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
keyequals one of the two remembered keys, the request is a duplicate:dropis 1 for the next cycle and nothing is remembered or counted. - Otherwise it is accepted:
dropis 0,doutshowsdin,keybecomes the newest remembered key (the old newest becomes the older one, the old older one is forgotten), and the accepted countaccgoes 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: randomkey,dinandgap(idle clocks before the request). Constraingapto 0 to 5, with long gaps (3 or more) and back-to-back requests (gap 0) both common. Makekeyrepeat often, so many requests are duplicates, but let every value from 0 to 15 appear, including 15.dd_seq: sendscountrandom items.dd_driver: waits out reset, waitsgapclocks, then drivesreq,keyanddinfor exactly one clock, and returnsreqto 0. Withgap0, 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 comparedropandaccwith the model, anddout(againstdin) whenever the request was accepted. Count items incheckedand mismatches inerrors; report the first few withuvm_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.