Module 8: Protocol Projects | Intermediate UVM

Intermediate Capstone: Protocol Environment

Build and validate a reusable UVM environment that combines protocol agents, register access, checking, coverage, assertions, reset handling, and regression-ready tests.

Learning objectives

  • Assemble a complete intermediate UVM verification environment from independently reusable components.
  • Separate protocol driving, monitoring, prediction, checking, coverage, and scenario control into appropriate UVM components.
  • Coordinate multiple interfaces with a virtual sequence without coupling tests to driver internals.
  • Use reset-aware scoreboarding, timeout handling, and end-of-test draining.
  • Integrate register access, assertions, functional coverage, and negative testing into one verification strategy.
  • Produce reproducible evidence that a protocol environment satisfies defined functional and verification requirements.

Capstone overview

The previous lessons developed individual skills: reusable agents, TLM communication, scoreboards, reference models, assertions, configuration, RAL, reset verification, interrupts, error injection, performance checking, and regression strategy.

This lesson combines those skills into one environment. The objective is not to create the largest possible testbench. The objective is to demonstrate that each verification responsibility has a clear owner and that the environment can produce trustworthy evidence about the DUT.

Capstone rule: implement only behavior that is supported by the DUT specification. The example below assumes a particular DUT interface and register behavior so that the architecture is concrete. Replace those assumptions with the actual specification when implementing the project.

Step 1: Define the capstone DUT

Use a manageable but realistic DUT. A useful intermediate target is a register-controlled FIFO with an interrupt output.

For this example, assume the DUT provides:

  • An AXI4-Lite slave interface for control and status registers.
  • A data-side interface used to push and pop FIFO data.
  • An interrupt output that reflects a documented FIFO condition.
  • A reset input.
  • A documented register map containing control, status, and interrupt-related registers.

These are planning assumptions, not universal FIFO or AXI-Lite requirements. The real project must derive addresses, access policies, interrupt semantics, reset values, and FIFO behavior from the DUT specification.

Verification requirements

Requirement What must be demonstrated
Reset DUT and verification state return to their specified reset state.
Register access Valid reads and writes follow the documented register map and access policies.
FIFO ordering Accepted writes and reads preserve the required data ordering.
Boundary behavior Empty, full, and other documented boundary conditions behave correctly.
Interrupts Interrupt assertion, enable/mask behavior, status, and clearing follow the specification.
Error handling Invalid or unsupported operations produce the documented response.
Performance Required latency or throughput limits are measured over clearly defined events.
Coverage Important functional scenarios and relationships are measurable and analyzed.

Step 2: Build the verification architecture

Start from the verification responsibilities rather than from the class hierarchy. Each component should have a reason to exist and a well-defined source or destination for its information.

                         +----------------------+
                     |     capstone_test     |
                     +----------+-----------+
                                |
                         virtual sequence
                                |
                     +----------v-----------+
                     |     capstone_env     |
                     |                      |
                     | +------------------+ |
                     | | AXI-Lite agent   | |
                     | | active           | |
                     | +--------+---------+ |
                     |          |            |
                     | +--------v---------+  |
                     | | Data-side agent |  |
                     | +--------+---------+  |
                     |          |            |
                     | +--------v---------+  |
                     | | IRQ monitor     |  |
                     | +--------+---------+  |
                     |          |            |
                     | +--------v---------+  |
                     | | Predictor /     |  |
                     | | reference model |  |
                     | +--------+---------+  |
                     |          | expected   |
                     | +--------v---------+  |
                     | | Scoreboard      |  |
                     | +------------------+ |
                     |                      |
                     | Coverage             |
                     | Assertions            |
                     +----------+-----------+
                                |
                               DUT
                                |
                     +----------v-----------+
                     | AXI-Lite / Data / IRQ|
                     +----------------------+

The important architectural boundaries are:

  • Agents own protocol-specific driving and monitoring.
  • The virtual sequence coordinates the scenario across interfaces.
  • The predictor/reference model determines expected architectural behavior.
  • The scoreboard compares expected and observed transactions.
  • Coverage measures whether intended scenarios were exercised.
  • Assertions enforce local temporal and protocol rules.
  • The test selects configuration and scenario intent rather than manipulating drivers directly.

Step 3: Configure the agents

Reuse the configuration pattern developed earlier in the course. Each agent should receive the interface and policy information it needs rather than reaching into the testbench hierarchy to discover it.

class axi_lite_agent_cfg extends uvm_object;


