aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2017-12-11 06:15:53 +0100
committerTristan Gingold <tgingold@free.fr>2017-12-11 06:15:53 +0100
commit5c8f0eb66888e0b35de3c4ec59ec4cc11061b23d (patch)
tree72412ba3f0a3a3b5aee66faf97a447f641958715 /src
parentb206f4cf1ee63ff517b9be3fcabaf156e07a9a15 (diff)
downloadghdl-5c8f0eb66888e0b35de3c4ec59ec4cc11061b23d.tar.gz
ghdl-5c8f0eb66888e0b35de3c4ec59ec4cc11061b23d.tar.bz2
ghdl-5c8f0eb66888e0b35de3c4ec59ec4cc11061b23d.zip
simul: replace Get_Instance_For_Slot by Get_Instance_Object.
Diffstat (limited to 'src')
-rw-r--r--src/synth/synth-context.adb6
-rw-r--r--src/vhdl/simulate/simul-execution.adb32
-rw-r--r--src/vhdl/simulate/simul-execution.ads3
3 files changed, 16 insertions, 25 deletions
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