Skip to content

Commit 7864412

Browse files
committed
DSP48E1: fix the fix: no AREG/BREG bit is actually value 1
1 parent df364a2 commit 7864412

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

xilinx/fasm.cc

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,15 +1577,21 @@ struct FasmBackend
15771577
}
15781578
};
15791579

1580-
// value 1 is equivalent to 2 here, see UG479
1581-
// also, prjxray only has bits for values 0 and 2
1582-
auto areg = int_or_default(ci->params, ctx->id("AREG"), 0);
1583-
write_bit("AREG_" + std::to_string(areg == 1 ? 2 : areg));
1580+
// value 1 is equivalent to 2, according to UG479
1581+
// but in real life, Vivado sets AREG_0 is 0,
1582+
// no bit is 1, and AREG_2 is 2
1583+
auto areg = int_or_default(ci->params, ctx->id("AREG"), 1);
1584+
if (areg == 0 or areg == 2) write_bit("AREG_" + std::to_string(areg));
1585+
15841586
auto ainput = str_or_default(ci->params, ctx->id("A_INPUT"), "DIRECT");
15851587
if (ainput == "CASCADE") write_bit("A_INPUT[0]");
15861588

1587-
auto breg = int_or_default(ci->params, ctx->id("BREG"), 0);
1588-
write_bit("BREG_" + std::to_string(breg == 1 ? 2 : breg));
1589+
// value 1 is equivalent to 2, according to UG479
1590+
// but in real life, Vivado sets AREG_0 is 0,
1591+
// no bit is 1, and AREG_2 is 2
1592+
auto breg = int_or_default(ci->params, ctx->id("BREG"), 1);
1593+
if (breg == 0 or breg == 2) write_bit("BREG_" + std::to_string(breg));
1594+
15891595
auto binput = str_or_default(ci->params, ctx->id("B_INPUT"), "DIRECT");
15901596
if (binput == "CASCADE") write_bit("B_INPUT[0]");
15911597

0 commit comments

Comments
 (0)