aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-10-09 20:23:41 +0200
committerTristan Gingold <tgingold@free.fr>2019-10-09 20:23:41 +0200
commita1d8c53e1cba26c14f64d8951b2117dda1fa4d25 (patch)
tree3aba188cfe6641d35e2f7341d5bf2d112b07678c /src/synth
parent7bb502c9372456aec9593b043e1fcf96b2e2138a (diff)
downloadghdl-a1d8c53e1cba26c14f64d8951b2117dda1fa4d25.tar.gz
ghdl-a1d8c53e1cba26c14f64d8951b2117dda1fa4d25.tar.bz2
ghdl-a1d8c53e1cba26c14f64d8951b2117dda1fa4d25.zip
synth: use synth.source for setting location.
Diffstat (limited to 'src/synth')
-rw-r--r--src/synth/synth-decls.adb1
-rw-r--r--src/synth/synth-expr.adb15
-rw-r--r--src/synth/synth-expr.ads3
-rw-r--r--src/synth/synth-insts.adb1
-rw-r--r--src/synth/synth-oper.adb4
-rw-r--r--src/synth/synth-source.adb21
-rw-r--r--src/synth/synth-source.ads3
-rw-r--r--src/synth/synth-stmts.adb3
8 files changed, 34 insertions, 17 deletions
diff --git a/src/synth/synth-decls.adb b/src/synth/synth-decls.adb
index 408e8ecc6..99e6d3d9b 100644
--- a/src/synth/synth-decls.adb
+++ b/src/synth/synth-decls.adb
@@ -31,6 +31,7 @@ with Vhdl.Ieee.Std_Logic_1164;
with Synth.Environment; use Synth.Environment;
with Synth.Expr; use Synth.Expr;
with Synth.Stmts;
+with Synth.Source; use Synth.Source;
package body Synth.Decls is
procedure Synth_Anonymous_Subtype_Indication
diff --git a/src/synth/synth-expr.adb b/src/synth/synth-expr.adb
index d534b5d87..564ce3420 100644
--- a/src/synth/synth-expr.adb
+++ b/src/synth/synth-expr.adb
@@ -33,7 +33,6 @@ with Vhdl.Annotations; use Vhdl.Annotations;
with Netlists.Gates; use Netlists.Gates;
with Netlists.Builders; use Netlists.Builders;
-with Netlists.Locations; use Netlists.Locations;
with Synth.Types; use Synth.Types;
with Synth.Errors; use Synth.Errors;
@@ -46,18 +45,8 @@ package body Synth.Expr is
function Synth_Name (Syn_Inst : Synth_Instance_Acc; Name : Node)
return Value_Acc;
- procedure Set_Location2 (N : Net; Loc : Node) is
- begin
- Set_Location (Get_Net_Parent (N), Get_Location (Loc));
- end Set_Location2;
-
- procedure Set_Location (N : Net; Loc : Node) is
- begin
- -- Short and compact code as it is inlined.
- if Flag_Locations then
- Set_Location2 (N, Loc);
- end if;
- end Set_Location;
+ procedure Set_Location (N : Net; Loc : Node)
+ renames Synth.Source.Set_Location;
function Get_Const_Discrete (V : Value_Acc) return Int64
is
diff --git a/src/synth/synth-expr.ads b/src/synth/synth-expr.ads
index f04e0630b..0fc4eb697 100644
--- a/src/synth/synth-expr.ads
+++ b/src/synth/synth-expr.ads
@@ -29,9 +29,6 @@ with Synth.Context; use Synth.Context;
with Vhdl.Nodes; use Vhdl.Nodes;
package Synth.Expr is
- procedure Set_Location (N : Net; Loc : Node);
- pragma Inline (Set_Location);
-
-- Perform a subtype conversion. Check constraints.
function Synth_Subtype_Conversion (Val : Value_Acc;
Dtype : Type_Acc;
diff --git a/src/synth/synth-insts.adb b/src/synth/synth-insts.adb
index 9d450eda0..f29ecea07 100644
--- a/src/synth/synth-insts.adb
+++ b/src/synth/synth-insts.adb
@@ -38,6 +38,7 @@ with Synth.Environment; use Synth.Environment;
with Synth.Stmts; use Synth.Stmts;
with Synth.Decls; use Synth.Decls;
with Synth.Expr; use Synth.Expr;
+with Synth.Source; use Synth.Source;
package body Synth.Insts is
Root_Instance : Synth_Instance_Acc;
diff --git a/src/synth/synth-oper.adb b/src/synth/synth-oper.adb
index 50449dac6..82a23f310 100644
--- a/src/synth/synth-oper.adb
+++ b/src/synth/synth-oper.adb
@@ -36,12 +36,16 @@ with Synth.Errors; use Synth.Errors;
with Synth.Types; use Synth.Types;
with Synth.Stmts; use Synth.Stmts;
with Synth.Expr; use Synth.Expr;
+with Synth.Source;
package body Synth.Oper is
-- As log2(3m) is directly referenced, the program must be linked with -lm
-- (math library) on unix systems.
pragma Linker_Options ("-lm");
+ procedure Set_Location (N : Net; Loc : Node)
+ renames Synth.Source.Set_Location;
+
function Synth_Uresize (N : Net; W : Width; Loc : Node) return Net
is
Wn : constant Width := Get_Width (N);
diff --git a/src/synth/synth-source.adb b/src/synth/synth-source.adb
index 0ccbf0d90..4f6230723 100644
--- a/src/synth/synth-source.adb
+++ b/src/synth/synth-source.adb
@@ -22,10 +22,29 @@ with Netlists; use Netlists;
with Netlists.Locations; use Netlists.Locations;
package body Synth.Source is
+ procedure Set_Location2 (N : Net; Loc : Node) is
+ begin
+ Set_Location (Get_Net_Parent (N), Get_Location (Loc));
+ end Set_Location2;
+
+ procedure Set_Location2 (Inst : Instance; Loc : Node) is
+ begin
+ Set_Location (Inst, Get_Location (Loc));
+ end Set_Location2;
+
procedure Set_Location (N : Net; Src : Syn_Src) is
begin
+ -- Short and compact code as it is inlined.
+ if Flag_Locations then
+ Set_Location2 (N, Src);
+ end if;
+ end Set_Location;
+
+ procedure Set_Location (Inst : Instance; Src : Syn_Src) is
+ begin
+ -- Short and compact code as it is inlined.
if Flag_Locations then
- Set_Location (Get_Net_Parent (N), Get_Location (Src));
+ Set_Location2 (Inst, Src);
end if;
end Set_Location;
end Synth.Source;
diff --git a/src/synth/synth-source.ads b/src/synth/synth-source.ads
index ed640463d..8962d86b1 100644
--- a/src/synth/synth-source.ads
+++ b/src/synth/synth-source.ads
@@ -35,4 +35,7 @@ package Synth.Source is
procedure Set_Location (N : Netlists.Net; Src : Syn_Src);
pragma Inline (Set_Location);
+
+ procedure Set_Location (Inst : Netlists.Instance; Src : Syn_Src);
+ pragma Inline (Set_Location);
end Synth.Source;
diff --git a/src/synth/synth-stmts.adb b/src/synth/synth-stmts.adb
index 7b25a456e..e153a7cd4 100644
--- a/src/synth/synth-stmts.adb
+++ b/src/synth/synth-stmts.adb
@@ -52,6 +52,9 @@ package body Synth.Stmts is
procedure Synth_Sequential_Statements
(C : in out Seq_Context; Stmts : Node);
+ procedure Set_Location (N : Net; Loc : Node)
+ renames Synth.Source.Set_Location;
+
function Synth_Waveform (Syn_Inst : Synth_Instance_Acc;
Wf : Node;
Targ_Type : Type_Acc) return Value_Acc is