diff --git a/sw/kousaten/src/fpga_cell_lut34.c b/sw/kousaten/src/fpga_cell_lut34.c index 95f6dd3..5a3da15 100644 --- a/sw/kousaten/src/fpga_cell_lut34.c +++ b/sw/kousaten/src/fpga_cell_lut34.c @@ -61,6 +61,11 @@ static int ROUTE_BITMAP[8] = { static int BIT_LED_LUT_IN = 28; static int BIT_LED_LUT_OUT_N = 29; /* Low-active */ +static inline int fpga_cell_lut34_is_driven(char drive_sel) +{ + 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; @@ -88,11 +93,9 @@ static int fpga_cell_lut34_lut_get_out_mux(int lut_group, char *ports) { ports = ports + lut; for (i = 0; i < 4; ++i) { - if (ports[0] == LUT_OUT_DC || - ports[0] == LUT_OUT_Z || + if (!fpga_cell_lut34_is_driven(ports[0]) || ports[0] == LUT_OUT_MUX[lut][i]) { - if (ports[1] == LUT_OUT_DC || - ports[1] == LUT_OUT_Z || + if (!fpga_cell_lut34_is_driven(ports[1]) || ports[1] == LUT_OUT_MUX[lut + 1][i]) return i; }