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: random we, addr, wdata and gap (idle clocks before the item). Constrain gap to 0 to 3 and make back-to-back items (gap 0) common. Make reads and writes about equally likely, and make wdata hit the values 0x00 and 0xFF often.
  • mem_seq: sends count random items.
  • mem_driver: waits out reset, waits gap clocks, then presents one item (req_valid, we, addr, wdata) for exactly one clock. With gap 0, 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 compares rdata with the reference (0 if the location was never written). Count every item, reads and writes, in checked, and mismatches in errors; report the first few with uvm_error. For a read the monitor sets rdata to 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.