tahirsengine
Member level 3
Hi,
Please see the code below:
As in above example, we saw that ha was generated N times. The issue that I can not understand is, all the generated instances will get an instance name as u0. But this code actually works. But doesn't the instance names should be unique? How come this is working, and that works actually!
Please see the code below:
Code:
module ha ( input a, b,
output sum, cout);
assign sum = a ^ b;
assign cout = a & b;
endmodule
Code:
module my_design
#(parameter N=4)
( input [N-1:0] a, b,
output [N-1:0] sum, cout);
generate
for (i = 0; i < N; i = i + 1) begin
ha u0 (a[i], b[i], sum[i], cout[i]);
end
endgenerate
endmodule
As in above example, we saw that ha was generated N times. The issue that I can not understand is, all the generated instances will get an instance name as u0. But this code actually works. But doesn't the instance names should be unique? How come this is working, and that works actually!