Module 3: Checking Architecture | Intermediate UVM

Scoreboard Design Patterns

Design scoreboards that turn observed transactions into reliable, maintainable checks for real verification environments.

Learning objectives

  • Explain the responsibility of a scoreboard in a UVM verification environment.
  • Distinguish a scoreboard from a monitor, predictor, reference model, assertion, and coverage component.
  • Identify when an in-order, out-of-order, FIFO-based, or multi-stream scoreboard architecture is appropriate.
  • Use UVM analysis connections to deliver transactions to a scoreboard.
  • Choose between direct write() callbacks and TLM FIFO-based scoreboard architectures.
  • Separate transaction transport from checking policy.
  • Design checks that distinguish missing, unexpected, duplicate, and mismatched transactions.
  • Produce diagnostics that make scoreboard failures useful during debug.
  • Recognize why expected-data generation should usually be separated from the scoreboard's comparison logic.
  • Prepare a scoreboard architecture that can evolve toward reference models, predictors, out-of-order checking, and multi-stream checking.

Step 1: What problem does a scoreboard solve?

A scoreboard answers one of the central questions in functional verification:

What did the DUT produce,


and is that result correct?

The monitor observes protocol activity and converts signal-level behavior into transactions. The scoreboard consumes those transactions and applies checking rules.

DUT


|
v
Monitor
|
| observed transactions
v
Scoreboard
|
+--> pass
|
+--> mismatch
|
+--> unexpected transaction
|
+--> missing transaction

A useful scoreboard does more than compare two objects. It maintains the state necessary to decide whether the observed behavior is correct according to the verification model.

Core idea: A scoreboard is a checking component. It consumes verification evidence and determines whether observed behavior matches the expected behavior defined by the verification environment.

Step 2: Know what the scoreboard does not own

A common architectural mistake is to put too much responsibility into one scoreboard class. Before designing one, separate the major verification roles.

Component Primary responsibility
Sequence Generate stimulus and scenarios.
Driver Translate sequence items into DUT interface activity.
Monitor Observe DUT activity and reconstruct transactions.
Predictor / reference model Determine expected behavior from inputs and model rules.
Scoreboard Correlate expected and actual behavior and report correctness.
Assertion Check temporal and protocol properties.
Coverage Measure whether intended scenarios and behaviors were exercised.

These responsibilities can interact, but they do not have to be implemented by the same class.

                    +--> Coverage
                |


Monitor -----------> +--> Scoreboard
|
+--> Other subscribers

Input transactions
|
v
Predictor / Reference Model
|
v
Expected transactions
|
v
Scoreboard

This separation becomes increasingly important as the environment grows. Lessons 22 and 23 will focus specifically on reference models and predictors.

Step 3: Start with the checking contract

Before writing SystemVerilog, define what the scoreboard must prove.

For example, suppose a DUT accepts a request:

request:


id      = 7
address = 32'h1000
data    = 32'h55AA
write   = 1

The scoreboard contract might require:

  • A corresponding response must eventually exist.
  • The response must have the correct transaction ID.
  • The response must contain the expected data.
  • The response must not appear twice.
  • The response must satisfy any ordering rules imposed by the protocol.

This immediately exposes an important design question:

How do we know what the expected response should be?

The answer may be trivial for a simple transformation, but it may require a predictor or reference model for a more complex DUT. That distinction is the foundation for the next lessons.

Step 4: Separate transport from checking policy

The previous module established TLM communication, analysis ports, fanout, FIFOs, ordering, correlation, and transaction recording.

A scoreboard should use those mechanisms rather than reinvent them.

Monitor


|
v
analysis_port
|
+----> Coverage
|
+----> Scoreboard input
|
+----> Logger / recorder

The analysis port provides transport. The scoreboard implements the checking policy.

Design principle: Do not confuse how a transaction reaches a scoreboard with how the scoreboard decides whether the transaction is correct.

This distinction makes it possible to change the transport architecture without rewriting the checking algorithm.

Step 5: The simplest scoreboard — direct comparison

