Hi everbody!
Allan Herriman a écrit :
Because the compiler does just what you wanted: it will create unique
labels like AB_5, AB_4, etc. It's just that the exact details are
compiler dependent, since they are not specified in the LRM. (IIRC -
someone please correct me if I'm wrong.)
Actually, the LRM (paragraph 12.4.2) specifies the elaboration of a
generate statement.
"[...]
For a generate statement with a for generation scheme, elaboration
consists of the elaboration of the discrete
range, followed by the generation of one block statement for each value
in the range. The block statements
all have the following form:
a) The label of the block statement is the same as the label of the
generate statement.
[..]
"
I don't reproduce the examples.
A note follows:
"NOTE-The repetition of the block labels in the case of a for
generation scheme does not produce multiple declarations
of the label on the generate statement. The multiple block statements
represented by the generate statement constitute
multiple references to the same implicitly declared label."
Finally, I don't see exactly why a variable labels should be needed. I
would think that the first goal is to discriminate multiple
instanciations of your component for, let's say, different
configurations. If so, I will quote a part (paragraph 4.2.3 GENERATE
Usage and Configuration) of the FAQ:
"
The generate statement (FAQ Part 4 - B.105) is a concurrent statement
(FAQ Part 4 - B.44) that contains other concurrent statements. Two
forms exist: for and if generate. An example which uses both is:
First: if i=0 generate
Q: adder port map (A(0), B(0), Cin, Sum(0), C(0));
end generate;
Second: for i in 1 to 3 generate
Q: adder port map (A(i), B(i), C(i-1), Sum(i), C(i));
end generate;
The components are addressed (e.g., for specification):
First.Q, Second(1).Q, Second(2).Q, and Second(3).Q
An external configuration specification might look like:
for First -- First.Q
for Q: adder use entity work.adder(architectureX);
end for;
end for;
for Second(1) -- Second(1).Q
for Q: adder use entity work.adder(architectureX);
end for;
end for;
for Second(2) -- Second(2).Q
for Q: adder use entity work.adder(architectureY);
end for;
end for;
for Second(3) -- Second(3).Q
for Q: adder use entity work.adder(architectureZ);
end for;
end for;
"
(see also LRM 1.3.1)
Regards,
Christophe