WIP: less strict pin matching (for top levels with/without pins). Fixed tests.

This commit is contained in:
Matthias Koefferlein 2019-04-14 19:22:07 +02:00
parent 699e94a45f
commit 9f3bea92fb
2 changed files with 71 additions and 56 deletions

View File

@ -1599,6 +1599,7 @@ NetlistComparer::compare (const db::Netlist *a, const db::Netlist *b) const
if (mp_logger) { if (mp_logger) {
mp_logger->circuit_skipped (ca, cb); mp_logger->circuit_skipped (ca, cb);
good = false;
} }
} }
@ -1849,6 +1850,8 @@ NetlistComparer::compare_circuits (const db::Circuit *c1, const db::Circuit *c2,
// Report pin assignment // Report pin assignment
// This step also does the pin identity mapping. // This step also does the pin identity mapping.
if (c1->pin_count () > 0 && c2->pin_count () > 0) {
std::multimap<size_t, const db::Pin *> net2pin; std::multimap<size_t, const db::Pin *> net2pin;
for (db::Circuit::const_pin_iterator p = c2->begin_pins (); p != c2->end_pins (); ++p) { for (db::Circuit::const_pin_iterator p = c2->begin_pins (); p != c2->end_pins (); ++p) {
const db::Net *net = c2->net_for_pin (p->id ()); const db::Net *net = c2->net_for_pin (p->id ());
@ -1920,6 +1923,18 @@ NetlistComparer::compare_circuits (const db::Circuit *c1, const db::Circuit *c2,
good = false; good = false;
} }
} else {
// skip pin mapping in case one circuit does not feature pins
// This is often the case for top-level circuits. We don't necessarily need pins for them.
// We still report those circuits with "pin mismatch" so they don't get considered within
// subcircuits.
if (c1->pin_count () != c2->pin_count ()) {
pin_mismatch = true;
}
}
// Report device assignment // Report device assignment

View File

@ -2033,10 +2033,10 @@ TEST(16_UniqueSubCircuitMatching)
"match_nets $I13 $I13\n" "match_nets $I13 $I13\n"
"match_nets $I23 $I23\n" "match_nets $I23 $I23\n"
"match_nets $I5 $I5\n" "match_nets $I5 $I5\n"
"match_nets $I24 $I24\n"
"match_nets $I6 $I6\n"
"match_nets $I7 $I7\n" "match_nets $I7 $I7\n"
"match_nets $I25 $I25\n" "match_nets $I25 $I25\n"
"match_nets $I6 $I6\n"
"match_nets $I24 $I24\n"
"match_subcircuits $1 $1\n" "match_subcircuits $1 $1\n"
"match_subcircuits $4 $2\n" "match_subcircuits $4 $2\n"
"match_subcircuits $3 $3\n" "match_subcircuits $3 $3\n"