For a deterministic, in-order protocol, the simplest architecture may be a scoreboard that receives actual transactions and compares them against expected transactions.

class simple_scoreboard extends uvm_scoreboard;


`uvm_component_utils(simple_scoreboard)

uvm_analysis_imp #(packet, simple_scoreboard) actual_imp;

packet expected_q[$];

function new(string name, uvm_component parent);
super.new(name, parent);
actual_imp = new("actual_imp", this);
endfunction

function void write(packet actual);


if (expected_q.size() == 0) begin
  `uvm_error("SB",
    "Received actual transaction with no expected transaction")
  return;
end

packet expected = expected_q.pop_front();

if (!actual.compare(expected)) begin
  `uvm_error("SB",
    $sformatf(
      "Transaction mismatch\nExpected:\n%s\nActual:\n%s",
      expected.sprint(),
      actual.sprint()))
end


endfunction

endclass

This architecture uses a queue because the checking assumption is:

first expected
 matches


first actual

second expected
matches
second actual

...

This is appropriate only when the protocol and expected behavior are actually ordered this way. It should not be used simply because a queue is convenient.

Step 6: Understand the write() path

An analysis implementation provides a convenient way for a monitor to deliver transactions directly to a scoreboard.

class scoreboard extends uvm_scoreboard;


uvm_analysis_imp #(packet, scoreboard) analysis_imp;

function new(string name, uvm_component parent);
super.new(name, parent);
analysis_imp = new("analysis_imp", this);
endfunction

function void write(packet tr);
// Checking logic
endfunction

endclass

The environment connects the monitor's analysis port to the scoreboard's analysis implementation.

function void connect_phase(uvm_phase phase);


super.connect_phase(phase);

monitor.ap.connect(scoreboard.analysis_imp);
endfunction

When the monitor calls:

ap.write(tr);

the scoreboard's write() method receives the transaction.

Important: An analysis write() call is a function call. Do not put a blocking operation such as get() inside that callback to wait for unrelated traffic. If the scoreboard needs independent streams or blocking consumption, a FIFO-based architecture is often a better fit.

Step 7: When a TLM FIFO is a better architecture

A scoreboard may need to process transactions independently from the monitor's immediate write() call.

In that case, an analysis FIFO provides buffering and allows a scoreboard process to consume transactions using blocking or nonblocking TLM operations.

Monitor


|
v
analysis_port
|
v
analysis_fifo
|
v
Scoreboard process
|
v
Checking

A typical connection is:

monitor.ap.connect(scoreboard.fifo.analysis_export);

The scoreboard can then use:

task run_phase(uvm_phase phase);


packet actual;

forever begin
fifo.get(actual);
check_actual(actual);
end

endtask

This approach is particularly useful when checking requires blocking waits, independent processing loops, multiple input streams, or more complex coordination.

The choice is architectural:

Approach Useful when
Analysis write() Checking can happen directly when a transaction arrives.
Analysis FIFO + get() Checking needs buffering, blocking consumption, or independent processing.

Step 8: Pattern 1 — In-order queue checking

An in-order scoreboard maintains expected transactions in the order they should be observed.

Expected queue:


[ E0 ][ E1 ][ E2 ][ E3 ]

Actual stream:


 A0   A1   A2   A3


Check:

E0 <-> A0
E1 <-> A1
E2 <-> A2
E3 <-> A3

This pattern is appropriate when the protocol guarantees that results appear in the same order as requests.

Typical data structures include SystemVerilog queues:

packet expected_q[$];


expected_q.push_back(expected);
packet expected = expected_q.pop_front();

The critical assumption is not the queue itself. The critical assumption is the protocol's ordering contract.

Step 9: Pattern 2 — Keyed or out-of-order checking

When transactions can complete out of order, the scoreboard should usually correlate expected and actual transactions using a protocol-defined key.

Expected transactions:


ID 10 -> expected data A
ID 11 -> expected data B
ID 12 -> expected data C

Responses:

ID 11
ID 12
ID 10

An associative array is a natural representation:

packet expected_by_id[int];


expected_by_id[10] = expected_10;
expected_by_id[11] = expected_11;
expected_by_id[12] = expected_12;

On response:

function void check_response(packet actual);


if (!expected_by_id.exists(actual.id)) begin


`uvm_error("SB",
  $sformatf(
    "Unexpected response ID=%0d",
    actual.id))

