Fold loop
authorEddie Hung <eddie@fpgeh.com>
Mon, 25 Nov 2019 23:43:37 +0000 (15:43 -0800)
committerEddie Hung <eddie@fpgeh.com>
Mon, 25 Nov 2019 23:43:37 +0000 (15:43 -0800)
backends/aiger/xaiger.cc

index 763a14909131c4c543224996d3c8e7bfad8c74c7..37ef30522c9dc499ccb88df218ecbbf18f1ed331 100644 (file)
@@ -189,6 +189,7 @@ struct XAigerWriter
                                        if (bit != wirebit)
                                                alias_map[bit] = wirebit;
                                        input_bits.insert(wirebit);
+                                       undriven_bits.erase(bit);
                                }
 
                                if (wire->port_output || keep) {
@@ -196,6 +197,8 @@ struct XAigerWriter
                                                if (bit != wirebit)
                                                        alias_map[wirebit] = bit;
                                                output_bits.insert(wirebit);
+                                               if (!wire->port_input)
+                                                       unused_bits.erase(bit);
                                        }
                                        else
                                                log_debug("Skipping PO '%s' driven by 1'bx\n", log_signal(wirebit));
@@ -203,12 +206,6 @@ struct XAigerWriter
                        }
                }
 
-               for (auto bit : input_bits)
-                       undriven_bits.erase(sigmap(bit));
-               for (auto bit : output_bits)
-                       if (!bit.wire->port_input)
-                               unused_bits.erase(bit);
-
                // TODO: Speed up toposort -- ultimately we care about
                //       box ordering, but not individual AIG cells
                dict<SigBit, pool<IdString>> bit_drivers, bit_users;