I'm writing a module assertion bind:
module top_assertion #(parameter WIDTH=8) (input rtl_signal);
axi_``WIDTH``_bus axi_bus;
assert property (@(posedge Clock) !$isunknown(axi_bus.valid);
endmodule
bind rtl_module top_assertion#(8) assertion(.*);
Idea being using different axi_buses (Ex: axi_8_bus, axi_32_bus, axi_64_bus interfaces) depending on what WIDTH parameter is passed. I could write with axi_8_bus, axi_32_bus, axi_64_bus instances explicitly hardcoded but I want it to be dynamic instead.
It seems axi_``WIDTH``_bus isn't valid though.
Could anyone help please?
The
``syntax is used withdefinecompiler macros, not parameters.You could use a
generateconstruct with acasestatement to conditionally declare the interface you need based on theparametervalue:Refer to IEEE Std 1800-2017, section 27.5 Conditional generate constructs. The
generatekeyword is optional.