Skip to content

9oelM/risc-v-web-simulator

Repository files navigation

risc-v-web-simulator

Yet another RISC-V Simulator on the web, for fun. Based on Kite, RISC-V architecture simulator I used for my computer architecture class (EEE3530) at Yonsei University. Turned it into Webassembly to use it on web. Again, it's just for fun.... and probably education. Lol.

Use it!

https://riscv.vercel.app/

Instructions

Detailed instruction on how to use it is found at the repository of Kite.

Developing

Modification of Kite's code

To enable communication with javascript from Webassembly binary, a few things have been changed in Kite's code:

  • Kite does not receive files as an input anymore. It receives const char* program_code, const char* memory_state, const char* reg_state as parameters and runs it. const char* is directly supplied from javascript.
  • No more build flags (-DDEBUG, -DDATA_FWD, -DBR_PRED); They are also directly supplied from javascript as well.
  • Kite throws error instead of cerr and exit(1);. For example:
    if(val != 1) {
        throw std::logic_error("Cache Error: number of sets must be a power of two");
    }
    This allows javascript to catch an error and display the error message.
  • Emscripten is used to compile C++ into Webassembly. More details in compile.sh.

Todo

  • cleanup duplicate css styles (now just copied and pasted cuz im lazy)

References