From f89b112fbf19a751070406449ab78f07b2c5e639 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Wed, 20 Feb 2019 15:35:32 -0800 Subject: [PATCH] write_aiger: fix CI/CO and symbols --- backends/aiger/.xaiger.cc.swo | Bin 0 -> 36864 bytes backends/aiger/xaiger.cc | 20 +++++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 backends/aiger/.xaiger.cc.swo diff --git a/backends/aiger/.xaiger.cc.swo b/backends/aiger/.xaiger.cc.swo new file mode 100644 index 0000000000000000000000000000000000000000..a1272983532268e20e66d4f82b5be9c8144f680d GIT binary patch literal 36864 zcmeI53zTG6S*VKyCw4Fd@ve(;EpShho~fScuI?ViB$H&M`Z1FtJ>8S;o=lpaNvFE% zRL>#RRh2r`Gt)Ce9vDy}l7KI`2Eq71@RHy)x*`Etc!>}(f(i<{5+y!J5JW|JC>X#0 z-}}@#r>eSVdXjb5x>}ulQ+3YXXFvY^{Qtf8siooTbNkKZnc)}= z>X|}e{V=*NT?uq0a1Ih!ZIlKtzbN$syGFFBzr1&=`JNXaJcod~k8~x_l|WYlT?uq0 z(3L<}0$mAoCD4_?|F05g)GkQfM&i$N8MxhjKCk8TJKXhQ_jyN)`}5uPF8BGTE$-jx zuHWoFFLn`x@oaJTPrA={w76g3?ytGem$(Fn&!6w^t8&Blds^I`bN8bwfvyC)66i{x zD}k;Ax)SJ0peuo{1iBLFN}wx&|CSQS7gH(G*{4KbX8r$mCxvfcoJxHL{uq85-U<`& zZ!b)x9)w?qB78sm$wjHukHH@J=kH3T9)SN1zY6b$pMV-vVIH#ZO8B4fKj4`cq*DI@ zPs3yIVfY|C4DW~g;eGIS_*r-ZG@u9tn1GkTmoDU4_yxEFj=*8K0?vnz^`uh22k(V9 zz!Kyk3p=16E`kf;YZxr2!1?gE7+W5NkHh_N7nI?8I0#q4 z_rfz6MV^MI;1A)wa1We>H8=>@!8SM#K1m(;age&OU+TlA|9a%lFPXGo@f*kT+*2J_~vRed?g=O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@@ -232,17 +232,22 @@ struct XAigerWriter co_bits.erase(bit); output_bits.erase(bit); } - // Erase all CIs that are also COs or POs - for (auto bit : co_bits) + // Erase all POs and CIs that are also PIs + for (auto bit : input_bits) { + output_bits.erase(bit); ci_bits.erase(bit); - for (auto bit : output_bits) + } + for (auto bit : output_bits) { + ci_bits.erase(bit); + // POs override COs + co_bits.erase(bit); + } + // Erase all CIs that are also COs + for (auto bit : co_bits) ci_bits.erase(bit); // CIs cannot be undriven for (auto bit : ci_bits) undriven_bits.erase(bit); - // POs override COs - for (auto bit : output_bits) - co_bits.erase(bit); for (auto bit : unused_bits) undriven_bits.erase(bit); @@ -525,7 +530,7 @@ struct XAigerWriter for (int i = 0; i < GetSize(wire); i++) { RTLIL::SigBit b(wire, i); - if (wire->port_input || ci_bits.count(b)) { + if (input_bits.count(b) || ci_bits.count(b)) { int a = aig_map.at(sig[i]); log_assert((a & 1) == 0); input_lines[a] += stringf("input %d %d %s\n", (a >> 1)-1, i, log_id(wire)); @@ -567,6 +572,7 @@ struct XAigerWriter input_lines.sort(); for (auto &it : input_lines) f << it.second; + log_assert(input_lines.size() == input_bits.size() + ci_bits.size()); init_lines.sort(); for (auto &it : init_lines) -- 2.30.2