sar...@gmail.com wrote:
> Hi all,
>
> I am trying to write a code where parameter 'approx' can be changed from outside of the module RCA1.
> Default value of approx is zero. If it is greater than zero then RCA1 module will go through 2 different types of for loops and create module instance name accordingly.
>
> If I run this code It says rr block name is already defined. If I change the block name for 2 different for loop then no syntax error generates but if I try to see the schematic view then nothing appears.
>
>
> Please help me with this situation.
> Thanks
>
> ............................
>
> module tb1;
>
> parameter n=3;
> reg [n:0] a,b;
> reg c,approx;
> wire [n+1:0] s;
>
>
>
> RCA1 #(.approx(1)) rca1(a,b,c,s);
>
> endmodule
> .................................................
You can't reuse a block name in the same context. So if you
don't want this to be a single loop, you need to use a different
name for the second one.
As for why you don't see anything when you try to see the
schematic view, I have no idea, especially since you didn't
even say what tools you're using.
On the other hand, as written there is no difference between the
two generate loops other than the genvar used. So in effect you
have the equivalent of (assuming 0 <= approx < 4):
for (i=0;i<4;i=i+1) begin: rr
. . .
--
Gabor