其他分享
首页 > 其他分享> > UVM Scoreboard

UVM Scoreboard

作者:互联网

用户自定义的 scoreboard 从 uvm_scoreboard 扩展而来。uvm_scoreboard 继承于 uvm_component 。

Writing Scoreboard:

scoreboard是通过扩展 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

scoreboard将通过将 DUT 输出与预期值进行比较来检查 DUT 的正确性

scoreboard从monitor接收事物

monitor和scoreboard将通过 TLM port和export进行通信

scoreboard应将 DUT 输出值与

1.黄金参考值

2. 从参考模型生成的值

进行比较

声明并创建 TLM analysis port,(从 Monitor 接收事务 pkt)。

/Declaring port
uvm_analysis_imp#(mem_seq_item, mem_scoreboard) item_collected_export;
 
//creating port
item_collected_export = new("item_collected_export", this);

Scoreboard 的analysis export连接到 Monitor port

monitor.item_collected_port.connect(scoreboard.item_collected_export);

uvm scoreboard write function

scoreboard的 write 方法,将在从monitor调用 write 方法时,接收来自monitor的事务包。

//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

 

完整代码:

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

 

标签:mem,Scoreboard,scoreboard,write,item,uvm,new,UVM
来源: https://www.cnblogs.com/fuqiangblog/p/16684397.html