diff options
author | Jannis Harder <me@jix.one> | 2022-12-09 15:02:58 +0100 |
---|---|---|
committer | Jannis Harder <me@jix.one> | 2022-12-12 17:51:01 +0100 |
commit | 4a0ed35aab1c7ff85e20f5be6776f101d421290e (patch) | |
tree | f9667b235f393da9fc012fa3abf8443ea7ff7573 | |
parent | 6a6e1d8424a0232c385676e8ee3dabfa91b5d113 (diff) | |
download | yosys-4a0ed35aab1c7ff85e20f5be6776f101d421290e.tar.gz yosys-4a0ed35aab1c7ff85e20f5be6776f101d421290e.tar.bz2 yosys-4a0ed35aab1c7ff85e20f5be6776f101d421290e.zip |
xprop: Improve signal splitting code
Avoid splitting output ports twice when combining -split-outputs with
-split-public and clean up the corresponding code.
-rw-r--r-- | passes/cmds/xprop.cc | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/passes/cmds/xprop.cc b/passes/cmds/xprop.cc index fa1976b34..5dee72e1b 100644 --- a/passes/cmds/xprop.cc +++ b/passes/cmds/xprop.cc @@ -967,7 +967,7 @@ struct XpropWorker if (!options.split_inputs && !options.split_outputs) return; - vector<IdString> new_ports; + int port_id = 1; for (auto port : module->ports) { auto wire = module->wire(port); @@ -983,16 +983,21 @@ struct XpropWorker wire_d->port_input = wire->port_input; wire_d->port_output = wire->port_output; - wire_d->port_id = GetSize(new_ports) + 1; + wire_d->port_id = port_id++; wire_x->port_input = wire->port_input; wire_x->port_output = wire->port_output; - wire_x->port_id = GetSize(new_ports) + 2; + wire_x->port_id = port_id++; if (wire->port_output) { auto enc = encoded(wire); module->connect(wire_d, enc.is_1); module->connect(wire_x, enc.is_x); + + if (options.split_public) { + // Need to hide the original wire so split_public doesn't try to split it again + module->rename(wire, NEW_ID_SUFFIX(wire->name.c_str())); + } } else { auto enc = encoded(wire, true); @@ -1004,18 +1009,12 @@ struct XpropWorker wire->port_input = wire->port_output = false; wire->port_id = 0; - new_ports.push_back(port_d); - new_ports.push_back(port_x); - continue; } } - wire->port_id = GetSize(new_ports) + 1; - new_ports.push_back(port); + wire->port_id = port_id++; } - module->ports = new_ports; - module->fixup_ports(); } @@ -1037,10 +1036,7 @@ struct XpropWorker module->connect(wire_d, enc.is_1); module->connect(wire_x, enc.is_x); - module->wires_.erase(wire->name); - wire->attributes.erase(ID::fsm_encoding); - wire->name = NEW_ID_SUFFIX(wire->name.c_str()); - module->wires_[wire->name] = wire; + module->rename(wire, NEW_ID_SUFFIX(wire->name.c_str())); } } |