# mr-jg-813/risc-v-64-im architecture

> Architecture diagram of the GitHub repository mr-jg-813/risc-v-64-im, 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/mr-jg-813/risc-v-64-im
- Repository: https://github.com/mr-jg-813/risc-v-64-im

## Overview

BRISC-V is an RV64IM processor RTL project with a C-program simulation flow. The principal workflow is to select a sample C program, use the runner to prepare instruction and data-memory images and launch simulation, then observe semihosted output and result dumps. The README documents the major RTL blocks and their roles; detailed signal-level connections are not shown in the supplied source excerpts, so the graph limits itself to documented relationships.

Main entry points: [`RISC_V/src_64/RISC_V_Core.v`](https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/src_64/RISC_V_Core.v) (RV64 Core), [`RISC_V/tb/tb_RISC_V_Core.v`](https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/tb/tb_RISC_V_Core.v) (Core Testbench), [`RISC_V/run_c.sh`](https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/run_c.sh) (C Runner), [`RISC_V/run_sim64`](https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/run_sim64) (RTL Simulator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Program Simulation"]
  node_samples["Sample C Programs"]
  node_runner["C Runner<br/>[run_c.sh]"]
  node_images["Memory Images<br/>[main_bsram.mem]"]
  node_simulator["RTL Simulator"]
  node_testbench["Core Testbench<br/>[tb_RISC_V_Core.v]"]
end

subgraph group_pipeline["Processor Pipeline"]
  node_core["RV64 Core<br/>[RISC_V_Core.v]"]
  node_fetch["Fetch Stage<br/>[fetch.v]"]
  node_decode["Decode Stage<br/>[decode.v]"]
  node_execute["Execute Stage<br/>[execute.v]"]
  node_memory_stage["Memory Stage<br/>[memory.v]"]
  node_writeback["Writeback Stage<br/>[writeback.v]"]
  node_hazards["Stall Bypass<br/>[stallControl.v]"]
  node_alu["Arithmetic Logic<br/>[ALU.v]"]
end

subgraph group_memory["Memory System"]
  node_imem[("Instruction RAM<br/>[bsram.v]")]
  node_dmem[("Data RAM<br/>[bram.v]")]
  node_memory_hierarchy["Memory Interfaces<br/>[memory_hierarchy.v]"]
end

subgraph group_io["Simulation Output"]
  node_semihost["Semihost Output<br/>[semihost_putchar.v]"]
  node_results["Simulation Dumps"]
end

node_user(("Engineer"))

node_user -->|"runs"| node_runner
node_samples -->|"provides source"| node_runner
node_runner -->|"creates images"| node_images
node_runner -->|"starts"| node_simulator
node_simulator -->|"runs"| node_testbench
node_testbench -->|"tests"| node_core
node_core -->|"connects stages"| node_fetch
node_core -->|"connects stages"| node_decode
node_core -->|"connects stages"| node_execute
node_core -->|"connects stages"| node_memory_stage
node_core -->|"connects stages"| node_writeback
node_core -->|"uses control"| node_hazards
node_execute -->|"performs operations"| node_alu
node_core -->|"uses instruction RAM"| node_imem
node_core -->|"uses data RAM"| node_dmem
node_core -->|"uses interfaces"| node_memory_hierarchy
node_testbench -->|"prints characters"| node_semihost
node_testbench -->|"writes dumps"| node_results

click node_samples "https://github.com/mr-jg-813/risc-v-64-im/tree/main/RISC_V/llvm"
click node_runner "https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/run_c.sh"
click node_images "https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/main_bsram.mem"
click node_simulator "https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/run_sim64"
click node_testbench "https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/tb/tb_RISC_V_Core.v"
click node_core "https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/src_64/RISC_V_Core.v"
click node_fetch "https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/src_64/fetch.v"
click node_decode "https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/src_64/decode.v"
click node_execute "https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/src_64/execute.v"
click node_memory_stage "https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/src_64/memory.v"
click node_writeback "https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/src_64/writeback.v"
click node_hazards "https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/src_64/stallControl.v"
click node_alu "https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/src_64/ALU.v"
click node_imem "https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/src_64/bsram.v"
click node_dmem "https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/src_64/bram.v"
click node_memory_hierarchy "https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/src_64/memory_hierarchy.v"
click node_semihost "https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/src_64/semihost_putchar.v"
click node_results "https://github.com/mr-jg-813/risc-v-64-im/tree/main/RISC_V/results"

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_samples,node_runner,node_images,node_simulator,node_testbench toneBlue
class node_core,node_fetch,node_decode,node_execute,node_memory_stage,node_writeback,node_hazards,node_alu toneAmber
class node_imem,node_dmem,node_memory_hierarchy toneMint
class node_semihost,node_results toneRose
class node_user toneIndigo
```

## Components

### Program Simulation

- [Sample C Programs](https://github.com/mr-jg-813/risc-v-64-im/tree/main/RISC_V/llvm): `RISC_V/llvm`
- [C Runner](https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/run_c.sh): `RISC_V/run_c.sh`
- [Memory Images](https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/main_bsram.mem): `RISC_V/main_bsram.mem`
- [RTL Simulator](https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/run_sim64): `RISC_V/run_sim64`
- [Core Testbench](https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/tb/tb_RISC_V_Core.v): `RISC_V/tb/tb_RISC_V_Core.v`

### Processor Pipeline

- [RV64 Core](https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/src_64/RISC_V_Core.v): `RISC_V/src_64/RISC_V_Core.v`
- [Fetch Stage](https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/src_64/fetch.v): `RISC_V/src_64/fetch.v`
- [Decode Stage](https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/src_64/decode.v): `RISC_V/src_64/decode.v`
- [Execute Stage](https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/src_64/execute.v): `RISC_V/src_64/execute.v`
- [Memory Stage](https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/src_64/memory.v): `RISC_V/src_64/memory.v`
- [Writeback Stage](https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/src_64/writeback.v): `RISC_V/src_64/writeback.v`
- [Stall Bypass](https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/src_64/stallControl.v): `RISC_V/src_64/stallControl.v`
- [Arithmetic Logic](https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/src_64/ALU.v): `RISC_V/src_64/ALU.v`

### Memory System

- [Instruction RAM](https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/src_64/bsram.v): `RISC_V/src_64/bsram.v`
- [Data RAM](https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/src_64/bram.v): `RISC_V/src_64/bram.v`
- [Memory Interfaces](https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/src_64/memory_hierarchy.v): `RISC_V/src_64/memory_hierarchy.v`

### Simulation Output

- [Semihost Output](https://github.com/mr-jg-813/risc-v-64-im/blob/main/RISC_V/src_64/semihost_putchar.v): `RISC_V/src_64/semihost_putchar.v`
- [Simulation Dumps](https://github.com/mr-jg-813/risc-v-64-im/tree/main/RISC_V/results): `RISC_V/results`

### Other components

- **Engineer**

## Connections

- Engineer → C Runner: runs (evidence: `README.md`)
- Sample C Programs → C Runner: provides source (evidence: `README.md`)
- C Runner → Memory Images: creates images (evidence: `README.md`)
- C Runner → RTL Simulator: starts (evidence: `README.md`)
- RTL Simulator → Core Testbench: runs (evidence: `README.md`)
- Core Testbench → RV64 Core: tests (evidence: `README.md`)
- RV64 Core → Fetch Stage: connects stages (evidence: `README.md`)
- RV64 Core → Decode Stage: connects stages (evidence: `README.md`)
- RV64 Core → Execute Stage: connects stages (evidence: `README.md`)
- RV64 Core → Memory Stage: connects stages (evidence: `README.md`)
- RV64 Core → Writeback Stage: connects stages (evidence: `README.md`)
- RV64 Core → Stall Bypass: uses control (evidence: `README.md`)
- Execute Stage → Arithmetic Logic: performs operations (evidence: `README.md`)
- RV64 Core → Instruction RAM: uses instruction RAM (evidence: `README.md`)
- RV64 Core → Data RAM: uses data RAM (evidence: `README.md`)
- RV64 Core → Memory Interfaces: uses interfaces (evidence: `README.md`)
- Core Testbench → Semihost Output: prints characters (evidence: `README.md`)
- Core Testbench → Simulation Dumps: writes dumps (evidence: `README.md`)
