Verification #51 · 2026-11-13 · UVM scoreboard · Medium · about 35 min
Build the testbench for a FIFO
sfifo.sv is a 4-entry, 8-bit FIFO. A write is accepted on a clock edge where wr = 1 and full = 0. A read is accepted where rd = 1 and empty = 0, and it removes the entry that rdata shows during that clock (the oldest one). full and empty always reflect what is stored. If a write and a read arrive together, each is accepted or refused on its own by the rule above: at a full FIFO only the read goes through, at an empty one only the write.
Write the verification components in components.sv. The monitor and environment in env.sv are provided, and they use your four classes by name. The monitor sends one item for every clock where wr or rd is 1, carrying the pins and the flags as they were during that clock.
fifo_item: randomwr,rdandwdata. Reads and writes must both be common, so the FIFO fills up, empties, and sees both together. Makewdatahit the corner values 0 and 255 often, not once in a few hundred items.fifo_seq: sendscountrandom items.fifo_driver: waits out reset, then presents each item for exactly one clock, with the pins back at 0 afterwards. Items go back to back.fifo_scoreboard: keeps its own model of the FIFO contents. For each item it checksfullandemptyagainst the model, checksrdatawhen a read is accepted, then updates the model. Count every item incheckedand every mismatch inerrors; report the first few withuvm_error.
Run uses tb.sv: 50 random items into the correct FIFO. Submit runs your testbench against the correct FIFO and against 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.