Running Renode

Tips for running Renode

Automatically Start Renode Script

To streamline firing-up renode, use the -e flag to execute onload:

renode "i @sim/config/shodan.resc; start"

This will start the renode script (resc) automatically.

Make sure to follow with "i @path/to/file.resc; start where the path starts after $ROOTDIR (don't include the $ROOTDIR in the path).

Using Headless Mode

To utilize without the pop-up renode consoles, utilize two flags:

  1. --disable-xwt -- to prevent the windows from opening
  2. --port 1234 -- or port of choice for prompt access

This can be combined with the -e flag:

renode --disable-xwt --port 1234 -e "i @sim/config/shodan.resc; start"

In a separate terminal window (or tmux pane), start a telnet at that port for prompt access:

telnet 127.0.0.1 1234

Using this should create the following prompt:

$ telnet 127.0.0.1 1234
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Renode, version 1.12.0.15824 (acb8f5b5-202201050847)

(monitor) i @sim/config/shodan.resc
(machine-0)  start
Starting emulation...
(machine-0)

Quitting Headless Renode Session

To quit the session, just type quit into the telnet prompt:

(machine-0) quit
Renode is quitting
Connection closed by foreign host.

This will quickly exit both telnet and the renode process on this port.

Opcode statistics and trace

Renode allows the user to collect opcode statistics during execution. The function is defined here.

Some typical usages:

  • cpu EnableRiscvOpcodesCounting: with no parameters -- it'll take instruction set extensions for the CPU as defined in the repl file and enable opcodes counting for all of them

    • It is enabled by default in sim/config/springbok.resc.
    • “cpu” can be changed to the cpu variable with the stats enabled. For example, in sim/config/springbok.resc it is sysbus.cpu2.
  • cpu EnableRiscvOpcodesCountingFromEmbeddedResource <extension>: Using the riscv-opcodes files embedded into Renode. The list of available resources can be retrieved with:

cpu GetRiscvOpcodesEmbeddedResourceNames
  • cpu GetAllOpcodesCounters: Return a nicely formatted table to be printed out in Renode.
  • cpu SaveAllOpcodesCounters @path/to/file: Dump counter data to a file.
  • cpu ResetOpcodesCounters: Reset all counters to 0
  • cpu ExecutedInstructions: Report number of instructions executed since the cpu reset