diff options
author | Eddie Hung <eddie@fpgeh.com> | 2019-05-27 11:38:52 -0700 |
---|---|---|
committer | Eddie Hung <eddie@fpgeh.com> | 2019-05-27 11:38:52 -0700 |
commit | 03b289a851c62eb2a7e3592432876bfa8a56770b (patch) | |
tree | c15f8380a484cc56423eae46e0d337a81211d4b5 /frontends/aiger/aigerparse.cc | |
parent | 3c8368454f5f9643425bab0065158587b03e2716 (diff) | |
download | yosys-03b289a851c62eb2a7e3592432876bfa8a56770b.tar.gz yosys-03b289a851c62eb2a7e3592432876bfa8a56770b.tar.bz2 yosys-03b289a851c62eb2a7e3592432876bfa8a56770b.zip |
Add 'cinput' and 'coutput' to symbols file for boxes
Diffstat (limited to 'frontends/aiger/aigerparse.cc')
-rw-r--r-- | frontends/aiger/aigerparse.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/frontends/aiger/aigerparse.cc b/frontends/aiger/aigerparse.cc index 94bfdfa3e..2441ee937 100644 --- a/frontends/aiger/aigerparse.cc +++ b/frontends/aiger/aigerparse.cc @@ -704,6 +704,41 @@ void AigerReader::post_process() } } } + else if (type == "cinput" || type == "coutput") { + RTLIL::Wire* wire; + if (type == "cinput") { + log_assert(static_cast<unsigned>(variable) < inputs.size()); + wire = inputs[variable]; + log_assert(wire); + log_assert(wire->port_input); + } + else if (type == "coutput") { + log_assert(static_cast<unsigned>(variable) < outputs.size()); + wire = outputs[variable]; + log_assert(wire); + log_assert(wire->port_output); + } + else log_abort(); + + std::string port; + mf >> port; + RTLIL::IdString cell_name = RTLIL::escape_id(symbol); + RTLIL::IdString cell_port = RTLIL::escape_id(port); + + RTLIL::Cell* cell = module->cell(cell_name); + if (!cell) + cell = module->addCell(cell_name, "$__blackbox__"); + wire->port_input = false; + wire->port_output = false; + if (cell->hasPort(cell_port)) { + log_assert(index == GetSize(cell->getPort(cell_port))); + cell->connections_[cell_port].append(wire); + } + else { + log_assert(index == 0); + cell->setPort(cell_port, wire); + } + } else log_error("Symbol type '%s' not recognised.\n", type.c_str()); } |