[UVM]Subscriber for UVM Component

First, Subscriber is used to receive Coverage, the following is a recommended way of writing:

class uvm_ip_subscriber extends uvm_subscriber;

  uvm_tlm_analysis_fiof#(dma_trans)            dma_monitor_to_sub_fifo[1];

  extern function new(string name, uvm_component parent);
  extern virtual function write(T t);
  extern virtual task get_dma_trans();

  extern virtual task run_phase(uvm_phase phase);

  //coverage group
  covergroup ostd_cfg_group;
    option.per_instance = 1;
    ostd: coverpoint(reg_cfg_trans.reg_wr_ostd[7:0]){
            bins udb_0    =    {0};
            bins udb_1    =    {[1:8]};
            bins udb_2    =    {[9:16]};
            bins udb_3    =    {[17:254]};
            bins udb_4    =    {255};
    }
  endgroup

endclass: uvm_ip_subscriber

function uvm_ip_subscriber::new(string name, uvm_component parent);
  super.new();
  dma_monitor_to_sub_fifo[0] = new("dma_monitor_to_sub_fifo_0", this);

  ostd_cfg_group = new();
endfunction: new

/ / Must be rewritten write this pure virtual function
function uvm_ip_subscriber::write(T t);  
endfunction: write

task uvm_ip_subscriber::get_dma_trans();
  dma_monitor_to_sub_fifo[0].get(tr);
  $cast(tr_clone, tr);
  reg_cfg_tr_q[0].push_back(tr_clone);

  if(reg_cfg_tr_q[0].size() > 0) begin
    reg_cfg_trans = reg_cfg_tr_q[0].pop_front();
         //sampling
    ostd_cfg_group.sample();
  end
endtask: get_dma_trans



 

Intelligent Recommendation

[UVM]UVM Callback Example

Callback to corrupt the stimulus Let's consider an example of a Slave Driver (Slave Driver: drives response to the master). For simplicity, one callback hook is implemented and only response gene...

[UVM]UVM Port Fundamentals

                         UVM Port Fundamentals        The UVM Base Class Library (BCL) includes base port classes t...

[UVM]UVM Sequencer

                                UVM Sequencer   The sequencer controls the flow of request and response sequence it...

[UVM]UVM Sequence

                                   UVM Sequence          A sequence generates a serie...

[UVM]UVM TLM FIFO

                                   UVM TLM FIFO   table of Contents          UVM...

More Recommendation

[UVM]UVM Sequence item

                               UVM Sequence item          The sequence-item is written by exten...

[UVM]UVM RAL Adapter

                                    UVM RAL Adapter          With the UVM Register mo...

[UVM]UVM TLM Export

                                  UVM TLM Export   The TLM Export is a port that forwards a transaction from a...

UVM ——UVM (sequence)

content 、sequence 5.1sequence 5.2sequence ——start()/default_sequence 5.3sequence ——body() `uvm_do(): 5.4sequence 5.4.1 5.4.2 、sequence UVM sequence test case testbench 。 ,testb...

UVM-partially inherited component source code

Article Directory 1.uvm_driver 2.uvm_monitor 3.uvm_agent 4.uvm_scoreboard 5.uvm_subscriber(coverage) 6.uvm_env 7.uvm_test    The source code of these components, exceptIn uvm_driver, uvm_age...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top