# funningboy/uvm_axi architecture

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

- Interactive diagram: https://gitdiagram.com/funningboy/uvm_axi
- Repository: https://github.com/funningboy/uvm_axi

## Overview

This project is an AXI Bus Functional Model (BFM) protocol checker designed to verify AXI interfaces in a simulation environment. Its purpose is to perform protocol checks (read/write phase, valid/ready handshakes, ID mapping, and transfer verification) for designs under test (DUT) that implement AXI protocols. Key indicators, such as directories named “dpi”, “pli”, “sv”, “v”, and “examples”, combined with the README content, show that the project focuses on simulation-based verification using UVM-like SystemVerilog testbench components and various DPI/PLI interfaces.

##### Main components
- Testbench Environment:
– Located under the “sv” directory (contains UVM classes and agents like axi_master_agent, axi_slave_agent, and measurement components such as monitors & recorders).
– Sequence libraries under “sv/sequence_libs” provide test scenarios (both master and slave sequences).
- Design Under Test (DUT):
– Found in the “v” directory (e.g., axi_slave.v) which represents the actual hardware module or DUT to be verified.
- DPI and PLI Interfaces:
– “dpi” directory with SystemVerilog DPI interface files (dpi_mem.c, mem.c, mem.h, and Makefile) that facilitate interactions with external C code.
– “pli” directory containing C files (dram.c, vpi_user.c) that support legacy PLI interfacing.
- Examples:
– The “examples” directory shows practical configurations for testing scenarios such as “virtual_master_to_dut_slave” and “virtual_master_to_virtual_slave”. These examples integrate the different components: DUT, the test environment, and configuration files (demo_conf.sv) that describe memory maps and interface connectivity.

##### Relationships and interactions
- The Testbench Environment (in “sv” and its sequence libraries) interacts with the DUT (in “v”) via interfaces defined in the DUT and the verification environment modules.
- DPI and PLI modules provide auxiliary or additional interfacing layers between simulation and C/C++ code, useful for memory modelling or integration with external components.
- The examples serve as complete instantiations of the architecture where the DUT is connected to virtual masters (or slaves) to simulate the complete AXI-based transaction sequences.
- The run.py script serves to orchestrate and automate simulation runs, likely invoking compilers and simulators, and connecting all the components.

##### Architectural patterns and design principles
- UVM-based Verification: The “sv” folder contains UVM-like testbench components (agents, drivers, monitors, sequencers) that embody a modular verification methodology.
- Interface Abstraction: DPI and PLI integration abstracts low-level interactions with external models and C code, enabling flexibility.
- Modular Test Scenarios: The “examples” directory indicates a design pattern where various test scenarios (different master/slave configurations) are provided to verify the DUT under multiple conditions.
- Layered Architecture: Separation between the DUT, testbench environment, and interface layers illustrates clear responsibilities and isolation of concerns.

##### Relevant technologies and frameworks
- SystemVerilog (for DUT, testbench, UVM classes)
- DPI and PLI (for C/SystemVerilog interfacing)
- Simulation tools like irun (as mentioned in README)
- Python (for orchestration via run.py)

- Use clear labels for each major component:
- “DUT (v/axi_slave.v)”
- “Testbench (sv/ UVM components & sequence libraries)”
- “DPI Interface (dpi directory)”
- “PLI Interface (pli directory)”
- “Example Scenarios (examples/virtual_master_to_dut_slave, examples/virtual_master_to_virtual_slave)”
- Rectangles for main hardware blocks (DUT, DPI/PLI modules)
- Ovals for testbench components or external interfaces.
- Additional elements such as configuration files (demo_conf.sv) and control scripts (run.py) to represent orchestration and configuration management.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Simulation Orchestration"
        runpy("Simulation Orchestration (run.py)")
    end

    subgraph "Testbench Environment"
        uvm("UVM Components (sv)")
        seq("Sequence Libraries (sv/sequence_libs)")
        uvm --> seq
    end

    dut("DUT (v/axi_slave.v)")

    subgraph "DPI Interface"
        dpi1("dpi_mem.c")
        dpi2("mem.c")
        dpi3("mem.h")
        dpi4("Makefile")
        dpi1 --> dpi2
        dpi2 --> dpi3
        dpi3 --> dpi4
    end

    subgraph "PLI Interface"
        pli1("dram.c")
        pli2("vpi_user.c")
        pli1 --> pli2
    end

    subgraph "Example Scenarios"
        ex1("Example: virtual_master_to_dut_slave")
        ex2("Example: virtual_master_to_virtual_slave")
        config("Configuration (demo_conf.sv)")
        ex1 --> config
        ex2 --> config
    end

    %% Connections
    runpy --> uvm
    runpy --> dut
    uvm --> dut
    dut --> dpi1
    dut --> pli1
    uvm -- "drives" --> ex1
    uvm -- "drives" --> ex2
    dut -- "interfaces" --> ex1
    dut -- "interfaces" --> ex2

    %% Styles
    classDef orchestrator fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
    classDef uvm fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef dut fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef dpi fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef pli fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef examples fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;

    class runpy orchestrator;
    class uvm,seq uvm;
    class dut dut;
    class dpi1,dpi2,dpi3,dpi4 dpi;
    class pli1,pli2 pli;
    class ex1,ex2,config examples;

    %% Click Events
    click runpy "https://github.com/funningboy/uvm_axi/blob/master/run.py"
    click uvm "https://github.com/funningboy/uvm_axi/tree/master/sv"
    click seq "https://github.com/funningboy/uvm_axi/tree/master/sv/sequence_libs"
    click dut "https://github.com/funningboy/uvm_axi/blob/master/v/axi_slave.v"
    click dpi1 "https://github.com/funningboy/uvm_axi/blob/master/dpi/dpi_mem.c"
    click dpi2 "https://github.com/funningboy/uvm_axi/blob/master/dpi/mem.c"
    click dpi3 "https://github.com/funningboy/uvm_axi/blob/master/dpi/mem.h"
    click dpi4 "https://github.com/funningboy/uvm_axi/tree/master/dpi/Makefile"
    click pli1 "https://github.com/funningboy/uvm_axi/blob/master/pli/dram.c"
    click pli2 "https://github.com/funningboy/uvm_axi/blob/master/pli/vpi_user.c"
    click ex1 "https://github.com/funningboy/uvm_axi/tree/master/examples/virtual_master_to_dut_slave"
    click ex2 "https://github.com/funningboy/uvm_axi/tree/master/examples/virtual_master_to_virtual_slave"
```
