aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-10-10 18:44:13 +0200
committerTristan Gingold <tgingold@free.fr>2019-10-10 18:44:13 +0200
commit1f333abb370b3cbf8809d2949eb33deccd97b076 (patch)
tree9e58358173b65faedc8bbfac28b5cbcadd1f6854 /src/synth
parent51331309cd16699ee5770e522d5e1e2b9430d1b4 (diff)
downloadghdl-1f333abb370b3cbf8809d2949eb33deccd97b076.tar.gz
ghdl-1f333abb370b3cbf8809d2949eb33deccd97b076.tar.bz2
ghdl-1f333abb370b3cbf8809d2949eb33deccd97b076.zip
netlists: add internings child package.
Diffstat (limited to 'src/synth')
-rw-r--r--src/synth/netlists-internings.adb26
-rw-r--r--src/synth/netlists-internings.ads32
-rw-r--r--src/synth/synth-inference.adb17
3 files changed, 61 insertions, 14 deletions
diff --git a/src/synth/netlists-internings.adb b/src/synth/netlists-internings.adb
new file mode 100644
index 000000000..fb534e587
--- /dev/null
+++ b/src/synth/netlists-internings.adb
@@ -0,0 +1,26 @@
+-- Simple interning for netlist elements.
+-- Copyright (C) 2019 Tristan Gingold
+--
+-- This file is part of GHDL.
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+-- MA 02110-1301, USA.
+
+package body Netlists.Internings is
+ function Id_Instance (Param : Instance) return Instance is
+ begin
+ return Param;
+ end Id_Instance;
+end Netlists.Internings;
diff --git a/src/synth/netlists-internings.ads b/src/synth/netlists-internings.ads
new file mode 100644
index 000000000..4fcc87d56
--- /dev/null
+++ b/src/synth/netlists-internings.ads
@@ -0,0 +1,32 @@
+-- Simple interning for netlist elements.
+-- Copyright (C) 2019 Tristan Gingold
+--
+-- This file is part of GHDL.
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+-- MA 02110-1301, USA.
+
+with Dyn_Interning;
+
+package Netlists.Internings is
+ function Id_Instance (Param : Instance) return Instance;
+
+ package Dyn_Instance_Interning is new Dyn_Interning
+ (Params_Type => Instance,
+ Object_Type => Instance,
+ Hash => Netlists.Hash,
+ Build => Id_Instance,
+ Equal => "=");
+end Netlists.Internings;
diff --git a/src/synth/synth-inference.adb b/src/synth/synth-inference.adb
index 643b2d124..ea976bd45 100644
--- a/src/synth/synth-inference.adb
+++ b/src/synth/synth-inference.adb
@@ -18,13 +18,12 @@
-- Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
-- MA 02110-1301, USA.
-with Dyn_Interning;
-
with Netlists.Utils; use Netlists.Utils;
with Netlists.Gates; use Netlists.Gates;
with Netlists.Gates_Ports; use Netlists.Gates_Ports;
with Netlists.Locations; use Netlists.Locations;
with Netlists.Errors; use Netlists.Errors;
+with Netlists.Internings;
with Synth.Flags;
with Synth.Source; use Synth.Source;
@@ -404,18 +403,6 @@ package body Synth.Inference is
Add_Conc_Assign (Wid, Res, Off, Stmt);
end Infere_FF;
- function Id_Instance (Param : Instance) return Instance is
- begin
- return Param;
- end Id_Instance;
-
- package Inst_Interning is new Dyn_Interning
- (Params_Type => Instance,
- Object_Type => Instance,
- Hash => Netlists.Hash,
- Build => Id_Instance,
- Equal => "=");
-
-- Detect false combinational loop. They can easily appear when variables
-- are only used in one branch:
-- process (all)
@@ -437,6 +424,8 @@ package body Synth.Inference is
-- muxes (which were inserted by controls).
function Is_False_Loop (Prev_Val : Net) return Boolean
is
+ package Inst_Interning renames
+ Netlists.Internings.Dyn_Instance_Interning;
use Inst_Interning;
T : Inst_Interning.Instance;