diff options
author | Eddie Hung <eddie@fpgeh.com> | 2019-04-16 16:37:47 -0700 |
---|---|---|
committer | Eddie Hung <eddie@fpgeh.com> | 2019-04-16 16:37:47 -0700 |
commit | e7a8955818b8b0fee02673607b429f1de0f7164e (patch) | |
tree | 74ee94fca4c53ddb3da5bc4ec9096f065563784e /backends/aiger/xaiger.cc | |
parent | b015ed48f7039f6b4d50c466d79d1d081952957e (diff) | |
download | yosys-e7a8955818b8b0fee02673607b429f1de0f7164e.tar.gz yosys-e7a8955818b8b0fee02673607b429f1de0f7164e.tar.bz2 yosys-e7a8955818b8b0fee02673607b429f1de0f7164e.zip |
CIs before PIs; also sort each cell's connections before iterating
Diffstat (limited to 'backends/aiger/xaiger.cc')
-rw-r--r-- | backends/aiger/xaiger.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/backends/aiger/xaiger.cc b/backends/aiger/xaiger.cc index 66ab3878e..ce93ffb28 100644 --- a/backends/aiger/xaiger.cc +++ b/backends/aiger/xaiger.cc @@ -215,6 +215,7 @@ struct XAigerWriter RTLIL::Module* box_module = module->design->module(cell->type); bool abc_box = box_module && box_module->attributes.count("\\abc_box_id"); + cell->connections_.sort(RTLIL::sort_by_id_str()); for (const auto &c : cell->connections()) { /*if (c.second.is_fully_const()) continue;*/ for (auto b : c.second.bits()) { @@ -313,15 +314,15 @@ struct XAigerWriter aig_map[State::S0] = 0; aig_map[State::S1] = 1; - for (auto &c : ci_bits) { + for (auto bit : input_bits) { aig_m++, aig_i++; - c.second = 2*aig_m; - aig_map[c.first] = c.second; + aig_map[bit] = 2*aig_m; } - for (auto bit : input_bits) { + for (auto &c : ci_bits) { aig_m++, aig_i++; - aig_map[bit] = 2*aig_m; + c.second = 2*aig_m; + aig_map[c.first] = c.second; } if (imode && input_bits.empty()) { @@ -585,6 +586,7 @@ struct XAigerWriter holes_cell = holes_module->addCell(stringf("\\u%d", box_id), cell->type); RTLIL::Wire *holes_wire; int num_inputs = 0; + // NB: cell->connections_ already sorted from before for (const auto &c : cell->connections()) { if (cell->input(c.first)) { box_inputs += c.second.size(); |