aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/vhdl-sem_inst.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2023-01-11 20:24:05 +0100
committerTristan Gingold <tgingold@free.fr>2023-01-12 06:44:22 +0100
commit185c172b00eb3b7c16370f468960a65975e0fdf0 (patch)
tree3406abc34f8b36ccd71e2364b4e7e46b4f430a40 /src/vhdl/vhdl-sem_inst.adb
parent26e1196e31e68a10f5381546decf08b95afcf221 (diff)
downloadghdl-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/vhdl-sem_inst.adb')
-rw-r--r--src/vhdl/vhdl-sem_inst.adb19
1 files changed, 18 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;