SystemVerilog-虚拟接口

时间:2015-10-26 05:02:00

标签: system-verilog

在代码中,在类BFM中,指针xaction如何在函数new中起作用?为什么我们需要新的功能?

//界面定义

 interface Bus
    (input logic clk);
     bit req;
     bit grant;
     logic [7:0] addr;
     logic [7:0] data;
    endinterface: Bus

//interface Instance
Bus infc_b (clk);
//dut instance
dut dut1 (infc_b, clk);
//class instance
Bus mybfm = new(infc_b);     

//class
Class BFM;
   Virtual Bus bus;
   Xaction xaction;
   function new (vitual bus b); //need to intertialize virtual Interface in       //constructor
 bus=b; 
 xaction=b; 
endfunction 

task req_bus();
    @(posedge bus.clk);
bus.req<=1'b1;
$display("Req = %b @ %0t", bus.req, $time);
endtask: req_bus
endclass: BFM

0 个答案:

没有答案