# nhpoole/dnn_accelerator architecture

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

- Interactive diagram: https://gitdiagram.com/nhpoole/dnn_accelerator
- Repository: https://github.com/nhpoole/dnn_accelerator

## Overview

##### Project type and purpose
- This is a hardware-design EDA flow for a convolutional neural-network accelerator (“dnn_accelerator”).
- It bundles Verilog RTL, C++/Verilog testbenches, Python orchestration (mflowgen), and a full synthesis → place-and-route → sign-off pipeline using Cadence and Synopsys tools as well as open-source DRC/LVS.

##### File structure
- Top-level “design” folder holds the mflowgen graph definition (`.mflowgen.yml`) and orchestration script (`construct.py`).
- Under “design” you see subdirectories per flow stage:
- rtl            – Verilog sources
- testbench      – testbench C++/Verilog + JSON parameter files
- synopsys-ptpx-rtl – RTL synthesis tcl for Synopsys pt_px
- cadence-xcelium-sim / synopsys-vcs-sim – simulation flows
- floorplan / pin-placement – physical-planning scripts
- cadence-innovus-power / cadence-innovus-signoff – power analysis & sign-off flows
- open-magic-drc / open-netgen-lvs / open-magic-def2spice – open-source DRC, LVS, spice-extraction
- constraints, sram – constraint files & memory generator configs
- A top-level “reports” directory holds all flow outputs and sign-off reports.

##### README for additional insights
- The README confirms the goal: a complete RTL+testbench and synthesis/layout reports for a CNN accelerator.

