Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17049 Discussions

Generic parameter with variable size

Altera_Forum
Honored Contributor II
1,359 Views

Hi all 

 

My design requires a parameter defined at compilation time that can range from 1 to 128 bytes. It isn't possible to create a generic based on another generic like this: 

 

generic ( 

es_size : natural range 1 to 128 := 2;  

es_info : bidim_array_t(es_size-1 downto 0) := (x"00",x"00")); 

) 

 

Where bidim_array_t is defined inside a package: 

type bidim_array_t is array(natural range <>) of std_logic_vector(7 downto 0); 

 

With this code Quartus reports the following error: 

***generic "es_size" cannot be used in its own interface list*** 

 

Removing the es_size and fixating the size of es_info to 128 could be one solution but I would like to know if there is anything more elegant to do in this case. 

 

Thank you 

Best regards 

Thiago
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
397 Views

 

--- Quote Start ---  

Hi all 

 

My design requires a parameter defined at compilation time that can range from 1 to 128 bytes. It isn't possible to create a generic based on another generic like this: 

 

generic ( 

es_size : natural range 1 to 128 := 2;  

es_info : bidim_array_t(es_size-1 downto 0) := (x"00",x"00")); 

) 

 

Where bidim_array_t is defined inside a package: 

type bidim_array_t is array(natural range <>) of std_logic_vector(7 downto 0); 

 

With this code Quartus reports the following error: 

***generic "es_size" cannot be used in its own interface list*** 

 

Removing the es_size and fixating the size of es_info to 128 could be one solution but I would like to know if there is anything more elegant to do in this case. 

 

Thank you 

Best regards 

Thiago 

--- Quote End ---  

 

 

I think generic should be a constant so that compiler knows what to do. 

Your second declaration of bidim_array should be an input
0 Kudos
Reply