From d07828b40958c6c2a1d09cf13c9a307c75b855b4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marcelina=20Ko=C5=9Bcielnicka?= Date: Tue, 7 Jun 2022 04:26:25 +0200 Subject: [PATCH] opt_ffinv: Harden against simple ff/inv loop. --- passes/opt/opt_ffinv.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/passes/opt/opt_ffinv.cc b/passes/opt/opt_ffinv.cc index fd76dd2be..fe5b59fa5 100644 --- a/passes/opt/opt_ffinv.cc +++ b/passes/opt/opt_ffinv.cc @@ -72,6 +72,8 @@ struct OptFfInvWorker for (auto &port: q_ports) { if (port.cell == ff.cell && port.port == ID::Q) continue; + if (port.cell == d_inv) + return false; if (port.port != ID::A) return false; if (!port.cell->type.in(ID($not), ID($_NOT_), ID($lut))) @@ -148,6 +150,8 @@ struct OptFfInvWorker for (auto &port: q_ports) { if (port.cell == ff.cell && port.port == ID::Q) continue; + if (port.cell == d_lut) + return false; if (port.port != ID::A) return false; if (port.cell->type.in(ID($not), ID($_NOT_))) { -- 2.30.2