Skip to content

Commit 3d46448

Browse files
committed
write_xaiger: simplify c{i,o}_bits
1 parent 3e14ff1 commit 3d46448

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

backends/aiger/xaiger.cc

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ struct XAigerWriter
8181
pool<SigBit> input_bits, output_bits;
8282
dict<SigBit, SigBit> not_map, alias_map;
8383
dict<SigBit, pair<SigBit, SigBit>> and_map;
84-
vector<std::tuple<SigBit,RTLIL::Cell*,RTLIL::IdString,int>> ci_bits;
85-
vector<std::tuple<SigBit,RTLIL::Cell*,RTLIL::IdString,int,int>> co_bits;
84+
vector<SigBit> ci_bits, co_bits;
8685
dict<SigBit, float> arrival_times;
8786

8887
vector<pair<int, int>> aig_gates;
@@ -367,7 +366,6 @@ struct XAigerWriter
367366
cell->setPort(port_name, rhs);
368367
}
369368

370-
int offset = 0;
371369
for (auto b : rhs.bits()) {
372370
SigBit I = sigmap(b);
373371
if (b == RTLIL::Sx)
@@ -378,7 +376,7 @@ struct XAigerWriter
378376
else
379377
alias_map[b] = I;
380378
}
381-
co_bits.emplace_back(b, cell, port_name, offset++, 0);
379+
co_bits.emplace_back(b);
382380
unused_bits.erase(b);
383381
}
384382
}
@@ -398,9 +396,8 @@ struct XAigerWriter
398396
cell->setPort(port_name, rhs);
399397
}
400398

401-
int offset = 0;
402399
for (const auto &b : rhs.bits()) {
403-
ci_bits.emplace_back(b, cell, port_name, offset++);
400+
ci_bits.emplace_back(b);
404401
SigBit O = sigmap(b);
405402
if (O != b)
406403
alias_map[O] = b;
@@ -487,15 +484,13 @@ struct XAigerWriter
487484
aig_map[bit] = 2*aig_m;
488485
}
489486

490-
for (auto &c : ci_bits) {
491-
RTLIL::SigBit bit = std::get<0>(c);
487+
for (auto bit : ci_bits) {
492488
aig_m++, aig_i++;
493489
aig_map[bit] = 2*aig_m;
494490
}
495491

496-
for (auto &c : co_bits) {
497-
RTLIL::SigBit bit = std::get<0>(c);
498-
std::get<4>(c) = ordered_outputs[bit] = aig_o++;
492+
for (auto bit : co_bits) {
493+
ordered_outputs[bit] = aig_o++;
499494
aig_outputs.push_back(bit2aig(bit));
500495
}
501496

@@ -508,7 +503,6 @@ struct XAigerWriter
508503
ordered_outputs[bit] = aig_o++;
509504
aig_outputs.push_back(bit2aig(bit));
510505
}
511-
512506
}
513507

514508
void write_aiger(std::ostream &f, bool ascii_mode)

0 commit comments

Comments
 (0)