User-Defined Attributes May Not Redefine Predefined Attributes
Proposal Details
- Who Updates: CliffordWalinsky
- Date Proposed:2013-12-9
- Date Last Updated:2013-12-9
- Bugzilla Reference: 259
Current Situation
In section 7.2 "Attribute specification", the statement is made that "An attribute specification associates a user-defined attribute with one or more named entities and defines the value of that attribute for those entities." From this statement, we can infer that attribute specifications cannot be provided for predefined attributes. The possibility for redefining a predefined attribute also seems to be precluded by the following statement:
"Similarly, it is an error if two different attributes with the same simple name (whether predefined or user-defined) are both associated with a given named entity."
Nonetheless, section 6.7 "Attribute declarations" never explicitly prevents a user-defined attribute from possessing the same name as a predefined attribute. If a user-defined attribute were to have the same name as a predefined attribute, the requirement of section 7.2 would prevent creation of attribute specifications associated with the same entity classes as the predefined attribute. The utility of being able to define attributes to have the same names as predefined attributes is severely limited.
--
ErnstChristen - 2015-01-27 - 1076.1 defines an exception: S'LAST_EVENT has 2 definitions that are disambiguated by the VHDL overloading rules.
Requirement
Since it is only legal to provide an attribute specifications for a user-defined attribute that has the same name as a predefined attribute when the associated attribute entities differ, according to the requirement of section 7.2, and since this requirement greatly reduces the utility of redefining predefined attributes, we suggest adding the following requirement to section 6.7 (third paragraph):
"The designator of an attribute shall not have the same simple name as any predefined attribute."
Implementation details
Compilers will make it an error to attempt to define an attribute with the same name as a predefined attribute.
Code Examples
The following example will no longer be accepted without error:
port( p : bit_vector(9 downto 0) );
attribute high : integer;
attribute high of p : signal is 5;
Currently, the Mentor Graphics compiler accepts these declarations, but produces a warning. This requirement would change the warning to an error at the point of the attribute declaration.
Use Cases
Arguments FOR
Accepting this proposal would prevent user-defined attributes from re-defining the predeclared attributes. Use of a predefined attribute would have the same meaning across all designs.
Arguments AGAINST
Predefined attributes are not fully described when associated with non-standard entity classes. For example, it's currently possible to create a user definition for 'high of a subprogram. This proposal would render existing designs non-compliant with the standard; hence, existing designs will not compile if they declare attributes identical to predefined attributes.
--
ErnstChristen - 2015-01-27 - The restrictions described under Current Situation are a consequence of the VHDL overloading rules. I believe that no artificial constraints should be imposed by the language definition, so I see this proposal to be an issue for coding guidelines, not for the language.
General Comments
Supporters
Add your signature here to indicate your support for the proposal