1
1
#include < cmath> /* Needed only for sqrt call (remove if sqrt removed) */
2
+ #include < fstream>
3
+ #include < iomanip>
2
4
3
5
#include " vtr_assert.h"
4
6
#include " vtr_log.h"
14
16
#include " rr_graph_indexed_data.h"
15
17
#include " read_xml_arch_file.h"
16
18
19
+ #include " echo_files.h"
20
+
17
21
/* ****************** Subroutines local to this module ************************/
18
22
19
23
static void load_rr_indexed_data_base_costs (enum e_base_cost_type base_cost_type);
@@ -28,7 +32,7 @@ static void fixup_rr_indexed_data_T_values(size_t num_segment);
28
32
29
33
static std::vector<size_t > count_rr_segment_types ();
30
34
31
- static void print_rr_index_info (const std::vector<t_segment_inf>& segment_inf);
35
+ static void print_rr_index_info (const char * fname, const std::vector<t_segment_inf>& segment_inf);
32
36
33
37
/* ******************* Subroutine definitions *********************************/
34
38
@@ -115,7 +119,10 @@ void alloc_and_load_rr_indexed_data(const std::vector<t_segment_inf>& segment_in
115
119
116
120
load_rr_indexed_data_base_costs (base_cost_type);
117
121
118
- if (false ) print_rr_index_info (segment_inf);
122
+ if (getEchoEnabled () && isEchoFileEnabled (E_ECHO_RR_GRAPH_INDEXED_DATA)) {
123
+ print_rr_index_info (getEchoFileName (E_ECHO_RR_GRAPH_INDEXED_DATA),
124
+ segment_inf);
125
+ }
119
126
}
120
127
121
128
void load_rr_index_segments (const int num_segment) {
@@ -269,7 +276,18 @@ static float get_delay_normalization_fac() {
269
276
Tdel_num += 1 ;
270
277
}
271
278
272
- return Tdel_sum / Tdel_num;
279
+ float delay_norm_fac = Tdel_sum / Tdel_num;
280
+
281
+ if (getEchoEnabled () && isEchoFileEnabled (E_ECHO_RR_GRAPH_INDEXED_DATA)) {
282
+ std::ofstream out_file;
283
+
284
+ out_file.open (getEchoFileName (E_ECHO_RR_GRAPH_INDEXED_DATA));
285
+ out_file << " Delay normalization factor: " << delay_norm_fac << std::endl;
286
+
287
+ out_file.close ();
288
+ }
289
+
290
+ return delay_norm_fac;
273
291
}
274
292
275
293
static void load_rr_indexed_data_T_values () {
@@ -471,32 +489,50 @@ static void fixup_rr_indexed_data_T_values(size_t num_segment) {
471
489
}
472
490
}
473
491
474
- static void print_rr_index_info (const std::vector<t_segment_inf>& segment_inf) {
492
+ static void print_rr_index_info (const char * fname, const std::vector<t_segment_inf>& segment_inf) {
475
493
auto & device_ctx = g_vpr_ctx.device ();
476
494
495
+ std::ofstream out_file;
496
+
497
+ out_file.open (fname, std::ios_base::app);
498
+ out_file << std::left << std::setw (30 ) << " Cost Index" ;
499
+ out_file << std::left << std::setw (20 ) << " Base Cost" ;
500
+ out_file << std::left << std::setw (20 ) << " Ortho Cost Index" ;
501
+ out_file << std::left << std::setw (20 ) << " Seg Index" ;
502
+ out_file << std::left << std::setw (20 ) << " Inv. Length" ;
503
+ out_file << std::left << std::setw (20 ) << " T. Linear" ;
504
+ out_file << std::left << std::setw (20 ) << " T. Quadratic" ;
505
+ out_file << std::left << std::setw (20 ) << " C. Load" << std::endl;
477
506
for (size_t cost_index = 0 ; cost_index < device_ctx.rr_indexed_data .size (); ++cost_index) {
478
507
auto & index_data = device_ctx.rr_indexed_data [cost_index];
479
508
509
+ std::ostringstream string_stream;
510
+
480
511
if (cost_index == SOURCE_COST_INDEX) {
481
- VTR_LOG ( " Cost Index %zu SOURCE \n " , cost_index) ;
512
+ string_stream << cost_index << " SOURCE " ;
482
513
} else if (cost_index == SINK_COST_INDEX) {
483
- VTR_LOG ( " Cost Index %zu SINK \n " , cost_index) ;
514
+ string_stream << cost_index << " SINK " ;
484
515
} else if (cost_index == OPIN_COST_INDEX) {
485
- VTR_LOG ( " Cost Index %zu OPIN \n " , cost_index) ;
516
+ string_stream << cost_index << " OPIN " ;
486
517
} else if (cost_index == IPIN_COST_INDEX) {
487
- VTR_LOG ( " Cost Index %zu IPIN \n " , cost_index) ;
518
+ string_stream << cost_index << " IPIN " ;
488
519
} else if (cost_index <= IPIN_COST_INDEX + segment_inf.size ()) {
489
- VTR_LOG ( " Cost Index %zu CHANX %s \n " , cost_index, segment_inf[index_data.seg_index ].name .c_str () );
520
+ string_stream << cost_index << " CHANX " << segment_inf[index_data.seg_index ].name .c_str ();
490
521
} else {
491
- VTR_LOG ( " Cost Index %zu CHANY %s \n " , cost_index, segment_inf[index_data.seg_index ].name .c_str () );
522
+ string_stream << cost_index << " CHANY " << segment_inf[index_data.seg_index ].name .c_str ();
492
523
}
493
524
494
- VTR_LOG (" \t base_cost=%g\n " , index_data.base_cost );
495
- VTR_LOG (" \t ortho_cost_index=%d\n " , index_data.ortho_cost_index );
496
- VTR_LOG (" \t seg_index=%d\n " , index_data.seg_index );
497
- VTR_LOG (" \t inv_length=%g\n " , index_data.inv_length );
498
- VTR_LOG (" \t T_linear=%g\n " , index_data.T_linear );
499
- VTR_LOG (" \t T_quadratic=%g\n " , index_data.T_quadratic );
500
- VTR_LOG (" \t C_load=%g\n " , index_data.C_load );
525
+ std::string cost_index_str = string_stream.str ();
526
+
527
+ out_file << std::left << std::setw (30 ) << cost_index_str;
528
+ out_file << std::left << std::setw (20 ) << index_data.base_cost ;
529
+ out_file << std::left << std::setw (20 ) << index_data.ortho_cost_index ;
530
+ out_file << std::left << std::setw (20 ) << index_data.seg_index ;
531
+ out_file << std::left << std::setw (20 ) << index_data.inv_length ;
532
+ out_file << std::left << std::setw (20 ) << index_data.T_linear ;
533
+ out_file << std::left << std::setw (20 ) << index_data.T_quadratic ;
534
+ out_file << std::left << std::setw (20 ) << index_data.C_load << std::endl;
501
535
}
536
+
537
+ out_file.close ();
502
538
}
0 commit comments