# vsdip/shakti_vsdfpga architecture

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

- Interactive diagram: https://gitdiagram.com/vsdip/shakti_vsdfpga
- Repository: https://github.com/vsdip/shakti_vsdfpga

## Overview

- CPU Core (“eclass”): The central processor that interprets instructions and orchestrates transactions.
- CLINT (Timer and Interrupt Controller): Manages timers and interrupt signals.
- UART: Handles serial communication with FIFOs for transmit and receive operations.
- Interconnect Fabric (AXI4-Lite Crossbar): Routes read/write requests between the CPU, memory controllers, and peripherals.
- Main Memory Interface: Connects the SoC to main memory (RAM).
- Boot Memory Interface: Connects the SoC to boot memory (ROM/flash).
- Error Handler (e.g., err_slave): Catches and manages invalid accesses for debugging purposes.
- Simulation Monitor (signature): Ends simulation when tests complete.
- AXI Transaction Handlers: These include blocks like “clint_s_xactor” and “uart_s_xactor” for handling AXI read/write transactions.

##### Important architectural patterns and design principles
- “monolithic design style” used in this project. Although logic is grouped by functionality (using naming conventions such as “mkSoc,” “mkcpu,” “mkcsr”, etc.), all functionality is integrated into the top level rather than split across many independently instantiated modules.
- Point out the use of AXI4-Lite as the protocol for communication on the interconnect; this is central to the data routing between the various components, providing standardized handshaking (via valid/ready signals) and addressing.

##### Relevant technologies, frameworks, or components
- Verilog is the language used for describing the hardware.
- The design shows support for both 32-bit and 64-bit variations of the SoC, so it may be helpful to indicate that there are design variants within the repository.
- Modules like “mkSoc,” “mkalu,” “mkcsr,” and various FIFO modules that are used to implement specific functionalities like arithmetic processing, control/status, and buffering.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "32-bit SoC Design"
        CR1["Clock & Reset"]:::clkres
        CPU32["CPU Core (32-bit)"]:::comp
        CLINT32["CLINT (32-bit)"]:::peri
        AXI32["AXI4-Lite Fabric (32-bit)"]:::axi
        SIM32["Simulation Monitor (32-bit)"]:::sim
        UART32["UART"]:::peri
        ERR32["Error Handler"]:::err
        MM32a["BRAM 1RW (Main Memory, 32-bit)"]:::mem
        MM32b["BRAM 1R1W (Main Memory, 32-bit)"]:::mem

        CR1 --> CPU32
        CR1 --> CLINT32
        CR1 --> AXI32
        CR1 --> UART32
        CR1 --> MM32a
        CR1 --> MM32b

        CPU32 -->|"sends_AXI_requests"| AXI32
        AXI32 -->|"routes_to"| CLINT32
        AXI32 -->|"routes_to"| UART32
        AXI32 -->|"routes_to"| MM32a
        AXI32 -->|"routes_to"| MM32b
        AXI32 -->|"routes_to"| ERR32
        SIM32 -->|"monitors"| CPU32
    end

    subgraph "64-bit SoC Design"
        CR2["Clock & Reset"]:::clkres
        CPU64["CPU Core (64-bit)"]:::comp
        CLINT64["CLINT (64-bit)"]:::peri
        AXI64["AXI4-Lite Fabric (64-bit)"]:::axi
        SIM64["Simulation Monitor (64-bit)"]:::sim
        UART64["UART"]:::peri
        ERR64["Error Handler"]:::err
        MM64a["BRAM 1RW (Main Memory, 64-bit)"]:::mem
        MM64b["BRAM 1R1W (Main Memory, 64-bit)"]:::mem

        CR2 --> CPU64
        CR2 --> CLINT64
        CR2 --> AXI64
        CR2 --> UART64
        CR2 --> MM64a
        CR2 --> MM64b

        CPU64 -->|"sends_AXI_requests"| AXI64
        AXI64 -->|"routes_to"| CLINT64
        AXI64 -->|"routes_to"| UART64
        AXI64 -->|"routes_to"| MM64a
        AXI64 -->|"routes_to"| MM64b
        AXI64 -->|"routes_to"| ERR64
        SIM64 -->|"monitors"| CPU64
    end

    subgraph "Boot Memory Interface"
        BootLSB["Boot LSB"]:::mem
        BootMSB["Boot MSB"]:::mem
    end

    AXI32 -->|"routes_to"| BootLSB
    AXI32 -->|"routes_to"| BootMSB
    AXI64 -->|"routes_to"| BootLSB
    AXI64 -->|"routes_to"| BootMSB

    click CPU32 "https://github.com/vsdip/shakti_vsdfpga/blob/main/eclass_32bit/mkriscv.v"
    click CLINT32 "https://github.com/vsdip/shakti_vsdfpga/blob/main/eclass_32bit/module_chk_interrupt.v"
    click AXI32 "https://github.com/vsdip/shakti_vsdfpga/blob/main/eclass_32bit/mkeclass_axi4lite.v"
    click SIM32 "https://github.com/vsdip/shakti_vsdfpga/blob/main/eclass_32bit/mksign_dump_axi4.v"
    click MM32a "https://github.com/vsdip/shakti_vsdfpga/blob/main/eclass_32bit/bram_1rw.v"
    click MM32b "https://github.com/vsdip/shakti_vsdfpga/blob/main/eclass_32bit/bram_1r1w.v"

    click CPU64 "https://github.com/vsdip/shakti_vsdfpga/blob/main/eclass_64bit/mkriscv.v"
    click CLINT64 "https://github.com/vsdip/shakti_vsdfpga/blob/main/eclass_64bit/module_chk_interrupt.v"
    click AXI64 "https://github.com/vsdip/shakti_vsdfpga/blob/main/eclass_64bit/mkeclass_axi4lite.v"
    click SIM64 "https://github.com/vsdip/shakti_vsdfpga/blob/main/eclass_64bit/mksign_dump_axi4lite.v"
    click MM64a "https://github.com/vsdip/shakti_vsdfpga/blob/main/eclass_64bit/bram_1rw.v"
    click MM64b "https://github.com/vsdip/shakti_vsdfpga/blob/main/eclass_64bit/bram_1r1w.v"

    click BootLSB "https://github.com/vsdip/shakti_vsdfpga/blob/main/bin/boot.LSB"
    click BootMSB "https://github.com/vsdip/shakti_vsdfpga/blob/main/bin/boot.MSB"

    classDef comp fill:#FFCC00,stroke:#333,stroke-width:2px;
    classDef peri fill:#99CCFF,stroke:#333,stroke-width:2px;
    classDef axi fill:#CCFFCC,stroke:#333,stroke-width:2px;
    classDef sim fill:#FF9999,stroke:#333,stroke-width:2px;
    classDef mem fill:#CCCCFF,stroke:#333,stroke-width:2px;
    classDef err fill:#FFCCFF,stroke:#333,stroke-width:2px;
    classDef clkres fill:#D3D3D3,stroke:#333,stroke-width:2px;
```
