U17.4.2 One Master at a Time

EasyFixUVM · server3 hidden designsReview the topic

Two bus masters take turns on a shared bus, and exactly one may use it in each tenure. Fix a heartbeat watchdog so it checks that rule instead of only checking that somebody is busy.

Hardware context: A bench whose driver, monitor and scoreboard each finish an item every 30 ns, with a reset in the middle of the run. Check mutual exclusion on a shared bus with a heartbeat window per bus tenure.

An arbiter hands a shared bus to master m0 and master m1 in turn. Each tenure lasts 20 to 50 ns, and env.turn fires at every hand-over. The granted master finishes a transfer every 10 ns and proves it by raising and dropping env.busy.

The bench's watchdog uses a uvm_heartbeat on that objection. It reports a hung bus, but it stays silent when two masters drive the bus in one tenure.

Fix bus_watchdog. It must stay silent on the healthy bench. It must report a failure within 100 ns when more than one master uses the bus in a tenure. It must also report a tenure in which nobody does.

Full specification
What you fix
// The bus watchdog. bus_env creates it and sets env before build_phase ends.
class bus_watchdog extends uvm_component;
  `uvm_component_utils(bus_watchdog)
  bus_env env;
  uvm_heartbeat hb;
  uvm_event #(uvm_object) window;
  function new(string name, uvm_component parent); super.new(name, parent); endfunction
  task run_phase(uvm_phase phase);
    uvm_component masters[$] = '{env.m0, env.m1};
    hb = new("hb", env, env.busy);
    void'(hb.set_mode(UVM_ANY_ACTIVE));
    window = new("window");
    hb.set_heartbeat(window, masters);
    forever begin                                // a window of 4 clocks
      repeat (4) env.tick.wait_trigger();
      window.trigger();
    end
  endtask
endclass
GivenWhat it offers
env.m0, env.m1The two masters. The granted one raises and drops env.busy 3 ns after every clock.
env.m2A third master on the same bus. It is parked and should never transfer.
env.turnTriggered at every hand-over of the bus, at irregular times from 10 ns.
env.tickTriggered every clock, 10 ns.
env.busyThe environment's own uvm_objection, with default propagation.

A failure is any HBFAIL report that names this bank. Each bank runs to 800 ns. A planted fault starts at 500 ns. It counts as caught only when the bank's first HBFAIL comes after 500 ns and by 600 ns.

Examples

Example 1

The Healthy Bus Must Stay Silent
Input
Healthy bus; hand-overs at 10, 40, 90, 110, 150, 200, 240, 260, 310, 350, 380, 430, 480, 510, 550, 580, 620, 670, 700, 740, 780 ns; run to 800 ns
Output
alarm = no

In every tenure exactly one master transfers. A window per tenure in ONE mode never fails.

Example 2

Two Masters in One Tenure Must Be Caught
Input
A master ignores the grant from 500 ns; hand-overs at 10, 40, 90, 110, 150, 200, 240, 260, 310, 350, 380, 430, 480, 510, 550, 580, 620, 670, 700, 740, 780 ns; run to 800 ns
Output
alarm = yes

From 500 ns m1 also transfers in m0's tenures. The tenure that ends at 510 ns has raises from both, and ONE mode reports it. ANY mode is happy with two.

Example 3

A Hung Bus Must Be Caught
Input
The bus hangs from 500 ns; hand-overs at 10, 40, 90, 110, 150, 200, 240, 260, 310, 350, 380, 430, 480, 510, 550, 580, 620, 670, 700, 740, 780 ns; run to 800 ns
Output
alarm = yes

From 500 ns nobody transfers. The tenure from 510 to 550 ns has no raise at all, and ONE mode reports that too.

Constraints and Contract

  • Keep the class name, its fields and the use of uvm_heartbeat.
  • Do not raise, drop or reconfigure the objection for the masters.
  • Do not change the severity of HBFAIL.

Hints

Hint 1

Which mode fails a window with two raising components, and also a window with none?

Hint 2

A window of a fixed number of clocks can contain the end of one tenure and the start of the next. Which event marks a tenure exactly?

Hint 3

m2 is not in the list. What does the heartbeat do with a raise from a component it was not given?

What the grader checks: Your watchdog runs in four real benches: one healthy, and three with a fault from 500 ns. A bench raises an alarm when the library reports HBFAIL for it, with the time of the first. The planted fault lives in private fields your code cannot read.

4 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

The Healthy Bus Must Stay Silent

Input
Healthy bus; hand-overs at 10, 40, 90, 110, 150, 200, 240, 260, 310, 350, 380, 430, 480, 510, 550, 580, 620, 670, 700, 740, 780 ns; run to 800 ns
Expected output
alarm = no

In every tenure exactly one master transfers. A window per tenure in ONE mode never fails.

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

UVM · server