Part 6 · Testbench Architecture · Intermediate
Monitors, Scoreboards & Reference Models
Hub — passive monitors, scoreboard architectures, reference models, compare discipline, end-of-test checks, and coverage hookup.
Overview
Stimulus alone proves nothing. A testbench earns its keep on the checking side : a monitor passively reconstructs transactions from DUT pins, a reference model predicts what the DUT should have done, and a scoreboard compares the two streams and reports mismatches. This topic builds all three by hand in plain SystemVerilog classes — the same architecture UVM formalizes, but with every wire visible.
The discipline that matters most: the monitor never drives a single signal, the scoreboard compares observed against predicted (never observed against observed from the same point), and end-of-test checks prove the scoreboard actually compared something before printing PASS.
Sub-topics
Monitor Design — passive sampling, protocol reconstruction FSM, broadcasting via mailboxes.
Scoreboard Architecture — expected vs actual streams, in-order FIFO vs out-of-order by-id compare.
Reference Models — fidelity spectrum, functional model class, keeping model and spec in sync.
Compare Discipline & Mismatch Debug — compare() design, field masks, first-mismatch context dump.
End-of-Test Checks & Drain — quiescence, leftovers, watchdog, zero-compare sanity check.
Hooking Coverage Into the TB — coverage subscribing to the monitor stream, env wiring.
CHECKING-SIDE TOPOLOGY (hand-built, no UVM)
DUT input pins DUT output pins
│ │
▼ ▼
┌──────────────┐ ┌──────────────┐
│ input monitor │ │ output monitor│ passive:
│ (observes) │ │ (observes) │ never drives
└──────┬───────┘ └──────┬───────┘
│ mbx_in │ mbx_out
▼ │
┌──────────────┐ │
│ reference │ │
│ model │ │
│ (predicts) │ │
└──────┬───────┘ │
│ mbx_expected │
▼ ▼
┌──────────────────────────────────┐
│ scoreboard │
│ expected stream vs actual stream│
│ compare → match / MISMATCH │
└──────────────────────────────────┘
│
▼
end-of-test: counts, leftovers, PASS/FAIL bannerKey takeaways
Monitors observe, never drive — checking is built on what the DUT actually did.
Scoreboards compare a predicted stream against an observed stream — two independent paths.
A PASS banner means nothing unless end-of-test checks prove comparisons actually happened.