diff options
author | Eddie Hung <eddie@fpgeh.com> | 2020-01-13 19:07:55 -0800 |
---|---|---|
committer | Eddie Hung <eddie@fpgeh.com> | 2020-01-13 19:07:55 -0800 |
commit | 9ec948f3965eef214bee3af778b67fdd6ee86929 (patch) | |
tree | dfe7b7b345876c0d172647a36ebaceeb752a2ae2 /backends | |
parent | 0d2c06ee47a5008ba79d14d52f72d9b08ac2c7fc (diff) | |
download | yosys-9ec948f3965eef214bee3af778b67fdd6ee86929.tar.gz yosys-9ec948f3965eef214bee3af778b67fdd6ee86929.tar.bz2 yosys-9ec948f3965eef214bee3af778b67fdd6ee86929.zip |
write_xaiger: add support and test for (* keep *) on wires
Diffstat (limited to 'backends')
-rw-r--r-- | backends/aiger/xaiger.cc | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/backends/aiger/xaiger.cc b/backends/aiger/xaiger.cc index 0c08645d0..2a0f5c7e4 100644 --- a/backends/aiger/xaiger.cc +++ b/backends/aiger/xaiger.cc @@ -156,7 +156,6 @@ struct XAigerWriter if (wire->get_bool_attribute(ID::keep)) sigmap.add(wire); - for (auto wire : module->wires()) for (int i = 0; i < GetSize(wire); i++) { @@ -174,10 +173,11 @@ struct XAigerWriter undriven_bits.insert(bit); unused_bits.insert(bit); - if (wire->port_input) + bool keep = wire->get_bool_attribute(ID::keep); + if (wire->port_input || keep) input_bits.insert(bit); - if (wire->port_output) { + if (wire->port_output || keep) { if (bit != wirebit) alias_map[wirebit] = bit; output_bits.insert(wirebit); @@ -209,9 +209,9 @@ struct XAigerWriter } if (cell->type == "$__ABC9_FF_" && - // The presence of an abc9_mergeability attribute indicates - // that we do want to pass this flop to ABC - cell->attributes.count("\\abc9_mergeability")) + // The presence of an abc9_mergeability attribute indicates + // that we do want to pass this flop to ABC + cell->attributes.count("\\abc9_mergeability")) { SigBit D = sigmap(cell->getPort("\\D").as_bit()); SigBit Q = sigmap(cell->getPort("\\Q").as_bit()); @@ -430,7 +430,17 @@ struct XAigerWriter for (const auto &bit : output_bits) { ordered_outputs[bit] = aig_o++; - aig_outputs.push_back(bit2aig(bit)); + int aig; + if (input_bits.count(bit)) { + auto it = aig_map.find(bit); + int input_aig = it->second; + aig_map.erase(it); + aig = bit2aig(bit); + aig_map.at(bit) = input_aig; + } + else + aig = bit2aig(bit); + aig_outputs.push_back(aig); } for (auto &i : ff_bits) { |