aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/elab-vhdl_context.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-07-20 19:37:51 +0200
committerTristan Gingold <tgingold@free.fr>2022-07-20 19:37:51 +0200
commit4b84d1fe0fd25ebf148218fa18971bdfd591f0c7 (patch)
treea8caa8929d047a7cf54ea6d24d8d11bc208064c3 /src/synth/elab-vhdl_context.adb
parent76ce880bef54d80cfd5a55817b203616f50de823 (diff)
downloadghdl-4b84d1fe0fd25ebf148218fa18971bdfd591f0c7.tar.gz
ghdl-4b84d1fe0fd25ebf148218fa18971bdfd591f0c7.tar.bz2
ghdl-4b84d1fe0fd25ebf148218fa18971bdfd591f0c7.zip
elab-vhdl_context: add iterator for top-level packages
Diffstat (limited to 'src/synth/elab-vhdl_context.adb')
-rw-r--r--src/synth/elab-vhdl_context.adb22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/synth/elab-vhdl_context.adb b/src/synth/elab-vhdl_context.adb
index 95b9ddf29..048ac1ae4 100644
--- a/src/synth/elab-vhdl_context.adb
+++ b/src/synth/elab-vhdl_context.adb
@@ -602,4 +602,26 @@ package body Elab.Vhdl_Context is
begin
return Syn_Inst.Caller;
end Get_Caller_Instance;
+
+ procedure Iterate_Top_Level (It : in out Iterator_Top_Level_Type;
+ Res : out Synth_Instance_Acc)
+ is
+ Obj : Obj_Type;
+ begin
+ loop
+ if It.Next_Idx > Root_Instance.Max_Objs then
+ Res := null;
+ exit;
+ end if;
+
+ Obj := Root_Instance.Objects (It.Next_Idx);
+ It.Next_Idx := It.Next_Idx + 1;
+
+ if Obj.Kind = Obj_Instance then
+ Res := Obj.I_Inst;
+ return;
+ end if;
+ end loop;
+ end Iterate_Top_Level;
+
end Elab.Vhdl_Context;