SystemVerilog DV of a RISC-V register file with fault injection and coverage analysis
This project implements and verifies a 32×32 RISC-V-compatible register file in SystemVerilog. It includes directed and randomized tests, fault injection (stuck-at, bit-flip), and functional coverage analysis using simulation tools like EDA Playground and QuestaSim.
- RISC-V-compliant 32×32 register file
- Functional verification with directed and randomized testbenches
- Dual-read / single-write support with write-first semantics
- Register x0 hardwired to zero (per RISC-V spec)
- Fault modeling with:
- Stuck-at-0 and stuck-at-1 faults (single and multi-bit)
- Bit-flip faults (randomized and deterministic)
- Functional and fault coverage metrics
- Regression test automation
- SystemVerilog simulator: QuestaSim or EDA Playground
- (Optional) GTKWave for waveform visualization
- Git, make (for script-based runs)
- Upload
regfile.sv
andtb_regfile.sv
- Set tool to Questa / ModelSim
- Enable waveform and run simulation
# Compile RTL and testbench vlog
../rtl/regfile.sv ../tb/tb_regfile_cv.sv
# Simulate vsim
-c work.tb_regfile_cv -do "run -all; quit"
- Stuck-at Faults: Force register bits to 0 or 1 and detect mismatches
- Multi-bit Faults: Inject burst errors (e.g., 3 bits in x27) to simulate radiation hits
- Bit-Flip Faults: Flip bits randomly or deterministically to emulate soft errors
The RISC-V register file successfully passed all functional tests, including both directed and randomized verification scenarios. Directed tests confirmed architectural correctness for key behaviors such as:
- Writes to general-purpose registers
- Enforcement of x0 hardwiring
- Read-after-write behavior (write-first semantics)
- Overwrite scenarios and simultaneous access patterns
A randomized test campaign of 10,000 stimuli vectors demonstrated 100% functional correctness with no assertion failures. The golden model mirrored every transaction, enabling cycle-accurate output comparison with the DUT. All mismatches were automatically flagged, and zero errors were reported during simulation.
To thoroughly evaluate the register file's robustness, we implemented a wide range of fault injection scenarios. A total of 2048 single-bit stuck-at faults were tested, covering all 32 bits across 32 registers with both stuck-at-0 and stuck-at-1 polarities. For deterministic bit-flip faults, 1024 unique cases were injected—one for each bit in the 32×32 register array—to simulate transient errors. Additionally, we executed multi-bit fault scenarios, injecting combinations of 2 to 3 simultaneous bit errors to replicate burst-like failures; approximately 100 targeted cases were analyzed. Finally, over 10,000 randomized bit-flip cases were simulated to emulate soft errors under stochastic conditions. This comprehensive fault model library ensures that both isolated and systemic vulnerabilities are exercised, analyzed, and validated through comparison with a golden reference model.
- Deterministic Bit-Flip Faults achieved 100% detection and 100% coverage, validating all bit locations across the 32×32 register array.
- Multi-bit faults revealed edge cases and latent propagation paths that were not visible in single-bit scenarios.
- Random bit-flip tests showed diminishing returns in coverage despite high injection counts, indicating the importance of strategic fault modeling.
- Tollec et al., Exploration of fault effects on formal RISC-V models, IEEE FDTC 2022
- Molina-Robles et al., Functional verification flow for RISC-V, IEEE PRIME-LA 2020
- Barbirotta et al., Fault resilience analysis of RISC-V design, IEEE DFT 2020
- Liew Y.H., RISC-V design verification with UVM, UTAR Thesis 2022
- Camille Chang — [email protected]
- Chi-Yun (William) Wang — [email protected]
- Yating Chang — [email protected]
- Zherong Yu — [email protected]
This project is released for academic and educational use. For commercial or research adoption, please contact the authors.
Thanks to the UC Davis EEC 283 course and faculty for guidance on functional verification methodology and simulation tooling.