3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-07-05 15:06:11 +00:00

write_xaiger2: fix indentation

This commit is contained in:
Lofty 2026-04-02 10:47:08 +01:00
parent 568a31c83a
commit b55fd6718b

View file

@ -177,6 +177,8 @@ struct Index {
if (!strashing) { if (!strashing) {
return (static_cast<Writer*>(this))->emit_gate(a, b); return (static_cast<Writer*>(this))->emit_gate(a, b);
} else { } else {
// AigMaker::node2index
if (a < b) std::swap(a, b); if (a < b) std::swap(a, b);
auto pair = std::make_pair(a, b); auto pair = std::make_pair(a, b);
@ -767,15 +769,15 @@ struct AigerWriter : Index<AigerWriter, unsigned int, 0, 1> {
// populate inputs // populate inputs
std::vector<SigBit> inputs; std::vector<SigBit> inputs;
for (auto id : top->ports) { for (auto id : top->ports) {
Wire *w = top->wire(id); Wire *w = top->wire(id);
log_assert(w); log_assert(w);
if (w->port_input && !w->port_output) if (w->port_input && !w->port_output)
for (int i = 0; i < w->width; i++) { for (int i = 0; i < w->width; i++) {
pi_literal(SigBit(w, i)) = lit_counter; pi_literal(SigBit(w, i)) = lit_counter;
inputs.push_back(SigBit(w, i)); inputs.push_back(SigBit(w, i));
lit_counter += 2; lit_counter += 2;
ninputs++; ninputs++;
} }
} }
this->f = f; this->f = f;
@ -783,27 +785,27 @@ struct AigerWriter : Index<AigerWriter, unsigned int, 0, 1> {
write_header(); write_header();
// insert padding where output literals will go (once known) // insert padding where output literals will go (once known)
for (auto id : top->ports) { for (auto id : top->ports) {
Wire *w = top->wire(id); Wire *w = top->wire(id);
log_assert(w); log_assert(w);
if (w->port_output) { if (w->port_output) {
for (auto bit : SigSpec(w)) { for (auto bit : SigSpec(w)) {
(void) bit; (void) bit;
char buf[16]; char buf[16];
snprintf(buf, sizeof(buf) - 1, "%08d\n", 0); snprintf(buf, sizeof(buf) - 1, "%08d\n", 0);
f->write(buf, strlen(buf)); f->write(buf, strlen(buf));
noutputs++; noutputs++;
}
} }
} }
}
auto data_start = f->tellp(); auto data_start = f->tellp();
// now the guts // now the guts
std::vector<std::pair<SigBit, int>> outputs; std::vector<std::pair<SigBit, int>> outputs;
for (auto w : top->wires()) for (auto w : top->wires())
if (w->port_output) { if (w->port_output) {
for (auto bit : SigSpec(w)) for (auto bit : SigSpec(w))
outputs.push_back({bit, eval_po(bit)}); outputs.push_back({bit, eval_po(bit)});
} }
auto data_end = f->tellp(); auto data_end = f->tellp();
// revisit header and the list of outputs // revisit header and the list of outputs
@ -908,33 +910,34 @@ struct XAigerAnalysis : Index<XAigerAnalysis, int, 0, 0> {
Wire *w = top->wire(id); Wire *w = top->wire(id);
log_assert(w); log_assert(w);
if (w->port_input && !w->port_output) if (w->port_input && !w->port_output)
for (int i = 0; i < w->width; i++) for (int i = 0; i < w->width; i++)
pi_literal(SigBit(w, i)) = 0; pi_literal(SigBit(w, i)) = 0;
} }
HierCursor cursor; HierCursor cursor;
for (auto box : top_minfo->found_blackboxes) { for (auto box : top_minfo->found_blackboxes) {
Module *def = design->module(box->type); Module *def = design->module(box->type);
if (!(def && def->has_attribute(ID::abc9_box_id))) if (!(def && def->has_attribute(ID::abc9_box_id)))
for (auto &conn : box->connections_) for (auto &conn : box->connections_)
if (box->port_dir(conn.first) != RTLIL::PD_INPUT) if (box->port_dir(conn.first) != RTLIL::PD_INPUT)
for (auto bit : conn.second) for (auto bit : conn.second)
pi_literal(bit, &cursor) = 0; pi_literal(bit, &cursor) = 0;
} }
for (auto w : top->wires()) for (auto w : top->wires()) {
if (w->port_output) { if (w->port_output) {
for (auto bit : SigSpec(w)) for (auto bit : SigSpec(w))
(void) eval_po(bit); (void) eval_po(bit);
}
} }
for (auto box : top_minfo->found_blackboxes) { for (auto box : top_minfo->found_blackboxes) {
Module *def = design->module(box->type); Module *def = design->module(box->type);
if (!(def && def->has_attribute(ID::abc9_box_id))) if (!(def && def->has_attribute(ID::abc9_box_id)))
for (auto &conn : box->connections_) for (auto &conn : box->connections_)
if (box->port_dir(conn.first) == RTLIL::PD_INPUT) if (box->port_dir(conn.first) == RTLIL::PD_INPUT)
for (auto bit : conn.second) for (auto bit : conn.second)
(void) eval_po(bit); (void) eval_po(bit);
} }
} }
}; };