# morphingmachines/rockettile architecture

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

- Interactive diagram: https://gitdiagram.com/morphingmachines/rockettile
- Repository: https://github.com/morphingmachines/rockettile

## Overview

##### Main Components
- Core Generator & Top-Level Module: Represent the central RocketTile design (see files like src/main/scala/Top.scala, CE.scala, Config.scala, and Uncore.scala). This is the heart of your FPGA/ASIC design.
- Accelerator Modules: Include RoCC components such as the LazyRoCC (src/main/scala/LazyRoCC.scala) and the simpleRoCC submodules (along with examples like Accumulator.scala and DMA.scala) that extend or accelerate functions in the core.
- Simulation Infrastructure: Illustrate the simulation testbench (src/main/scala/sim/SimDUT.scala) plus the connection to the Front-End Server (FESVR) used during simulation when running “make verilate”. This section should also note the integration with Spike and the dependency on the FESVR library.
- Bare-Metal Environment: Show the support files located under src/main/resources/baremetal. Include bootrom code (with its Makefile, bootrom.S, and image files) and the various example programs (e.g., vecAdd, rocc-example, assembly-example) which validate the design in a bare-metal context.
- External Dependencies: Highlight the external “playground” library that must reside alongside RocketTile and any linking with riscv-tests for executing the bare-metal examples.

##### Interactions and Relationships
- Simulator (SimDUT) to the generated Verilog components, showing how testbenches drive and verify the hardware design.
- Data flow from the bootrom and bare-metal initialization code into the core (startup sequences, assembly initialization, interrupt/exit system calls).

##### Architectural Patterns and Design Principles
- Modular Design: Emphasize that the design is split into distinct modules (core, accelerators, simulation/testbench, bootrom/baremetal examples) which interact via well-defined interfaces.
- Reuse of Frameworks: Note that Chisel is used to generate the Verilog, and the diplomacy graph (see the graphml file generated with “make rtl”) represents the inter-module communication and hierarchy.
- Layering: Clearly mark the separation between hardware description (Scala/Chisel modules), simulation environment (test benches and FESVR integration), and baremetal runtime examples.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Hardware Design Layer
    subgraph "Hardware Design"
        subgraph "RocketTile Core"
            RocketTile1["Top.scala – RocketTile Core"]:::core
            RocketTile2["CE.scala – RocketTile Core"]:::core
            RocketTile3["Config.scala – RocketTile Core"]:::core
            RocketTile4["Uncore.scala – RocketTile Core"]:::core
        end
        subgraph "Accelerator Modules"
            LazyRoCC["LazyRoCC – RoCC Accelerator"]:::accelerator
            Accumulator["Accumulator – RoCC Example"]:::accelerator
            DMA["DMA – RoCC Example"]:::accelerator
            RoCCIOBridge["RoCC I/O Bridge"]:::accelerator
        end
    end

    %% Simulation Environment Layer
    subgraph "Simulation Environment"
        SimDUT["SimDUT – Simulation Testbench"]:::simulator
        TestbenchDriver["Testbench Driver – C++"]:::simulator
    end

    %% Bare-Metal Environment Layer
    subgraph "Bare-Metal Environment"
        subgraph "Bootrom"
            BootromMakefile["Makefile – Bootrom"]:::baremetal
            BootromS["bootrom.S"]:::baremetal
            BootromRV32["bootrom.rv32.img"]:::baremetal
            BootromRV64["bootrom.rv64.img"]:::baremetal
            Linker["linker.ld"]:::baremetal
        end
        BareMetalExamples["Bare-metal Examples"]:::baremetal
    end

    %% External Dependencies Layer
    subgraph "External Dependencies"
        Playground["Playground Library"]:::external
    end

    %% Connections between Components
    RocketTile1 -->|"RoCC_interface"| LazyRoCC
    RocketTile1 -->|"RoCC_interface"| Accumulator
    RocketTile1 -->|"RoCC_interface"| DMA
    RocketTile1 -->|"RoCC_interface"| RoCCIOBridge

    TestbenchDriver -->|"drives"| SimDUT
    SimDUT -->|"stimulates"| RocketTile1

    BootromS -->|"boots"| RocketTile1
    BareMetalExamples -->|"runtime_code"| RocketTile1

    Playground -->|"dependency"| RocketTile1

    %% Styles
    classDef core fill:#f9d5b5,stroke:#333,stroke-width:2px;
    classDef accelerator fill:#a6e1fa,stroke:#333,stroke-width:2px;
    classDef simulator fill:#c8e6c9,stroke:#333,stroke-width:2px;
    classDef baremetal fill:#fff9c4,stroke:#333,stroke-width:2px;
    classDef external fill:#f8bbd0,stroke:#333,stroke-width:2px;

    %% Click Events for RocketTile Core Files
    click RocketTile1 "https://github.com/morphingmachines/rockettile/blob/master/src/main/scala/Top.scala"
    click RocketTile2 "https://github.com/morphingmachines/rockettile/blob/master/src/main/scala/CE.scala"
    click RocketTile3 "https://github.com/morphingmachines/rockettile/blob/master/src/main/scala/Config.scala"
    click RocketTile4 "https://github.com/morphingmachines/rockettile/blob/master/src/main/scala/Uncore.scala"

    %% Click Events for Accelerator Modules
    click LazyRoCC "https://github.com/morphingmachines/rockettile/blob/master/src/main/scala/LazyRoCC.scala"
    click Accumulator "https://github.com/morphingmachines/rockettile/blob/master/src/main/scala/simpleRoCC/Examples/Accumulator.scala"
    click DMA "https://github.com/morphingmachines/rockettile/blob/master/src/main/scala/simpleRoCC/Examples/DMA.scala"
    click RoCCIOBridge "https://github.com/morphingmachines/rockettile/blob/master/src/main/scala/simpleRoCC/RoCCIOBridge.scala"

    %% Click Events for Simulation Infrastructure
    click SimDUT "https://github.com/morphingmachines/rockettile/blob/master/src/main/scala/sim/SimDUT.scala"
    click TestbenchDriver "https://github.com/morphingmachines/rockettile/blob/master/src/main/resources/test_tb_top.cpp"

    %% Click Events for Bare-Metal Environment
    click BootromMakefile "https://github.com/morphingmachines/rockettile/tree/master/src/main/resources/bootrom/Makefile"
    click BootromS "https://github.com/morphingmachines/rockettile/blob/master/src/main/resources/bootrom/bootrom.S"
    click BootromRV32 "https://github.com/morphingmachines/rockettile/blob/master/src/main/resources/bootrom/bootrom.rv32.img"
    click BootromRV64 "https://github.com/morphingmachines/rockettile/blob/master/src/main/resources/bootrom/bootrom.rv64.img"
    click Linker "https://github.com/morphingmachines/rockettile/blob/master/src/main/resources/bootrom/linker.ld"
    click BareMetalExamples "https://github.com/morphingmachines/rockettile/tree/master/src/main/resources/baremetal"

    %% Click Event for External Dependency
    click Playground "https://github.com/morphingmachines/rockettile/blob/master/playground.hash"
```
