Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
15539 Discussions

System Verilog 2009 Generate Loop

Altera_Forum
Honored Contributor II
1,221 Views

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!!
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
436 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 II
436 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