From 5c8f0eb66888e0b35de3c4ec59ec4cc11061b23d Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Mon, 11 Dec 2017 06:15:53 +0100 Subject: simul: replace Get_Instance_For_Slot by Get_Instance_Object. --- src/synth/synth-context.adb | 6 +++--- src/vhdl/simulate/simul-execution.adb | 32 +++++++++++++------------------- src/vhdl/simulate/simul-execution.ads | 3 --- 3 files changed, 16 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/synth/synth-context.adb b/src/synth/synth-context.adb index 975e205c5..96242ee73 100644 --- a/src/synth/synth-context.adb +++ b/src/synth/synth-context.adb @@ -215,12 +215,12 @@ package body Synth.Context is function Get_Value (Inst : Synth_Instance_Acc; Obj : Iir) return Value_Acc is - Slot : constant Object_Slot_Type := Get_Info (Obj).Slot; + Info : constant Sim_Info_Acc := Get_Info (Obj); Sim_Inst : constant Block_Instance_Acc := - Simul.Execution.Get_Instance_For_Slot (Inst.Sim, Obj); + Simul.Execution.Get_Instance_By_Scope (Inst.Sim, Info.Obj_Scope); Val : Value_Acc; begin - Val := Instance_Map (Sim_Inst.Id).Objects (Slot); + Val := Instance_Map (Sim_Inst.Id).Objects (Info.Slot); pragma Assert (Val /= null); return Val; end Get_Value; diff --git a/src/vhdl/simulate/simul-execution.adb b/src/vhdl/simulate/simul-execution.adb index 4515d6295..c4c5a54f4 100644 --- a/src/vhdl/simulate/simul-execution.adb +++ b/src/vhdl/simulate/simul-execution.adb @@ -122,11 +122,15 @@ package body Simul.Execution is end case; end Get_Instance_By_Scope; - function Get_Instance_For_Slot (Instance: Block_Instance_Acc; Decl: Iir) - return Block_Instance_Acc is + function Get_Instance_Object (Instance: Block_Instance_Acc; Obj : Iir) + return Iir_Value_Literal_Acc + is + Info : constant Sim_Info_Acc := Get_Info (Obj); + Obj_Inst : Block_Instance_Acc; begin - return Get_Instance_By_Scope (Instance, Get_Info (Decl).Obj_Scope); - end Get_Instance_For_Slot; + Obj_Inst := Get_Instance_By_Scope (Instance, Info.Obj_Scope); + return Obj_Inst.Objects (Info.Slot); + end Get_Instance_Object; function Get_Info_For_Scope (Scope : Iir) return Sim_Info_Acc is begin @@ -2278,8 +2282,7 @@ package body Simul.Execution is Execute_Expression (Block, Get_Right_Limit (Prefix)), Get_Direction (Prefix)); elsif Info.Kind = Kind_Object then - Bound := Get_Instance_For_Slot - (Block, Prefix).Objects (Info.Slot); + Bound := Get_Instance_Object (Block, Prefix); else raise Internal_Error; end if; @@ -2592,9 +2595,7 @@ package body Simul.Execution is Expr: Iir; Base : Iir_Value_Literal_Acc; Res : out Iir_Value_Literal_Acc; - Is_Sig : out Boolean) - is - Slot_Block: Block_Instance_Acc; + Is_Sig : out Boolean) is begin -- Default value Is_Sig := False; @@ -2611,8 +2612,7 @@ package body Simul.Execution is if Base /= null then Res := Base; else - Slot_Block := Get_Instance_For_Slot (Block, Expr); - Res := Slot_Block.Objects (Get_Info (Expr).Slot); + Res := Get_Instance_Object (Block, Expr); end if; when Iir_Kind_Object_Alias_Declaration => @@ -2621,8 +2621,7 @@ package body Simul.Execution is if Base /= null then Res := Base; else - Slot_Block := Get_Instance_For_Slot (Block, Expr); - Res := Slot_Block.Objects (Get_Info (Expr).Slot); + Res := Get_Instance_Object (Block, Expr); end if; when Iir_Kind_Interface_Constant_Declaration @@ -2638,12 +2637,7 @@ package body Simul.Execution is if Base /= null then Res := Base; else - declare - Info : constant Sim_Info_Acc := Get_Info (Expr); - begin - Slot_Block := Get_Instance_By_Scope (Block, Info.Obj_Scope); - Res := Slot_Block.Objects (Info.Slot); - end; + Res := Get_Instance_Object (Block, Expr); end if; when Iir_Kind_Indexed_Name => diff --git a/src/vhdl/simulate/simul-execution.ads b/src/vhdl/simulate/simul-execution.ads index b8ef5e7d2..66748b52a 100644 --- a/src/vhdl/simulate/simul-execution.ads +++ b/src/vhdl/simulate/simul-execution.ads @@ -139,9 +139,6 @@ package Simul.Execution is (Instance: Block_Instance_Acc; Scope: Sim_Info_Acc) return Block_Instance_Acc; - function Get_Instance_For_Slot (Instance: Block_Instance_Acc; Decl: Iir) - return Block_Instance_Acc; - -- Check VALUE follows the constraints of DEF. -- INSTANCE,DEF is the definition of a subtype. -- EXPR is just used in case of error to display the location -- cgit v1.2.3