0
如何在接口中添加功能?我正在嘗試使用具有計算總和和進位的函數的接口來實現半加法器。以下是我的代碼。在沒有功能的情況下嘗試使用補充行來運行。帶功能的系統verilog接口
module top_ha_interface;
ha_interface nh1();
ha h1(nh1);
ha_tb h2(nh1);
endmodule
interface ha_interface;
logic sum,c_out;
logic a,b;
function summ(a,b,output sum,c_out);
sum=a^b;
c_out=a&b;
endfunction
endinterface
module ha(ha_interface nh1);
// assign nh1.sum=nh1.a^nh1.b;
// assign nh1.c_out=nh1.a&nh1.b;
nh1.summ(nh1.a,nh1.b);
endmodule
module ha_tb(ha_interface nh1);
initial
begin
nh1.a=1'b1;
nh1.b=1'b0;
#10 $display($time,"ns\t",nh1.sum,nh1.c_out);
nh1.a=1'b1;
nh1.b=1'b1;
#20 $display($time,"ns\t",nh1.sum,nh1.c_out);
nh1.a=1'b0;
nh1.b=1'b0;
#30 $display($time,"ns\t",nh1.sum,nh1.c_out);
end
endmodule
感謝 它的工作現在。 你能告訴我如何提高我的SV技能? 是否可以在一個月內完成UVM? 從明天開始,我將開始研究UVM,每天學習12小時。 –
@NIKHILARORA:您可以通過System Verilog LRM的Chris Spear閱讀「SV For Verification」這本書。對於UVM,您應該閱讀「UVM食譜」,您也可以在Verification Academy上觀看視頻。順便說一句,如果你確信答案,你可以接受我的答案,如果你願意,你也可以放棄它。 –
[IEEE Std 1800-2012](http://standards.ieee.org/getieee/1800/download/1800-2012.pdf)是SystemVerilog LRM。 (Verification Academy)[https://verificationacademy.com/]是一個很好的資源;我建議通過UVM食譜的視頻課程。這兩者都不是完美的,但我發現食譜更加面向OVM(前身的方法論)有更多令人困惑的微妙拼寫錯誤,讓學習變得更加痛苦。 – Greg