Verification #57 · 2026-11-19 · Memory scoreboard · Medium · about 30 min
Build the testbench for a small memory
ram16.sv is a 16 x 8 memory with registered reads. One request is accepted on any clock edge where req_valid is 1.
we |
request |
|---|---|
| 1 | Write: mem[addr] = wdata. No response. |
| 0 | Read: one clock later rsp_valid is 1 for a clock, and rdata holds mem[addr]. |
Every location holds 0 after reset.
Write the verification components in components.sv. The monitor and environment in env.sv are provided, and they use your four classes by name:
mem_item: randomwe,addr,wdataandgap(idle clocks before the item). Constraingapto 0 to 3 and make back-to-back items (gap 0) common. Make reads and writes about equally likely, and makewdatahit the values 0x00 and 0xFF often.mem_seq: sendscountrandom items.mem_driver: waits out reset, waitsgapclocks, then presents one item (req_valid,we,addr,wdata) for exactly one clock. Withgap0, items go back to back.mem_scoreboard: keep a reference memory. For each item the monitor reports, in order: a write updates the reference, a read comparesrdatawith the reference (0 if the location was never written). Count every item, reads and writes, inchecked, and mismatches inerrors; report the first few withuvm_error. For a read the monitor setsrdatato all X if the DUT gave no response.
Run uses tb.sv: 50 random items into the correct memory. Submit runs your testbench against the correct memory 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.