return;


end

packet expected = expected_by_id[actual.id];

if (!actual.compare(expected)) begin
`uvm_error("SB",
$sformatf(
"Mismatch for ID=%0d\nExpected:\n%s\nActual:\n%s",
actual.id,
expected.sprint(),
actual.sprint()))
end

expected_by_id.delete(actual.id);

endfunction

This pattern builds directly on Lesson 17's transaction correlation and Lesson 18's out-of-order response checking.

Lesson 25 will examine this architecture in much greater depth.

Step 10: Pattern 3 — FIFO-based checking

Sometimes the scoreboard receives transactions from an analysis port, but the checking algorithm is easier to express as a consumer process.

monitor


|
v
analysis_port
|
v
uvm_tlm_analysis_fifo
|
v
scoreboard run_phase()
|
v
check transaction

This architecture is useful when the scoreboard needs to wait for transactions without blocking an analysis callback.

task run_phase(uvm_phase phase);


packet tr;

forever begin


actual_fifo.get(tr);

check_transaction(tr);


end

endtask

It also provides a natural place to introduce buffering between the producer and consumer, which connects directly to the TLM FIFO concepts from Lesson 13.

Step 11: Pattern 4 — Predictor plus scoreboard

For a nontrivial DUT, the scoreboard should not necessarily contain the complete algorithm required to calculate expected behavior.

A predictor can transform observed inputs into expected outputs:

Input monitor
  |
  v


Predictor
|
v
Expected transaction
|
+------------------+
|
v
Scoreboard
^
|
Actual monitor
|
v
DUT

The scoreboard then focuses on correlation and comparison rather than becoming a second giant model.

For example:

request


|
v
predict(request)
|
v
expected response
|
v
expected_by_id[id]

actual response
|
v
lookup by ID
|
v
compare expected vs actual

This separation becomes particularly valuable when the expected behavior is algorithmically complex.

Architectural goal: Keep the scoreboard responsible for checking and correlation while keeping complex expected-behavior computation in a predictor or reference model when appropriate.

Step 12: Pattern 5 — Multiple input streams

Real environments often have more than one transaction stream.

Request monitor ----+
                |
                v
             Scoreboard
                ^
                |


Response monitor ---+

The scoreboard may need to correlate requests and responses, or compare transactions from multiple interfaces.

A more complex environment might look like:

AXI request monitor ----+
                    |


APB monitor ------------+--> Scoreboard
|
Interrupt monitor ------+
|
Status monitor ----------+

At this point, simply writing one large write() function becomes difficult to maintain.

Possible architectural improvements include:

  • Separate analysis implementations for different transaction types.
  • Separate FIFOs for independent streams.
  • Dedicated matching structures for each protocol channel.
  • Helper methods for correlation and comparison.
  • Independent checking processes for streams that can operate concurrently.

Lesson 26 will develop multi-stream scoreboard architectures in detail.

Step 13: Define failure categories

A good scoreboard should not report every failure as simply "mismatch." Different failure types imply different bugs.

Failure Meaning
Unexpected An actual transaction has no corresponding expected transaction.
Mismatch An expected transaction exists, but its contents differ from actual.
Duplicate A transaction that was already consumed appears again.
Missing An expected transaction never arrives.
Ordering violation Transactions appear in an order that violates the protocol contract.
Correlation error A response cannot be associated with the correct request.

These distinctions make regression triage much faster.

Step 14: Build debug-friendly diagnostics

A scoreboard error should contain enough information to identify the failing transaction without immediately opening a waveform.

Prefer:

UVM_ERROR [SB_MISMATCH]


ID=27
address=0x4000
expected_data=0x12345678
actual_data=0x12340000
request_cycle=100
response_cycle=113

over:

UVM_ERROR [SB]


Transaction mismatch

Useful diagnostic fields commonly include:

  • Transaction ID.
  • Address or channel.
  • Expected value.
  • Actual value.
  • Transaction type.
  • Relevant timing information.
  • Correlation state.
  • Protocol-specific status or error information.

This directly builds on Lesson 20, where transaction recording provided higher-level visibility into the same information.

Step 15: Do not silently delete failed expectations

The lifecycle of expected transactions matters.

Expected created
  |
  v


Stored in scoreboard
|
v
Actual arrives
|
+---- match ----> consume expected
|
+---- mismatch --> report failure
|
+---- unexpected --> report failure

If the scoreboard deletes an expected transaction before the comparison is complete, it can hide useful state and make duplicate or missing transaction detection harder.

A robust scoreboard should make the state transition explicit:

pending --> matched --> removed


pending --> mismatch --> removed or retained according to policy

no pending entry --> unexpected

The exact error-recovery policy can vary, but it should be deliberate rather than accidental.

Step 16: Handle end-of-test state

A scoreboard can miss an important class of failures if it checks only arriving actual transactions.

Consider:

Expected:


ID=10
ID=11
ID=12

Actual:
ID=10
ID=11

Simulation ends.

No mismatched actual transaction occurred, but ID 12 was never observed.

Therefore, scoreboards commonly need an end-of-test check that examines pending expected state.

function void check_remaining_expected();


foreach (expected_by_id[id]) begin
`uvm_error("SB",
$sformatf(
"Missing transaction ID=%0d",
id))
end

