# skandakm29/shakti_risc_v_32i architecture

> Architecture diagram of the GitHub repository skandakm29/shakti_risc_v_32i, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/skandakm29/shakti_risc_v_32i
- Repository: https://github.com/skandakm29/shakti_risc_v_32i

## Overview

##### Main Components
– ALU (e.g., module_fn_alu, mkalu)
– Register File (e.g., RegFile.v and RegFileLoad.v)
– Control/CSR Unit (e.g., mkcsr.v, mkcsrfile.v)
– Pipeline stages modules (e.g., mkstage1.v, mkstage2.v, mkstage3.v)
- Memory Subsystem – Highlight the BRAM modules (e.g., BRAM1Load.v, BRAM2.v, etc.) which likely serve as on-chip memory.
- FIFO and Synchronization Units – Include modules like FIFO, SyncFIFO, and SyncHandshake that manage buffering and clock-domain crossings.
- Boot and External Interfaces – Use the “boot.hex” and boot loader binaries (boot.LSB, boot.MSB) to indicate a boot sequence or initialization process.
- Additional Modules – Other supporting modules like address validation, decode units, and signal inverters (e.g., ClockInverter.v, ResetEither.v) should be shown as peripheral functional blocks.

##### Relationships and Data Flow
- Data paths between the CPU’s register file, the ALU, and memory modules.
- Interactions between pipeline stages—marking interfaces between mkstage1, mkstage2, and mkstage3 blocks.

##### Architectural Patterns and Design Principles
- Modularity – Emphasize that each hardware block (e.g., arithmetic, control, memory) is a separate Verilog module, permitting reuse and easier testing.
- Pipeline Architecture – Since there are clearly distinct “stage” modules, outline the pipeline flow from instruction fetch through execution.
- Synchronous Design – Signal the synchronization mechanisms in place (e.g., SyncFIFO, SyncHandshake, SyncReset) which are critical in digital circuits.
- Boot and Initialization Flow – Capture how the boot loader (using boot.hex) interacts with the processor core to start the system.

##### Specify Relevant Technologies and Tools
- Verilog HDL – Indicate that all components are designed in Verilog.
- FPGA/ASIC Context – Given the file organization (presence of binary output and synthesis report files like yosys_report.txt), the target might be an FPGA or ASIC.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clock and Reset Generation
    subgraph "Clock and Reset Generation"
        CR["Clock/Reset Generation"]:::clk
    end

    %% Boot and External Interfaces
    subgraph "Boot & External Interfaces"
        BOOT["Boot Loader & Interfaces"]:::boot
    end

    %% CPU Core and its modules
    subgraph "CPU Core"
        CPU["Shakti RISC-V 32I Core"]:::core
        subgraph "Core Modules"
            ALU["ALU"]:::module
            RF["Register File"]:::module
            CSR["Control/CSR Unit"]:::module
            PIPE["Pipeline Stages"]:::module
        end
    end

    %% Memory Subsystem
    subgraph "Memory Subsystem"
        MEM["BRAM Modules"]:::mem
    end

    %% FIFO and Synchronization Units
    subgraph "FIFO and Sync Units"
        FIFO["FIFO & Sync Modules"]:::sync
    end

    %% Connections between components
    CR -->|"feeds"| CPU
    CR -->|"supplies"| MEM
    CR -->|"drives"| FIFO

    BOOT -->|"initializes"| CPU

    CPU -->|"data interface"| MEM
    CPU -->|"synchronizes"| FIFO

    PIPE -->|"controls"| CSR
    PIPE -->|"arithmetic"| ALU
    PIPE -->|"buffers"| FIFO

    ALU -->|"operates on"| RF
    RF -->|"feeds data"| ALU

    %% Click Events for CPU Core
    click CPU "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/mkSoc.v"
    click CPU "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/mkriscv.v"

    %% Click Events for ALU
    click ALU "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/module_fn_alu.v"
    click ALU "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/mkalu.v"

    %% Click Events for Register File
    click RF "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/RegFile.v"
    click RF "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/RegFileLoad.v"

    %% Click Events for Control/CSR Unit
    click CSR "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/mkcsr.v"
    click CSR "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/mkcsrfile.v"

    %% Click Events for Pipeline Stages
    click PIPE "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/mkstage1.v"
    click PIPE "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/mkstage2.v"
    click PIPE "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/mkstage3.v"

    %% Click Events for Memory Subsystem (BRAM Modules)
    click MEM "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/BRAM1Load.v"
    click MEM "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/BRAM2.v"
    click MEM "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/BRAM2BE.v"
    click MEM "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/BRAM2BELoad.v"
    click MEM "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/BRAM2Load.v"
    click MEM "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/bram_1r1w.v"
    click MEM "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/bram_1rw.v"

    %% Click Events for FIFO and Synchronization Units
    click FIFO "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/FIFO1.v"
    click FIFO "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/FIFO10.v"
    click FIFO "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/FIFO2.v"
    click FIFO "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/FIFO20.v"
    click FIFO "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/FIFOL1.v"
    click FIFO "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/SizedFIFO.v"
    click FIFO "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/SyncFIFO.v"
    click FIFO "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/SyncFIFO1.v"
    click FIFO "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/SyncHandshake.v"
    click FIFO "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/SyncRegister.v"
    click FIFO "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/SyncReset0.v"
    click FIFO "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/SyncResetA.v"

    %% Click Events for Clock and Reset Generation
    click CR "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/MakeClock.v"
    click CR "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/MakeReset0.v"
    click CR "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/MakeResetA.v"
    click CR "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/UngatedClockMux.v"
    click CR "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/ClockInverter.v"
    click CR "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/ResetEither.v"

    %% Click Events for Boot and External Interfaces
    click BOOT "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/verilog_nex/verilog/boot.hex"
    click BOOT "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/bin_nex/bin/boot.LSB"
    click BOOT "https://github.com/skandakm29/shakti_risc_v_32i/blob/main/Shakthi_basic/bin_nex/bin/boot.MSB"

    %% Styles
    classDef core fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef module fill:#d4edda,stroke:#333,stroke-width:2px;
    classDef mem fill:#fff3cd,stroke:#333,stroke-width:2px;
    classDef sync fill:#f8d7da,stroke:#333,stroke-width:2px;
    classDef clk fill:#d1ecf1,stroke:#333,stroke-width:2px;
    classDef boot fill:#e2e3e5,stroke:#333,stroke-width:2px;
```
