Search code examples
riscvrars-simulator

RISC-V educational hexacode listing


I want to change my educational-purpose simulator from Y86 to RISC-V. I like the Y86 combined hexacode+listing file, like

                      | # Execution begins at address 0 
  0x000:              |     .pos 0 
  0x000: 30f400010000 | init:   irmovl Stack, %esp      # Set up stack pointer  
  0x006: 30f500010000 |     irmovl Stack, %ebp      # Set up base pointer   
  0x00c: 8024000000   |     call Main       # Execute main program
  0x011: 00           |     halt            # Terminate program 

Is there something similar around for RISC-V?


Solution

  • RARS has a view which shows address, hexcode, elementary instruction and source code side by side.

    Execution view of a bottles of bear program

    You can likely get a similar hexcode/source view in the terminal using GNU standard tools (like objdump) that have RISC-V support.

    Additionally there is https://github.com/michaeljclark/riscv-disassembler which may serve your needs.

    Disclaimer: I am main author and maintainer of RARS.