1--  Semantic analysis pass.
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 Vhdl.Nodes; use Vhdl.Nodes;
17with Types; use Types;
18
19package Vhdl.Sem is
20   --  Semantic analysis for chapters 1, 2, 10 (uses clauses) and 11.
21
22   -- Do the semantic analysis of design unit DESIGN_UNIT.
23   -- Also add a few node or change some nodes, when for exemple an
24   -- identifier is changed into an access to the type.
25   procedure Semantic (Design_Unit: Iir_Design_Unit);
26
27   -- Get the current design unit, ie, the parameter of the procedure semantic.
28   function Get_Current_Design_Unit return Iir_Design_Unit;
29
30   --  Makes the current design unit depends on UNIT.
31   --  UNIT must be either an entity_aspect or a design_unit.
32   procedure Add_Dependence (Unit : Iir);
33
34   --  Add EL in the current design unit list of items to be checked later.
35   procedure Add_Analysis_Checks_List (El : Iir);
36
37   --  INTER_PARENT contains generics and ports interfaces;
38   --  ASSOC_PARENT constains generics and ports map aspects.
39   procedure Sem_Generic_Port_Association_Chain
40     (Inter_Parent : Iir; Assoc_Parent : Iir);
41
42   --  INTER_PARENT contains generics interfaces;
43   --  ASSOC_PARENT constains generic aspects.
44   procedure Sem_Generic_Association_Chain
45     (Inter_Parent : Iir; Assoc_Parent : Iir);
46
47   --  Return TRUE iff the actual of ASSOC can be the formal FORMAL.
48   --  ASSOC must be an association_element_by_expression.
49   function Can_Collapse_Signals (Assoc : Iir; Formal : Iir) return Boolean;
50
51   --  Return TRUE iff LEFT and RIGHT are (in depth) equal.
52   --  This corresponds to conformance rules, LRM 2.7
53   function Are_Trees_Equal (Left, Right : Iir) return Boolean;
54
55   --  Check requirements on number of interfaces for subprogram specification
56   --  SUBPRG for a symbol operator ID.  Requirements only concern operators,
57   --  and are defined in LRM 2.3.1.
58   --  If ID is not an operator name, this subprogram does no checks.
59   --  ID might be different from the identifier of SUBPRG when non object
60   --  aliases are checked.
61   procedure Check_Operator_Requirements (Id : Name_Id; Subprg : Iir);
62
63   --  Analyze an use clause.
64   --  This may adds use clauses to the chain.
65   procedure Sem_Use_Clause (Clauses : Iir_Use_Clause);
66
67   --  LRM 2.1  Subprogram Declarations.
68   procedure Sem_Subprogram_Specification (Subprg : Iir);
69   procedure Sem_Subprogram_Declaration (Subprg : Iir);
70
71   --  LRM 2.2  Subprogram Bodies.
72   procedure Sem_Subprogram_Body (Subprg : Iir);
73
74   --  LRM08 4.4  Subprogram instantiation declarations
75   procedure Sem_Subprogram_Instantiation_Declaration (Decl : Iir);
76
77   --  LRM 2.5  Package Declarations.
78   procedure Sem_Package_Declaration (Pkg : Iir_Package_Declaration);
79
80   --  LRM 2.6  Package Bodies.
81   procedure Sem_Package_Body (Decl : Iir);
82
83   --  LRM08 4.9  Package Instantiation Declarations
84   procedure Sem_Package_Instantiation_Declaration (Decl : Iir);
85
86   --  Do late analysis checks (pure rules).
87   procedure Sem_Analysis_Checks_List (Unit : Iir_Design_Unit;
88                                       Emit_Warnings : Boolean);
89
90   --  Analyze the uninstantiated package name of DECL, and return the
91   --  package declaration.  Return Null_Iir if the name doesn't denote an
92   --  uninstantiated package.
93   function Sem_Uninstantiated_Package_Name (Decl : Iir) return Iir;
94
95end Vhdl.Sem;
96