1 |
32 |
alirezamon |
#! /usr/bin/perl -w
|
2 |
48 |
alirezamon |
use constant::boolean;
|
3 |
32 |
alirezamon |
use strict;
|
4 |
|
|
use warnings;
|
5 |
43 |
alirezamon |
use FindBin;
|
6 |
|
|
use lib $FindBin::Bin;
|
7 |
|
|
|
8 |
48 |
alirezamon |
|
9 |
|
|
|
10 |
32 |
alirezamon |
use GD::Graph::Data;
|
11 |
|
|
use emulator;
|
12 |
|
|
use GD::Graph::colour qw/:colours/;
|
13 |
|
|
|
14 |
|
|
use File::Basename;
|
15 |
|
|
use File::Path qw/make_path/;
|
16 |
|
|
use File::Copy;
|
17 |
|
|
use File::Find::Rule;
|
18 |
|
|
|
19 |
|
|
require "widget.pl";
|
20 |
|
|
require "mpsoc_gen.pl";
|
21 |
|
|
require "emulator.pl";
|
22 |
|
|
require "mpsoc_verilog_gen.pl";
|
23 |
|
|
require "readme_gen.pl";
|
24 |
38 |
alirezamon |
require "graph.pl";
|
25 |
32 |
alirezamon |
|
26 |
43 |
alirezamon |
|
27 |
32 |
alirezamon |
use List::MoreUtils qw(uniq);
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
|
32 |
43 |
alirezamon |
sub generate_sim_bin_file {
|
33 |
32 |
alirezamon |
my ($simulate,$info_text) =@_;
|
34 |
48 |
alirezamon |
#check simulator envirement
|
35 |
|
|
my $simulator =$simulate->object_get_attribute("Simulator");
|
36 |
|
|
#TODO generate .sim file only for modelsim simulator
|
37 |
|
|
|
38 |
38 |
alirezamon |
$simulate->object_add_attribute('status',undef,'run');
|
39 |
|
|
set_gui_status($simulate,"ref",1);
|
40 |
|
|
|
41 |
43 |
alirezamon |
my ($nr,$ne,$router_p,$ref_tops,$includ_h)= get_noc_verilator_top_modules_info($simulate);
|
42 |
|
|
my %tops = %{$ref_tops};
|
43 |
|
|
|
44 |
48 |
alirezamon |
$tops{Vtraffic} = "--top-module traffic_gen_top";
|
45 |
|
|
$tops{Vpck_inj} = "--top-module packet_injector_verilator";
|
46 |
38 |
alirezamon |
my $target_dir= "$ENV{PRONOC_WORK}/simulate";
|
47 |
|
|
|
48 |
32 |
alirezamon |
my $dir = Cwd::getcwd();
|
49 |
|
|
my $project_dir = abs_path("$dir/..");
|
50 |
|
|
my $src_verilator_dir="$project_dir/src_verilator";
|
51 |
48 |
alirezamon |
my $src_c="$project_dir/src_c";
|
52 |
|
|
my $src_noc_dir="$project_dir/rtl/src_noc";
|
53 |
32 |
alirezamon |
my $script_dir="$project_dir/script";
|
54 |
38 |
alirezamon |
my $testbench_file= "$src_verilator_dir/simulator.cpp";
|
55 |
|
|
|
56 |
43 |
alirezamon |
my $target_verilog_dr ="$target_dir/src_verilog";
|
57 |
48 |
alirezamon |
my $obj_dir ="$target_dir/verilator/obj_dir/";
|
58 |
38 |
alirezamon |
|
59 |
43 |
alirezamon |
rmtree("$target_dir/verilator");
|
60 |
|
|
rmtree("$target_verilog_dr");
|
61 |
|
|
mkpath("$target_verilog_dr/",1,01777);
|
62 |
38 |
alirezamon |
|
63 |
|
|
#copy src_verilator files
|
64 |
43 |
alirezamon |
my @files_list = File::Find::Rule->file()
|
65 |
|
|
->name( '*.v','*.V','*.sv' )
|
66 |
|
|
->in( "$src_verilator_dir" );
|
67 |
|
|
|
68 |
|
|
#make sure source files have key word 'module'
|
69 |
|
|
my @files;
|
70 |
|
|
foreach my $p (@files_list){
|
71 |
|
|
push (@files,$p) if(check_file_has_string($p,'module'));
|
72 |
|
|
}
|
73 |
|
|
push (@files,$src_noc_dir);
|
74 |
48 |
alirezamon |
push (@files,"$project_dir/rtl/arbiter.v");
|
75 |
|
|
push (@files,"$project_dir/rtl/main_comp.v");
|
76 |
38 |
alirezamon |
|
77 |
48 |
alirezamon |
|
78 |
43 |
alirezamon |
#my @files=(
|
79 |
|
|
# $src_noc_dir,
|
80 |
|
|
# "$src_verilator_dir/noc_connection.sv",
|
81 |
|
|
# "$src_verilator_dir/mesh_torus_noc_connection.sv",
|
82 |
|
|
# "$src_verilator_dir/router_verilator.v",
|
83 |
|
|
# "$src_verilator_dir/traffic_gen_verilator.v"
|
84 |
|
|
#);
|
85 |
38 |
alirezamon |
|
86 |
48 |
alirezamon |
copy_file_and_folders (\@files,$project_dir,$target_verilog_dr);
|
87 |
|
|
copy_file_and_folders (\@files,$project_dir,"$target_dir/modelsim/src_verilog/");
|
88 |
38 |
alirezamon |
|
89 |
48 |
alirezamon |
my $target_modelsim_dr ="$target_dir/modelsim/src_modelsim";
|
90 |
|
|
my $src_modelsim_dir="$project_dir/rtl/src_modelsim";
|
91 |
|
|
rmtree("$target_modelsim_dr");
|
92 |
|
|
mkpath("$target_modelsim_dr/",1,01777);
|
93 |
43 |
alirezamon |
|
94 |
48 |
alirezamon |
#copy src_verilator files
|
95 |
|
|
@files_list = File::Find::Rule->file()
|
96 |
|
|
->name( '*.v','*.V','*.sv' )
|
97 |
|
|
->in( "$src_modelsim_dir" );
|
98 |
|
|
|
99 |
|
|
#make sure source files have key word 'module'
|
100 |
|
|
@files=();
|
101 |
|
|
foreach my $p (@files_list){
|
102 |
|
|
push (@files,$p) if(check_file_has_string($p,'module'));
|
103 |
|
|
}
|
104 |
|
|
copy_file_and_folders (\@files,$project_dir,$target_modelsim_dr);
|
105 |
|
|
|
106 |
|
|
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
#check if we have a custom topology
|
110 |
|
|
my $topology=$simulate->object_get_attribute('noc_param','TOPOLOGY');
|
111 |
|
|
if ($topology eq '"CUSTOM"'){
|
112 |
|
|
my $name=$simulate->object_get_attribute('noc_param','CUSTOM_TOPOLOGY_NAME');
|
113 |
|
|
$name=~s/["]//gs;
|
114 |
|
|
my $dir1= get_project_dir()."/mpsoc/rtl/src_topolgy/$name";
|
115 |
|
|
my $dir2= get_project_dir()."/mpsoc/rtl/src_topolgy/common";
|
116 |
|
|
my @files = File::Find::Rule->file()
|
117 |
|
|
->name( '*.v','*.V','*.sv' )
|
118 |
|
|
->in( "$dir1" );
|
119 |
|
|
copy_file_and_folders (\@files,$project_dir,$target_verilog_dr);
|
120 |
|
|
copy_file_and_folders (\@files,$project_dir,"$target_dir/modelsim/src_verilog/");
|
121 |
|
|
|
122 |
|
|
@files = File::Find::Rule->file()
|
123 |
|
|
->name( '*.v','*.V','*.sv' )
|
124 |
|
|
->in( "$dir2" );
|
125 |
|
|
|
126 |
|
|
copy_file_and_folders (\@files,$project_dir,$target_verilog_dr);
|
127 |
|
|
copy_file_and_folders (\@files,$project_dir,"$target_dir/modelsim/src_verilog/");
|
128 |
|
|
|
129 |
|
|
|
130 |
|
|
|
131 |
|
|
}
|
132 |
38 |
alirezamon |
# generate NoC parameter file
|
133 |
48 |
alirezamon |
#my ($noc_param,$pass_param)=gen_noc_param_v($simulate);
|
134 |
|
|
#open(FILE, ">$target_verilog_dr/parameter.v") || die "Can not open: $!";
|
135 |
38 |
alirezamon |
my $fifow=$simulate->object_get_attribute('fpga_param','TIMSTMP_FIFO_NUM');
|
136 |
48 |
alirezamon |
gen_noc_localparam_v_file($simulate,"$target_verilog_dr/src_noc");
|
137 |
38 |
alirezamon |
|
138 |
43 |
alirezamon |
#generate routers with different port num
|
139 |
48 |
alirezamon |
my $cpu_num = $simulate->object_get_attribute('compile', 'cpu_num');
|
140 |
|
|
my $result = verilator_compilation (\%tops,$target_dir,$info_text,$cpu_num);
|
141 |
32 |
alirezamon |
|
142 |
|
|
|
143 |
38 |
alirezamon |
if ($result){
|
144 |
|
|
add_colored_info($info_text,"Veriator model has been generated successfully!\n",'blue');
|
145 |
|
|
}else {
|
146 |
|
|
add_colored_info($info_text,"Verilator compilation failed!\n","red");
|
147 |
48 |
alirezamon |
$simulate->object_add_attribute('status',undef,'programmer_failed');
|
148 |
38 |
alirezamon |
set_gui_status($simulate,"ref",1);
|
149 |
43 |
alirezamon |
print "gen-ended!\n";
|
150 |
38 |
alirezamon |
return;
|
151 |
43 |
alirezamon |
}
|
152 |
32 |
alirezamon |
|
153 |
43 |
alirezamon |
#copy simulation c header files
|
154 |
|
|
@files = File::Find::Rule->file()
|
155 |
|
|
->name( '*.h')
|
156 |
|
|
->in( "$src_verilator_dir" );
|
157 |
38 |
alirezamon |
|
158 |
|
|
copy_file_and_folders (\@files,$project_dir,$obj_dir);
|
159 |
|
|
copy($testbench_file,"$obj_dir/testbench.cpp");
|
160 |
43 |
alirezamon |
|
161 |
48 |
alirezamon |
my $r;
|
162 |
|
|
#copy nettrace
|
163 |
|
|
dircopy("$src_c/netrace-1.0","$obj_dir/netrace-1.0") or $r=$!;
|
164 |
|
|
add_colored_info($info_text,"ERROR: $r\n","red") if(defined $r ) ;
|
165 |
|
|
|
166 |
32 |
alirezamon |
#compile the testbench
|
167 |
|
|
my $param_h=gen_noc_param_h($simulate);
|
168 |
43 |
alirezamon |
my $text = gen_sim_parameter_h($param_h,$includ_h,$ne,$nr,$router_p,$fifow);
|
169 |
|
|
|
170 |
32 |
alirezamon |
$param_h =~ s/\d\'b/ /g;
|
171 |
38 |
alirezamon |
open(FILE, ">$obj_dir/parameter.h") || die "Can not open: $!";
|
172 |
43 |
alirezamon |
print FILE "$text";
|
173 |
32 |
alirezamon |
|
174 |
|
|
close FILE;
|
175 |
|
|
|
176 |
38 |
alirezamon |
|
177 |
|
|
|
178 |
48 |
alirezamon |
#$result = run_make_file("$obj_dir/",$info_text,'lib');
|
179 |
|
|
my $lib_num=0;
|
180 |
|
|
add_colored_info($info_text,"Makefie will use the maximum number of $cpu_num core(s) in parallel for compilation\n",'green');
|
181 |
|
|
my $length=scalar (keys %tops);
|
182 |
|
|
my $cmd="";
|
183 |
|
|
foreach my $top (sort keys %tops) {
|
184 |
|
|
$cmd.= "lib$lib_num & ";
|
185 |
|
|
$lib_num++;
|
186 |
|
|
if( $lib_num % $cpu_num == 0 || $lib_num == $length){
|
187 |
|
|
$cmd.="wait\n";
|
188 |
|
|
$result = run_make_file("$obj_dir/",$info_text,$cmd);
|
189 |
|
|
if ($result ==0){
|
190 |
|
|
$simulate->object_add_attribute('status',undef,'programmer_failed');
|
191 |
|
|
set_gui_status($simulate,"ref",1);
|
192 |
|
|
print "gen-ended!\n";
|
193 |
|
|
return;
|
194 |
|
|
}
|
195 |
|
|
$cmd="";
|
196 |
|
|
}else {
|
197 |
|
|
$cmd.=" make ";
|
198 |
|
|
}
|
199 |
|
|
}
|
200 |
|
|
|
201 |
|
|
|
202 |
38 |
alirezamon |
|
203 |
32 |
alirezamon |
|
204 |
48 |
alirezamon |
run_make_file("$obj_dir/",$info_text);
|
205 |
38 |
alirezamon |
if ($result ==0){
|
206 |
48 |
alirezamon |
$simulate->object_add_attribute('status',undef,'programmer_failed');
|
207 |
38 |
alirezamon |
set_gui_status($simulate,"ref",1);
|
208 |
43 |
alirezamon |
print "gen-ended!\n";
|
209 |
38 |
alirezamon |
return;
|
210 |
|
|
}
|
211 |
|
|
|
212 |
|
|
|
213 |
|
|
|
214 |
|
|
|
215 |
|
|
#my $end = localtime;
|
216 |
|
|
|
217 |
32 |
alirezamon |
|
218 |
|
|
|
219 |
|
|
#save the binarry file
|
220 |
38 |
alirezamon |
my $bin= "$obj_dir/testbench";
|
221 |
32 |
alirezamon |
my $path=$simulate->object_get_attribute ('sim_param',"BIN_DIR");
|
222 |
|
|
my $name=$simulate->object_get_attribute ('sim_param',"SAVE_NAME");
|
223 |
|
|
|
224 |
38 |
alirezamon |
#create project directory if it does not exist
|
225 |
|
|
my ($stdout,$exit)=run_cmd_in_back_ground_get_stdout("mkdir -p $path" );
|
226 |
43 |
alirezamon |
if($exit != 0 ){ print "$stdout\n"; print "gen-ended!\n"; message_dialog($stdout,'error'); return;}
|
227 |
32 |
alirezamon |
|
228 |
38 |
alirezamon |
|
229 |
|
|
|
230 |
32 |
alirezamon |
#check if the verilation was successful
|
231 |
|
|
if ((-e $bin)==0) {#something goes wrong
|
232 |
38 |
alirezamon |
#message_dialog("Verilator compilation was unsuccessful please check the $path/$name.log files for more information",'error');
|
233 |
|
|
add_colored_info($info_text,"Verilator compilation failed!\n","red");
|
234 |
48 |
alirezamon |
$simulate->object_add_attribute('status',undef,'programmer_failed');
|
235 |
38 |
alirezamon |
set_gui_status($simulate,"ref",1);
|
236 |
43 |
alirezamon |
print "gen-ended!\n";
|
237 |
38 |
alirezamon |
return;
|
238 |
32 |
alirezamon |
}
|
239 |
|
|
|
240 |
|
|
|
241 |
|
|
#copy ($bin,"$path/$name") or die "Can not copy: $!";
|
242 |
|
|
($stdout,$exit)=run_cmd_in_back_ground_get_stdout("cp -f $bin $path/$name");
|
243 |
43 |
alirezamon |
if($exit != 0 ){ print "$stdout\n"; print "gen-ended!\n"; message_dialog($stdout,'error'); return;}
|
244 |
32 |
alirezamon |
|
245 |
|
|
#save noc info
|
246 |
|
|
open(FILE, ">$path/$name.inf") || die "Can not open: $!";
|
247 |
|
|
print FILE perl_file_header("$name.inf");
|
248 |
|
|
my %pp;
|
249 |
|
|
$pp{'noc_param'}= $simulate->{'noc_param'};
|
250 |
|
|
$pp{'sim_param'}= $simulate->{'sim_param'};
|
251 |
|
|
print FILE Data::Dumper->Dump([\%pp],["emulate_info"]);
|
252 |
|
|
close(FILE) || die "Error closing file: $!";
|
253 |
43 |
alirezamon |
|
254 |
|
|
print "gen-ended successfully!\n";
|
255 |
32 |
alirezamon |
message_dialog("The simulation binary file has been successfully generated in $path!");
|
256 |
|
|
|
257 |
38 |
alirezamon |
$simulate->object_add_attribute('status',undef,'ideal');
|
258 |
|
|
set_gui_status($simulate,"ref",1);
|
259 |
43 |
alirezamon |
|
260 |
32 |
alirezamon |
#make project dir
|
261 |
|
|
#my $dir= $simulate->object_get_attribute ("sim_param","BIN_DIR");
|
262 |
|
|
#my $name=$simulate->object_get_attribute ("sim_param","SAVE_NAME");
|
263 |
|
|
#my $path= "$dir/$name";
|
264 |
|
|
#add_info($info_text, "$src_verilator_dir!\n");
|
265 |
|
|
#mkpath("$path",1,01777);
|
266 |
|
|
}
|
267 |
|
|
|
268 |
|
|
|
269 |
48 |
alirezamon |
|
270 |
|
|
|
271 |
|
|
|
272 |
|
|
|
273 |
32 |
alirezamon |
##########
|
274 |
34 |
alirezamon |
# save_simulation
|
275 |
32 |
alirezamon |
##########
|
276 |
|
|
sub save_simulation {
|
277 |
|
|
my ($simulate)=@_;
|
278 |
|
|
# read emulation name
|
279 |
|
|
my $name=$simulate->object_get_attribute ("simulate_name",undef);
|
280 |
|
|
my $s= (!defined $name)? 0 : (length($name)==0)? 0 :1;
|
281 |
|
|
if ($s == 0){
|
282 |
|
|
message_dialog("Please set Simulation name!");
|
283 |
|
|
return 0;
|
284 |
|
|
}
|
285 |
|
|
# Write object file
|
286 |
|
|
open(FILE, ">lib/simulate/$name.SIM") || die "Can not open: $!";
|
287 |
|
|
print FILE perl_file_header("$name.SIM");
|
288 |
38 |
alirezamon |
print FILE Data::Dumper->Dump([\%$simulate],["simulate"]);
|
289 |
32 |
alirezamon |
close(FILE) || die "Error closing file: $!";
|
290 |
|
|
message_dialog("Simulation has saved as lib/simulate/$name.SIM!");
|
291 |
|
|
return 1;
|
292 |
|
|
}
|
293 |
|
|
|
294 |
|
|
#############
|
295 |
36 |
alirezamon |
# load_simulation
|
296 |
32 |
alirezamon |
############
|
297 |
|
|
|
298 |
|
|
sub load_simulation {
|
299 |
|
|
my ($simulate,$info)=@_;
|
300 |
|
|
my $file;
|
301 |
48 |
alirezamon |
my $dialog = gen_file_dialog (undef, 'SIM');
|
302 |
|
|
|
303 |
32 |
alirezamon |
my $dir = Cwd::getcwd();
|
304 |
|
|
$dialog->set_current_folder ("$dir/lib/simulate");
|
305 |
|
|
|
306 |
|
|
|
307 |
|
|
if ( "ok" eq $dialog->run ) {
|
308 |
|
|
$file = $dialog->get_filename;
|
309 |
|
|
my ($name,$path,$suffix) = fileparse("$file",qr"\..[^.]*$");
|
310 |
|
|
if($suffix eq '.SIM'){
|
311 |
43 |
alirezamon |
my ($pp,$r,$err) = regen_object($file);
|
312 |
|
|
if ($r){
|
313 |
48 |
alirezamon |
add_colored_info($info,"**Error reading $file file: $err\n",'red');
|
314 |
|
|
$dialog->destroy;
|
315 |
32 |
alirezamon |
return;
|
316 |
|
|
}
|
317 |
|
|
#deactivate running simulations
|
318 |
|
|
$pp->object_add_attribute('status',undef,'ideal');
|
319 |
38 |
alirezamon |
my @samples =$pp->object_get_attribute_order("samples");
|
320 |
|
|
foreach my $sample (@samples){
|
321 |
|
|
my $st=$pp->object_get_attribute ($sample,"status");
|
322 |
|
|
$pp->object_add_attribute ($sample,"status",'done');# if ($st eq "run");
|
323 |
32 |
alirezamon |
}
|
324 |
|
|
clone_obj($simulate,$pp);
|
325 |
|
|
#message_dialog("done!");
|
326 |
|
|
}
|
327 |
|
|
}
|
328 |
|
|
$dialog->destroy;
|
329 |
|
|
}
|
330 |
|
|
|
331 |
|
|
|
332 |
38 |
alirezamon |
|
333 |
|
|
|
334 |
|
|
sub check_hotspot_parameters{
|
335 |
|
|
my ($self,$sample)=@_;
|
336 |
|
|
my $num=$self->object_get_attribute($sample,"HOTSPOT_NUM");
|
337 |
|
|
my $result;
|
338 |
|
|
if (defined $num){
|
339 |
|
|
my @hotspots;
|
340 |
|
|
my $acuum=0;
|
341 |
|
|
for (my $i=0;$i<$num;$i++){
|
342 |
|
|
my $w1 = $self->object_get_attribute($sample,"HOTSPOT_CORE_$i");
|
343 |
|
|
if( grep (/^\Q$w1\E$/,@hotspots)){
|
344 |
|
|
$result="Error: Tile $w1 has been selected for Two or more than two hotspot nodes.\n";
|
345 |
|
|
}
|
346 |
|
|
push( @hotspots,$w1);
|
347 |
|
|
my $w2 = $self->object_get_attribute($sample,"HOTSPOT_PERCENT_$i");
|
348 |
|
|
$acuum+=$w2;
|
349 |
|
|
|
350 |
|
|
}
|
351 |
|
|
if ($acuum > 100){
|
352 |
48 |
alirezamon |
$result="Error: The traffic summation of all hotspot nodes is $acuum. The hotspot summation must be <=100";
|
353 |
38 |
alirezamon |
|
354 |
|
|
}
|
355 |
|
|
}
|
356 |
|
|
return $result;
|
357 |
|
|
}
|
358 |
|
|
|
359 |
48 |
alirezamon |
sub get_district_avg {
|
360 |
|
|
my ($self,$sample)=@_;
|
361 |
|
|
my $vt=$self->object_get_attribute($sample,"DISCRETE_RANGE");
|
362 |
|
|
$vt = "2,3,4,5" unless (defined $vt);
|
363 |
|
|
my $pt=$self->object_get_attribute($sample,"PROBEB_RANGE");
|
364 |
|
|
$pt= "25,25,25,25" unless (defined $pt);
|
365 |
|
|
|
366 |
|
|
my $avg=0;
|
367 |
|
|
my @valus = split(',',$vt);
|
368 |
|
|
my @probs = split(',',$pt);
|
369 |
|
|
my $i=0;
|
370 |
|
|
my $sum=0;
|
371 |
|
|
my $min=10000000;
|
372 |
|
|
my $max=0;
|
373 |
|
|
foreach my $v (@valus) {
|
374 |
|
|
return ("-","The $v is not numeric value") unless (is_integer($v));
|
375 |
|
|
$sum+= $probs[$i];
|
376 |
|
|
$avg+=$v*$probs[$i];
|
377 |
|
|
$i++;
|
378 |
|
|
$min=$v if($min>$v);
|
379 |
|
|
$max=$v if($max<$v);
|
380 |
|
|
}
|
381 |
|
|
return ("-","The summation of probebilities are $sum which is not equal 100.") if($sum!=100);
|
382 |
|
|
$avg/=100;
|
383 |
|
|
|
384 |
|
|
$self->object_add_attribute ($sample,"MIN_PCK_SIZE",$min);
|
385 |
|
|
$self->object_add_attribute ($sample,"MAX_PCK_SIZE",$max);
|
386 |
|
|
return ($avg,undef);
|
387 |
|
|
}
|
388 |
38 |
alirezamon |
|
389 |
|
|
sub get_simulator_noc_configuration{
|
390 |
48 |
alirezamon |
my ($self,$mode,$sample,$set_win) =@_;
|
391 |
|
|
|
392 |
|
|
my $table=def_table(10,2,FALSE);
|
393 |
38 |
alirezamon |
my $row=0;
|
394 |
|
|
|
395 |
48 |
alirezamon |
my $scrolled_win = add_widget_to_scrolled_win ($table);
|
396 |
38 |
alirezamon |
|
397 |
48 |
alirezamon |
my $ok = def_image_button('icons/select.png','_OK',FALSE,1);
|
398 |
|
|
my $import = def_image_button('icons/import.png','I_mport',FALSE,1);
|
399 |
|
|
my $save = def_image_button('icons/save.png','_Export',FALSE,1);
|
400 |
|
|
|
401 |
|
|
$save ->signal_connect("clicked"=> sub{
|
402 |
|
|
my $dialog=save_file_dialog ("Enter configuration file name",'conf');
|
403 |
|
|
#$dialog->set_current_folder ($open_in) if(defined $open_in);
|
404 |
|
|
if ( "ok" eq $dialog->run ) {
|
405 |
|
|
my $file = $dialog->get_filename;
|
406 |
|
|
my ($name,$path,$suffix) = fileparse("$file",qr"\..[^.]*$");
|
407 |
|
|
my $t=$self->object_get_attribute($sample);
|
408 |
|
|
open(FILE, ">$path/${name}.conf") || die "Can not open: $!";
|
409 |
|
|
print FILE Data::Dumper->Dump([\$t],['config']);
|
410 |
|
|
close FILE;
|
411 |
|
|
}
|
412 |
|
|
$dialog->destroy();
|
413 |
|
|
});
|
414 |
|
|
|
415 |
|
|
$import ->signal_connect("clicked"=> sub{
|
416 |
|
|
my $dialog=save_file_dialog ("Enter configuration file name",'conf');
|
417 |
|
|
#$dialog->set_current_folder ($open_in) if(defined $open_in);
|
418 |
|
|
if ( "ok" eq $dialog->run ) {
|
419 |
|
|
my $file = $dialog->get_filename;
|
420 |
|
|
my $pp= do $file ;
|
421 |
|
|
my $status=1;
|
422 |
|
|
$status=0 if $@;
|
423 |
|
|
message_dialog("Error reading: $@") if $@;
|
424 |
|
|
if ($status==1){
|
425 |
|
|
$self->object_add_attribute ("$sample",undef,$$pp);
|
426 |
|
|
set_gui_status($self,'ref_set_win',1);
|
427 |
|
|
}
|
428 |
|
|
}
|
429 |
|
|
$dialog->destroy();
|
430 |
|
|
});
|
431 |
|
|
|
432 |
|
|
|
433 |
|
|
|
434 |
|
|
my $mtable = def_table(10, 3, TRUE);
|
435 |
38 |
alirezamon |
|
436 |
48 |
alirezamon |
$mtable->attach_defaults($scrolled_win,0,3,0,9);
|
437 |
|
|
$mtable-> attach ($ok , 1, 2, 9, 10,'expand','shrink',2,2);
|
438 |
|
|
$mtable-> attach ($import , 0, 1, 9, 10,'expand','shrink',2,2);
|
439 |
|
|
$mtable-> attach ($save , 2, 3, 9, 10,'expand','shrink',2,2);
|
440 |
38 |
alirezamon |
|
441 |
|
|
|
442 |
|
|
|
443 |
|
|
$set_win ->signal_connect (destroy => sub{
|
444 |
|
|
$self->object_add_attribute("active_setting",undef,undef);
|
445 |
48 |
alirezamon |
|
446 |
38 |
alirezamon |
});
|
447 |
|
|
|
448 |
|
|
|
449 |
|
|
my $dir = Cwd::getcwd();
|
450 |
|
|
my $open_in = abs_path("$ENV{PRONOC_WORK}/simulate");
|
451 |
|
|
|
452 |
|
|
|
453 |
48 |
alirezamon |
attach_widget_to_table ($table,$row,gen_label_in_left(" Search Path:"),gen_button_message ("Select the Path where the verilator simulation files are located. Different NoC verilated models can be generated using Generate NoC configuration tab.","icons/help.png"),
|
454 |
38 |
alirezamon |
get_dir_in_object ($self,$sample,"sof_path",undef,'ref_set_win',1,$open_in)); $row++;
|
455 |
|
|
|
456 |
|
|
$open_in = $self->object_get_attribute($sample,"sof_path");
|
457 |
|
|
|
458 |
|
|
|
459 |
|
|
|
460 |
|
|
my @files = glob "$open_in/*";
|
461 |
|
|
my $exe_files="";
|
462 |
|
|
foreach my $file (@files){
|
463 |
48 |
alirezamon |
my ($name,$path,$suffix) = fileparse("$file",qr"\..[^.]*$");
|
464 |
|
|
if($suffix eq '.inf'){
|
465 |
|
|
$exe_files="$exe_files,$name";
|
466 |
|
|
}
|
467 |
38 |
alirezamon |
}
|
468 |
|
|
|
469 |
|
|
attach_widget_to_table ($table,$row,gen_label_in_left(" Verilated Model:"),gen_button_message ("Select the verilator simulation file. Different NoC simulators can be generated using Generate NoC configuration tab.","icons/help.png"),
|
470 |
48 |
alirezamon |
gen_combobox_object ($self,$sample, "sof_file", $exe_files, undef,'ref_set_win',1)); $row++;
|
471 |
|
|
|
472 |
|
|
|
473 |
|
|
|
474 |
43 |
alirezamon |
my $coltmp=0;
|
475 |
|
|
($row,$coltmp)=add_param_widget ($self, "Traffic Type", "TRAFFIC_TYPE", "Synthetic", 'Combo-box', "Synthetic,Task-graph", undef, $table,$row,undef,1, $sample, 1,'ref_set_win');
|
476 |
|
|
|
477 |
38 |
alirezamon |
my $traffictype=$self->object_get_attribute($sample,"TRAFFIC_TYPE");
|
478 |
43 |
alirezamon |
my $MIN_PCK_SIZE=$self->object_get_attribute($sample,"MIN_PCK_SIZE");
|
479 |
|
|
|
480 |
38 |
alirezamon |
|
481 |
43 |
alirezamon |
|
482 |
|
|
my $max_pck_num = get_MAX_PCK_NUM();
|
483 |
|
|
my $max_sim_clk = get_MAX_SIM_CLKs();
|
484 |
48 |
alirezamon |
|
485 |
|
|
my $pck_info = "Select how injected packet size are selected.
|
486 |
|
|
random-range: The injected packet size is randomly selected between given minimum and maximum packet size.
|
487 |
|
|
random-discrete: The injected packet size is randomly selected among given district valuse.";
|
488 |
38 |
alirezamon |
|
489 |
|
|
if($traffictype eq "Synthetic"){
|
490 |
|
|
|
491 |
|
|
my $min=$self->object_get_attribute($sample,'MIN_PCK_SIZE');
|
492 |
|
|
my $max=$self->object_get_attribute($sample,'MAX_PCK_SIZE');
|
493 |
48 |
alirezamon |
$min=5 if(!defined $min);
|
494 |
|
|
$max=5 if(!defined $max);
|
495 |
|
|
$max= $min if($max< $min);
|
496 |
38 |
alirezamon |
my $avg=floor(($min+$max)/2);
|
497 |
48 |
alirezamon |
my $msg;
|
498 |
43 |
alirezamon |
my $max_pck_size = get_MAX_PCK_SIZ();
|
499 |
|
|
|
500 |
48 |
alirezamon |
my $NE;
|
501 |
|
|
my ($infobox,$info)= create_txview();
|
502 |
43 |
alirezamon |
|
503 |
48 |
alirezamon |
|
504 |
|
|
my $traffics="tornado,transposed 1,transposed 2,bit reverse,bit complement,random,hot spot,shuffle,bit rotation,neighbor,custom";
|
505 |
38 |
alirezamon |
my @synthinfo = (
|
506 |
|
|
|
507 |
|
|
|
508 |
48 |
alirezamon |
{ label=>'Configuration name:', param_name=>'line_name', type=>'Entry', default_val=>$sample, content=>undef, info=>"NoC configuration name. This name will be shown in load-latency graph for this configuration", param_parent=>$sample, ref_delay=> undef, new_status=>undef},
|
509 |
38 |
alirezamon |
|
510 |
|
|
|
511 |
48 |
alirezamon |
|
512 |
|
|
{ label=>"Total packet number limit:", param_name=>'PCK_NUM_LIMIT', type=>'Spin-button', default_val=>200000, content=>"2,$max_pck_num,1", info=>"Simulation will stop when total number of sent packets by all nodes reaches packet number limit or total simulation clock reach its limit", param_parent=>$sample, ref_delay=>undef, new_status=>undef},
|
513 |
38 |
alirezamon |
|
514 |
48 |
alirezamon |
{ label=>"Simulator clocks limit:", param_name=>'SIM_CLOCK_LIMIT', type=>'Spin-button', default_val=>100000, content=>"2,$max_sim_clk,1", info=>"Each node stops sending packets when it reaches packet number limit or simulation clock number limit", param_parent=>$sample, ref_delay=>undef, new_status=>undef},
|
515 |
38 |
alirezamon |
|
516 |
48 |
alirezamon |
{ label=>"Traffic name", param_name=>'traffic', type=>'Combo-box', default_val=>'random', content=>$traffics, info=>"Select traffic pattern", param_parent=>$sample, ref_delay=>1, new_status=>'ref_set_win'},
|
517 |
38 |
alirezamon |
|
518 |
48 |
alirezamon |
{ label=>"Packet size (#flit)", param_name=>'PCK_SIZ_SEL', type=>'Combo-box', default_val=>'random-range', content=>"random-range,random-discrete", info=>$pck_info, param_parent=>$sample, ref_delay=>1, new_status=>'ref_set_win'},
|
519 |
38 |
alirezamon |
|
520 |
|
|
);
|
521 |
43 |
alirezamon |
my $coltmp=0;
|
522 |
48 |
alirezamon |
|
523 |
38 |
alirezamon |
foreach my $d (@synthinfo) {
|
524 |
48 |
alirezamon |
|
525 |
43 |
alirezamon |
($row,$coltmp)=add_param_widget ($self, $d->{label}, $d->{param_name}, $d->{default_val}, $d->{type}, $d->{content}, $d->{info}, $table,$row,undef,1, $d->{param_parent}, $d->{ref_delay}, $d->{new_status});
|
526 |
48 |
alirezamon |
|
527 |
38 |
alirezamon |
}
|
528 |
48 |
alirezamon |
|
529 |
|
|
my $t=$self->object_get_attribute($sample,"PCK_SIZ_SEL");
|
530 |
|
|
if($t eq 'random-range' ){
|
531 |
43 |
alirezamon |
|
532 |
48 |
alirezamon |
@synthinfo = (
|
533 |
|
|
{ label=>"Min pck size :", param_name=>'MIN_PCK_SIZE', type=>'Spin-button', default_val=>5, content=>"1,$max,1", info=>"Minimum packet size in flit. The injected packet size is randomly selected between minimum and maximum packet size", param_parent=>$sample, ref_delay=>10, new_status=>'ref_set_win'},
|
534 |
|
|
{ label=>"Max pck size :", param_name=>'MAX_PCK_SIZE', type=>'Spin-button', default_val=>5, content=>"$min,$max_pck_size,1", info=>"Maximum packet size in flit. The injected packet size is randomly selected between minimum and maximum packet size", param_parent=>$sample, ref_delay=>10, new_status=>'ref_set_win'},
|
535 |
|
|
{ label=>"Avg. Packet size:", param_name=>'PCK_SIZE', type=>'Fixed', default_val=>$avg, content=>"$avg", info=>undef, param_parent=>$sample, ref_delay=>undef},
|
536 |
|
|
);
|
537 |
|
|
|
538 |
|
|
}else{
|
539 |
|
|
#$self->object_add_attribute ($sample,"MIN_PCK_SIZE",2);#will be updated by get_district_avg
|
540 |
|
|
my $vt=$self->object_get_attribute($sample,"DISCRETE_RANGE");
|
541 |
|
|
$vt = "2,3,4,5" unless (defined $vt);
|
542 |
|
|
my $pt=$self->object_get_attribute($sample,"PROBEB_RANGE");
|
543 |
|
|
$pt= "25,25,25,25" unless (defined $pt);
|
544 |
|
|
|
545 |
|
|
#($avg,$msg) = get_district_avg($self,$sample);
|
546 |
|
|
|
547 |
|
|
|
548 |
|
|
@synthinfo = (
|
549 |
|
|
{ label=>"pck size discrete range: ", param_name=>'DISCRETE_RANGE', type=>'Entry', default_val=>$vt, content=>undef, info=>"Set discrete set of number as packet size separated by \",\" (v1,v2,v3 ..). The injected packet size is randomly selected among these discrete values", param_parent=>$sample, ref_delay=>10, new_status=>'ref_set_win'},
|
550 |
|
|
{ label=>"pck size probebility(%): ", param_name=>'PROBEB_RANGE' , type=>'Entry', default_val=>$pt, content=>undef, info=>"Set the probability separated by \",\" (p1,p2,p3 ..). The probabilities pi must satisfy two requirements: every probability pi is a number between 0 and 100, and the sum of all the probabilities is 100.", param_parent=>$sample, ref_delay=>10, new_status=>'ref_set_win'},
|
551 |
|
|
# { label=>"Avg. Packet size:", param_name=>'PCK_SIZE', type=>'Fixed', default_val=>$avg, content=>"$avg", info=>undef, param_parent=>$sample, ref_delay=>undef},
|
552 |
|
|
);
|
553 |
|
|
|
554 |
|
|
|
555 |
|
|
}
|
556 |
|
|
|
557 |
|
|
foreach my $d (@synthinfo){
|
558 |
|
|
($row,$coltmp)=add_param_widget ($self, $d->{label}, $d->{param_name}, $d->{default_val}, $d->{type}, $d->{content}, $d->{info}, $table,$row,undef,1, $d->{param_parent}, $d->{ref_delay}, $d->{new_status});
|
559 |
|
|
}
|
560 |
|
|
if(defined $msg){
|
561 |
|
|
my $error= def_image_button("icons/cancel.png");
|
562 |
|
|
$table->attach ($error , 6, 7, $row-1,$row,'shrink','shrink',2,2);
|
563 |
|
|
}
|
564 |
|
|
|
565 |
38 |
alirezamon |
|
566 |
|
|
my $traffic=$self->object_get_attribute($sample,"traffic");
|
567 |
48 |
alirezamon |
|
568 |
|
|
my $st = check_sim_sample($self,$sample,$info);
|
569 |
|
|
if ($st==0){
|
570 |
|
|
$NE=100;
|
571 |
|
|
}else{
|
572 |
|
|
my ($topology, $T1, $T2, $T3, $V, $Fpay) = get_sample_emulation_param($self,$sample);
|
573 |
|
|
my ($NEe, $NR, $RAw, $EAw, $Fw) = get_topology_info_sub ($topology, $T1, $T2, $T3, $V, $Fpay);
|
574 |
|
|
$NE=$NEe;
|
575 |
|
|
}
|
576 |
|
|
|
577 |
|
|
|
578 |
|
|
if ($traffic eq 'custom'){
|
579 |
|
|
|
580 |
|
|
|
581 |
|
|
my $htable=def_table(10,2,FALSE);
|
582 |
|
|
|
583 |
|
|
my $d= { label=>'number of active nodes:', param_name=>'CUSTOM_SRC_NUM', type=>'Spin-button', default_val=>1, content=>"1,$NE,1", info=>"Number of active nodes which injects packets to the NoC", param_parent=>$sample, ref_delay=> 1, new_status=>'ref_set_win'};
|
584 |
|
|
($row,$coltmp)=add_param_widget ($self, $d->{label}, $d->{param_name}, $d->{default_val}, $d->{type}, $d->{content}, $d->{info}, $table,$row,undef,1, $d->{param_parent}, $d->{ref_delay}, $d->{new_status});
|
585 |
|
|
my $num=$self->object_get_attribute($sample,"CUSTOM_SRC_NUM");
|
586 |
|
|
$htable->attach ( gen_label_in_left ("Source "), 0, 1, $row,$row+1,'fill','shrink',2,2);
|
587 |
|
|
$htable->attach ( gen_label_in_left (" -> "), 1, 2, $row,$row+1,'fill','shrink',2,2);
|
588 |
|
|
$htable->attach ( gen_label_in_left ("Destination"), 2, 3, $row,$row+1,'fill','shrink',2,2);
|
589 |
|
|
|
590 |
|
|
$row++;
|
591 |
|
|
|
592 |
|
|
|
593 |
|
|
my $tiles="0";
|
594 |
|
|
for (my $i=1;$i<$NE;$i++){$tiles.=",$i";}
|
595 |
|
|
|
596 |
|
|
|
597 |
|
|
for (my $i=0;$i<$num;$i++){
|
598 |
|
|
my $w1 = gen_combobox_object ($self,$sample,"SRC_$i",$tiles, $i,undef,undef);
|
599 |
|
|
my $w2 = gen_combobox_object ($self,$sample,"DST_$i",$tiles, $i+1,undef,undef);
|
600 |
|
|
$htable->attach ($w1 , 0, 1, $row,$row+1,'shrink','shrink',2,2);
|
601 |
|
|
$htable->attach ($w2 , 2, 3, $row,$row+1,'shrink','shrink',2,2);
|
602 |
|
|
$row++;
|
603 |
|
|
|
604 |
|
|
}
|
605 |
|
|
$table->attach ($htable , 0, 3, $row,$row+1,'shrink','shrink',2,2); $row++;
|
606 |
|
|
|
607 |
|
|
}
|
608 |
|
|
|
609 |
|
|
|
610 |
|
|
my $d= { label=>'number of message class:', param_name=>'MESSAGE_CLASS', type=>'Spin-button', default_val=>0, content=>"0,256,1", info=>"Number of packet message classes. Each message class can be configured to use specefic subset of avilable VCs", param_parent=>$sample, ref_delay=> 1, new_status=>'ref_set_win'};
|
611 |
|
|
($row,$coltmp)=add_param_widget ($self, $d->{label}, $d->{param_name}, $d->{default_val}, $d->{type}, $d->{content}, $d->{info}, $table,$row,undef,1, $d->{param_parent}, $d->{ref_delay}, $d->{new_status});
|
612 |
|
|
my $num=$self->object_get_attribute($sample,"MESSAGE_CLASS");
|
613 |
|
|
if($num>0){
|
614 |
|
|
my $htable=def_table(10,2,FALSE);
|
615 |
|
|
$htable->attach ( gen_label_in_left ("Class num "), 0, 1, $row,$row+1,'fill','shrink',2,2);
|
616 |
|
|
$htable->attach ( gen_label_in_left (" - "), 1, 2, $row,$row+1,'fill','shrink',2,2);
|
617 |
|
|
$htable->attach ( gen_label_in_left ("Traffic(%)"), 2, 3, $row,$row+1,'fill','shrink',2,2);
|
618 |
|
|
$row++;
|
619 |
|
|
|
620 |
|
|
for (my $i=0;$i<$num;$i++){
|
621 |
|
|
$htable->attach ( gen_label_in_left ("$i"), 0, 1, $row,$row+1,'fill','shrink',2,2);
|
622 |
|
|
my $w1 = gen_spin_object ($self,$sample,"CLASS_$i","0,100,1", 100/$num,undef,undef);
|
623 |
|
|
$htable->attach ( $w1, 2, 3, $row,$row+1,'fill','shrink',2,2);
|
624 |
|
|
$row++;
|
625 |
|
|
}
|
626 |
|
|
$table->attach ($htable , 0, 3, $row,$row+1,'shrink','shrink',2,2); $row++;
|
627 |
|
|
}
|
628 |
|
|
|
629 |
|
|
|
630 |
38 |
alirezamon |
|
631 |
|
|
if ($traffic eq 'hot spot'){
|
632 |
|
|
my $htable=def_table(10,2,FALSE);
|
633 |
|
|
|
634 |
|
|
my $d= { label=>'number of Hot Spot nodes:', param_name=>'HOTSPOT_NUM', type=>'Spin-button', default_val=>1, content=>"1,256,1", info=>"Number of hot spot nodes in the network", param_parent=>$sample, ref_delay=> 1, new_status=>'ref_set_win'};
|
635 |
43 |
alirezamon |
($row,$coltmp)=add_param_widget ($self, $d->{label}, $d->{param_name}, $d->{default_val}, $d->{type}, $d->{content}, $d->{info}, $table,$row,undef,1, $d->{param_parent}, $d->{ref_delay}, $d->{new_status});
|
636 |
38 |
alirezamon |
|
637 |
48 |
alirezamon |
my $l1=gen_label_help("Define the tile number which is hotspt. All other nodes will send [Hot Spot traffic percentage] of their traffic to this node"," Hot Spot tile number \%");
|
638 |
38 |
alirezamon |
my $l2=gen_label_help("If it is set as \"n\" then each node sends n % of its traffic to each hotspot node"," Hot Spot traffic \%");
|
639 |
48 |
alirezamon |
my $l3=gen_label_help("If it is checked then hot spot node also sends packets to other nodes otherwise it only receives packets from other nodes"," send enable");
|
640 |
38 |
alirezamon |
|
641 |
|
|
$htable->attach ($l1 , 0, 1, $row,$row+1,'fill','shrink',2,2);
|
642 |
|
|
$htable->attach ($l2 , 1, 2, $row,$row+1,'fill','shrink',2,2);
|
643 |
|
|
$htable->attach ($l3 , 2,3, $row,$row+1,'fill','shrink',2,2);
|
644 |
|
|
$row++;
|
645 |
|
|
|
646 |
|
|
my $num=$self->object_get_attribute($sample,"HOTSPOT_NUM");
|
647 |
|
|
for (my $i=0;$i<$num;$i++){
|
648 |
|
|
my $w1 = gen_spin_object ($self,$sample,"HOTSPOT_CORE_$i","0,256,1", $i,undef,undef);
|
649 |
|
|
my $w2 = gen_spin_object ($self,$sample,"HOTSPOT_PERCENT_$i","0.1,100,0.1", 0.1,undef,undef);
|
650 |
|
|
my $w3 = gen_check_box_object ($self,$sample,"HOTSPOT_SEND_EN_$i", 0,undef,undef);
|
651 |
|
|
$htable->attach ($w1 , 0, 1, $row,$row+1,'fill','shrink',2,2);
|
652 |
|
|
$htable->attach ($w2 ,1, 2, $row,$row+1,'fill','shrink',2,2);
|
653 |
|
|
$htable->attach ($w3 , 2,3, $row,$row+1,'fill','shrink',2,2);
|
654 |
|
|
$row++;
|
655 |
|
|
|
656 |
|
|
}
|
657 |
|
|
|
658 |
|
|
$table->attach ($htable , 0, 3, $row,$row+1,'shrink','shrink',2,2); $row++;
|
659 |
|
|
|
660 |
|
|
|
661 |
|
|
|
662 |
|
|
|
663 |
|
|
|
664 |
|
|
|
665 |
|
|
|
666 |
|
|
}
|
667 |
48 |
alirezamon |
my $l= "Define injection ratios. You can define individual ratios separating by comma (\',\') or define a range of injection ratios with \$min:\$max:\$step format.
|
668 |
38 |
alirezamon |
As an example defining 2,3,4:10:2 will result in (2,3,4,6,8,10) injection ratios." ;
|
669 |
|
|
my $u=get_injection_ratios ($self,$sample,"ratios");
|
670 |
|
|
|
671 |
|
|
attach_widget_to_table ($table,$row,gen_label_in_left(" Injection ratios:"),gen_button_message ($l,"icons/help.png") , $u); $row++;
|
672 |
|
|
|
673 |
|
|
$ok->signal_connect("clicked"=> sub{
|
674 |
|
|
#check if sof file has been selected
|
675 |
|
|
my $s=$self->object_get_attribute($sample,"sof_file");
|
676 |
|
|
#check if injection ratios are valid
|
677 |
|
|
my $r=$self->object_get_attribute($sample,"ratios");
|
678 |
|
|
my $h;
|
679 |
48 |
alirezamon |
|
680 |
|
|
my $t=$self->object_get_attribute($sample,"PCK_SIZ_SEL");
|
681 |
|
|
unless ($t eq 'random-range' ){
|
682 |
|
|
($avg,$msg) = get_district_avg($self,$sample);
|
683 |
|
|
if(defined $msg){
|
684 |
|
|
message_dialog($msg);
|
685 |
|
|
return;
|
686 |
|
|
}
|
687 |
|
|
}
|
688 |
|
|
|
689 |
38 |
alirezamon |
if ($traffic eq 'hot spot'){
|
690 |
|
|
$h= check_hotspot_parameters($self,$sample);
|
691 |
48 |
alirezamon |
}
|
692 |
38 |
alirezamon |
|
693 |
|
|
if(defined $s && defined $r && !defined $h) {
|
694 |
48 |
alirezamon |
#$set_win->destroy;
|
695 |
|
|
$set_win->hide();
|
696 |
|
|
$self->object_add_attribute("active_setting",undef,undef);
|
697 |
38 |
alirezamon |
set_gui_status($self,"ref",1);
|
698 |
|
|
} else {
|
699 |
|
|
|
700 |
|
|
if(!defined $s){
|
701 |
|
|
my $m= "Please select NoC verilated file";
|
702 |
|
|
message_dialog($m);
|
703 |
|
|
} elsif (! defined $r) {
|
704 |
|
|
message_dialog("Please define valid injection ratio(s)!");
|
705 |
|
|
} else {
|
706 |
|
|
message_dialog("$h");
|
707 |
|
|
}
|
708 |
|
|
}
|
709 |
|
|
});
|
710 |
|
|
|
711 |
|
|
}
|
712 |
|
|
|
713 |
|
|
|
714 |
|
|
if($traffictype eq "Task-graph"){
|
715 |
|
|
|
716 |
|
|
my @custominfo = (
|
717 |
48 |
alirezamon |
#{ label=>"Verilated Model", param_name=>'sof_file', type=>'Combo-box', default_val=>undef, content=>$exe_files, info=>"Select the verilator simulation file. Different NoC simulators can be generated using Generate NoC configuration tab.", param_parent=>$sample, ref_delay=>undef, new_status=>undef},
|
718 |
38 |
alirezamon |
|
719 |
48 |
alirezamon |
{ label=>'Configuration name:', param_name=>'line_name', type=>'Entry', default_val=>$sample, content=>undef, info=>"NoC configuration name. This name will be shown in load-latency graph for this configuration", param_parent=>$sample, ref_delay=> undef, new_status=>undef},
|
720 |
38 |
alirezamon |
|
721 |
|
|
{ label=>"Number of Files", param_name=>"TRAFFIC_FILE_NUM", type=>'Spin-button', default_val=>1, content=>"1,100,1", info=>"Select number of input files", param_parent=>$sample, ref_delay=>1, new_status=>'ref_set_win'},
|
722 |
|
|
|
723 |
43 |
alirezamon |
{ label=>"Simulator clocks limit:", param_name=>'SIM_CLOCK_LIMIT', type=>'Spin-button', default_val=>100000, content=>"2,$max_sim_clk,1", info=>"Each node stops sending packets when it reaches packet number limit or simulation clock number limit", param_parent=>$sample, ref_delay=>undef, new_status=>undef},
|
724 |
38 |
alirezamon |
);
|
725 |
|
|
|
726 |
|
|
foreach my $d (@custominfo) {
|
727 |
43 |
alirezamon |
($row,$coltmp)=add_param_widget ($self, $d->{label}, $d->{param_name}, $d->{default_val}, $d->{type}, $d->{content}, $d->{info}, $table,$row,undef,1, $d->{param_parent}, $d->{ref_delay}, $d->{new_status});
|
728 |
|
|
|
729 |
|
|
}
|
730 |
38 |
alirezamon |
|
731 |
|
|
|
732 |
|
|
my $open_in = "$ENV{'PRONOC_WORK'}/traffic_pattern";
|
733 |
|
|
|
734 |
|
|
|
735 |
|
|
|
736 |
|
|
my $num=$self->object_get_attribute($sample,"TRAFFIC_FILE_NUM");
|
737 |
|
|
for (my $i=0; $i<$num; $i++){
|
738 |
48 |
alirezamon |
attach_widget_to_table ($table,$row,gen_label_in_left("traffic pattern file $i:"),gen_button_message ("Select the traffic pattern input file. Any custom traffic based on application task graphs can be generated using ProNoC Trace Generator tool.","icons/help.png"), get_file_name_object ($self,$sample,"traffic_file$i",undef,$open_in)); $row++;
|
739 |
38 |
alirezamon |
}
|
740 |
|
|
|
741 |
48 |
alirezamon |
|
742 |
|
|
|
743 |
|
|
|
744 |
|
|
|
745 |
38 |
alirezamon |
$ok->signal_connect("clicked"=> sub{
|
746 |
|
|
#check if sof file has been selected
|
747 |
|
|
my $s=$self->object_get_attribute($sample,"sof_file");
|
748 |
|
|
if(!defined $s){
|
749 |
|
|
message_dialog("Please select NoC verilated file");
|
750 |
|
|
return;
|
751 |
|
|
}
|
752 |
|
|
|
753 |
|
|
#check if traffic files have been selected
|
754 |
|
|
for (my $i=0; $i<$num; $i++){
|
755 |
|
|
my $f=$self->object_get_attribute($sample,"traffic_file$i");
|
756 |
|
|
if(!defined $f){
|
757 |
|
|
my $m= "Please select traffic_file$i";
|
758 |
|
|
message_dialog($m);
|
759 |
|
|
return;
|
760 |
|
|
}
|
761 |
|
|
|
762 |
|
|
}
|
763 |
48 |
alirezamon |
#$set_win->destroy;
|
764 |
|
|
$set_win->hide();
|
765 |
|
|
$self->object_add_attribute("active_setting",undef,undef);
|
766 |
38 |
alirezamon |
set_gui_status($self,"ref",1);
|
767 |
|
|
|
768 |
|
|
});
|
769 |
|
|
|
770 |
|
|
|
771 |
|
|
}
|
772 |
|
|
|
773 |
|
|
|
774 |
48 |
alirezamon |
add_widget_to_scrolled_win ($mtable,$set_win);
|
775 |
38 |
alirezamon |
|
776 |
|
|
$set_win->show_all();
|
777 |
|
|
|
778 |
|
|
|
779 |
|
|
}
|
780 |
|
|
|
781 |
|
|
|
782 |
|
|
|
783 |
32 |
alirezamon |
############
|
784 |
38 |
alirezamon |
# run_simulator
|
785 |
|
|
###########
|
786 |
|
|
|
787 |
|
|
sub run_simulator {
|
788 |
|
|
my ($simulate,$info)=@_;
|
789 |
|
|
#return if(!check_samples($emulate,$info));
|
790 |
|
|
$simulate->object_add_attribute('status',undef,'run');
|
791 |
|
|
set_gui_status($simulate,"ref",1);
|
792 |
|
|
show_info($info, "Start Simulation\n");
|
793 |
|
|
my $name=$simulate->object_get_attribute ("simulate_name",undef);
|
794 |
|
|
|
795 |
|
|
#unlink $log; # remove old log file
|
796 |
|
|
|
797 |
|
|
my @samples =$simulate->object_get_attribute_order("samples");
|
798 |
|
|
foreach my $sample (@samples){
|
799 |
|
|
my $status=$simulate->object_get_attribute ($sample,"status");
|
800 |
|
|
next if($status ne "run");
|
801 |
|
|
next if(!check_sim_sample($simulate,$sample,$info));
|
802 |
|
|
my $traffictype=$simulate->object_get_attribute($sample,"TRAFFIC_TYPE");
|
803 |
|
|
run_synthetic_simulation($simulate,$info,$sample,$name) if($traffictype eq "Synthetic");
|
804 |
48 |
alirezamon |
run_task_simulation($simulate,$info,$sample,$name) if($traffictype eq "Task-graph");
|
805 |
38 |
alirezamon |
|
806 |
|
|
|
807 |
|
|
}
|
808 |
|
|
|
809 |
|
|
add_info($info, "Simulation is done!\n");
|
810 |
43 |
alirezamon |
printf "Simulation is done!\n";
|
811 |
38 |
alirezamon |
$simulate->object_add_attribute('status',undef,'ideal');
|
812 |
|
|
set_gui_status($simulate,"ref",1);
|
813 |
|
|
}
|
814 |
|
|
|
815 |
|
|
|
816 |
|
|
sub run_synthetic_simulation {
|
817 |
|
|
my ($simulate,$info,$sample,$name)=@_;
|
818 |
48 |
alirezamon |
|
819 |
|
|
|
820 |
|
|
my %traffic= (
|
821 |
|
|
'tornado' => 'TORNADO',
|
822 |
|
|
'transposed 1' => "TRANSPOSE1",
|
823 |
|
|
'transposed 2' => "TRANSPOSE2",
|
824 |
|
|
'bit reverse' => "BIT_REVERSE",
|
825 |
|
|
'bit complement' => "BIT_COMPLEMENT",
|
826 |
|
|
'random' => "RANDOM",
|
827 |
|
|
'hot spot' => "HOTSPOT",
|
828 |
|
|
'shuffle' => "SHUFFLE",
|
829 |
|
|
'bit rotation' => "BIT_ROTATE",
|
830 |
|
|
'neighbor' => "NEIGHBOR",
|
831 |
|
|
'custom' => "CUSTOM"
|
832 |
|
|
);
|
833 |
|
|
|
834 |
|
|
my $simulator =$simulate->object_get_attribute("Simulator");
|
835 |
38 |
alirezamon |
my $log= (defined $name)? "$ENV{PRONOC_WORK}/simulate/$name.log": "$ENV{PRONOC_WORK}/simulate/sim.log";
|
836 |
48 |
alirezamon |
my $out_path ="$ENV{PRONOC_WORK}/simulate/";
|
837 |
38 |
alirezamon |
my $r= $simulate->object_get_attribute($sample,"ratios");
|
838 |
|
|
my @ratios=@{check_inserted_ratios($r)};
|
839 |
|
|
#$emulate->object_add_attribute ("sample$i","status","run");
|
840 |
43 |
alirezamon |
my $bin=get_sim_bin_path($simulate,$sample,$info);
|
841 |
38 |
alirezamon |
|
842 |
|
|
#load traffic configuration
|
843 |
48 |
alirezamon |
my $patern=$simulate->object_get_attribute ($sample,'traffic');
|
844 |
|
|
my $PCK_NUM_LIMIT=$simulate->object_get_attribute ($sample,"PCK_NUM_LIMIT");
|
845 |
|
|
my $SIM_CLOCK_LIMIT=$simulate->object_get_attribute ($sample,"SIM_CLOCK_LIMIT");
|
846 |
38 |
alirezamon |
my $MIN_PCK_SIZE=$simulate->object_get_attribute ($sample,"MIN_PCK_SIZE");
|
847 |
|
|
my $MAX_PCK_SIZE=$simulate->object_get_attribute ($sample,"MAX_PCK_SIZE");
|
848 |
|
|
|
849 |
|
|
|
850 |
|
|
#hotspot
|
851 |
48 |
alirezamon |
my $custom="";
|
852 |
|
|
my $custom_sv="";
|
853 |
|
|
if ($patern eq 'custom'){
|
854 |
|
|
$custom="";
|
855 |
|
|
my $num=$simulate->object_get_attribute($sample,"CUSTOM_SRC_NUM");
|
856 |
|
|
$custom_sv.="localparam CUSTOM_NODE_NUM=$num;\n\twire [NEw-1 : 0] custom_traffic_t [NE-1 : 0];\n\twire [NE-1 : 0] custom_traffic_en;\n";
|
857 |
|
|
my @srcs;
|
858 |
|
|
for (my $i=0;$i<$num; $i++){
|
859 |
|
|
my $src = $simulate->object_get_attribute($sample,"SRC_$i");
|
860 |
|
|
my $dst = $simulate->object_get_attribute($sample,"DST_$i");
|
861 |
|
|
|
862 |
|
|
$custom.=($i==0)? "-H \"$src,$dst" : ",$src,$dst";
|
863 |
|
|
|
864 |
|
|
}
|
865 |
|
|
my ($topology, $T1, $T2, $T3, $V, $Fpay) = get_sample_emulation_param($simulate,$sample);
|
866 |
|
|
my ($NE, $NR, $RAw, $EAw, $Fw) = get_topology_info_sub ($topology, $T1, $T2, $T3, $V, $Fpay);
|
867 |
|
|
|
868 |
|
|
for (my $i=0;$i<$NE; $i++){
|
869 |
|
|
my ($src,$dst) = custom_traffic_dest ($simulate,$sample,$i);
|
870 |
|
|
$custom_sv.="\tassign custom_traffic_t[$src]=$dst;\n";
|
871 |
|
|
$custom_sv.="\tassign custom_traffic_en[$src]=";
|
872 |
|
|
$custom_sv.=($dst==-1)? "1'b0;//off \n" : "1'b1;\n"
|
873 |
|
|
}
|
874 |
|
|
$custom.="\"";
|
875 |
|
|
|
876 |
|
|
}
|
877 |
|
|
else{
|
878 |
|
|
$custom_sv.="localparam CUSTOM_NODE_NUM=0;\n\twire [NEw-1 : 0] custom_traffic_t [NE-1 : 0];\n\twire [NE-1 : 0] custom_traffic_en;
|
879 |
|
|
";
|
880 |
|
|
}
|
881 |
|
|
|
882 |
|
|
my $classes;
|
883 |
|
|
my $num=$simulate->object_get_attribute($sample,"MESSAGE_CLASS");
|
884 |
|
|
$classes.="-p 100" if($num==0);
|
885 |
|
|
for (my $i=0;$i<$num;$i++){
|
886 |
|
|
my $w1 = $simulate->object_get_attribute($sample,"CLASS_$i");
|
887 |
|
|
$classes.= ($i==0)? "-p $w1" : ",$w1" ;
|
888 |
|
|
|
889 |
|
|
}
|
890 |
|
|
|
891 |
|
|
my $discrete_sv="";
|
892 |
38 |
alirezamon |
my $hotspot="";
|
893 |
48 |
alirezamon |
my $hotspot_sv="";
|
894 |
38 |
alirezamon |
if($patern eq "hot spot"){
|
895 |
|
|
$hotspot="-h \" ";
|
896 |
|
|
my $num=$simulate->object_get_attribute($sample,"HOTSPOT_NUM");
|
897 |
|
|
if (defined $num){
|
898 |
48 |
alirezamon |
$hotspot.=" $num";
|
899 |
38 |
alirezamon |
|
900 |
48 |
alirezamon |
$hotspot_sv.="localparam HOTSPOT_NODE_NUM=$num;\n\thotspot_t hotspot_info [HOTSPOT_NODE_NUM-1 : 0];\n";
|
901 |
|
|
my $acum=0;
|
902 |
|
|
|
903 |
38 |
alirezamon |
for (my $i=0;$i<$num;$i++){
|
904 |
|
|
my $w1 = $simulate->object_get_attribute($sample,"HOTSPOT_CORE_$i");
|
905 |
|
|
my $w2 = $simulate->object_get_attribute($sample,"HOTSPOT_PERCENT_$i");
|
906 |
|
|
$w2=$w2*10;
|
907 |
|
|
my $w3 = $simulate->object_get_attribute($sample,"HOTSPOT_SEND_EN_$i");
|
908 |
48 |
alirezamon |
$hotspot.=",$w1,$w3,$w2";
|
909 |
|
|
$acum+=$w2;
|
910 |
|
|
|
911 |
|
|
$hotspot_sv.="
|
912 |
|
|
assign hotspot_info[$i].ip_num=$w1;
|
913 |
|
|
assign hotspot_info[$i].send_enable=$w3;
|
914 |
|
|
assign hotspot_info[$i].percentage=$acum; // $w2
|
915 |
|
|
"; }
|
916 |
38 |
alirezamon |
|
917 |
|
|
}
|
918 |
|
|
|
919 |
48 |
alirezamon |
$hotspot.=" \"";
|
920 |
38 |
alirezamon |
|
921 |
|
|
}
|
922 |
48 |
alirezamon |
else{ $hotspot_sv.="localparam HOTSPOT_NODE_NUM = 0;\n\thotspot_t hotspot_info [0:0];\n" }
|
923 |
|
|
|
924 |
|
|
my $pck_size;
|
925 |
|
|
my $t=$simulate->object_get_attribute($sample,"PCK_SIZ_SEL");
|
926 |
|
|
if($t eq 'random-range' ){
|
927 |
|
|
|
928 |
|
|
$pck_size = "-m \"R,$MIN_PCK_SIZE,$MAX_PCK_SIZE\"";
|
929 |
|
|
$discrete_sv="\t localparam DISCRETE_PCK_SIZ_NUM=1;
|
930 |
|
|
\t rnd_discrete_t rnd_discrete [DISCRETE_PCK_SIZ_NUM-1:0];\n";
|
931 |
|
|
|
932 |
|
|
}else{
|
933 |
|
|
my $vt=$simulate->object_get_attribute($sample,"DISCRETE_RANGE");
|
934 |
|
|
my $pt=$simulate->object_get_attribute($sample,"PROBEB_RANGE");
|
935 |
|
|
$pck_size = "-m \"D,$vt,P,$pt\"";
|
936 |
|
|
my @injects = split(',',$vt);
|
937 |
|
|
my @probs = split(',',$pt);
|
938 |
|
|
my $i=0;
|
939 |
|
|
my $sum=0;
|
940 |
|
|
for my $v (@injects) {
|
941 |
|
|
$sum+=$probs[$i];
|
942 |
|
|
$discrete_sv.= "\t assign rnd_discrete[$i].value= $v;\n";
|
943 |
|
|
$discrete_sv.= "\t assign rnd_discrete[$i].percentage= $sum;\n";
|
944 |
|
|
$i++;
|
945 |
|
|
}
|
946 |
|
|
$discrete_sv="\t localparam DISCRETE_PCK_SIZ_NUM=$i;
|
947 |
|
|
\t rnd_discrete_t rnd_discrete [DISCRETE_PCK_SIZ_NUM-1: 0];\n".$discrete_sv;
|
948 |
|
|
}
|
949 |
|
|
|
950 |
|
|
my $modelsim_bin= $ENV{MODELSIM_BIN};
|
951 |
53 |
alirezamon |
my $vsim = (! defined $modelsim_bin)? "vsim" : "$modelsim_bin/vsim";
|
952 |
|
|
|
953 |
|
|
|
954 |
|
|
|
955 |
48 |
alirezamon |
|
956 |
|
|
my $cpu_num = $simulate->object_get_attribute('compile', 'cpu_num');
|
957 |
|
|
$cpu_num = 1 if (!defined $cpu_num);
|
958 |
|
|
|
959 |
|
|
my $thread_num = $simulate->object_get_attribute('compile', 'thread_num');
|
960 |
|
|
$thread_num = 1 if (!defined $thread_num);
|
961 |
|
|
|
962 |
|
|
if ($simulator ne 'Verilator'){
|
963 |
|
|
for (my $i=0; $i<$cpu_num; $i++ ){
|
964 |
|
|
my $out="$out_path/modelsim/work$i";
|
965 |
|
|
rmtree("$out");
|
966 |
|
|
mkpath("$out",1,01777);
|
967 |
|
|
my $vsim = ($simulator eq 'Modelsim')? "vsim -c": "vsim";
|
968 |
|
|
gen_noc_localparam_v_file($simulate,"$out",$sample);
|
969 |
|
|
my $param="
|
970 |
|
|
// simulation parameter setting
|
971 |
|
|
|
972 |
|
|
`ifdef INCLUDE_SIM_PARAM
|
973 |
|
|
localparam
|
974 |
|
|
TRAFFIC=\"$traffic{$patern}\",
|
975 |
|
|
PCK_SIZ_SEL=\"$t\",
|
976 |
|
|
AVG_LATENCY_METRIC= \"HEAD_2_TAIL\",
|
977 |
|
|
//simulation min and max packet size. The injected packet take a size randomly selected between min and max value
|
978 |
|
|
MIN_PACKET_SIZE=$MIN_PCK_SIZE,
|
979 |
|
|
MAX_PACKET_SIZE=$MAX_PCK_SIZE,
|
980 |
|
|
STOP_PCK_NUM=$PCK_NUM_LIMIT,
|
981 |
|
|
STOP_SIM_CLK=$SIM_CLOCK_LIMIT;
|
982 |
|
|
|
983 |
|
|
$hotspot_sv
|
984 |
|
|
|
985 |
|
|
$custom_sv
|
986 |
|
|
|
987 |
|
|
$discrete_sv
|
988 |
|
|
|
989 |
|
|
parameter INJRATIO=90;
|
990 |
|
|
`endif
|
991 |
|
|
";
|
992 |
|
|
save_file("$out/sim_param.sv",$param);
|
993 |
38 |
alirezamon |
|
994 |
48 |
alirezamon |
|
995 |
|
|
#Get the list of all verilog files in src_verilog folder
|
996 |
|
|
my @files = File::Find::Rule->file()
|
997 |
|
|
->name( '*.v','*.V','*.sv' )
|
998 |
|
|
->in( "$out_path/modelsim/src_verilog" );
|
999 |
38 |
alirezamon |
|
1000 |
48 |
alirezamon |
#get list of all verilog files in src_sim folder
|
1001 |
|
|
my @sim_files = File::Find::Rule->file()
|
1002 |
|
|
->name( '*.v','*.V','*.sv' )
|
1003 |
|
|
->in( "$out_path/modelsim/src_modelsim" );
|
1004 |
|
|
push (@files, @sim_files);
|
1005 |
|
|
my $tt =create_file_list("$out_path/modelsim",\@files,'modelsim');
|
1006 |
|
|
$tt="+incdir+./ \n$tt";
|
1007 |
|
|
save_file("$out/file_list.f", "$tt");
|
1008 |
|
|
my $tcl="#!/usr/bin/tclsh
|
1009 |
|
|
|
1010 |
|
|
|
1011 |
|
|
transcript on
|
1012 |
|
|
if {[file exists rtl_work]} {
|
1013 |
|
|
vdel -lib rtl_work -all
|
1014 |
|
|
}
|
1015 |
|
|
vlib rtl_work
|
1016 |
|
|
vmap work rtl_work
|
1017 |
|
|
|
1018 |
|
|
|
1019 |
|
|
vlog +acc=rn -F $out/file_list.f
|
1020 |
|
|
|
1021 |
|
|
$vsim -t 1ps -L rtl_work -L work -voptargs=\"+acc\" testbench_noc
|
1022 |
|
|
|
1023 |
|
|
add wave *
|
1024 |
|
|
view structure
|
1025 |
|
|
view signals
|
1026 |
|
|
run -all
|
1027 |
|
|
quit
|
1028 |
|
|
";
|
1029 |
|
|
|
1030 |
|
|
save_file ("$out/model.tcl",$tcl);
|
1031 |
|
|
|
1032 |
53 |
alirezamon |
my $cmd="cd $out; rm -Rf rtl_work; $vsim -do $out/model.tcl ";
|
1033 |
48 |
alirezamon |
save_file ("$out/run.sh",'#!/bin/bash'."
|
1034 |
|
|
sed -i \"s/ INJRATIO=\[\[:digit:\]\]\\+/ INJRATIO=\$1/\" $out/sim_param.sv
|
1035 |
|
|
".$cmd);
|
1036 |
|
|
add_info($info, "model.tcl is created in $out\n");
|
1037 |
|
|
}#for
|
1038 |
|
|
}
|
1039 |
|
|
|
1040 |
|
|
|
1041 |
|
|
|
1042 |
|
|
my @paralel_ratio;
|
1043 |
|
|
my $total=scalar @ratios;
|
1044 |
|
|
my $jobs=0;
|
1045 |
|
|
my $c=0;
|
1046 |
|
|
my $cmds="";
|
1047 |
|
|
|
1048 |
|
|
|
1049 |
38 |
alirezamon |
foreach my $ratio_in (@ratios){
|
1050 |
|
|
#my $r= $ratio_in * MAX_RATIO/100;
|
1051 |
48 |
alirezamon |
my $cmd;
|
1052 |
|
|
|
1053 |
|
|
if ($simulator eq 'Modelsim'){
|
1054 |
|
|
add_info($info, "Run $bin with injection ratio of $ratio_in \% \n");
|
1055 |
|
|
my $out="$out_path/modelsim/work$c";
|
1056 |
53 |
alirezamon |
$cmd=" xterm -e bash -c ' cd $out; sed -i \"s/ INJRATIO=\[\[:digit:\]\]\\+/ INJRATIO=$ratio_in/\" $out/sim_param.sv; rm -Rf rtl_work; $vsim -c -do $out/model.tcl -l $out_path/sim_out$ratio_in;' &\n ";
|
1057 |
48 |
alirezamon |
|
1058 |
|
|
}elsif ($simulator eq 'Modelsim gui'){
|
1059 |
|
|
add_info($info, "Run $bin with injection ratio of $ratio_in \% \n");
|
1060 |
|
|
my $out="$out_path/modelsim/work$c";
|
1061 |
53 |
alirezamon |
$cmd="cd $out; sed -i \"s/ INJRATIO=\[\[:digit:\]\]\\+/ INJRATIO=$ratio_in/\" $out/sim_param.sv; rm -Rf rtl_work; $vsim -do $out/model.tcl -l $out_path/sim_out$ratio_in; ";
|
1062 |
48 |
alirezamon |
|
1063 |
|
|
}else{
|
1064 |
|
|
add_info($info, "Run $bin with injection ratio of $ratio_in \% \n");
|
1065 |
|
|
$cmd="$bin -t \"$patern\" $pck_size -T $thread_num -n $PCK_NUM_LIMIT -c $SIM_CLOCK_LIMIT -i $ratio_in $classes $hotspot $custom > $out_path/sim_out$ratio_in & ";
|
1066 |
|
|
|
1067 |
|
|
}
|
1068 |
|
|
$cmds .=$cmd;
|
1069 |
38 |
alirezamon |
add_info($info, "$cmd \n");
|
1070 |
48 |
alirezamon |
|
1071 |
38 |
alirezamon |
my $time_strg = localtime;
|
1072 |
48 |
alirezamon |
#append_text_to_file($log,"started at:$time_strg\n"); #save simulation output
|
1073 |
|
|
$jobs++;
|
1074 |
38 |
alirezamon |
|
1075 |
48 |
alirezamon |
push (@paralel_ratio,$ratio_in);
|
1076 |
|
|
$c++;
|
1077 |
|
|
if($jobs % $cpu_num ==0 || $jobs == $total){
|
1078 |
|
|
|
1079 |
|
|
#run paralle simulation
|
1080 |
|
|
my ($stdout,$exit,$stderr)=run_cmd_in_back_ground_get_stdout("$cmds\n wait\n");
|
1081 |
|
|
if($exit || (length $stderr >4)){
|
1082 |
|
|
add_colored_info($info, "Error in running simulation: $stderr \n",'red');
|
1083 |
|
|
$simulate->object_add_attribute ($sample,"status","failed");
|
1084 |
|
|
$simulate->object_add_attribute('status',undef,'ideal');
|
1085 |
|
|
return;
|
1086 |
|
|
}
|
1087 |
|
|
|
1088 |
|
|
#save results
|
1089 |
|
|
for (my $i=0; $i<$c; $i++){
|
1090 |
|
|
my $r = $paralel_ratio[$i];
|
1091 |
|
|
|
1092 |
|
|
my @errors = unix_grep("$out_path/sim_out$r","ERROR:");
|
1093 |
|
|
if (scalar @errors ){
|
1094 |
|
|
add_colored_info($info, "Error in running simulation: @errors \n",'red');
|
1095 |
|
|
$simulate->object_add_attribute ($sample,"status","failed");
|
1096 |
|
|
$simulate->object_add_attribute('status',undef,'ideal');
|
1097 |
|
|
return;
|
1098 |
|
|
}
|
1099 |
|
|
|
1100 |
|
|
|
1101 |
|
|
my $stdout = load_file("$out_path/sim_out$r");
|
1102 |
|
|
|
1103 |
|
|
extract_and_update_noc_sim_statistic ($simulate,$sample,$r,$stdout);
|
1104 |
|
|
|
1105 |
|
|
|
1106 |
|
|
}
|
1107 |
|
|
|
1108 |
|
|
$cmds="";
|
1109 |
|
|
@paralel_ratio=();
|
1110 |
|
|
$c=0;
|
1111 |
|
|
|
1112 |
|
|
set_gui_status($simulate,"ref",2);
|
1113 |
|
|
}
|
1114 |
|
|
|
1115 |
|
|
}#@ratios
|
1116 |
38 |
alirezamon |
|
1117 |
|
|
$simulate->object_add_attribute ($sample,"status","done");
|
1118 |
|
|
|
1119 |
48 |
alirezamon |
}
|
1120 |
|
|
|
1121 |
|
|
sub extract_and_update_noc_sim_statistic {
|
1122 |
|
|
my ($simulate,$sample,$ratio_in,$stdout)=@_;
|
1123 |
|
|
my @results = split("#node,",$stdout);
|
1124 |
|
|
my %statistcs;
|
1125 |
|
|
my @lines = split("\n",$results[1]);
|
1126 |
|
|
#first line is statsitic names
|
1127 |
|
|
my @names;
|
1128 |
|
|
my $i=0;
|
1129 |
|
|
foreach my $line (@lines){
|
1130 |
|
|
$line=remove_all_white_spaces($line);
|
1131 |
|
|
$line =~ s/^#//g; #remove # from beginig of each line in modelsim
|
1132 |
|
|
if($i==0){
|
1133 |
|
|
@names=split(",",$line);
|
1134 |
|
|
|
1135 |
|
|
}else{
|
1136 |
|
|
my @fileds=split(",",$line);
|
1137 |
|
|
my $j=0;
|
1138 |
|
|
#print ("ff :@fileds\n");
|
1139 |
|
|
foreach my $f (@fileds){
|
1140 |
|
|
unless($j==0){
|
1141 |
|
|
$statistcs{$fileds[0]}{$names[$j-1]}=$f;
|
1142 |
|
|
}
|
1143 |
|
|
$j++;
|
1144 |
|
|
}
|
1145 |
|
|
}
|
1146 |
|
|
$i++;
|
1147 |
|
|
}
|
1148 |
|
|
#print Dumper(\%statistcs);
|
1149 |
38 |
alirezamon |
|
1150 |
48 |
alirezamon |
|
1151 |
|
|
|
1152 |
|
|
my $total_time =capture_number_after("Simulation clock cycles:",$stdout);
|
1153 |
|
|
|
1154 |
|
|
my %packet_rsvd_per_core = capture_cores_data("total number of received packets:",$stdout);
|
1155 |
|
|
my %worst_rsvd_delay_per_core = capture_cores_data('worst-case-delay of received packets \(clks\):',$stdout);
|
1156 |
|
|
my %packet_sent_per_core = capture_cores_data("total number of sent packets:",$stdout);
|
1157 |
|
|
my %worst_sent_delay_per_core = capture_cores_data('worst-case-delay of sent packets \(clks\):',$stdout);
|
1158 |
|
|
|
1159 |
|
|
next if (!defined $statistcs{"total"}{'avg_latency_pck'});
|
1160 |
|
|
update_result($simulate,$sample,"latency_result",$ratio_in,$statistcs{"total"}{'avg_latency_pck'});
|
1161 |
|
|
update_result($simulate,$sample,"latency_flit_result",$ratio_in,$statistcs{"total"}{'avg_latency_flit'});
|
1162 |
|
|
update_result($simulate,$sample,"sd_latency_result",$ratio_in,$statistcs{"total"}{'avg.std_dev'});
|
1163 |
|
|
update_result($simulate,$sample,"throughput_result",$ratio_in,$statistcs{"total"}{'avg_throughput(%)'});
|
1164 |
|
|
update_result($simulate,$sample,"exe_time_result",$ratio_in,$total_time);
|
1165 |
|
|
update_result($simulate,$sample,"worst_latency_result",$ratio_in,$statistcs{"total"}{'sent_stat.worst_latency'});
|
1166 |
|
|
update_result($simulate,$sample,"latency_perhop_result",$ratio_in,$statistcs{"total"}{'avg_latency_per_hop'});
|
1167 |
|
|
update_result($simulate,$sample,"min_latency_result",,$ratio_in,$statistcs{"total"}{'sent_stat.min_latency'});
|
1168 |
|
|
update_result($simulate,$sample,"injected_pck_total",,$ratio_in,$statistcs{"total"}{'sent_stat.pck_num'});
|
1169 |
|
|
update_result($simulate,$sample,"injected_flit_total",,$ratio_in,$statistcs{"total"}{'sent_stat.flit_num'});
|
1170 |
|
|
foreach my $p (sort keys %statistcs){
|
1171 |
|
|
next unless (is_integer($p));
|
1172 |
|
|
update_result($simulate,$sample,"packet_rsvd_result",$ratio_in,$p,$statistcs{$p}{'rsvd_stat.pck_num'});
|
1173 |
|
|
update_result($simulate,$sample,"worst_delay_rsvd_result",$ratio_in,$p,$statistcs{$p}{'rsvd_stat.worst_latency'});
|
1174 |
|
|
update_result($simulate,$sample,"packet_sent_result",$ratio_in,$p,$statistcs{$p}{'sent_stat.pck_num'} );
|
1175 |
|
|
update_result($simulate,$sample,"worst_delay_sent_result",$ratio_in,$p,$statistcs{$p}{'sent_stat.worst_latency'});
|
1176 |
|
|
}
|
1177 |
38 |
alirezamon |
}
|
1178 |
|
|
|
1179 |
|
|
|
1180 |
48 |
alirezamon |
sub run_task_simulation{
|
1181 |
38 |
alirezamon |
my ($simulate,$info,$sample,$name)=@_;
|
1182 |
|
|
my $log= (defined $name)? "$ENV{PRONOC_WORK}/simulate/$name.log": "$ENV{PRONOC_WORK}/simulate/sim.log";
|
1183 |
|
|
my $SIM_CLOCK_LIMIT=$simulate->object_get_attribute ($sample,"SIM_CLOCK_LIMIT");
|
1184 |
43 |
alirezamon |
|
1185 |
|
|
my $bin=get_sim_bin_path($simulate,$sample,$info);
|
1186 |
|
|
|
1187 |
38 |
alirezamon |
my $dir = Cwd::getcwd();
|
1188 |
|
|
my $project_dir = abs_path("$dir/../.."); #mpsoc directory address
|
1189 |
|
|
$bin= "$project_dir/$bin" if(!(-f $bin));
|
1190 |
|
|
my $num=$simulate->object_get_attribute($sample,"TRAFFIC_FILE_NUM");
|
1191 |
48 |
alirezamon |
|
1192 |
|
|
my $cpu_num = $simulate->object_get_attribute('compile', 'cpu_num');
|
1193 |
|
|
$cpu_num = 1 if (!defined $cpu_num);
|
1194 |
|
|
|
1195 |
|
|
my @paralel_ratio;
|
1196 |
|
|
my $total=$num;
|
1197 |
|
|
my $jobs=0;
|
1198 |
|
|
my $c=0;
|
1199 |
|
|
my $cmds="";
|
1200 |
|
|
my $out_path ="$ENV{PRONOC_WORK}/simulate/";
|
1201 |
|
|
|
1202 |
38 |
alirezamon |
for (my $i=0; $i<$num; $i++){
|
1203 |
|
|
my $f=$simulate->object_get_attribute($sample,"traffic_file$i");
|
1204 |
|
|
add_info($info, "Run $bin for $f file \n");
|
1205 |
48 |
alirezamon |
my $cmd="$bin -c $SIM_CLOCK_LIMIT -f \"$f\" > $out_path/sim_out$i & ";
|
1206 |
|
|
$cmds .=$cmd;
|
1207 |
38 |
alirezamon |
add_info($info, "$cmd \n");
|
1208 |
48 |
alirezamon |
$jobs++;
|
1209 |
|
|
push (@paralel_ratio,$i);
|
1210 |
|
|
$c++;
|
1211 |
|
|
if($jobs % $cpu_num ==0 || $jobs == $total){
|
1212 |
|
|
#run paralle simulation
|
1213 |
|
|
my ($stdout,$exit,$stderr)=run_cmd_in_back_ground_get_stdout("$cmds\n wait\n");
|
1214 |
|
|
#print "($stdout,$exit,$stderr)\n";
|
1215 |
|
|
if($exit || (length $stderr >4)){
|
1216 |
|
|
add_colored_info($info, "Error in running simulation: $stderr \n",'red');
|
1217 |
38 |
alirezamon |
$simulate->object_add_attribute ($sample,"status","failed");
|
1218 |
|
|
$simulate->object_add_attribute('status',undef,'ideal');
|
1219 |
|
|
return;
|
1220 |
48 |
alirezamon |
}
|
1221 |
|
|
|
1222 |
38 |
alirezamon |
|
1223 |
48 |
alirezamon |
|
1224 |
|
|
|
1225 |
|
|
#save results
|
1226 |
|
|
for (my $j=0; $j<$c; $j++){
|
1227 |
|
|
my $r = $paralel_ratio[$j];
|
1228 |
|
|
my $stdout = load_file("$out_path/sim_out$r");
|
1229 |
|
|
my @errors = unix_grep("$out_path/sim_out$r","ERROR:");
|
1230 |
|
|
if (scalar @errors ){
|
1231 |
|
|
add_colored_info($info, "Error in running simulation: @errors \n",'red');
|
1232 |
|
|
$simulate->object_add_attribute ($sample,"status","failed");
|
1233 |
|
|
$simulate->object_add_attribute('status',undef,'ideal');
|
1234 |
|
|
return;
|
1235 |
|
|
}
|
1236 |
|
|
|
1237 |
|
|
extract_and_update_noc_sim_statistic ($simulate,$sample,$r,$stdout);
|
1238 |
|
|
}
|
1239 |
|
|
|
1240 |
|
|
$cmds="";
|
1241 |
|
|
@paralel_ratio=();
|
1242 |
|
|
$c=0;
|
1243 |
|
|
set_gui_status($simulate,"ref",2);
|
1244 |
|
|
}
|
1245 |
|
|
|
1246 |
|
|
}#for i
|
1247 |
38 |
alirezamon |
|
1248 |
|
|
$simulate->object_add_attribute ($sample,"status","done");
|
1249 |
|
|
}
|
1250 |
|
|
|
1251 |
|
|
|
1252 |
|
|
|
1253 |
|
|
##########
|
1254 |
|
|
# check_sample
|
1255 |
|
|
##########
|
1256 |
|
|
|
1257 |
43 |
alirezamon |
sub get_sim_bin_path {
|
1258 |
38 |
alirezamon |
my ($self,$sample,$info)=@_;
|
1259 |
|
|
my $bin_path=$self->object_get_attribute ($sample,"sof_path");
|
1260 |
43 |
alirezamon |
unless (-d $bin_path){
|
1261 |
|
|
my $path= $self->object_get_attribute ("sim_param","BIN_DIR");
|
1262 |
|
|
if(-d $path){
|
1263 |
48 |
alirezamon |
add_colored_info($info, "Warning: The given path ($bin_path) for searching $sample bin file does not exist. The system search in default $path instead.\n",'green');
|
1264 |
43 |
alirezamon |
$bin_path=$path;
|
1265 |
|
|
}
|
1266 |
|
|
}
|
1267 |
48 |
alirezamon |
my $bin_file=$self->object_get_attribute ($sample,"sof_file");
|
1268 |
|
|
$bin_file = "-" if(!defined $bin_file);
|
1269 |
38 |
alirezamon |
my $sof="$bin_path/$bin_file";
|
1270 |
43 |
alirezamon |
return $sof;
|
1271 |
|
|
}
|
1272 |
|
|
|
1273 |
|
|
sub check_sim_sample{
|
1274 |
|
|
my ($self,$sample,$info)=@_;
|
1275 |
|
|
my $status=1;
|
1276 |
|
|
my $sof=get_sim_bin_path($self,$sample,$info);
|
1277 |
|
|
|
1278 |
38 |
alirezamon |
# ckeck if sample have sof file
|
1279 |
|
|
if(!defined $sof){
|
1280 |
43 |
alirezamon |
add_colored_info($info, "Error: bin file has not set for $sample!\n",'red');
|
1281 |
38 |
alirezamon |
$self->object_add_attribute ($sample,"status","failed");
|
1282 |
|
|
$status=0;
|
1283 |
|
|
} else {
|
1284 |
|
|
# ckeck if bin file has info file
|
1285 |
|
|
my ($name,$path,$suffix) = fileparse("$sof",qr"\..[^.]*$");
|
1286 |
|
|
my $sof_info= "$path$name.inf";
|
1287 |
|
|
if(!(-f $sof_info)){
|
1288 |
48 |
alirezamon |
add_colored_info($info, "Could not find $name.inf file in $path. An information file is required for each sof file containing the device name and NoC configuration. Press F3 for more help.\n",'red');
|
1289 |
38 |
alirezamon |
$self->object_add_attribute ($sample,"status","failed");
|
1290 |
|
|
$status=0;
|
1291 |
|
|
}else { #add info
|
1292 |
|
|
my $pp= do $sof_info ;
|
1293 |
|
|
|
1294 |
|
|
my $p=$pp->{'noc_param'};
|
1295 |
|
|
|
1296 |
|
|
$status=0 if $@;
|
1297 |
|
|
message_dialog("Error reading: $@") if $@;
|
1298 |
|
|
if ($status==1){
|
1299 |
|
|
$self->object_add_attribute ($sample,"noc_info",$p) ;
|
1300 |
|
|
|
1301 |
|
|
|
1302 |
|
|
}
|
1303 |
|
|
}
|
1304 |
|
|
}
|
1305 |
43 |
alirezamon |
#check if sample min packet size matches in simulation
|
1306 |
|
|
|
1307 |
|
|
my $p= $self->object_get_attribute ($sample,"noc_info");
|
1308 |
|
|
my $HW_MIN_PCK_SIZE=$p->{"MIN_PCK_SIZE"};
|
1309 |
48 |
alirezamon |
my $HW_PCK_TYPE=$p->{"PCK_TYPE"};
|
1310 |
43 |
alirezamon |
my $SIM_MIN_PCK_SIZE=$self->object_get_attribute ($sample,"MIN_PCK_SIZE");
|
1311 |
48 |
alirezamon |
my $SIM_MAX_PCK_SIZE=$self->object_get_attribute ($sample,"MAX_PCK_SIZE");
|
1312 |
43 |
alirezamon |
if(!defined $HW_MIN_PCK_SIZE){
|
1313 |
|
|
$HW_MIN_PCK_SIZE= 2;
|
1314 |
|
|
#print "undef\n";
|
1315 |
|
|
}
|
1316 |
48 |
alirezamon |
$HW_PCK_TYPE = "MULTI_FLIT" if(~defined $HW_PCK_TYPE);
|
1317 |
43 |
alirezamon |
if($HW_MIN_PCK_SIZE>$SIM_MIN_PCK_SIZE){
|
1318 |
|
|
add_colored_info($info, "Error: The minimum simulation packet size of $SIM_MIN_PCK_SIZE flit(s) is smaller than $HW_MIN_PCK_SIZE which is defined in generating verilog model of NoC!\n",'red');
|
1319 |
|
|
$self->object_add_attribute ($sample,"status","failed");
|
1320 |
|
|
$status=0;
|
1321 |
48 |
alirezamon |
}
|
1322 |
|
|
if( $HW_PCK_TYPE eq '"SINGLE_FLIT"' && $SIM_MAX_PCK_SIZE !=1){
|
1323 |
|
|
#print "$HW_PCK_TYPE \n";
|
1324 |
|
|
add_colored_info($info, "Error: The maximum packet size is set as $SIM_MAX_PCK_SIZE however, the selected NoC model only support single-flit packet injection! Please redefine it to one\n",'red');
|
1325 |
|
|
|
1326 |
|
|
$self->object_add_attribute ($sample,"status","failed");
|
1327 |
|
|
$status=0;
|
1328 |
|
|
}
|
1329 |
|
|
|
1330 |
38 |
alirezamon |
return $status;
|
1331 |
|
|
}
|
1332 |
|
|
|
1333 |
48 |
alirezamon |
sub noc_sim_ctrl{
|
1334 |
|
|
my ($simulate,$info)=@_;
|
1335 |
|
|
|
1336 |
|
|
my $generate = def_image_button('icons/forward.png','R_un all',FALSE,1);
|
1337 |
|
|
my $open = def_image_button('icons/browse.png',"_Load",FALSE,1);
|
1338 |
|
|
my $save = def_image_button('icons/save.png','Sav_e',FALSE,1);
|
1339 |
|
|
my $save_all_results = def_image_button('icons/copy.png',"E_xtract all results",FALSE,1);
|
1340 |
|
|
my $cpus=select_parallel_process_num($simulate);
|
1341 |
|
|
my ($object,$attribute1,$attribute2,$content,$default,$status,$timeout)=@_;
|
1342 |
|
|
|
1343 |
|
|
my $compiler =def_pack_hbox('FALSE',0, gen_label_in_center('Simulator:'), gen_combobox_object($simulate,'Simulator',undef,"Modelsim gui,Modelsim,Verilator","Verilator",'ref',1));
|
1344 |
|
|
|
1345 |
|
|
|
1346 |
|
|
my $entry = gen_entry_object($simulate,'simulate_name',undef,undef,undef,undef);
|
1347 |
|
|
my $entrybox=gen_label_info(" Save as:",$entry);
|
1348 |
|
|
$entrybox->pack_start( $save, FALSE, FALSE, 0);
|
1349 |
|
|
|
1350 |
|
|
my $simulator =$simulate->object_get_attribute("Simulator");
|
1351 |
|
|
|
1352 |
|
|
|
1353 |
|
|
my $thread=select_parallel_thread_num($simulate);
|
1354 |
|
|
|
1355 |
|
|
|
1356 |
|
|
my $table = def_table (1, 12, FALSE);
|
1357 |
|
|
$table->attach ($open, 0, 1, 0,1,'expand','shrink',2,2);
|
1358 |
|
|
$table->attach ($compiler, 1, 2, 0,1,'expand','shrink',2,2);
|
1359 |
|
|
|
1360 |
|
|
$table->attach ($cpus, 2, 4, 0,1,'expand','shrink',2,2);
|
1361 |
|
|
if($simulator eq "Verilator"){
|
1362 |
|
|
$table->attach ($thread, 4, 5, 0,1,'expand','shrink',2,2);
|
1363 |
|
|
}
|
1364 |
|
|
|
1365 |
|
|
$table->attach ($entrybox, 5, 7, 0,1,'expand','shrink',2,2);
|
1366 |
|
|
$table->attach ($save_all_results, 7, 8, 0,1,'shrink','shrink',2,2);
|
1367 |
|
|
$table->attach ($generate, 8, 9, 0,1,'expand','shrink',2,2);
|
1368 |
|
|
|
1369 |
|
|
$generate-> signal_connect("clicked" => sub{
|
1370 |
|
|
my @samples =$simulate->object_get_attribute_order("samples");
|
1371 |
|
|
foreach my $sample (@samples){
|
1372 |
|
|
$simulate->object_add_attribute ("$sample","status","run");
|
1373 |
|
|
}
|
1374 |
|
|
run_simulator($simulate,$info);
|
1375 |
|
|
#set_gui_status($emulate,"ideal",2);
|
1376 |
38 |
alirezamon |
|
1377 |
48 |
alirezamon |
});
|
1378 |
38 |
alirezamon |
|
1379 |
48 |
alirezamon |
# $wb-> signal_connect("clicked" => sub{
|
1380 |
|
|
# wb_address_setting($mpsoc);
|
1381 |
|
|
#
|
1382 |
|
|
# });
|
1383 |
43 |
alirezamon |
|
1384 |
48 |
alirezamon |
$open-> signal_connect("clicked" => sub{
|
1385 |
|
|
|
1386 |
|
|
load_simulation($simulate,$info);
|
1387 |
|
|
#print Dumper($simulate);
|
1388 |
|
|
set_gui_status($simulate,"ref",5);
|
1389 |
|
|
|
1390 |
|
|
});
|
1391 |
|
|
|
1392 |
|
|
$save-> signal_connect("clicked" => sub{
|
1393 |
|
|
save_simulation($simulate);
|
1394 |
|
|
set_gui_status($simulate,"ref",5);
|
1395 |
|
|
|
1396 |
|
|
|
1397 |
|
|
});
|
1398 |
|
|
|
1399 |
|
|
$save_all_results-> signal_connect("clicked" => sub{
|
1400 |
|
|
#Get the path where to save all the simulation results
|
1401 |
|
|
my $open_in = $simulate->object_get_attribute ('sim_param','BIN_DIR');
|
1402 |
|
|
get_dir_name($simulate,"Select the target directory","sim_param","ALL_RESULT_DIR",$open_in,'ref',1);
|
1403 |
|
|
$simulate->object_add_attribute ("graph_save","save_all_result",1);
|
1404 |
|
|
|
1405 |
|
|
});
|
1406 |
|
|
|
1407 |
|
|
|
1408 |
|
|
return $table;
|
1409 |
|
|
|
1410 |
|
|
}
|
1411 |
|
|
|
1412 |
|
|
|
1413 |
38 |
alirezamon |
############
|
1414 |
32 |
alirezamon |
# main
|
1415 |
|
|
############
|
1416 |
|
|
sub simulator_main{
|
1417 |
|
|
|
1418 |
|
|
add_color_to_gd();
|
1419 |
|
|
my $simulate= emulator->emulator_new();
|
1420 |
|
|
set_gui_status($simulate,"ideal",0);
|
1421 |
38 |
alirezamon |
|
1422 |
32 |
alirezamon |
|
1423 |
48 |
alirezamon |
my $main_table = def_table (25, 12, FALSE);
|
1424 |
|
|
$main_table->show_all;
|
1425 |
|
|
my ($infobox,$info)= create_txview();
|
1426 |
32 |
alirezamon |
|
1427 |
43 |
alirezamon |
|
1428 |
32 |
alirezamon |
|
1429 |
38 |
alirezamon |
my @pages =(
|
1430 |
|
|
{page_name=>" Avg. throughput/latency", page_num=>0},
|
1431 |
|
|
{page_name=>" Injected Packet ", page_num=>1},
|
1432 |
|
|
{page_name=>" Worst-Case Delay ",page_num=>2},
|
1433 |
48 |
alirezamon |
{page_name=>" Execution Time ",page_num=>3},
|
1434 |
38 |
alirezamon |
);
|
1435 |
|
|
|
1436 |
|
|
|
1437 |
|
|
|
1438 |
|
|
my @charts = (
|
1439 |
48 |
alirezamon |
{ type=>"2D_line", page_num=>0, graph_name=> "Avg. packet Latency", result_name => "latency_result", X_Title=> 'Desired Avg. Injected Load Per Router (flits/clock (%))', Y_Title=>'Avg. Packet Latency (clock)', Z_Title=>undef, Y_Max=>100},
|
1440 |
|
|
{ type=>"2D_line", page_num=>0, graph_name=> "Avg. flit Latency", result_name => "latency_flit_result", X_Title=> 'Desired Avg. Injected Load Per Router (flits/clock (%))', Y_Title=>'Avg. Flit Latency (clock)', Z_Title=>undef, Y_Max=>100},
|
1441 |
|
|
{ type=>"2D_line", page_num=>0, graph_name=> "Avg. flit Latency per hop", result_name => "latency_perhop_result", X_Title=> 'Desired Avg. Injected Load Per Router (flits/clock (%))', Y_Title=>'Avg. Flit Latency per hop (clock)', Z_Title=>undef, Y_Max=>100},
|
1442 |
|
|
{ type=>"2D_line", page_num=>0, graph_name=> "Avg. throughput", result_name => "throughput_result", X_Title=> 'Desired Avg. Injected Load Per Router (flits/clock (%))', Y_Title=>'Avg. Throughput (flits/clock (%))', Z_Title=>undef,Y_Max=>100},
|
1443 |
|
|
{ type=>"2D_line", page_num=>0, graph_name=> "Avg. SD latency", result_name => "sd_latency_result", X_Title=> 'Desired Avg. Injected Load Per Router (flits/clock (%))', Y_Title=>'Latency Standard Deviation (clock)', Z_Title=>undef},
|
1444 |
|
|
|
1445 |
|
|
{ type=>"2D_line", page_num=>0, graph_name=> "Worst pck latency (clk)", result_name => "worst_latency_result", X_Title=> 'Desired Avg. Injected Load Per Router (flits/clock (%))', Y_Title=>'Worst Packet Latency (clock)', Z_Title=>undef},
|
1446 |
|
|
{ type=>"2D_line", page_num=>0, graph_name=> "Min pck latency (clk)", result_name => "min_latency_result", X_Title=> 'Desired Avg. Injected Load Per Router (flits/clock (%))', Y_Title=>'Minimum Packet Latency (clock)', Z_Title=>undef},
|
1447 |
|
|
{ type=>"2D_line", page_num=>0, graph_name=> "Total injected pck", result_name =>"injected_pck_total" , X_Title=> 'Desired Avg. Injected Load Per Router (flits/clock (%))', Y_Title=>'Total Injected packets', Z_Title=>undef},
|
1448 |
|
|
{ type=>"2D_line", page_num=>0, graph_name=> "Total injected flit",result_name =>"injected_flit_total", X_Title=> 'Desired Avg. Injected Load Per Router (flits/clock (%))', Y_Title=>'Total Injected Fslits', Z_Title=>undef},
|
1449 |
|
|
|
1450 |
|
|
|
1451 |
|
|
|
1452 |
38 |
alirezamon |
{ 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},
|
1453 |
|
|
{ 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},
|
1454 |
|
|
{ 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},
|
1455 |
|
|
{ type=>"3D_bar", page_num=>2, graph_name=> "Sent", result_name => "worst_delay_sent_result",X_Title=>'Core ID' , Y_Title=>'Worst-Case Delay (clk)', Z_Title=>undef},
|
1456 |
|
|
{ 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 Simulation Time (clk)', Z_Title=>undef},
|
1457 |
32 |
alirezamon |
|
1458 |
38 |
alirezamon |
);
|
1459 |
32 |
alirezamon |
|
1460 |
|
|
|
1461 |
48 |
alirezamon |
my ($conf_box,$set_win)=process_notebook_gen($simulate,$info,"simulate",undef,@charts);
|
1462 |
|
|
my $chart =gen_multiple_charts ($simulate,\@pages,\@charts,0.4);
|
1463 |
32 |
alirezamon |
|
1464 |
|
|
|
1465 |
|
|
|
1466 |
|
|
$main_table->set_row_spacings (4);
|
1467 |
|
|
$main_table->set_col_spacings (1);
|
1468 |
|
|
|
1469 |
48 |
alirezamon |
|
1470 |
32 |
alirezamon |
#my $device_win=show_active_dev($soc,$soc,$infc,$soc_state,\$refresh,$info);
|
1471 |
|
|
|
1472 |
|
|
|
1473 |
|
|
|
1474 |
|
|
|
1475 |
|
|
my $image = get_status_gif($simulate);
|
1476 |
48 |
alirezamon |
my $ctrl = noc_sim_ctrl ($simulate,$info);
|
1477 |
32 |
alirezamon |
|
1478 |
38 |
alirezamon |
my $v1=gen_vpaned($conf_box,.45,$image);
|
1479 |
|
|
my $v2=gen_vpaned($infobox,.2,$chart);
|
1480 |
|
|
my $h1=gen_hpaned($v1,.4,$v2);
|
1481 |
32 |
alirezamon |
|
1482 |
|
|
|
1483 |
|
|
|
1484 |
38 |
alirezamon |
$main_table->attach_defaults ($h1 , 0, 12, 0,24);
|
1485 |
48 |
alirezamon |
$main_table->attach ($ctrl, 0,12, 24,25,'fill','fill',2,2);
|
1486 |
38 |
alirezamon |
|
1487 |
48 |
alirezamon |
|
1488 |
32 |
alirezamon |
|
1489 |
|
|
|
1490 |
48 |
alirezamon |
#check soc status every 0.5 second. refresh device table if there is any changes
|
1491 |
32 |
alirezamon |
Glib::Timeout->add (100, sub{
|
1492 |
|
|
|
1493 |
|
|
my ($state,$timeout)= get_gui_status($simulate);
|
1494 |
|
|
|
1495 |
|
|
if ($timeout>0){
|
1496 |
|
|
$timeout--;
|
1497 |
|
|
set_gui_status($simulate,$state,$timeout);
|
1498 |
38 |
alirezamon |
return TRUE;
|
1499 |
32 |
alirezamon |
|
1500 |
|
|
}
|
1501 |
38 |
alirezamon |
if($state eq "ideal"){
|
1502 |
|
|
return TRUE;
|
1503 |
|
|
|
1504 |
|
|
}
|
1505 |
|
|
|
1506 |
|
|
|
1507 |
|
|
|
1508 |
|
|
#refresh GUI
|
1509 |
48 |
alirezamon |
|
1510 |
|
|
$ctrl->destroy();
|
1511 |
38 |
alirezamon |
$conf_box->destroy();
|
1512 |
|
|
$chart->destroy();
|
1513 |
|
|
$image->destroy();
|
1514 |
|
|
$image = get_status_gif($simulate);
|
1515 |
48 |
alirezamon |
($conf_box,$set_win)=process_notebook_gen($simulate,$info,"simulate",$set_win,@charts);
|
1516 |
|
|
$chart = gen_multiple_charts ($simulate,\@pages,\@charts,0.4);
|
1517 |
|
|
$ctrl = noc_sim_ctrl ($simulate,$info);
|
1518 |
|
|
$main_table->attach ($ctrl,0, 12, 24,25,'fill','fill',2,2);
|
1519 |
|
|
$v1 -> pack1($conf_box, TRUE, TRUE);
|
1520 |
38 |
alirezamon |
$v1 -> pack2($image, TRUE, TRUE);
|
1521 |
|
|
$v2 -> pack2($chart, TRUE, TRUE);
|
1522 |
48 |
alirezamon |
|
1523 |
|
|
|
1524 |
|
|
|
1525 |
|
|
|
1526 |
38 |
alirezamon |
$conf_box->show_all();
|
1527 |
|
|
$main_table->show_all();
|
1528 |
|
|
set_gui_status($simulate,"ideal",0);
|
1529 |
|
|
|
1530 |
32 |
alirezamon |
return TRUE;
|
1531 |
|
|
|
1532 |
|
|
} );
|
1533 |
|
|
|
1534 |
|
|
|
1535 |
43 |
alirezamon |
|
1536 |
|
|
|
1537 |
48 |
alirezamon |
|
1538 |
32 |
alirezamon |
|
1539 |
48 |
alirezamon |
return add_widget_to_scrolled_win($main_table);
|
1540 |
32 |
alirezamon |
|
1541 |
|
|
|
1542 |
|
|
|
1543 |
48 |
alirezamon |
}
|
1544 |
32 |
alirezamon |
|
1545 |
48 |
alirezamon |
sub custom_traffic_dest{
|
1546 |
|
|
my ($self,$sample,$core_num) =@_;
|
1547 |
32 |
alirezamon |
|
1548 |
48 |
alirezamon |
my $num=$self->object_get_attribute($sample,"CUSTOM_SRC_NUM");
|
1549 |
|
|
for (my $i=0;$i<$num;$i++){
|
1550 |
|
|
my $src = $self->object_get_attribute($sample,"SRC_$i");
|
1551 |
|
|
my $dst = $self->object_get_attribute($sample,"DST_$i");
|
1552 |
|
|
return ($core_num,$dst) if($src == $core_num);
|
1553 |
|
|
}
|
1554 |
|
|
return ($core_num, -1);#off
|
1555 |
|
|
}
|
1556 |
32 |
alirezamon |
|