aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-09-08 17:35:35 +0200
committerTristan Gingold <tgingold@free.fr>2019-09-11 06:37:27 +0200
commit52dcf8712d0186c5a5d38fcdeac4f8d015af281b (patch)
tree007241d1314f6be436b762ef7e2a3f069f20495c
parent43f70120eb51d9d5ff8e429e0128d12b8c302fe2 (diff)
downloadghdl-52dcf8712d0186c5a5d38fcdeac4f8d015af281b.tar.gz
ghdl-52dcf8712d0186c5a5d38fcdeac4f8d015af281b.tar.bz2
ghdl-52dcf8712d0186c5a5d38fcdeac4f8d015af281b.zip
synth: move synth_user_function_call to synth-stmts.
-rw-r--r--src/synth/synth-expr.adb57
-rw-r--r--src/synth/synth-stmts.adb61
-rw-r--r--src/synth/synth-stmts.ads4
3 files changed, 62 insertions, 60 deletions
diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb
index 11777c079..366e83d8e 100644
--- a/src/synth/synth-expr.adb
+++ b/src/synth/synth-expr.adb
@@ -35,8 +35,6 @@ with Vhdl.Annotations; use Vhdl.Annotations;
with Synth.Errors; use Synth.Errors;
with Synth.Types; use Synth.Types;
with Synth.Stmts; use Synth.Stmts;
-with Synth.Decls;
-with Synth.Environment; use Synth.Environment;
with Netlists.Gates; use Netlists.Gates;
with Netlists.Builders; use Netlists.Builders;
@@ -2139,61 +2137,6 @@ package body Synth.Expr is
return Create_Value_Const_Array (Bnd, Arr);
end Eval_To_Unsigned;
- function Synth_User_Function_Call
- (Syn_Inst : Synth_Instance_Acc; Expr : Node) return Value_Acc
- is
- Imp : constant Node := Get_Implementation (Expr);
- Assoc_Chain : constant Node := Get_Parameter_Association_Chain (Expr);
- Inter_Chain : constant Node := Get_Interface_Declaration_Chain (Imp);
- Bod : constant Node := Get_Subprogram_Body (Imp);
- Subprg_Inst : Synth_Instance_Acc;
- M : Areapools.Mark_Type;
- Res : Value_Acc;
- begin
- -- Is it a call to an ieee function ?
- declare
- Pkg : constant Node := Get_Parent (Imp);
- Unit : Node;
- Lib : Node;
- begin
- if Get_Kind (Pkg) = Iir_Kind_Package_Declaration then
- Unit := Get_Parent (Pkg);
- if Get_Kind (Unit) = Iir_Kind_Design_Unit then
- Lib := Get_Library (Get_Design_File (Unit));
- if Get_Identifier (Lib) = Std_Names.Name_Ieee then
- Error_Msg_Synth
- (+Expr, "unhandled call to an ieee function");
- raise Internal_Error;
- end if;
- end if;
- end if;
- end;
-
- Areapools.Mark (M, Instance_Pool.all);
- Subprg_Inst := Make_Instance (Syn_Inst, Get_Info (Bod));
-
- Subprg_Inst.Name := New_Internal_Name (Build_Context);
-
- Synth_Subprogram_Association
- (Subprg_Inst, Syn_Inst, Inter_Chain, Assoc_Chain);
-
- Push_Phi;
-
- Decls.Synth_Declarations (Subprg_Inst, Get_Declaration_Chain (Bod));
-
- Synth_Sequential_Statements
- (Subprg_Inst, Get_Sequential_Statement_Chain (Bod));
-
- Res := Subprg_Inst.Return_Value;
-
- Pop_And_Merge_Phi (Build_Context, Bod);
-
- Free_Instance (Subprg_Inst);
- Areapools.Release (M, Instance_Pool.all);
-
- return Res;
- end Synth_User_Function_Call;
-
function Synth_Predefined_Function_Call
(Syn_Inst : Synth_Instance_Acc; Expr : Node) return Value_Acc
is
diff --git a/src/synth/synth-stmts.adb b/src/synth/synth-stmts.adb
index a651f5e07..80eee0ba8 100644
--- a/src/synth/synth-stmts.adb
+++ b/src/synth/synth-stmts.adb
@@ -22,8 +22,9 @@ with Ada.Unchecked_Deallocation;
with Grt.Algos;
with Areapools;
-with Vhdl.Errors; use Vhdl.Errors;
+with Std_Names;
+with Vhdl.Errors; use Vhdl.Errors;
with Vhdl.Types;
with Vhdl.Sem_Expr;
with Vhdl.Utils; use Vhdl.Utils;
@@ -51,6 +52,9 @@ with Netlists.Utils; use Netlists.Utils;
with Netlists.Locations; use Netlists.Locations;
package body Synth.Stmts is
+ procedure Synth_Sequential_Statements
+ (Syn_Inst : Synth_Instance_Acc; Stmts : Node);
+
function Synth_Waveform (Syn_Inst : Synth_Instance_Acc;
Wf : Node;
Targ_Type : Node) return Value_Acc is
@@ -1403,6 +1407,61 @@ package body Synth.Stmts is
Instance_Pool := Prev_Instance_Pool;
end Synth_Process_Statement;
+ function Synth_User_Function_Call
+ (Syn_Inst : Synth_Instance_Acc; Expr : Node) return Value_Acc
+ is
+ Imp : constant Node := Get_Implementation (Expr);
+ Assoc_Chain : constant Node := Get_Parameter_Association_Chain (Expr);
+ Inter_Chain : constant Node := Get_Interface_Declaration_Chain (Imp);
+ Bod : constant Node := Get_Subprogram_Body (Imp);
+ Subprg_Inst : Synth_Instance_Acc;
+ M : Areapools.Mark_Type;
+ Res : Value_Acc;
+ begin
+ -- Is it a call to an ieee function ?
+ declare
+ Pkg : constant Node := Get_Parent (Imp);
+ Unit : Node;
+ Lib : Node;
+ begin
+ if Get_Kind (Pkg) = Iir_Kind_Package_Declaration then
+ Unit := Get_Parent (Pkg);
+ if Get_Kind (Unit) = Iir_Kind_Design_Unit then
+ Lib := Get_Library (Get_Design_File (Unit));
+ if Get_Identifier (Lib) = Std_Names.Name_Ieee then
+ Error_Msg_Synth
+ (+Expr, "unhandled call to an ieee function");
+ raise Internal_Error;
+ end if;
+ end if;
+ end if;
+ end;
+
+ Areapools.Mark (M, Instance_Pool.all);
+ Subprg_Inst := Make_Instance (Syn_Inst, Get_Info (Bod));
+
+ Subprg_Inst.Name := New_Internal_Name (Build_Context);
+
+ Synth_Subprogram_Association
+ (Subprg_Inst, Syn_Inst, Inter_Chain, Assoc_Chain);
+
+ Push_Phi;
+
+ Decls.Synth_Declarations (Subprg_Inst, Get_Declaration_Chain (Bod));
+
+ Synth_Sequential_Statements
+ (Subprg_Inst, Get_Sequential_Statement_Chain (Bod));
+
+ Res := Subprg_Inst.Return_Value;
+
+ Pop_And_Merge_Phi (Build_Context, Bod);
+
+ Free_Instance (Subprg_Inst);
+ Areapools.Release (M, Instance_Pool.all);
+
+ return Res;
+ end Synth_User_Function_Call;
+
procedure Synth_Concurrent_Assertion_Statement
(Syn_Inst : Synth_Instance_Acc; Stmt : Node)
is
diff --git a/src/synth/synth-stmts.ads b/src/synth/synth-stmts.ads
index 884ea299b..fd15559fa 100644
--- a/src/synth/synth-stmts.ads
+++ b/src/synth/synth-stmts.ads
@@ -41,8 +41,8 @@ package Synth.Stmts is
Val : Value_Acc;
Loc : Node);
- procedure Synth_Sequential_Statements
- (Syn_Inst : Synth_Instance_Acc; Stmts : Node);
+ function Synth_User_Function_Call
+ (Syn_Inst : Synth_Instance_Acc; Expr : Node) return Value_Acc;
-- Generate netlists for concurrent statements STMTS.
procedure Synth_Concurrent_Statements