diff options
Diffstat (limited to 'src/vhdl/vhdl-sem.adb')
-rw-r--r-- | src/vhdl/vhdl-sem.adb | 96 |
1 files changed, 64 insertions, 32 deletions
diff --git a/src/vhdl/vhdl-sem.adb b/src/vhdl/vhdl-sem.adb index ce0428476..20b5f13ad 100644 --- a/src/vhdl/vhdl-sem.adb +++ b/src/vhdl/vhdl-sem.adb @@ -128,6 +128,9 @@ package body Vhdl.Sem is Entity := Get_Library_Unit (Entity); Set_Named_Entity (Name, Entity); Xrefs.Xref_Ref (Name, Entity); + elsif Get_Kind (Name) not in Iir_Kinds_Denoting_Name then + Error_Msg_Sem (+Name, "entity name expected"); + return Null_Iir; else -- Certainly an expanded name. Use the standard name analysis. Name := Sem_Denoting_Name (Name); @@ -566,6 +569,9 @@ package body Vhdl.Sem is -- The actual, if an expression, must be a globally -- static expression. if Get_Expr_Staticness (Actual) < Globally then + -- This is an inertial association. + Set_Inertial_Flag (Assoc, True); + if Flags.Vhdl_Std < Vhdl_08 then -- LRM08 6.5.6.3 Port clauses Error_Msg_Sem @@ -1388,20 +1394,14 @@ package body Vhdl.Sem is -- A simple name can be replaced by an expanded name in which this -- simple name is the selector, if and only if at both places the -- meaning of the simple name is given by the same declaration. - case Get_Kind (Left) is - when Iir_Kind_Simple_Name - | Iir_Kind_Selected_Name => - case Get_Kind (Right) is - when Iir_Kind_Simple_Name - | Iir_Kind_Selected_Name => - return Are_Trees_Equal (Get_Named_Entity (Left), - Get_Named_Entity (Right)); - when others => - return False; - end case; - when others => - null; - end case; + if Get_Kind (Left) in Iir_Kinds_Denoting_Name then + if Get_Kind (Right) in Iir_Kinds_Denoting_Name then + return Get_Identifier (Left) = Get_Identifier (Right) + and then Get_Named_Entity (Left) = Get_Named_Entity (Right); + else + return False; + end if; + end if; -- If nodes are not of the same kind, then they are not equals! if Get_Kind (Left) /= Get_Kind (Right) then @@ -1654,6 +1654,10 @@ package body Vhdl.Sem is (Get_Association_Choices_Chain (Left), Get_Association_Choices_Chain (Right)); + when Iir_Kind_Simple_Aggregate => + return Are_Trees_Equal (Get_Literal_Origin (Left), + Get_Literal_Origin (Right)); + when Iir_Kind_Choice_By_None | Iir_Kind_Choice_By_Others => return Are_Trees_Equal (Get_Associated_Expr (Left), @@ -1995,13 +1999,32 @@ package body Vhdl.Sem is end loop; end; - -- Mark the procedure as suspendable, unless in a std packages. + -- Mark the procedure as suspendable, unless in a std or + -- most ieee packages. -- This is a minor optimization. - if Get_Library (Get_Design_File (Get_Current_Design_Unit)) - /= Libraries.Std_Library - then - Set_Suspend_Flag (Subprg, True); - end if; + declare + Lib : constant Iir := + Get_Library (Get_Design_File (Get_Current_Design_Unit)); + begin + if Lib = Libraries.Std_Library then + -- No procedures in std have a wait statement. + null; + elsif Get_Identifier (Lib) = Std_Names.Name_Ieee then + -- Package ieee.vital_primitives has wait statements. + declare + Unit : constant Iir := + Get_Library_Unit (Get_Current_Design_Unit); + Unit_Id : constant Name_Id := Get_Identifier (Unit); + begin + if Unit_Id = Std_Names.Name_VITAL_Primitives then + Set_Suspend_Flag (Subprg, True); + end if; + end; + else + -- User procedures may have wait statements. + Set_Suspend_Flag (Subprg, True); + end if; + end; when others => Error_Kind ("sem_subprogram_declaration", Subprg); end case; @@ -2844,7 +2867,10 @@ package body Vhdl.Sem is Pkg : constant Iir := Get_Uninstantiated_Package_Decl (Inter); begin - if Get_Macro_Expanded_Flag (Pkg) then + -- Could be an error. + if Get_Kind (Pkg) = Iir_Kind_Package_Declaration + and then Get_Macro_Expanded_Flag (Pkg) + then return True; end if; end; @@ -3035,17 +3061,23 @@ package body Vhdl.Sem is Name : Iir; Pkg : Iir; begin - Name := Sem_Denoting_Name (Get_Uninstantiated_Package_Name (Decl)); - Set_Uninstantiated_Package_Name (Decl, Name); - Pkg := Get_Named_Entity (Name); - if Is_Error (Pkg) then - null; - elsif Get_Kind (Pkg) /= Iir_Kind_Package_Declaration then - Error_Class_Match (Name, "package"); - Pkg := Create_Error (Pkg); - elsif not Is_Uninstantiated_Package (Pkg) then - Error_Msg_Sem (+Name, "%n is not an uninstantiated package", +Pkg); - Pkg := Create_Error (Pkg); + Name := Get_Uninstantiated_Package_Name (Decl); + if Get_Kind (Name) not in Iir_Kinds_Denoting_Name then + Error_Msg_Sem (+Name, "uninstantiated package name expected"); + Pkg := Create_Error (Name); + else + Name := Sem_Denoting_Name (Name); + Set_Uninstantiated_Package_Name (Decl, Name); + Pkg := Get_Named_Entity (Name); + if Is_Error (Pkg) then + null; + elsif Get_Kind (Pkg) /= Iir_Kind_Package_Declaration then + Error_Class_Match (Name, "package"); + Pkg := Create_Error (Pkg); + elsif not Is_Uninstantiated_Package (Pkg) then + Error_Msg_Sem (+Name, "%n is not an uninstantiated package", +Pkg); + Pkg := Create_Error (Pkg); + end if; end if; Set_Uninstantiated_Package_Decl (Decl, Pkg); |