some fixes regarding bidirectional switches

This commit is contained in:
Wolfgang Spraul 2013-01-24 08:19:03 -05:00
parent 7c12ea66a7
commit ba826ee297
4 changed files with 43 additions and 44 deletions

View File

@ -72,7 +72,7 @@ static int diff_printf(struct test_state* tstate)
int rc;
if (tstate->cmdline_count != -1
&& tstate->next_diff_counter >= tstate->cmdline_skip + tstate->cmdline_count) {
&& tstate->next_diff_counter > tstate->cmdline_skip + tstate->cmdline_count) {
printf("\nO Finished %i tests.\n", tstate->cmdline_count);
exit(0);
}
@ -80,8 +80,10 @@ static int diff_printf(struct test_state* tstate)
printf("O Dry run, skipping diff %i.\n", tstate->next_diff_counter++);
return 0;
}
if (tstate->cmdline_skip >= tstate->next_diff_counter) {
printf("O Skipping diff %i.\n", tstate->next_diff_counter++);
if (tstate->next_diff_counter <= tstate->cmdline_skip) {
tstate->next_diff_counter++;
if (tstate->next_diff_counter == tstate->cmdline_skip)
printf("O Skipping diffs 1-%i.\n", tstate->next_diff_counter);
return 0;
}

View File

@ -1594,12 +1594,20 @@ static int extract_routing_switches(struct extract_state* es, int y, int x)
from_str = fpga_wire2str_yx(es->model, es->model->sw_bitpos[i].from, y, x);
to_str = fpga_wire2str_yx(es->model, es->model->sw_bitpos[i].to, y, x);
#ifdef DBG_EXTRACT_ROUTING_SW
fprintf(stderr, "#D %s:%i y%i x%i from %i (%s) to %i (%s)\n",
fprintf(stderr, "#D %s:%i y%i x%i (r%i ma%i v64_%02i mi%i) "
"from %s to %s bidir %i "
"two_bits_o %i two_bits_val %i one_bit_o %i\n",
__FILE__, __LINE__, y, x,
es->model->sw_bitpos[i].from,
which_row(y, es->model),
es->model->x_major[x],
regular_row_pos(y, es->model),
es->model->sw_bitpos[i].minor,
strarray_lookup(&es->model->str, from_str),
es->model->sw_bitpos[i].to,
strarray_lookup(&es->model->str, to_str));
strarray_lookup(&es->model->str, to_str),
es->model->sw_bitpos[i].bidir,
es->model->sw_bitpos[i].two_bits_o,
es->model->sw_bitpos[i].two_bits_val,
es->model->sw_bitpos[i].one_bit_o);
#endif
sw_idx = fpga_switch_lookup(es->model, y, x, from_str, to_str);
if (sw_idx == NO_SWITCH) RC_FAIL(es->model, EINVAL);

View File

@ -735,6 +735,7 @@ static void printf_routing_2minors(const uint8_t* bits, int row, int major,
if (u64_1 & (1ULL << i))
bit_str[i*2+1] = '1';
}
// todo: might be nice to add the tile y and x here
printf("r%i ma%i v64_%02i mip%02i %s\n",
row, major, y, even_minor, bit_str);
}

View File

