I've a simple assertion: Lets say
assert @(posedge clk) (a |=> b);
I generally connect it with design signals using separate binding module
module bind_module;
bind dut assertion a1 (.*);
endmodule
I've a situation: dut has a bus of 45bits, each bit is generated / driven individually but all of them follow same assertion.
Can I use bind statement inside generate block? (for a range of 0 to 44) and then instead of .* use .a (in_bus[i]), .b (out_bus[i])
Assuming you intend the following:
This will not work for 2 reasons:
The instance name
a1is being clobbered on each loop. Each instance name within a module needs to be unique. Quoting from IEEE std 1800-2012 § 23.11 'Binding auxiliary code to scopes or instances':iin the bind statement is referring to anivariable name within the scope ofdut, not thegenvar i. Again, quoting from IEEE std 1800-2012 § 23.11 'Binding auxiliary code to scopes or instances':How to bind this kind of checker:
You could create one module that handles the generate statements, then instantiate that module with a bind statement. Example:
Technically, you could bind an array of instances. It is legal syntax according to § 23.11's Syntax 23-9 plus Appendix A.4.1.1 'Module instantiation'. However it this seems to fail on all the simulators I currently have access to. Example (if it works on your simulator):
Can
bindexist within agenerateblock?IEEE std 1800-2012 § 27.3 'Generate construct syntax' does mention
bind_directivewithin the syntax for generate constructs is given in Syntax 27-1. Like binding an array of instances, not all simulators support this feature yet. IEEE std 1800-2009 § 27.3 also mentionsbind_directivebut IEEE std 1800-2005 (first IEEE version of SystemVerilog) does not. Example (if it works on your simulator):