1 /* { dg-do compile } */
2 /* { dg-options "-O2" } */
4 extern double log10 (double __x
);
5 extern double ceil (double __x
);
6 extern double floor (double __x
);
7 extern void free (void *__ptr
);
8 extern void *my_malloc (unsigned int);
9 extern int num_rr_nodes
;
10 static float get_cblock_trans (int *num_inputs_to_cblock
,
11 int max_inputs_to_cblock
,
12 float trans_cblock_to_lblock_buf
,
13 float trans_sram_bit
);
14 static float trans_per_mux (int num_inputs
, float trans_sram_bit
);
16 count_routing_transistors (int num_switch
, float R_minW_nmos
,
19 int *num_inputs_to_cblock
;
20 int iswitch
, i
, j
, iseg
, max_inputs_to_cblock
;
21 float input_cblock_trans
;
22 const float trans_sram_bit
= 6.;
23 float trans_cblock_to_lblock_buf
;
25 get_cblock_trans (num_inputs_to_cblock
, max_inputs_to_cblock
,
26 trans_cblock_to_lblock_buf
, trans_sram_bit
);
30 get_cblock_trans (int *num_inputs_to_cblock
, int max_inputs_to_cblock
,
31 float trans_cblock_to_lblock_buf
, float trans_sram_bit
)
33 float *trans_per_cblock
;
38 (float *) my_malloc ((max_inputs_to_cblock
+ 1) * sizeof (float));
39 for (i
= 1; i
<= max_inputs_to_cblock
; i
++)
41 trans_per_mux (i
, trans_sram_bit
) + trans_cblock_to_lblock_buf
;
42 for (i
= 0; i
< num_rr_nodes
; i
++)
44 num_inputs
= num_inputs_to_cblock
[i
];
45 trans_count
+= trans_per_cblock
[num_inputs
];
47 free (trans_per_cblock
);
52 trans_per_mux (int num_inputs
, float trans_sram_bit
)
54 int nlevels
, ilevel
, current_inps
;
59 nlevels
= ceil (log10 (num_inputs
) / log10 (2.) - 0.00001);
60 current_inps
= num_inputs
;
61 for (ilevel
= 1; ilevel
<= nlevels
; ilevel
++)
63 ntrans
+= 2 * floor (current_inps
/ 2.);
64 current_inps
= ceil (current_inps
/ 2.);
66 ntrans
+= trans_sram_bit
* nlevels
;