aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2017-12-05 05:12:16 +0100
committerTristan Gingold <tgingold@free.fr>2017-12-05 05:12:16 +0100
commit237ff6b3749f8e8bcab5040fcb04feeec77da92b (patch)
tree0840018131793a294e2f98c5c0a76f434fee4695 /src
parent619a6e10cbcd439ba2a499ea74357774e9d4ffae (diff)
downloadghdl-237ff6b3749f8e8bcab5040fcb04feeec77da92b.tar.gz
ghdl-237ff6b3749f8e8bcab5040fcb04feeec77da92b.tar.bz2
ghdl-237ff6b3749f8e8bcab5040fcb04feeec77da92b.zip
simul: handle interface subprogram.
Diffstat (limited to 'src')
-rw-r--r--src/vhdl/simulate/simul-annotations.adb5
-rw-r--r--src/vhdl/simulate/simul-elaboration.adb27
-rw-r--r--src/vhdl/simulate/simul-execution.adb5
3 files changed, 26 insertions, 11 deletions
diff --git a/src/vhdl/simulate/simul-annotations.adb b/src/vhdl/simulate/simul-annotations.adb
index 534fca38a..fb03495e4 100644
--- a/src/vhdl/simulate/simul-annotations.adb
+++ b/src/vhdl/simulate/simul-annotations.adb
@@ -415,7 +415,7 @@ package body Simul.Annotations is
| Iir_Kind_Interface_File_Declaration =>
Annotate_Anonymous_Type_Definition (Block_Info, Get_Type (El));
when others =>
- Error_Kind ("annotate_interface_list", El);
+ Error_Kind ("annotate_interface_list_subtype", El);
end case;
El := Get_Chain (El);
end loop;
@@ -460,6 +460,9 @@ package body Simul.Annotations is
Create_Object_Info (Block_Info, Decl);
when Iir_Kind_Interface_Package_Declaration =>
Annotate_Interface_Package_Declaration (Block_Info, Decl);
+ when Iir_Kinds_Interface_Subprogram_Declaration =>
+ -- Macro-expanded
+ null;
when others =>
Error_Kind ("annotate_interface_list", Decl);
end case;
diff --git a/src/vhdl/simulate/simul-elaboration.adb b/src/vhdl/simulate/simul-elaboration.adb
index 57088afd5..7cfb0c352 100644
--- a/src/vhdl/simulate/simul-elaboration.adb
+++ b/src/vhdl/simulate/simul-elaboration.adb
@@ -404,15 +404,21 @@ package body Simul.Elaboration is
if Get_Kind (Decl) = Iir_Kind_Package_Instantiation_Declaration then
-- Elaborate the body now.
- declare
- Uninst : constant Iir := Get_Uninstantiated_Package_Decl (Decl);
- Uninst_Info : constant Sim_Info_Acc := Get_Info (Uninst);
- Bod : constant Iir := Get_Package_Body (Uninst);
- begin
- Instance.Uninst_Scope := Uninst_Info;
+ if Get_Package_Body (Decl) /= Null_Iir then
+ -- Macro-expanded.
Elaborate_Declarative_Part
- (Instance, Get_Declaration_Chain (Bod));
- end;
+ (Instance, Get_Declaration_Chain (Get_Package_Body (Decl)));
+ else
+ -- Shared body.
+ declare
+ Uninst : constant Iir := Get_Uninstantiated_Package_Decl (Decl);
+ Bod : constant Iir := Get_Package_Body (Uninst);
+ begin
+ Instance.Uninst_Scope := Get_Info (Uninst);
+ Elaborate_Declarative_Part
+ (Instance, Get_Declaration_Chain (Bod));
+ end;
+ end if;
end if;
end Elaborate_Package_Declaration;
@@ -1060,6 +1066,9 @@ package body Simul.Elaboration is
-- to determine the value of the constant.
when Iir_Kind_Interface_Package_Declaration =>
Create_Object (Instance, Get_Info (Decl).Pkg_Slot);
+ when Iir_Kinds_Interface_Subprogram_Declaration =>
+ -- Macro-expanded.
+ null;
when others =>
Error_Kind ("elaborate_generic_clause", Decl);
end case;
@@ -1158,6 +1167,8 @@ package body Simul.Elaboration is
end;
goto Continue;
+ when Iir_Kind_Association_Element_Subprogram =>
+ goto Continue;
when others =>
Error_Kind ("elaborate_generic_map_aspect", Assoc);
end case;
diff --git a/src/vhdl/simulate/simul-execution.adb b/src/vhdl/simulate/simul-execution.adb
index c4cfa7404..ae3818792 100644
--- a/src/vhdl/simulate/simul-execution.adb
+++ b/src/vhdl/simulate/simul-execution.adb
@@ -3301,8 +3301,9 @@ package body Simul.Execution is
Up_Info := Get_Info_For_Scope (Parent);
Up_Block := Get_Instance_By_Scope (Instance, Up_Info);
- Origin := Sem_Inst.Get_Origin (Imp);
- if Origin /= Null_Iir then
+ if Up_Block.Uninst_Scope /= null then
+ Origin := Sem_Inst.Get_Origin (Imp);
+ pragma Assert (Origin /= Null_Iir);
-- Call to a subprogram of an instantiated package.
-- For a generic package, only the spec is instantiated, the body
-- is shared by all the instances.