Verification #63 · 2026-11-25 · Scoreboard with a memory model · Medium · about 30 min

Build the testbench for a pipelined accumulator memory

accmem.sv is a small accumulator memory: 8 entries of 8 bits, all 0 after reset. On a clock edge where req is 1:

  • clr = 1: entry addr becomes 0.
  • clr = 0: entry addr becomes its old value plus din, stopping at 255 (it saturates, it does not wrap).

The new value of the entry appears on rdata, with rvalid = 1, two clock edges after the request edge. Requests can come on every clock, and results come back in order. The memory is a pipeline with bypassing, so back-to-back requests to the same address are exactly where it can go wrong.

Write the verification components in components.sv. The monitor and environment in env.sv are provided: the monitor pairs each request with its result and sends one acc_item per request, in order, with rdata filled in. They use your four classes by name:

  • acc_item: random clr, addr, din and gap (idle clocks before the request). Constrain gap to 0 to 5 with back-to-back requests (gap 0) the most common. Make the same addresses come up often, and let all 8 addresses appear. Make din small often and large often, and clr rare but not very rare.
  • acc_seq: sends count random items.
  • acc_driver: waits out reset, waits gap clocks, then drives req, clr, addr and din for exactly one clock, and returns req to 0. With gap 0, the next item follows on the very next clock.
  • acc_scoreboard: keeps a model of the 8 entries. For each item the monitor reports, in order, update the model and compare the item's rdata with the new value. Count items in checked and mismatches in errors; report the first few with uvm_error.

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.