@@ -65,6 +65,9 @@ static void parse_comma_separated_wire_points(const char* ch, std::vector<t_wire
65
65
/* Parses the number of connections type */
66
66
static void parse_num_conns (std::string num_conns, t_wireconn_inf& wireconn);
67
67
68
+ /* Set connection from_side and to_side for custom switch block pattern*/
69
+ static void set_switch_func_type (SB_Side_Connection& conn, const char * func_type);
70
+
68
71
/* parse switch_override in wireconn */
69
72
static void parse_switch_override (const char * switch_override, t_wireconn_inf& wireconn, const t_arch_switch_inf* switches, int num_switches);
70
73
@@ -269,6 +272,70 @@ static void parse_num_conns(std::string num_conns, t_wireconn_inf& wireconn) {
269
272
wireconn.num_conns_formula = num_conns;
270
273
}
271
274
275
+ // set sides for a specific conn for custom switch block pattern
276
+ static void set_switch_func_type (SB_Side_Connection& conn, const char * func_type) {
277
+ if (0 == strcmp (func_type, " lt" )) {
278
+ conn.set_sides (LEFT, TOP);
279
+ } else if (0 == strcmp (func_type, " lr" )) {
280
+ conn.set_sides (LEFT, RIGHT);
281
+ } else if (0 == strcmp (func_type, " lb" )) {
282
+ conn.set_sides (LEFT, BOTTOM);
283
+ } else if (0 == strcmp (func_type, " la" )) {
284
+ conn.set_sides (LEFT, ABOVE);
285
+ } else if (0 == strcmp (func_type, " lu" )) {
286
+ conn.set_sides (LEFT, UNDER);
287
+ } else if (0 == strcmp (func_type, " tl" )) {
288
+ conn.set_sides (TOP, LEFT);
289
+ } else if (0 == strcmp (func_type, " tb" )) {
290
+ conn.set_sides (TOP, BOTTOM);
291
+ } else if (0 == strcmp (func_type, " tr" )) {
292
+ conn.set_sides (TOP, RIGHT);
293
+ } else if (0 == strcmp (func_type, " ta" )) {
294
+ conn.set_sides (TOP, ABOVE);
295
+ } else if (0 == strcmp (func_type, " tu" )) {
296
+ conn.set_sides (TOP, UNDER);
297
+ } else if (0 == strcmp (func_type, " rt" )) {
298
+ conn.set_sides (RIGHT, TOP);
299
+ } else if (0 == strcmp (func_type, " rl" )) {
300
+ conn.set_sides (RIGHT, LEFT);
301
+ } else if (0 == strcmp (func_type, " rb" )) {
302
+ conn.set_sides (RIGHT, BOTTOM);
303
+ } else if (0 == strcmp (func_type, " ra" )) {
304
+ conn.set_sides (RIGHT, ABOVE);
305
+ } else if (0 == strcmp (func_type, " ru" )) {
306
+ conn.set_sides (RIGHT, UNDER);
307
+ } else if (0 == strcmp (func_type, " bl" )) {
308
+ conn.set_sides (BOTTOM, LEFT);
309
+ } else if (0 == strcmp (func_type, " bt" )) {
310
+ conn.set_sides (BOTTOM, TOP);
311
+ } else if (0 == strcmp (func_type, " br" )) {
312
+ conn.set_sides (BOTTOM, RIGHT);
313
+ } else if (0 == strcmp (func_type, " ba" )) {
314
+ conn.set_sides (BOTTOM, ABOVE);
315
+ } else if (0 == strcmp (func_type, " bu" )) {
316
+ conn.set_sides (BOTTOM, UNDER);
317
+ } else if (0 == strcmp (func_type, " al" )) {
318
+ conn.set_sides (ABOVE, LEFT);
319
+ } else if (0 == strcmp (func_type, " at" )) {
320
+ conn.set_sides (ABOVE, TOP);
321
+ } else if (0 == strcmp (func_type, " ar" )) {
322
+ conn.set_sides (ABOVE, RIGHT);
323
+ } else if (0 == strcmp (func_type, " ab" )) {
324
+ conn.set_sides (ABOVE, BOTTOM);
325
+ } else if (0 == strcmp (func_type, " ul" )) {
326
+ conn.set_sides (UNDER, LEFT);
327
+ } else if (0 == strcmp (func_type, " ut" )) {
328
+ conn.set_sides (UNDER, TOP);
329
+ } else if (0 == strcmp (func_type, " ur" )) {
330
+ conn.set_sides (UNDER, RIGHT);
331
+ } else if (0 == strcmp (func_type, " ub" )) {
332
+ conn.set_sides (UNDER, BOTTOM);
333
+ } else {
334
+ /* unknown permutation function */
335
+ archfpga_throw (__FILE__, __LINE__, " Unknown permutation function specified: %s\n " , func_type);
336
+ }
337
+ }
338
+
272
339
/* Loads permutation funcs specified under Node into t_switchblock_inf. Node should be
273
340
* <switchfuncs> */
274
341
void read_sb_switchfuncs (pugi::xml_node Node, t_switchblock_inf* sb, const pugiutil::loc_data& loc_data) {
@@ -300,34 +367,8 @@ void read_sb_switchfuncs(pugi::xml_node Node, t_switchblock_inf* sb, const pugiu
300
367
func_formula = get_attribute (SubElem, " formula" , loc_data).as_string (nullptr );
301
368
302
369
/* go through all the possible cases of func_type */
303
- if (0 == strcmp (func_type, " lt" )) {
304
- conn.set_sides (LEFT, TOP);
305
- } else if (0 == strcmp (func_type, " lr" )) {
306
- conn.set_sides (LEFT, RIGHT);
307
- } else if (0 == strcmp (func_type, " lb" )) {
308
- conn.set_sides (LEFT, BOTTOM);
309
- } else if (0 == strcmp (func_type, " tl" )) {
310
- conn.set_sides (TOP, LEFT);
311
- } else if (0 == strcmp (func_type, " tb" )) {
312
- conn.set_sides (TOP, BOTTOM);
313
- } else if (0 == strcmp (func_type, " tr" )) {
314
- conn.set_sides (TOP, RIGHT);
315
- } else if (0 == strcmp (func_type, " rt" )) {
316
- conn.set_sides (RIGHT, TOP);
317
- } else if (0 == strcmp (func_type, " rl" )) {
318
- conn.set_sides (RIGHT, LEFT);
319
- } else if (0 == strcmp (func_type, " rb" )) {
320
- conn.set_sides (RIGHT, BOTTOM);
321
- } else if (0 == strcmp (func_type, " bl" )) {
322
- conn.set_sides (BOTTOM, LEFT);
323
- } else if (0 == strcmp (func_type, " bt" )) {
324
- conn.set_sides (BOTTOM, TOP);
325
- } else if (0 == strcmp (func_type, " br" )) {
326
- conn.set_sides (BOTTOM, RIGHT);
327
- } else {
328
- /* unknown permutation function */
329
- archfpga_throw (__FILE__, __LINE__, " Unknown permutation function specified: %s\n " , func_type);
330
- }
370
+ set_switch_func_type (conn, func_type);
371
+
331
372
func_ptr = &(sb->permutation_map [conn]);
332
373
333
374
/* Here we load the specified switch function(s) */
@@ -404,8 +445,8 @@ static void check_bidir_switchblock(const t_permutation_map* permutation_map) {
404
445
SB_Side_Connection conn;
405
446
406
447
/* iterate over all combinations of from_side -> to side */
407
- for (e_side from_side : {TOP, RIGHT, BOTTOM, LEFT} ) {
408
- for (e_side to_side : {TOP, RIGHT, BOTTOM, LEFT} ) {
448
+ for (e_side from_side : TOTAL_2D_SIDES ) {
449
+ for (e_side to_side : TOTAL_2D_SIDES ) {
409
450
/* can't connect a switchblock side to itself */
410
451
if (from_side == to_side) {
411
452
continue ;
0 commit comments