V
valtih1978
In "Designer's guide to VHDL", Chapter 18, I read:
- BEGIN QUOTE -
"We can use an external constant name (or an alias of such a name) in an
expression, provided the constant has been elaborated and given a value
by the time the expression is evaluated. In some cases, expressions are
evaluated during elaboration of a design."
"We can ensure this is the case by writing the part of the design that
includes the constant declaration prior to the part of the design that
contains the external constant name. VHDL’s elaboration rules specify
that the design is elaborated in depth-first top-to-bottom order."
"We now assemble the design and test bench in a top-level entity and
architecture:
architecture level of top is
begin
assert false report "Width = " & to_string(<<constant .top.duv.width
: natural>>);
duv : entity work.design(rtl);
"The external constant name in the concurrent assertion statement, on
the other hand, is not evaluated until the model is executed, by which
time the model is completely elaborated. Thus, the external constant
name is allowed to precede the instance of the design under test in
which the constant is declared.
- END QUOTE -
It says that to be sure that referenced constant is evaluated prior to
external name reference is evaluated, "declare the constant prior to the
part of the design that contains the external constant name". But, in
example we see the opposite: constant is declared in the instance below
the assertion elaboration!
Then, it reassures us that this is ok and develops this idea by denying it!
"VHDL has a related rule regarding elaboration of a signal referenced by
an external signal name. If such a name (or an alias of such a name) is
used in a port map, the signal declaration must have been previously
elaborated. The reason is that the hierarchy of signal nets and drivers
is built during elaboration. If a signal used in a port map is not yet
elaborated, the elaborator would have to revisit elaboration of that
part of the design hierarchy once the signal declaration was
encountered. In general, allowing such use of external signal names
would make elaboration of signal nets indefinitely complicated. The rule
preventing such use allows elaboration to proceed in a well-defined
order, and is not onerous in practice."
That is, they say that situation is the same and object, referenced in
external name, must be elaborated before external name.
alias DONE_SIG is <<signal DUT.DONE: BIT>>; -- Legal
begin
DUT: entity WORK.MY_DESIGN port map (s1, S2, S3);
We do not want to re-elaborate the alias, once the signal declaration
was encountered during instance elaboration. Right?
After all, I could not understand if your VHDL example is correct or not.
- BEGIN QUOTE -
"We can use an external constant name (or an alias of such a name) in an
expression, provided the constant has been elaborated and given a value
by the time the expression is evaluated. In some cases, expressions are
evaluated during elaboration of a design."
"We can ensure this is the case by writing the part of the design that
includes the constant declaration prior to the part of the design that
contains the external constant name. VHDL’s elaboration rules specify
that the design is elaborated in depth-first top-to-bottom order."
"We now assemble the design and test bench in a top-level entity and
architecture:
architecture level of top is
begin
assert false report "Width = " & to_string(<<constant .top.duv.width
: natural>>);
duv : entity work.design(rtl);
"The external constant name in the concurrent assertion statement, on
the other hand, is not evaluated until the model is executed, by which
time the model is completely elaborated. Thus, the external constant
name is allowed to precede the instance of the design under test in
which the constant is declared.
- END QUOTE -
It says that to be sure that referenced constant is evaluated prior to
external name reference is evaluated, "declare the constant prior to the
part of the design that contains the external constant name". But, in
example we see the opposite: constant is declared in the instance below
the assertion elaboration!
Then, it reassures us that this is ok and develops this idea by denying it!
"VHDL has a related rule regarding elaboration of a signal referenced by
an external signal name. If such a name (or an alias of such a name) is
used in a port map, the signal declaration must have been previously
elaborated. The reason is that the hierarchy of signal nets and drivers
is built during elaboration. If a signal used in a port map is not yet
elaborated, the elaborator would have to revisit elaboration of that
part of the design hierarchy once the signal declaration was
encountered. In general, allowing such use of external signal names
would make elaboration of signal nets indefinitely complicated. The rule
preventing such use allows elaboration to proceed in a well-defined
order, and is not onerous in practice."
That is, they say that situation is the same and object, referenced in
external name, must be elaborated before external name.
alias DONE_SIG is <<signal DUT.DONE: BIT>>; -- Legal
begin
DUT: entity WORK.MY_DESIGN port map (s1, S2, S3);
We do not want to re-elaborate the alias, once the signal declaration
was encountered during instance elaboration. Right?
After all, I could not understand if your VHDL example is correct or not.