diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-06-07 07:58:12 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-06-07 18:35:02 +0200 |
commit | 705ef790875789d6e92aef48092f27af1ced27e6 (patch) | |
tree | 30482febb0a161d090f029a4bafd88ea38b8d22a /src/vhdl/vhdl-sem.adb | |
parent | 0464fc08590bf4f8cc9d011ff26b4e726134d5dd (diff) | |
download | ghdl-705ef790875789d6e92aef48092f27af1ced27e6.tar.gz ghdl-705ef790875789d6e92aef48092f27af1ced27e6.tar.bz2 ghdl-705ef790875789d6e92aef48092f27af1ced27e6.zip |
vhdl-sem: adjust condition to set suspend_state on procedures
Diffstat (limited to 'src/vhdl/vhdl-sem.adb')
-rw-r--r-- | src/vhdl/vhdl-sem.adb | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/src/vhdl/vhdl-sem.adb b/src/vhdl/vhdl-sem.adb index 74a0dfc85..d24652797 100644 --- a/src/vhdl/vhdl-sem.adb +++ b/src/vhdl/vhdl-sem.adb @@ -1995,13 +1995,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; |