Language Change Specification for Anonymous Types

LCS Number: LCS-2016-016
Version: 5
Date: 21-Mar-2017
Status: Voting
Author: Jim Lewis
Email: Main.JimLewis
Source Doc: Anonymous Types
More Doc: History
Related LCS': Interface Type Declarations - LCS_2016_059
Generics on subprogram call - LCS_2016_049
All interface lists are ordered - LCS_2016_086
Summary: Leverages interface type definitions introduced in generic lists to create an anonymous type declaration for interface lists

Style Notes

Changes are shown in red font. Deletions are crossed out. Editing notes in green font.

Details of Language Change

Section 6.5.2 Interface object declarations

[016.1: Edit productions in 6.5.2 and Annex C as follows]

  interface_constant_declaration ::=
    [ constant ] identifier_list : [ in ] subtype_indication interface_type_indication [ := static_expression ]

  interface_signal_declaration ::=
    [ signal ] identifier_list : [ mode ] subtype_indication interface_type_indication [ bus ] [ := static_expression ]

    interface_variable_declaration ::=
    [ variable ] identifier_list : [ mode ] subtype_indication interface_type_indication [ := static_expression ]

  interface_type_indication ::=
    subtype_indication 
    | anonymous_type_indication 

[Editing note: For anonymous type indication see LCS_2016_059

[016.2: Add paragraph in 6.5.2 on page 74 before first paragraph]

For any VHDL construct that has formal port or parameter whose type is specified as an anonymous type declaration, there is an equivalent construct with a generic list and modified port or parameter list. For each interface object declaration that contains an anonymous type declaration, there is a corresponding anonymous formal generic type added to the end of the generic list. If a generic list does not exist, one is created. The modified port or parameter list contains the same declarations as the original port or parameter list, except that each anonymous type declaration is replaced by a reference to the corresponding anonymous formal generic type. The anonymous formal generic type does not have a simple name.

[016.3 Add paragraph in 6.5.2 after paragraph]

[Note: this could be put in the section on formal generic types. However, it is not there and there are corresponding notes in signal and constant. Hence, it should have always been here too.]
For an interface constant, signal, or variable declaration whose subtype indication is a formal generic type, a check is required that the actual generic type complies with the rules for subtype indication for the corresponding interface object. Depending on the implementation, this check may be done during analysis of the instantiation or call, or it may be deferred until the design hierarchy is elaborated.

016.4 [Edit paragraph 3 on page 74 of section 6.5.2]

If an interface signal declaration includes the reserved word bus, then the signal declared by that interface declaration is a guarded signal of signal kind bus. It is an error if an interface signal declaration includes both an anonymous type declaration and the reserved word bus.

[016.5 Add list item to paragraph 4 on page 74 of section 6.5.2]

[Edit note: paragraph shown to help locate list item] If an interface declaration contains a := symbol followed by an expression, the expression is said to be the default expression of the interface object. The type of a default expression shall be that of the corresponding interface object. It is an error if a default expression appears in an interface declaration and any of the following conditions hold: - ... [This LCS does not change the other list elements]
- The type of the interface object is specified with an interface type definition

[016.6 Add to end of section 6.5.2 after the last note at the bottom of page 75]


Example:
-- An entity whose type of the formal signal port A is defined by an anonymous type declaration.
entity E is
  port (
    A : type is private ;   -- any type
    B : type is <>          -- a scalar type
  ) ; 

-- The equivalent entity with a formal generic type (here designated
-- as anonymous for clarity) and the signal port A whose type is designated  
-- by the unnamed formal generic type.
entity E is
  generic (
    type Anonymous1 is private ;  -- any type
    type Anonymous2 is <>         -- a scalar type
  )
  port (
    A : Anonymous1 ;
    B : Anonymous2 
  ) ; 

Section 6.5.7.1 General (of Association lists)

[016.7 Add paragraph: In section 6.5.7.1 on page 81 after ...]

For any VHDL construct with a port or parameter association list whose corresponding interface object declaration has a type defined by an anonymous type declaration, there is a corresponding construct with a generic association list and a port or parameter list. For each formal port or parameter whose type is specified as an anonymous type declaration, an association element is added to the end of the generic association list to associate the anonymous formal generic type with the subtype of the actual port or parameter. It is an error if the subtype of the actual port or parameter is not determinable from the context. If a generic association list does not already exist, one is created. The original port or parameter list is unchanged.

[016.8 Add to end of section 6.5.7.1 after the last note at the top of page 85]

Example
Architecture A of E is 
  signal SigA : std_logic_vector(7 downto 0) ; 
  signal SigB : std_logic ; 
  component E is
    port (
      A : type is private ; -- any type
      B : type is <>        -- a scalar type
    ) ; 
  end component E ; 
begin 
  -- A component instance whose type of the formal signal port A is defined by an anonymous type declaration.
  E1 :  E 
    port map (
      A => SigA  ; 
      B => SigB
    ) ; 
    ... 
  
-- The equivalent component declaration and instance.
Architecture A of E is 
  signal SigA : std_logic_vector(7 downto 0) ; 
  signal SigB : std_logic ; 
  -- The equivalent component declaration is formed by the rules of section 6.5.2
  component E is
    generic (
      type Anonymous1 is private ;  -- any type
      type Anonymous2 is <>         -- a scalar type
    )
    port (
      A : Anonymous1 ;
      B : Anonymous2 
    ) ; 
  end component E ; 
begin 
  -- The equivalent component instance has a generic map to associate the 
  -- subtype of actual port SigA with the formal generic type Anonymous.
  -- The component instance has the same port map as the original instance.
  E1 :  E 
    generic map (
      Anonymous1 => SigA'SUBTYPE ;
      Anonymous2 => SigB'SUBTYPE
    )
    port map (
      A => SigA  ; 
      B => SigB
    ) ; 
    ... 

Topic revision: r25 - 2017-07-16 - 04:04:20 - JimLewis
 
Copyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback