diff options
author | Tristan Gingold <tgingold@free.fr> | 2023-01-11 20:24:05 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2023-01-12 06:44:22 +0100 |
commit | 185c172b00eb3b7c16370f468960a65975e0fdf0 (patch) | |
tree | 3406abc34f8b36ccd71e2364b4e7e46b4f430a40 /src/vhdl | |
parent | 26e1196e31e68a10f5381546decf08b95afcf221 (diff) | |
download | ghdl-185c172b00eb3b7c16370f468960a65975e0fdf0.tar.gz ghdl-185c172b00eb3b7c16370f468960a65975e0fdf0.tar.bz2 ghdl-185c172b00eb3b7c16370f468960a65975e0fdf0.zip |
synth: fix handle of protected type bodies within instantiated packages.
Diffstat (limited to 'src/vhdl')
-rw-r--r-- | src/vhdl/vhdl-sem_inst.adb | 19 | ||||
-rw-r--r-- | src/vhdl/vhdl-sem_inst.ads | 4 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/vhdl/vhdl-sem_inst.adb b/src/vhdl/vhdl-sem_inst.adb index 3272628d1..57225e2ae 100644 --- a/src/vhdl/vhdl-sem_inst.adb +++ b/src/vhdl/vhdl-sem_inst.adb @@ -664,17 +664,20 @@ package body Vhdl.Sem_Inst is when Field_Suspend_State_Chain => if Kind = Iir_Kind_Suspend_State_Declaration then + -- Clear the fields for suspend state variable. Set_Suspend_State_Chain (Res, Null_Node); Set_Suspend_State_Last (Res, Null_Node); else + -- Link for suspend state statement. declare Decl : constant Node := Get_Suspend_State_Decl (Res); Last : constant Node := Get_Suspend_State_Last (Decl); begin - Set_Suspend_State_Chain (Res, Last); Set_Suspend_State_Last (Decl, Res); if Last = Null_Node then Set_Suspend_State_Chain (Decl, Res); + else + Set_Suspend_State_Chain (Last, Res); end if; end; end if; @@ -1482,4 +1485,18 @@ package body Vhdl.Sem_Inst is return Get_Subprogram_Body_Origin (Orig); end if; end Get_Subprogram_Body_Origin; + + function Get_Protected_Type_Body_Origin (Atype : Iir) return Iir + is + Res : constant Iir := Get_Protected_Type_Body (Atype); + Orig : Iir; + begin + if Res /= Null_Iir then + return Res; + else + Orig := Get_Origin (Atype); + pragma Assert (Orig /= Null_Iir); + return Get_Protected_Type_Body_Origin (Orig); + end if; + end Get_Protected_Type_Body_Origin; end Vhdl.Sem_Inst; diff --git a/src/vhdl/vhdl-sem_inst.ads b/src/vhdl/vhdl-sem_inst.ads index dea437837..f86c1a560 100644 --- a/src/vhdl/vhdl-sem_inst.ads +++ b/src/vhdl/vhdl-sem_inst.ads @@ -53,4 +53,8 @@ package Vhdl.Sem_Inst is -- instantiated nodes have no bodies. -- See comment about Get/Set_Subprogram_body in vhdl-nodes. function Get_Subprogram_Body_Origin (Spec : Iir) return Iir; + + -- Likewise for protected type bodies. + -- ATYPE is the protected type definition. + function Get_Protected_Type_Body_Origin (Atype : Iir) return Iir; end Vhdl.Sem_Inst; |