aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/netlists-inference.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-07-11 07:30:46 +0200
committerTristan Gingold <tgingold@free.fr>2022-07-11 07:30:46 +0200
commit493d10f3c362620c24365440de7480b4bf49818e (patch)
tree9dc48c23ae0efebae66206eb9ecd064a9fcd2d91 /src/synth/netlists-inference.adb
parentaad4702adb85eeb15ce666643f386ba171ddc675 (diff)
downloadghdl-493d10f3c362620c24365440de7480b4bf49818e.tar.gz
ghdl-493d10f3c362620c24365440de7480b4bf49818e.tar.bz2
ghdl-493d10f3c362620c24365440de7480b4bf49818e.zip
netlists-inference: detect false loops only for variables. Fix #2125
Diffstat (limited to 'src/synth/netlists-inference.adb')
-rw-r--r--src/synth/netlists-inference.adb5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/synth/netlists-inference.adb b/src/synth/netlists-inference.adb
index 383211684..9c44b218c 100644
--- a/src/synth/netlists-inference.adb
+++ b/src/synth/netlists-inference.adb
@@ -747,12 +747,13 @@ package body Netlists.Inference is
function Infere_Latch (Ctxt : Context_Acc;
Val : Net;
Prev_Val : Net;
+ Last_Use : Boolean;
Loc : Location_Type) return Net
is
Name : Sname;
begin
-- In case of false loop, do not close the loop but assign X.
- if Is_False_Loop (Prev_Val) then
+ if Last_Use and then Is_False_Loop (Prev_Val) then
return Build_Const_X (Ctxt, Get_Width (Val));
end if;
@@ -862,7 +863,7 @@ package body Netlists.Inference is
Extract_Clock (Ctxt, Get_Driver (Sel), Clk, Enable);
if Clk = No_Net then
-- No clock -> latch or combinational loop
- Res := Infere_Latch (Ctxt, Val, Prev_Val, Loc);
+ Res := Infere_Latch (Ctxt, Val, Prev_Val, Last_Use, Loc);
else
-- Clock -> FF
First_Mux := Get_Net_Parent (Val);