#include <assert.h>
#include "util.h"
#include "vpr_types.h"
#include "rr_graph_sbox.h"
#include "rr_graph_util.h"
Go to the source code of this file.
Defines | |
#define | SBOX_ERROR -1 |
Functions | |
int | get_simple_switch_block_track (IN enum e_side from_side, IN enum e_side to_side, IN int from_track, IN enum e_switch_block_type switch_block_type, IN int nodes_per_chan) |
static enum e_side | get_sbox_side (IN int get_i, IN int get_j, IN t_rr_type get_type, IN int comp_i, IN int comp_j) |
struct s_ivec *** | alloc_and_load_switch_block_conn (IN int nodes_per_chan, IN enum e_switch_block_type switch_block_type, IN int Fs) |
void | free_switch_block_conn (struct s_ivec ***switch_block_conn, int nodes_per_chan) |
#define SBOX_ERROR -1 |
Definition at line 141 of file rr_graph_sbox.c.
struct s_ivec*** alloc_and_load_switch_block_conn | ( | IN int | nodes_per_chan, | |
IN enum e_switch_block_type | switch_block_type, | |||
IN int | Fs | |||
) | [read] |
Definition at line 47 of file rr_graph_sbox.c.
00051 { 00052 enum e_side from_side, to_side; 00053 int from_track; 00054 struct s_ivec ***switch_block_conn = NULL; 00055 00056 #ifdef CREATE_ECHO_FILES 00057 int i, j, k, l; 00058 FILE *out; 00059 #endif /* CREATE_ECHO_FILES */ 00060 00061 /* Currently Fs must be 3 since each track maps once to each other side */ 00062 assert(3 == Fs); 00063 00064 switch_block_conn = 00065 (struct s_ivec ***)alloc_matrix3(0, 3, 00066 0, 3, 00067 0, (nodes_per_chan - 1), 00068 sizeof(struct s_ivec)); 00069 00070 for(from_side = 0; from_side < 4; from_side++) 00071 { 00072 for(to_side = 0; to_side < 4; to_side++) 00073 { 00074 for(from_track = 0; from_track < nodes_per_chan; 00075 from_track++) 00076 { 00077 if(from_side != to_side) 00078 { 00079 switch_block_conn[from_side][to_side] 00080 [from_track].nelem = 1; 00081 switch_block_conn[from_side][to_side] 00082 [from_track].list = 00083 (int *)my_malloc(sizeof(int)); 00084 00085 switch_block_conn[from_side][to_side] 00086 [from_track].list[0] = 00087 get_simple_switch_block_track 00088 (from_side, to_side, from_track, 00089 switch_block_type, nodes_per_chan); 00090 } 00091 else 00092 { /* from_side == to_side -> no connection. */ 00093 switch_block_conn[from_side][to_side] 00094 [from_track].nelem = 0; 00095 switch_block_conn[from_side][to_side] 00096 [from_track].list = NULL; 00097 } 00098 } 00099 } 00100 } 00101 00102 #ifdef CREATE_ECHO_FILES 00103 out = my_fopen("switch_block_conn.echo", "w"); 00104 for(l = 0; l < 4; ++l) 00105 { 00106 for(k = 0; k < 4; ++k) 00107 { 00108 fprintf(out, "Side %d to %d\n", l, k); 00109 for(j = 0; j < nodes_per_chan; ++j) 00110 { 00111 fprintf(out, "%d: ", j); 00112 for(i = 0; i < switch_block_conn[l][k][j].nelem; 00113 ++i) 00114 { 00115 fprintf(out, "%d ", 00116 switch_block_conn[l][k][j]. 00117 list[i]); 00118 } 00119 fprintf(out, "\n"); 00120 } 00121 fprintf(out, "\n"); 00122 } 00123 } 00124 fclose(out); 00125 #endif /* CREATE_ECHO_FILES */ 00126 00127 return switch_block_conn; 00128 }
void free_switch_block_conn | ( | struct s_ivec *** | switch_block_conn, | |
int | nodes_per_chan | |||
) |
Definition at line 132 of file rr_graph_sbox.c.
00134 { 00135 /* Frees the switch_block_conn data structure. */ 00136 00137 free_ivec_matrix3(switch_block_conn, 0, 3, 0, 3, 0, nodes_per_chan - 1); 00138 }
static enum e_side get_sbox_side | ( | IN int | get_i, | |
IN int | get_j, | |||
IN t_rr_type | get_type, | |||
IN int | comp_i, | |||
IN int | comp_j | |||
) | [static] |
int get_simple_switch_block_track | ( | IN enum e_side | from_side, | |
IN enum e_side | to_side, | |||
IN int | from_track, | |||
IN enum e_switch_block_type | switch_block_type, | |||
IN int | nodes_per_chan | |||
) |
Definition at line 149 of file rr_graph_sbox.c.
00154 { 00155 00156 /* This routine returns the track number to which the from_track should * 00157 * connect. It supports three simple, Fs = 3, switch blocks. */ 00158 00159 int to_track; 00160 00161 to_track = SBOX_ERROR; /* Can check to see if it's not set later. */ 00162 00163 if(switch_block_type == SUBSET) 00164 { /* NB: Global routing uses SUBSET too */ 00165 to_track = from_track; 00166 } 00167 00168 00169 /* See S. Wilton Phd thesis, U of T, 1996 p. 103 for details on following. */ 00170 00171 else if(switch_block_type == WILTON) 00172 { 00173 00174 if(from_side == LEFT) 00175 { 00176 00177 if(to_side == RIGHT) 00178 { /* CHANX to CHANX */ 00179 to_track = from_track; 00180 } 00181 else if(to_side == TOP) 00182 { /* from CHANX to CHANY */ 00183 to_track = 00184 (nodes_per_chan - 00185 from_track) % nodes_per_chan; 00186 } 00187 else if(to_side == BOTTOM) 00188 { 00189 to_track = 00190 (nodes_per_chan + from_track - 00191 1) % nodes_per_chan; 00192 } 00193 } 00194 00195 else if(from_side == RIGHT) 00196 { 00197 if(to_side == LEFT) 00198 { /* CHANX to CHANX */ 00199 to_track = from_track; 00200 } 00201 else if(to_side == TOP) 00202 { /* from CHANX to CHANY */ 00203 to_track = 00204 (nodes_per_chan + from_track - 00205 1) % nodes_per_chan; 00206 } 00207 else if(to_side == BOTTOM) 00208 { 00209 to_track = 00210 (2 * nodes_per_chan - 2 - 00211 from_track) % nodes_per_chan; 00212 } 00213 } 00214 00215 else if(from_side == BOTTOM) 00216 { 00217 if(to_side == TOP) 00218 { /* CHANY to CHANY */ 00219 to_track = from_track; 00220 } 00221 else if(to_side == LEFT) 00222 { /* from CHANY to CHANX */ 00223 to_track = (from_track + 1) % nodes_per_chan; 00224 } 00225 else if(to_side == RIGHT) 00226 { 00227 to_track = 00228 (2 * nodes_per_chan - 2 - 00229 from_track) % nodes_per_chan; 00230 } 00231 } 00232 00233 else if(from_side == TOP) 00234 { 00235 if(to_side == BOTTOM) 00236 { /* CHANY to CHANY */ 00237 to_track = from_track; 00238 } 00239 else if(to_side == LEFT) 00240 { /* from CHANY to CHANX */ 00241 to_track = 00242 (nodes_per_chan - 00243 from_track) % nodes_per_chan; 00244 } 00245 else if(to_side == RIGHT) 00246 { 00247 to_track = (from_track + 1) % nodes_per_chan; 00248 } 00249 } 00250 00251 } 00252 /* End switch_block_type == WILTON case. */ 00253 else if(switch_block_type == UNIVERSAL) 00254 { 00255 00256 if(from_side == LEFT) 00257 { 00258 00259 if(to_side == RIGHT) 00260 { /* CHANX to CHANX */ 00261 to_track = from_track; 00262 } 00263 else if(to_side == TOP) 00264 { /* from CHANX to CHANY */ 00265 to_track = nodes_per_chan - 1 - from_track; 00266 } 00267 else if(to_side == BOTTOM) 00268 { 00269 to_track = from_track; 00270 } 00271 } 00272 00273 else if(from_side == RIGHT) 00274 { 00275 if(to_side == LEFT) 00276 { /* CHANX to CHANX */ 00277 to_track = from_track; 00278 } 00279 else if(to_side == TOP) 00280 { /* from CHANX to CHANY */ 00281 to_track = from_track; 00282 } 00283 else if(to_side == BOTTOM) 00284 { 00285 to_track = nodes_per_chan - 1 - from_track; 00286 } 00287 } 00288 00289 else if(from_side == BOTTOM) 00290 { 00291 if(to_side == TOP) 00292 { /* CHANY to CHANY */ 00293 to_track = from_track; 00294 } 00295 else if(to_side == LEFT) 00296 { /* from CHANY to CHANX */ 00297 to_track = from_track; 00298 } 00299 else if(to_side == RIGHT) 00300 { 00301 to_track = nodes_per_chan - 1 - from_track; 00302 } 00303 } 00304 00305 else if(from_side == TOP) 00306 { 00307 if(to_side == BOTTOM) 00308 { /* CHANY to CHANY */ 00309 to_track = from_track; 00310 } 00311 else if(to_side == LEFT) 00312 { /* from CHANY to CHANX */ 00313 to_track = nodes_per_chan - 1 - from_track; 00314 } 00315 else if(to_side == RIGHT) 00316 { 00317 to_track = from_track; 00318 } 00319 } 00320 } 00321 00322 /* End switch_block_type == UNIVERSAL case. */ 00323 /* UDSD Modification by WMF Begin */ 00324 if(switch_block_type == FULL) 00325 { /* Just a placeholder. No meaning in reality */ 00326 to_track = from_track; 00327 } 00328 /* UDSD Modification by WMF End */ 00329 00330 if(to_track == SBOX_ERROR) 00331 { 00332 printf 00333 ("Error in get_simple_switch_block_track. Unexpected connection.\n" 00334 "from_side: %d to_side: %d switch_block_type: %d.\n", 00335 from_side, to_side, switch_block_type); 00336 exit(1); 00337 } 00338 00339 return (to_track); 00340 }