Compare commits

..

No commits in common. "6fbdcf901650a917d0a2a6f6423e781eb45ed05f" and "f27c7284729ba3dc4c03d112314570a7f4ffca27" have entirely different histories.

View File

@ -10,12 +10,12 @@ static int need_fix = 1;
/* LUT Definitions (correct offset, no fix must be applied) */ /* LUT Definitions (correct offset, no fix must be applied) */
static int LUT4_BITMAP[16] = { static int LUT4_BITMAP[16] = {
24, 25, 26, 27, 28, 29, 30, 31, 16, 17, 18, 19, 20, 21, 22, 23,
16, 17, 18, 19, 20, 21, 22, 23 24, 25, 26, 27, 28, 29, 30, 31
}; };
static int LUT3_BITMAP[2][8] = { static int LUT3_BITMAP[2][8] = {
{24, 25, 26, 27, 28, 29, 30, 31}, {16, 17, 18, 19, 20, 21, 22, 23},
{16, 17, 18, 19, 20, 21, 22, 23} {24, 25, 26, 27, 28, 29, 30, 31}
}; };
/* LUT Config Definitions */ /* LUT Config Definitions */
@ -61,13 +61,7 @@ static int ROUTE_BITMAP[8] = {
static int BIT_LED_LUT_IN = 28; static int BIT_LED_LUT_IN = 28;
static int BIT_LED_LUT_OUT_N = 29; /* Low-active */ static int BIT_LED_LUT_OUT_N = 29; /* Low-active */
static inline int fpga_cell_lut34_is_driven(char drive_sel) static int fpga_cell_lut34_lut_get_mux(int lut, char port) {
{
return (drive_sel != LUT_OUT_DC && drive_sel != LUT_OUT_Z);
}
static int fpga_cell_lut34_lut_get_mux(int lut, char port)
{
int i; int i;
if (port == LUT_NET_DC) if (port == LUT_NET_DC)
@ -80,8 +74,7 @@ static int fpga_cell_lut34_lut_get_mux(int lut, char port)
return -1; return -1;
} }
static int fpga_cell_lut34_lut_get_out_mux(int lut_group, char *ports) static int fpga_cell_lut34_lut_get_out_mux(int lut_group, char *ports) {
{
int i; int i;
int lut; int lut;
@ -95,9 +88,11 @@ static int fpga_cell_lut34_lut_get_out_mux(int lut_group, char *ports)
ports = ports + lut; ports = ports + lut;
for (i = 0; i < 4; ++i) { for (i = 0; i < 4; ++i) {
if (!fpga_cell_lut34_is_driven(ports[0]) || if (ports[0] == LUT_OUT_DC ||
ports[0] == LUT_OUT_Z ||
ports[0] == LUT_OUT_MUX[lut][i]) { ports[0] == LUT_OUT_MUX[lut][i]) {
if (!fpga_cell_lut34_is_driven(ports[1]) || if (ports[1] == LUT_OUT_DC ||
ports[1] == LUT_OUT_Z ||
ports[1] == LUT_OUT_MUX[lut + 1][i]) ports[1] == LUT_OUT_MUX[lut + 1][i])
return i; return i;
} }
@ -237,11 +232,15 @@ char *fpga_cell_lut34_isp_generate_bitstream(struct fpga_cell *cell)
"Couldn't set LUT output sel %d for output %d.", temp, i); "Couldn't set LUT output sel %d for output %d.", temp, i);
} }
for (i = 0; i < 4; ++i) { for (i = 0; i < 2; ++i) {
temp = fpga_cell_lut34_is_driven(lut34->drive_sel[i]); temp = fpga_cell_bitstream_is_set(sbuf, LUT_OUT_BITMAP[i][0]); /* At some point, we set a specific output on this MUX */
BS_SET_BIT(LUT_OUT_EN_N_BITMAP[i], !temp, BS_SET_BIT(LUT_OUT_EN_N_BITMAP[i], !temp,
"Couldn't %s output for output %d.", "Couldn't %s output for output %d.",
(!temp ? "enable" : "disabled"), i); (!temp ? "enable" : "disabled"), i);
if (!temp) {
BS_SET_BITS(0, 2 , LUT_OUT_BITMAP[i],
"Couldn't set LUT output sel 0 for output %d (undriven by user logic).", i);
}
} }
/* Routing */ /* Routing */
@ -281,10 +280,8 @@ char *fpga_cell_lut34_isp_generate_bitstream(struct fpga_cell *cell)
report(LL_DEBUG, "Bitstream result for %p:", cell); report(LL_DEBUG, "Bitstream result for %p:", cell);
for (i = 0; i < 48; ++i) { for (i = 0; i < 48; ++i) {
report(LL_DEBUG, report(LL_DEBUG,
" %d: %d%s", " %d: %d",
i, i, fpga_cell_bitstream_is_set(buf, i));
fpga_cell_bitstream_is_set(buf, i),
(fpga_cell_bitstream_is_set(sbuf, i) ? "" : " (Z)"));
} }
free(sbuf); free(sbuf);