ISAC: IR 2095 analyzed

From: Chuck Swart <cswart_at_.....>
Date: Thu May 18 2006 - 15:54:18 PDT
Lance has supplied an analysis for this IR.

VHDL Issue Number:        2095 
 
Language_Version          VHDL-2002
Classification            Language Definition Problem
Summary                   What is the entity class of an enumeration literal?
Relevant_LRM_Sections     5.1 Attribute specifications
Related_Issues            
Key_Words_and_Phrases     attribute specification, entity class, enumeration literal
Authors_Name              Peter Ashenden
Authors_Phone_Number      +61 414 709 106
Authors_Fax_Number        
Authors_Email_Address     peter@ashenden.com.au
Authors_Affiliation       Ashenden Designs
Authors_Address1          
Authors_Address2          
Authors_Address3          

Current Status:           Analyzed

Superseded By:

------------------------
Date Submitted:           13 May 2006
Date Analyzed:            18 May 2006
Author of Analysis:       Lance Thompson
Revision Number:          1
Date Last Revised:        18 May 2006

Description of Problem
----------------------

An attribute specification uses the entity class of a named entity to
identify the named entity to be decorated with an attribute. For an
enumeration literal, it is not clear whether the entity class is
literal or function.
    
    An enumeration literal is syntactically a literal, as specified by
    7.3.1. However, 3.1.1 specifies that declaration of an enumeration
    literal is equivalent to declaration of a parameterless function
    returning the type of the enumeration literal. Moreover, 5.1
    discusses subprograms and enumeration literals together in the
    context of appearance of a signature in an attribute
    specification.
    
    The question of the entity class of an enumeration literal is
    significant in the following ways:
    
    - If the wrong class is specified when an enumeration literal is
      named in an entity name list, it is an error.
    
    - If an attribute specification supplies the reserved word "all"
      or "others" in an entity name list and specifies the entity
      class "literal", are enumeration literals included? Similarly,
      if the entity class is "function", are enumeration literals
      included?

Proposed Resolution
-------------------

The description of attribute specifications does not require any
particular entity classes to be specified in combination with a
signature, only that, if a signature appears, the entity tags denote
subprograms or enumeration literals. In the case of enumeration
literals, it would thus not be contradictory for the entity class to
be either "function" or "literal". Since an enumeration literal is
defined to be a literal in 7.3.1, that would seem to be the preferred
choice for its entity class. 5.1 should be amended to specify this
explicitly.

VASG-ISAC Analysis & Rationale
------------------------------

The submitters question regarding the entity class of enumeration
literals is well founded.  Some of the relevant text from 1076-2002
follows:

7.3.1

    A literal is either a numeric literal, an enumeration literal, a
    string literal, a bit string literal, or the literal null.

3.1.1

    Each enumeration literal is the declaration of the corresponding
    enumeration literal; for the purpose of determining the parameter
    and result type profile of an enumeration literal, this
    declaration is equivalent to the declaration of a parameterless
    function whose designator is the same as the enumeration literal
    and whose result type is the same as the enumeration type.

The submitter has observed the apparently conflicting definitions of
the classification of enumeration literal and the effect that it has
on attribute specification.  7.3.1 clearly state that an enumeration
literal is a literal.  3.1.1 confuses the issue with the phrase that
it "is equivalent to the declaration of a parameterless function..."
So, which is it?  Literal or function?

Perhaps the rest of 3.1.1 lends a clue.  The preface to the equivalent
function statement is "for the purpose of determining the parameter
and result type profile..."  The implication is that for other
purposes the declaration can be something else.

There are perhaps further clues in 5.1.  

The entity tag of an entity designator containing a signature must
denote the name of one or more subprograms or enumeration literals.
In this case, the signature must match (see 2.3.2) the parameter and
result type profile of exactly one subprogram or enumeration literal
in the current declarative part; the enclosing attribute specification
then denotes that subprogram or enumeration literal.

An attribute specification whose entity designator contains no
signature and identifies an overloaded subprogram or enumeration
literal has the effect of associating that attribute with each of the
designated overloaded subprograms or enumeration literals declared
within that declarative part.

By mentioning subprograms and enumeration literals separately, the LRM
may be trying to imply that enumeration literals are not subprograms.

There could be a backward compatibility concern here.  If we choose 1
class, implementations that associated enumeration literals with the
other class would be in error.


VASG-ISAC Recommendation for IEEE Std 1076-2002
-----------------------------------------------

Accept 7.3.1 at face value so that enumeration literals are of the
entity class literal.

VASG-ISAC Recommendation for Future Revisions
---------------------------------------------

Augment the notation in 3.1.1 to state that while there is an
equivalent function declaration view, the declaration is of a literal,
not a function.

-------------END OF IR----------------
Received on Thu May 18 15:54:20 2006

This archive was generated by hypermail 2.1.8 : Thu May 18 2006 - 15:54:21 PDT