diff options
author | Eddie Hung <eddieh@ece.ubc.ca> | 2019-02-08 08:37:18 -0800 |
---|---|---|
committer | Eddie Hung <eddieh@ece.ubc.ca> | 2019-02-08 08:37:18 -0800 |
commit | 5e24251a61b8798e597ac49bdc8aff2f378f625d (patch) | |
tree | 83b73fa9e48a41aa47e57efcab1c152213f604f8 /frontends/aiger/aigerparse.cc | |
parent | 652e414392b8e9e8c7dde74e6f2c2369d8d65a20 (diff) | |
download | yosys-5e24251a61b8798e597ac49bdc8aff2f378f625d.tar.gz yosys-5e24251a61b8798e597ac49bdc8aff2f378f625d.tar.bz2 yosys-5e24251a61b8798e597ac49bdc8aff2f378f625d.zip |
Handle reset logic in latches
Diffstat (limited to 'frontends/aiger/aigerparse.cc')
-rw-r--r-- | frontends/aiger/aigerparse.cc | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/frontends/aiger/aigerparse.cc b/frontends/aiger/aigerparse.cc index 0414d3db3..c3cc6b321 100644 --- a/frontends/aiger/aigerparse.cc +++ b/frontends/aiger/aigerparse.cc @@ -134,8 +134,23 @@ static void parse_aiger_ascii(RTLIL::Design *design, std::istream &f, std::strin RTLIL::Wire *d_wire = createWireIfNotExists(l2); module->addDff(NEW_ID, clk_wire, d_wire, q_wire); - // AIGER latches are assumed to be initialized to zero - q_wire->attributes["\\init"] = RTLIL::Const(0); + + if (f.peek() == ' ') { + if (!(f >> l3)) + log_error("Line %d cannot be interpreted as a latch!\n", line_count); + + if (l3 == 0 || l3 == 1) + q_wire->attributes["\\init"] = RTLIL::Const(0); + else if (l3 == l1) { + //q_wire->attributes["\\init"] = RTLIL::Const(RTLIL::State::Sx); + } + else + log_error("Line %d has invalid reset literal for latch!\n", line_count); + } + else { + // AIGER latches are assumed to be initialized to zero + q_wire->attributes["\\init"] = RTLIL::Const(0); + } latches.push_back(q_wire); } |