From b93769c93d695b4dc77199bdab041da50b1fb5ff Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Thu, 19 Sep 2019 06:21:53 +0200 Subject: synth: make synth_instance_type private. --- src/synth/synth-context.ads | 62 ++++++++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 21 deletions(-) (limited to 'src/synth/synth-context.ads') diff --git a/src/synth/synth-context.ads b/src/synth/synth-context.ads index 0cfbc949c..bf729a282 100644 --- a/src/synth/synth-context.ads +++ b/src/synth/synth-context.ads @@ -30,28 +30,9 @@ package Synth.Context is -- Block_Instance_Type. type Objects_Array is array (Object_Slot_Type range <>) of Value_Acc; - type Synth_Instance_Type; + type Synth_Instance_Type (<>) is private; type Synth_Instance_Acc is access Synth_Instance_Type; - type Synth_Instance_Type (Max_Objs : Object_Slot_Type) is record - -- Module which owns gates created for this instance. - M : Module; - - -- Name prefix for declarations. - Name : Sname; - - -- The corresponding info for this instance. - Block_Scope : Sim_Info_Acc; - - -- Parent instance. - Up_Block : Synth_Instance_Acc; - - Elab_Objects : Object_Slot_Type; - - -- Instance for synthesis. - Objects : Objects_Array (1 .. Max_Objs); - end record; - type Instance_Map_Array is array (Block_Instance_Id range <>) of Synth_Instance_Acc; type Instance_Map_Array_Acc is access Instance_Map_Array; @@ -68,13 +49,33 @@ package Synth.Context is return Synth_Instance_Acc; -- Create and free the corresponding synth instance. - function Make_Instance (Parent : Synth_Instance_Acc; Info : Sim_Info_Acc) + function Make_Instance (Parent : Synth_Instance_Acc; + Info : Sim_Info_Acc; + Name : Sname := No_Sname) return Synth_Instance_Acc; procedure Free_Instance (Synth_Inst : in out Synth_Instance_Acc); + function Get_Sname (Inst : Synth_Instance_Acc) return Sname; + pragma Inline (Get_Sname); + + procedure Set_Module (Inst : Synth_Instance_Acc; M : Module); + function Get_Module (Inst : Synth_Instance_Acc) return Module; + pragma Inline (Set_Module, Get_Module); + + procedure Set_Block_Scope + (Inst : Synth_Instance_Acc; Scope : Sim_Info_Acc); + procedure Create_Object (Syn_Inst : Synth_Instance_Acc; Decl : Iir; Val : Value_Acc); + procedure Create_Package_Object + (Syn_Inst : Synth_Instance_Acc; Decl : Iir; Val : Value_Acc); + + -- Force the value of DECL, without checking for elaboration order. + -- It is for deferred constants. + procedure Create_Object_Force + (Syn_Inst : Synth_Instance_Acc; Decl : Iir; Val : Value_Acc); + procedure Destroy_Object (Syn_Inst : Synth_Instance_Acc; Decl : Iir); @@ -97,4 +98,23 @@ package Synth.Context is function Create_Value_Instance (Inst : Synth_Instance_Acc) return Value_Acc; +private + type Synth_Instance_Type (Max_Objs : Object_Slot_Type) is record + -- Module which owns gates created for this instance. + M : Module; + + -- Name prefix for declarations. + Name : Sname; + + -- The corresponding info for this instance. + Block_Scope : Sim_Info_Acc; + + -- Parent instance. + Up_Block : Synth_Instance_Acc; + + Elab_Objects : Object_Slot_Type; + + -- Instance for synthesis. + Objects : Objects_Array (1 .. Max_Objs); + end record; end Synth.Context; -- cgit v1.2.3