Basic Scoreboards
Learn how a UVM scoreboard compares observed DUT behavior with expected behavior and turns mismatches into clear verification results.
Learning objectives
- Explain the purpose of a UVM scoreboard.
- Distinguish expected behavior from observed DUT behavior.
- Connect a monitor to a basic scoreboard through TLM analysis.
- Compare transactions and report mismatches clearly.
- Count scoreboard errors and summarize results at the end of a test.
- Understand when a simple in-order scoreboard is sufficient.
- Recognize common scoreboard design and debugging mistakes.
Step 1: What does a scoreboard do?
A scoreboard is a verification component that determines whether the DUT's observed behavior matches what the testbench expects.
The basic idea is simple:
Expected behavior
|
v
Scoreboard
^
|
Observed behavior
|
v
DUT
For example, suppose the testbench expects:
WRITE
addr = 8'h20
data = 8'hAA
The monitor observes:
WRITE
addr = 8'h20
data = 8'hAA
The scoreboard compares the two and reports a match.
If the DUT instead produces:
WRITE
addr = 8'h20
data = 8'h55
the scoreboard should report a mismatch.
Step 2: Expected versus observed
A useful scoreboard keeps two concepts separate:
- Expected: what the verification environment predicts should happen.
- Observed: what the monitor actually saw on the DUT interface.
The monitor provides the observed transaction:
Monitor
|
| observed transaction
v
Scoreboard
The expected transaction may come from a simple prediction, a reference model, a queue of expected values, or another part of the verification environment.
For this beginner lesson, start with a simple expected transaction.
expected.data = 8'hAA;
Then compare it against the observed transaction:
if (observed.data != expected.data)
`uvm_error("SB",
"Observed data does not match expected data")
This simple comparison is the foundation of much more sophisticated scoreboard architectures.
Step 3: Where does the scoreboard fit?
The scoreboard belongs on the observation side of the verification environment.
Sequence
|
v
Sequencer
|
v
Driver
|
v
DUT
|
v
Monitor
|
| observed transaction
v
Analysis Port
|
v
Scoreboard
|
v
PASS / FAIL
Notice what the scoreboard does not do:
- It does not drive DUT pins.
- It does not generate the original stimulus.
- It does not sample the interface directly.
- It does not replace the monitor.
The monitor translates signal activity into transactions. The scoreboard reasons about those transactions.
Step 4: Build a basic scoreboard
A simple scoreboard can extend uvm_scoreboard and receive transactions through an analysis implementation.
class bus_scoreboard extends uvm_scoreboard;
`uvm_component_utils(bus_scoreboard)
uvm_analysis_imp #(bus_transaction, bus_scoreboard)
analysis_imp;
int total_checks;
int total_errors;
function new(
string name = "bus_scoreboard",
uvm_component parent = null
);
super.new(name, parent);
analysis_imp =
new("analysis_imp", this);
total_checks = 0;
total_errors = 0;
endfunction
function void write(bus_transaction t);
total_checks++;
`uvm_info("SB",
$sformatf(
"Checking transaction:\n%s",
t.sprint()),
UVM_MEDIUM)
endfunction
endclass
For now, the scoreboard receives transactions and counts how many it has checked.
Next, we add an actual correctness comparison.
Step 5: Compare an observed value
Suppose the scoreboard expects a specific data value.
function void write(bus_transaction t);
total_checks++;
if (t.data != 8'hAA) begin
total_errors++;
`uvm_error("SB",
$sformatf(
"Data mismatch: expected=8'hAA observed=%0h",
t.data))
end
else begin
`uvm_info("SB",
$sformatf(
"Data matched: %0h",
t.data),
UVM_MEDIUM)
end
endfunction
This is intentionally simple. Real designs usually cannot expect every transaction to have the same value.
But the structure is important:
Receive
|
v
Determine expected result
|
v
Compare expected vs observed
|
+---- Match ----> Continue
|
+---- Mismatch --> Record error
That pattern remains useful as the scoreboard becomes more sophisticated.
Step 6: Why a scoreboard often needs expected data
For realistic verification, the expected result usually depends on previous transactions.
Consider a FIFO.
Write A
Write B
Read -> expected A
Read -> expected B
The scoreboard cannot simply compare every observed read against one constant.
It needs to remember what should come out.
A basic architecture is:
Write transaction
|
v
Expected queue
|
v
Read transaction -> Compare
^
|
Monitor
This introduces a very important scoreboard concept:
Lesson 48 will develop this idea into in-order checking. For now, understand why expected data sometimes needs to be stored.
Step 7: Simple expected-data queue
Suppose a test writes values into a DUT and later expects those same values to be returned in order.
A queue can represent the expected stream:
bit [7:0] expected_queue[$];
When a write is observed:
expected_queue.push_back(t.data);
When a read is observed:
bit [7:0] expected;
if (expected_queue.size() == 0) begin
`uvm_error("SB",
"Read observed but no expected data exists")
end
else begin
expected = expected_queue.pop_front();
if (t.data != expected) begin
total_errors++;
`uvm_error("SB",
$sformatf(
"Mismatch: expected=%0h observed=%0h",
expected,
t.data))
end
end
This is the beginning of an in-order scoreboard.
The important lesson is that the scoreboard is no longer comparing against a fixed constant. It is maintaining a model of what should happen next.
Step 8: Expected data is not always the driver's transaction
A common beginner mistake is to assume that the driver transaction is automatically the correct expected result.
The driver represents stimulus intent:
"I asked the DUT to perform this operation."
The monitor represents observed behavior:
"This is what appeared on the DUT interface."
The scoreboard represents prediction and checking:
"Given the DUT specification and prior activity,
this is what should have happened."
These concepts should remain distinct.
Stimulus intent ----> Driver ----> DUT
|
v
Monitor
|
v
Observed data
|
v
Expected model ----------------> Scoreboard
|
v
Compare
Step 9: Report scoreboard results
A scoreboard should keep track of useful summary information.
int total_checks;
int total_errors;
At the end of the test, it can report the result:
function void report_phase(uvm_phase phase);
super.report_phase(phase);
`uvm_info("SB",
$sformatf(
"Scoreboard summary: checks=%0d errors=%0d",
total_checks,
total_errors),
UVM_LOW)
endfunction
A summary might look like:
Scoreboard summary:
checks = 100
errors = 0
or:
Scoreboard summary:
checks = 100
errors = 3
For a beginner environment, this provides a clear connection between observed transactions and the final verification result.
Step 10: A complete basic scoreboard
Here is a compact scoreboard that receives transactions, performs a simple check, counts errors, and reports a summary.
class bus_scoreboard extends uvm_scoreboard;
`uvm_component_utils(bus_scoreboard)
uvm_analysis_imp #(bus_transaction, bus_scoreboard)
analysis_imp;
int total_checks;
int total_errors;
function new(
string name = "bus_scoreboard",
uvm_component parent = null
);
super.new(name, parent);
analysis_imp =
new("analysis_imp", this);
total_checks = 0;
total_errors = 0;
endfunction
function void write(bus_transaction t);
total_checks++;
if (t.data != 8'hAA) begin
total_errors++;
`uvm_error("SB",
$sformatf(
"Mismatch: expected=8'hAA observed=%0h",
t.data))
end
else begin
`uvm_info("SB",
$sformatf(
"PASS: observed data=%0h",
t.data),
UVM_MEDIUM)
end
endfunction
function void report_phase(uvm_phase phase);
super.report_phase(phase);
`uvm_info("SB",
$sformatf(
"Scoreboard summary: checks=%0d errors=%0d",
total_checks,
total_errors),
UVM_LOW)
endfunction
endclass
This is not a production-level scoreboard, but it demonstrates the essential architecture:
- Receive an observed transaction.
- Determine what should be true.
- Compare expected and observed behavior.
- Record mismatches.
- Report a summary.
Step 11: Connect the monitor to the scoreboard
The scoreboard needs to be connected to the monitor just like the subscribers from Lesson 45.
In build_phase():
monitor =
bus_monitor::type_id::create(
"monitor", this);
scoreboard =
bus_scoreboard::type_id::create(
"scoreboard", this);
In connect_phase():
monitor.analysis_port.connect(
scoreboard.analysis_imp
);
The complete observation path becomes:
DUT
|
v
Monitor
|
| bus_transaction
v
Analysis Port
|
v
Scoreboard
|
+--> Compare
|
+--> Count errors
|
+--> Report result Step 12: Scoreboard versus subscriber
Lesson 45 introduced subscribers. It is important to understand why a scoreboard is different.
| Component | Primary purpose | Example |
|---|---|---|
| Subscriber | Analyze observations | Count transactions or collect coverage |
| Scoreboard | Check correctness | Compare expected and observed data |
Both can receive the same monitor transaction:
Monitor
|
v
Analysis Port
/ \
/ \
v v
Subscriber Scoreboard
"What did "Was it
we observe?" correct?"
This separation keeps the verification environment modular.
Common mistakes
- Comparing against the wrong expected value: the expected result must reflect the DUT specification.
- Using driver intent as observed behavior: the scoreboard should normally consume monitor observations.
- Forgetting to connect the scoreboard: no transaction can be checked if the analysis path is missing.
- Ignoring ordering: if outputs correspond to earlier inputs, the scoreboard may need a queue or other state.
- Checking before a transaction is complete: compare complete meaningful observations.
- Putting protocol sampling in the scoreboard: the monitor should handle interface timing.
- Reporting every mismatch without useful context: include expected and observed values, and enough information to locate the transaction.
- Assuming zero scoreboard messages means zero errors: a missing connection can produce zero checks rather than a passing test.
- Checking only the final value: intermediate incorrect behavior can be missed if the protocol requires transaction-by-transaction checking.
checks = 0 is usually not the same as errors = 0. A scoreboard that received nothing cannot prove the DUT was correct.
Debugging a scoreboard
When a scoreboard reports an unexpected result, debug from the transaction source toward the comparison.
1. Did the DUT perform the operation?
2. Did the monitor observe it?
3. Did the monitor reconstruct the transaction correctly?
4. Did the analysis port publish it?
5. Did the scoreboard receive it?
6. Is the expected result correct?
7. Is the comparison correct?
8. Was transaction ordering handled correctly?
Print both sides of the comparison:
`uvm_info("SB",
$sformatf(
"Expected=%0h Observed=%0h",
expected,
observed),
UVM_MEDIUM)
Then compare the transaction against the waveform.
A good debugging sequence is:
Waveform
|
v
Monitor observation
|
v
Observed transaction
|
v
Expected transaction/model
|
v
Scoreboard comparison
|
v
PASS / FAIL When is a basic scoreboard enough?
A simple scoreboard works well when:
- transactions arrive in a predictable order,
- the expected result is easy to calculate,
- one observed transaction corresponds directly to one expected result,
- there is little or no internal state to model.
It becomes more complicated when:
- responses can arrive out of order,
- one request produces multiple responses,
- multiple interfaces must be correlated,
- latency varies,
- the expected result depends on substantial DUT behavior.
Those situations lead to more advanced scoreboard and reference-model architectures later in the curriculum.
Practical scoreboard design pattern
Stimulus
|
v
DUT
|
v
Monitor
|
| observed
v
+-------------+
| Scoreboard |
+-------------+
| |
| +----> Error count
|
+------------> Expected model
|
v
Compare
|
v
PASS / FAIL
The scoreboard is the point where the testbench turns observations into a correctness judgment.
Try it yourself
Build a basic in-order scoreboard for a simple bus or FIFO-style DUT.
- Create a
bus_scoreboardextendinguvm_scoreboard. - Add an analysis implementation for
bus_transaction. - Connect the monitor's analysis port to the scoreboard.
- Count every received transaction.
- Create a small expected-data queue.
- Add expected values when the appropriate operation is observed.
- Compare returned/observed values against the expected queue.
- Increment an error counter when a mismatch occurs.
- Print a final scoreboard summary.
Debug challenge: intentionally change one expected value. Confirm that the scoreboard reports a mismatch and that the final error count increases.
Architecture challenge: temporarily disconnect the scoreboard. What does checks = 0 tell you about the test result?
Key takeaways
- A scoreboard determines whether observed DUT behavior matches expected behavior.
- Observed transactions normally come from a monitor through a TLM analysis connection.
- Expected behavior should come from the DUT specification, prediction logic, or a reference model—not simply from driver intent.
- A basic scoreboard can compare transactions, count errors, and report a summary.
- Stateful behavior often requires queues or other data structures to remember expected results.
- Simple in-order scoreboards work well when expected and observed transactions have a predictable relationship.
- A scoreboard should check behavior rather than drive the DUT or sample its pins directly.
checks = 0does not prove correctness; it may indicate that the scoreboard received no transactions.- Good scoreboard errors include enough expected, observed, and transaction context to debug the failure.
Core mental model
The monitor tells you what happened. The expected model tells you what should have happened. The scoreboard compares the two and turns the difference into verification evidence.
What comes next?
A basic scoreboard becomes much more powerful when the expected behavior is generated by a dedicated model of the DUT.
That leads to the next lesson: Reference Model Basics.
You will learn how a reference model predicts expected results and provides the scoreboard with an independent source of truth for checking DUT behavior.