# vlsi-shubh/riscv-32i-processor architecture

> Architecture diagram of the GitHub repository vlsi-shubh/riscv-32i-processor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vlsi-shubh/riscv-32i-processor
- Repository: https://github.com/vlsi-shubh/riscv-32i-processor

## Overview

The repository implements two RV32I processor designs: a single-cycle core and a five-stage pipelined core. The documented shared-RTL arrangement has the pipeline core use the SingleCycle ALU, control, register-file, immediate, PC, branch, mux, adder, and instruction-memory modules. Pipeline-specific stages, inter-stage registers, hazard detection, and forwarding are also represented. Source excerpts were not provided, so internal stage-to-stage calls and the single-cycle core’s wiring are not asserted.

Main entry points: [`PipelineExecution/core/core_pip.v`](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/PipelineExecution/core/core_pip.v) (Pipeline core), [`SingleCycle/src/alu.v`](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/SingleCycle/src/alu.v) (ALU), [`SingleCycle/src/alu_control.v`](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/SingleCycle/src/alu_control.v) (ALU control), [`SingleCycle/src/control.v`](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/SingleCycle/src/control.v) (Control unit)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_single["Single-cycle RTL"]
  node_single_core["Single-cycle core<br/>[core_sc.v]"]
end

subgraph group_shared["Shared processor RTL"]
  node_alu["ALU<br/>[alu.v]"]
  node_alu_control["ALU control<br/>[alu_control.v]"]
  node_control["Control unit<br/>[control.v]"]
  node_reg_file["Register file<br/>[reg_file.v]"]
  node_imm["Immediate generator<br/>[imm.v]"]
  node_pc["Program counter<br/>[pc.v]"]
  node_branch["Branch unit<br/>[branch_unit.v]"]
  node_mux["MUX modules<br/>[mux.v]"]
  node_adder["Adder<br/>[adder.v]"]
  node_inst_mem["Instruction memory<br/>[inst_mem.v]"]
end

subgraph group_pipeline["Pipeline RTL"]
  node_pipeline_core["Pipeline core<br/>[core_pip.v]"]
  node_pipeline_stages["Stage coordination<br/>[core_pip.v]"]
  node_fetch["Fetch stage<br/>[fetch.v]"]
  node_decode["Decode stage<br/>[decode.v]"]
  node_execute["Execute stage<br/>[execute.v]"]
  node_memory["Memory stage<br/>[memory.v]"]
  node_if_id["IF/ID register<br/>[if_id_reg.v]"]
  node_id_ex["ID/EX register<br/>[id_ex_reg.v]"]
  node_ex_mem["EX/MEM register<br/>[ex_mem_reg.v]"]
  node_mem_wb["MEM/WB register<br/>[mem_wb_reg.v]"]
  node_hazard["Hazard detection<br/>[hazard_unit.v]"]
  node_forwarding["Forwarding unit<br/>[forwarding_unit.v]"]
end

node_pipeline_core -->|"uses"| node_alu
node_pipeline_core -->|"uses"| node_alu_control
node_pipeline_core -->|"uses"| node_reg_file
node_pipeline_core -->|"uses"| node_control
node_pipeline_core -->|"uses"| node_imm
node_pipeline_core -->|"uses"| node_pc
node_pipeline_core -->|"uses"| node_branch
node_pipeline_core -->|"uses"| node_mux
node_pipeline_core -->|"uses"| node_adder
node_pipeline_core -->|"uses"| node_inst_mem

