Hi everybody!
Can anybody help me to understand how to use variable outside of generate-endgenerate loop.
I found some explanation. For example:
Code Verilog - [expand] |
1
2
3
4
5
6
7
8
9
10
11
| generate
for(i=0; i<SIZE; i=i+1)
begin:addbit
wire n1,n2,n3; //internal nets
xor g1 (n1 ,a[i] ,b[i]);
xor g2 (sum[i] ,n1 ,c[i]);
and g3 (n2 ,a[i] ,b[i]);
and g4 (n3 ,n1 ,c[i]);
or g5 (c[i+1] ,n2 ,n3);
end
endgenerate |
In the preceding example, each generated net will have a unique name, and each generated
primitive instance will have a unique instance name. The name comprises the name of the block
within the for-loop, plus the value of the genvar variable used as the loop index. The names of
the generated n1 nets are:
addbit[0].n1
addbit[1].n1
addbit[2].n1
addbit[3].n1
I can't use for example prereg <= addbit[0].n1.
How can i use instance outside generate loop?
The relative generation i saw in bram generation in AXI4-Full.
But the register have the same name but multiplied.