`uvm_object_utils(axi_lite_agent_cfg)

virtual axi_lite_if vif;
uvm_active_passive_enum is_active = UVM_ACTIVE;

bit enable_protocol_checks = 1;
bit enable_coverage = 1;
int unsigned timeout_cycles = 100;

function new(string name = "axi_lite_agent_cfg");
super.new(name);
endfunction

function bit is_valid();
return (vif != null) && (timeout_cycles > 0);
endfunction
endclass

The environment can contain several agent instances with different configurations. For example, a monitor-only instance can observe an interface while another instance actively drives it.

Do not duplicate UVM's active/passive concept. Use uvm_active_passive_enum and the inherited uvm_agent.is_active rather than defining a project-specific replacement.

Step 4: Define transaction semantics

Before writing the scoreboard, define exactly what a transaction means. This is especially important because the capstone contains more than one interface.

AXI-Lite transactions

A write is not simply "an AW transaction followed immediately by a W transaction". AXI4-Lite has independent address and data channels, so the monitor must correctly handle their independent VALID/READY handshakes and assemble a complete write operation.

A completed write transaction should represent the architectural operation that the DUT accepted, not merely an attempted handshake.

FIFO transactions

Define whether the monitor publishes an attempted push/pop or an accepted operation. For scoreboard purposes, accepted operations are normally the useful boundary.

write_accept = push_request && !fifo_full;


read_accept  = pop_request  && !fifo_empty;

The actual acceptance rules must come from the DUT specification. If simultaneous push and pop has special behavior, document that behavior explicitly rather than assuming that a generic FIFO rule applies.

Interrupt transactions

The interrupt monitor should publish meaningful interrupt events such as assertion, deassertion, source, or timestamp according to the project's requirements.

class interrupt_item extends uvm_sequence_item;


`uvm_object_utils(interrupt_item)

int unsigned source_id;
bit          asserted;
time         timestamp;

function new(string name = "interrupt_item");
super.new(name);
endfunction
endclass

Step 5: Connect the environment with TLM

Components should communicate through stable TLM interfaces. The environment owns the connections; individual components should not search the hierarchy for other components.

function void connect_phase(uvm_phase phase);


super.connect_phase(phase);

axi_agent.monitor.ap.connect(predictor.axi_imp);
data_agent.monitor.ap.connect(scoreboard.actual_data_imp);

predictor.expected_ap.connect(scoreboard.expected_imp);

irq_monitor.ap.connect(irq_checker.irq_imp);

data_agent.monitor.ap.connect(coverage.data_imp);
endfunction

The exact implementation depends on the transaction types. If a component receives multiple differently typed analysis streams, use appropriately declared analysis implementations rather than trying to overload a single write() method.

`uvm_analysis_imp_decl(_axi)


`uvm_analysis_imp_decl(_irq)

class integration_checker extends uvm_component;
`uvm_component_utils(integration_checker)

uvm_analysis_imp_axi #(axi_lite_item, integration_checker) axi_imp;
uvm_analysis_imp_irq #(interrupt_item, integration_checker) irq_imp;

function new(string name, uvm_component parent);
super.new(name, parent);
axi_imp = new("axi_imp", this);
irq_imp = new("irq_imp", this);
endfunction

function void write_axi(axi_lite_item item);
// Correlate or record the relevant AXI-Lite operation.
endfunction

function void write_irq(interrupt_item item);
// Check the interrupt event against expected state.
endfunction
endclass
Do not infer causality from callback order. An AXI-Lite transaction observed by one monitor and an interrupt observed by another monitor may arrive at the checker through different processes. Correlation should use explicit state, IDs, timestamps, protocol events, or other documented relationships.

Step 6: Add the register model

The register model provides a bus-independent way for sequences to perform architectural register operations. The AXI-Lite agent remains responsible for the physical protocol.

reg_model.default_map.set_sequencer(


axi_agent.sequencer,
axi_adapter
);

The resulting path is:

RAL operation
|
v


register map
|
v
AXI-Lite adapter
|
v
AXI-Lite sequencer
|
v
AXI-Lite driver
|
v
DUT register interface

Use the register model for operations such as enabling an interrupt, reading status, or configuring FIFO behavior. Do not put AXI-Lite protocol logic into the register model.

The capstone should verify both the register abstraction and the underlying bus path. A successful read() is not sufficient evidence if the test accidentally bypassed the intended frontdoor path.

Step 7: Build the predictor and scoreboard

The scoreboard should compare independently produced expected and actual information. Do not make the scoreboard simply repeat the DUT's implementation.

For a FIFO, the reference model can remain deliberately simple: maintain the expected sequence of accepted data and compare observed output data against it.

if (write_accept)


expected_q.push_back(write_item.data);

if (read_accept) begin
if (expected_q.size() == 0) begin
`uvm_error("FIFO_SB",
"Read was accepted but no expected data exists")
end
else begin
expected = expected_q.pop_front();


