mirror of https://github.com/YosysHQ/yosys.git
write_xaiger: simplify c{i,o}_bits
This commit is contained in:
parent
b7afafde22
commit
36d79c80d0
|
@ -81,8 +81,7 @@ struct XAigerWriter
|
||||||
pool<SigBit> input_bits, output_bits;
|
pool<SigBit> input_bits, output_bits;
|
||||||
dict<SigBit, SigBit> not_map, alias_map;
|
dict<SigBit, SigBit> not_map, alias_map;
|
||||||
dict<SigBit, pair<SigBit, SigBit>> and_map;
|
dict<SigBit, pair<SigBit, SigBit>> and_map;
|
||||||
vector<std::tuple<SigBit,RTLIL::Cell*,RTLIL::IdString,int>> ci_bits;
|
vector<SigBit> ci_bits, co_bits;
|
||||||
vector<std::tuple<SigBit,RTLIL::Cell*,RTLIL::IdString,int,int>> co_bits;
|
|
||||||
dict<SigBit, float> arrival_times;
|
dict<SigBit, float> arrival_times;
|
||||||
|
|
||||||
vector<pair<int, int>> aig_gates;
|
vector<pair<int, int>> aig_gates;
|
||||||
|
@ -376,7 +375,6 @@ struct XAigerWriter
|
||||||
cell->setPort(port_name, rhs);
|
cell->setPort(port_name, rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
int offset = 0;
|
|
||||||
for (auto b : rhs.bits()) {
|
for (auto b : rhs.bits()) {
|
||||||
SigBit I = sigmap(b);
|
SigBit I = sigmap(b);
|
||||||
if (b == RTLIL::Sx)
|
if (b == RTLIL::Sx)
|
||||||
|
@ -387,7 +385,7 @@ struct XAigerWriter
|
||||||
else
|
else
|
||||||
alias_map[b] = I;
|
alias_map[b] = I;
|
||||||
}
|
}
|
||||||
co_bits.emplace_back(b, cell, port_name, offset++, 0);
|
co_bits.emplace_back(b);
|
||||||
unused_bits.erase(b);
|
unused_bits.erase(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -407,9 +405,8 @@ struct XAigerWriter
|
||||||
cell->setPort(port_name, rhs);
|
cell->setPort(port_name, rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
int offset = 0;
|
|
||||||
for (const auto &b : rhs.bits()) {
|
for (const auto &b : rhs.bits()) {
|
||||||
ci_bits.emplace_back(b, cell, port_name, offset++);
|
ci_bits.emplace_back(b);
|
||||||
SigBit O = sigmap(b);
|
SigBit O = sigmap(b);
|
||||||
if (O != b)
|
if (O != b)
|
||||||
alias_map[O] = b;
|
alias_map[O] = b;
|
||||||
|
@ -496,15 +493,13 @@ struct XAigerWriter
|
||||||
aig_map[bit] = 2*aig_m;
|
aig_map[bit] = 2*aig_m;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto &c : ci_bits) {
|
for (auto bit : ci_bits) {
|
||||||
RTLIL::SigBit bit = std::get<0>(c);
|
|
||||||
aig_m++, aig_i++;
|
aig_m++, aig_i++;
|
||||||
aig_map[bit] = 2*aig_m;
|
aig_map[bit] = 2*aig_m;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto &c : co_bits) {
|
for (auto bit : co_bits) {
|
||||||
RTLIL::SigBit bit = std::get<0>(c);
|
ordered_outputs[bit] = aig_o++;
|
||||||
std::get<4>(c) = ordered_outputs[bit] = aig_o++;
|
|
||||||
aig_outputs.push_back(bit2aig(bit));
|
aig_outputs.push_back(bit2aig(bit));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -517,7 +512,6 @@ struct XAigerWriter
|
||||||
ordered_outputs[bit] = aig_o++;
|
ordered_outputs[bit] = aig_o++;
|
||||||
aig_outputs.push_back(bit2aig(bit));
|
aig_outputs.push_back(bit2aig(bit));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void write_aiger(std::ostream &f, bool ascii_mode)
|
void write_aiger(std::ostream &f, bool ascii_mode)
|
||||||
|
|
Loading…
Reference in New Issue