vhdl_reference_93:dynamic_elaboration

Dynamic elaboration

In order to be able to execute program parts which contain sequential statements it is necessary to elaborate these program parts as well. This is done while the model is executed. Here are some examples in which elaboration is carried out dynamically during simulation:

  • In order to execute a FOR -iteration loop it is necessary to elaborate the loop-parameters before the statements within the loop can be carried out. Elaboration generates the loop-parameters and calculates their value ranges.

Dynamic Elaboration of a FOR loop

  • In order to execute a subprogram call it is at first necessary to elaborate the parameter-interface list of the corresponding subprogram-declaration. In doing so every interface declaration is elaborated so that the formal parameters can be generated. These are then linked to the actual-parameters. Eventually, the declarative part of the corresponding subprogram body is elaborated and the subprogram body`s sequence of statements is carried out.

Dynamic Elaboration of a Subprogram

  • In order to calculate an index which contains a subtype identification it is necessary to elaborate the subtype determination before the generated instance is assigned.

As a consequence of the rules mentioned above, declarations within a subprogram body`s declarative part are elaborated every time the corresponding subprogram is called. If this is the case the elaboration of a declaration can lead to different results with different characteristics.

Thus, for example, the elaboration of one and the same subtype within a subprogram body can lead to subtypes with different characteristics being generated.

FUNCTION diff_subtypes (N : INTEGER)
RETURN INTEGER IS
 
    SUBTYPE my_int IS INTEGER RANGE 0 TO N;
    VARIABLE out_sig : my_int;
 
BEGIN
...

N here is a constant's formal parameter (default for formal parameters of mode IN). The actual-parameter which is linked to N may, however, also be a signal, for example, ⇒ subtype my_int can change with every function call depending on N!