bug fixing in fpga_flow scripts and add more print-out message for VPR
This commit is contained in:
parent
95674c4687
commit
4392c6bc3a
|
@ -20,6 +20,7 @@ my $mydate = gmctime();
|
||||||
my $cwd = getcwd();
|
my $cwd = getcwd();
|
||||||
|
|
||||||
# Global Variants
|
# Global Variants
|
||||||
|
my ($max_route_width_retry) = (1000);
|
||||||
# input Option Hash
|
# input Option Hash
|
||||||
my %opt_h;
|
my %opt_h;
|
||||||
my $opt_ptr = \%opt_h;
|
my $opt_ptr = \%opt_h;
|
||||||
|
@ -112,7 +113,7 @@ sub generate_path($)
|
||||||
mkpath "$mypath";
|
mkpath "$mypath";
|
||||||
print "Path($mypath) does not exist...Create it.\n";
|
print "Path($mypath) does not exist...Create it.\n";
|
||||||
}
|
}
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Print the usage
|
# Print the usage
|
||||||
|
@ -267,7 +268,7 @@ sub read_opt_into_hash($ $ $)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Read options
|
# Read options
|
||||||
|
@ -370,7 +371,7 @@ sub opts_read()
|
||||||
|
|
||||||
&print_opts();
|
&print_opts();
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
# List the options
|
# List the options
|
||||||
|
@ -381,7 +382,7 @@ sub print_opts()
|
||||||
while(my ($key,$value) = each(%opt_h))
|
while(my ($key,$value) = each(%opt_h))
|
||||||
{print "$key : $value\n";}
|
{print "$key : $value\n";}
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -429,7 +430,7 @@ sub check_keywords_conf()
|
||||||
{die "Error: Keyword($mctgy[$imcg],$sctgy[$imcg]->[$iscg]) is missing!\n";}
|
{die "Error: Keyword($mctgy[$imcg],$sctgy[$imcg]->[$iscg]) is missing!\n";}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Read the configuration file
|
# Read the configuration file
|
||||||
|
@ -467,7 +468,7 @@ sub read_conf()
|
||||||
print "Checking these keywords...";
|
print "Checking these keywords...";
|
||||||
print "Successfully\n";
|
print "Successfully\n";
|
||||||
close(CONF);
|
close(CONF);
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub read_benchmarks()
|
sub read_benchmarks()
|
||||||
|
@ -499,7 +500,7 @@ sub read_benchmarks()
|
||||||
foreach my $temp(@benchmark_names)
|
foreach my $temp(@benchmark_names)
|
||||||
{print "$temp\n";}
|
{print "$temp\n";}
|
||||||
close(FCONF);
|
close(FCONF);
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Input program path is like "~/program_dir/program_name"
|
# Input program path is like "~/program_dir/program_name"
|
||||||
|
@ -1744,6 +1745,9 @@ sub run_vpr_in_flow($ $ $ $ $ $ $ $ $ $ $ $) {
|
||||||
if (-e $vpr_route) {
|
if (-e $vpr_route) {
|
||||||
print "INFO: try route_chan_width($min_chan_width) success!\n";
|
print "INFO: try route_chan_width($min_chan_width) success!\n";
|
||||||
last; #Jump out
|
last; #Jump out
|
||||||
|
} elsif ($max_route_width_retry < $min_chan_width) {
|
||||||
|
# I set a threshold of 1000 as it is the limit of VPR
|
||||||
|
die "ERROR: Route Fail for $abc_blif_out with a min_chan_width of $min_chan_width!\n";
|
||||||
} else {
|
} else {
|
||||||
print "INFO: try route_chan_width($min_chan_width) failed! Retry with +2...\n";
|
print "INFO: try route_chan_width($min_chan_width) failed! Retry with +2...\n";
|
||||||
$min_chan_width += 2;
|
$min_chan_width += 2;
|
||||||
|
@ -1767,6 +1771,9 @@ sub run_vpr_in_flow($ $ $ $ $ $ $ $ $ $ $ $) {
|
||||||
if (-e $vpr_route) {
|
if (-e $vpr_route) {
|
||||||
print "INFO: try route_chan_width($fix_chan_width) success!\n";
|
print "INFO: try route_chan_width($fix_chan_width) success!\n";
|
||||||
last; #Jump out
|
last; #Jump out
|
||||||
|
} elsif ($max_route_width_retry < $fix_chan_width) {
|
||||||
|
# I set a threshold of 1000 as it is the limit of VPR
|
||||||
|
die "ERROR: Route Fail for $abc_blif_out with a min_chan_width of $fix_chan_width!\n";
|
||||||
} else {
|
} else {
|
||||||
print "INFO: try route_chan_width($fix_chan_width) failed! Retry with +2...\n";
|
print "INFO: try route_chan_width($fix_chan_width) failed! Retry with +2...\n";
|
||||||
$fix_chan_width += 2;
|
$fix_chan_width += 2;
|
||||||
|
|
|
@ -29,7 +29,7 @@ sub print_usage()
|
||||||
print " -add_default_clk\n";
|
print " -add_default_clk\n";
|
||||||
print " -initial_blif <input_blif_path>\n";
|
print " -initial_blif <input_blif_path>\n";
|
||||||
print "\n";
|
print "\n";
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub opts_read()
|
sub opts_read()
|
||||||
|
@ -53,7 +53,7 @@ sub opts_read()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Print a line of blif netlist
|
# Print a line of blif netlist
|
||||||
|
@ -432,15 +432,15 @@ sub scan_blif()
|
||||||
}
|
}
|
||||||
close($FIN2);
|
close($FIN2);
|
||||||
close($FOUT);
|
close($FOUT);
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub main()
|
sub main()
|
||||||
{
|
{
|
||||||
&opts_read();
|
&opts_read();
|
||||||
&scan_blif();
|
&scan_blif();
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
&main();
|
&main();
|
||||||
exit(1);
|
exit(0);
|
||||||
|
|
|
@ -90,7 +90,7 @@ sub findPath(){
|
||||||
} else {
|
} else {
|
||||||
$path = "$path"."/"."$folders[$count]";
|
$path = "$path"."/"."$folders[$count]";
|
||||||
if($folders[$count] eq $folder_top){
|
if($folders[$count] eq $folder_top){
|
||||||
print "$path\n";
|
#print "$path\n";
|
||||||
return $path;
|
return $path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,4 +135,4 @@ sub main()
|
||||||
}
|
}
|
||||||
|
|
||||||
&main();
|
&main();
|
||||||
exit(1);
|
exit(0);
|
||||||
|
|
|
@ -506,3 +506,182 @@ void print_rr_graph_stats(const t_rr_graph& rr_graph) {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* Print statistics of a rr_graph
|
||||||
|
* 1. We print number of nodes by types
|
||||||
|
* 2. Print the number of edges
|
||||||
|
************************************************************************/
|
||||||
|
void print_rr_graph_stats() {
|
||||||
|
|
||||||
|
/* Print number of nodes */
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, "Statistics on number of RR nodes (by node type): \n");
|
||||||
|
|
||||||
|
/* Count the number of nodes */
|
||||||
|
std::vector<size_t> num_nodes_per_type;
|
||||||
|
num_nodes_per_type.resize(NUM_RR_TYPES);
|
||||||
|
num_nodes_per_type.assign(NUM_RR_TYPES, 0);
|
||||||
|
|
||||||
|
for (int inode = 0; inode < num_rr_nodes; ++inode) {
|
||||||
|
num_nodes_per_type[rr_node[inode].type]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the largest string size of rr_node_typename */
|
||||||
|
size_t max_str_typename = 0;
|
||||||
|
for (int type = 0; type < NUM_RR_TYPES; ++type) {
|
||||||
|
max_str_typename = std::max(max_str_typename, strlen(rr_node_typename[type]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Constant strings */
|
||||||
|
char* type_str = " Type ";
|
||||||
|
char* total_str = " Total ";
|
||||||
|
char* node_str = " No. of nodes ";
|
||||||
|
char* edge_str = " No. of edges ";
|
||||||
|
|
||||||
|
/* Count the number of characters per line:
|
||||||
|
* we check the string length of each node type
|
||||||
|
* Then we plus two reserved strings "type" and "total"
|
||||||
|
*/
|
||||||
|
size_t num_char_per_line = 0;
|
||||||
|
for (int type = 0; type < NUM_RR_TYPES; ++type) {
|
||||||
|
num_char_per_line += 6 + max_str_typename;
|
||||||
|
}
|
||||||
|
num_char_per_line += strlen(type_str);
|
||||||
|
num_char_per_line += strlen(total_str);
|
||||||
|
|
||||||
|
/* Print splitter */
|
||||||
|
for (size_t ichar = 0; ichar < num_char_per_line; ++ichar) {
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, "-");
|
||||||
|
}
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, "\n");
|
||||||
|
|
||||||
|
/* Print node type */
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, "%s", type_str);
|
||||||
|
for (int type = 0; type < NUM_RR_TYPES; ++type) {
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, " %s ", rr_node_typename[type]);
|
||||||
|
}
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, "%s", total_str);
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, "\n");
|
||||||
|
|
||||||
|
/* Print node numbers */
|
||||||
|
int total_num_nodes = 0;
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, "%s", node_str);
|
||||||
|
for (int type = 0; type < NUM_RR_TYPES; ++type) {
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, " %10lu ", num_nodes_per_type[type]);
|
||||||
|
total_num_nodes += num_nodes_per_type[type];
|
||||||
|
}
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, " %10lu ", num_rr_nodes);
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, "\n");
|
||||||
|
|
||||||
|
/* Check we have the same number as stated in rr_graph */
|
||||||
|
assert (total_num_nodes == num_rr_nodes);
|
||||||
|
|
||||||
|
/* Count the number of edges */
|
||||||
|
size_t num_edges = 0;
|
||||||
|
std::vector<size_t> num_edges_per_type;
|
||||||
|
num_edges_per_type.resize(NUM_RR_TYPES);
|
||||||
|
num_edges_per_type.assign(NUM_RR_TYPES, 0);
|
||||||
|
|
||||||
|
for (int inode = 0; inode < num_rr_nodes; ++inode) {
|
||||||
|
num_edges_per_type[rr_node[inode].type] += rr_node[inode].num_edges;
|
||||||
|
}
|
||||||
|
for (int inode = 0; inode < num_rr_nodes; ++inode) {
|
||||||
|
num_edges += rr_node[inode].num_edges;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Print number of edges */
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, "%s", edge_str);
|
||||||
|
for (int type = 0; type < NUM_RR_TYPES; ++type) {
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, " %10lu ", num_edges_per_type[type]);
|
||||||
|
}
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, " %10lu ", num_edges);
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, "\n");
|
||||||
|
|
||||||
|
/* Print splitter */
|
||||||
|
for (size_t ichar = 0; ichar < num_char_per_line; ++ichar) {
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, "-");
|
||||||
|
}
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, "\n");
|
||||||
|
|
||||||
|
/* Print MUX size distribution */
|
||||||
|
/* Get the maximum SB mux size */
|
||||||
|
short max_sb_mux_size = 0;
|
||||||
|
for (int inode = 0; inode < num_rr_nodes; ++inode) {
|
||||||
|
/* MUX multiplexers for SBs */
|
||||||
|
if ( (CHANX == rr_node[inode].type)
|
||||||
|
|| (CHANY == rr_node[inode].type) ) {
|
||||||
|
max_sb_mux_size = std::max(rr_node[inode].fan_in, max_sb_mux_size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Get the minimum SB mux size */
|
||||||
|
short min_sb_mux_size = max_sb_mux_size;
|
||||||
|
for (int inode = 0; inode < num_rr_nodes; ++inode) {
|
||||||
|
/* MUX multiplexers for SBs */
|
||||||
|
if ( (CHANX == rr_node[inode].type)
|
||||||
|
|| (CHANY == rr_node[inode].type) ) {
|
||||||
|
min_sb_mux_size = std::min(rr_node[inode].fan_in, min_sb_mux_size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the minimum SB mux size */
|
||||||
|
int num_sb_mux = 0;
|
||||||
|
short avg_sb_mux_size = 0;
|
||||||
|
for (int inode = 0; inode < num_rr_nodes; ++inode) {
|
||||||
|
/* MUX multiplexers for SBs */
|
||||||
|
if ( (CHANX == rr_node[inode].type)
|
||||||
|
|| (CHANY == rr_node[inode].type) ) {
|
||||||
|
avg_sb_mux_size += rr_node[inode].fan_in;
|
||||||
|
num_sb_mux++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
avg_sb_mux_size /= num_sb_mux;
|
||||||
|
/* Print statistics */
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, "------------------------------------------------\n");
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, "Total No. of Switch Block Multiplexer size:%d\n", num_sb_mux);
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, "Maximum Switch Block Multiplexer size:%d\n", max_sb_mux_size);
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, "Minimum Switch Block Multiplexer size:%d\n", min_sb_mux_size);
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, "Average Switch Block Multiplexer size:%d\n", avg_sb_mux_size);
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, "------------------------------------------------\n");
|
||||||
|
|
||||||
|
/* Get the maximum SB mux size */
|
||||||
|
short max_cb_mux_size = 0;
|
||||||
|
for (int inode = 0; inode < num_rr_nodes; ++inode) {
|
||||||
|
/* MUX multiplexers for SBs */
|
||||||
|
if (IPIN == rr_node[inode].type) {
|
||||||
|
max_cb_mux_size = std::max(rr_node[inode].fan_in, max_cb_mux_size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Get the minimum SB mux size */
|
||||||
|
short min_cb_mux_size = max_cb_mux_size;
|
||||||
|
for (int inode = 0; inode < num_rr_nodes; ++inode) {
|
||||||
|
/* MUX multiplexers for SBs */
|
||||||
|
if (IPIN == rr_node[inode].type) {
|
||||||
|
min_cb_mux_size = std::min(rr_node[inode].fan_in, min_cb_mux_size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the minimum SB mux size */
|
||||||
|
int num_cb_mux = 0;
|
||||||
|
short avg_cb_mux_size = 0;
|
||||||
|
for (int inode = 0; inode < num_rr_nodes; ++inode) {
|
||||||
|
/* MUX multiplexers for SBs */
|
||||||
|
if (IPIN == rr_node[inode].type) {
|
||||||
|
avg_cb_mux_size += rr_node[inode].fan_in;
|
||||||
|
num_cb_mux++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
avg_cb_mux_size /= num_cb_mux;
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, "------------------------------------------------\n");
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, "Total No. of Connection Block Multiplexer size:%d\n", num_cb_mux);
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, "Maximum Connection Block Multiplexer size:%d\n", max_cb_mux_size);
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, "Minimum Connection Block Multiplexer size:%d\n", min_cb_mux_size);
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, "Average Connection Block Multiplexer size:%d\n", avg_cb_mux_size);
|
||||||
|
vpr_printf(TIO_MESSAGE_INFO, "------------------------------------------------\n");
|
||||||
|
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* End of file : rr_graph_builder_utils.cpp
|
||||||
|
***********************************************************************/
|
||||||
|
|
|
@ -43,5 +43,7 @@ short get_track_rr_node_end_track_id(const t_rr_node* track_rr_node);
|
||||||
|
|
||||||
void print_rr_graph_stats(const t_rr_graph& rr_graph);
|
void print_rr_graph_stats(const t_rr_graph& rr_graph);
|
||||||
|
|
||||||
|
void print_rr_graph_stats();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1038,7 +1038,7 @@ void build_tileable_unidir_rr_graph(INP const int L_num_types,
|
||||||
build_rr_graph_direct_connections(&rr_graph, device_size, grids, delayless_switch,
|
build_rr_graph_direct_connections(&rr_graph, device_size, grids, delayless_switch,
|
||||||
num_directs, directs, clb_to_clb_directs);
|
num_directs, directs, clb_to_clb_directs);
|
||||||
|
|
||||||
print_rr_graph_stats(rr_graph);
|
//print_rr_graph_stats(rr_graph);
|
||||||
|
|
||||||
/* Clear driver switches of the rr_graph */
|
/* Clear driver switches of the rr_graph */
|
||||||
clear_rr_graph_driver_switch(&rr_graph);
|
clear_rr_graph_driver_switch(&rr_graph);
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "ReadOptions.h"
|
#include "ReadOptions.h"
|
||||||
|
|
||||||
#include "tileable_rr_graph_builder.h"
|
#include "tileable_rr_graph_builder.h"
|
||||||
|
#include "rr_graph_builder_utils.h"
|
||||||
|
|
||||||
/* Xifan TANG: SWSEG SUPPORT */
|
/* Xifan TANG: SWSEG SUPPORT */
|
||||||
#include "rr_graph_swseg.h"
|
#include "rr_graph_swseg.h"
|
||||||
|
@ -245,6 +246,9 @@ void build_rr_graph(INP t_graph_type graph_type, INP int L_num_types,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Print statistics of RR graph */
|
||||||
|
print_rr_graph_stats();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue