aboutsummaryrefslogtreecommitdiffstats
path: root/frontends/aiger
diff options
context:
space:
mode:
authorEddie Hung <eddie@fpgeh.com>2020-01-07 15:43:22 -0800
committerEddie Hung <eddie@fpgeh.com>2020-01-07 15:43:22 -0800
commit2ca8c10e7a39c1924aa918d0f8235966d6cd3307 (patch)
treec39cc3d0ec1cecfd90bf168ebd5cf70c05b09239 /frontends/aiger
parent8f5388ea5b88d4e848b1110fed2abf7544440185 (diff)
parent66b0f3c406fca11d789b26d85dd27660eacee26c (diff)
downloadyosys-2ca8c10e7a39c1924aa918d0f8235966d6cd3307.tar.gz
yosys-2ca8c10e7a39c1924aa918d0f8235966d6cd3307.tar.bz2
yosys-2ca8c10e7a39c1924aa918d0f8235966d6cd3307.zip
Merge remote-tracking branch 'origin/master' into eddie/abc9_refactor
Diffstat (limited to 'frontends/aiger')
-rw-r--r--frontends/aiger/aigerparse.cc25
1 files changed, 20 insertions, 5 deletions
diff --git a/frontends/aiger/aigerparse.cc b/frontends/aiger/aigerparse.cc
index b18049df1..bded2bfee 100644
--- a/frontends/aiger/aigerparse.cc
+++ b/frontends/aiger/aigerparse.cc
@@ -271,14 +271,24 @@ end_of_header:
if ((c == 'i' && l1 > inputs.size()) || (c == 'l' && l1 > latches.size()) || (c == 'o' && l1 > outputs.size()))
log_error("Line %u has invalid symbol position!\n", line_count);
+ RTLIL::IdString escaped_s = stringf("\\%s", s.c_str());
RTLIL::Wire* wire;
if (c == 'i') wire = inputs[l1];
else if (c == 'l') wire = latches[l1];
- else if (c == 'o') wire = outputs[l1];
+ else if (c == 'o') {
+ wire = module->wire(escaped_s);
+ if (wire) {
+ // Could have been renamed by a latch
+ module->swap_names(wire, outputs[l1]);
+ module->connect(outputs[l1], wire);
+ goto next;
+ }
+ wire = outputs[l1];
+ }
else if (c == 'b') wire = bad_properties[l1];
else log_abort();
- module->rename(wire, stringf("\\%s", s.c_str()));
+ module->rename(wire, escaped_s);
}
else if (c == 'j' || c == 'f') {
// TODO
@@ -293,6 +303,7 @@ end_of_header:
}
else
log_error("Line %u: cannot interpret first character '%c'!\n", line_count, c);
+next:
std::getline(f, line); // Ignore up to start of next line
}
@@ -506,12 +517,14 @@ void AigerReader::parse_aiger_ascii()
clk_wire->port_input = true;
clk_wire->port_output = false;
}
+ digits = ceil(log10(L));
for (unsigned i = 0; i < L; ++i, ++line_count) {
if (!(f >> l1 >> l2))
log_error("Line %u cannot be interpreted as a latch!\n", line_count);
log_debug2("%d %d is a latch\n", l1, l2);
log_assert(!(l1 & 1));
- RTLIL::Wire *q_wire = createWireIfNotExists(module, l1);
+ RTLIL::Wire *q_wire = module->addWire(stringf("$l%0*d", digits, l1 >> 1));
+ module->connect(createWireIfNotExists(module, l1), q_wire);
RTLIL::Wire *d_wire = createWireIfNotExists(module, l2);
if (clk_wire)
@@ -629,12 +642,14 @@ void AigerReader::parse_aiger_binary()
clk_wire->port_input = true;
clk_wire->port_output = false;
}
+ digits = ceil(log10(L));
l1 = (I+1) * 2;
for (unsigned i = 0; i < L; ++i, ++line_count, l1 += 2) {
if (!(f >> l2))
log_error("Line %u cannot be interpreted as a latch!\n", line_count);
log_debug("%d %d is a latch\n", l1, l2);
- RTLIL::Wire *q_wire = createWireIfNotExists(module, l1);
+ RTLIL::Wire *q_wire = module->addWire(stringf("$l%0*d", digits, l1 >> 1));
+ module->connect(createWireIfNotExists(module, l1), q_wire);
RTLIL::Wire *d_wire = createWireIfNotExists(module, l2);
if (clk_wire)
@@ -946,7 +961,7 @@ struct AigerFrontend : public Frontend {
{
log_header(design, "Executing AIGER frontend.\n");
- RTLIL::IdString clk_name = "\\clk";
+ RTLIL::IdString clk_name;
RTLIL::IdString module_name;
std::string map_filename;
bool wideports = false, xaiger = false;