# valerii-dzhafarov/uvm_templates architecture

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

- Interactive diagram: https://gitdiagram.com/valerii-dzhafarov/uvm_templates
- Repository: https://github.com/valerii-dzhafarov/uvm_templates

## Overview

##### Project type and purpose
- This is a UVM verification‐environment *template library*.
- It provides two template modules:
– comp1_env1_env/ : a UVM Environment template
– comp1_agent1_agent/ : a UVM Agent template
- There’s also a DUT model under dut/ (stack.sv) and an instantiation script instant.py to copy & rename templates.

##### File structure
- Top level:
– comp1_env1_env/ (environment packages, TB, wrapper, tests, config files)
– comp1_agent1_agent/ (agent interface, package, include files for driver, monitor, sequencer, sequences, coverage, checker)
– dut/ (stack.sv)
– instant.py (template instantiation tool)
- comp1_env1_env/include/seq & /test holds base sequences/tests.
- comp1_agent1_agent/include/seq holds base agent sequences.
- Scripts/config.mk in each template folder drive compile/build options.

##### README for additional insights
- instant.py: automates copying the chosen template (env or agent), renames folders/files, and replaces placeholder text.
- The README lists compile & runtime options for QuestaSim, Synopsys, Cadence—indicating how the testbench is driven.

##### Main components & their relationships
– Reads user options (mode=env/agent, company, name, target_dir)
– Produces an instantiated template directory.
– Instantiates:
- `comp1_env1_wrapper` (orange)
- `stack.sv` (DUT)
– Binds interfaces for DUT and agent.
– Contains: agents (comp1_agent1_agent)
– Configures settings (env1_cfg)
– Hosts scoreboard or coverage collector (if added)
– Sub-components in include/:
- Driver (agent1_driver.svh) → drives DUT via the interface
- Sequencer (agent1_sequencer.svh) → issues sequence items (agent1_item.svh)
- Monitor (agent1_monitor.svh) → samples DUT signals back to analysis ports
- Checker (agent1_checker.svh) → optional functional checking
- Coverage collector (agent1_cov_collector.svh)
– Custom sequences in include/seq (agent1_base_seq.svh)
– Simple stack model used to test templates.

##### Architectural patterns & design principles
- UVM Factory for component creation
- Transaction‐based verification: sequences → sequencer → driver → DUT → monitor → analysis ports → scoreboard/checker
- Layered hierarchy: top → env → agent → driver/monitor/sequencer
- Reusable & parameterized packages for config and utilities.

##### Essential elements to capture
- instant.py → template copy/rename process
- comp1_env1_tb (top) → comp1_env1_wrapper → comp1_env1_env → comp1_agent1_agent → driver/monitor/sequencer
- Interfaces between agent and DUT
- /config files and sequence/test packages
- UVM factory & hierarchal “uvm_component_utils” registrations

