From c96e19bd436022d214cede1dcaf11910cfadbdf1 Mon Sep 17 00:00:00 2001 From: Lofty Date: Tue, 10 May 2022 19:12:39 +0100 Subject: [PATCH] abc9: break conflict between boxes and outputs --- backends/aiger/xaiger.cc | 6 +++++- tests/various/bug3311.ys | 29 +++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 tests/various/bug3311.ys diff --git a/backends/aiger/xaiger.cc b/backends/aiger/xaiger.cc index e223f185e..755f32ce1 100644 --- a/backends/aiger/xaiger.cc +++ b/backends/aiger/xaiger.cc @@ -432,8 +432,12 @@ struct XAigerWriter // that has been padded to its full width if (bit == State::Sx) continue; + // A bit might be simultaneously a box output + // and a primary output. The latter wins. + if (input_bits.count(bit)) + continue; if (aig_map.count(bit)) - log_error("Visited AIG node more than once; this could be a combinatorial loop that has not been broken\n"); + log_error("While visiting box outputs, found a signal bit more than once; this could be a combinatorial loop that has not been broken\n"); aig_map[bit] = 2*aig_m; } diff --git a/tests/various/bug3311.ys b/tests/various/bug3311.ys new file mode 100644 index 000000000..59f0f58a8 --- /dev/null +++ b/tests/various/bug3311.ys @@ -0,0 +1,29 @@ +read_rtlil <