UVM Lab | 45 minutes

Create a Transaction Class

Define the sequence item passed between UVM stimulus components.

Lab objective

Extend uvm_sequence_item, register fields with factory macros, and print a transaction that can be reused by sequences.

    How to work: read the contract, run the starter pattern, inspect the result, then complete the challenge. Change one thing at a time so you can identify the cause of a failure.

    Step 1: Understand the starting code

    Identify the inputs, outputs, timing or transaction boundary, and the expected result before changing the code. This small example is deliberately focused on the skill named in the lab.

    Questions to answer

    1. What behavior is the code intended to implement?
    2. Which value can the testbench calculate independently?
    3. Which boundary or invalid case could expose a defect?

    Step 2: Apply the lab task

    Run the example and compare the observed result with the contract. Use a self-checking assertion or error report so the simulator identifies the failure without relying on manual waveform inspection.

    Expected result

    UVM PASS: factory-created transaction prints address and direction

    Step 3: Explain what to inspect

    CheckWhat to inspect
    InputsAre values legal and applied at the correct time?
    TimingIs the output sampled after the design has had time to respond?
    Expected valueIs it calculated independently from the DUT output?
    Failure reportDoes it include the input, expected value, and actual value?
    Reset or cleanupDoes the lab finish with no pending process or stale state?

    A passing line is useful only when you know which scenario produced it. Include the case number, transaction ID, or input values in the report so a failure can be reproduced quickly.

    Step 4: Try the boundary and failure case

    1. Run the normal case and save the passing output.
    2. Run a boundary case and explain why it is part of the verification plan.
    3. Introduce one controlled defect related to this lab.
    4. Confirm the check reports the defect with useful context.
    5. Repair the defect and rerun the same reproducer.
    Common mistake: Putting virtual interfaces or driver behavior inside the sequence item.

    Step 5: Move the skill toward UVM

    When this lab is complete, identify how the same work would be organized in UVM:

    Direct lab responsibilityUVM home
    Input values and scenariosequence and sequence item
    Signal or protocol drivingdriver and virtual interface
    Sampling actual behaviormonitor and analysis port
    Expected-versus-actual comparisonscoreboard or reference model
    Behavior measurementcoverage subscriber or assertions
    class lab_item extends uvm_sequence_item;
        rand logic [7:0] data;
        `uvm_object_utils(lab_item)
    
        function new(string name = "lab_item");
            super.new(name);
        endfunction
    endclass
    
    // The sequence creates intent.
    // The driver performs timing.
    // The monitor publishes actual behavior.
    // The scoreboard checks the independent expectation.

    Lab completion checklist

    1. Write the requirement and expected behavior.
    2. Run the starter code and confirm the expected result.
    3. Complete the normal, boundary, and failure cases.
    4. Capture console output and waveform evidence.
    5. Document the UVM component that would own each responsibility.
    6. Record what remains outside the lab's scope.
    Acceptance criteria: the example runs, the expected result is independently checked, the boundary case is exercised, the controlled defect is detected and repaired, and the final report identifies evidence and remaining risk.