if (read_item.data !== expected)
  `uvm_error("FIFO_SB",
    $sformatf("Data mismatch: expected=%0h actual=%0h",
              expected, read_item.data))


end
end

For register-controlled behavior, the predictor should model the architectural state that can be derived from accepted configuration operations. It should not duplicate implementation details that the DUT is supposed to calculate.

Reset behavior

Reset must explicitly affect the predictor and scoreboard. Whether outstanding expectations are discarded, preserved, or converted into expected errors depends on the DUT specification.

function void reset_model();


expected_q.delete();
// Reset architectural state represented by the model.
// Increment a reset epoch if the environment uses epochs
// to distinguish transactions before and after reset.
endfunction
Important: never clear scoreboard state merely because a reset signal toggled. First determine what the DUT specification says happens to in-flight operations.

Step 8: Coordinate the scenario with a virtual sequence

The capstone contains relationships between interfaces, so scenario control belongs above the individual agents. A virtual sequence can configure the DUT through AXI-Lite, stimulate FIFO activity, and wait for the expected interrupt.

task body();


reset_seq.start(p_sequencer.axi_sequencer);

// Configure the DUT through the register model.
configure_fifo();

// Start data-side activity.
data_seq.start(p_sequencer.data_sequencer);

// Exercise the condition that should generate the interrupt.
wait_for_expected_interrupt();

// Read status and clear the interrupt through RAL.
check_and_clear_interrupt();

endtask

The sequence should express scenario intent. It should not reach into a driver and modify internal signals or queues.

If a virtual sequence is tied to a specific virtual sequencer, declare the sequencer type explicitly:

`uvm_declare_p_sequencer(capstone_virtual_sequencer)

Step 9: Add assertions

Use assertions for local temporal rules that are naturally expressed from sampled signals. Use the scoreboard for transaction-level functional relationships.

For an AXI-Lite channel, one important class of protocol property is that VALID information remains stable while the sender is waiting for READY. The exact assertion must match the interface and protocol specification.

ap_aw_stable:


assert property (
@(posedge aclk)
awvalid && !awready
|=> awvalid && $stable(awaddr)
)
else
`uvm_error("AXI_AW",
"AW channel changed while waiting for READY");

Similarly, FIFO assertions should be limited to properties actually guaranteed by the specification. For example, if the DUT guarantees that an empty FIFO cannot accept a pop operation, assert that rule at the appropriate protocol boundary.

Do not turn every scoreboard rule into an assertion. Assertions are strongest for local temporal behavior; scoreboards and reference models are better suited to data relationships, stateful predictions, and cross-interface correlation.

Step 10: Add functional coverage

Coverage should measure the verification plan, not simply count transactions. Start with dimensions that correspond directly to requirements.

Coverage area Example dimensions
Register access Read/write, register, legal/illegal access, reset state
FIFO behavior Empty, partial, full, push, pop, simultaneous operation
Interrupts Enabled, masked, asserted, cleared, repeated events
AXI-Lite timing Independent AW/W timing, backpressure, wait states, back-to-back transfers
Reset Reset at idle, reset during activity, recovery after reset
Error behavior Invalid address, unsupported operation, documented error response
Performance Latency categories, throughput range, outstanding activity

Cross only dimensions for which the relationship matters. For example, crossing interrupt enable state with interrupt event type can be meaningful; crossing every register address with every timing bucket may create a large and low-value coverage space.

Step 11: Implement the test sequence in stages

Do not begin with a large randomized test. Establish a deterministic baseline first.

  1. Reset smoke: apply reset and verify required initial state.
  2. Register smoke: read reset values and perform a small number of legal writes and reads.
  3. FIFO smoke: push known data and verify the same ordered data is observed on read.
  4. Interrupt scenario: configure the interrupt condition, create the event, observe the interrupt, and verify status/clear behavior.
  5. Boundary tests: exercise empty/full and other documented limits.
  6. Negative tests: exercise documented invalid or error conditions.
  7. Reset-in-flight: introduce reset while meaningful activity is outstanding and verify the specified recovery behavior.
  8. Randomized scenarios: vary legal transaction values, timing, ordering, and backpressure after the deterministic baseline is stable.
  9. Performance scenarios: measure defined latency or throughput requirements independently of functional correctness.

Step 12: Make the environment drain correctly

Ending stimulus does not necessarily mean that verification is complete. Transactions may still be outstanding, monitors may still be publishing data, and the scoreboard may still contain expected items.

task run_phase(uvm_phase phase);


phase.raise_objection(this);

capstone_virtual_sequence seq =
capstone_virtual_sequence::type_id::create("seq");

seq.start(env.vseqr);

// Wait for verification state to become empty or complete.
if (!env.scoreboard.wait_for_drain(1000ns))
`uvm_error("DRAIN",
"Scoreboard did not drain before the deadline");

