Using a SystemVerilog Generate in Quartus

Status
Not open for further replies.

BartlebyScrivener

Member level 5
Joined
Feb 8, 2012
Messages
90
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
2,081
I am using Quartus to try and synthesize a design and I keep getting the following errors when trying to use a generate block

Code:
Error (10170): Verilog HDL syntax error at LIB_PPE.sv(25) near text "genvar";  expecting an identifier ("genvar" is a reserved keyword )
Error (10644): Verilog HDL error at LIB_PPE.sv(30): this block requires a name

for code such as

Code:
  generate
    for (genvar i=0; i<N-1; i++) begin
      or  gate1  (l_intermediate[i], l_carry[i], i_priority[i]);
      and gate2  (o_grant[i], l_intermediate[i], i_request[i]);
      and gate3  (l_carry[i+1], l_intermediate[i], ~i_request[i]);
    end
  endgenerate

I found a setting to ensure that it knows my code is systemverilog, am I missing something else? The code works fine in modelsim.
 

It is probably not supporting the SV syntax that lets you declare a variable as part of the for loop initialization, so pull the genvar i out of the for loop.
 
Thanks Dave, I think it fixed changing the code to ...

Code:
genvar i;
generate 
    for (i=0; i<N-1; i++) begin : PPE_SLICES
      or  gate1  (l_intermediate[i], l_carry[i], i_priority[i]);
      and gate2  (o_grant[i], l_intermediate[i], i_request[i]);
      and gate3  (l_carry[i+1], l_intermediate[i], ~i_request[i]);
    end
  endgenerate
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…