我想連接systemverilog/verilog中的兩個字符串來創建信號名稱。 在我的下面的代碼片段中,lhs方似乎工作正常,但rhs方面沒有。 該工具給出錯誤「bitemp尚未聲明」。使用宏在systemverilog中連接信號名稱
如果我通過一個hardcorded值說「0」爲「clno」參數,那麼它適用於lhs和rhs。
enter code here
`define strcat_assign_macro(lhs_prestr,lhs_poststr,rhs_prestr,rhs_poststr,clno) \
assign lhs_prestr``clno``lhs_poststr = rhs_prestr``clno``rhs_poststr;
module tempmod;
wire a0temp,b0temp;
wire a1temp,b1temp;
wire a2temp,b2temp;
assign b0temp =1'b1;
genvar i;
generate
for(i = 0; i < 3; i++)
begin
`strcat_assign_macro(a,temp,b,temp,i)
end
endgenerate
initial begin
$display (a0temp);
end
endmodule
膨脹後的宏將看起來像這樣:'分配aitemp =雙溫;'它將代替lhs_poststr和rhs_poststr的替代'temp',I,a和b將被替換爲其他部分。所以,你需要一個不同的方案。 – Serge