From 493d10f3c362620c24365440de7480b4bf49818e Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Mon, 11 Jul 2022 07:30:46 +0200 Subject: netlists-inference: detect false loops only for variables. Fix #2125 --- src/synth/netlists-inference.adb | 5 +++-- 1 file 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); -- cgit v1.2.3