15 float R_minW_nmos,
float R_minW_pmos);
18 int max_inputs_to_cblock,
float trans_cblock_to_lblock_buf,
19 float trans_sram_bit);
22 float trans_sram_bit,
float R_minW_nmos);
25 float trans_sram_bit,
float R_minW_nmos,
float R_minW_pmos);
27 static float trans_per_buf(
float Rbuf,
float R_minW_nmos,
float R_minW_pmos);
29 static float trans_per_mux(
int num_inputs,
float trans_sram_bit,
30 float pass_trans_area);
32 static float trans_per_R(
float Rtrans,
float R_minW_trans);
37 int num_switch,
t_segment_inf * segment_inf,
float R_minW_nmos,
83 int *num_inputs_to_cblock;
87 boolean * cblock_counted;
88 float *shared_buffer_trans;
89 float *unsharable_switch_trans, *sharable_switch_trans;
92 int from_node, to_node, iedge, num_edges, maxlen;
93 int iswitch, i, j, iseg, max_inputs_to_cblock;
94 float input_cblock_trans, shared_opin_buffer_trans;
95 const float trans_sram_bit = 6.;
105 double ntrans_sharing, ntrans_no_sharing;
111 float trans_track_to_cblock_buf;
112 float trans_cblock_to_lblock_buf;
115 ntrans_no_sharing = 0.;
116 max_inputs_to_cblock = 0;
122 trans_track_to_cblock_buf =
trans_per_buf(R_minW_nmos / 4., R_minW_nmos,
125 trans_cblock_to_lblock_buf =
trans_per_buf(R_minW_nmos / 4., R_minW_nmos,
131 cblock_counted = (
boolean *)
my_calloc(maxlen,
sizeof(
boolean));
132 shared_buffer_trans = (
float *)
my_calloc(maxlen,
sizeof(
float));
135 trans_sram_bit, R_minW_nmos);
138 trans_sram_bit, R_minW_nmos, R_minW_pmos);
140 for (from_node = 0; from_node <
num_rr_nodes; from_node++) {
144 switch (from_rr_type) {
150 for (iedge = 0; iedge < num_edges; iedge++) {
155 switch (to_rr_type) {
163 shared_buffer_trans[iseg] =
std::max(
164 shared_buffer_trans[iseg],
165 sharable_switch_trans[iswitch]);
167 ntrans_no_sharing += unsharable_switch_trans[iswitch]
168 + sharable_switch_trans[iswitch];
169 ntrans_sharing += unsharable_switch_trans[iswitch];
170 }
else if (from_node < to_node) {
175 ntrans_no_sharing += unsharable_switch_trans[iswitch];
176 ntrans_sharing += unsharable_switch_trans[iswitch];
181 num_inputs_to_cblock[to_node]++;
182 max_inputs_to_cblock =
std::max(max_inputs_to_cblock,
183 num_inputs_to_cblock[to_node]);
187 if (cblock_counted[iseg] ==
FALSE) {
188 cblock_counted[iseg] =
TRUE;
189 ntrans_sharing += trans_track_to_cblock_buf;
190 ntrans_no_sharing += trans_track_to_cblock_buf;
195 vpr_printf(TIO_MESSAGE_ERROR,
"in count_routing_transistors:\n");
196 vpr_printf(TIO_MESSAGE_ERROR,
"\tUnexpected connection from node %d (type %d) to node %d (type %d).\n",
197 from_node, from_rr_type, to_node, to_rr_type);
207 if (from_rr_type ==
CHANX) {
208 for (i =
rr_node[from_node].xlow - 1;
210 ntrans_sharing += shared_buffer_trans[i];
211 shared_buffer_trans[i] = 0.;
216 cblock_counted[i] =
FALSE;
219 for (j =
rr_node[from_node].ylow - 1;
221 ntrans_sharing += shared_buffer_trans[j];
222 shared_buffer_trans[j] = 0.;
227 cblock_counted[j] =
FALSE;
234 shared_opin_buffer_trans = 0.;
236 for (iedge = 0; iedge < num_edges; iedge++) {
238 ntrans_no_sharing += unsharable_switch_trans[iswitch]
239 + sharable_switch_trans[iswitch];
240 ntrans_sharing += unsharable_switch_trans[iswitch];
242 shared_opin_buffer_trans =
std::max(shared_opin_buffer_trans,
243 sharable_switch_trans[iswitch]);
246 ntrans_sharing += shared_opin_buffer_trans;
255 free(cblock_counted);
256 free(shared_buffer_trans);
257 free(unsharable_switch_trans);
258 free(sharable_switch_trans);
263 max_inputs_to_cblock, trans_cblock_to_lblock_buf, trans_sram_bit);
265 free(num_inputs_to_cblock);
267 ntrans_sharing += input_cblock_trans;
268 ntrans_no_sharing += input_cblock_trans;
271 vpr_printf(TIO_MESSAGE_INFO,
"Routing area (in minimum width transistor areas)...\n");
272 vpr_printf(TIO_MESSAGE_INFO,
"\tAssuming no buffer sharing (pessimistic). Total: %#g, per logic tile: %#g\n",
273 ntrans_no_sharing, ntrans_no_sharing / (
float) (
nx *
ny));
274 vpr_printf(TIO_MESSAGE_INFO,
"\tAssuming buffer sharing (slightly optimistic). Total: %#g, per logic tile: %#g\n",
275 ntrans_sharing, ntrans_sharing / (
float) (
nx * ny));
280 float R_minW_nmos,
float R_minW_pmos) {
281 boolean * cblock_counted;
282 int *num_inputs_to_cblock;
287 int i, j, iseg, from_node, to_node, iedge, num_edges, maxlen;
288 int max_inputs_to_cblock, cost_index, seg_type, switch_type;
289 float input_cblock_trans;
290 const float trans_sram_bit = 6.;
306 float trans_track_to_cblock_buf;
307 float trans_cblock_to_lblock_buf;
309 max_inputs_to_cblock = 0;
315 trans_track_to_cblock_buf =
trans_per_buf(R_minW_nmos / 4., R_minW_nmos,
318 trans_cblock_to_lblock_buf =
trans_per_buf(R_minW_nmos / 4., R_minW_nmos,
323 cblock_counted = (
boolean *)
my_calloc(maxlen,
sizeof(
boolean));
326 for (from_node = 0; from_node <
num_rr_nodes; from_node++) {
330 switch (from_rr_type) {
339 segment_inf[seg_type].wire_switch == segment_inf[seg_type].opin_switch);
340 assert(
switch_inf[switch_type].mux_trans_size >= 1);
343 assert(
rr_node[from_node].num_opin_drivers == 0);
345 assert(
rr_node[from_node].num_wire_drivers == 0);
362 for (iedge = 0; iedge < num_edges; iedge++) {
367 switch (to_rr_type) {
374 num_inputs_to_cblock[to_node]++;
375 max_inputs_to_cblock =
std::max(max_inputs_to_cblock,
376 num_inputs_to_cblock[to_node]);
379 if (cblock_counted[iseg] ==
FALSE) {
380 cblock_counted[iseg] =
TRUE;
381 ntrans += trans_track_to_cblock_buf;
386 vpr_printf(TIO_MESSAGE_ERROR,
"in count_routing_transistors:\n");
387 vpr_printf(TIO_MESSAGE_ERROR,
"\tUnexpected connection from node %d (type %d) to node %d (type %d).\n",
388 from_node, from_rr_type, to_node, to_rr_type);
397 if (from_rr_type ==
CHANX) {
400 cblock_counted[i] =
FALSE;
405 cblock_counted[j] =
FALSE;
421 max_inputs_to_cblock, trans_cblock_to_lblock_buf, trans_sram_bit);
423 free(cblock_counted);
424 free(num_inputs_to_cblock);
426 ntrans += input_cblock_trans;
429 vpr_printf(TIO_MESSAGE_INFO,
"Routing area (in minimum width transistor areas)...\n");
430 vpr_printf(TIO_MESSAGE_INFO,
"\tTotal routing area: %#g, per logic tile: %#g\n", ntrans, ntrans / (
float) (
nx *
ny));
434 int max_inputs_to_cblock,
float trans_cblock_to_lblock_buf,
435 float trans_sram_bit) {
442 float *trans_per_cblock;
447 (max_inputs_to_cblock + 1) *
sizeof(float));
449 trans_per_cblock[0] = 0.;
455 for (i = 1; i <= max_inputs_to_cblock; i++)
462 num_inputs = num_inputs_to_cblock[i];
463 trans_count += trans_per_cblock[num_inputs];
466 free(trans_per_cblock);
467 return (trans_count);
479 float *unsharable_switch_trans, Rpass;
482 unsharable_switch_trans = (
float *)
my_malloc(num_switch *
sizeof(
float));
484 for (i = 0; i < num_switch; i++) {
492 unsharable_switch_trans[i] =
trans_per_R(Rpass, R_minW_nmos)
496 return (unsharable_switch_trans);
501 float R_minW_nmos,
float R_minW_pmos) {
509 float *sharable_switch_trans, Rbuf;
512 sharable_switch_trans = (
float *)
my_malloc(num_switch *
sizeof(
float));
514 for (i = 0; i < num_switch; i++) {
517 sharable_switch_trans[i] = 0.;
525 return (sharable_switch_trans);
528 static float trans_per_buf(
float Rbuf,
float R_minW_nmos,
float R_minW_pmos) {
534 int num_stage, istage;
535 float trans_count, stage_ratio, Rstage;
537 if (Rbuf > 0.6 * R_minW_nmos || Rbuf <= 0.) {
545 num_stage =
nint(log10(R_minW_nmos / Rbuf) / log10(4.));
547 stage_ratio = pow((
float)(R_minW_nmos / Rbuf), (
float)( 1. / (
float) num_stage));
549 Rstage = R_minW_nmos;
552 for (istage = 0; istage <= num_stage; istage++) {
555 Rstage /= stage_ratio;
559 return (trans_count);
563 float pass_trans_area) {
570 float ntrans, sram_trans, pass_trans;
571 int num_second_stage_trans;
573 if (num_inputs <= 1) {
575 }
else if (num_inputs == 2) {
576 pass_trans = 2 * pass_trans_area;
577 sram_trans = 1 * trans_sram_bit;
578 }
else if (num_inputs <= 4) {
580 pass_trans = num_inputs * pass_trans_area;
581 sram_trans = num_inputs * trans_sram_bit;
586 num_second_stage_trans = (int)floor((
float)sqrt((
float)num_inputs) + 0.00001);
587 pass_trans = (num_inputs + num_second_stage_trans) * pass_trans_area;
589 (
float) num_inputs / num_second_stage_trans - 0.00001)
590 + num_second_stage_trans) * trans_sram_bit;
591 if (num_second_stage_trans == 2) {
594 sram_trans -= 1 * trans_sram_bit;
598 ntrans = pass_trans + sram_trans;
613 if (Rtrans >= R_minW_trans)
622 trans_area = 0.5 * R_minW_trans / Rtrans + 0.5;
static void count_unidir_routing_transistors(t_segment_inf *segment_inf, float R_minW_nmos, float R_minW_pmos)
int seg_index_of_cblock(t_rr_type from_rr_type, int to_node)
static void count_bidir_routing_transistors(int num_switch, float R_minW_nmos, float R_minW_pmos)
t_rr_indexed_data * rr_indexed_data
void * my_calloc(size_t nelem, size_t size)
static float trans_per_buf(float Rbuf, float R_minW_nmos, float R_minW_pmos)
int seg_index_of_sblock(int from_node, int to_node)
static void * my_malloc(int ibytes)
static float * alloc_and_load_unsharable_switch_trans(int num_switch, float trans_sram_bit, float R_minW_nmos)
static float * alloc_and_load_sharable_switch_trans(int num_switch, float trans_sram_bit, float R_minW_nmos, float R_minW_pmos)
struct s_switch_inf * switch_inf
static float trans_per_R(float Rtrans, float R_minW_trans)
static float trans_per_mux(int num_inputs, float trans_sram_bit, float pass_trans_area)
static float get_cblock_trans(int *num_inputs_to_cblock, int max_inputs_to_cblock, float trans_cblock_to_lblock_buf, float trans_sram_bit)
float ipin_mux_trans_size
void count_routing_transistors(enum e_directionality directionality, int num_switch, t_segment_inf *segment_inf, float R_minW_nmos, float R_minW_pmos)