aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/synth/synth-decls.adb33
-rw-r--r--src/synth/synth-decls.ads3
-rw-r--r--src/synth/synth-insts.adb44
-rw-r--r--src/synth/synthesis.adb89
4 files changed, 85 insertions, 84 deletions
diff --git a/src/synth/synth-decls.adb b/src/synth/synth-decls.adb
index fcdc721d0..0460694f9 100644
--- a/src/synth/synth-decls.adb
+++ b/src/synth/synth-decls.adb
@@ -489,6 +489,39 @@ package body Synth.Decls is
end loop;
end Synth_Subprogram_Declaration;
+ procedure Synth_Convertible_Declarations (Syn_Inst : Synth_Instance_Acc)
+ is
+ use Vhdl.Std_Package;
+ begin
+ Create_Object
+ (Syn_Inst, Convertible_Integer_Type_Definition,
+ Get_Value (Syn_Inst, Universal_Integer_Type_Definition));
+ Create_Object
+ (Syn_Inst, Convertible_Real_Type_Definition,
+ Get_Value (Syn_Inst, Universal_Real_Type_Definition));
+ end Synth_Convertible_Declarations;
+
+ procedure Synth_Package_Declaration
+ (Parent_Inst : Synth_Instance_Acc; Pkg : Node)
+ is
+ use Vhdl.Std_Package;
+ pragma Assert (not Is_Uninstantiated_Package (Pkg));
+ Syn_Inst : Synth_Instance_Acc;
+ Val : Value_Acc;
+ begin
+ Syn_Inst := Make_Instance (Parent_Inst, Pkg);
+ Val := Create_Value_Instance (Syn_Inst);
+ if Get_Kind (Get_Parent (Pkg)) = Iir_Kind_Design_Unit then
+ Create_Package_Object (Parent_Inst, Pkg, Val);
+ else
+ Create_Object (Parent_Inst, Pkg, Val);
+ end if;
+ Synth_Declarations (Syn_Inst, Get_Declaration_Chain (Pkg));
+ if Pkg = Vhdl.Std_Package.Standard_Package then
+ Synth_Convertible_Declarations (Syn_Inst);
+ end if;
+ end Synth_Package_Declaration;
+
procedure Synth_Declaration
(Syn_Inst : Synth_Instance_Acc; Decl : Node; Is_Subprg : Boolean) is
begin
diff --git a/src/synth/synth-decls.ads b/src/synth/synth-decls.ads
index ea2d434f7..0c478d5a2 100644
--- a/src/synth/synth-decls.ads
+++ b/src/synth/synth-decls.ads
@@ -44,4 +44,7 @@ package Synth.Decls is
procedure Finalize_Declarations (Syn_Inst : Synth_Instance_Acc;
Decls : Iir;
Is_Subprg : Boolean := False);
+
+ procedure Synth_Package_Declaration
+ (Parent_Inst : Synth_Instance_Acc; Pkg : Node);
end Synth.Decls;
diff --git a/src/synth/synth-insts.adb b/src/synth/synth-insts.adb
index 66a6bb2fb..ebbfedcab 100644
--- a/src/synth/synth-insts.adb
+++ b/src/synth/synth-insts.adb
@@ -628,6 +628,44 @@ package body Synth.Insts is
end;
end Synth_Component_Instantiation_Statement;
+ procedure Synth_Dependencies (Parent_Inst : Synth_Instance_Acc; Unit : Node)
+ is
+ Dep_List : constant Node_List := Get_Dependence_List (Unit);
+ Dep_It : List_Iterator;
+ Dep : Node;
+ Dep_Unit : Node;
+ begin
+ Dep_It := List_Iterate (Dep_List);
+ while Is_Valid (Dep_It) loop
+ Dep := Get_Element (Dep_It);
+ pragma Assert (Get_Kind (Dep) = Iir_Kind_Design_Unit);
+ if not Get_Elab_Flag (Dep) then
+ Set_Elab_Flag (Dep, True);
+ Synth_Dependencies (Parent_Inst, Dep);
+ Dep_Unit := Get_Library_Unit (Dep);
+ case Iir_Kinds_Library_Unit (Get_Kind (Dep_Unit)) is
+ when Iir_Kind_Entity_Declaration =>
+ null;
+ when Iir_Kind_Configuration_Declaration =>
+ null;
+ when Iir_Kind_Context_Declaration =>
+ null;
+ when Iir_Kind_Package_Declaration =>
+ Synth_Package_Declaration (Parent_Inst, Dep_Unit);
+ when Iir_Kind_Package_Instantiation_Declaration =>
+ null;
+ when Iir_Kind_Package_Body =>
+ null;
+ when Iir_Kind_Architecture_Body =>
+ null;
+ when Iir_Kinds_Verification_Unit =>
+ null;
+ end case;
+ end if;
+ Next (Dep_It);
+ end loop;
+ end Synth_Dependencies;
+
procedure Synth_Top_Entity (Global_Instance : Synth_Instance_Acc;
Arch : Node;
Config : Node;
@@ -642,6 +680,10 @@ package body Synth.Insts is
begin
Root_Instance := Global_Instance;
+ -- Dependencies first.
+ Synth_Dependencies (Global_Instance, Get_Design_Unit (Entity));
+ Synth_Dependencies (Global_Instance, Get_Design_Unit (Arch));
+
Syn_Inst := Make_Instance (Global_Instance, Arch,
New_Sname_User (Get_Identifier (Entity)));
@@ -806,6 +848,8 @@ package body Synth.Insts is
return;
end if;
+ Synth_Dependencies (Root_Instance, Get_Design_Unit (Arch));
+
Set_Instance_Module (Syn_Inst, Inst.M);
Self_Inst := Get_Self_Instance (Inst.M);
diff --git a/src/synth/synthesis.adb b/src/synth/synthesis.adb
index 5d41ad70f..e2d72142e 100644
--- a/src/synth/synthesis.adb
+++ b/src/synth/synthesis.adb
@@ -18,10 +18,7 @@
-- Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
-- MA 02110-1301, USA.
-with Vhdl.Utils; use Vhdl.Utils;
-
-with Synth.Values; use Synth.Values;
-with Synth.Decls; use Synth.Decls;
+with Synth.Values;
with Synth.Insts; use Synth.Insts;
with Synth.Environment.Debug;
@@ -29,87 +26,15 @@ pragma Unreferenced (Synth.Environment.Debug);
with Errorout; use Errorout;
with Vhdl.Errors; use Vhdl.Errors;
-with Vhdl.Std_Package;
package body Synthesis is
- procedure Synth_Convertible_Declarations (Syn_Inst : Synth_Instance_Acc)
- is
- use Vhdl.Std_Package;
- begin
- Create_Object
- (Syn_Inst, Convertible_Integer_Type_Definition,
- Get_Value (Syn_Inst, Universal_Integer_Type_Definition));
- Create_Object
- (Syn_Inst, Convertible_Real_Type_Definition,
- Get_Value (Syn_Inst, Universal_Real_Type_Definition));
- end Synth_Convertible_Declarations;
-
- procedure Synth_Package_Declaration
- (Parent_Inst : Synth_Instance_Acc; Pkg : Node)
- is
- use Vhdl.Std_Package;
- pragma Assert (not Is_Uninstantiated_Package (Pkg));
- Syn_Inst : Synth_Instance_Acc;
- Val : Value_Acc;
- begin
- Syn_Inst := Make_Instance (Parent_Inst, Pkg);
- Val := Create_Value_Instance (Syn_Inst);
- if Get_Kind (Get_Parent (Pkg)) = Iir_Kind_Design_Unit then
- Create_Package_Object (Parent_Inst, Pkg, Val);
- else
- Create_Object (Parent_Inst, Pkg, Val);
- end if;
- Synth_Declarations (Syn_Inst, Get_Declaration_Chain (Pkg));
- if Pkg = Vhdl.Std_Package.Standard_Package then
- Synth_Convertible_Declarations (Syn_Inst);
- end if;
- end Synth_Package_Declaration;
-
- procedure Synth_Dependencies (Parent_Inst : Synth_Instance_Acc; Unit : Node)
- is
- Dep_List : constant Node_List := Get_Dependence_List (Unit);
- Dep_It : List_Iterator;
- Dep : Node;
- Dep_Unit : Node;
- begin
- Dep_It := List_Iterate (Dep_List);
- while Is_Valid (Dep_It) loop
- Dep := Get_Element (Dep_It);
- pragma Assert (Get_Kind (Dep) = Iir_Kind_Design_Unit);
- if not Get_Elab_Flag (Dep) then
- Set_Elab_Flag (Dep, True);
- Synth_Dependencies (Parent_Inst, Dep);
- Dep_Unit := Get_Library_Unit (Dep);
- case Iir_Kinds_Library_Unit (Get_Kind (Dep_Unit)) is
- when Iir_Kind_Entity_Declaration =>
- null;
- when Iir_Kind_Configuration_Declaration =>
- null;
- when Iir_Kind_Context_Declaration =>
- null;
- when Iir_Kind_Package_Declaration =>
- Synth_Package_Declaration (Parent_Inst, Dep_Unit);
- when Iir_Kind_Package_Instantiation_Declaration =>
- null;
- when Iir_Kind_Package_Body =>
- null;
- when Iir_Kind_Architecture_Body =>
- null;
- when Iir_Kinds_Verification_Unit =>
- null;
- end case;
- end if;
- Next (Dep_It);
- end loop;
- end Synth_Dependencies;
-
procedure Synth_Design
(Design : Node; M : out Module; Inst : out Synth_Instance_Acc)
is
Unit : constant Node := Get_Library_Unit (Design);
Arch : Node;
Config : Node;
- Top_Instance : Synth_Instance_Acc;
+ Global_Instance : Synth_Instance_Acc;
begin
-- Extract architecture from design.
case Get_Kind (Unit) is
@@ -125,21 +50,17 @@ package body Synthesis is
Error_Kind ("synth_design", Unit);
end case;
- Top_Instance := Make_Base_Instance;
+ Global_Instance := Make_Base_Instance;
Synth.Values.Init;
Synth.Insts.Init;
- -- Dependencies first.
- Synth_Dependencies (Top_Instance, Get_Design_Unit (Get_Entity (Arch)));
- Synth_Dependencies (Top_Instance, Get_Design_Unit (Arch));
-
- Synth_Top_Entity (Top_Instance, Arch, Config, Inst);
+ Synth_Top_Entity (Global_Instance, Arch, Config, Inst);
Synth_All_Instances;
if Errorout.Nbr_Errors > 0 then
raise Compilation_Error;
end if;
- M := Get_Top_Module (Top_Instance);
+ M := Get_Top_Module (Global_Instance);
end Synth_Design;
end Synthesis;