aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/netlists-expands.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-11-10 07:24:27 +0100
committerTristan Gingold <tgingold@free.fr>2019-11-11 20:28:41 +0100
commit6eb11dd7c637659881f80cd66e5504b2b057d370 (patch)
tree76baa3f4e11e3f29da3b41c52d4a87ab6a0ad934 /src/synth/netlists-expands.adb
parent72094d312400368dda79e32b4403d0f142404fad (diff)
downloadghdl-6eb11dd7c637659881f80cd66e5504b2b057d370.tar.gz
ghdl-6eb11dd7c637659881f80cd66e5504b2b057d370.tar.bz2
ghdl-6eb11dd7c637659881f80cd66e5504b2b057d370.zip
netlists: expand dyn_insert_en
Diffstat (limited to 'src/synth/netlists-expands.adb')
-rw-r--r--src/synth/netlists-expands.adb21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/synth/netlists-expands.adb b/src/synth/netlists-expands.adb
index c6f2196e2..3eeee7d3b 100644
--- a/src/synth/netlists-expands.adb
+++ b/src/synth/netlists-expands.adb
@@ -261,7 +261,8 @@ package body Netlists.Expands is
Off : in out Uns32;
Dat : Net;
Memidx_Arr : Memidx_Array_Type;
- Net_Arr : Net_Array)
+ Net_Arr : Net_Array;
+ En : Net := No_Net)
is
Dat_W : constant Width := Get_Width (Dat);
type Count_Type is record
@@ -277,6 +278,7 @@ package body Netlists.Expands is
Next_Off : Uns32;
Prev_Net : Net;
Step : Uns32;
+ S : Net;
begin
-- Initialize count.
for I in Memidx_Arr'Range loop
@@ -337,7 +339,12 @@ package body Netlists.Expands is
V := Build_Extract (Ctxt, Mem, Off, Dat_W);
end if;
- V := Build_Mux2 (Ctxt, Net_Arr (Sel), V, Dat);
+ S := Net_Arr (Sel);
+ if En /= No_Net then
+ S := Build_Dyadic (Ctxt, Id_And, S, En);
+ end if;
+
+ V := Build_Mux2 (Ctxt, S, V, Dat);
Prev_Net := V;
Next_Off := Off + Dat_W;
@@ -364,7 +371,8 @@ package body Netlists.Expands is
end loop;
end Generate_Muxes;
- procedure Expand_Dyn_Insert (Ctxt : Context_Acc; Inst : Instance)
+ procedure Expand_Dyn_Insert
+ (Ctxt : Context_Acc; Inst : Instance; En : Net)
is
Mem : constant Net := Get_Input_Net (Inst, 0);
Dat : constant Net := Get_Input_Net (Inst, 1);
@@ -413,6 +421,9 @@ package body Netlists.Expands is
Disconnect (Get_Input (Inst, 0));
Disconnect (Get_Input (Inst, 1));
Disconnect (Get_Input (Inst, 2));
+ if En /= No_Net then
+ Disconnect (Get_Input (Inst, 3));
+ end if;
Remove_Instance (Inst);
end Expand_Dyn_Insert;
@@ -456,7 +467,9 @@ package body Netlists.Expands is
Expand_Dyn_Extract (Ctxt, Inst);
when Id_Dyn_Insert =>
- Expand_Dyn_Insert (Ctxt, Inst);
+ Expand_Dyn_Insert (Ctxt, Inst, No_Net);
+ when Id_Dyn_Insert_En =>
+ Expand_Dyn_Insert (Ctxt, Inst, Get_Input_Net (Inst, 3));
when Id_Rol =>
-- a rol b == shl (a, b) | shr (a, l - b)