Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
1,051 Views

System Verilog 2009 Generate Loop

How can I get this piece of code to compile? 

This works fine in other synthesis tools, simulation etc. Just trying to map it to an FPGA. 

 

In Quartus 17.1 and 18.0 I get this error: 

 

Error(13411): Verilog HDL syntax error at blah.sv(329) near text generate Error(13224): Verilog HDL or VHDL error at blah.sv(329): SystemVerilog 2009 keyword generate used in incorrect context  

 

 

 

generate for (genvar i=0; i<N; i++) for (genvar j=0; j<10; j++) assign status = status_ff]; endgenerate  

 

Any help will be appreciated. Thanks!!
Tags (1)
0 Kudos
2 Replies
Altera_Forum
Honored Contributor I
266 Views

I don't think I've seen the genvar commands inside the loop before. Try putting genvar i and genvar j above the generate keyword. You might also want to try inserting begin/end around the inner for loop. And how and where is N defined? 

 

Also, why are you using generate for simple assignments? Can't you just use a normal for loop?
Altera_Forum
Honored Contributor I
266 Views

Usually when you get an unexplainable syntax error, there is a problem with the code just before it.  

 

SystemVerilog added the ability to put the genvar inside the for loop. Verilog-2005 made the generate/endgenerate keywords optional. The compiler should be able to tell from the context whether the for-loop is a generate-for or a procedural-for. I would try removing them and seeing if you get a different error message.
Reply