【发布时间】:2017-10-12 16:47:43
【问题描述】:
我正在尝试连接 systemverilog/verilog 中的两个字符串以创建信号名称。 在我下面的代码 sn-p 中,lhs 端似乎工作正常,但 rhs 端却不行。 该工具给出错误“尚未声明bittemp”。
如果我将硬编码值“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
【问题讨论】:
-
扩展后您的宏将如下所示:
assign aitemp = bitemp;将替换temp代替 lhs_poststr 和 rhs_poststr,i、a 和 b 将替换其他部分。所以,你需要一个不同的方案。
标签: macros verilog system-verilog