How chipsalliance/cores-veer-eh2 works
1. What this repository is
- This is the RTL for the VeeR EH2 32-bit RISC-V core, a machine-mode-only CPU with support for I, C, M, A, CSR, instruction-fetch fence, and subset bit-manipulation extensions.
- Architecturally it is a 9-stage, dual-threaded, dual-issue, mostly in-order superscalar pipeline with some out-of-order capability.
2. Top-level composition
- The core is assembled from a small set of major RTL blocks under design/: instruction fetch, decode/control, execution, load/store, debug, interrupts/privilege/timers, and memory/interface glue.
- The main integration points are design/eh2_veer.sv and design/eh2_veer_wrapper.sv, which act as the core and wrapper-level boundaries.
3. Pipeline subsystem
- design/ifu handles instruction fetch, branch prediction, alignment/compression handling, I-cache/ICCM access, and fetch control.
- design/dec performs instruction decode, CSR decode, register file control, trap/exception control, and trigger handling.
- design/exu contains the execution stage logic: ALU, multiply, and divide datapaths and their control.
- design/lsu implements memory operations, including address checking, AMOs, load/store buffering, ECC, bus buffering, store buffer, and DCCM access.
4. Control, privilege, and trap flow
- Decode and TLU-related blocks in design/dec centralize architectural control flow for exceptions, interrupts, CSRs, triggers, and retirement-related decisions.
- The presence of eh2_dec_tlu_*, eh2_dec_trigger.sv, and CSR-specific logic indicates a dedicated trap/privilege control boundary separate from the execution datapaths.
5. Memory hierarchy
- The design supports both internal tightly coupled memories and external bus-backed memory.
- design/ifu/eh2_ifu_iccm_mem.sv and design/lsu/eh2_lsu_dccm_mem.sv provide ICCM/DCCM implementations.
- design/eh2_mem.sv and library bridges in design/lib connect the core to external AHB/AXI-style system buses.
6. Bus and protocol boundaries
- The repo includes protocol conversion blocks (ahb_to_axi4.sv, axi4_to_ahb.sv) showing that the core can be integrated into either AHB- or AXI-oriented systems.
- The testbench and wrapper logic also indicate a clear distinction between core-internal memory paths and external memory/bus interfaces.
7. Debug and JTAG/DMI path
- design/dbg and design/dmi implement the debug architecture boundary: JTAG TAP, DMI transport, and synchronization into the core clock domain.
- This is a separate control plane from the normal instruction/data pipeline, used for debug access and possibly external run-control.
8. Interrupts, timers, and platform-specific control
- design/eh2_pic_ctrl.sv and related control blocks handle platform interrupt controller behavior.
- DMA control (design/eh2_dma_ctrl.sv) and memory/control glue indicate that the core can be coupled to system-level acceleration or memory-loading paths, especially for simulation and ICCM preload flows.
9. Configuration-driven build architecture
- configs/veer.config is a key architectural piece: it generates consistent parameter/header/linker artifacts in a snapshot directory.
- The generated snapshot contains design parameters, C headers, physical-design defines, a Perl config map, a PIC map, and a Whisper JSON file, which means the RTL, software build, and verification environment are all driven from one configuration source.
10. Verification and simulation environment
- testbench/ is a lightweight but important system-level boundary around the core.
- It provides a top-level simulation harness, AXI/AHB shims, remote bitbang/SimJTAG support, trace support, and a simple console/output mechanism for running software payloads.
- The testbench is not a full system model; it is focused on exercising the core with memory images and debug connectivity.
11. Software payloads and boot flow
- The repo includes assembly/C benchmarks and prebuilt HEX images under testbench/asm and testbench/hex.
- Simulation flow is centered on loading a program.hex image into the memory model or internal memories, then observing console output, execution trace, and optional waveform dumps.
12. Tooling and generation utilities
- tools/ contains support scripts and Makefile logic for decode generation, PIC mapping, JSON generation, and math/utilities used by the build flow.
- The mention of espresso for instruction decode generation is significant: instruction-set changes are not purely manual RTL edits; some decode artifacts are tool-generated.
13. Documentation and target variation
- configs/README.md, docs/RISC-V_VeeR_EH2_PRM.pdf, and release-notes.md document supported configurations and behavior.
- The repo supports several predefined targets such as default, default_mt, typical_pd, and high_perf, which mainly alter pipeline/memory/clock-gating and multi-thread configuration.
14. How to think about the architecture diagram
- The most accurate high-level diagram would show:
- a core pipeline split into IFU / Decode-TLU / EXU / LSU,
- a memory subsystem with ICCM/DCCM plus external bus interfaces,
- a debug plane via JTAG/DMI,
- and a configuration/build plane that generates parameters and software-visible headers.
- The primary boundaries are between pipeline stages, internal vs external memory, and normal execution vs debug/control flows.
Main entry points: eh2_veer.sv VeeR EH2 · eh2_dec.sv Decode/TLU · tb_top.sv Testbench top · eh2_ifu.sv Fetch
Components 18
RTL core
Main synthesizable core RTL and integration boundaries
- VeeR EH2 · Top-level core integration for pipeline, control, memory, and debug
design/eh2_veer.sv - Core wrapper · SoC-facing wrapper around the core and its external interfaces
design/eh2_veer_wrapper.sv - Fetch · Instruction fetch, branch prediction, alignment, compression, and I-cache/ICCM control
design/ifu/eh2_ifu.sv - Decode/TLU · Decode, CSR decode, register control, traps, triggers, and retirement control
design/dec/eh2_dec.sv - Execute · ALU, multiply, and divide execution datapaths and control
design/exu/eh2_exu.sv - Load/store · Address checks, AMOs, buffering, ECC, store buffer, and DCCM access
design/lsu/eh2_lsu.sv - Platform control · Platform interrupt controller and DMA control glue
design/eh2_pic_ctrl.sv
Memory & bus
Internal memories and external bus adaptation
- Memory glue · Core-facing memory and system interface glue
design/eh2_mem.sv - ICCM · Instruction tightly coupled memory implementation
design/ifu/eh2_ifu_iccm_mem.sv - DCCM · Data tightly coupled memory implementation
design/lsu/eh2_lsu_dccm_mem.sv - Bus bridges · AHB/AXI bridge modules and memory protocol helpers
design/lib/ahb_to_axi4.sv
Debug plane
JTAG/DMI and debug control path
- Debug block · Debug control block for run-control and debug access
design/dbg/eh2_dbg.sv - DMI/JTAG · JTAG TAP, DMI wrapper, and clock-domain synchronization
design/dmi/dmi_wrapper.v
Verification
Simulation harness, payloads, and runtime support
- Testbench top · Top-level simulation harness and core/system test wrapper
testbench/tb_top.sv - Bus shims · Simulation-side AHB/AXI and DMA bridge adapters
testbench/ahb_sif.sv - Payloads · Assembly tests, benchmarks, and prebuilt HEX images used in simulation
testbench/hex/hello_world.hex
Config & tools
Configuration generation and build utilities
- Config source · Single source of truth for target parameters and generated artifacts
configs/veer.config - Generators · Decode, PIC map, JSON, and utility generators used by the build flow
tools/Makefile
Connections 25
- Core wrapper → VeeR EH2: instantiates · Wrapper builds around the core top
- VeeR EH2 → Fetch: connects · Core integrates instruction fetch
- VeeR EH2 → Decode/TLU: connects · Core integrates decode and trap control
- VeeR EH2 → Execute: connects · Core integrates execution datapaths
- VeeR EH2 → Load/store: connects · Core integrates load/store subsystem
- VeeR EH2 → Platform control: connects · Core integrates platform interrupt and DMA control
- Fetch → ICCM: accesses · Fetch can use internal instruction memory
- Load/store → DCCM: accesses · Load/store can use internal data memory
- Fetch → Bus bridges: fetch path · Fetch side can reach external memory through bus adapters
- Load/store → Bus bridges: data path · Load/store side can reach external memory through bus adapters
- Memory glue → Bus bridges: bridges · Memory glue routes core traffic to system buses
- Decode/TLU → Execute: issues · Decode feeds execution control and operands
- Decode/TLU → Load/store: issues · Decode feeds memory operations and ordering control
- Decode/TLU → Fetch: redirects · Traps and branches redirect fetch
- Decode/TLU → Platform control: controls · Decode/TLU boundary handles privilege and interrupt flow
- Debug block → DMI/JTAG: transport · Debug block is reached through JTAG/DMI transport
- DMI/JTAG → VeeR EH2: debug access · Debug transport synchronizes into the core domain
- Testbench top → VeeR EH2: simulates · Testbench instantiates the core for software execution
- Testbench top → Bus shims: uses · Simulation harness connects bus and DMA shims
- Testbench top → Debug block: debug path · Testbench exposes debug connectivity to the core
- Testbench top → Payloads: loads · Simulation loads program images and benchmarks
- Config source → Generators: drives · Config source feeds generated headers, maps, and decode artifacts
- Generators → Decode/TLU: generates · Tooling supports decode and related generated RTL artifacts
- Config source → VeeR EH2: parameterizes · Repository configuration sets core build variants
- Config source → Testbench top: parameterizes · Config also shapes simulation and target selection