UVM Library Structure
Learn how the UVM library is organized, what its major building blocks do, and how those pieces become a verification environment.
Learning objectives
- Explain how the UVM class library is organized.
- Recognize the major functional areas of UVM.
- Distinguish between UVM objects and UVM components.
- Identify the purpose of common UVM components.
- Understand how sequences, sequence items, sequencers, drivers, and monitors work together.
- Understand the difference between the UVM library structure and your testbench hierarchy.
- Trace a transaction from stimulus generation through driving, observation, checking, and coverage.
Step 1: What is the UVM library?
In the previous lesson, we learned why UVM is useful. UVM gives us a standardized way to build reusable verification environments instead of creating every testbench mechanism from scratch.
Now we need to understand what is actually inside UVM.
The UVM Class Library is a collection of SystemVerilog classes, utilities, and mechanisms that provide the building blocks for verification environments.
The official UVM class reference organizes these capabilities into functional categories. You do not need to memorize every category yet. Your goal is to understand what each area is responsible for and recognize the important ones when you encounter them in a real testbench.
Step 2: The UVM library at a glance
A simplified view of the UVM library looks like this:
UVM Library
|
+-- Base
| +-- Objects
| +-- Components
| +-- Transactions
| +-- Communication building blocks
|
+-- Components
| +-- Test
| +-- Environment
| +-- Agent
| +-- Driver
| +-- Monitor
| +-- Scoreboard
|
+-- Sequences
| +-- Sequence items
| +-- Sequences
|
+-- Sequencers
|
+-- TLM
|
+-- Reporting
|
+-- Factory
|
+-- Phasing
|
+-- Configuration
|
+-- Policies
|
+-- Register Layer
These categories solve different problems.
| Library area | What it provides | Where you will use it |
|---|---|---|
| Base | Fundamental UVM objects, components, transactions, and communication building blocks. | Throughout almost every UVM environment. |
| Components | Reusable testbench building blocks such as drivers, monitors, agents, and scoreboards. | Building the testbench architecture. |
| Sequences | Mechanisms for generating transaction-level stimulus. | Creating verification scenarios. |
| Sequencers | Controls the flow of sequence items toward drivers. | Connecting stimulus generation to a driver. |
| TLM | Transaction-level interfaces for communication between components. | Connecting monitors, scoreboards, subscribers, and other components. |
| Reporting | Consistent messages with different severities and verbosity levels. | Debugging and communicating verification results. |
| Factory | Flexible creation and substitution of UVM objects and components. | Reusable and configurable testbenches. |
| Phasing | A standardized execution structure for UVM components. | Controlling when testbench activities occur. |
| Configuration | Mechanisms for storing and retrieving configuration information. | Passing settings through a testbench. |
| Policies | Reusable mechanisms for operations such as printing and comparing objects. | Inspecting and manipulating UVM objects. |
| Register Layer | Abstractions for verifying registers and memories. | Register and memory verification. |
Step 3: The two big categories — objects and components
One of the most important concepts in UVM is the difference between an object and a component.
UVM objects
Objects primarily represent data or temporary verification activity. A transaction is a common example.
Important object-based classes include:
uvm_objectuvm_transactionuvm_sequence_item- sequence-related classes
For example, a bus transaction might contain an address, data, and operation type:
class bus_transaction extends uvm_sequence_item;
rand bit [31:0] addr;
rand bit [31:0] data;
rand bit write;
endclass
This object describes an operation. It does not directly drive the DUT pins.
UVM components
Components form the structural part of the verification environment. They have names, parents, and positions in the UVM hierarchy.
Common examples include:
uvm_testuvm_envuvm_agentuvm_driveruvm_monitoruvm_sequenceruvm_scoreboarduvm_subscriber
Step 4: UVM library structure vs. testbench structure
This distinction is easy to miss.
The UVM library is the collection of classes provided by UVM. Your testbench hierarchy is the specific arrangement of those classes that you create for your DUT.
The UVM library
UVM
|
+-- Objects
+-- Components
+-- Sequences
+-- Sequencers
+-- TLM
+-- Reporting
+-- Factory
+-- Phasing
+-- Configuration
+-- Policies
+-- Register Layer
Your testbench
uvm_test
|
+-- env
|
+-- agent
| |
| +-- sequencer
| +-- driver
| +-- monitor
|
+-- scoreboard
|
+-- coverage
The first diagram describes what UVM provides. The second describes how you use those building blocks.
Step 5: Understanding uvm_component
Most structural classes in a UVM testbench are derived directly or indirectly
from uvm_component.
A component has a hierarchical location in the testbench. For example:
uvm_test_top.env.agent.driver
This name describes the component's location:
uvm_test_topis the top-level UVM test.envis the verification environment.agentgroups components associated with an interface.driveris responsible for driving transactions.
Hierarchical names become extremely useful when debugging a large verification environment. A report such as:
UVM_ERROR uvm_test_top.env.agent.monitor
Unexpected response
immediately gives you useful information about which component produced the message.
Step 6: The major UVM components
You will encounter the following components repeatedly throughout your UVM work.
| Component | Responsibility | Simple question |
|---|---|---|
uvm_test |
Defines and controls the verification scenario. | What are we testing? |
uvm_env |
Organizes the major verification components. | How is the testbench organized? |
uvm_agent |
Groups components associated with an interface or protocol. | What belongs to this interface? |
uvm_sequencer |
Controls transaction flow from sequences toward the driver. | Which transaction should be delivered? |
uvm_driver |
Converts transactions into DUT interface activity. | How do we apply this operation? |
uvm_monitor |
Observes DUT interface activity and reconstructs transactions. | What actually happened? |
uvm_scoreboard |
Checks observed behavior against expected behavior. | Did the DUT behave correctly? |
uvm_subscriber |
Receives transactions for analysis such as functional coverage. | What should we measure? |
Step 7: Sequence items, sequences, and sequencers
These three concepts are closely related, so beginners often confuse them. Keep their responsibilities separate.
Sequence item
A sequence item represents one transaction.
WRITE address=0x20 data=0x55
It contains the information needed to describe that operation.
Sequence
A sequence generates one or more sequence items to create a verification scenario.
WRITE address=0x20 data=0x55
READ address=0x20
WRITE address=0x24 data=0xAA
READ address=0x24
The sequence represents the stimulus intent.
Sequencer
The sequencer manages the flow of sequence items toward the driver.
A sequencer becomes especially important when multiple sequences or stimulus sources need to share a driver.
Sequence = generates transactions.
Sequencer = controls transaction flow.
Step 8: The driver and monitor form a boundary
The driver and monitor are the components that connect the transaction-level world of the testbench to the signal-level world of the DUT interface.
Transaction-level world
|
| sequence item
v
Sequencer
|
v
Driver
|
| protocol signals
v
DUT
|
| protocol signals
v
Monitor
|
| observed transaction
v
Transaction-level world
The driver moves information toward the DUT. The monitor moves observed information away from the DUT.
This separation is one of the reasons UVM environments can be reused. Tests can work with transactions instead of directly manipulating every protocol signal.
Step 9: TLM — communicating between components
UVM also provides Transaction-Level Modeling (TLM) mechanisms for communication between components.
Instead of forcing components to know about each other's internal implementation, TLM provides standardized interfaces for transferring transactions.
For example, a monitor can publish an observed transaction and a scoreboard can receive it for checking.
Monitor
|
| observed transaction
v
Analysis connection
|
v
Scoreboard
At this stage, you only need to understand the purpose of TLM: components communicate using transactions rather than directly depending on each other's internal implementation.
Step 10: Other major UVM library areas
The UVM library contains more than the components used in a typical agent. Several supporting mechanisms provide the infrastructure that makes large environments manageable.
Reporting
UVM reporting provides a consistent way to issue messages such as information, warnings, errors, and fatal failures.
`uvm_info("BUS", "Transaction completed", UVM_MEDIUM)
`uvm_warning("BUS", "Unexpected response")
`uvm_error("BUS", "Data mismatch")
Reporting becomes an important part of debugging and verification results.
Phasing
UVM uses a standardized phase mechanism to control when different parts of the testbench are built, connected, executed, and completed.
You will see phases such as:
build_phase
connect_phase
run_phase
check_phase
report_phase
Phasing is important because a large testbench contains many components that need to perform work in an organized way.
Configuration
UVM provides configuration mechanisms that allow testbench settings to be passed through the component hierarchy.
For example, an agent might need to know whether it should operate in active or passive mode.
Factory
The UVM factory provides flexible creation and substitution of UVM objects and components.
This becomes particularly useful when you want to change an implementation without modifying the environment that uses it.
Step 11: Policies and object operations
UVM also separates several operations from the objects themselves. These include operations such as printing, comparing, recording, packing, and unpacking.
This is called a policy-based approach. Instead of forcing every object to contain one fixed implementation of printing or comparison, UVM provides policy classes that can operate on UVM objects.
You will use this idea later when learning how UVM objects can be printed, copied, compared, and recorded.
Step 12: Follow one transaction through the UVM environment
Let's put everything together.
Imagine a test wants to write 8'h5A to address 32'h10.
- The test selects the verification scenario.
- A sequence generates a transaction describing the write.
- The sequencer controls delivery of the transaction.
- The driver converts the transaction into protocol signals.
- The DUT processes those signals.
- The monitor observes the interface.
- The monitor reconstructs an observed transaction.
- The transaction is sent to the scoreboard.
- The scoreboard checks the observed behavior against the expected behavior.
- A subscriber or coverage component can measure what happened.
STIMULUS
|
v
Test
|
v
Sequence
|
v
Sequence Item
|
v
Sequencer
|
v
Driver
|
| signals
v
DUT
|
| signals
v
Monitor
|
| transaction
+------+------+
| |
v v
Scoreboard Coverage
|
v
CHECK
Step 13: Why this structure helps reuse
Imagine you have written a driver for an AXI-like interface. Your test sequences describe transactions rather than manually toggling every interface signal.
Now suppose you want to create a new test:
- Test a reset condition.
- Test a burst of writes.
- Test back-to-back reads.
- Test randomized addresses.
- Test protocol corner cases.
Ideally, these tests can reuse the same driver, monitor, agent, and scoreboard. The test or sequence changes the scenario, while the reusable components continue to implement the protocol and checking infrastructure.
Reusable Environment
+-----------------------+
| |
Test A ----> | |
Test B ----> | Agent / Driver | ----> DUT
Test C ----> | Monitor / Checker |
Test D ----> | |
+-----------------------+
This is the architecture that Lesson 11 introduced conceptually: separate verification intent from reusable infrastructure.
Step 14: A practical UVM hierarchy
A realistic UVM environment may contain multiple interfaces and multiple checking components.
uvm_test_top
|
+-- env
|
+-- axi_agent
| |
| +-- sequencer
| +-- driver
| +-- monitor
|
+-- apb_agent
| |
| +-- sequencer
| +-- driver
| +-- monitor
|
+-- scoreboard
|
+-- coverage
The environment can therefore contain multiple agents, with each agent encapsulating the verification logic for a particular interface.
This is one reason UVM scales well from a small block-level testbench to a larger subsystem environment.
Step 15: What you should know — and what can wait
There is a lot inside the UVM library. You are not expected to learn all of it in one lesson.
For now, make sure you can answer these questions:
- What is the difference between a UVM object and a UVM component?
- What is the purpose of a sequence item?
- What does a sequence generate?
- What does a sequencer do?
- What does a driver do?
- What does a monitor do?
- What does a scoreboard do?
- Why does a UVM testbench have a hierarchy?
- What is TLM used for?
- Why does UVM provide reporting, phasing, configuration, and factory mechanisms?
The upcoming lessons will answer these questions in much more detail.
Try it yourself
Consider a FIFO DUT. Identify the UVM element that should be responsible for each task.
- Represent a FIFO write containing data
8'hA5. - Generate a sequence of FIFO writes and reads.
- Control the flow of transactions toward the driver.
- Convert transactions into FIFO interface signals.
- Observe FIFO interface activity.
- Compare observed output data with expected data.
- Measure which FIFO scenarios have occurred.
Show answers
- Represent one operation:
uvm_sequence_item - Generate operations: sequence
- Control transaction flow: sequencer
- Drive interface signals: driver
- Observe interface activity: monitor
- Check expected versus actual: scoreboard
- Measure scenarios: subscriber or coverage component
Quick check
Question 1: Is a sequence item a UVM component?
Answer: No. A sequence item is an object used to represent transaction data.
Question 2: Which component converts transactions into DUT interface activity?
Answer: The driver.
Question 3: Which component observes DUT interface activity?
Answer: The monitor.
Question 4: What is the difference between the UVM library and your UVM environment?
Answer: The UVM library provides the reusable classes and mechanisms. Your environment is the specific hierarchy and combination of those building blocks used to verify your DUT.
Question 5: What is TLM primarily used for?
Answer: TLM provides transaction-level communication mechanisms that allow UVM components to communicate without depending directly on each other's internal implementation.
Build the mental model
Before moving forward, try to remember UVM as two layers.
The library layer
UVM provides
|
+-- Objects
+-- Components
+-- Sequences
+-- Sequencers
+-- TLM
+-- Reporting
+-- Phasing
+-- Configuration
+-- Factory
+-- Policies
The verification layer
You build
|
+-- Test
+-- Environment
+-- Agents
+-- Drivers
+-- Monitors
+-- Scoreboards
+-- Coverage
+-- Sequences
+-- Transactions
The first layer is supplied by UVM. The second layer is the verification environment you design for your project.
Key takeaways
- The UVM Class Library provides reusable building blocks for SystemVerilog verification environments.
- The library is organized into functional areas such as Base, Components, Sequences, Sequencers, TLM, Reporting, Factory, Phasing, Configuration, and Policies.
uvm_object-based classes commonly represent data and transactions.uvm_component-based classes form the structural hierarchy of the testbench.- A sequence item represents one transaction.
- A sequence generates one or more transactions.
- A sequencer controls the flow of transactions toward a driver.
- A driver converts transactions into DUT interface activity.
- A monitor observes DUT activity and reconstructs transactions.
- A scoreboard checks observed behavior against expected behavior.
- TLM provides transaction-level communication between verification components.
- The UVM library is the toolbox; your UVM environment is the architecture you build with that toolbox.
What comes next?
You now have a map of the UVM library and understand how its major pieces fit into a verification environment.
Next, we zoom in on one of the most important foundations:
uvm_object.
You will learn what a UVM object provides, why transaction classes are commonly derived from it, and how UVM adds useful capabilities on top of ordinary SystemVerilog classes.
uvm_object Fundamentals