eliben / luz-cpu

Educational open-source CPU suite (with assembler, linker and simulator)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Show disassembly in the simulator's interactive shell

holmak opened this issue · comments

It would be useful to be able to see disassembled code in the simulator's interactive shell. I implemented a command to do this. (See diff.) If you are interested, I can submit a pull request.

Sample session:
(I didn't modify the "show memory" command; it is just included for comparison.)

$ python run_test_interactive.py -i loop_simple

LUZ simulator started at 0x00100000

[0x00100000] [lui $sp, 0x13] >> m 0x100000
0x00100000:   1300A01B   FCFFBDAB   03000474   10002019
0x00100010:   3C0029A9   0000A93C   1000C018   4000C6A8
0x00100020:   0028A600   00000001   0000E640   00380801
0x00100030:   0100C680   FDFFC594   000000FC   10000000
[0x00100000] [lui $sp, 0x13] >> d
0x00100000:   1300A01B   lui $sp, 0x13
0x00100004:   FCFFBDAB   ori $sp, $sp, 0xFFFC
0x00100008:   03000474   call 0x40003 [0x10000C]
0x0010000C:   10002019   lui $t1, 0x10
0x00100010:   3C0029A9   ori $t1, $t1, 0x3C
0x00100014:   0000A93C   lw $a1, 0($t1)
0x00100018:   1000C018   lui $a2, 0x10
0x0010001C:   4000C6A8   ori $a2, $a2, 0x40
[0x00100000] [lui $sp, 0x13] >> d 0x100008 3
0x00100008:   03000474   call 0x40003 [0x10000C]
0x0010000C:   10002019   lui $t1, 0x10
0x00100010:   3C0029A9   ori $t1, $t1, 0x3C
[0x00100000] [lui $sp, 0x13] >>

Yes, this looks useful. Please submit a PR