← 返回命令列表

Linux command

spike 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Run simulator

spike [program.elf]

With ISA extension

spike --isa=rv64gc [program.elf]

Interactive debug

spike -d [program.elf]

Simulate with 4 cores

spike -p4 [program.elf]

With memory configuration

spike -m0x80000000:0x10000000 [program.elf]

Log executed instructions

spike -l --isa=rv64gc [program.elf]

说明

spike is the official RISC-V ISA (Instruction Set Architecture) reference simulator. It provides instruction-accurate emulation of RISC-V processors, supporting both RV32 and RV64 base integer instruction sets along with standard extensions including M (multiply/divide), A (atomic), F/D (floating-point), and C (compressed). The simulator includes an interactive debug mode for stepping through instructions, setting breakpoints, and inspecting registers and memory. It supports multi-core SMP simulation with configurable processor counts and memory layouts, making it suitable for testing both bare-metal firmware and operating system kernels. As the reference implementation maintained by the RISC-V project, spike serves as the golden model for verifying hardware implementations and compiler output against the specification.

参数

--isa _SPEC_
ISA specification.
-d
Debug mode.
-p _N_
Number of processors.
-m _RANGE_
Memory configuration.
--pc _ADDR_
Start address.
-l
Log executed instructions
-g
Track histogram of PCs
-h
Print help message
--ic= _S:W:B_
Instantiate instruction cache (sets:ways:blocksize)
--dc= _S:W:B_
Instantiate data cache (sets:ways:blocksize)
--l2= _S:W:B_
Instantiate L2 cache (sets:ways:blocksize)

FAQ

What is the spike command used for?

spike is the official RISC-V ISA (Instruction Set Architecture) reference simulator. It provides instruction-accurate emulation of RISC-V processors, supporting both RV32 and RV64 base integer instruction sets along with standard extensions including M (multiply/divide), A (atomic), F/D (floating-point), and C (compressed). The simulator includes an interactive debug mode for stepping through instructions, setting breakpoints, and inspecting registers and memory. It supports multi-core SMP simulation with configurable processor counts and memory layouts, making it suitable for testing both bare-metal firmware and operating system kernels. As the reference implementation maintained by the RISC-V project, spike serves as the golden model for verifying hardware implementations and compiler output against the specification.

How do I run a basic spike example?

Run `spike [program.elf]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --isa _SPEC_ do in spike?

ISA specification.