Module 6: First Complete Environment | Beginner UVM

Beginner Capstone: Complete UVM Testbench

Bring the pieces together into a small, working UVM environment that can generate stimulus, observe DUT behavior, check results, and report evidence.

Learning objectives

  • Assemble a complete beginner-level UVM testbench from reusable components.
  • Trace a transaction from a sequence through the driver, DUT, monitor, and scoreboard.
  • Use UVM reporting to distinguish successful checks from real verification failures.
  • Explain how the testbench architecture supports a specific verification goal.

Step 1: Define what the testbench must prove

A UVM testbench is not complete simply because all the standard components exist. It is complete when the environment can provide evidence that the DUT behaves as intended.

For this capstone, use a small counter or FIFO and start with one clear requirement. For example:

Verification requirement: after reset, a valid write must be accepted and the expected value must later be observed at the DUT output.

From that requirement, identify the path your transaction must follow:

  1. Sequence: creates the intended transaction.
  2. Driver: converts the transaction into interface activity.
  3. DUT: performs the actual design behavior.
  4. Monitor: observes what really happened on the interface.
  5. Scoreboard: compares the observed result against the expected behavior.
  6. Test: controls the scenario and determines when the test is complete.

Step 2: Assemble the environment

The environment owns reusable verification components. The test should select what to test; it should not need to know how every driver and monitor works internally.

class basic_env extends uvm_env;


bus_agent        agent;
basic_scoreboard scoreboard;

`uvm_component_utils(basic_env)

function new(string name = "basic_env", uvm_component parent = null);
super.new(name, parent);
endfunction

function void build_phase(uvm_phase phase);
super.build_phase(phase);


agent      = bus_agent::type_id::create("agent", this);
scoreboard = basic_scoreboard::type_id::create("scoreboard", this);


endfunction

function void connect_phase(uvm_phase phase);
super.connect_phase(phase);


agent.monitor.ap.connect(scoreboard.analysis_export);


endfunction
endclass

The important connection is not the class declaration itself. It is the data path:

monitor → analysis port → scoreboard

This means the scoreboard checks transactions observed from the DUT rather than assuming that whatever the driver attempted was successful.

Architecture check: if you cannot point to where stimulus is generated, where DUT activity is observed, and where the result is checked, the environment is not ready for the capstone.

Step 3: Run the test in stages

Do not begin with a large random test. Build confidence one layer at a time.

  1. Reset: verify that the DUT reaches its known initial state.
  2. One transaction: send one directed operation and confirm that the monitor observes it.
  3. Expected result: check the observed transaction in the scoreboard.
  4. Several transactions: exercise a short sequence and verify that ordering and values remain correct.
  5. Edge cases: test conditions such as empty/full FIFO behavior, counter wraparound, or invalid operations when those features exist.
  6. Randomization: only after the directed test is working should you introduce randomized stimulus.
`uvm_info("CAPSTONE",


"Starting directed counter/FIFO test",
UVM_LOW)

if (observed_value != expected_value) begin
`uvm_error("CHECK",
$sformatf("Expected %0d, observed %0d",
expected_value, observed_value))
end

A useful test does more than produce a waveform. It produces a clear pass/fail result that can be understood from the simulation log and, when appropriate, from assertions or coverage.

Step 4: Understand the complete data flow

Before calling the environment complete, trace one transaction from beginning to end:

sequence


|
v
sequencer
|
v
driver
|
v
DUT
|
v
monitor
|
v
analysis port
|
v
scoreboard / coverage

Each component has a different responsibility. Keeping those responsibilities separate makes the testbench easier to debug and reuse.

  • Sequence: describes stimulus intent.
  • Driver: implements the protocol.
  • Monitor: observes protocol activity.
  • Scoreboard: determines whether observed behavior is correct.
  • Coverage collector: records whether important scenarios occurred.
  • Test: selects the scenario and controls test execution.

Step 5: Debug by locating the broken boundary

When the capstone fails, resist the temptation to change several components at once. Find the first point where the expected behavior stops matching the observed behavior.

  1. No transaction generated? Inspect the sequence and sequencer.
  2. Transaction generated but no DUT activity? Inspect the driver and virtual interface.
  3. DUT activity exists but monitor sees nothing? Inspect the monitor's sampling condition.
  4. Monitor sees the wrong value? Check timing, sampling, and transaction construction.
  5. Monitor is correct but scoreboard fails? Check the reference-model or expected-value calculation.
  6. Everything passes but coverage is poor? Add scenarios that exercise the missing bins rather than weakening the checker.
Common mistake: treating a scoreboard failure as proof that the scoreboard is wrong. First compare the expected value with the actual monitored transaction and determine which side of the comparison is incorrect.

Capstone challenge

Build a complete UVM environment for either a counter or FIFO.

  1. Create a transaction class that represents one operation.
  2. Create a sequence that produces at least three directed transactions.
  3. Drive those transactions to the DUT through an active agent.
  4. Monitor the DUT interface and publish observed transactions through an analysis port.
  5. Connect the monitor to a scoreboard.
  6. Check at least one expected-versus-actual result.
  7. Use UVM reporting to clearly identify passes and failures.
  8. Add one meaningful coverage point if your environment supports functional coverage.
Definition of done: you can run the test from the command line, see transactions being generated and observed, receive a meaningful scoreboard result, and explain the path a transaction takes through the environment.

Self-check

Before moving beyond the beginner module, make sure you can answer these questions without looking at your code:

  • Why does the monitor observe the DUT instead of the driver reporting what it sent?
  • Why is the scoreboard connected to the monitor's analysis port?
  • What belongs in a sequence, and what belongs in an agent?
  • What evidence tells you that the DUT passed the test?
  • Where would you start debugging if no transaction reaches the scoreboard?

If you can answer these questions and explain your transaction flow, you have learned more than how to assemble UVM classes—you have learned the basic architecture of a verification environment.

Key takeaways

  • A complete UVM testbench connects stimulus generation, protocol driving, observation, checking, and test control into one data flow.
  • The monitor provides evidence of what happened at the DUT interface; the scoreboard uses that evidence to determine correctness.
  • Build directed tests first, then add edge cases, randomization, coverage, and more complex checking.
  • Keep reusable behavior inside agents and environment components while keeping scenario intent in tests and sequences.
  • A good capstone ends with measurable verification evidence—not merely a simulation that finishes without errors.