Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Regarding for loop in verilog

Status
Not open for further replies.

dhivya34

Junior Member level 1
Junior Member level 1
Joined
Aug 7, 2012
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,399
Hi,

When I use the normal for loop in verilog with the loop variable declared as a wire I get the following error
'i' is an invalid type in Generate loop. Must be a genvar

Hence I changed the loop variable i as genvar. I got the following error.
The for-generate loop scope genblk1[2] already exists

Help me fix this!
 

declare i as integer

ex: integer i;

for(i=0; i<x; i = i+1)
begin
end
 

u need to put the for loop inside always or initial block.
 
  • Like
Reactions: ruwan2

    ruwan2

    Points: 2
    Helpful Answer Positive Rating
Thanks.
But then also I got error.
The function of for loop in my code was to assign values to different bits of the same variable according to some rule.
Hence I had to enclose 'for' within a generate block and name the block to get rid of the error.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top