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

generate with step other than unit

Altera_Forum
Honored Contributor II
1,231 Views

Hi, 

 

I need to write a GENERATE statement, but the step must be different from unit. 

 

Something like: 

 

gen: for i in 0 to 20 generate temp(i) <= temp(i+4-2) or temp(i+4-1); end generate;  

 

this "i" must be incremented by 4 units instead of 1. 

 

Regards 

Jaraqui
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
553 Views

with something like this: 

 

gen: for i in 0 to 4 generate 

temp(i) <= temp(i * 4 +4-2) or temp(i * 4+4-1); 

end generate; 

 

but check the range of i.
0 Kudos
Altera_Forum
Honored Contributor II
553 Views

 

--- Quote Start ---  

with something like this: 

 

gen: for i in 0 to 4 generate 

temp(i) <= temp(i * 4 +4-2) or temp(i * 4+4-1); 

end generate; 

 

but check the range of i. 

--- Quote End ---  

 

 

thank you! I will test this solution, but I need only temp(0), temp(4), temp(8), ... be the positions to receive assignments. 

Writing in this way, I suspect that temp(0), temp(1), temp(2), ... would receive assignments 

 

Regards 

Jaraqui
0 Kudos
Altera_Forum
Honored Contributor II
553 Views

You're right. The new code would be: 

 

temp(i * 4) <= temp(...
0 Kudos
Altera_Forum
Honored Contributor II
553 Views

I found another thread about this. 

 

http://www.alteraforum.com/forum/showthread.php?t=25890 

Sorry for my poor previous query. 

 

What I was exactly looking for is a "programmable step" and not a step that has to stablish some logic between the index and my desired positions. 

Something like  

 

for i in begin to end loop (step n) generate... 

 

Reading about this I seems that this feature isn´t availabe for concurrent generate as well as for sequential loops... 

Is that correct? 

 

Regards 

Jaraqui
0 Kudos
Altera_Forum
Honored Contributor II
553 Views

To learn about allowed VHDL constructs I suggest to read a text book or the LRM.  

 

In the present case, these points should be considered: 

- the range of sequential for loops as well as generate loops must be constant. 

- you can achieve a variable range or a variable step size in sequential for loops by combining it with conditional statements 

- this is impossible with generate statements by their nature
0 Kudos
Reply