-
Notifications
You must be signed in to change notification settings - Fork 2
Simulator
The Simulator is the main component of venus.
The following controls are available:
- Run / Stop: runs the program until it terminates or a breakpoint is hit. While running, the program can be stopped by clicking it again.
- Step: executes the highlighted instruction.
- Prev: undo the previously executed instruction.
- Reset: resets the simulator to its initial state (equivalent to reassembling the program).
The program view displays the assembled program. It contains three columns:
- Machine Code: the machine code of the instruction in hexadecimal.
- Basic Code: the assembly code after pseudoinstruction expansion and linking.
- Original Code: the original code in the program.
The instruction which is about to be executed is highlighted in green.
In order to add a breakpoint, simply click on the instruction. This will cause the row to be highlighted red, indicating that a breakpoint has been set. To remove the breakpoint, click it again.
Another option is if you always want to break at a certain point in the code, you can just put an ebreak
where you want the debugger to stop at. The debugger will stop just before it executes the instruction after the ebreak
.
The register tab displays the values of the current registers. The most recently changed register is highlighted in blue. In addition, the registers values can be edited.
The memory tab shows the bytes currently in memory.
The Jump to select box allows jumping to a memory segment.
The Up / Down buttons scroll the memory view. Up moves towards higher addresses, and down moves towards lower addresses.
The Address box allows you to jump to a specific address of memory.
The display settings can be used to change how values are displayed. By default, values are displayed in unsigned hexadecimal.
- Hex (default) - display as unsigned hexadecimal.
- Decimal - display as signed decimal.
- Unsigned - display as unsigned decimal.
-
ASCII - display as ASCII character, surrounded by single quotes.
- If the number is too big (not between 0 and 255), it is displayed as hex instead.
- Anything which is in ASCII but not printable is displayed as the unicode replacement glyph: �
The console output is used for ecalls and displaying any errors which occur.
The web version will now display an exit code when the program finishes. This may be due to the program calling an ecall or the PC counter going beyond the loaded text section. If your program goes beyond the program’s text, it will determine the exit code from the register a0
. You can think of it as returning an int from main. The JV version will actually cause Venus to exit with that error code. Note that Venus jvm currently exits with a -1
error code when an internal error occurs (aka. Assembly error).
- Currently maintained by CS 61C Course Staff
- Originally made by kvakil and ThaumicMekanism