System verilog 我可以在生成块中使用bind吗
我有一个简单的断言: 比方说System verilog 我可以在生成块中使用bind吗,system-verilog,assertions,system-verilog-assertions,System Verilog,Assertions,System Verilog Assertions,我有一个简单的断言: 比方说 assert @(posedge clk) (a |=> b); 我通常使用单独的绑定模块将其与设计信号连接 module bind_module; bind dut assertion a1 (.*); endmodule 我有一种情况:dut有一个45位的总线,每个位都是单独生成/驱动的,但它们都遵循相同的断言 我可以在生成块中使用bind语句吗?(范围为0到44),然后使用.a(in_-bus[i]),.b(out_-bus[i])代替。*假设
assert @(posedge clk) (a |=> b);
我通常使用单独的绑定模块将其与设计信号连接
module bind_module;
bind dut assertion a1 (.*);
endmodule
我有一种情况:dut有一个45位的总线,每个位都是单独生成/驱动的,但它们都遵循相同的断言
我可以在生成块中使用bind语句吗?(范围为0到44),然后使用
.a(in_-bus[i]),.b(out_-bus[i])
代替。*假设您打算:
genvar i;
generate
for(i=0; i<45; i=i+1) begin : gen_asrt
bind dut assertion a1( .a(in_bus[i]), .b(out_bus[i]), .* );
end
从技术上讲,您可以绑定实例数组。根据第23.11节的语法23-9和附录A.4.1.1“模块实例化”,这是合法的语法。然而,这似乎是失败的所有模拟器,我目前有权访问。示例(如果它在模拟器上工作):
bind
能否存在于generate
块中?
§27.3“生成构造语法”并未提及语法27-1中给出的生成构造语法中的bind_指令
。与绑定一系列实例一样,并非所有模拟器都支持此功能。IEEE标准1800-2009§27.3也提到了bind_指令
,但IEEE标准1800-2005(SystemVerilog的第一个IEEE版本)没有提到。示例(如果它在模拟器上工作):
谢谢@Greg,我会考虑你的解决方案,并为我的模拟器尝试几个小例子,我会报告我的发现
module bind_assertions #(parameter SIZE=1) ( input clock, input [SIZE-1:0] a,b );
genvar i;
generate
for(i=0; i<SIZE; i=i+1) begin : gen_asrt
assertion a1_even( .a(a[i]), .b(b[i]), .* );
end
endgenerate
endmodule
bind dut bind_assertions#(45) a1( .a(in_bus), .b(out_bus), .* );
bind dut assertion a1[44:0]( .a(in_bus[44:0]), .b(out_bus[44:0]), .* );
parameter DO_BIND=1;
generate
if(DO_BIND==1) begin
bind dut bind_assertions#(45) a1( .a(in_bus), .b(out_bus), .* );
end
endgenerate