12.10 16.10b Open Source Verification Platform For RISC V Processors
12.10 16.10b Open Source Verification Platform For RISC V Processors
● Roadmap
RISCV-DV
SV/UVM based open source RISC-V instruction generator
https://github.com/google/riscv-dv
Random instructions
Page tables
PT 0 PT 2
PT 1 PT 3
PT 4
mem_0
HINT Section mem_0
mem_2
Type of illegal instructions:
Reserved opcode Use cases:
Unsupported instruction Access various internal memories
CSR access to unsupported CSR PMP verification
Operation in the wrong privileged mode Virtual address translation verification
...
Debug mode support
Debug mode test scenarios
ebreak handler
Normal program
... > ebreak with dcsr.ebreakx enable/disable
ebreak
... > Enter debug mode through external debug request
External
debug mret
> Access non debug mode CSR in debug mode
request
> ebreak in debug ROM
ebreak Debug ROM
> Exception in debug ROM
dpc check
> Single step debug mode
randomize dcsr
> ….
?
save GPR
...
ebreak How to check the processor’s behavior if
... ISS cannot be put to debug mode the
same time as RTL design?
Restore GPR
dret
Handshake mechanism
Handshake packet definition CORE_STATUS : 0
TEST_RESULT: 1 Testbench Normal program Debug ROM
24 bits 8 bits
WRITE_GPR : 2
debug re
data cmd WRITE_CSR : 3 quest
ISS
ISSlog
log log2csv
ISS loglog
whisper
Functional coverage model
● Cover all possible operands of each instruction
● Hazard conditions
● Corner cases like overflow, underflow, divide by zero
● Aligned/unaligned load/store
● Positive/negative immediate value
● Forward/backward branches, branch hit history
● Hint instruction
● Illegal instruction
● All opcode
● Access to all implemented privileged CSR
● Exception and interrupt
Generator performance improvement
test_0, batch 1, 20 iterations
35s
test_0, batch 2, 20 iterations
test_0, 100 iterations
Average test generation time (s) Run large regression in parallel with small batches
YAML based end-to-end verification flow
An ecosystem for RISC-V processor verification
iss.yaml
simulator.yaml
Generate
RISC-V Assembly test
Assembly test
assembly Assembly test simulator.yaml
Assembly test
tests
# Run the generator with two ISS and cross compare the result
python3 run.py --iss ovpsim,spike
SPIKE RV32I
RV32IMC
RV64IMC
RV64GC
Sail-RISCV ...
Case study: Ibex core verification
Source code: https://github.com/lowRISC/ibex/tree/master/dv/uvm
Ibex features
RV32IMC + Debug mode +
User mode + PMP + ….
Case study : Ibex core verification
Environment
Action
testlist.yaml Improve the generator controllability
riscv-config
Generator flow
Initialization routine Test completion section
Pulpino RI5CY:
4 stages, RV32-IMC, DSP extension
Pulpino Ariane :
6-stage, RV64-IMC, single issue,
in-order, support M/S/U privileged levels
Merlin:
Open Source RV32I[C] CPU
ISS simulator
Spike
Benchmark metrics
Bug hunting capability, test coverage
Flow integration effort, performance
Ariane core architecture
Bugs found
LSU
wr rd
Fence
Issue
Load SSTATUS mxr ... ALU
Store
...
Load MSTATUS mxr ...
Load Multiplier
Cache line access racing privileged CSR access FENCE operation failure
PT 0 PT 2
Load Branch Add ... Mult MULHSU
PT 1 PT 3
PT 4
page fault handling Incorrect branch execution ALU corner case bug
Handshake packet format
IN_DEBUG_MODE 0 CORE_STATUS
TEST_PASS 1 TEST_RESULT
MSTATUS 2
WRITE_GPR: MSTATUS
0x0000_1234