# govardhnn/riscv_single_cycle_processor architecture

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

- Interactive diagram: https://gitdiagram.com/govardhnn/riscv_single_cycle_processor
- Repository: https://github.com/govardhnn/riscv_single_cycle_processor

## Overview

This repository implements a simulation-validated, 32-bit single-cycle RISC-V processor. Its principal hardware workflow fetches an instruction from shared memory, decodes it, executes it in the datapath, and commits register, CSR, or memory effects at the clock edge; traps redirect control flow through machine CSRs. The graph follows the README’s architecture description and source paths in the tree. No RTL excerpts were supplied, so relationships are documented at that level rather than inferred from unsampled code.

Main entry points: [`rtl/Core_Datapath.v`](https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/Core_Datapath.v) (Core datapath), [`rtl/Control_Unit.v`](https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/Control_Unit.v) (Control unit), [`rtl/Data_Memory.v`](https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/Data_Memory.v) (Unified memory), [`rtl/Single_Cycle_Top.v`](https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/Single_Cycle_Top.v) (Single-cycle top)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_integration["Core integration"]
  node_top["Single-cycle top<br/>[Single_Cycle_Top.v]"]
  node_core["Single-cycle core"]
  node_memory[("Unified memory<br/>[Data_Memory.v]")]
end

subgraph group_control["Instruction control"]
  node_control_unit["Control unit<br/>[Control_Unit.v]"]
  node_main_decoder["Main decoder<br/>[Main_Decoder.v]"]
  node_alu_decoder["ALU decoder<br/>[ALU_decoder.v]"]
  node_instruction_check["Instruction checks"]
end

subgraph group_datapath["Execution datapath"]
  node_datapath["Core datapath<br/>[Core_Datapath.v]"]
  node_pc["PC control<br/>[PC.v]"]
  node_registers[("Register file<br/>[Register_File.v]")]
  node_alu["ALU<br/>[ALU.v]"]
  node_immediate["Immediate extension<br/>[Extend.v]"]
  node_result_mux["Writeback selection<br/>[Result_Mux.v]"]
end

subgraph group_machine["Machine state"]
  node_csr[("Machine CSRs<br/>[CSR_File.v]")]
end

node_top -->|"connects"| node_core
node_top -->|"connects"| node_memory
node_memory -->|"supplies instruction"| node_control_unit
node_memory -->|"supplies instruction and data"| node_datapath
node_control_unit -->|"provides controls"| node_datapath
node_datapath -->|"provides address and store data"| node_memory
node_datapath -->|"accesses"| node_csr
node_csr -->|"returns CSR and trap state"| node_datapath
node_control_unit -->|"decodes"| node_main_decoder
node_control_unit -->|"selects ALU operation"| node_alu_decoder
node_control_unit -->|"checks encoding"| node_instruction_check
node_datapath -->|"selects next PC"| node_pc
node_datapath -->|"reads and writes"| node_registers
node_datapath -->|"executes operations"| node_alu
node_datapath -->|"extends immediates"| node_immediate
node_datapath -->|"selects writeback"| node_result_mux

click node_top "https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/Single_Cycle_Top.v"
click node_core "https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/Single_Cycle_Core.v"
click node_memory "https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/Data_Memory.v"
click node_control_unit "https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/Control_Unit.v"
click node_main_decoder "https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/Main_Decoder.v"
click node_alu_decoder "https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/ALU_decoder.v"
click node_instruction_check "https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/Instruction_Check.v"
click node_datapath "https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/Core_Datapath.v"
click node_pc "https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/PC.v"
click node_registers "https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/Register_File.v"
click node_alu "https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/ALU.v"
click node_immediate "https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/Extend.v"
click node_result_mux "https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/Result_Mux.v"
click node_csr "https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/CSR_File.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_top,node_core,node_memory toneBlue
class node_control_unit,node_main_decoder,node_alu_decoder,node_instruction_check toneAmber
class node_datapath,node_pc,node_registers,node_alu,node_immediate,node_result_mux toneMint
class node_csr toneRose
```

## Components

### Core integration

- [Single-cycle top](https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/Single_Cycle_Top.v): `rtl/Single_Cycle_Top.v`
- [Single-cycle core](https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/Single_Cycle_Core.v): `rtl/Single_Cycle_Core.v`
- [Unified memory](https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/Data_Memory.v): `rtl/Data_Memory.v`

### Instruction control

- [Control unit](https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/Control_Unit.v): `rtl/Control_Unit.v`
- [Main decoder](https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/Main_Decoder.v): `rtl/Main_Decoder.v`
- [ALU decoder](https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/ALU_decoder.v): `rtl/ALU_decoder.v`
- [Instruction checks](https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/Instruction_Check.v): `rtl/Instruction_Check.v`

### Execution datapath

- [Core datapath](https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/Core_Datapath.v): `rtl/Core_Datapath.v`
- [PC control](https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/PC.v): `rtl/PC.v`
- [Register file](https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/Register_File.v): `rtl/Register_File.v`
- [ALU](https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/ALU.v): `rtl/ALU.v`
- [Immediate extension](https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/Extend.v): `rtl/Extend.v`
- [Writeback selection](https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/Result_Mux.v): `rtl/Result_Mux.v`

### Machine state

- [Machine CSRs](https://github.com/govardhnn/riscv_single_cycle_processor/blob/main/rtl/CSR_File.v): `rtl/CSR_File.v`

## Connections

- Single-cycle top → Single-cycle core: connects (evidence: `README.md`)
- Single-cycle top → Unified memory: connects (evidence: `README.md`)
- Unified memory → Control unit: supplies instruction (evidence: `README.md`)
- Unified memory → Core datapath: supplies instruction and data (evidence: `README.md`)
- Control unit → Core datapath: provides controls (evidence: `README.md`)
- Core datapath → Unified memory: provides address and store data (evidence: `README.md`)
- Core datapath → Machine CSRs: accesses (evidence: `README.md`)
- Machine CSRs → Core datapath: returns CSR and trap state (evidence: `README.md`)
- Control unit → Main decoder: decodes (evidence: `README.md`)
- Control unit → ALU decoder: selects ALU operation (evidence: `README.md`)
- Control unit → Instruction checks: checks encoding (evidence: `README.md`)
- Core datapath → PC control: selects next PC (evidence: `README.md`)
- Core datapath → Register file: reads and writes (evidence: `README.md`)
- Core datapath → ALU: executes operations (evidence: `README.md`)
- Core datapath → Immediate extension: extends immediates (evidence: `README.md`)
- Core datapath → Writeback selection: selects writeback (evidence: `README.md`)
