I have a wrapper, with multiple ports (mainly used to parameterize/scale a particular module) and in this wrapper i parameterize the module instantiation with help of generate for-loop. i.e.
generate
for (genvar a=0; a< NUM1; a++)
begin : module_label
module module_inst(
.x1(x1[a]),
.x2(x2[a]),
.x3(x3[a]),
.y(y[a])
);
end
endgenerate
Now i want to control my port connectivity inside this module instantiation based on some condition. Can i use a if loop within this instantiation? Something like :
generate
for (genvar a=0; a< NUM1; a++)
begin : module_label
module module_inst(
.x1(x1[a]),
if ( NUM2 = 5) begin
.x2(x2[a]),
.x3(x3[a]),
end
.y(y[a])
);
end
endgenerate