# chipsalliance/cores-veer-eh2 architecture

> Architecture diagram of the GitHub repository chipsalliance/cores-veer-eh2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chipsalliance/cores-veer-eh2
- Repository: https://github.com/chipsalliance/cores-veer-eh2

## Overview

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: [`design/eh2_veer.sv`](https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/eh2_veer.sv) (VeeR EH2), [`design/dec/eh2_dec.sv`](https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/dec/eh2_dec.sv) (Decode/TLU), [`testbench/tb_top.sv`](https://github.com/chipsalliance/cores-veer-eh2/blob/main/testbench/tb_top.sv) (Testbench top), [`design/ifu/eh2_ifu.sv`](https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/ifu/eh2_ifu.sv) (Fetch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_g_design["RTL core"]
  node_n_veer["VeeR EH2<br/>core top<br/>[eh2_veer.sv]"]
  node_n_wrapper["Core wrapper<br/>integration wrapper"]
  node_n_ifu["Fetch<br/>pipeline IFU<br/>[eh2_ifu.sv]"]
  node_n_dec["Decode/TLU<br/>pipeline decode<br/>[eh2_dec.sv]"]
  node_n_exu["Execute<br/>pipeline EXU<br/>[eh2_exu.sv]"]
  node_n_lsu["Load/store<br/>pipeline LSU<br/>[eh2_lsu.sv]"]
  node_n_pic_dma["Platform control<br/>interrupt/DMA<br/>[eh2_pic_ctrl.sv]"]
end

subgraph group_g_mem["Memory & bus"]
  node_n_mem["Memory glue<br/>[eh2_mem.sv]"]
  node_n_iccm[("ICCM<br/>instruction memory")]
  node_n_dccm[("DCCM<br/>data memory")]
  node_n_buslib["Bus bridges<br/>protocol adapters<br/>[ahb_to_axi4.sv]"]
end

subgraph group_g_dbg["Debug plane"]
  node_n_dbg["Debug block<br/>debug RTL<br/>[eh2_dbg.sv]"]
  node_n_dmi["DMI/JTAG<br/>debug transport<br/>[dmi_wrapper.v]"]
end

subgraph group_g_tb["Verification"]
  node_n_tbtop["Testbench top<br/>sim harness<br/>[tb_top.sv]"]
  node_n_shims["Bus shims<br/>testbench adapters<br/>[ahb_sif.sv]"]
  node_n_payloads["Payloads<br/>software images<br/>[hello_world.hex]"]
end

subgraph group_g_cfg["Config & tools"]
  node_n_config["Config source<br/>build config<br/>[veer.config]"]
  node_n_tools["Generators<br/>tooling"]
end

node_n_wrapper -->|"instantiates"| node_n_veer
node_n_veer -->|"connects"| node_n_ifu
node_n_veer -->|"connects"| node_n_dec
node_n_veer -->|"connects"| node_n_exu
node_n_veer -->|"connects"| node_n_lsu
node_n_veer -->|"connects"| node_n_pic_dma
node_n_ifu -->|"accesses"| node_n_iccm
node_n_lsu -->|"accesses"| node_n_dccm
node_n_ifu -->|"fetch path"| node_n_buslib
node_n_lsu -->|"data path"| node_n_buslib
node_n_mem -->|"bridges"| node_n_buslib
node_n_dec -->|"issues"| node_n_exu
node_n_dec -->|"issues"| node_n_lsu
node_n_dec -->|"redirects"| node_n_ifu
node_n_dec -->|"controls"| node_n_pic_dma
node_n_dbg -->|"transport"| node_n_dmi
node_n_dmi -->|"debug access"| node_n_veer
node_n_tbtop -->|"simulates"| node_n_veer
node_n_tbtop -->|"uses"| node_n_shims
node_n_tbtop -->|"debug path"| node_n_dbg
node_n_tbtop -->|"loads"| node_n_payloads
node_n_config -->|"drives"| node_n_tools
node_n_tools -->|"generates"| node_n_dec
node_n_config -->|"parameterizes"| node_n_veer
node_n_config -->|"parameterizes"| node_n_tbtop

click node_n_veer "https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/eh2_veer.sv"
click node_n_wrapper "https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/eh2_veer_wrapper.sv"
click node_n_ifu "https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/ifu/eh2_ifu.sv"
click node_n_dec "https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/dec/eh2_dec.sv"
click node_n_exu "https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/exu/eh2_exu.sv"
click node_n_lsu "https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/lsu/eh2_lsu.sv"
click node_n_pic_dma "https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/eh2_pic_ctrl.sv"
click node_n_mem "https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/eh2_mem.sv"
click node_n_iccm "https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/ifu/eh2_ifu_iccm_mem.sv"
click node_n_dccm "https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/lsu/eh2_lsu_dccm_mem.sv"
click node_n_buslib "https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/lib/ahb_to_axi4.sv"
click node_n_dbg "https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/dbg/eh2_dbg.sv"
click node_n_dmi "https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/dmi/dmi_wrapper.v"
click node_n_tbtop "https://github.com/chipsalliance/cores-veer-eh2/blob/main/testbench/tb_top.sv"
click node_n_shims "https://github.com/chipsalliance/cores-veer-eh2/blob/main/testbench/ahb_sif.sv"
click node_n_payloads "https://github.com/chipsalliance/cores-veer-eh2/blob/main/testbench/hex/hello_world.hex"
click node_n_config "https://github.com/chipsalliance/cores-veer-eh2/blob/main/configs/veer.config"
click node_n_tools "https://github.com/chipsalliance/cores-veer-eh2/tree/main/tools/Makefile"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_n_veer,node_n_wrapper,node_n_ifu,node_n_dec,node_n_exu,node_n_lsu,node_n_pic_dma toneBlue
class node_n_mem,node_n_iccm,node_n_dccm,node_n_buslib toneAmber
class node_n_dbg,node_n_dmi toneMint
class node_n_tbtop,node_n_shims,node_n_payloads toneRose
class node_n_config,node_n_tools toneIndigo
```

## Components

### RTL core

Main synthesizable core RTL and integration boundaries

- [VeeR EH2](https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/eh2_veer.sv): core top · Top-level core integration for pipeline, control, memory, and debug · `design/eh2_veer.sv`
- [Core wrapper](https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/eh2_veer_wrapper.sv): integration wrapper · SoC-facing wrapper around the core and its external interfaces · `design/eh2_veer_wrapper.sv`
- [Fetch](https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/ifu/eh2_ifu.sv): pipeline IFU · Instruction fetch, branch prediction, alignment, compression, and I-cache/ICCM control · `design/ifu/eh2_ifu.sv`
- [Decode/TLU](https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/dec/eh2_dec.sv): pipeline decode · Decode, CSR decode, register control, traps, triggers, and retirement control · `design/dec/eh2_dec.sv`
- [Execute](https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/exu/eh2_exu.sv): pipeline EXU · ALU, multiply, and divide execution datapaths and control · `design/exu/eh2_exu.sv`
- [Load/store](https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/lsu/eh2_lsu.sv): pipeline LSU · Address checks, AMOs, buffering, ECC, store buffer, and DCCM access · `design/lsu/eh2_lsu.sv`
- [Platform control](https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/eh2_pic_ctrl.sv): interrupt/DMA · Platform interrupt controller and DMA control glue · `design/eh2_pic_ctrl.sv`

### Memory & bus

Internal memories and external bus adaptation

- [Memory glue](https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/eh2_mem.sv): core memory glue · Core-facing memory and system interface glue · `design/eh2_mem.sv`
- [ICCM](https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/ifu/eh2_ifu_iccm_mem.sv): instruction memory · Instruction tightly coupled memory implementation · `design/ifu/eh2_ifu_iccm_mem.sv`
- [DCCM](https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/lsu/eh2_lsu_dccm_mem.sv): data memory · Data tightly coupled memory implementation · `design/lsu/eh2_lsu_dccm_mem.sv`
- [Bus bridges](https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/lib/ahb_to_axi4.sv): protocol adapters · AHB/AXI bridge modules and memory protocol helpers · `design/lib/ahb_to_axi4.sv`

### Debug plane

JTAG/DMI and debug control path

- [Debug block](https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/dbg/eh2_dbg.sv): debug RTL · Debug control block for run-control and debug access · `design/dbg/eh2_dbg.sv`
- [DMI/JTAG](https://github.com/chipsalliance/cores-veer-eh2/blob/main/design/dmi/dmi_wrapper.v): debug transport · JTAG TAP, DMI wrapper, and clock-domain synchronization · `design/dmi/dmi_wrapper.v`

### Verification

Simulation harness, payloads, and runtime support

- [Testbench top](https://github.com/chipsalliance/cores-veer-eh2/blob/main/testbench/tb_top.sv): sim harness · Top-level simulation harness and core/system test wrapper · `testbench/tb_top.sv`
- [Bus shims](https://github.com/chipsalliance/cores-veer-eh2/blob/main/testbench/ahb_sif.sv): testbench adapters · Simulation-side AHB/AXI and DMA bridge adapters · `testbench/ahb_sif.sv`
- [Payloads](https://github.com/chipsalliance/cores-veer-eh2/blob/main/testbench/hex/hello_world.hex): software images · Assembly tests, benchmarks, and prebuilt HEX images used in simulation · `testbench/hex/hello_world.hex`

### Config & tools

Configuration generation and build utilities

- [Config source](https://github.com/chipsalliance/cores-veer-eh2/blob/main/configs/veer.config): build config · Single source of truth for target parameters and generated artifacts · `configs/veer.config`
- [Generators](https://github.com/chipsalliance/cores-veer-eh2/tree/main/tools/Makefile): tooling · Decode, PIC map, JSON, and utility generators used by the build flow · `tools/Makefile`

## Connections

- 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
