aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/netlists-folds.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2021-06-20 08:50:03 +0200
committerTristan Gingold <tgingold@free.fr>2021-06-21 08:02:33 +0200
commit6aaabbfc1716fffd7b7185d53e791e77400950d2 (patch)
treea00fb3faec42b6508de916332132a8fe02151e2c /src/synth/netlists-folds.adb
parentca26a87dc5a0d405c6d777a4899ea617811cf402 (diff)
downloadghdl-6aaabbfc1716fffd7b7185d53e791e77400950d2.tar.gz
ghdl-6aaabbfc1716fffd7b7185d53e791e77400950d2.tar.bz2
ghdl-6aaabbfc1716fffd7b7185d53e791e77400950d2.zip
synth-environment: early transformation of dyn_insert to dyn_insert_en
Simplifies memory extraction
Diffstat (limited to 'src/synth/netlists-folds.adb')
-rw-r--r--src/synth/netlists-folds.adb25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/synth/netlists-folds.adb b/src/synth/netlists-folds.adb
index 41d06b3ea..c3fc3d022 100644
--- a/src/synth/netlists-folds.adb
+++ b/src/synth/netlists-folds.adb
@@ -349,4 +349,29 @@ package body Netlists.Folds is
return Build_Const_UB32 (Ctxt, 0, 1);
end case;
end Build2_Compare;
+
+ function Add_Enable_To_Dyn_Insert
+ (Ctxt : Context_Acc; Inst : Instance; Sel : Net) return Instance
+ is
+ In_Mem : constant Input := Get_Input (Inst, 0);
+ In_V : constant Input := Get_Input (Inst, 1);
+ In_Idx : constant Input := Get_Input (Inst, 2);
+ Off : constant Uns32 := Get_Param_Uns32 (Inst, 0);
+ Res : Net;
+ begin
+ Res := Build_Dyn_Insert_En
+ (Ctxt, Get_Driver (In_Mem), Get_Driver (In_V), Get_Driver (In_Idx),
+ Sel, Off);
+ Set_Location (Res, Get_Location (Inst));
+
+ Disconnect (In_Mem);
+ Disconnect (In_V);
+ Disconnect (In_Idx);
+ Redirect_Inputs (Get_Output (Inst, 0), Res);
+
+ Remove_Instance (Inst);
+
+ return Get_Net_Parent (Res);
+ end Add_Enable_To_Dyn_Insert;
+
end Netlists.Folds;