phase.drop_objection(this);
endtask

The exact drain mechanism is project-specific. A bounded wait is important so that a missing response becomes a diagnostic failure rather than an indefinitely hanging simulation.

Step 13: Add debug and regression evidence

A capstone is incomplete if it only passes once on a developer workstation. The environment should make failures reproducible and diagnosable.

For every important regression result, preserve information such as:

  • Test name and seed.
  • DUT/build or source revision.
  • Relevant configuration and plusargs.
  • Simulator/tool version.
  • First meaningful error and report ID.
  • Waveform or transaction trace when available.
  • Coverage result and model version.
  • Failure classification and disposition.

A useful failure report should answer: what failed, which transaction or state was involved, what was expected, what was observed, and how the failure can be reproduced.

Step 14: Validate the capstone in layers

Debug the environment from the bottom up. Do not immediately blame the scoreboard when a high-level scenario fails.

  1. Compilation: verify packages, interfaces, class definitions, and macros.
  2. Elaboration: verify hierarchy, virtual interfaces, factory-created components, and configuration.
  3. Agent sanity: prove that drivers and monitors communicate correctly.
  4. Protocol sanity: confirm handshakes and transaction boundaries.
  5. RAL sanity: confirm address mapping, adapter, sequencer, and frontdoor access.
  6. Checker sanity: deliberately create a known mismatch and prove the checker reports it.
  7. Reset sanity: prove both DUT and verification state recover correctly.
  8. Coverage sanity: confirm bins are sampled at the intended events.
  9. Scenario validation: run the complete capstone tests.
  10. Regression validation: reproduce failures from recorded metadata and classify results.

Capstone traceability matrix

Before declaring the environment complete, connect every major requirement to stimulus, checking, coverage, and debug evidence.

Requirement Stimulus Checker Coverage Debug evidence
Reset state Reset sequence Reset-aware scoreboard/assertions Reset scenarios Reset epoch + waveform
FIFO ordering Push/pop sequences Reference queue Depth and operation crosses Transaction ID/data trail
Register behavior RAL sequences RAL/status/reference model Register/access bins Address/data log
Interrupt behavior Configured event sequences Interrupt checker Enable/mask/event crosses IRQ timestamp + status
Error behavior Negative sequences Expected-error checking Error categories Error classification
Performance Timed traffic Latency/throughput measurement Latency categories Seed + performance report

Definition of done

The capstone is complete when all of the following are true:

  • The environment builds from reusable UVM components rather than test-specific driver internals.
  • Every active agent has a validated configuration object and virtual interface.
  • Every important monitor publishes well-defined transaction semantics.
  • The virtual sequence can coordinate the required multi-interface scenarios.
  • The register model, adapter, and bus sequencer are correctly connected where RAL is applicable.
  • The predictor/reference model produces independently derived expectations.
  • The scoreboard detects mismatches, unexpected transactions, missing responses, and relevant timeouts.
  • Reset behavior is explicitly handled by monitors, models, and scoreboards.
  • End-of-test draining is bounded and diagnostic.
  • Assertions cover important local protocol properties.
  • Functional coverage maps to the verification plan.
  • At least one negative test proves that the checker can detect an intentionally incorrect outcome.
  • At least one reset-in-flight scenario has been verified.
  • At least one performance measurement has clearly defined start/end events and units.
  • Smoke and broader regression tests have reproducible metadata.
  • At least one deliberately injected or constructed failure has been minimized and diagnosed.

Common capstone mistakes

  • Over-scoping: adding multiple protocols, DMA, power domains, and complex coherency when one focused environment would demonstrate the required skills better.
  • Testbench duplication: implementing protocol behavior again inside a test instead of reusing the agent.
  • Weak transaction semantics: publishing attempted operations when the checker actually needs accepted operations.
  • Incorrect AXI-Lite assumptions: assuming AW and W always arrive together or assuming AXI-Lite has transaction IDs like full AXI.
  • Reset blindness: resetting the DUT while leaving stale expectations in the scoreboard.
  • Callback-order assumptions: assuming an IRQ monitor will always execute immediately after the bus monitor.
  • Scoreboard duplication of the DUT: reproducing implementation logic instead of modeling architectural behavior.
  • Coverage theater: adding many bins without demonstrating that they correspond to verification intent.
  • Unbounded waits: allowing a missing DUT response to hang the simulation indefinitely.
  • Seed-only reproducibility: recording a seed while ignoring configuration, source revision, simulator version, and other run metadata.
  • Checker suppression: globally disabling errors to make negative tests appear to pass. Expected DUT errors should be explicitly modeled and checked.

