This changes how much code the compiler emits, often by several
times over. -O0 keeps every C statement separate and
-O3 unrolls and inlines, so both are usually the largest;
-Os is the smallest.
Making sure it still fits the hardware
The program has to fit the instruction memory the processor
actually has. In this simulator that limit is Code (.text)
size in Settings → Linker; on the FPGA it is set by
IROM_DEPTH_BITS in Wrapper, and the two
have to agree. The status bar reports the size after every
assemble, and says by how many words the program overruns if it
does. Raising the optimisation level, or raising both limits
together, are the two ways out — raising only the linker
setting will build here and then silently truncate on hardware.
💡 Note: C source code is compiled online via Compiler Explorer (Godbolt) REST API
Base addresses and segment sizes (hex). Stack top (sp) defaults to Data Base + Data Size, but can be customized. Applying reloads the program with the new layout.
⚠️ The segment sizes should not exceed the memory size provisioned in hardware.
Both engines
Step and Back move a whole C statement or pseudo-op expansion at a time, not one machine instruction.
Clock
CLK_DIV_BITS
3.13 MHz
JavaScript model
Maximum number of instructions executed per run before pausing. Default: 100,000,000.
Your Verilog is compiled on this computer and never uploaded. Files you drop
here last for this session; a folder is remembered.
Processor sources
Drop your .v files here, or
Include Wrapper, RV and every submodule.
You can also drop them anywhere on the page, or open them with 📂 Open.
None of the loaded files declares module Wrapper. The generated
testbench instantiates Wrapper by name, so add the file that declares it.
Simulation
Clock cycles a fresh Run records, and how many more each Resume adds.
Recording & output
Needed for Step, Back, breakpoints and the Registers panel. About 30% of the run time.
For the waveform view and the VCD download. About 30% of the run time.
Reports the first instruction where your hardware and the functional model
disagree. Costs a second execution.
Synthesises your core with Yosys and checks the netlist against your RTL.
Slow: 20–35 s each time the Verilog changes, then a second, slower run.
A Run is simulated in one go and cannot be paused.
What this does, and the one-off download
Every run is simulated twice: once as you wrote it, and once as the
gate-level netlist Yosys produces. The two are compared and the first point
where they differ is reported — which is what an inferred latch, an
incomplete sensitivity list or a race between blocking assignments looks
like. The panels keep showing the RTL run, so stepping and the register view
are unaffected; register writes are not compared, because synthesis leaves
no register array to read.
Ticking this downloads the synthesiser the first time you use it (about
13 MB). Nothing is fetched until you tick it, and your browser caches
it for a year, so later sessions start immediately. Synthesis takes 20–35
seconds and is redone only when your Verilog changes.
Register filedetected automatically
load your sources to detect the register file
How HDL mode works
The assembled program reaches your Wrapper as AA_IROM.mem and
AA_DMEM.mem through its own $readmemh — assemble first, then run.
Run records the whole simulation; Step and Back then move through that
recording, so stepping is instant and works in both directions. Run becomes
Resume once there is a recording — it continues to the next breakpoint, and
records another Cycles worth when it reaches the end. Reset is how you
start the hardware over.
Changing a DIP switch, a button, the accelerometer or the UART input while paused is
timestamped at the current cycle and the run replayed — everything before that point
comes out identical, so you keep your place, and the very next instruction already
sees the new value.
RVEduSim is open source, at github.com/r-panicker/RVEduSim. A desktop app for Windows, macOS
and Linux, with native Icarus Verilog and Verilator, can be downloaded from its
Releases page.
The MMIO layout and ecall system call services follow the conventions of
RARS,
the RISC-V Assembler and Runtime Simulator.
The microarchitecture terminology and some of the general ideas follow Sarah L. Harris and
David Harris, Digital Design and Computer Architecture: RISC-V Edition. The datapaths
here are a different design from the book's.
The code editor is CodeMirror
6, and C is compiled by Compiler Explorer. HDL mode runs on Icarus Verilog, compiled to WebAssembly by
verisim.
The desktop app runs Icarus natively and can use
Verilator instead,
with Zig as the C++ compiler
where none is installed. Post-synthesis simulation runs on Yosys, compiled to WebAssembly by
YoWASP.
Feedback and bug reports are welcome: rajesh<at>nus.edu.sg.
RVEduSim: RISC-V Functional and HDL Simulator
ReadyCycles: 0 | Instr: 0 | PC: 0x00400000
0/0
#
ABI Name
Content (Hex)
Content (Dec)
Variable
Address
Content (Hex)
Content (Dec)
Full word (LSB to the right) · Editable
AddrContent (Hex)Content (ASCII)
LEDs (LED[15:0]) & DIP Switches (SW[15:0])
PC[8:2] (LED[15:9])CLK (LED[8])User OUT (LED[7:0]) 0xFFFF0060 WO
DIP Switches 0xFFFF0064 RO (SW15..SW0)
Push Buttons 0xFFFF0068 RO
BTNL | BTNC | BTNR — click to toggle, or hold J K L