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

  1. Monitor Design — passive sampling, protocol reconstruction FSM, broadcasting via mailboxes.

  2. Scoreboard Architecture — expected vs actual streams, in-order FIFO vs out-of-order by-id compare.

  3. Reference Models — fidelity spectrum, functional model class, keeping model and spec in sync.

  4. Compare Discipline & Mismatch Debug — compare() design, field masks, first-mismatch context dump.

  5. End-of-Test Checks & Drain — quiescence, leftovers, watchdog, zero-compare sanity check.

  6. Hooking Coverage Into the TB — coverage subscribing to the monitor stream, env wiring.

diagram
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 banner

Key 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.