Capstone exercise

Implement the environment in the following order:

  1. Create the interface definitions and transaction classes.
  2. Build the AXI-Lite and data-side agents.
  3. Add the interrupt monitor.
  4. Construct the environment and connect analysis ports.
  5. Add the register model and AXI-Lite adapter.
  6. Implement the reference model and scoreboard.
  7. Implement reset handling and bounded draining.
  8. Create a deterministic smoke sequence.
  9. Add interrupt, boundary, error, reset-in-flight, and randomized scenarios.
  10. Add assertions and functional coverage.
  11. Run the smoke regression, then broaden the regression.
  12. Record at least one failure, reproduce it, minimize it, and document the diagnosis.

Do not move to the next layer until the previous layer has observable evidence that it works.

Challenge: prove the environment can catch a bug

A verification environment is more convincing when it has demonstrated detection capability. Introduce one controlled defect into a local DUT model or testbench model, such as an incorrect FIFO ordering rule, an incorrect interrupt clear condition, or an intentionally corrupted expected value.

Your challenge is to:

  1. Run the scenario and observe the failure.
  2. Identify the first meaningful verification error.
  3. Use transaction logs and waveform evidence to locate the first divergence.
  4. Confirm that the checker—not merely a timeout—detected the problem.
  5. Restore the correct behavior and reproduce a clean pass with the same test intent.

Knowledge check

  1. Why should a virtual sequence coordinate multiple agents instead of directly controlling their drivers?
  2. Why must AXI-Lite monitors treat the address and data write channels independently?
  3. What information belongs in a transaction contract before implementing the scoreboard?
  4. When should reset clear scoreboard expectations, and when should it not?
  5. What is the difference between a predictor/reference model and a scoreboard?
  6. Why are assertions and transaction-level scoreboards complementary rather than interchangeable?
  7. What evidence proves that a performance measurement is meaningful?
  8. Why is a passing smoke test insufficient to claim verification closure?
Answers
  1. The virtual sequence owns scenario-level coordination while the agents retain protocol-specific behavior and reusable interfaces.
  2. AXI-Lite has independent AW and W channels, so address and data may be accepted in different cycles. The monitor must assemble the architectural write operation correctly.
  3. It should define the transaction boundary, acceptance/completion semantics, important fields, ownership, ordering/correlation rules, reset behavior, and error semantics.
  4. Only when the DUT specification says the reset invalidates those outstanding expectations. Some operations may survive, complete, or produce documented errors.
  5. The predictor/reference model derives expected architectural behavior; the scoreboard compares those expectations with observed DUT behavior.
  6. Assertions are particularly effective for local temporal/protocol rules, while scoreboards are suited to stateful data relationships and cross-transaction or cross-interface checking.
  7. It needs precisely defined start and completion events, measurement interval, units, reset/warm-up policy, and appropriate handling of outstanding transactions.
  8. Smoke tests establish a healthy baseline. Broader functional scenarios, negative testing, coverage analysis, assertions, reset scenarios, and regression evidence are still required.

Key takeaways

  • A complete UVM environment is an architecture of cooperating responsibilities, not a collection of classes.
  • Agents encapsulate protocol mechanics; virtual sequences express scenario relationships.
  • Transaction semantics must be defined before reliable scoreboards and predictors can be built.
  • RAL separates architectural register operations from physical bus transactions.
  • Reference models, scoreboards, assertions, and coverage provide different kinds of verification evidence.
  • Reset, timeout, draining, error handling, and reproducibility are part of the environment—not afterthoughts.
  • A strong capstone demonstrates both successful verification and the ability to detect and diagnose a controlled failure.

Where to go next

This lesson completes the intermediate UVM learning path. You have moved from reusable stimulus and TLM, through checking and coverage, into configuration, production environments, debug/regression practices, and protocol-focused projects.

The next step is to take the architecture from Lesson 79, implement it for a real DUT, and use the resulting environment as a reusable verification asset. The goal is no longer simply to know individual UVM mechanisms; it is to make sound architectural decisions about where each mechanism belongs.