Verification #58 · 2026-11-20 · Driver and scoreboard under back-pressure · Medium · about 30 min

Build the testbench for a sliding-window maximum

win_max.sv tracks the maximum of the last four samples. A beat is accepted on any clock edge where in_valid and in_ready are both 1; in_ready drops now and then, at times you can't predict, so the driver has to hold a beat until it is accepted. Idle clocks and stalled clocks don't change anything inside the block.

flush meaning of an accepted beat
0 data (signed 8-bit) joins the window. The window keeps the last four samples since the last flush, or fewer if there haven't been four yet.
1 The window is emptied. data is ignored.

One clock after an accepted beat, out_valid is 1 for a clock and out_max holds the largest (signed) sample now in the window, or 0 for a flush beat.

Write the verification components in components.sv. The monitor and environment in env.sv are provided, and they use your four classes by name:

  • win_item: random flush, data and gap (idle clocks before the item). Constrain gap to 0 to 3. Flushes must be fairly rare, so the window gets full between them, but they must still happen, including right after another beat. Make data hit -128 and 127 often, and let both signs appear.
  • win_seq: sends count random items.
  • win_driver: waits out reset, waits gap clocks, then presents one item and keeps it on the pins until in_ready is 1 at a clock edge, which is when the beat is accepted. Then it drops in_valid, or presents the next item at once if its gap is 0.
  • win_scoreboard: for each item the monitor reports, in order, update a model of the window from flush and data, work out the expected maximum, and compare it with result. Count items in checked and mismatches in errors; report the first few with uvm_error. The monitor's result is the 8-bit out_max (all X if the DUT never answered).

Run uses tb.sv: 50 random items into the correct block. Submit runs your testbench against the correct block and four faulty ones. Your scoreboard must stay quiet on the first and catch each of the others.

Write and run your answer in the browser. The hidden tests check it, and it’s free.