Skip to main content

UVM Scoreboard Usage and Adder Example

· loading · loading · ·
Education UVM Verification UVM Verification SystemVerilog Uvm_scoreboard Test Results
Education UVM Verification
Axolot Logic
Author
Axolot Logic
Digital Design Engineer
Table of Contents
UVM Series - This article is part of a series.
Part 17: This Article

📊 UVM Scoreboard Usage and Adder Example
#

🚀 Introduction
#

In UVM, a scoreboard is a testbench component used to compare the actual results produced by the DUT (Device Under Test) with the expected results. It receives data from the monitor and checks it against a golden model or simple arithmetic rules to verify the DUT’s behavior. The scoreboard reports whether the test has passed or failed, providing feedback on the test process.


📝 Adder Scoreboard Example
#

Below is a simple adder_scoreboard example. This scoreboard verifies addition operations using the adder_transaction.

class adder_scoreboard extends uvm_component;
    uvm_analysis_imp #(adder_transaction, adder_scoreboard) analysis_export;
    int total_transactions;
    int correct_transactions;

    `uvm_component_utils(adder_scoreboard)

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

    function void write(adder_transaction t);
      int expected_result = t.num1 + t.num2;
      t.is_correct = (t.result == expected_result);
      `uvm_info("SCOREBOARD", $sformatf("Checked: num1=0x%0d, num2=0x%0d, DUT result=0x%0d, Expected=0x%0d, %s",
                t.num1, t.num2, t.result, expected_result, t.is_correct ? "PASS" : "FAIL"), UVM_MEDIUM)
      total_transactions++;
      if (t.is_correct) correct_transactions++;
    endfunction

    function void report_phase(uvm_phase phase);
      `uvm_info("SCOREBOARD_REPORT", $sformatf("Total Transactions: %0d, Correct Transactions: %0d, Pass Rate: %0.2f%%",
                total_transactions, correct_transactions, (correct_transactions * 100.0) / total_transactions), UVM_NONE)
    endfunction
  endclass

🔍 Explanations
#

  • uvm_analysis_imp: Used to receive adder_transaction data from the monitor.
  • adder_transaction: Holds the received data for checking.
  • total_transactions: A transaction counter (optionally used for coverage or logging).
  • report_phase(): Checks whether the addition operation is correct and reports the result.

💡 Summary
#

🔹 The scoreboard is used to compare the DUT’s actual behavior with the expected behavior. 🔹 In the adder example, it checks whether the addition result is correct. 🔹 Simple error and info messages report the test results. 🔹 This structure increases the efficiency and reliability of the testbench.


UVM Series - This article is part of a series.
Part 17: This Article

Related

UVM Agent Usage and Adder Example
· loading · loading
Education UVM Verification UVM Verification SystemVerilog Uvm_agent Testbench Structure
Education UVM Verification
UVM Monitor Usage and Adder Example
· loading · loading
Education UVM Verification UVM Verification SystemVerilog Uvm_monitor Coverage
Education UVM Verification
UVM Sequence Usage and Adder Example
· loading · loading
Education UVM Verification UVM Verification SystemVerilog Uvm_sequence Stimulus Generation
Education UVM Verification
UVM Test Usage and base_test Example
· loading · loading
Education UVM Verification UVM Verification SystemVerilog Uvm_test Test Scenario
Education UVM Verification
UVM Base Classes
· loading · loading
Education UVM Verification UVM Verification SystemVerilog Class Hierarchy
Education UVM Verification
UVM Driver Usage and Adder Example
· loading · loading
Education UVM Verification UVM Verification SystemVerilog Uvm_driver Stimulus Driving
Education UVM Verification