|
LCS-2016-016 |
|
5 |
|
21-Mar-2017 |
|
Voting |
|
Jim Lewis |
|
Main.JimLewis |
|
Anonymous Types |
|
History |
|
Interface Type Declarations - LCS_2016_059 Generics on subprogram call - LCS_2016_049 All interface lists are ordered - LCS_2016_086 |
|
Leverages interface type definitions introduced in generic lists to create an anonymous type declaration for interface lists |
interface_constant_declaration ::= [ constant ] identifier_list : [ in ][Editing note: For anonymous type indication see LCS_2016_059subtype_indicationinterface_type_indication [ := static_expression ] interface_signal_declaration ::= [ signal ] identifier_list : [ mode ]subtype_indicationinterface_type_indication [ bus ] [ := static_expression ] interface_variable_declaration ::= [ variable ] identifier_list : [ mode ]subtype_indicationinterface_type_indication [ := static_expression ] interface_type_indication ::= subtype_indication | anonymous_type_indication
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 ) ;
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 ) ; ...