– How the instantiation script ties into the template library
– The hierarchy and relationships within the UVM testbench
– Data/transaction flows between sequencer, driver, DUT, and monitor/checker
– The points where configuration and template pragmas are applied
– Where each file from the project file tree fits into the overall architecture.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Tool
    instant["instant.py"]:::tool
    click instant "https://github.com/valerii-dzhafarov/uvm_templates/blob/main/instant.py"

    %% Generated Template
    subgraph "Generated Template"
        direction TB

        TB["comp1_env1_tb.sv"]:::toplevel
        click TB "https://github.com/valerii-dzhafarov/uvm_templates/blob/main/comp1_env1_env/comp1_env1_tb.sv"

        Interface["comp1_env1_tb_if.sv"]:::toplevel
        click Interface "https://github.com/valerii-dzhafarov/uvm_templates/blob/main/comp1_env1_env/comp1_env1_tb_if.sv"

        Wrapper["comp1_env1_wrapper.sv"]:::wrapper
        click Wrapper "https://github.com/valerii-dzhafarov/uvm_templates/blob/main/comp1_env1_env/comp1_env1_wrapper.sv"

        DUT["stack.sv"]:::dut
        click DUT "https://github.com/valerii-dzhafarov/uvm_templates/blob/main/dut/stack.sv"

        subgraph "Environment"
            direction TB
            EnvPkg["comp1_env1_env_pkg.sv"]:::env
            click EnvPkg "https://github.com/valerii-dzhafarov/uvm_templates/blob/main/comp1_env1_env/comp1_env1_env_pkg.sv"

            EnvCfg["env1_cfg.svh"]:::env
            click EnvCfg "https://github.com/valerii-dzhafarov/uvm_templates/blob/main/comp1_env1_env/include/env1_cfg.svh"

            EnvEnv["env1_env.svh"]:::env
            click EnvEnv "https://github.com/valerii-dzhafarov/uvm_templates/blob/main/comp1_env1_env/include/env1_env.svh"

            EnvSB["env1_stack_sb.svh"]:::env
            click EnvSB "https://github.com/valerii-dzhafarov/uvm_templates/blob/main/comp1_env1_env/include/env1_stack_sb.svh"

            EnvSeq["env1_vseq.svh"]:::env
            click EnvSeq "https://github.com/valerii-dzhafarov/uvm_templates/blob/main/comp1_env1_env/include/seq/env1_vseq.svh"

            TestPkg["env1_base_test.svh"]:::env
            click TestPkg "https://github.com/valerii-dzhafarov/uvm_templates/blob/main/comp1_env1_env/include/test/env1_base_test.svh"

            Utils["comp1_test_utils.svh"]:::env
            click Utils "https://github.com/valerii-dzhafarov/uvm_templates/blob/main/comp1_env1_env/include/utils/comp1_test_utils.svh"

            StackUtils["stack_model.svh"]:::env
            click StackUtils "https://github.com/valerii-dzhafarov/uvm_templates/blob/main/comp1_env1_env/include/utils/stack_model.svh"

            ConfigMkEnv["config.mk"]:::env
            click ConfigMkEnv "https://github.com/valerii-dzhafarov/uvm_templates/blob/main/comp1_env1_env/scripts/config.mk"
        end

        subgraph "Agent"
            direction TB
            Iface["comp1_agent1_if.sv"]:::agent
            click Iface "https://github.com/valerii-dzhafarov/uvm_templates/blob/main/comp1_agent1_agent/comp1_agent1_if.sv"

            APkg["comp1_agent1_pkg.sv"]:::agent
            click APkg "https://github.com/valerii-dzhafarov/uvm_templates/blob/main/comp1_agent1_agent/comp1_agent1_pkg.sv"

            AConfig["agent1_config.svh"]:::agent
            click AConfig "https://github.com/valerii-dzhafarov/uvm_templates/blob/main/comp1_agent1_agent/include/agent1_config.svh"

            Driver["agent1_driver.svh"]:::agent
            click Driver "https://github.com/valerii-dzhafarov/uvm_templates/blob/main/comp1_agent1_agent/include/agent1_driver.svh"

            Sequencer["agent1_sequencer.svh"]:::agent
            click Sequencer "https://github.com/valerii-dzhafarov/uvm_templates/blob/main/comp1_agent1_agent/include/agent1_sequencer.svh"

            Item["agent1_item.svh"]:::agent
            click Item "https://github.com/valerii-dzhafarov/uvm_templates/blob/main/comp1_agent1_agent/include/agent1_item.svh"

            Monitor["agent1_monitor.svh"]:::agent
            click Monitor "https://github.com/valerii-dzhafarov/uvm_templates/blob/main/comp1_agent1_agent/include/agent1_monitor.svh"

            Checker["agent1_checker.svh"]:::agent
            click Checker "https://github.com/valerii-dzhafarov/uvm_templates/blob/main/comp1_agent1_agent/include/agent1_checker.svh"

            CovCol["agent1_cov_collector.svh"]:::agent
            click CovCol "https://github.com/valerii-dzhafarov/uvm_templates/blob/main/comp1_agent1_agent/include/agent1_cov_collector.svh"

            BaseSeq["agent1_base_seq.svh"]:::agent
            click BaseSeq "https://github.com/valerii-dzhafarov/uvm_templates/blob/main/comp1_agent1_agent/include/seq/agent1_base_seq.svh"

            ConfigMkAgent["config.mk"]:::agent
            click ConfigMkAgent "https://github.com/valerii-dzhafarov/uvm_templates/blob/main/comp1_agent1_agent/scripts/config.mk"
        end
    end

    %% Instantiation flow
    instant --> TB
    instant --> Interface

    %% Hierarchy
    TB --> Wrapper
    TB --> DUT
    TB --> Interface

    Wrapper --> EnvPkg
    EnvPkg --> EnvCfg
    EnvPkg --> EnvEnv
    EnvPkg --> EnvSB
    EnvPkg --> EnvSeq
    EnvPkg --> TestPkg
    EnvPkg --> Utils
    EnvPkg --> StackUtils
    EnvPkg --> ConfigMkEnv

    EnvPkg --> APkg
    APkg --> Iface
    APkg --> AConfig
    APkg --> Driver
    APkg --> Sequencer
    APkg --> Item
    APkg --> Monitor
    APkg --> Checker
    APkg --> CovCol
    APkg --> BaseSeq
    APkg --> ConfigMkAgent

    %% Transaction flows
    Sequencer -.->|transactions| Driver
    Driver -.->|drives| DUT
    DUT -.->|samples| Monitor
    Monitor -.->|analysis| EnvSB

    classDef tool fill:#a0c4ff,stroke:#6699cc,color:#000;
    classDef toplevel fill:#c8e6c9,stroke:#2e7d32,color:#000;
    classDef wrapper fill:#ffe0b2,stroke:#e65100,color:#000;
    classDef env fill:#e1bee7,stroke:#6a1b9a,color:#000;
    classDef agent fill:#ffcdd2,stroke:#b71c1c,color:#000;
    classDef dut fill:#a5d6a7,stroke:#2e7d32,color:#000;
```
