docs: Update Renode doc * Update resource file path in the example * Add opcode statistics information Change-Id: I4b4e40191ffa285279cf9b876ab0587f6897aa3a
diff --git a/RenodeUsageNotes.md b/RenodeUsageNotes.md index de99340..8ff9d7a 100644 --- a/RenodeUsageNotes.md +++ b/RenodeUsageNotes.md
@@ -7,7 +7,7 @@ To streamline firing-up renode, use the `-e` flag to execute onload: ``` -renode "i @sim/config/shodan_hellovector.resc; start" +renode "i @sim/config/shodan.resc; start" ``` This will start the renode script (resc) automatically. @@ -24,7 +24,7 @@ This can be combined with the `-e` flag: ``` -renode --disable-xwt --port 1234 -e "i @sim/config/shodan_hellovector.resc; start" +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 @@ -39,9 +39,9 @@ Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. -Renode, version 1.10.1.31213 (773406ba-202011051557) +Renode, version 1.12.0.15824 (acb8f5b5-202201050847) -(monitor) i @sim/config/shodan_hellovector.resc +(monitor) i @sim/config/shodan.resc (machine-0) start Starting emulation... (machine-0) @@ -58,3 +58,30 @@ ``` 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](https://github.com/renode/renode-infrastructure/blob/master/src/Emulator/Cores/RiscV/RiscvOpcodesParser.cs). + +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: + +```bash +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