“l(fā)et”和define一樣,也是可以帶有參數(shù)的。
module abc; logic clk, x, y, j; logic [7:0] r1; let lxor (p, q=1’b0) = p^q; always @ (posedge clk) begin for (i = 0; i <= 256; i++) begin r1 = lxor( i ); //After expanding the ‘let’ instance, //this will be r1 = i ^ 1’b0; end end endmodule
在上面的例子中,“l(fā)et”中包含2個(gè)參數(shù)“p”和“q”。
lxor(i)將i傳遞給“p”,"q"還是默認(rèn)值1‘b0。
所以
r1 = lxor( i );
等價(jià)
r1 = i ^ 1’b0;
審核編輯:劉清
-
ABC
+關(guān)注
關(guān)注
0文章
12瀏覽量
9443 -
Verilog編程
+關(guān)注
關(guān)注
0文章
3瀏覽量
1610
原文標(biāo)題:SystemVerilog中帶參數(shù)的“l(fā)et”
文章出處:【微信號:芯片驗(yàn)證工程師,微信公眾號:芯片驗(yàn)證工程師】歡迎添加關(guān)注!文章轉(zhuǎn)載請注明出處。
發(fā)布評論請先 登錄
SystemVerilog中的Virtual Methods
SystemVerilog中的“const”類屬性
systemverilog------Let's Go
SystemVerilog的斷言手冊
基于SystemVerilog語言的驗(yàn)證方法學(xué)介紹

SystemVerilog語言介紹匯總
SystemVerilog中$cast的應(yīng)用
SystemVerilog中的操作方法
SystemVerilog中可以嵌套的數(shù)據(jù)結(jié)構(gòu)
SystemVerilog中的Semaphores
Systemverilog中的Driving Strength講解

評論