The For Generate Statement lists a series of behavioral statements to be repeated.
The following example shows an iterative For Generate Statement:
CONSTANT NUM_OF_ADDERS = 8; SUBDESIGN 4gentst ( a[NUM_OF_ADDERS..1], b[NUM_OF_ADDERS..1], cin : INPUT; c[NUM_OF_ADDERS..1], cout :OUTPUT; ) VARIABLE carry_out[(NUM_OF_ADDERS+1)..1] : NODE; BEGIN carry_out = cin; FOR i IN 1 TO NUM_OF_ADDERS GENERATE c[i] = a[i] $ b[i] $ carry_out[i]; % Full Adder % carry_out[i+1] = a[i] & b[i] # carry_out[i] & (a[i] $ b[i]); END GENERATE; cout = carry_out[NUM_OF_ADDERS+1]; END;
The For Generate Statement has the following characteristics:
GENERATE enclose the following
A temporary variable name, which consists of a symbolic
name that is used only within the context of the For Generate Statement,
that is, the variable ceases to exist after the Compiler processes the statement.
In the example shown above, the variable is
i. This variable
name cannot be a constant, parameter, or node name that is used elsewhere
in the project.
IN, which is followed by a range delimited by two
The arithmetic expressions are separated by the
In the example shown above, the arithmetic expressions are
NUM_OF_ADDERS. The range endpoints can consist of expressions
containing only constants and parameters;
variables are not required.
GENERATE keyword is followed by one or more logic statements,
each of which ends with a semicolon (
END GENERATE and a semicolon (
end the For Generate Statement.
Back to Top
- Altera -
|Created by chm2web html help conversion utility.|