U17.5.1 Who Kept the Test Alive?

MediumImplementUVM · serverReview the topic

Write an objection callback that measures how long each component held its own objection. It must also name the component whose drop let the run end.

Hardware context: A regression bench whose runs outlast their traffic, with agents, a child component and drain times. Measure per-component objection hold time and the last objector with an objection callback.

A regression has runs that last far longer than their traffic. To find out why, you add a meter to the objection the bench raises. For each component it measures how long that component's own objections were raised. It also names the last objector. That is the component whose drop last took the total at the top to zero.

Write hold_meter, an objection callback, and attach_meter, which puts it on one bench's objection. Raises can carry counts above 1, children raise below their parents, and some components have a drain time.

Full specification
What you write
// Measures, for each component, how long its own objections were raised, and
// which component's drop took the total at the top to zero last.
class hold_meter extends uvm_objection_callback;
  uvm_object last_objector;
  function new(string name = "hold_meter"); super.new(name); endfunction
  function int unsigned held_ns(uvm_object comp);
    return 0;
  endfunction
endclass

// Called once per bench, in connect_phase, with the objection the bench raises.
function automatic void attach_meter(uvm_objection alive, hold_meter m);
endfunction
GivenWhat it does
hold_envAgents a and b, and c below a. Each bench has its own uvm_objection.
The scheduleAt given times a component raises or drops that objection, with a count.
Drain timesSet with set_drain_time(component, ns) on some benches.
held_ns(comp)Read by the test after the run, for a, b, c and the env.

Hold time counts only a component's own raises: while c holds, a's own count may still be 0. Eight benches run together in one test.

Examples

Example 1

Two Agents, No Drain
Input
10 ns a raises 1; 20 ns b raises 1; 40 ns a drops 1; 70 ns b drops 1
Output
held_ns_a = 30, held_ns_b = 50, held_ns_c = 0, held_ns_env = 0, last_objector = b (2)

a holds from 10 to 40 ns and b from 20 to 70 ns. b's drop at 70 ns takes the top total to zero, so b is the last objector. The env never raises for itself.

Example 2

A Count of 2 and a Child
Input
10 ns a raises 2; 15 ns c raises 1; 30 ns a drops 1; 50 ns c drops 1; 60 ns a drops 1
Output
held_ns_a = 50, held_ns_b = 0, held_ns_c = 35, held_ns_env = 0, last_objector = a (1)

a's own count is 2, then 1 at 30 ns, then 0 at 60 ns: 50 ns. c's raise at 15 ns also passes through a, but it is c's time, not a's.

Example 3

A Drain Decides Who Was Last
Input
10 ns a raises 1; 20 ns b raises 1; 40 ns a drops 1; 70 ns b drops 1; drain a 50 ns
Output
held_ns_a = 30, held_ns_b = 50, held_ns_c = 0, held_ns_env = 0, last_objector = a (1)

a drops first, at 40 ns, but its 50 ns drain holds the drop until 90 ns. b's drop reaches the top at 70 ns, while a still counts there. a is the last objector.

Constraints and Contract

  • Keep the class name, last_objector, held_ns and both signatures.
  • Observe only through the callback hooks; do not poll the objection.
  • Put the meter on the one objection you are given.

Hints

Hint 1

One raise by c calls your raised hook several times. Which arguments tell the calls apart?

Hint 2

A raise can carry a count of 2 and be dropped one at a time. When does the component's own count really reach zero?

Hint 3

A drain time delays a drop on its way up. Where must you watch to see the drop that really ended the total?

What the grader checks: Eight benches with real uvm_objection objects run together, each with its own schedule, counts and drain times. The checks read your meter after the run and compare it with an independent model of objection propagation and drain.

8 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

Report a problem with this page

Your code SystemVerilogSaved locally
Ln 1, Col 1Tab indents · Ctrl/⌘ + Enter runs samples
Not run yet

Two Agents, No Drain

Input
10 ns a raises 1; 20 ns b raises 1; 40 ns a drops 1; 70 ns b drops 1
Expected output
held_ns_a = 30, held_ns_b = 50, held_ns_c = 0, held_ns_env = 0, last_objector = b (2)

a holds from 10 to 40 ns and b from 20 to 70 ns. b's drop at 70 ns takes the top total to zero, so b is the last objector. The env never raises for itself.

Run samples executes all 3 public checks. Check all tests runs 8 checks on the server.

UVM · server