# praneethsaibharath/riscv architecture

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

- Interactive diagram: https://gitdiagram.com/praneethsaibharath/riscv
- Repository: https://github.com/praneethsaibharath/riscv

## Overview

This repository is a staged RV32IM processor project, with FPGA-facing integration and cycle-trace utilities. The principal workflow is instruction fetch through the five pipeline stages to register writeback, augmented by arithmetic, cache, prediction, counter, and bit-manipulation features. The README supports the processor and feature relationships; source excerpts additionally show trace utilities and simulation invocation. Feature implementations beyond the sampled files are represented at their documented directory paths, not inferred internal wiring.

Main entry points: [`feature_1/modules/execute_stage.v`](https://github.com/praneethsaibharath/riscv/blob/main/feature_1/modules/execute_stage.v) (Execute), [`feature_1/modules/pipeline_5stage.v`](https://github.com/praneethsaibharath/riscv/blob/main/feature_1/modules/pipeline_5stage.v) (Fetch), [`feature_1/modules/memory_stage.v`](https://github.com/praneethsaibharath/riscv/blob/main/feature_1/modules/memory_stage.v) (Memory Stage), [`feature_1/modules/decode_stage.v`](https://github.com/praneethsaibharath/riscv/blob/main/feature_1/modules/decode_stage.v) (Decode)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_pipeline["Processor Pipeline"]
  node_fetch["Fetch<br/>[pipeline_5stage.v]"]
  node_decode["Decode<br/>[decode_stage.v]"]
  node_execute["Execute<br/>[execute_stage.v]"]
  node_memory_stage["Memory Stage<br/>[memory_stage.v]"]
  node_writeback["Writeback<br/>[writeback_stage.v]"]
  node_hazards["Hazard Control<br/>[hazard_unit.v]"]
end

subgraph group_extensions["Execution Extensions"]
  node_multiplier["RV32M Multiplier"]
  node_fpu["IEEE 754 FPU"]
  node_divider["RV32M Divider"]
  node_zbb["Zbb Operations"]
end

subgraph group_memory["Memory System"]
  node_icache["L1 I-Cache"]
  node_dcache["L1 D-Cache"]
end

subgraph group_system["Control And Monitoring"]
  node_branch_prediction["Branch Prediction"]
  node_counters["Performance CSRs"]
end

subgraph group_tools["Trace Utilities"]
  node_root_trace["Pipeline Trace"]
  node_feature1_trace["Feature 1 Trace"]
  node_feature2_trace["Feature 2 Trace"]
  node_simulation["Pipeline Simulation"]
end

node_program(("Program"))

node_program -->|"executes on"| node_fetch
node_fetch -->|"passes instructions"| node_decode
node_decode -->|"passes operands"| node_execute
node_execute -->|"passes results"| node_memory_stage
node_memory_stage -->|"passes results"| node_writeback
node_hazards -->|"controls stalls"| node_fetch
node_hazards -->|"forwards operands"| node_decode
node_execute -->|"uses arithmetic"| node_multiplier
node_execute -->|"uses arithmetic"| node_fpu
node_execute -->|"uses arithmetic"| node_divider
node_execute -->|"executes operations"| node_zbb
node_fetch -->|"reads instructions"| node_icache
node_memory_stage -->|"accesses data"| node_dcache
node_branch_prediction -->|"predicts targets"| node_fetch
node_branch_prediction -->|"recovers flushes"| node_execute
node_counters -->|"tracks retirement"| node_writeback
node_root_trace -->|"runs simulation"| node_simulation
node_feature1_trace -->|"runs simulation"| node_simulation
node_feature2_trace -->|"builds benchmark"| node_simulation

click node_fetch "https://github.com/praneethsaibharath/riscv/blob/main/feature_1/modules/pipeline_5stage.v"
click node_decode "https://github.com/praneethsaibharath/riscv/blob/main/feature_1/modules/decode_stage.v"
click node_execute "https://github.com/praneethsaibharath/riscv/blob/main/feature_1/modules/execute_stage.v"
click node_memory_stage "https://github.com/praneethsaibharath/riscv/blob/main/feature_1/modules/memory_stage.v"
click node_writeback "https://github.com/praneethsaibharath/riscv/blob/main/feature_1/modules/writeback_stage.v"
click node_hazards "https://github.com/praneethsaibharath/riscv/blob/main/feature_1/modules/hazard_unit.v"
click node_multiplier "https://github.com/praneethsaibharath/riscv/tree/main/feature_2"
click node_fpu "https://github.com/praneethsaibharath/riscv/tree/main/feature_4"
click node_divider "https://github.com/praneethsaibharath/riscv/tree/main/feature_5"
click node_zbb "https://github.com/praneethsaibharath/riscv/tree/main/feature_9"
click node_icache "https://github.com/praneethsaibharath/riscv/tree/main/feature_3"
click node_dcache "https://github.com/praneethsaibharath/riscv/tree/main/feature_6"
click node_branch_prediction "https://github.com/praneethsaibharath/riscv/tree/main/feature_7"
click node_counters "https://github.com/praneethsaibharath/riscv/tree/main/feature_8"
click node_root_trace "https://github.com/praneethsaibharath/riscv/blob/main/run_pipeline_trace.py"
click node_feature1_trace "https://github.com/praneethsaibharath/riscv/blob/main/feature_1/run_pipeline_trace.py"
click node_feature2_trace "https://github.com/praneethsaibharath/riscv/blob/main/feature_2/run_pipeline_trace.py"
click node_simulation "https://github.com/praneethsaibharath/riscv/tree/main/feature_1/simulation"

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_hazards toneBlue
class node_multiplier,node_fpu,node_divider,node_zbb toneAmber
class node_icache,node_dcache toneMint
class node_branch_prediction,node_counters toneRose
class node_root_trace,node_feature1_trace,node_feature2_trace,node_simulation,node_program toneIndigo
```

## Components

### Processor Pipeline

- [Fetch](https://github.com/praneethsaibharath/riscv/blob/main/feature_1/modules/pipeline_5stage.v): `feature_1/modules/pipeline_5stage.v`
- [Decode](https://github.com/praneethsaibharath/riscv/blob/main/feature_1/modules/decode_stage.v): `feature_1/modules/decode_stage.v`
- [Execute](https://github.com/praneethsaibharath/riscv/blob/main/feature_1/modules/execute_stage.v): `feature_1/modules/execute_stage.v`
- [Memory Stage](https://github.com/praneethsaibharath/riscv/blob/main/feature_1/modules/memory_stage.v): `feature_1/modules/memory_stage.v`
- [Writeback](https://github.com/praneethsaibharath/riscv/blob/main/feature_1/modules/writeback_stage.v): `feature_1/modules/writeback_stage.v`
- [Hazard Control](https://github.com/praneethsaibharath/riscv/blob/main/feature_1/modules/hazard_unit.v): `feature_1/modules/hazard_unit.v`

### Execution Extensions

- [RV32M Multiplier](https://github.com/praneethsaibharath/riscv/tree/main/feature_2): `feature_2`
- [IEEE 754 FPU](https://github.com/praneethsaibharath/riscv/tree/main/feature_4): `feature_4`
- [RV32M Divider](https://github.com/praneethsaibharath/riscv/tree/main/feature_5): `feature_5`
- [Zbb Operations](https://github.com/praneethsaibharath/riscv/tree/main/feature_9): `feature_9`

### Memory System

- [L1 I-Cache](https://github.com/praneethsaibharath/riscv/tree/main/feature_3): `feature_3`
- [L1 D-Cache](https://github.com/praneethsaibharath/riscv/tree/main/feature_6): `feature_6`

### Control And Monitoring

- [Branch Prediction](https://github.com/praneethsaibharath/riscv/tree/main/feature_7): `feature_7`
- [Performance CSRs](https://github.com/praneethsaibharath/riscv/tree/main/feature_8): `feature_8`

### Trace Utilities

- [Pipeline Trace](https://github.com/praneethsaibharath/riscv/blob/main/run_pipeline_trace.py): `run_pipeline_trace.py`
- [Feature 1 Trace](https://github.com/praneethsaibharath/riscv/blob/main/feature_1/run_pipeline_trace.py): `feature_1/run_pipeline_trace.py`
- [Feature 2 Trace](https://github.com/praneethsaibharath/riscv/blob/main/feature_2/run_pipeline_trace.py): `feature_2/run_pipeline_trace.py`
- [Pipeline Simulation](https://github.com/praneethsaibharath/riscv/tree/main/feature_1/simulation): `feature_1/simulation`

### Other components

- **Program**

## Connections

- Program → Fetch: executes on (evidence: `README.md`)
- Fetch → Decode: passes instructions (evidence: `README.md`)
- Decode → Execute: passes operands (evidence: `README.md`)
- Execute → Memory Stage: passes results (evidence: `README.md`)
- Memory Stage → Writeback: passes results (evidence: `README.md`)
- Hazard Control → Fetch: controls stalls (evidence: `README.md`)
- Hazard Control → Decode: forwards operands (evidence: `README.md`)
- Execute → RV32M Multiplier: uses arithmetic (evidence: `README.md`)
- Execute → IEEE 754 FPU: uses arithmetic (evidence: `README.md`)
- Execute → RV32M Divider: uses arithmetic (evidence: `README.md`)
- Execute → Zbb Operations: executes operations (evidence: `README.md`)
- Fetch → L1 I-Cache: reads instructions (evidence: `README.md`)
- Memory Stage → L1 D-Cache: accesses data (evidence: `README.md`)
- Branch Prediction → Fetch: predicts targets (evidence: `README.md`)
- Branch Prediction → Execute: recovers flushes (evidence: `README.md`)
- Performance CSRs → Writeback: tracks retirement (evidence: `README.md`)
- Pipeline Trace → Pipeline Simulation: runs simulation (evidence: `run_pipeline_trace.py`)
- Feature 1 Trace → Pipeline Simulation: runs simulation (evidence: `feature_1/run_pipeline_trace.py`)
- Feature 2 Trace → Pipeline Simulation: builds benchmark (evidence: `feature_2/run_pipeline_trace.py`)
