Resources
Please Log In for full access to the web site.
Note that this link will take you to an external site (https://shimmer.mit.edu) to authenticate, and then you will be redirected back to this page.
We've provided a RISC-V debugger for you to use as you work through RISC-V programming questions.
Enabling the debugger
To enable the debugger, you must add a breakpoint to your program, then "submit" your code.
- If your program has no breakpoints, it will be treated like a normal submission (you will receive a grade and see how your code performed against the test cases.)
- When the debugger is enabled, your code won't receive a grade (you'll automatically get 0%) -- you must remove all breakpoints to receive a grade for your program.
Setting breakpoints
You may be curious about the state of your program after a certain instruction. Breakpoints can help here -- they will tell the program to stop when it reaches them.
Set a breakpoint in your code by adding the instruction csbreak to your program wherever you'd like.
For example, if you have a program:
addi x5, x5, 1
xor x6, x5, -1
slli x7, x5, 3
and you are curious about what value will be in x6 after the xor instruction, you can place a breakpoint like so:
addi x5, x5, 1
xor x6, x5, -1
csbreak
slli x7, x5, 3
Using the debugger
If the debugger is enabled, after submitting you should see a red box stating that you're in debug mode, and a button saying "Show/Hide Debugger". Click on this button to reveal the debuggers (there is one for every test case).
The debugger will start paused at the beginning of your program. You can see what instruction your program is on in the "Program" window.
Step
The step button will move the program to the next instruction. This button will be disabled once you reach the end of your program.
Continue
The continue button will move the program to the next breakpoint (csbreak), or to the end of the program if there are no remaining breakpoints. This button will be disabled when you reach the end of your program.
Reset
The reset button will bring you back to the beginning of the program.
Registers
You can see the values of all of the registers by expanding the "Registers" section.
Memory
You can explore memory by expanding the "Memory" section. You can also use the search bar to search for a specific address in memory.
Stack
You can see how the stack evolves throughout your program in the "Stack" window.
Done debugging?
Make sure to remove all csbreak instructions before submitting in order to exit debug mode and receive a grade!