The stimulus is done, but responses are still in flight. Make the scoreboard hold the run phase open only for as long as it has something left to match.
Hardware context: A regression bench whose runs outlast their traffic, with agents, a child component and drain times. Hold the run phase open from phase_ready_to_end while responses are still in flight.
A bench's stimulus sends its items and drops its objection at 100 ns. The design answers each item after a latency, so some responses arrive after that. Today the run phase ends at 100 ns, and the scoreboard never sees them.
Write run_sb. When the run phase is ready to end and responses are still in flight, it must hold the phase open. It must let go exactly when its last response has been matched. The real benches send millions of items, so do not raise an objection per item or for the whole run.
Full specification
class run_sb extends sb_base;
`uvm_component_utils(run_sb)
function new(string name, uvm_component parent); super.new(name, parent); endfunction
// Keep the run phase open until every response has been matched.
task run_phase(uvm_phase phase);
phase.raise_objection(this);
wait (pending == 0);
phase.drop_objection(this);
endtask
endclass
| Given | What it does |
|---|---|
pending | Items sent and not yet matched. It rises when the stimulus sends and falls at each match. |
on_match() | Called after every match. Empty in the base class. |
| The test | Raises the run-phase objection, sends every bench's items by 95 ns, and drops it at 100 ns. |
Seven benches, each with its own scoreboard, run in one test. The test records when each scoreboard raised and dropped the run-phase objection. It also checks that the run phase ended exactly at the last response of any bench.
Examples
Example 1
Responses Trail the Stimulus- Input
item sent at 10 ns, answered at 15 ns; item sent at 40 ns, answered at 60 ns; item sent at 90 ns, answered at 150 ns; the test drops at 100 ns; all seven benches run together
- Output
items_sent = 3, items_matched = 3, held_from_ns = 100, held_to_ns = 150, run_phase_ended_at_last_response = yes
At 100 ns one response is still due, at 150 ns. The scoreboard raises in phase_ready_to_end at 100 ns and drops at 150 ns. The phase ends when the slowest bench in the run lets go.
Example 2
Nothing Left at 100 Ns- Input
item sent at 10 ns, answered at 15 ns; item sent at 20 ns, answered at 25 ns; the test drops at 100 ns; all seven benches run together
- Output
items_sent = 2, items_matched = 2, run_phase_ended_at_last_response = yes
Both responses came by 25 ns. At 100 ns nothing is pending, so this scoreboard does not raise at all.
Example 3
One Slow Response- Input
item sent at 50 ns, answered at 180 ns; the test drops at 100 ns; all seven benches run together
- Output
items_sent = 1, items_matched = 1, held_from_ns = 100, held_to_ns = 180, run_phase_ended_at_last_response = yes
The item sent at 50 ns is answered at 180 ns. The scoreboard holds the phase from 100 to 180 ns.
Constraints and Contract
- Keep the class name and
sb_baseas its base. - Raise no objection before the stimulus has dropped its own.
- End with no
UVM_ERROR.
Hints
Hint 1
Which component hook is called when every objection of a phase has been dropped, but before the phase ends?
Hint 2
That hook runs for every phase, and again after anyone who raised in it drops. What must it check?
Hint 3
Where do you learn that the last response has been matched?
What the grader checks: Seven benches with real scoreboards share one run phase. A trusted callback on the run phase's objection records when each scoreboard raised and dropped it. The test records when the phase ended.
7 checks on UVM · server. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain public samples only. A passing result establishes the tested cases, not a proof for all possible inputs.
See all 2 problems on this path