d-iii-s / msim

Light-weight MIPS R4000 and RISC-V system simulator
https://d3s.mff.cuni.cz/software/msim/
GNU General Public License v2.0
5 stars 5 forks source link

Add `nomem' device #45

Closed vhotspur closed 1 year ago

vhotspur commented 1 year ago

The dnomem device represents a memory region where any reads or writes terminates with simulation failure.

The device is meant as a debugging aid to ensure our code is not accessing non-existent memory.

The device operates in three modes. In the default warn mode, attempts to access are printed to console but the simulation continues. In debug mode, the simulation is switched to interactive mode after each access. And in halt mode, the simulation is immediately terminated.

lbulej commented 1 year ago

This looks great!

Just a minor point—is there a way to print the address of the instruction that caused the access? Or perhaps one of the modes could be register dump.

However, I suspect that either of the above could be an internal API problem and switching the device to break mode allows the user to dump the registers from the interactive shell, so I would say let's merge it :-)

vhotspur commented 1 year ago

Just a minor point—is there a way to print the address of the instruction that caused the access? Or perhaps one of the modes could be register dump.

Done.