aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-10-14 06:48:56 +0200
committerTristan Gingold <tgingold@free.fr>2019-10-14 06:48:56 +0200
commit8603cf148413f4e0c0cdcfd61dea2ac7f37b6bc0 (patch)
tree962f0611ff961010650037dcc8ea74652f6aa596
parent6c529cda8ddfd60f2e9ffdfa839b4aacfc6bfe30 (diff)
downloadghdl-8603cf148413f4e0c0cdcfd61dea2ac7f37b6bc0.tar.gz
ghdl-8603cf148413f4e0c0cdcfd61dea2ac7f37b6bc0.tar.bz2
ghdl-8603cf148413f4e0c0cdcfd61dea2ac7f37b6bc0.zip
synth-infere: fix partial assignment with clock enable.
-rw-r--r--src/synth/synth-inference.adb11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/synth/synth-inference.adb b/src/synth/synth-inference.adb
index ea976bd45..5d2477dc6 100644
--- a/src/synth/synth-inference.adb
+++ b/src/synth/synth-inference.adb
@@ -364,8 +364,14 @@ package body Synth.Inference is
-- keep the previous value if the condition is false. Add the mux
-- for it.
if Enable /= No_Net then
- Data := Build_Mux2 (Ctxt, Enable, Prev_Val, Data);
- Copy_Location (Data, Enable);
+ declare
+ Prev : Net;
+ begin
+ Prev := Build2_Extract (Ctxt, Prev_Val, Off, Get_Width (Data));
+
+ Data := Build_Mux2 (Ctxt, Enable, Prev, Data);
+ Copy_Location (Data, Enable);
+ end;
end if;
-- Create the FF.
@@ -529,6 +535,7 @@ package body Synth.Inference is
Add_Conc_Assign (Wid, Val, Off, Stmt);
end Infere_Latch;
+ -- Note: PREV_VAL is the wire gate, so with full width and no offset.
procedure Infere (Ctxt : Context_Acc;
Wid : Wire_Id;
Val : Net;