Skip to content

Commit

Permalink
ecp5: Fix constant and inverted CEMUX
Browse files Browse the repository at this point in the history
Signed-off-by: gatecat <[email protected]>
  • Loading branch information
gatecat committed Jan 27, 2025
1 parent 0c06051 commit ede78f3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ecp5/pack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,8 @@ class Ecp5Packer
if (is_lut(ctx, uc)) {
set_lut_input_constant(uc, user.port, constval);
} else if (is_ff(ctx, uc) && user.port == id_CE) {
uc->params[id_CEMUX] = std::string(constval ? "1" : "0");
bool inv = (str_or_default(uc->params, id_CEMUX, "CE") == "INV");
uc->params[id_CEMUX] = std::string((constval ^ inv) ? "1" : "0");
uc->ports[user.port].net = nullptr;
} else if (is_carry(ctx, uc)) {
if (constval && (user.port.in(id_A0, id_A1, id_B0, id_B1, id_C0, id_C1, id_D0, id_D1))) {
Expand Down

0 comments on commit ede78f3

Please sign in to comment.