a. Main components
1. RTL library (Verilog)
2. Testbench & parameter generator
3. Flow orchestrator (mflowgen + construct.py)
4. Simulation engines: Cadence Xcelium, Synopsys VCS
5. RTL synthesis: Synopsys pt_px
6. Floorplan & pin-placement scripts
7. -and-route & power analysis: Cadence Innovus
8. Physical verification: Magic (DRC), Netgen (LVS), def2spice extraction
9. Sign-off reporting
10. SRAM generator & constraints subsystem
b. Relationships and interactions
- The mflowgen graph triggers:
- Testbench flows (simulate the RTL with golden C++ model).
- Synthesis of RTL into gate-level netlist.
- The synthesized netlist plus constraints feed floorplanning and pin-placement.
- Floorplan outputs feed Innovus for P&R.
- P&R deliver GDSII/netlist to:
- Power analysis (Innovus-power)
- DRC/LVS (Magic/Netgen)
- Spice extraction (def2spice)
- All these feed into sign-off scripts for timing, power, and area reports.
c. Architectural patterns/design principles
- A staged pipeline (simulation → synthesis → physical design → verification → sign-off)
- Modular flows orchestrated by a central Python/mflowgen script
- Separation of open-source vs. commercial tool steps
d. Key technologies/frameworks
- Verilog RTL
- Python + mflowgen
- Cadence Innovus & Xcelium
- Synopsys pt_px & VCS
- Magic, Netgen, def2spice

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Orchestrator
    Orchestrator("mflowgen Orchestrator"):::orchestrator
    click Orchestrator "https://github.com/nhpoole/dnn_accelerator/blob/main/design/construct.py"

    %% Source Libraries
    RTL["RTL Library"]:::synthesis
    click RTL "https://github.com/nhpoole/dnn_accelerator/tree/main/design/rtl/verilog/"
    Testbench["Testbench & Parameter Gen"]:::simulation
    click Testbench "https://github.com/nhpoole/dnn_accelerator/blob/main/design/testbench/conv_tb.cpp"

    %% Simulation Flows
    subgraph "Simulation" 
        Xcelium["Cadence Xcelium"]:::simulation
        VCS["Synopsys VCS"]:::simulation
    end
    click Xcelium "https://github.com/nhpoole/dnn_accelerator/blob/main/design/cadence-xcelium-sim/configure.yml"
    click VCS "https://github.com/nhpoole/dnn_accelerator/blob/main/design/synopsys-vcs-sim/run.sh"

    %% Synthesis & Physical Design
    subgraph "Synthesis & Physical Design"
        Synthesis["RTL Synthesis (Synopsys pt_px)"]:::synthesis
        Floorplan["Floorplan"]:::synthesis
        PinPlacement["Pin-Placement"]:::synthesis
        PnR["Place-and-Route (Innovus)"]:::synthesis
        Power["Power Analysis"]:::synthesis
        Signoff["Sign-off (Timing/Power/Area)"]:::synthesis
    end
    click Synthesis "https://github.com/nhpoole/dnn_accelerator/blob/main/design/synopsys-ptpx-rtl/pt_px.tcl"
    click Floorplan "https://github.com/nhpoole/dnn_accelerator/blob/main/design/floorplan/configure.yml"
    click PinPlacement "https://github.com/nhpoole/dnn_accelerator/blob/main/design/pin-placement/configure.yml"
    click Power "https://github.com/nhpoole/dnn_accelerator/blob/main/design/cadence-innovus-power/START.tcl"
    click Signoff "https://github.com/nhpoole/dnn_accelerator/blob/main/design/cadence-innovus-signoff/START.tcl"

    %% Physical Verification
    subgraph "Physical Verification" 
        DRC["DRC (Magic)"]:::verification
        LVS["LVS (Netgen)"]:::verification
        Spice["Spice Extraction"]:::verification
    end
    click DRC "https://github.com/nhpoole/dnn_accelerator/blob/main/design/open-magic-drc/run_drc.tcl"
    click LVS "https://github.com/nhpoole/dnn_accelerator/blob/main/design/open-netgen-lvs/run_lvs.sh"
    click Spice "https://github.com/nhpoole/dnn_accelerator/blob/main/design/open-magic-def2spice/extract.tcl"

    %% Constraints & SRAM
    Constraints["Constraints"]:::synthesis
    SRAM["SRAM Generator"]:::synthesis
    click Constraints "https://github.com/nhpoole/dnn_accelerator/blob/main/design/constraints/constraints.tcl"
    click SRAM "https://github.com/nhpoole/dnn_accelerator/blob/main/design/sram/configure.yml"

    %% Reports
    Reports["Reports Store"]:::data
    click Reports "https://github.com/nhpoole/dnn_accelerator/tree/main/reports/"

    %% Flow Connections
    Orchestrator --> RTL
    Orchestrator --> Testbench

    RTL -->|Verilog| Testbench
    Testbench -->|Stimuli| Xcelium
    Testbench -->|Stimuli| VCS

    Orchestrator --> Synthesis
    RTL -->|RTL Sources| Synthesis
    Constraints -->|Constraints| Synthesis
    SRAM -->|Memory Config| Synthesis

    Synthesis -->|Gate-Level Netlist| Floorplan
    Floorplan -->|Floorplan TCL| PinPlacement
    PinPlacement -->|Pin Assignments| PnR

    PnR -->|GDSII/Netlist| Power
    PnR -->|GDSII/Netlist| DRC
    PnR -->|GDSII/Netlist| LVS
    PnR -->|GDSII/Netlist| Spice

    Power -->|Analysis RPT| Signoff
    DRC -->|DRC RPT| Signoff
    LVS -->|LVS RPT| Signoff
    Spice -->|Spice RPT| Signoff

    Signoff --> Reports
    Xcelium --> Reports
    VCS --> Reports

    %% Styles
    classDef simulation fill:#AEDFF7,stroke:#1E90FF,color:#000;
    classDef synthesis fill:#C8E6C9,stroke:#2E7D32,color:#000;
    classDef verification fill:#FFE0B2,stroke:#F57C00,color:#000;
    classDef orchestrator fill:#E0E0E0,stroke:#616161,color:#000;
    classDef data fill:#F5F5F5,stroke:#9E9E9E,color:#000;
```