click node_single_core "https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/SingleCycle/src/core_sc.v"
click node_alu "https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/SingleCycle/src/alu.v"
click node_alu_control "https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/SingleCycle/src/alu_control.v"
click node_control "https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/SingleCycle/src/control.v"
click node_reg_file "https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/SingleCycle/src/reg_file.v"
click node_imm "https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/SingleCycle/src/imm.v"
click node_pc "https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/SingleCycle/src/pc.v"
click node_branch "https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/SingleCycle/src/branch_unit.v"
click node_mux "https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/SingleCycle/src/mux.v"
click node_adder "https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/SingleCycle/src/adder.v"
click node_inst_mem "https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/SingleCycle/src/inst_mem.v"
click node_pipeline_core "https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/PipelineExecution/core/core_pip.v"
click node_pipeline_stages "https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/PipelineExecution/stages/core_pip.v"
click node_fetch "https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/PipelineExecution/stages/fetch.v"
click node_decode "https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/PipelineExecution/stages/decode.v"
click node_execute "https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/PipelineExecution/stages/execute.v"
click node_memory "https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/PipelineExecution/stages/memory.v"
click node_if_id "https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/PipelineExecution/stages/if_id_reg.v"
click node_id_ex "https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/PipelineExecution/stages/id_ex_reg.v"
click node_ex_mem "https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/PipelineExecution/stages/ex_mem_reg.v"
click node_mem_wb "https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/PipelineExecution/stages/mem_wb_reg.v"
click node_hazard "https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/PipelineExecution/stages/hazard_unit.v"
click node_forwarding "https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/PipelineExecution/stages/forwarding_unit.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_single_core toneBlue
class node_alu,node_alu_control,node_control,node_reg_file,node_imm,node_pc,node_branch,node_mux,node_adder,node_inst_mem toneAmber
class node_pipeline_core,node_pipeline_stages,node_fetch,node_decode,node_execute,node_memory,node_if_id,node_id_ex,node_ex_mem,node_mem_wb,node_hazard,node_forwarding toneMint
```

## Components

### Single-cycle RTL

- [Single-cycle core](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/SingleCycle/src/core_sc.v): `SingleCycle/src/core_sc.v`

### Shared processor RTL

- [ALU](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/SingleCycle/src/alu.v): `SingleCycle/src/alu.v`
- [ALU control](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/SingleCycle/src/alu_control.v): `SingleCycle/src/alu_control.v`
- [Control unit](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/SingleCycle/src/control.v): `SingleCycle/src/control.v`
- [Register file](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/SingleCycle/src/reg_file.v): `SingleCycle/src/reg_file.v`
- [Immediate generator](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/SingleCycle/src/imm.v): `SingleCycle/src/imm.v`
- [Program counter](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/SingleCycle/src/pc.v): `SingleCycle/src/pc.v`
- [Branch unit](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/SingleCycle/src/branch_unit.v): `SingleCycle/src/branch_unit.v`
- [MUX modules](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/SingleCycle/src/mux.v): `SingleCycle/src/mux.v`
- [Adder](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/SingleCycle/src/adder.v): `SingleCycle/src/adder.v`
- [Instruction memory](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/SingleCycle/src/inst_mem.v): `SingleCycle/src/inst_mem.v`

### Pipeline RTL

- [Pipeline core](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/PipelineExecution/core/core_pip.v): `PipelineExecution/core/core_pip.v`
- [Stage coordination](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/PipelineExecution/stages/core_pip.v): `PipelineExecution/stages/core_pip.v`
- [Fetch stage](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/PipelineExecution/stages/fetch.v): `PipelineExecution/stages/fetch.v`
- [Decode stage](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/PipelineExecution/stages/decode.v): `PipelineExecution/stages/decode.v`
- [Execute stage](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/PipelineExecution/stages/execute.v): `PipelineExecution/stages/execute.v`
- [Memory stage](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/PipelineExecution/stages/memory.v): `PipelineExecution/stages/memory.v`
- [IF/ID register](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/PipelineExecution/stages/if_id_reg.v): `PipelineExecution/stages/if_id_reg.v`
- [ID/EX register](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/PipelineExecution/stages/id_ex_reg.v): `PipelineExecution/stages/id_ex_reg.v`
- [EX/MEM register](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/PipelineExecution/stages/ex_mem_reg.v): `PipelineExecution/stages/ex_mem_reg.v`
- [MEM/WB register](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/PipelineExecution/stages/mem_wb_reg.v): `PipelineExecution/stages/mem_wb_reg.v`
- [Hazard detection](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/PipelineExecution/stages/hazard_unit.v): `PipelineExecution/stages/hazard_unit.v`
- [Forwarding unit](https://github.com/vlsi-shubh/riscv-32i-processor/blob/main/PipelineExecution/stages/forwarding_unit.v): `PipelineExecution/stages/forwarding_unit.v`

## Connections

- Pipeline core → ALU: uses (evidence: `README.md`)
- Pipeline core → ALU control: uses (evidence: `README.md`)
- Pipeline core → Register file: uses (evidence: `README.md`)
- Pipeline core → Control unit: uses (evidence: `README.md`)
- Pipeline core → Immediate generator: uses (evidence: `README.md`)
- Pipeline core → Program counter: uses (evidence: `README.md`)
- Pipeline core → Branch unit: uses (evidence: `README.md`)
- Pipeline core → MUX modules: uses (evidence: `README.md`)
- Pipeline core → Adder: uses (evidence: `README.md`)
- Pipeline core → Instruction memory: uses (evidence: `README.md`)