endfunction

This introduces a topic that will be developed in Lesson 29: End-of-Test Scoreboard Draining.

Step 17: Avoid embedding DUT implementation details

A scoreboard should provide an independent basis for checking the DUT.

Consider a DUT implementing:

output = (input_a + input_b) ^ mask;

A poor verification model might reproduce the same RTL structure line by line. If the RTL contains the same algorithmic mistake, the scoreboard can reproduce that mistake and incorrectly declare the DUT correct.

A better model expresses the expected behavior at the appropriate abstraction level.

expected = reference_function(input_a, input_b, mask);

The objective is not to make the reference model artificially different from the specification. The objective is to avoid unnecessary coupling to the DUT's implementation structure.

Step 18: Choose the pattern from protocol behavior

There is no universally correct scoreboard architecture. Choose the data structure and communication pattern from the DUT's behavior.

Protocol behavior Possible scoreboard pattern
One expected result for each actual result, same order Queue / in-order comparison
Responses can complete out of order Keyed associative-array matching
Independent processing is useful Analysis FIFO + consumer process
Expected behavior requires computation Predictor or reference model + scoreboard
Multiple independent streams Multiple inputs/FIFOs and dedicated correlation logic

The important design question is:

What behavior must the scoreboard prove?

    |
    v


What ordering exists?
What correlation key exists?
What expected behavior is required?
How many streams exist?
When can a transaction be considered complete?

Step 19: A practical scoreboard skeleton

The following skeleton provides a useful starting point without forcing a particular matching algorithm.

class bus_scoreboard extends uvm_scoreboard;


