55/*
66RISCV emulator for the RV32I architecture
77based on TinyEMU by Fabrice Bellard, see https://bellard.org/tinyemu/
8- stripped down for RV32I only, all "gotos" removed, and fixed some bugs for the compliance test
9- by Frank Buss, 2018
8+ stripped down for RV32I only, all "gotos" removed, and fixed some bugs for the
9+ compliance test by Frank Buss, 2018
1010
1111Requires libelf-dev:
1212
@@ -18,10 +18,12 @@ Compile it like this:
1818gcc -O3 -Wall -lelf emu-rv32i.c -o emu-rv32i
1919
2020
21- It is compatible to Spike for the command line arguments, which means you can run
22- the compliance test from https://github.com/riscv/riscv-compliance like this:
21+ It is compatible to Spike for the command line arguments, which means you can
22+ run the compliance test from https://github.com/riscv/riscv-compliance like
23+ this:
2324
24- make RISCV_TARGET=spike RISCV_DEVICE=rv32i TARGET_SIM=/full/path/emulator variant
25+ make RISCV_TARGET=spike RISCV_DEVICE=rv32i TARGET_SIM=/full/path/emulator
26+ variant
2527
2628It is also compatible with qemu32, as it is used for Zephyr. You can compile the
2729Zephyr examples for qemu like this:
@@ -73,19 +75,19 @@ original copyright:
7375// ====================================================== //
7476// =================== User Trap Setup ================== //
7577// ====================================================== //
76- uint32_t ustatus ; /* User status register */
77- uint32_t uie ; /* User interrupt-enable register */
78- uint32_t utvec ; /* User trap handler base address */
78+ uint32_t ustatus ; /* User status register */
79+ uint32_t uie ; /* User interrupt-enable register */
80+ uint32_t utvec ; /* User trap handler base address */
7981// ====================================================== //
8082// ================= User Trap Handling ================= //
8183// ====================================================== //
82- uint32_t uscratch ; /* Scratch register for user trap handlers*/
83- uint32_t uepc ; /* User exception program counter */
84- uint32_t ucause ; /* User trap cause*/
85- uint32_t ubadaddr ; /* User bad address */
86- uint32_t uip ; /* User interrupt pending */
84+ uint32_t uscratch ; /* Scratch register for user trap handlers*/
85+ uint32_t uepc ; /* User exception program counter */
86+ uint32_t ucause ; /* User trap cause*/
87+ uint32_t ubadaddr ; /* User bad address */
88+ uint32_t uip ; /* User interrupt pending */
8789// ====================================================== //
8890// ============== User Floating-Point CSRs ============== //
8991// ====================================================== //
90- uint32_t fflags ; /* Floating-Point Accrued Exceptions*/
91- uint32_t frm ; /* Floating-Point Dynamic Rounding Mode*/
92+ uint32_t fflags ; /* Floating-Point Accrued Exceptions*/
93+ uint32_t frm ; /* Floating-Point Dynamic Rounding Mode*/
0 commit comments