Skip to content

Commit

Permalink
Remove the Reduce* Ops again
Browse files Browse the repository at this point in the history
  • Loading branch information
thiskappaisgrey committed Dec 8, 2023
1 parent c3621ce commit 1f0ec58
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions backends/lakeroad/lakeroad.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1246,6 +1246,7 @@ struct LakeroadWorker {
}

// The let-bound ID string of the expression to extract from.
// FIXME: On certain inputs - this never terminates. Not sure if this is a problem
auto extract_from_expr = get_expression_for_signal(sigmap(sig.chunks()[0].wire), -1);
auto new_id = get_new_id_str();
auto extract_expr = stringf("(Op1 (Extract %d %d) %s)", (chunk.offset + chunk.width - 1) + chunk.wire->start_offset,
Expand Down Expand Up @@ -1307,25 +1308,7 @@ struct LakeroadWorker {
log_error("This should be unreachable. You are missing an else if branch.\n");

f << stringf("(union %s (Op1 %s %s))\n", y_let_name.c_str(), op_str.c_str(), a_let_name.c_str()).c_str();
}
else if (cell->type.in(ID($reduce_and), ID($reduce_or), ID($reduce_bool), ID($reduce_xor), ID($reduce_xnor))) {
assert(cell->connections().size() == 2);
auto y = sigmap(cell->getPort(ID::Y));
auto a_let_name = get_expression_for_signal(sigmap(cell->getPort(ID::A)), y.size());
auto y_let_name = get_expression_for_signal(y, -1);


std::string op_str;
if (cell->type == ID($reduce_and))
op_str = "(ReduceAnd)";
if (cell->type.in(ID($reduce_or), ID($reduce_bool)))
op_str = "(ReduceOr)";
if (cell->type.in(ID($reduce_xor), ID($reduce_xnor)))
op_str = "(ReduceXor)"; // NOTE: Not sure why this is the same. Copied from BTOR logic.
f << stringf("(union %s (Op1 %s %s))\n", y_let_name.c_str(), op_str.c_str(), a_let_name.c_str()).c_str();

}
else if (cell->type.in(ID($and), ID($or), ID($xor), ID($shr))) {
} else if (cell->type.in(ID($and), ID($or), ID($xor), ID($shr))) {
// Binary ops that preserve width.
assert(cell->connections().size() == 3);
auto y = sigmap(cell->getPort(ID::Y));
Expand Down

0 comments on commit 1f0ec58

Please sign in to comment.