= clk_limit);
endmodule
";
return $top_v;
}
sub save_the_sof_file{
my $self=shift;
my $name=$self->object_get_attribute ('fpga_param',"SAVE_NAME");
my $sofdir="$ENV{PRONOC_WORK}/emulate/sof";
my $fpga_board=$self->object_get_attribute('compile','board');
my $target_dir = "$ENV{'PRONOC_WORK'}/emulate/$name";
mkpath("$sofdir/$fpga_board/",1,01777);
open(FILE, ">$sofdir/$fpga_board/$name.inf") || die "Can not open: $!";
print FILE perl_file_header("$name.inf");
my %pp;
$pp{'noc_param'}= $self->{'noc_param'};
$pp{'fpga_param'}= $self->{'fpga_param'};
print FILE Data::Dumper->Dump([\%pp],["emulate_info"]);
close(FILE) || die "Error closing file: $!";
#find $dir_name -name \*.sof -exec cp '{}' $sofdir/$fpga_board/$save_name.sof"
my @files = File::Find::Rule->file()
->name( '*.sof' )
->in( "$target_dir" );
copy($files[0],"$sofdir/$fpga_board/$name.sof") or do {
my $err= "Error copy($files[0] , $sofdir/$fpga_board/$name.sof";
print "$err\n";
message_dialog($err,'error');
return;
};
#copy the board's programming and jtag interface files
my $board_name=$self->object_get_attribute('compile','board');
#copy board jtag_intfc.sh file
copy("../boards/Altera/$board_name/jtag_intfc.sh","$sofdir/$fpga_board/jtag_intfc.sh");
#print "../boards/$board_name/jtag_intfc.sh","$sofdir/$fpga_board/jtag_intfc.sh\n";
#add argument run to jtag_interface file
my $runarg='
if [ $# -ne 0 ]
then
$JTAG_INTFC $1
fi
';
append_text_to_file ("$sofdir/$fpga_board/jtag_intfc.sh",$runarg );
#copy board program_device.sh file
copy("../boards/Altera/$board_name/program_device.sh","$sofdir/$fpga_board/program_device.sh");
message_dialog("sof file has been generated successfully");
}
##########
# save_emulation
##########
sub save_emulation {
my ($emulate)=@_;
# read emulation name
my $name=$emulate->object_get_attribute ("emulate_name",undef);
my $s= (!defined $name)? 0 : (length($name)==0)? 0 :1;
if ($s == 0){
message_dialog("Please set emulation name!");
return 0;
}
# Write object file
open(FILE, ">lib/emulate/$name.EML") || die "Can not open: $!";
print FILE perl_file_header("$name.EML");
print FILE Data::Dumper->Dump([\%$emulate],["emulate"]);
close(FILE) || die "Error closing file: $!";
message_dialog("Emulation saved as lib/emulate/$name.EML!");
return 1;
}
#############
# load_emulation
############
sub load_emulation {
my ($emulate,$info)=@_;
my $file;
my $dialog = gen_file_dialog (undef, 'EML');
my $dir = Cwd::getcwd();
$dialog->set_current_folder ("$dir/lib/emulate");
if ( "ok" eq $dialog->run ) {
$file = $dialog->get_filename;
my ($name,$path,$suffix) = fileparse("$file",qr"\..[^.]*$");
if($suffix eq '.EML'){
my ($pp,$r,$err) = regen_object($file);
if ($r ){
add_colored_info($info,"**Error reading $file file: $err\n",'red');
$dialog->destroy;
return;
}
clone_obj($emulate,$pp);
#message_dialog("done!");
}
}
$dialog->destroy;
}
sub update_result {
my ($self,$sample,$name,$x,$y,$z)=@_;
my $ref=$self->object_get_attribute ($sample,$name);
my %results;
%results= %{$ref} if(defined $ref);
if(!defined $z) {$results{$x}=$y;}
else {$results{$x}{$y}=$z;}
$self->object_add_attribute ($sample,$name,\%results);
}
sub gen_sim_parameter_h {
my ($param_h,$includ_h,$ne,$nr,$router_p,$fifow)=@_;
$param_h =~ s/\d\'b/ /g;
my $text= "
#ifndef INCLUDE_PARAM
#define INCLUDE_PARAM \n \n
$param_h
#define NE $ne
#define NR $nr
#define ROUTER_P_NUM $router_p
extern Vtraffic *traffic[NE];
extern Vpck_inj *pck_inj[NE];
extern int reset,clk;
//simulation parameter
#define MAX_RATIO ".MAX_RATIO."
#define AVG_LATENCY_METRIC \"HEAD_2_TAIL\"
#define TIMSTMP_FIFO_NUM $fifow
$includ_h
\n \n \#endif" ;
return $text;
}
sub gen_noc_sim_param {
my $simulate=shift;
my $fifow=$simulate->object_get_attribute('fpga_param','TIMSTMP_FIFO_NUM');
$fifow= '16' if (!defined $fifow);
return "
//simulation parameter
//localparam MAX_RATIO = ".MAX_RATIO.";
localparam MAX_PCK_NUM = ".MAX_SIM_CLKs.";
localparam MAX_PCK_SIZ = ".MAX_PCK_SIZ.";
localparam MAX_SIM_CLKs= ".MAX_SIM_CLKs.";
localparam TIMSTMP_FIFO_NUM = $fifow;
";
}
sub gen_noc_localparam_v_file {
my ($self,$dst_path,$sample)=@_;
# generate NoC parameter file
my ($noc_param,$pass_param)=gen_noc_param_v($self,$sample);
my $header=autogen_warning().get_license_header("noc_localparam.v");
open(FILE, ">${dst_path}/noc_localparam.v") || die "Can not open: $!";
my $sim =gen_noc_sim_param($self);
print FILE "$header
\`ifdef NOC_LOCAL_PARAM \n \n
$noc_param
$sim
\n \n \`endif";
close FILE;
}
############
# main
############
sub emulator_main{
add_color_to_gd();
my $emulate= emulator->emulator_new();
set_gui_status($emulate,"ideal",0);
$emulate->object_add_attribute('compile','compilers',"QuartusII");
my $left_table = def_table (25, 6, FALSE);
my $right_table =def_table (25, 6, FALSE);
my $main_table = def_table (25, 12, FALSE);
my ($infobox,$info)= create_txview();
my @pages =(
{page_name=>" Avg. throughput/latency", page_num=>0},
{page_name=>" Injected Packet ", page_num=>1},
{page_name=>" Worst-Case Delay ",page_num=>2},
{page_name=>" Execution Time ",page_num=>3},
);
my @charts = (
{ type=>"2D_line", page_num=>0, graph_name=> "Latency", result_name => "latency_result", X_Title=> 'Desired Avg. Injected Load Per Router (flits/clock (%))', Y_Title=>'Avg. Latency (clock)', Z_Title=>undef, Y_Max=>100},
{ type=>"2D_line", page_num=>0, graph_name=> "Throughput", result_name => "throughput_result", X_Title=> 'Desired Avg. Injected Load Per Router (flits/clock (%))', Y_Title=>'Avg. Throughput (flits/clock (%))', Z_Title=>undef},
{ type=>"3D_bar", page_num=>1, graph_name=> "Received", result_name => "packet_rsvd_result", X_Title=>'Core ID' , Y_Title=>'Received Packets Per Router', Z_Title=>undef},
{ type=>"3D_bar", page_num=>1, graph_name=> "Sent", result_name => "packet_sent_result", X_Title=>'Core ID' , Y_Title=>'Sent Packets Per Router', Z_Title=>undef},
{ type=>"3D_bar", page_num=>2, graph_name=> "Received", result_name => "worst_delay_rsvd_result",X_Title=>'Core ID' , Y_Title=>'Worst-Case Delay (clk)', Z_Title=>undef},
{ type=>"2D_line", page_num=>3, graph_name=> "-", result_name => "exe_time_result",X_Title=>'Desired Avg. Injected Load Per Router (flits/clock (%))' , Y_Title=>'Total Emulation Time (clk)', Z_Title=>undef},
);
my ($conf_box,$set_win)=process_notebook_gen($emulate,$info,"emulate", undef,@charts);
my $chart =gen_multiple_charts ($emulate,\@pages,\@charts,.4);
$main_table->set_row_spacings (4);
$main_table->set_col_spacings (1);
my $generate = def_image_button('icons/forward.png','Run all');
my $open = def_image_button('icons/browse.png','Load');
my $diagram = def_image_button('icons/diagram.png','Diagram');
my ($entrybox,$entry) = def_h_labeled_entry('Save as:',undef);
$entry->signal_connect( 'changed'=> sub{
my $name=$entry->get_text();
$emulate->object_add_attribute ("emulate_name",undef,$name);
});
my $save = def_image_button('icons/save.png','Save');
$entrybox->pack_end($save, FALSE, FALSE,0);
my $image = get_status_gif($emulate);
my $v1=gen_vpaned($conf_box,.45,$image);
my $v2=gen_vpaned($infobox,.2,$chart);
my $h1=gen_hpaned($v1,.4,$v2);
#$table->attach_defaults ($event_box, $col, $col+1, $row, $row+1);
$main_table->attach_defaults ($h1 , 0, 12, 0,24);
$main_table->attach ($open,0, 2, 24,25,'expand','shrink',2,2);
# $main_table->attach ($diagram, 2, 4, 24,25,'expand','shrink',2,2);
$main_table->attach ($entrybox,4, 7, 24,25,'expand','shrink',2,2);
$main_table->attach ($generate, 7, 9, 24,25,'expand','shrink',2,2);
#check soc status every 0.5 second. referesh device table if there is any changes
Glib::Timeout->add (100, sub{
my ($state,$timeout)= get_gui_status($emulate);
if ($timeout>0){
$timeout--;
set_gui_status($emulate,$state,$timeout);
return TRUE;
}
if($state eq "ideal"){
return TRUE;
}
#refresh GUI
my $name=$emulate->object_get_attribute ("emulate_name",undef);
$entry->set_text($name) if(defined $name);
$conf_box->destroy();
$chart->destroy();
$image->destroy();
$image = get_status_gif($emulate);
($conf_box,$set_win)=process_notebook_gen($emulate,$info,"emulate",$set_win, @charts);
$chart =gen_multiple_charts ($emulate,\@pages,\@charts,.4);
$v1 -> pack1($conf_box, TRUE, TRUE);
$v1 -> pack2($image, TRUE, TRUE);
$v2 -> pack2($chart, TRUE, TRUE);
$conf_box->show_all();
$main_table->show_all();
set_gui_status($emulate,"ideal",0);
return TRUE;
} );
$diagram-> signal_connect("clicked" => sub{
show_topology_diagram ($emulate);
});
$generate-> signal_connect("clicked" => sub{
my @samples =$emulate->object_get_attribute_order("samples");
foreach my $sample (@samples){
$emulate->object_add_attribute ($sample,"status","run");
}
run_emulator($emulate,$info);
});
$open-> signal_connect("clicked" => sub{
load_emulation($emulate,$info);
set_gui_status($emulate,"ref",5);
});
$save-> signal_connect("clicked" => sub{
save_emulation($emulate);
set_gui_status($emulate,"ref",5);
});
return add_widget_to_scrolled_win($main_table);
}
Error running this command: diff -w -U 5 "" "/tmp/0VPfqv"
diff: : No such file or directory