16
16
#include " rr_graph_indexed_data.h"
17
17
#include " read_xml_arch_file.h"
18
18
19
+ #include " histogram.h"
20
+
19
21
#include " echo_files.h"
20
22
21
23
/* ****************** Subroutines local to this module ************************/
@@ -302,18 +304,18 @@ static void load_rr_indexed_data_T_values() {
302
304
auto & rr_indexed_data = device_ctx.rr_indexed_data ;
303
305
304
306
std::vector<int > num_nodes_of_index (rr_indexed_data.size (), 0 );
305
- std::vector<float > C_total (rr_indexed_data.size (), 0.0 );
306
- std::vector<float > R_total (rr_indexed_data.size (), 0.0 );
307
+ std::vector<std::vector< float >> C_total (rr_indexed_data.size ());
308
+ std::vector<std::vector< float >> R_total (rr_indexed_data.size ());
307
309
308
310
/* August 2014: Not all wire-to-wire switches connecting from some wire segment will
309
311
* necessarily have the same delay. i.e. a mux with less inputs will have smaller delay
310
312
* than a mux with a greater number of inputs. So to account for these differences we will
311
313
* get the average R/Tdel/Cinternal values by first averaging them for a single wire segment
312
314
* (first for loop below), and then by averaging this value over all wire segments in the channel
313
315
* (second for loop below) */
314
- std::vector<double > switch_R_total (rr_indexed_data.size (), 0.0 );
315
- std::vector<double > switch_T_total (rr_indexed_data.size (), 0.0 );
316
- std::vector<double > switch_Cinternal_total (rr_indexed_data.size (), 0.0 );
316
+ std::vector<std::vector< float >> switch_R_total (rr_indexed_data.size ());
317
+ std::vector<std::vector< float >> switch_T_total (rr_indexed_data.size ());
318
+ std::vector<std::vector< float >> switch_Cinternal_total (rr_indexed_data.size ());
317
319
std::vector<short > switches_buffered (rr_indexed_data.size (), UNDEFINED);
318
320
319
321
/* Get average C and R values for all the segments of this type in one *
@@ -343,12 +345,12 @@ static void load_rr_indexed_data_T_values() {
343
345
VTR_ASSERT (num_switches > 0 );
344
346
345
347
num_nodes_of_index[cost_index]++;
346
- C_total[cost_index] += rr_nodes[inode].C ();
347
- R_total[cost_index] += rr_nodes[inode].R ();
348
+ C_total[cost_index]. push_back ( rr_nodes[inode].C () );
349
+ R_total[cost_index]. push_back ( rr_nodes[inode].R () );
348
350
349
- switch_R_total[cost_index] += avg_switch_R;
350
- switch_T_total[cost_index] += avg_switch_T;
351
- switch_Cinternal_total[cost_index] += avg_switch_Cinternal;
351
+ switch_R_total[cost_index]. push_back ( avg_switch_R) ;
352
+ switch_T_total[cost_index]. push_back ( avg_switch_T) ;
353
+ switch_Cinternal_total[cost_index]. push_back ( avg_switch_Cinternal) ;
352
354
if (buffered == UNDEFINED) {
353
355
/* this segment does not have any outgoing edges to other general routing wires */
354
356
continue ;
@@ -370,6 +372,8 @@ static void load_rr_indexed_data_T_values() {
370
372
}
371
373
}
372
374
375
+ auto & segment_inf = device_ctx.rr_segments ;
376
+
373
377
for (size_t cost_index = CHANX_COST_INDEX_START;
374
378
cost_index < rr_indexed_data.size (); cost_index++) {
375
379
if (num_nodes_of_index[cost_index] == 0 ) { /* Segments don't exist. */
@@ -378,11 +382,17 @@ static void load_rr_indexed_data_T_values() {
378
382
rr_indexed_data[cost_index].T_quadratic = 0.0 ;
379
383
rr_indexed_data[cost_index].C_load = 0.0 ;
380
384
} else {
381
- float Rnode = R_total[cost_index] / num_nodes_of_index[cost_index];
382
- float Cnode = C_total[cost_index] / num_nodes_of_index[cost_index];
383
- float Rsw = (float )switch_R_total[cost_index] / num_nodes_of_index[cost_index];
384
- float Tsw = (float )switch_T_total[cost_index] / num_nodes_of_index[cost_index];
385
- float Cinternalsw = (float )switch_Cinternal_total[cost_index] / num_nodes_of_index[cost_index];
385
+ auto C_total_histogram = build_histogram (C_total[cost_index], 10 );
386
+ auto R_total_histogram = build_histogram (R_total[cost_index], 10 );
387
+ auto switch_R_total_histogram = build_histogram (switch_R_total[cost_index], 10 );
388
+ auto switch_T_total_histogram = build_histogram (switch_T_total[cost_index], 10 );
389
+ auto switch_Cinternal_total_histogram = build_histogram (switch_Cinternal_total[cost_index], 10 );
390
+
391
+ float Rnode = get_histogram_mode (R_total_histogram);
392
+ float Cnode = get_histogram_mode (C_total_histogram);
393
+ float Rsw = get_histogram_mode (switch_R_total_histogram);
394
+ float Tsw = get_histogram_mode (switch_T_total_histogram);
395
+ float Cinternalsw = get_histogram_mode (switch_Cinternal_total_histogram);
386
396
387
397
if (switches_buffered[cost_index]) {
388
398
// Here, we are computing the linear time delay for buffered switches. Tlinear is
0 commit comments