1--  Semantic analysis.
2--  Copyright (C) 2002, 2003, 2004, 2005 Tristan Gingold
3--
4--  This program is free software: you can redistribute it and/or modify
5--  it under the terms of the GNU General Public License as published by
6--  the Free Software Foundation, either version 2 of the License, or
7--  (at your option) any later version.
8--
9--  This program is distributed in the hope that it will be useful,
10--  but WITHOUT ANY WARRANTY; without even the implied warranty of
11--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12--  GNU General Public License for more details.
13--
14--  You should have received a copy of the GNU General Public License
15--  along with this program.  If not, see <gnu.org/licenses>.
16with Types; use Types;
17with Vhdl.Nodes; use Vhdl.Nodes;
18with Vhdl.Tokens;
19
20package Vhdl.Sem_Specs is
21   --  Return the attribute_value for named entity ENT and attribute identifier
22   --  ID.  Return Null_Iir if ENT was not decorated with attribute ID.
23   function Find_Attribute_Value (Ent : Iir; Id : Name_Id) return Iir;
24
25   --  Return the node containing the attribute_value_chain field for DECL.
26   --  This is the parent of the attribute specification, so in general this
27   --  is also the parent of the declaration, but there are exceptions...
28   function Get_Attribute_Value_Chain_Parent (Decl : Iir) return Iir;
29
30   function Get_Entity_Class_Kind (Decl : Iir) return Vhdl.Tokens.Token_Type;
31
32   procedure Sem_Attribute_Specification (Spec : Iir_Attribute_Specification);
33
34   --  Check declarations following an ALL/OTHERS attribute specification.
35   --  ATTR_SPEC_CHAIN is the linked list of all attribute specifications whith
36   --  the entity name list ALL or OTHERS until the current declaration DECL.
37   --  So no specification in the chain must match the declaration.
38   procedure Check_Post_Attribute_Specification
39     (Attr_Spec_Chain : Iir; Decl : Iir);
40
41   procedure Sem_Disconnection_Specification
42     (Dis : Iir_Disconnection_Specification);
43
44   procedure Sem_Step_Limit_Specification (Limit : Iir);
45
46   procedure Sem_Configuration_Specification
47     (Parent_Stmts : Iir; Conf : Iir_Configuration_Specification);
48
49   --  Analyze binding indication BIND of configuration specification or
50   --  component configuration PARENT.
51   --  PRIMARY_BINDING is not Null_Iir for an incremental binding.
52   procedure Sem_Binding_Indication (Bind : Iir_Binding_Indication;
53                                     Parent : Iir;
54                                     Primary_Binding : Iir);
55
56   --  Analyze entity aspect ASPECT and return the entity declaration.
57   --  Return NULL_IIR if not found.
58   function Sem_Entity_Aspect (Aspect : Iir) return Iir;
59
60   --  Analyze component_configuration or configuration_specification SPEC.
61   --  STMTS is the concurrent statement list related to SPEC.
62   procedure Sem_Component_Specification
63     (Parent_Stmts : Iir; Spec : Iir; Primary_Binding : out Iir);
64
65   --  Check that all interfaces of INTER_CHAIN are associated either by
66   --  ASSOC1 or ASSOC2 (if not null_iir) when they need to be associated.
67   procedure Sem_Check_Missing_Generic_Association
68     (Inter_Chain : Iir;  Assoc1 : Iir; Assoc2 : Iir; Loc : Iir);
69
70   --  Create a default binding indication for component COMP which will be
71   --  bound with entity ENTITY_UNIT.
72   --  If ENTITY_UNIT is NULL_IIR, the component is not bound.
73   --  If FORCE is True, a binding indication will be created even if the
74   --   component is not bound (this is an open binding indication).
75   --  If CREATE_MAP_ASPECT is true, port and generic map aspect are created.
76   --  PARENT is used to report error.
77   function Sem_Create_Default_Binding_Indication
78     (Comp : Iir_Component_Declaration;
79      Entity_Unit : Iir_Design_Unit;
80      Parent : Iir;
81      Force : Boolean;
82      Create_Map_Aspect : Boolean)
83     return Iir_Binding_Indication;
84
85   --  Create a default generic or port map aspect that associates all elements
86   --  of ENTITY (if any) to elements of COMP with the same name or to
87   --  an open association.
88   --  If KIND is GENERIC_MAP, apply this on generics, if KIND is PORT_MAP,
89   --  apply this on ports.
90   --  PARENT is used to report errors.
91   type Map_Kind_Type is (Map_Generic, Map_Port);
92   function Create_Default_Map_Aspect
93     (Comp : Iir; Entity : Iir; Kind : Map_Kind_Type; Parent : Iir)
94     return Iir;
95
96   --  Explain why there is no default binding for COMP.
97   procedure Explain_No_Visible_Entity (Comp: Iir_Component_Declaration);
98
99   function Get_Visible_Entity_Declaration (Comp: Iir_Component_Declaration)
100                                           return Iir_Design_Unit;
101
102   procedure Sem_Specification_Chain (Decls_Parent : Iir; Parent_Stmts: Iir);
103end Vhdl.Sem_Specs;
104