NJU-ProjectN / nemu

NJU EMUlator, a full system x86/mips32/riscv32/riscv64 emulator for teaching
Other
859 stars 184 forks source link

cpu: flip byte order of instructions printing #27

Closed LeoJhonSong closed 2 years ago

LeoJhonSong commented 2 years ago

考虑到教程默认我们使用的机器是小端序的, 我建议在exec_once()中输出指令hex时按指令长度翻转一下, 从 image 变成 image

比如对于RV32这样操作数长度为7位, 而不是整字节长度的指令集来说, 按内存数组地址递增顺序按字节打印指令并没有太大意义 (甚至一开始误导了我) 😂

sashimi-yzh commented 2 years ago

感谢建议! x86是按顺序打印的, 所以一直没改这里 :) 以后把x86加回来的时候再加上条件编译吧