Verification #62 · 2026-11-24 · Scoreboard with a two-entry history model · Medium · about 30 min

Build the testbench for a duplicate filter

dedup.sv is a duplicate filter. It remembers the 4-bit key of the last two accepted requests. On any clock edge where req is 1:

  • If key equals one of the two remembered keys, the request is a duplicate: drop is 1 for the next cycle and nothing is remembered or counted.
  • Otherwise it is accepted: drop is 0, dout shows din, key becomes the newest remembered key (the old newest becomes the older one, the old older one is forgotten), and the accepted count acc goes up by one, stopping at 15.

After reset nothing is remembered and acc is 0. drop, dout and acc are registered: they show the result of the previous edge. dout only means something when drop is 0.

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

  • dd_item: random key, din and gap (idle clocks before the request). Constrain gap to 0 to 5, with long gaps (3 or more) and back-to-back requests (gap 0) both common. Make key repeat often, so many requests are duplicates, but let every value from 0 to 15 appear, including 15.
  • dd_seq: sends count random items.
  • dd_driver: waits out reset, waits gap clocks, then drives req, key and din for exactly one clock, and returns req to 0. With gap 0, the next item follows on the very next clock.
  • dd_scoreboard: for each item the monitor reports, in order, apply it to a model of the filter, then compare drop and acc with the model, and dout (against din) whenever the request was accepted. Count items in checked and mismatches in errors; report the first few with uvm_error. The monitor fills in the result fields (drop, dout, acc) of the item from the pins, one clock after the request.

Run uses tb.sv: 50 random items into the correct filter. Submit runs your testbench against the correct filter and five 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.