@ -941,10 +941,6 @@ struct sw_mip_src
int from_w[6];
};
// returns:
// 1 for the active side of a bidir switch, where the bits reside
// 0 for a unidirectional switch
// -1 for the passive side of a bidir switch, where no bits reside
static int bidir_check(int sw_to, int sw_from)
{
// the first member of bidir switch pairs is where the bits reside
@ -964,10 +960,8 @@ static int bidir_check(int sw_to, int sw_from)
// bidirectional switches are ignored on one side, and
// marked as bidir on the other side
for (i = 0; i < sizeof(bidir)/sizeof(*bidir)/2; i++) {
if (sw_from == bidir[i*2] && sw_to == bidir[i*2+1])
// nothing to do where no bits reside
return -1;
if (sw_from == bidir[i*2+1] && sw_to == bidir[i*2])
if ((sw_from == bidir[i*2] && sw_to == bidir[i*2+1])
|| (sw_from == bidir[i*2+1] && sw_to == bidir[i*2]))
return 1;
}
return 0;
@ -1025,37 +1019,31 @@ static enum extra_wires clean_S0N3(enum extra_wires wire)
static int src_to_bitpos(struct xc6_routing_bitpos* bitpos, int* cur_el, int max_el,
const struct sw_mip_src* src, int src_len)
{
int i, j, bidir, rc;
int i, j, rc;
for (i = 0; i < src_len; i++) {
for (j = 0; j < sizeof(src->from_w)/sizeof(src->from_w[0]); j++) {
if (src[i].from_w[j] == NO_WIRE) continue;
bidir = bidir_check(src[i].m0_sw_to, src[i].from_w[j]);
if (bidir != -1) {
if (*cur_el >= max_el) FAIL(EINVAL);
bitpos[*cur_el].from = clean_S0N3(src[i].from_w[j]);
bitpos[*cur_el].to = clean_S0N3(src[i].m0_sw_to);
bitpos[*cur_el].bidir = bidir;
bitpos[*cur_el].minor = src[i].minor;
bitpos[*cur_el].two_bits_o = src[i].m0_two_bits_o;
bitpos[*cur_el].two_bits_val = src[i].m0_two_bits_val;
bitpos[*cur_el].one_bit_o = src[i].m0_one_bit_start + j*2;
(*cur_el)++;
}
if (*cur_el >= max_el) FAIL(EINVAL);
bitpos[*cur_el].from = clean_S0N3(src[i].from_w[j]);
bitpos[*cur_el].to = clean_S0N3(src[i].m0_sw_to);
bitpos[*cur_el].bidir = bidir_check(src[i].m0_sw_to, src[i].from_w[j]);
bitpos[*cur_el].minor = src[i].minor;
bitpos[*cur_el].two_bits_o = src[i].m0_two_bits_o;
bitpos[*cur_el].two_bits_val = src[i].m0_two_bits_val;
bitpos[*cur_el].one_bit_o = src[i].m0_one_bit_start + j*2;
(*cur_el)++;
bidir = bidir_check(src[i].m1_sw_to, src[i].from_w[j]);
if (bidir != -1) {
if (*cur_el >= max_el) FAIL(EINVAL);
bitpos[*cur_el].from = clean_S0N3(src[i].from_w[j]);
bitpos[*cur_el].to = clean_S0N3(src[i].m1_sw_to);
bitpos[*cur_el].bidir = bidir;
bitpos[*cur_el].minor = src[i].minor;
bitpos[*cur_el].two_bits_o = src[i].m1_two_bits_o;
bitpos[*cur_el].two_bits_val = src[i].m1_two_bits_val;
bitpos[*cur_el].one_bit_o = src[i].m1_one_bit_start + j*2;
(*cur_el)++;
}
if (*cur_el >= max_el) FAIL(EINVAL);
bitpos[*cur_el].from = clean_S0N3(src[i].from_w[j]);
bitpos[*cur_el].to = clean_S0N3(src[i].m1_sw_to);
bitpos[*cur_el].bidir = bidir_check(src[i].m1_sw_to, src[i].from_w[j]);
bitpos[*cur_el].minor = src[i].minor;
bitpos[*cur_el].two_bits_o = src[i].m1_two_bits_o;
bitpos[*cur_el].two_bits_val = src[i].m1_two_bits_val;
bitpos[*cur_el].one_bit_o = src[i].m1_one_bit_start + j*2;
(*cur_el)++;
}
}
return 0;
@ -1497,7 +1485,7 @@ int get_xc6_routing_bitpos(struct xc6_routing_bitpos** bitpos, int* num_bitpos)
{20, SR0, 8, 2, 10, .from_w =
{GCLK14, GCLK15, LW+(LI_DI|LD1), LW+(LI_BX|LD1), LW+LI_BX, FAN_B}},
{20, SR0, 8, 1, 10, .from_w = {DW+W_SR1*4+2, DW+W_ER1*4+2, DW+W_NR1*4+2,
VCC_WIRE, NO_WIRE, DW+W_WR1*4+2}},
VCC_WIRE, NO_WIRE /*is this GND?*/, DW+W_WR1*4+2}},
{20, CLK0, 16, 3, 18, .from_w =
{GCLK0, GCLK1, GCLK2, GCLK5, GCLK4, GCLK3}},
@ -1522,12 +1510,12 @@ int get_xc6_routing_bitpos(struct xc6_routing_bitpos** bitpos, int* num_bitpos)
{20, GFAN0, 54, 2, 48, .from_w =
{DW+W_WR1*4+1, GND_WIRE, VCC_WIRE, DW+W_NR1*4+1, DW+W_ER1*4+1, DW+W_SR1*4+1}},
{20, GFAN0, 54, 1, 48, .from_w =
{LW+(LI_CE|LD1), NO_WIRE, NO_WIRE, LW+(LI_CI|LD1), GCLK7, GCLK6}},
{LW+(LI_CE|LD1), LW+(LI_AX|LD1), LW+LI_AX, LW+(LI_CI|LD1), GCLK7, GCLK6}},
{20, GFAN1, 56, 3, 58, .from_w =
{GCLK0, GCLK1, GCLK4, GCLK5, GCLK2, GCLK3}},
{20, GFAN1, 56, 2, 58, .from_w =
{GCLK6, GCLK7, LW+(LI_AX|LD1), LW+LI_AX, NO_WIRE, NO_WIRE}},
{GCLK6, GCLK7, LW+(LI_AX|LD1), LW+LI_AX, LW+(LI_CI|LD1), LW+(LI_CE|LD1)}},
{20, GFAN1, 56, 1, 58, .from_w =
{DW+W_SR1*4+1, DW+W_ER1*4+1, GND_WIRE, VCC_WIRE, DW+W_NR1*4+1, DW+W_WR1*4+1}}};
@ -1538,7 +1526,7 @@ int get_xc6_routing_bitpos(struct xc6_routing_bitpos** bitpos, int* num_bitpos)
if (*num_bitpos >= MAX_SWITCHBOX_SIZE) FAIL(EINVAL);
(*bitpos)[*num_bitpos].from = src[i].from_w[j];
(*bitpos)[*num_bitpos].to = src[i].m0_sw_to;
(*bitpos)[*num_bitpos].bidir = 0;
(*bitpos)[*num_bitpos].bidir = bidir_check(src[i].from_w[j], src[i].m0_sw_to);
(*bitpos)[*num_bitpos].minor = 20;
(*bitpos)[*num_bitpos].two_bits_o = src[i].m0_two_bits_o;
(*bitpos)[*num_bitpos].two_bits_val = src[i].m0_two_bits_val;