/runcool-emulator

runcool is an emulator of a simple 16-bit computer designed to execute programs compiled from the esoteric programming language cool.

Primary LanguageC

runcool

Final grade: 94%

CITS2002 Project 1

Due date: 11:59pm Friday 17th September (end of week 7)

Grade weighting: 25%

runcool.c is an emulator of a simple 16-bit computer designed to execute programs compiled from the esoteric programming language cool.

To compile runcool.c:

cc -std=c11 -Wall -Werror -o runcool runcool.c

To run runcool program with a cool executable:

./runcool program.coolexe

To compile cool source files use the script cool-executables/coolc.sh:

./coolc.sh program.cool

This will output cool-executables/program.coolexe. Run this command in cool-executables/ folder to avoid clogging up the main directory.

Useful Links

Project info:

cool language info:

Misc.:

Todo

  • Create starter todo list
  • Get basic test cases
  • Appreciate Chris McDonald
  • Check this thread on how cache handles main memory addresses. Check off when we know the answer
    • Read a chapter on cacheing as recommended in that post
  • Add names and student numbers to code comment
    • Check how this should be formatted
  • Check if compiler flags are same for gcc and clang, otherwise we got a problem
  • Implement read_coolexe_file()
    • Figure out how thats supposed to work
  • Implement asm instructions in execute_stackmachine()
    • Implement halt
      • Check if starter code already has this fully implemented
    • Implement nop
    • Implement add
    • Implement sub
    • Implement mult
    • Implement div
    • Implement call (hard?)
      • Get head around the PC and FP and SP switching for this
    • Implement return
    • Implement jmp
    • Implement jeq (hard?)
    • Implement printi
    • Implement prints
    • Implement pushc
    • Implement pusha
    • Implement pushr
    • Implement popa
    • Implement popr
  • Check if implementation works for recursive functions. Easier to do once we have print and jeq done.
  • Implement statistics measuring
    • Measure memory reads
    • Measure memory writes
    • Measure cache memory hits
    • Measure cache memory misses
  • Figure out how cache memory plays into this. They keep mentioning it but not explaining it (yet)
  • Do cache
  • Write & compile some more complex cool test cases