# shass27/rv32i-soc architecture

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

- Interactive diagram: https://gitdiagram.com/shass27/rv32i-soc
- Repository: https://github.com/shass27/rv32i-soc

## Overview

This repository implements a single-cycle RV32I SoC. Its principal workflow is a RISC-V program executing through fetch, decode, execute, memory, and writeback; local accesses use on-chip data memory, while IO accesses pass through the Wishbone master and interconnect. The SoC also supports DMA-driven transfers and a MAC accelerator. Relationships below are based on README statements only; RTL excerpts were not provided, so unsampled implementation details are omitted.

Main entry points: [`hardware/src/bus/wb_interconnect.v`](https://github.com/shass27/rv32i-soc/blob/main/hardware/src/bus/wb_interconnect.v) (Address interconnect), [`hardware/src/core/mem/data_memory.v`](https://github.com/shass27/rv32i-soc/blob/main/hardware/src/core/mem/data_memory.v) (Memory stage), [`hardware/src/bus/wb_dma.v`](https://github.com/shass27/rv32i-soc/blob/main/hardware/src/bus/wb_dma.v) (DMA controller), [`hardware/src/core/if/inst_mem.v`](https://github.com/shass27/rv32i-soc/blob/main/hardware/src/core/if/inst_mem.v) (Fetch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cpu["RV32I core"]
  node_fetch["Fetch<br/>[inst_mem.v]"]
  node_decode["Decode<br/>[control_unit.v]"]
  node_execute["Execute<br/>[alu_module.v]"]
  node_memory_stage["Memory stage<br/>[data_memory.v]"]
  node_writeback["Writeback<br/>[writeback_mux.v]"]
  node_cpu_top["SoC top<br/>[cpu_top_wb.v]"]
end

subgraph group_bus["Wishbone fabric"]
  node_wb_master["CPU bus master<br/>[wb_master.v]"]
  node_interconnect["Address interconnect<br/>[wb_interconnect.v]"]
end

subgraph group_peripherals["SoC peripherals"]
  node_dma["DMA controller<br/>[wb_dma.v]"]
  node_mac["MAC accelerator<br/>[wb_mac_accel.v]"]
  node_error_slave["Error slave<br/>[wb_err.v]"]
end

subgraph group_memory["Memory"]
  node_data_memory[("Local data memory<br/>[data_memory.v]")]
end

node_program(("RISC-V program"))

node_program -->|"executes"| node_fetch
node_fetch -->|"passes instruction"| node_decode
node_decode -->|"controls"| node_execute
node_execute -->|"provides result"| node_memory_stage
node_memory_stage -->|"supplies data"| node_writeback
node_cpu_top -->|"instantiates"| node_wb_master
node_wb_master -->|"requests access"| node_interconnect
node_interconnect -->|"routes access"| node_mac
node_interconnect -->|"routes access"| node_dma
node_interconnect -->|"routes unmatched"| node_error_slave
node_memory_stage -->|"accesses locally"| node_data_memory
node_dma -->|"copies via port B"| node_data_memory
node_dma -->|"transfers operands"| node_mac

click node_fetch "https://github.com/shass27/rv32i-soc/blob/main/hardware/src/core/if/inst_mem.v"
click node_decode "https://github.com/shass27/rv32i-soc/blob/main/hardware/src/core/id/control_unit.v"
click node_execute "https://github.com/shass27/rv32i-soc/blob/main/hardware/src/core/ex/alu_module.v"
click node_memory_stage "https://github.com/shass27/rv32i-soc/blob/main/hardware/src/core/mem/data_memory.v"
click node_writeback "https://github.com/shass27/rv32i-soc/blob/main/hardware/src/core/wb/writeback_mux.v"
click node_cpu_top "https://github.com/shass27/rv32i-soc/blob/main/hardware/src/core/cpu_top_wb.v"
click node_wb_master "https://github.com/shass27/rv32i-soc/blob/main/hardware/src/bus/wb_master.v"
click node_interconnect "https://github.com/shass27/rv32i-soc/blob/main/hardware/src/bus/wb_interconnect.v"
click node_dma "https://github.com/shass27/rv32i-soc/blob/main/hardware/src/bus/wb_dma.v"
click node_mac "https://github.com/shass27/rv32i-soc/blob/main/hardware/src/bus/wb_mac_accel.v"
click node_error_slave "https://github.com/shass27/rv32i-soc/blob/main/hardware/src/bus/wb_err.v"
click node_data_memory "https://github.com/shass27/rv32i-soc/blob/main/hardware/src/core/mem/data_memory.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_fetch,node_decode,node_execute,node_memory_stage,node_writeback,node_cpu_top toneBlue
class node_wb_master,node_interconnect toneAmber
class node_dma,node_mac,node_error_slave toneMint
class node_data_memory toneRose
class node_program toneIndigo
```

## Components

### RV32I core

- [Fetch](https://github.com/shass27/rv32i-soc/blob/main/hardware/src/core/if/inst_mem.v): `hardware/src/core/if/inst_mem.v`
- [Decode](https://github.com/shass27/rv32i-soc/blob/main/hardware/src/core/id/control_unit.v): `hardware/src/core/id/control_unit.v`
- [Execute](https://github.com/shass27/rv32i-soc/blob/main/hardware/src/core/ex/alu_module.v): `hardware/src/core/ex/alu_module.v`
- [Memory stage](https://github.com/shass27/rv32i-soc/blob/main/hardware/src/core/mem/data_memory.v): `hardware/src/core/mem/data_memory.v`
- [Writeback](https://github.com/shass27/rv32i-soc/blob/main/hardware/src/core/wb/writeback_mux.v): `hardware/src/core/wb/writeback_mux.v`
- [SoC top](https://github.com/shass27/rv32i-soc/blob/main/hardware/src/core/cpu_top_wb.v): `hardware/src/core/cpu_top_wb.v`

### Wishbone fabric

- [CPU bus master](https://github.com/shass27/rv32i-soc/blob/main/hardware/src/bus/wb_master.v): `hardware/src/bus/wb_master.v`
- [Address interconnect](https://github.com/shass27/rv32i-soc/blob/main/hardware/src/bus/wb_interconnect.v): `hardware/src/bus/wb_interconnect.v`

### SoC peripherals

- [DMA controller](https://github.com/shass27/rv32i-soc/blob/main/hardware/src/bus/wb_dma.v): `hardware/src/bus/wb_dma.v`
- [MAC accelerator](https://github.com/shass27/rv32i-soc/blob/main/hardware/src/bus/wb_mac_accel.v): `hardware/src/bus/wb_mac_accel.v`
- [Error slave](https://github.com/shass27/rv32i-soc/blob/main/hardware/src/bus/wb_err.v): `hardware/src/bus/wb_err.v`

### Memory

- [Local data memory](https://github.com/shass27/rv32i-soc/blob/main/hardware/src/core/mem/data_memory.v): `hardware/src/core/mem/data_memory.v`

### Other components

- **RISC-V program**

## Connections

- RISC-V program → Fetch: executes (evidence: `README.md`)
- Fetch → Decode: passes instruction (evidence: `README.md`)
- Decode → Execute: controls (evidence: `README.md`)
- Execute → Memory stage: provides result (evidence: `README.md`)
- Memory stage → Writeback: supplies data (evidence: `README.md`)
- SoC top → CPU bus master: instantiates (evidence: `README.md`)
- CPU bus master → Address interconnect: requests access (evidence: `README.md`)
- Address interconnect → MAC accelerator: routes access (evidence: `README.md`)
- Address interconnect → DMA controller: routes access (evidence: `README.md`)
- Address interconnect → Error slave: routes unmatched (evidence: `README.md`)
- Memory stage → Local data memory: accesses locally (evidence: `README.md`)
- DMA controller → Local data memory: copies via port B (evidence: `README.md`)
- DMA controller → MAC accelerator: transfers operands (evidence: `README.md`)
