How riscv-stc/riscv-isa-sim works
Spike is a functional RISC-V ISA simulator. The primary workflow is to invoke spike with a RISC-V program, configure simulated harts and memory, execute instructions, and observe results through logs or debugging. The graph also retains documented instruction-set coverage, disassembly, interactive debugging, and remote GDB support. Several implementation links are necessarily omitted or marked unverified: the excerpts show only parts of the CLI and runtime, so they do not establish all internal calls or program-loading paths.
Main entry points: spike.cc Spike CLI · sim.h Simulation · execute.cc Instruction execution · processor.cc Hart processor
Components 20
Simulation runtime
- Spike CLI
spike_main/spike.cc - Simulation
riscv/sim.h - Hart processor
riscv/processor.cc - Address translation
riscv/mmu.h - Memory and devices
riscv/devices.h
ISA modeling
- Instruction decoding
riscv/decode.h - Instruction execution
riscv/execute.cc - Instruction semantics
riscv/insns - ISA configuration
disasm/isa_parser.cc - Floating-point arithmetic
softfloat/softfloat.h
Inspection and debug
- Disassembly
disasm/disasm.cc - Interactive debug
riscv/sim.h - Debug module
riscv/debug_module.h - Remote bitbang
riscv/remote_bitbang.h
Host interface
- ELF loading
fesvr/elfloader.cc - Host target interface
fesvr/htif.cc - Guest syscalls
fesvr/syscall.cc
Other components
- Simulator user
- GDB and OpenOCD
- RISC-V program
Connections 20
- Simulator user → Spike CLI: invokes
- RISC-V program → Spike CLI: simulated by
- Spike CLI → Simulation: starts simulation
spike_main/spike.cc - Spike CLI → Address translation: configures memory
spike_main/spike.cc - Simulation → Hart processor: dispatches harts
- Hart processor → Instruction decoding: decodes instructions
- Hart processor → Instruction execution: executes instructions
- Instruction execution → Instruction semantics: uses semantics
- Instruction execution → Address translation: accesses memory
- Instruction execution → Floating-point arithmetic: uses arithmetic
- Spike CLI → ELF loading: loads program
- Simulation → Host target interface: communicates through
- Host target interface → Guest syscalls: handles guest calls
- Simulation → Memory and devices: models devices
riscv/sim.h - ISA configuration → Hart processor: configures ISA
- Simulator user → Disassembly: disassembles logs
- Simulator user → Interactive debug: enters debug mode
- GDB and OpenOCD → Remote bitbang: connects remotely
- Remote bitbang → Debug module: accesses debug module
- Spike CLI → Debug module: configures debugging