#include "kernel/register.h"
#include "kernel/celltypes.h"
#include "kernel/log.h"
+#include "kernel/sigtools.h"
#include <stdlib.h>
#include <stdio.h>
#include <set>
CellTypes ct;
RTLIL::Design *design;
RTLIL::Module *module;
+ pool<Wire*> outputs;
bool copy_mode;
std::string opt_name;
if (wire->port_input)
flags.is_ext_driven = true;
- if (wire->port_output)
+ if (wire->port_output || outputs.count(wire))
flags.is_ext_used = true;
bool new_wire_port_input = false;
ct.setup_stdcells_mem();
ct.setup_design(design);
+ SigMap sigmap(module);
+ for (auto port : module->ports) {
+ auto wire = module->wire(port);
+ if (!wire->port_output)
+ continue;
+ auto sig = sigmap(wire);
+ for (auto c : sig.chunks()) {
+ if (!c.wire)
+ continue;
+ if (c.wire == wire)
+ continue;
+ outputs.insert(c.wire);
+ log_dump(c.wire->name);
+ }
+ }
+
if (opt_name.empty())
{
for (auto &it : module->wires_)