aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2017-12-11 18:44:48 +0100
committerTristan Gingold <tgingold@free.fr>2017-12-11 18:44:48 +0100
commitc45ff2bef0b61aa82599ee8a4f28e4766039b69e (patch)
tree6f3010eef4b310167515ea63fa462e41f8e1f417
parent09b5eacda6a6f27625679519f9d3843c0ad4c82e (diff)
downloadghdl-c45ff2bef0b61aa82599ee8a4f28e4766039b69e.tar.gz
ghdl-c45ff2bef0b61aa82599ee8a4f28e4766039b69e.tar.bz2
ghdl-c45ff2bef0b61aa82599ee8a4f28e4766039b69e.zip
simul: handle call to a function of instantiated package.
-rw-r--r--src/vhdl/simulate/simul-execution.adb16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/vhdl/simulate/simul-execution.adb b/src/vhdl/simulate/simul-execution.adb
index a3babf0d9..9cb1189ec 100644
--- a/src/vhdl/simulate/simul-execution.adb
+++ b/src/vhdl/simulate/simul-execution.adb
@@ -3301,6 +3301,20 @@ package body Simul.Execution is
Unshare (Val, Instance_Pool);
end Execute_Monadic_Association;
+ -- Like Get_Subprogram_Body, but also works for instances, where
+ -- instantiated nodes have no bodies.
+ -- FIXME: maybe fix the issue directly in Sem_Inst ?
+ function Get_Subprogram_Body_Origin (Spec : Iir) return Iir
+ is
+ Orig : constant Iir := Sem_Inst.Get_Origin (Spec);
+ begin
+ if Orig /= Null_Iir then
+ return Get_Subprogram_Body_Origin (Orig);
+ else
+ return Get_Subprogram_Body (Spec);
+ end if;
+ end Get_Subprogram_Body_Origin;
+
-- Create a block instance for subprogram IMP.
function Create_Subprogram_Instance (Instance : Block_Instance_Acc;
Prot_Obj : Block_Instance_Acc;
@@ -3318,7 +3332,7 @@ package body Simul.Execution is
begin
case Get_Kind (Imp) is
when Iir_Kinds_Subprogram_Declaration =>
- Bod := Get_Subprogram_Body (Imp);
+ Bod := Get_Subprogram_Body_Origin (Imp);
when Iir_Kind_Protected_Type_Body =>
Bod := Imp;
when others =>