UVM Scoreboard Example

UVM Scoreboard

The user-defined scoreboard is extended from uvm_scoreboard, uvm_scoreboard is inherited by uvm_component.

Writing Scoreboard

The scoreboard is written by extending the UVM_SCOREBOARD.

class mem_scoreboard extends uvm_scoreboard;

  `uvm_component_utils(mem_scoreboard)

  // new - constructor
  function new (string name, uvm_component parent);
    super.new(name, parent);
  endfunction : new

endclass : mem_scoreboard
  • the scoreboard will check the correctness of the DUT by comparing the DUT output with the expected values
  • the scoreboard will receive the transactions from the Monitors implemented inside agents
  • Monitor and scoreboard will communicate via TLM ports and exports

Scoreboard shall compare the DUT output values with,

  1. The golden reference values
  2. The values Generated from the reference model
UVM Scoreboard
UVM Scoreboard

Declare and Create TLM Analysis port, ( to receive transaction pkt from Monitor).

//Declaring port
uvm_analysis_imp#(mem_seq_item, mem_scoreboard) item_collected_export;

//creating port
item_collected_export = new("item_collected_export", this);

analysis export of Scoreboard is connected to Monitor port

monitor.item_collected_port.connect(scoreboard.item_collected_export);

uvm scoreboard write function

write method of the scoreboard will receive the transaction packet from the monitor, on calling write method from the monitor.

uvm scoreboard write function
uvm scoreboard write function
  //calling write method from monitor
  item_collected_port.write(pkt);
 
  //scoreboard write function
  virtual function void write(mem_seq_item pkt);
    pkt.print();
  endfunction : write

UVM scoreboard code

Below is the complete scoreboard code.

class mem_scoreboard extends uvm_scoreboard;

  `uvm_component_utils(mem_scoreboard)
  uvm_analysis_imp#(mem_seq_item, mem_scoreboard) item_collected_export;

  // new - constructor
  function new (string name, uvm_component parent);
    super.new(name, parent);
  endfunction : new

  function void build_phase(uvm_phase phase);
    super.build_phase(phase);
    item_collected_export = new("item_collected_export", this);
  endfunction: build_phase
  
  // write
  virtual function void write(mem_seq_item pkt);
    $display("SCB:: Pkt recived");
    pkt.print();
  endfunction : write

endclass : mem_scoreboard

❮ Previous Next ❯