aboutsummaryrefslogtreecommitdiffstats
path: root/passes/techmap
diff options
context:
space:
mode:
authorMarcelina Koƛcielnicka <mwk@0x04.net>2020-08-05 12:28:18 +0200
committerMarcelina Koƛcielnicka <mwk@0x04.net>2020-08-05 12:28:18 +0200
commitb4a4cb081de717a7f6de89914f8f5ffec959b0c3 (patch)
treea99b7d104001a9afc759071f8bfcdbeb557335f2 /passes/techmap
parentc39ebe6ae0e41cf9a84da852fa3cf9f71937a9b2 (diff)
downloadyosys-b4a4cb081de717a7f6de89914f8f5ffec959b0c3.tar.gz
yosys-b4a4cb081de717a7f6de89914f8f5ffec959b0c3.tar.bz2
yosys-b4a4cb081de717a7f6de89914f8f5ffec959b0c3.zip
techmap.CONSTMAP: Handle outputs before inputs.
Fixes #2321.
Diffstat (limited to 'passes/techmap')
-rw-r--r--passes/techmap/techmap.cc23
1 files changed, 22 insertions, 1 deletions
diff --git a/passes/techmap/techmap.cc b/passes/techmap/techmap.cc
index c22ae8ef0..8d16a2bae 100644
--- a/passes/techmap/techmap.cc
+++ b/passes/techmap/techmap.cc
@@ -801,11 +801,31 @@ struct TechmapWorker
}
}
+ // Handle outputs first, as these cannot be remapped.
for (auto &conn : cell->connections())
+ {
+ Wire *twire = tpl->wire(conn.first);
+ if (!twire->port_output)
+ continue;
+
+ for (int i = 0; i < GetSize(conn.second); i++) {
+ RTLIL::SigBit bit = sigmap(conn.second[i]);
+ RTLIL::SigBit tplbit(twire, i);
+ cellbits_to_tplbits[bit] = tplbit;
+ }
+ }
+
+ // Now handle inputs, remapping as necessary.
+ for (auto &conn : cell->connections())
+ {
+ Wire *twire = tpl->wire(conn.first);
+ if (twire->port_output)
+ continue;
+
for (int i = 0; i < GetSize(conn.second); i++)
{
RTLIL::SigBit bit = sigmap(conn.second[i]);
- RTLIL::SigBit tplbit(tpl->wire(conn.first), i);
+ RTLIL::SigBit tplbit(twire, i);
if (bit.wire == nullptr)
{
@@ -820,6 +840,7 @@ struct TechmapWorker
else
cellbits_to_tplbits[bit] = tplbit;
}
+ }
RTLIL::SigSig port_conn;
for (auto &it : port_connmap) {