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.
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
- What behavior is the code intended to implement?
- Which value can the testbench calculate independently?
- 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
| Check | What to inspect |
|---|---|
| Inputs | Are values legal and applied at the correct time? |
| Timing | Is the output sampled after the design has had time to respond? |
| Expected value | Is it calculated independently from the DUT output? |
| Failure report | Does it include the input, expected value, and actual value? |
| Reset or cleanup | Does 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
- Run the normal case and save the passing output.
- Run a boundary case and explain why it is part of the verification plan.
- Introduce one controlled defect related to this lab.
- Confirm the check reports the defect with useful context.
- Repair the defect and rerun the same reproducer.
Step 5: Move the skill toward UVM
When this lab is complete, identify how the same work would be organized in UVM:
| Direct lab responsibility | UVM home |
|---|---|
| Input values and scenario | sequence and sequence item |
| Signal or protocol driving | driver and virtual interface |
| Sampling actual behavior | monitor and analysis port |
| Expected-versus-actual comparison | scoreboard or reference model |
| Behavior measurement | coverage 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
- Write the requirement and expected behavior.
- Run the starter code and confirm the expected result.
- Complete the normal, boundary, and failure cases.
- Capture console output and waveform evidence.
- Document the UVM component that would own each responsibility.
- Record what remains outside the lab's scope.