aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-04-24 06:39:13 +0200
committerTristan Gingold <tgingold@free.fr>2020-04-24 06:39:13 +0200
commitfc1f68e9df9fb41e3c9d279366b8b95f5c8cc9ca (patch)
treec5f0cade53b0ea8704ef29feceecc2653ef421b3
parent8836b83f3878d93d19aa716ac65e30a591178c27 (diff)
downloadghdl-fc1f68e9df9fb41e3c9d279366b8b95f5c8cc9ca.tar.gz
ghdl-fc1f68e9df9fb41e3c9d279366b8b95f5c8cc9ca.tar.bz2
ghdl-fc1f68e9df9fb41e3c9d279366b8b95f5c8cc9ca.zip
synth-environment: add an optimization. Fix #1258
This optimization is important for the control wires to avoid false paths.
-rw-r--r--src/synth/synth-environment.adb4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/synth/synth-environment.adb b/src/synth/synth-environment.adb
index f11c3f274..03acc2478 100644
--- a/src/synth/synth-environment.adb
+++ b/src/synth/synth-environment.adb
@@ -1285,6 +1285,10 @@ package body Synth.Environment is
N (0), Get_Driver (Get_Mux2_I1 (N1_Inst)));
end if;
end;
+ elsif N (0) = N (1) then
+ -- Minor optimization: no need to add a mux if both sides are
+ -- equal. But this is important for the control wires.
+ Res := N (0);
else
Res := Build_Mux2 (Ctxt, Sel, N (0), N (1));
end if;