From 5225faf76fd5638863711f4ca40ce7353e179e33 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Thu, 23 Apr 2020 07:47:13 +0200 Subject: netlists-inference: adjust guard. Fix ghdl/ghdl-yosys-plugin#110 --- src/synth/netlists-inference.adb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/synth/netlists-inference.adb b/src/synth/netlists-inference.adb index 12c689123..9ec445901 100644 --- a/src/synth/netlists-inference.adb +++ b/src/synth/netlists-inference.adb @@ -845,8 +845,16 @@ package body Netlists.Inference is -- No logical loop or self assignment. return Val; end if; - if Last_Use and then Has_One_Connection (Prev_Val) then + if Last_Use + and then Has_One_Connection (Prev_Val) + and then not Is_Connected (Val) + then -- Value is not used, to be removed. Do not try to infere anything. + -- Conditions: + -- * last_use must be true: the signal won't be use after the call + -- to infere (because it goes out of scope). + -- * Prev_val must be connected once (to create a loop). + -- * Val must not be connected (for variables). return Val; end if; -- cgit v1.2.3