|
LCS-2016-019 History |
|
8 |
|
2017-02-24 |
|
|
|
Ryan Hinton Martin Zabel Jim Lewis |
|
Main.RyanHinton Main.MartinZabel Main.JimLewis |
|
Inferring Constraints from Initial Values for Signals and Variables |
|
Allow for signal and variable subtype constraints to be inferred from initial value |
variable v : bit_vector := "1010"; signal s : bit_vector := "1010";The first one declares a variable (object) with an unconstrained subtype (see 14.4.2.5), and an index range of
0 to 3
(see 5.3.2.2). Same applies to the signal declaration.
The problem now is, that a lot of rules for signal and variable assignments target the subtype of the object, e.g. the implicit subtype conversion in 10.6.2.2. But, this subtype can be unconstrained now,
in the current LRM, the subtype of signals and variables are always constrained. constants do not matter because they cannot be assigned. Maybe the following must be prohibited explicitly:
v := "10101"; s <= "10101";Thus, I can't tell whether more changes in the LRM need to be updated. There may be to many places.
0 to 4
of the literal in the above example is just checked against the index subtype which is natural
. The check succeeds and the variable will now have the value "10101". But, if the variable is passed to a subprogram with a formal of type bit_vector
, then the index range is still determined by clause 5.3.2.2 resulting in the index range 0 to 3
. This is a conflict.
TODO Signals.
string
to hold string values of arbitrary length. This LCS might make it very difficult or impossible to adopt such a notion in the future due to compatibility issues.
-- Thomas Preusser - 2017-02-27