-3
任何人都可以向我展示如何在Systemverilog中編寫Coverage監視器的示例,因爲我是新手。我需要了解顯示器任何示例或參考也很好如何在SystemVerilog中編寫UVM監視器
任何人都可以向我展示如何在Systemverilog中編寫Coverage監視器的示例,因爲我是新手。我需要了解顯示器任何示例或參考也很好如何在SystemVerilog中編寫UVM監視器
約翰Aynsley(來自Doulos)寫了一篇關於UVM的好文章,有一個可以幫助你的部分。該論文發表於DVCon 2011,您可以獲得其中的free copy:「主流用戶功能驗證更容易UVM」。
正如文章中所解釋的,這個想法是,你有一個uvm_monitor
和一個uvm_subscriber
。請注意,即使紙張在UVM訂閱服務器中顯示了所有功能覆蓋代碼,但沒有任何東西阻止您在監視器中顯示該代碼。
的監控代碼看起來如下圖所示:
class my_monitor extends uvm_monitor;
`uvm_component_utils(my_monitor)
uvm_analysis_port #(my_tx) aport;
virtual dut_if dut_vi;
...
task run;
forever
begin
my_tx tx;
// Sense the DUT pins on a clock edge
@(posedge dut_vi.clock);
tx = my_tx::type_id::create("tx");
tx.cmd = dut_vi.cmd;
tx.addr = dut_vi.addr;
tx.data = dut_vi.data;
aport.write(tx);
end
endtask
endclass
然後創建一個用戶,如圖中的文件:
class my_subscriber extends uvm_subscriber #(my_tx);
`uvm_component_utils(my_subscriber)
// Coverage registers
bit cmd;
int addr;
int data;
covergroup cover_bus;
coverpoint cmd;
coverpoint addr;
coverpoint data;
endgroup
...
// Function called through analysis port
function void write(my_tx t);
cmd = t.cmd;
addr = t.addr;
data = t.data;
cover_bus.sample();
endfunction
endclass
最後,您實例監視器和在用戶在組件層次結構中進行下一級升級並按文件中所示連接它們。
class my_env extends uvm_env;
`uvm_component_utils(my_env)
my_monitor monitor;
my_subscriber subscriber;
...
function void build;
super.build();
monitor = my_monitor::type_id::create("monitor" , this);
subscriber = my_subscriber::type_id::create("subscriber", this);
endfunction
function void connect;
monitor.aport.connect(subscriber.analysis_export);
endfunction
endclass
PS。文件中顯示的所有代碼源文件都可以從Doulos website下載。