# Uvm\_scoreboard

**URL:** <https://verificationacademy.com/forums/t/uvm-scoreboard/36852>\
**Category:** UVM\
**Tags:** uvm\_scoreboard, UVM\
**Created:** [November 27, 2019, 12:30am UTC](https://verificationacademy.com/forums/t/uvm-scoreboard/36852 "2019-11-27T00:30:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dvuvmsv](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/a4c791/32.png) [@dvuvmsv](https://verificationacademy.com/forums/u/dvuvmsv)\
**Post date:** [November 27, 2019, 12:30am UTC](https://verificationacademy.com/forums/t/uvm-scoreboard/36852/1 "2019-11-27T00:30:58Z")

</div>

Hello,

uvm\_scoreboard has a write task which will write to the Queue or Associative array.  
How will uvm scoreboard know that a packet has arrived ?

Thanks  
JeffD

---

<div class="post-metadata">

**Author:** ![chr\_sue](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/chr_sue/32/1199_2.png) [@chr\_sue](https://verificationacademy.com/forums/u/chr_sue)\
**Post date:** [November 27, 2019, 7:54am UTC](https://verificationacademy.com/forums/t/uvm-scoreboard/36852/2 "2019-11-27T07:54:32Z")

</div>

_In reply to [dvuvmsv](https://verificationacademy.com/forums/t/uvm-scoreboard/36852):_

Hi Jeff the scoreboard does not call the write function. This function is provided for another componenet which is calling it. In most cases it is a monotr which is collectiong a transaction from the virtual interface. When the transaction is complete it is published to the analysis port of the monitor by calling the write function. Then each component which is registered with this analysis port get this tranction and the scoreboard can store it.

---

<div class="post-metadata">

**Author:** ![dvuvmsv](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/a4c791/32.png) [@dvuvmsv](https://verificationacademy.com/forums/u/dvuvmsv)\
**Post date:** [November 27, 2019, 4:08pm UTC](https://verificationacademy.com/forums/t/uvm-scoreboard/36852/3 "2019-11-27T16:08:47Z")

</div>

Thanks chr\_sue for your reply.

I saw an example scoreboard class. Here there is a uvm\_tlm\_analysis\_fifo instantiated.  
The Monitor call the write function implemented in the scoreboard. ( Here in this example there is no write function shown ). I believe a write task should be implemented  
in scoreboard and Scoreboard should call the get(transaction) to pop the transaction  
out of the analysis port before comparison.

Could you please give me an example of write function in scoreboard

class simpleadder\_scoreboard extends uvm\_scoreboard;  
`uvm\_component\_utils(simpleadder\_scoreboard)

```
 uvm_analysis_export #(simpleadder_transaction) sb_export_before;
 uvm_analysis_export #(simpleadder_transaction) sb_export_after;

 uvm_tlm_analysis_fifo #(simpleadder_transaction) before_fifo;
 uvm_tlm_analysis_fifo #(simpleadder_transaction) after_fifo;

 simpleadder_transaction transaction_before;
 simpleadder_transaction transaction_after;

 function new(string name, uvm_component parent);
      super.new(name, parent);
      transaction_before = new("transaction_before");
      transaction_after = new("transaction_after");
 endfunction: new

 function void build_phase(uvm_phase phase);
      super.build_phase(phase);
      sb_export_before = new("sb_export_before", this);
      sb_export_after = new("sb_export_after", this);

      before_fifo = new("before_fifo", this);
      after_fifo = new("after_fifo", this);
 endfunction: build_phase

 function void connect_phase(uvm_phase phase);
      sb_export_before.connect(before_fifo.analysis_export);
      sb_export_after.connect(after_fifo.analysis_export);
 endfunction: connect_phase

 task run();
      forever begin
           before_fifo.get(transaction_before);
           after_fifo.get(transaction_after);
           compare();
      end
 endtask: run

 virtual function void compare();
      if(transaction_before.out == transaction_after.out) begin
           `uvm_info("compare", {"Test: OK!"}, UVM_LOW);
      end else begin
           `uvm_info("compare", {"Test: Fail!"}, UVM_LOW);
      end
 endfunction: compare

```

endclass: simpleadder\_scoreboard

Thanks  
JeffD

---

<div class="post-metadata">

**Author:** ![chr\_sue](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/chr_sue/32/1199_2.png) [@chr\_sue](https://verificationacademy.com/forums/u/chr_sue)\
**Post date:** [November 27, 2019, 6:41pm UTC](https://verificationacademy.com/forums/t/uvm-scoreboard/36852/4 "2019-11-27T18:41:02Z")

</div>

_In reply to [dvuvmsv](https://verificationacademy.com/forums/t/uvm-scoreboard/36852/3):_

The base class uvm\_scoreboard does not have itself a write function, but the uvm\_tlm\_analysis\_fifo has one. Thus you are writing from the scoreboardto the tlm\_fifo. In the scoreboard itself you are performimg calls of (blocking) on each of the tlm\_fifos to retrieve the corresponding transactions. write has to have a function. It ios not blocking.

---

<div class="post-metadata">

**Author:** ![dvuvmsv](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/d/a4c791/32.png) [@dvuvmsv](https://verificationacademy.com/forums/u/dvuvmsv)\
**Post date:** [November 27, 2019, 11:08pm UTC](https://verificationacademy.com/forums/t/uvm-scoreboard/36852/5 "2019-11-27T23:08:39Z")

</div>

Thank you chr\_sue  
JeffD
