aboutsummaryrefslogtreecommitdiffstats
path: root/frontends/aiger
diff options
context:
space:
mode:
authorEddie Hung <eddie@fpgeh.com>2019-04-12 17:02:24 -0700
committerEddie Hung <eddie@fpgeh.com>2019-04-12 17:02:24 -0700
commitacf3f5694bb0cd9911566855df27c17e7e82b8cc (patch)
treefa9ff19efe562f6ce6dc53d43817b75397df35b3 /frontends/aiger
parentd880f73c79d897107a54f7734c2a1dea302c930c (diff)
downloadyosys-acf3f5694bb0cd9911566855df27c17e7e82b8cc.tar.gz
yosys-acf3f5694bb0cd9911566855df27c17e7e82b8cc.tar.bz2
yosys-acf3f5694bb0cd9911566855df27c17e7e82b8cc.zip
Fix inout handling for -map option
Diffstat (limited to 'frontends/aiger')
-rw-r--r--frontends/aiger/aigerparse.cc40
1 files changed, 30 insertions, 10 deletions
diff --git a/frontends/aiger/aigerparse.cc b/frontends/aiger/aigerparse.cc
index b752d3127..009b28455 100644
--- a/frontends/aiger/aigerparse.cc
+++ b/frontends/aiger/aigerparse.cc
@@ -439,7 +439,7 @@ next_line:
std::string type, symbol;
int variable, index;
while (mf >> type >> variable >> index >> symbol) {
- RTLIL::IdString escaped_symbol = RTLIL::escape_id(symbol);
+ RTLIL::IdString escaped_s = RTLIL::escape_id(symbol);
if (type == "input") {
log_assert(static_cast<unsigned>(variable) < inputs.size());
RTLIL::Wire* wire = inputs[variable];
@@ -447,11 +447,11 @@ next_line:
log_assert(wire->port_input);
if (index == 0)
- module->rename(wire, escaped_symbol);
+ module->rename(wire, escaped_s);
else if (index > 0) {
- module->rename(wire, stringf("%s[%d]", escaped_symbol.c_str(), index));
+ module->rename(wire, stringf("%s[%d]", escaped_s.c_str(), index));
if (wideports)
- wideports_cache[escaped_symbol] = std::max(wideports_cache[escaped_symbol], index);
+ wideports_cache[escaped_s] = std::max(wideports_cache[escaped_s], index);
}
}
else if (type == "output") {
@@ -460,12 +460,32 @@ next_line:
log_assert(wire);
log_assert(wire->port_output);
- if (index == 0)
- module->rename(wire, escaped_symbol);
- else if (index > 0) {
- module->rename(wire, stringf("%s[%d]", escaped_symbol.c_str(), index));
- if (wideports)
- wideports_cache[escaped_symbol] = std::max(wideports_cache[escaped_symbol], index);
+ if (index == 0) {
+ if (escaped_s.ends_with("$inout.out")) {
+ wire->port_output = false;
+ RTLIL::Wire *in_wire = module->wire(escaped_s.substr(0, escaped_s.size()-10));
+ log_assert(in_wire);
+ log_assert(in_wire->port_input && !in_wire->port_output);
+ in_wire->port_output = true;
+ module->connect(in_wire, wire);
+ }
+ else
+ module->rename(wire, escaped_s);
+ }
+ else if (index > 0) {
+ if (escaped_s.ends_with("$inout.out")) {
+ wire->port_output = false;
+ RTLIL::Wire *in_wire = module->wire(stringf("%s[%d]", escaped_s.substr(0, escaped_s.size()-10).c_str(), index));
+ log_assert(in_wire);
+ log_assert(in_wire->port_input && !in_wire->port_output);
+ in_wire->port_output = true;
+ module->connect(in_wire, wire);
+ }
+ else {
+ module->rename(wire, stringf("%s[%d]", escaped_s.c_str(), index));
+ if (wideports)
+ wideports_cache[escaped_s] = std::max(wideports_cache[escaped_s], index);
+ }
}
}
else