Finish a derived burst driver so every callback reaches it after a factory override. Hook it through a helper, connect the typewide queues, and add a late callback without losing any.
Hardware context: Lanes where a factory override installs a derived burst driver. Make typewide and late instance callbacks reach a derived driver that hooks through a helper.
Another team's burst_driver replaces lane_driver on some lanes through a factory override. It runs its pre_send hooks through a helper object, burst_shaper. The test adds cov to every lane_driver and burst_cb to every burst_driver, both typewide. Later it adds perr to a few chosen lanes, through a lane_driver handle.
The code below is unfinished: the helper has no hook point, burst_driver lacks a declaration, and add_perr is empty. Finish it so every lane calls exactly the callbacks below, in that order, with no callback warning in the log.
Full specification
typedef class burst_driver;
// Runs the pre_send hooks for each beat of a burst on behalf of its driver.
class burst_shaper extends uvm_object;
`uvm_object_utils(burst_shaper)
function new(string name = "burst_shaper"); super.new(name); endfunction
function void shape(burst_driver drv, lane_item it);
// Run drv's pre_send hooks here.
endfunction
endclass
// Team B's driver, installed on some lanes by a factory override.
class burst_driver extends lane_driver;
`uvm_component_utils(burst_driver)
`uvm_register_cb(burst_driver, lane_cb)
burst_shaper shaper;
function new(string name, uvm_component parent); super.new(name, parent); endfunction
task run_phase(uvm_phase phase);
shaper = burst_shaper::type_id::create("shaper");
forever begin
seq_item_port.get_next_item(req);
shaper.shape(this, req);
#5ns; // a burst beat takes half the time
seq_item_port.item_done();
end
endtask
endclass
// Called in end_of_elaboration_phase for each chosen lane. drv may be a burst_driver.
function automatic void add_perr(lane_driver drv, lane_cb perr);
endfunction
| Callback | Added | Must run on |
|---|---|---|
| cov | connect_phase: uvm_callbacks #(lane_driver, lane_cb)::add(null, cov) | every lane, first |
| burst_cb | connect_phase: uvm_callbacks #(burst_driver, lane_cb)::add(null, burst_cb) | burst lanes only, after cov |
| perr | end_of_elaboration_phase: add_perr(lane.drv, perr), your code | the chosen lanes, last |
The test's code is fixed. Each case is one environment of four lanes, a to d; some are burst lanes. lane_driver registers lane_cb and calls pre_send in its own run loop; its handle in each agent is typed lane_driver.
Examples
Example 1
lane_b Is a Burst Lane- Input
burst lanes "b", perr on ""
- Output
lane_a_calls = 0x1000, lane_b_calls = 0x1200, lane_c_calls = 0x1000, lane_d_calls = 0x1000, cb_warnings = 0
lane_b calls cov, then burst_cb (1 2). The plain lanes call cov only (1).
Example 2
Burst Lanes b and d, Perr on lane_a- Input
burst lanes "bd", perr on "a"
- Output
lane_a_calls = 0x1300, lane_b_calls = 0x1200, lane_c_calls = 0x1000, lane_d_calls = 0x1200, cb_warnings = 0
lane_a is a plain lane with its own queue: cov, then perr (1 3). lane_b and lane_d borrow the burst_driver typewide queue: cov, burst_cb (1 2).
Example 3
Every Lane a Burst Lane, Perr on lane_c- Input
burst lanes "abcd", perr on "c"
- Output
lane_a_calls = 0x1200, lane_b_calls = 0x1200, lane_c_calls = 0x1230, lane_d_calls = 0x1200, cb_warnings = 0
lane_c's own queue starts as a copy of the burst_driver typewide queue, then perr: cov, burst_cb, perr (1 2 3).
Constraints and Contract
- Keep both class names, add_perr's signature and burst_driver's timing.
- shape must run the hooks registered on drv, not on the helper.
- No CBUNREG or CBTPREG warning may appear.
Hints
Hint 1
The hook point lives in a helper, so this is not the helper's callbacks. Which macro names the object whose callbacks run?
Hint 2
A facade typed burst_driver looks in the burst_driver typewide queue. How can callbacks added to lane_driver get there?
Hint 3
perr is the first instance add on its lane. Which typewide queue does the new queue copy, and does that depend on the pool you add through?
What the grader checks: Your burst driver is installed by factory overrides on chosen lanes of six real environments. Each lane driver runs one item. The checks read which callbacks its hook point called, in order, and count callback warnings.
6 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 1 problem on this path