`uvm_component_utils(bus_scoreboard)

uvm_analysis_imp #(bus_transaction, bus_scoreboard) actual_imp;

function new(string name, uvm_component parent);
super.new(name, parent);
actual_imp = new("actual_imp", this);
endfunction

function void build_phase(uvm_phase phase);
super.build_phase(phase);
endfunction

function void connect_phase(uvm_phase phase);
super.connect_phase(phase);
endfunction

function void write(bus_transaction actual);
check_actual(actual);
endfunction

function void check_actual(bus_transaction actual);


// Determine how the actual transaction
// should be matched and checked.


endfunction

function void report_phase(uvm_phase phase);
super.report_phase(phase);


// Report remaining expected transactions
// and final scoreboard statistics.


endfunction

endclass

Notice that the skeleton does not assume that every scoreboard should use a queue or associative array. Those choices belong to the checking requirements.

Step 20: Scoreboard architecture in a reusable environment

A production verification environment may contain several scoreboards or specialized checking components.

                    +--> Protocol Assertions
                |
                +--> Functional Coverage
                |


DUT Interfaces --> Monitors
|
+--> Request Predictor
|        |
|        v
|     Expected
|        |
|        v
+--> Scoreboard <--- Actual
|
+--> Reports
|
+--> Recording / Debug

The architecture scales because each component has a focused responsibility.

This is also why the upcoming lessons are split into reference models, predictors, in-order scoreboards, out-of-order scoreboards, and multi-stream scoreboards rather than treating "the scoreboard" as one universal class.

Common mistakes

  • Making the scoreboard a giant monolithic component: Put complex expected-behavior algorithms in a predictor or reference model when that separation improves reuse and debug.
  • Assuming all traffic is in order: Verify the protocol's ordering rules before selecting a queue-based checker.
  • Using transaction arrival order as the correlation key: Use an actual protocol-defined identifier or matching rule when responses can complete independently.
  • Blocking inside an analysis write() callback: Use a TLM FIFO and a consumer process when the checking algorithm requires independent blocking behavior.
  • Reporting only "mismatch": Include IDs, expected values, actual values, and relevant context.
  • Ignoring missing transactions: Check pending expected state when the test ends or when a protocol-specific timeout expires.
  • Deleting state too early: Preserve enough information to diagnose duplicate, mismatch, and missing transaction failures.
  • Duplicating RTL implementation: Maintain enough independence between the DUT and expected-behavior model to make the check meaningful.
  • Making recording a functional dependency: Transaction recording should support scoreboard debug, not determine whether the scoreboard can perform its check.
  • Using one matching strategy for every protocol: Select queues, associative arrays, FIFOs, or multi-stream structures based on actual protocol behavior.

Debugging strategy

When a scoreboard reports a failure, debug from the highest useful abstraction level first.

  1. Identify the failure category: unexpected, missing, mismatch, duplicate, or ordering error.
  2. Identify the transaction ID, channel, address, or other correlation key.
  3. Inspect the expected transaction.
  4. Inspect the actual transaction observed by the monitor.
  5. Check whether the expected transaction was generated correctly.
  6. Check the scoreboard's matching state.
  7. Use transaction recording to inspect surrounding activity.
  8. Move to waveform analysis if signal-level behavior is required.

For example:

UVM_ERROR [SB_MISMATCH]


ID=42
expected=32'h00001234
actual=32'h00001230

The first question should not immediately be "Which RTL signal is wrong?" Instead ask:

Was the expected value correct?
    |
    +--> No --> investigate predictor/reference model
    |
    +--> Yes
          |
          v
    Was the correct response correlated?
          |
          +--> No --> investigate scoreboard matching
          |
          +--> Yes
                |
                v
          Investigate DUT behavior

This approach prevents verification infrastructure bugs from being mistaken for DUT bugs.

Practice: Build an in-order scoreboard

Create a small environment containing:

  • A transaction class containing an ID and data field.
  • A monitor that publishes actual transactions through an analysis port.
  • A scoreboard containing an expected queue.
  • A test that inserts five expected transactions.
  • A stimulus path that produces five actual transactions.

First make all five transactions match.

Then introduce these failures one at a time:

  1. Change one data value.
  2. Send an unexpected ID.
  3. Send a duplicate transaction.
  4. Stop before the final expected transaction arrives.

Your scoreboard should report a different diagnostic for each failure category.

Challenge: Convert it to keyed checking

Modify the previous scoreboard so that responses may arrive out of order.

Expected requests:


ID=10
ID=11
ID=12
ID=13

Actual responses:

ID=12
ID=10
ID=13
ID=11

Replace the expected queue with a keyed data structure.

Verify that every response is matched by ID rather than by arrival order.

Then deliberately:

  • Return an unknown ID.
  • Return the same ID twice.
  • Return the correct ID with incorrect data.
  • Never return one expected ID.

Explain which internal scoreboard state allows each failure to be detected.

Design challenge: Choose the architecture

For each scenario, select the most appropriate starting architecture and explain why.

  1. A simple FIFO DUT guarantees that outputs occur in exactly the same order as inputs.
  2. A bus permits eight outstanding requests and responses can return in any order using a transaction ID.
  3. Expected output requires a nontrivial algorithm that should be independently maintained from the scoreboard.
  4. Two interfaces produce transactions that must be correlated concurrently.
  5. The checking algorithm needs to block while waiting for transactions from independent streams.

For each answer, identify:

  • The transaction transport mechanism.
  • The expected-data mechanism.
  • The correlation strategy.
  • The data structure used for pending transactions.
  • How missing transactions will be detected.

Connection to the next lessons

Lesson 21 establishes the overall scoreboard architecture. The next lessons specialize the pieces introduced here.

Lesson 21  -> Scoreboard Design Patterns
              |
              +--> Lesson 22: Reference Models
              |
              +--> Lesson 23: Predictors
              |
              +--> Lesson 24: In-Order Scoreboards
              |
              +--> Lesson 25: Out-of-Order Scoreboards
              |
              +--> Lesson 26: Multi-Stream Scoreboards
              |
              +--> Lesson 27: Error Handling Strategies
              |
              +--> Lesson 28: Timeout Detection
              |
              +--> Lesson 29: End-of-Test Scoreboard Draining
              |
              +--> Lesson 30: Debug-Friendly Diagnostics

The key progression is:

What should be checked?
    |
    v


How is expected behavior generated?
|
v
How are expected and actual transactions correlated?
|
v
How are ordering and concurrency handled?
|
v
How are failures detected?
|
v
How is the result made easy to debug?

By the end of this module, the goal is not simply to have written a scoreboard. The goal is to be able to choose and justify a checking architecture for a real verification environment.

Self-check

  1. What is the primary responsibility of a UVM scoreboard?
  2. Why should a scoreboard not automatically contain the complete expected-behavior model?
  3. What is the difference between transaction transport and checking policy?
  4. When is a queue-based scoreboard appropriate?
  5. Why is a transaction ID useful for out-of-order checking?
  6. When would an analysis FIFO be preferable to direct write() processing?
  7. Why should an analysis write() callback not block waiting for unrelated traffic?
  8. What is the difference between an unexpected transaction and a missing transaction?
  9. Why is deleting expected state part of the checking algorithm?
  10. How can a scoreboard accidentally reproduce a DUT implementation bug?
  11. What information should a useful scoreboard error contain?
  12. Why must the scoreboard's architecture follow the protocol's ordering and concurrency rules?
Expected understanding: You should be able to look at a DUT's transaction behavior and select an appropriate scoreboard architecture, explain how expected behavior is generated, choose a correlation strategy, and design diagnostics that distinguish different classes of verification failure.

Key takeaways

  • A scoreboard is a checking component that determines whether observed behavior matches expected behavior.
  • Monitors observe traffic; predictors and reference models generate expected behavior; scoreboards correlate and compare it.
  • Analysis ports and TLM FIFOs provide transaction transport; they should not dictate the checking algorithm.
  • In-order protocols are naturally modeled with queues when arrival order is part of the contract.
  • Out-of-order protocols generally require protocol-defined correlation keys and keyed pending state.
  • Analysis FIFOs are useful when scoreboard processing needs buffering or independent blocking consumers.
  • Complex expected behavior is often easier to maintain in a predictor or reference model than inside the scoreboard itself.
  • Multiple transaction streams require explicit architecture for correlation and concurrency.
  • Missing, unexpected, duplicate, mismatched, and ordering failures should be distinguishable during debug.
  • Scoreboards should remain independent enough from DUT implementation details to provide meaningful verification.
  • End-of-test state matters: a scoreboard must detect expected transactions that never arrived.
  • Good scoreboard architecture follows protocol behavior rather than forcing every protocol into the same data structure.