aboutsummaryrefslogtreecommitdiffstats
path: root/passes/techmap/deminout.cc
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2018-06-19 14:29:38 +0200
committerClifford Wolf <clifford@clifford.at>2018-06-19 14:29:38 +0200
commit675a44b41a2df2c02ceccda2434bc3efac3e5e2f (patch)
tree0f83f931b583c879af75b267fbeb94cc27288a8f /passes/techmap/deminout.cc
parent25c5002f8367043ca3ec7e8f5ad9c1dd53a381c2 (diff)
downloadyosys-675a44b41a2df2c02ceccda2434bc3efac3e5e2f.tar.gz
yosys-675a44b41a2df2c02ceccda2434bc3efac3e5e2f.tar.bz2
yosys-675a44b41a2df2c02ceccda2434bc3efac3e5e2f.zip
Be slightly less aggressive in "deminout" pass
Signed-off-by: Clifford Wolf <clifford@clifford.at>
Diffstat (limited to 'passes/techmap/deminout.cc')
-rw-r--r--passes/techmap/deminout.cc32
1 files changed, 28 insertions, 4 deletions
diff --git a/passes/techmap/deminout.cc b/passes/techmap/deminout.cc
index ed4e45762..0b8fd5246 100644
--- a/passes/techmap/deminout.cc
+++ b/passes/techmap/deminout.cc
@@ -57,7 +57,7 @@ struct DeminoutPass : public Pass {
for (auto module : design->selected_modules())
{
SigMap sigmap(module);
- pool<SigBit> bits_written, bits_used, bits_inout;
+ pool<SigBit> bits_written, bits_used, bits_inout, bits_tribuf;
dict<SigBit, int> bits_numports;
for (auto wire : module->wires())
@@ -82,6 +82,25 @@ struct DeminoutPass : public Pass {
if (cellport_in)
for (auto bit : sigmap(conn.second))
bits_used.insert(bit);
+
+ if (conn.first == "\\Y" && cell->type.in("$mux", "$pmux", "$_MUX_", "$_TBUF_"))
+ {
+ bool tribuf = (cell->type == "$_TBUF_");
+
+ if (!tribuf) {
+ for (auto &c : cell->connections()) {
+ if (!c.first.in("\\A", "\\B"))
+ continue;
+ for (auto b : sigmap(c.second))
+ if (b == State::Sz)
+ tribuf = true;
+ }
+ }
+
+ if (tribuf)
+ for (auto bit : sigmap(conn.second))
+ bits_tribuf.insert(bit);
+ }
}
for (auto wire : module->selected_wires())
@@ -95,10 +114,15 @@ struct DeminoutPass : public Pass {
if (bits_numports[bit] > 1 || bits_inout.count(bit))
new_input = true, new_output = true;
- if (bits_written.count(bit))
+ if (bits_written.count(bit)) {
new_output = true;
- else if (bits_used.count(bit))
- new_input = true;
+ if (bits_tribuf.count(bit))
+ goto tribuf_bit;
+ } else {
+ tribuf_bit:
+ if (bits_used.count(bit))
+ new_input = true;
+ }
}
if (new_input != new_output) {