Write a report catcher that expects exactly the errors an injection causes on each scoreboard. Every other error must fail the run.
Hardware context: Agents and scoreboards whose reports pass through report catchers. Rename a vendor's IDs and promote one agent's warnings to errors, in the right order.
An error-injection test corrupts a planned number of transfers on each scoreboard's path. While the injection window is open, each scoreboard reports that many DATA errors, and those must not fail the run. Any other error must fail it: one more DATA error than planned, or one after the window. So must a DATA error from the checker or a scoreboard outside the window, or another ID.
Write the catcher and open and close its window on the scoreboards the bench names. Give a verdict that fails unless every scoreboard produced exactly its planned errors. The bench runs your catcher on the correct bench and on six benches with a planted problem.
Full specification
// Expects a set number of DATA errors from each scoreboard while the injection window is open.
class expect_data extends uvm_report_catcher;
int quota[string]; // full name of a scoreboard -> DATA errors the injection causes there
int seen[string]; // DATA errors each scoreboard reported while the window was open
function new(string name = "expect_data"); super.new(name); endfunction
function action_e catch();
return THROW;
endfunction
// The bench calls open when it starts injecting and close when it stops. scoreboards is a
// glob on the full names of the scoreboards under env.
function void open(uvm_component env, string scoreboards);
endfunction
function void close(uvm_component env, string scoreboards);
endfunction
// Called after close: 1 only if every scoreboard in quota reported exactly its quota.
function bit verdict();
return 1;
endfunction
// How many DATA errors the scoreboards reported in the window, in all.
function int total();
int t = 0;
foreach (seen[who]) t += seen[who];
return t;
endfunction
endclass
| Report | What must happen |
|---|---|
| A scoreboard named by the glob: UVM_ERROR, ID DATA, inside the window, within its quota | Demoted to UVM_INFO, still printed |
| The same, beyond its quota | Stays an error |
| Any other report | Unchanged |
Before 10 ns the bench fills quota with the full name of each scoreboard the glob names. It calls open(env, scoreboards) at 10 ns, close(env, scoreboards) at 40 ns, and verdict() and total() after that. env holds sb_rd, sb_wr and a checker, chk; every case has its own env and its own catcher.
The checks read how the report server counted each report (info, warning, error, or not counted at all), your verdict and total().
Examples
Example 1
The Correct Bench- Input
glob *.sb_*; quota sb_rd 2, sb_wr 1; in window: sb_rd error DATA; in window: sb_wr error DATA; in window: sb_rd error DATA
- Output
report_0 = info (0), report_1 = info (0), report_2 = info (0), report_3 = info (0), report_4 = info (0), verdict = 1, total = 3
All three DATA errors are within their scoreboard's quota: demoted to infos, total 3, verdict 1. Unused report slots read info (0).
Example 2
A Real DATA Error After the Window- Input
glob *.sb_*; quota sb_rd 1, sb_wr 0; in window: sb_rd error DATA; after: sb_rd error DATA
- Output
report_0 = info (0), report_1 = error (2), report_2 = info (0), report_3 = info (0), report_4 = info (0), verdict = 1, total = 1
close took the catcher off sb_rd at 40 ns. The DATA error after the window stays an error and fails the run.
Example 3
The Checker Reports DATA- Input
glob *.sb_*; quota sb_rd 1, sb_wr 1; in window: chk error DATA; in window: sb_rd error DATA; in window: sb_wr error DATA
- Output
report_0 = error (2), report_1 = info (0), report_2 = info (0), report_3 = info (0), report_4 = info (0), verdict = 1, total = 2
The glob names the scoreboards only. chk's DATA error is not one of the injected ones and stays an error.
Constraints and Contract
- Keep the class, its two arrays and the method signatures.
- Demote rather than drop: an expected error still prints, as an info.
Hints
Hint 1
A catcher added to a component sees that component's reports only. Which call adds one object to every component a glob names under a root? Which takes it off again?
Hint 2
Count per scoreboard: get_client() says who made the report. The quota is a limit on demotions, not only a target for the verdict.
Hint 3
Every case has its own env. What happens to the other cases if your add looks for the glob from the top of the tree?
Hint 4
The verdict is the only thing that notices an injection that never happened.
What the grader checks: Your catcher runs on seven environments at once: the correct bench and six with a planted problem. The checks read how the report server counted every report, your verdict and your total.
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 3 problems on this path