aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2023-01-04 19:51:08 +0100
committerTristan Gingold <tgingold@free.fr>2023-01-04 19:51:08 +0100
commit456c28b50ce95dca9fb0576de161051816b6c2dc (patch)
tree1fcb58503357107a74fe032431a3ac3c51ac8a8e
parent10b0d40e66decde8794e39343d83bc9694755238 (diff)
downloadghdl-456c28b50ce95dca9fb0576de161051816b6c2dc.tar.gz
ghdl-456c28b50ce95dca9fb0576de161051816b6c2dc.tar.bz2
ghdl-456c28b50ce95dca9fb0576de161051816b6c2dc.zip
synth-vhdl_decls: manually elaborate protected type body
-rw-r--r--src/synth/synth-vhdl_decls.adb31
-rw-r--r--src/synth/synth-vhdl_decls.ads2
2 files changed, 27 insertions, 6 deletions
diff --git a/src/synth/synth-vhdl_decls.adb b/src/synth/synth-vhdl_decls.adb
index 35ed61a86..d1cb3463d 100644
--- a/src/synth/synth-vhdl_decls.adb
+++ b/src/synth/synth-vhdl_decls.adb
@@ -393,26 +393,47 @@ package body Synth.Vhdl_Decls is
end Synth_Concurrent_Package_Instantiation;
function Create_Protected_Object (Inst : Synth_Instance_Acc;
- Decl : Node;
+ Var : Node;
Typ : Type_Acc) return Valtyp
is
use Elab.Memtype;
Prev_Instance_Pool : constant Areapools.Areapool_Acc := Instance_Pool;
- Decl_Type : constant Node := Get_Type (Decl);
+ Decl_Type : constant Node := Get_Type (Var);
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;
+ Decl : Node;
Res : Valtyp;
+ Last_Type : Node;
begin
Parent := Get_Instance_By_Scope (Inst, Get_Parent_Scope (Bod));
- Obj_Inst := Make_Elab_Instance (Parent, Decl, Bod, Null_Node);
+ Obj_Inst := Make_Elab_Instance (Parent, Var, 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);
+ Decl := Get_Declaration_Chain (Bod);
+ Last_Type := Null_Node;
+ while Decl /= Null_Node loop
+ case Get_Kind (Decl) is
+ when Iir_Kind_Type_Declaration
+ | Iir_Kind_Anonymous_Type_Declaration
+ | Iir_Kind_Subtype_Declaration
+ | Iir_Kind_Variable_Declaration =>
+ Elab.Vhdl_Decls.Elab_Declaration
+ (Obj_Inst, Decl, True, Last_Type);
+ when Iir_Kind_Function_Declaration
+ | Iir_Kind_Procedure_Declaration
+ | Iir_Kind_Function_Body
+ | Iir_Kind_Procedure_Body =>
+ -- Interface subtypes ?
+ null;
+ when others =>
+ Vhdl.Errors.Error_Kind ("create_protected_object", Decl);
+ end case;
+ Decl := Get_Chain (Decl);
+ end loop;
Mem := Alloc_Memory (Typ, Instance_Pool);
Write_Protected (Mem, Obj_Hand);
diff --git a/src/synth/synth-vhdl_decls.ads b/src/synth/synth-vhdl_decls.ads
index 06cc9f4c9..e30f18c62 100644
--- a/src/synth/synth-vhdl_decls.ads
+++ b/src/synth/synth-vhdl_decls.ads
@@ -56,7 +56,7 @@ package Synth.Vhdl_Decls is
Is_Subprg : Boolean := False);
function Create_Protected_Object (Inst : Synth_Instance_Acc;
- Decl : Node;
+ Var : Node;
Typ : Type_Acc) return Valtyp;
-- For declarations in architectural statements (top-level, entities,