diff options
author | Eddie Hung <eddie@fpgeh.com> | 2019-09-30 12:34:28 -0700 |
---|---|---|
committer | Eddie Hung <eddie@fpgeh.com> | 2019-09-30 12:34:28 -0700 |
commit | bd8356799aaee629b747984fd01d3ef4d1182a27 (patch) | |
tree | 5674c4d27d5b62cecf88dd1609a5e7ae0ffa4dcb | |
parent | 8684b58bed2875ab67e9b12912d791f9d588f272 (diff) | |
download | yosys-bd8356799aaee629b747984fd01d3ef4d1182a27.tar.gz yosys-bd8356799aaee629b747984fd01d3ef4d1182a27.tar.bz2 yosys-bd8356799aaee629b747984fd01d3ef4d1182a27.zip |
Use derived module
-rw-r--r-- | backends/aiger/xaiger.cc | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/backends/aiger/xaiger.cc b/backends/aiger/xaiger.cc index 616aca074..6907ccecc 100644 --- a/backends/aiger/xaiger.cc +++ b/backends/aiger/xaiger.cc @@ -808,6 +808,11 @@ struct XAigerWriter int box_count = 0; for (auto cell : box_list) { RTLIL::Module* box_module = module->design->module(cell->type); + if (box_module->get_bool_attribute("\\abc9_flop")) { + auto derived_name = box_module->derive(module->design, cell->parameters); + box_module = module->design->module(derived_name); + } + int box_inputs = 0, box_outputs = 0; Cell *holes_cell = nullptr; if (box_module->get_bool_attribute("\\whitebox")) { @@ -858,28 +863,6 @@ struct XAigerWriter } } - if (box_module->get_bool_attribute("\\abc9_flop")) { - log_assert(holes_cell); - IdString port_name = "\\$currQ"; - Wire* w = box_module->wire(port_name); - SigSpec rhs = cell->getPort(port_name); - log_assert(GetSize(w) == GetSize(rhs)); - SigSpec port_wire; - Wire *holes_wire; - for (int i = 0; i < GetSize(w); i++) { - box_inputs++; - holes_wire = holes_module->wire(stringf("\\i%d", box_inputs)); - if (!holes_wire) { - holes_wire = holes_module->addWire(stringf("\\i%d", box_inputs)); - holes_wire->port_input = true; - holes_wire->port_id = port_id++; - holes_module->ports.push_back(holes_wire->name); - } - port_wire.append(holes_wire); - } - holes_cell->setPort(w->name, port_wire); - } - write_h_buffer(box_inputs); write_h_buffer(box_outputs); write_h_buffer(box_module->attributes.at("\\abc_box_id").as_int()); |