How openhwgroup/cva6 works
Project Type and Purpose
• This is a hardware micro-architecture project: a 6-stage, single-issue, in-order RISC-V CPU core (CVA6) and its integration into an APU (CORE-V-APU) for simulation, FPGA emulation, and ASIC synthesis. It contains:
• RTL (SystemVerilog) for the core (core/) and APU wrapper (corev_apu/)
• CI and build scripts (ci/, .github/, Makefile)
• Configuration generators (config/)
• Verification environment (verif/) with UVM, testbenches, directed tests, regressions
• Documentation (docs/) and performance model (perf-model/)
Key Architectural Elements from File Structure & README
• core/: pipeline modules organized by function (frontend, decoder, issue, execute, LSU, commit, cache_subsystem, MMU, PTW, branch predictor, CSR file)
• common/: shared utilities and SRAM wrappers
• corev_apu/: APU testbench wrapper, bus interfaces (AXI, APB), peripherals (bootrom, UART, CLINT, PLIC), FPGA scripts
• verif/: UVM testbench, simulation harness (Verilator, VCS, Spike), directed & random tests, regressions
• pd/synth/: ASIC synthesis flow scripts (DC, timing)
• perf-model/: Python performance model of the core
Main Components
A. CVA6 Core
• Pipeline stages (IF, ID, EX, MEM, WB/commit)
• Frontend: fetch, branch predictor (BTB, BHT), instruction queue, compressed decoder
• ID/Decode: decoder, register file
• EX: ALU, multiplier, FPU wrapper, AMO unit
• MEM: LSU, DCache controller (write-through/ write-back variant), MMU (TLB + PTW)
• Commit: scoreboard, CSR unit, performance counters
• Interfaces:
– AXI interface (axi_shim.sv) to cache_subsystem → system bus
– RVFI interface for trace output
– External debug DTM/JTAG module
B. APU & System Integration (corev_apu/)
• AXI interconnect: connects CVA6 core’s AXI ports to DDR controller, bootrom, peripherals
• APB bridge: PLIC (interrupt controller), CLINT (timer & software interrupts), UART, GPIO
• Boot ROM and device-tree loader
• FPGA wrapper scripts (Vivado, Quartus)
C. Verification & Simulation Environment (verif/)
• Testbench harness (Verilator + C++ DPI, UVM agents) instantiating corev_apu/testharness.sv
• Spike ISS comparator, python orchestration (cva6.py)
• Directed & random test suites (riscv-dv, riscv-compliance, riscv-tests)
• Waveform controls, regression scripts
D. ASIC Flow (pd/synth/)
• Synthesis Tcl scripts (cva6_synth.tcl)
• Gate-level netlist analysis
E. Performance Model (perf-model/)
Relationships & Data Flows
• Instruction fetch flows from ICache → frontend → decoder → issue
• Data load/store flows through DCache → AXI interconnect → DDR
• MMU TLB lookups for both I/D side, PTW requests on miss
• CSR & debug register accesses via AXI/APB to CLINT/PLIC or JTAG DTM
• UVM agents drive/monitor AXI, RVFI, CSR interfaces
• Spike ISS and python scripts compare trace to RTL output