How different is the synthesized results of for loop and for

  • Thread starter Deepak kumar Singhaniya
  • Start date
D

Deepak kumar Singhaniya

Guest
Hi,

Why is it that only concurrent statements are allowed to use within for generate? I want to understand the difference between for loop and for generate so that I can be aware of what I will synthesizing.
 
A generate is statically bound. A for loop is dynamically bound. They are different structures for different purposes than the sequential if/loop statements, though similar logic can be described using either one.

You can use a variable in a for-loop for iterative behavior (updating the same variable over multiple iterations of the loop, such as when calculating parity of an SLV).

In synthesis, both are "unrolled" and therefore the loop/generate index is treated as static (i.e. a constant) for each iteration.

Note also that a generate statement can contain a declarative region where signals, types, constants, etc. unique to each iteration can be declared.

I tend to use for-generate in structural code (e.g. instantiating N copies of an entity), and for-loop in behavioral code (TB or RTL).

Andy
 

Welcome to EDABoard.com

Sponsor

Back
Top