# wren6991/hazard3 architecture

> Architecture diagram of the GitHub repository wren6991/hazard3, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wren6991/hazard3
- Repository: https://github.com/wren6991/hazard3

## Overview

Hazard3 is configurable 3-stage RISC-V processor IP with optional ISA extensions, privilege and protection features, and external debug. The principal workflow is a processor integrated into a SoC executing software, with the example SoC demonstrating a JTAG-enabled system and platform timer. The README documents the core’s capabilities and that integration, but the sampled source is only a multiply/divide reference model; internal RTL connections below are therefore shown as unverified rather than asserted as observed calls.

Main entry points: [`hdl/hazard3_core.v`](https://github.com/wren6991/hazard3/blob/stable/hdl/hazard3_core.v) (Hazard3 Core), [`example_soc/soc/example_soc.v`](https://github.com/wren6991/hazard3/blob/stable/example_soc/soc/example_soc.v) (Example SoC), [`hdl/hazard3_decode.v`](https://github.com/wren6991/hazard3/blob/stable/hdl/hazard3_decode.v) (Instruction Decode), [`hdl/debug/dtm/hazard3_jtag_dtm.v`](https://github.com/wren6991/hazard3/blob/stable/hdl/debug/dtm/hazard3_jtag_dtm.v) (JTAG Debug Transport)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_processor["Processor Core"]
  node_core["Hazard3 Core<br/>[hazard3_core.v]"]
  node_frontend["Fetch Frontend<br/>[hazard3_frontend.v]"]
  node_decode["Instruction Decode<br/>[hazard3_decode.v]"]
  node_decompress["Compressed Decode"]
end

subgraph group_execution["Execution Features"]
  node_arithmetic["Arithmetic Units"]
  node_csr["Control Registers<br/>[hazard3_csr.v]"]
  node_irq["Interrupt Control<br/>[hazard3_irq_ctrl.v]"]
end

subgraph group_protection["Protection and Debug"]
  node_pmp["Memory Protection<br/>[hazard3_pmp.v]"]
  node_triggers["Address Triggers<br/>[hazard3_triggers.v]"]
  node_debug_module["Debug Module<br/>[hazard3_dm.v]"]
  node_jtag_dtm["JTAG Debug Transport<br/>[hazard3_jtag_dtm.v]"]
end

subgraph group_integration["Example Integration"]
  node_example_soc["Example SoC<br/>[example_soc.v]"]
  node_timer["Platform Timer"]
  node_memory_io["RAM and Serial<br/>[example_soc.v]"]
end

node_designer(("SoC Designer"))
node_software["RISC-V Software"]

node_designer -->|"integrates"| node_example_soc
node_example_soc -->|"assembles"| node_core
node_example_soc -->|"assembles"| node_jtag_dtm
node_example_soc -.->|"includes"| node_timer
node_example_soc -->|"includes"| node_memory_io
node_software -.->|"executes on"| node_core
node_core -.->|"uses"| node_frontend
node_core -.->|"uses"| node_decode
node_decode -.->|"uses"| node_decompress
node_core -.->|"uses"| node_arithmetic
node_core -.->|"uses"| node_csr
node_core -.->|"uses"| node_irq
node_core -.->|"uses"| node_pmp
node_core -.->|"uses"| node_triggers
node_jtag_dtm -.->|"transports debug"| node_debug_module

click node_core "https://github.com/wren6991/hazard3/blob/stable/hdl/hazard3_core.v"
click node_frontend "https://github.com/wren6991/hazard3/blob/stable/hdl/hazard3_frontend.v"
click node_decode "https://github.com/wren6991/hazard3/blob/stable/hdl/hazard3_decode.v"
click node_decompress "https://github.com/wren6991/hazard3/blob/stable/hdl/hazard3_instr_decompress.v"
click node_arithmetic "https://github.com/wren6991/hazard3/tree/stable/hdl/arith"
click node_csr "https://github.com/wren6991/hazard3/blob/stable/hdl/hazard3_csr.v"
click node_irq "https://github.com/wren6991/hazard3/blob/stable/hdl/hazard3_irq_ctrl.v"
click node_pmp "https://github.com/wren6991/hazard3/blob/stable/hdl/hazard3_pmp.v"
click node_triggers "https://github.com/wren6991/hazard3/blob/stable/hdl/hazard3_triggers.v"
click node_debug_module "https://github.com/wren6991/hazard3/blob/stable/hdl/debug/dm/hazard3_dm.v"
click node_jtag_dtm "https://github.com/wren6991/hazard3/blob/stable/hdl/debug/dtm/hazard3_jtag_dtm.v"
click node_example_soc "https://github.com/wren6991/hazard3/blob/stable/example_soc/soc/example_soc.v"
click node_timer "https://github.com/wren6991/hazard3/blob/stable/example_soc/soc/peri/hazard3_riscv_timer.v"
click node_memory_io "https://github.com/wren6991/hazard3/blob/stable/example_soc/soc/example_soc.v"

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_core,node_frontend,node_decode,node_decompress toneBlue
class node_arithmetic,node_csr,node_irq toneAmber
class node_pmp,node_triggers,node_debug_module,node_jtag_dtm toneMint
class node_example_soc,node_timer,node_memory_io toneRose
class node_designer,node_software toneIndigo
```

## Components

### Processor Core

- [Hazard3 Core](https://github.com/wren6991/hazard3/blob/stable/hdl/hazard3_core.v): `hdl/hazard3_core.v`
- [Fetch Frontend](https://github.com/wren6991/hazard3/blob/stable/hdl/hazard3_frontend.v): `hdl/hazard3_frontend.v`
- [Instruction Decode](https://github.com/wren6991/hazard3/blob/stable/hdl/hazard3_decode.v): `hdl/hazard3_decode.v`
- [Compressed Decode](https://github.com/wren6991/hazard3/blob/stable/hdl/hazard3_instr_decompress.v): `hdl/hazard3_instr_decompress.v`

### Execution Features

- [Arithmetic Units](https://github.com/wren6991/hazard3/tree/stable/hdl/arith): `hdl/arith`
- [Control Registers](https://github.com/wren6991/hazard3/blob/stable/hdl/hazard3_csr.v): `hdl/hazard3_csr.v`
- [Interrupt Control](https://github.com/wren6991/hazard3/blob/stable/hdl/hazard3_irq_ctrl.v): `hdl/hazard3_irq_ctrl.v`

### Protection and Debug

- [Memory Protection](https://github.com/wren6991/hazard3/blob/stable/hdl/hazard3_pmp.v): `hdl/hazard3_pmp.v`
- [Address Triggers](https://github.com/wren6991/hazard3/blob/stable/hdl/hazard3_triggers.v): `hdl/hazard3_triggers.v`
- [Debug Module](https://github.com/wren6991/hazard3/blob/stable/hdl/debug/dm/hazard3_dm.v): `hdl/debug/dm/hazard3_dm.v`
- [JTAG Debug Transport](https://github.com/wren6991/hazard3/blob/stable/hdl/debug/dtm/hazard3_jtag_dtm.v): `hdl/debug/dtm/hazard3_jtag_dtm.v`

### Example Integration

- [Example SoC](https://github.com/wren6991/hazard3/blob/stable/example_soc/soc/example_soc.v): `example_soc/soc/example_soc.v`
- [Platform Timer](https://github.com/wren6991/hazard3/blob/stable/example_soc/soc/peri/hazard3_riscv_timer.v): `example_soc/soc/peri/hazard3_riscv_timer.v`
- [RAM and Serial](https://github.com/wren6991/hazard3/blob/stable/example_soc/soc/example_soc.v): `example_soc/soc/example_soc.v`

### Other components

- **SoC Designer**
- **RISC-V Software**

## Connections

- SoC Designer → Example SoC: integrates (evidence: `Readme.md`)
- Example SoC → Hazard3 Core: assembles (evidence: `Readme.md`)
- Example SoC → JTAG Debug Transport: assembles (evidence: `Readme.md`)
- Example SoC → Platform Timer: includes (evidence: `Readme.md`)
- Example SoC → RAM and Serial: includes (evidence: `Readme.md`)
- RISC-V Software → Hazard3 Core: executes on
- Hazard3 Core → Fetch Frontend: uses
- Hazard3 Core → Instruction Decode: uses
- Instruction Decode → Compressed Decode: uses
- Hazard3 Core → Arithmetic Units: uses
- Hazard3 Core → Control Registers: uses
- Hazard3 Core → Interrupt Control: uses
- Hazard3 Core → Memory Protection: uses
- Hazard3 Core → Address Triggers: uses
- JTAG Debug Transport → Debug Module: transports debug
