jlpteaching / dinocpu

A teaching-focused RISC-V CPU design used at UC Davis
BSD 3-Clause "New" or "Revised" License
143 stars 38 forks source link

Add display and undisplay commands to singlestep runner #123

Closed klanmiko closed 4 years ago

klanmiko commented 4 years ago

Use case: While stepping through programs on the dinocpu, it is helpful to know the instruction at pc. Usually a user would call print inst. However, this would have to be called after every step. GDB and most debuggers have a display function that stores a list of expressions to print after every step.

The goal of this PR is to add display functionality to the single-stepper. doDisplay is run after each successful step, and there is a displayList: ArrayBuffer[Array[String]] in main that stores all the commands to display, directly from input. displayCommandOkay is used as an input validation guard in the command pattern matching part of main.

powerjg commented 4 years ago

This is awesome! Could you please update the single-stepper documentation with how to use this new feature?

klanmiko commented 4 years ago

I've updated the documentation and merged in Kevin's changes

powerjg commented 4 years ago

Can you rebase this on top of master? I prefer rebases to merges :).

I tried doing it myself, but when I did the 'display" command didn't work.

See https://github.com/jlpteaching/dinocpu/tree/klanmiko-singlestep-enhance for what I tried :)

klanmiko commented 4 years ago

I've hammered away the merge commit with a rebase.

It looked like your rebase should have worked. The display command returns silently if there was no error, and will print the value on the next step. Idk if this should be mentioned in the documentation?

powerjg commented 4 years ago

Thanks!