From 6e800dc93b88801fcb9465cb3ca95b14e8489200 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sat, 17 Sep 2022 16:07:07 +0200 Subject: synth: handle protected types in subprograms --- src/simul/simul-vhdl_elab.adb | 34 +++------------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) (limited to 'src/simul') diff --git a/src/simul/simul-vhdl_elab.adb b/src/simul/simul-vhdl_elab.adb index 89cf9cf17..9c89cfa81 100644 --- a/src/simul/simul-vhdl_elab.adb +++ b/src/simul/simul-vhdl_elab.adb @@ -23,10 +23,10 @@ with Vhdl.Utils; use Vhdl.Utils; with Vhdl.Canon; with Synth.Vhdl_Stmts; +with Synth.Vhdl_Decls; with Trans_Analyzes; with Elab.Vhdl_Decls; -with Elab.Vhdl_Prot; with Simul.Vhdl_Debug; @@ -197,35 +197,6 @@ package body Simul.Vhdl_Elab is Val.Val.T := Terminal_Table.Last; end Gather_Terminal; - function Create_Protected_Object (Inst : Synth_Instance_Acc; - Decl : Node; - Typ : Type_Acc) return Valtyp - is - Decl_Type : constant Node := Get_Type (Decl); - Bod : constant Node := Get_Protected_Type_Body (Decl_Type); - Obj_Inst : Synth_Instance_Acc; - Obj_Hand : Protected_Index; - Mem : Memory_Ptr; - Parent : Synth_Instance_Acc; - Res : Valtyp; - begin - Parent := Get_Instance_By_Scope (Inst, Get_Parent_Scope (Bod)); - Obj_Inst := Make_Elab_Instance (Parent, Bod, Null_Node); - Obj_Hand := Elab.Vhdl_Prot.Create (Obj_Inst); - - Instance_Pool := Global_Pool'Access; - Elab.Vhdl_Decls.Elab_Declarations - (Obj_Inst, Get_Declaration_Chain (Bod), True); - - Mem := Alloc_Memory (Typ, Instance_Pool); - Write_Protected (Mem, Obj_Hand); - - Res := Create_Value_Memory ((Typ, Mem), Instance_Pool); - Instance_Pool := null; - - return Res; - end Create_Protected_Object; - procedure Gather_Processes_Decl (Inst : Synth_Instance_Acc; Decl : Node) is begin case Get_Kind (Decl) is @@ -311,7 +282,8 @@ package body Simul.Vhdl_Elab is pragma Assert (V.Val = null); Current_Pool := Global_Pool'Access; if V.Typ.Kind = Type_Protected then - V := Create_Protected_Object (Inst, Decl, V.Typ); + V := Synth.Vhdl_Decls.Create_Protected_Object + (Inst, Decl, V.Typ); else V := Create_Value_Default (V.Typ); end if; -- cgit v1.2.3