1 |
16 |
alirezamon |
#! /usr/bin/perl -w
|
2 |
48 |
alirezamon |
use constant::boolean;
|
3 |
16 |
alirezamon |
use strict;
|
4 |
|
|
use warnings;
|
5 |
43 |
alirezamon |
use FindBin;
|
6 |
|
|
use lib $FindBin::Bin;
|
7 |
16 |
alirezamon |
use mpsoc;
|
8 |
|
|
use soc;
|
9 |
|
|
use ip;
|
10 |
|
|
use interface;
|
11 |
|
|
use POSIX 'strtol';
|
12 |
|
|
use File::Path;
|
13 |
|
|
use File::Copy;
|
14 |
|
|
use Cwd 'abs_path';
|
15 |
48 |
alirezamon |
use Glib::Event;
|
16 |
|
|
use Event; # any order
|
17 |
16 |
alirezamon |
|
18 |
|
|
|
19 |
|
|
require "widget.pl";
|
20 |
|
|
require "mpsoc_verilog_gen.pl";
|
21 |
17 |
alirezamon |
require "hdr_file_gen.pl";
|
22 |
25 |
alirezamon |
require "readme_gen.pl";
|
23 |
28 |
alirezamon |
require "soc_gen.pl";
|
24 |
48 |
alirezamon |
require "topology.pl";
|
25 |
43 |
alirezamon |
require "diagram.pl";
|
26 |
48 |
alirezamon |
require "orcc.pl";
|
27 |
16 |
alirezamon |
|
28 |
|
|
|
29 |
|
|
sub initial_default_param{
|
30 |
43 |
alirezamon |
my $mpsoc=shift;
|
31 |
|
|
my @socs=$mpsoc->mpsoc_get_soc_list();
|
32 |
|
|
foreach my $soc_name (@socs){
|
33 |
|
|
my %param_value;
|
34 |
|
|
my $top=$mpsoc->mpsoc_get_soc($soc_name);
|
35 |
|
|
my @insts=$top->top_get_all_instances();
|
36 |
|
|
my @exceptions=get_NI_instance_list($top);
|
37 |
|
|
@insts=get_diff_array(\@insts,\@exceptions);
|
38 |
|
|
foreach my $inst (@insts){
|
39 |
|
|
my @params=$top->top_get_parameter_list($inst);
|
40 |
|
|
foreach my $p (@params){
|
41 |
|
|
my ($default,$type,$content,$info,$global_param,$redefine)=$top->top_get_parameter($inst,$p);
|
42 |
|
|
$param_value{$p}=$default;
|
43 |
|
|
}
|
44 |
|
|
}
|
45 |
|
|
$top->top_add_default_soc_param(\%param_value);
|
46 |
|
|
}
|
47 |
|
|
|
48 |
16 |
alirezamon |
}
|
49 |
|
|
|
50 |
|
|
#############
|
51 |
43 |
alirezamon |
# get_soc_lists
|
52 |
16 |
alirezamon |
############
|
53 |
|
|
|
54 |
|
|
sub get_soc_list {
|
55 |
48 |
alirezamon |
my ($mpsoc,$info)=@_;
|
56 |
43 |
alirezamon |
my $path=$mpsoc->object_get_attribute('setting','soc_path');
|
57 |
|
|
$path =~ s/ /\\ /g;
|
58 |
48 |
alirezamon |
my @socs;
|
59 |
43 |
alirezamon |
my @files = glob "$path/*.SOC";
|
60 |
|
|
for my $p (@files){
|
61 |
|
|
my ($soc,$r,$err) = regen_object($p);
|
62 |
|
|
# Read
|
63 |
|
|
if ($r){
|
64 |
48 |
alirezamon |
add_info($info,"**Error reading $p file: $err\n");
|
65 |
43 |
alirezamon |
next;
|
66 |
|
|
}
|
67 |
|
|
my $top=$soc->soc_get_top();
|
68 |
|
|
if (defined $top){
|
69 |
|
|
my @instance_list=$top->top_get_all_instances();
|
70 |
|
|
#check if the soc has ni port
|
71 |
|
|
foreach my $instanc(@instance_list){
|
72 |
|
|
my $category=$top->top_get_def_of_instance($instanc,'category');
|
73 |
|
|
if($category eq 'NoC')
|
74 |
|
|
{
|
75 |
|
|
my $name=$soc->object_get_attribute('soc_name');
|
76 |
48 |
alirezamon |
#get old tile parameter setting
|
77 |
|
|
my $old_top = $mpsoc->mpsoc_get_soc($name);
|
78 |
|
|
copy_back_custom_soc_param($top,$old_top) if(defined $old_top);
|
79 |
43 |
alirezamon |
$mpsoc->mpsoc_add_soc($name,$top);
|
80 |
|
|
#print" $name\n";
|
81 |
|
|
}
|
82 |
|
|
}
|
83 |
|
|
|
84 |
|
|
}
|
85 |
|
|
}# files
|
86 |
|
|
|
87 |
|
|
# initial default soc parameter
|
88 |
|
|
initial_default_param($mpsoc);
|
89 |
|
|
return $mpsoc->mpsoc_get_soc_list;
|
90 |
16 |
alirezamon |
}
|
91 |
30 |
alirezamon |
|
92 |
48 |
alirezamon |
sub copy_back_custom_soc_param{
|
93 |
|
|
my ($new,$old)=@_;
|
94 |
|
|
my @tiles = $old->top_get_custom_tile_list();
|
95 |
|
|
foreach my $tile (@tiles){
|
96 |
|
|
my %l =$old->top_get_custom_soc_param($tile);
|
97 |
|
|
$new->top_add_custom_soc_param (\%l,$tile);
|
98 |
|
|
}
|
99 |
|
|
|
100 |
|
|
}
|
101 |
30 |
alirezamon |
|
102 |
|
|
sub get_NI_instance_list {
|
103 |
43 |
alirezamon |
my $top=shift;
|
104 |
|
|
my @nis;
|
105 |
48 |
alirezamon |
return if (!defined $top);
|
106 |
43 |
alirezamon |
my @instance_list=$top->top_get_all_instances();
|
107 |
|
|
#check if the soc has ni port
|
108 |
|
|
foreach my $instanc(@instance_list){
|
109 |
|
|
my $category=$top->top_get_def_of_instance($instanc,'category');
|
110 |
|
|
push(@nis,$instanc) if($category eq 'NoC') ;
|
111 |
|
|
}
|
112 |
|
|
return @nis;
|
113 |
30 |
alirezamon |
}
|
114 |
|
|
|
115 |
16 |
alirezamon |
####################
|
116 |
|
|
# get_conflict_decision
|
117 |
|
|
###########################
|
118 |
|
|
|
119 |
|
|
|
120 |
|
|
sub get_conflict_decision{
|
121 |
43 |
alirezamon |
my ($mpsoc,$name,$inserted,$conflicts,$msg)=@_;
|
122 |
48 |
alirezamon |
$msg="\tThe inserted tile number(s) have been mapped previously to \n\t\t\"$msg\".\n\tDo you want to remove the conflicted tiles number(s) in newly \n\tinserted range or remove them from the previous ones? ";
|
123 |
43 |
alirezamon |
|
124 |
|
|
my $wind=def_popwin_size(10,30,"warning",'percent');
|
125 |
|
|
my $label= gen_label_in_left($msg);
|
126 |
|
|
my $table=def_table(2,6,FALSE);
|
127 |
|
|
$table->attach_defaults ($label , 0, 6, 0,1);
|
128 |
|
|
$wind->add($table);
|
129 |
16 |
alirezamon |
|
130 |
48 |
alirezamon |
my $b1= def_button("Remove Previous");
|
131 |
|
|
my $b2= def_button("Remove Current");
|
132 |
|
|
my $b3= def_button("Cancel");
|
133 |
43 |
alirezamon |
|
134 |
48 |
alirezamon |
$table->attach ($b1 , 0, 1, 1,2,'fill','fill',2,2);
|
135 |
|
|
$table->attach ($b2 , 3, 4, 1,2,'fill','fill',2,2);
|
136 |
|
|
$table->attach ($b3 , 5, 6, 1,2,'fill','fill',2,2);
|
137 |
16 |
alirezamon |
|
138 |
48 |
alirezamon |
|
139 |
43 |
alirezamon |
$wind->show_all();
|
140 |
|
|
|
141 |
|
|
$b1->signal_connect( "clicked"=> sub{ #Remove Previous
|
142 |
|
|
my @socs=$mpsoc->mpsoc_get_soc_list();
|
143 |
|
|
foreach my $p (@socs){
|
144 |
|
|
if($p ne $name){
|
145 |
|
|
my @taken_tiles=$mpsoc->mpsoc_get_soc_tiles_num($p);
|
146 |
|
|
my @diff=get_diff_array(\@taken_tiles,$inserted);
|
147 |
|
|
$mpsoc->mpsoc_add_soc_tiles_num($p,\@diff) if(scalar @diff );
|
148 |
|
|
$mpsoc->mpsoc_add_soc_tiles_num($p,undef) if(scalar @diff ==0 );
|
149 |
|
|
}
|
150 |
|
|
}
|
151 |
|
|
$mpsoc->mpsoc_add_soc_tiles_num($name,$inserted) if(defined $inserted );
|
152 |
48 |
alirezamon |
#set_gui_status($mpsoc,"ref",1);
|
153 |
|
|
$wind->destroy();
|
154 |
|
|
get_soc_parameter_setting($mpsoc,$name, $inserted)if(defined $inserted );
|
155 |
43 |
alirezamon |
|
156 |
|
|
});
|
157 |
|
|
|
158 |
|
|
$b2->signal_connect( "clicked"=> sub{#Remove Current
|
159 |
|
|
my @new= get_diff_array($inserted,$conflicts);
|
160 |
|
|
$mpsoc->mpsoc_add_soc_tiles_num($name,\@new) if(scalar @new );
|
161 |
|
|
$mpsoc->mpsoc_add_soc_tiles_num($name,undef) if(scalar @new ==0 );
|
162 |
48 |
alirezamon |
#set_gui_status($mpsoc,"ref",1);
|
163 |
|
|
$wind->destroy();
|
164 |
|
|
get_soc_parameter_setting($mpsoc,$name, \@new) if(scalar @new );
|
165 |
43 |
alirezamon |
|
166 |
|
|
});
|
167 |
|
|
|
168 |
|
|
$b3->signal_connect( "clicked"=> sub{
|
169 |
|
|
$wind->destroy();
|
170 |
|
|
|
171 |
48 |
alirezamon |
});
|
172 |
43 |
alirezamon |
}
|
173 |
16 |
alirezamon |
|
174 |
|
|
|
175 |
|
|
#############
|
176 |
43 |
alirezamon |
# check_inserted_ip_nums
|
177 |
16 |
alirezamon |
##########
|
178 |
|
|
sub check_inserted_ip_nums{
|
179 |
43 |
alirezamon |
my ($mpsoc,$name,$str)=@_;
|
180 |
|
|
my @all_num=();
|
181 |
|
|
$str= remove_all_white_spaces ($str);
|
182 |
|
|
|
183 |
|
|
if($str !~ /^[0-9.:,]+$/){ message_dialog ("The Ip numbers contains invalid character" ); return; }
|
184 |
48 |
alirezamon |
my @chunks=split(/\s*,\s*/,$str);
|
185 |
43 |
alirezamon |
foreach my $p (@chunks){
|
186 |
|
|
my @range=split(':',$p);
|
187 |
|
|
my $size= scalar @range;
|
188 |
|
|
if($size==1){ # its a number
|
189 |
48 |
alirezamon |
if ( grep( /^$range[0]$/, @all_num ) ) { message_dialog ("Multiple definition for IP number $range[0]" ); return; }
|
190 |
43 |
alirezamon |
push(@all_num,$range[0]);
|
191 |
|
|
}elsif($size ==2){# its a range
|
192 |
|
|
my($min,$max)=@range;
|
193 |
48 |
alirezamon |
if($min>$max) {message_dialog ("invalid range: [$p]",'error' ); return;}
|
194 |
43 |
alirezamon |
for (my $i=$min; $i<=$max; $i++){
|
195 |
48 |
alirezamon |
if ( grep( /^$i$/, @all_num ) ) { message_dialog ("Multiple definition for IP number $i in $p" ); return; }
|
196 |
43 |
alirezamon |
push(@all_num,$i);
|
197 |
|
|
|
198 |
|
|
}
|
199 |
|
|
|
200 |
|
|
}else{message_dialog ("invalid range: [$p]" ); return; }
|
201 |
|
|
|
202 |
|
|
}
|
203 |
|
|
#check if range does not exceed the tile numbers
|
204 |
48 |
alirezamon |
my ($NE, $NR, $RAw, $EAw, $Fw)=get_topology_info($mpsoc);
|
205 |
|
|
my $max_tile_num=$NE;
|
206 |
43 |
alirezamon |
|
207 |
|
|
my @f=sort { $a <=> $b } @all_num;
|
208 |
|
|
my @l;
|
209 |
|
|
foreach my $num (@f){
|
210 |
|
|
push(@l,$num) if($num<$max_tile_num);
|
211 |
|
|
|
212 |
|
|
}
|
213 |
|
|
@all_num=@l;
|
214 |
|
|
|
215 |
|
|
#check if any ip number exists in the rest
|
216 |
|
|
my $conflicts_msg;
|
217 |
|
|
my @conflicts;
|
218 |
|
|
|
219 |
|
|
|
220 |
|
|
my @socs=$mpsoc->mpsoc_get_soc_list();
|
221 |
|
|
foreach my $p (@socs){
|
222 |
|
|
if($p ne $name){
|
223 |
|
|
my @taken_tiles=$mpsoc->mpsoc_get_soc_tiles_num($p);
|
224 |
|
|
my @c=get_common_array(\@all_num,\@taken_tiles);
|
225 |
|
|
if (scalar @c) {
|
226 |
|
|
my $str=join(',', @c);
|
227 |
|
|
$conflicts_msg = (defined $conflicts_msg)? "$conflicts_msg\n\t\t $str->$p" : "$str->$p";
|
228 |
|
|
@conflicts= (defined $conflicts_msg)? (@conflicts,@c): @c;
|
229 |
|
|
}
|
230 |
|
|
}#if
|
231 |
|
|
}
|
232 |
|
|
if (defined $conflicts_msg) {
|
233 |
48 |
alirezamon |
get_conflict_decision($mpsoc,$name,\@all_num,\@conflicts,$conflicts_msg);
|
234 |
|
|
|
235 |
43 |
alirezamon |
|
236 |
|
|
}else {
|
237 |
|
|
#save the entered ips
|
238 |
48 |
alirezamon |
if( scalar @all_num>0){
|
239 |
|
|
$mpsoc->mpsoc_add_soc_tiles_num($name,\@all_num);
|
240 |
|
|
return \@all_num;
|
241 |
|
|
}
|
242 |
|
|
else {
|
243 |
|
|
$mpsoc->mpsoc_add_soc_tiles_num($name,undef);
|
244 |
|
|
return undef;
|
245 |
|
|
}
|
246 |
|
|
#set_gui_status($mpsoc,"ref",1);
|
247 |
43 |
alirezamon |
}
|
248 |
48 |
alirezamon |
return undef;
|
249 |
16 |
alirezamon |
}
|
250 |
|
|
|
251 |
|
|
|
252 |
|
|
#################
|
253 |
|
|
# get_soc_parameter_setting
|
254 |
|
|
################
|
255 |
|
|
|
256 |
48 |
alirezamon |
|
257 |
|
|
|
258 |
|
|
|
259 |
16 |
alirezamon |
sub get_soc_parameter_setting{
|
260 |
48 |
alirezamon |
my ($mpsoc,$soc_name,$tiles_ref)=@_;
|
261 |
|
|
my @tiles = @{$tiles_ref} if defined ($tiles_ref);
|
262 |
|
|
my $string = join (',',@tiles );
|
263 |
|
|
my $window = def_popwin_size(40,40,"Parameter setting for $soc_name mapped to tile( $string ) ",'percent');
|
264 |
|
|
my $table = get_soc_parameter_setting_table($mpsoc,$soc_name,$window,$tiles_ref);
|
265 |
|
|
$window->add($table);
|
266 |
|
|
$window->show_all;
|
267 |
|
|
}
|
268 |
|
|
|
269 |
|
|
|
270 |
|
|
sub get_soc_parameter_setting_table{
|
271 |
|
|
my ($mpsoc,$soc_name,$window,$tiles_ref)=@_;
|
272 |
|
|
my @tiles;
|
273 |
|
|
@tiles = @{$tiles_ref} if defined ($tiles_ref);
|
274 |
|
|
# my $window = def_popwin_size(40,40,"Parameter setting for $soc_name mapped to tile(@tiles) ",'percent');
|
275 |
|
|
my $table = def_table(10, 7, FALSE);
|
276 |
43 |
alirezamon |
|
277 |
48 |
alirezamon |
my $scrolled_win = add_widget_to_scrolled_win($table);
|
278 |
43 |
alirezamon |
my $row=0;
|
279 |
48 |
alirezamon |
my $column=0;
|
280 |
43 |
alirezamon |
my $top=$mpsoc->mpsoc_get_soc($soc_name);
|
281 |
|
|
|
282 |
|
|
#read soc parameters
|
283 |
48 |
alirezamon |
my %param_value=(scalar @tiles ==1 ) ? $top->top_get_custom_soc_param($tiles[0]) : $top->top_get_default_soc_param();
|
284 |
|
|
$mpsoc->object_add_attribute('current_tile_param',undef,\%param_value);
|
285 |
|
|
|
286 |
43 |
alirezamon |
my @insts=$top->top_get_all_instances();
|
287 |
|
|
my @exceptions=get_NI_instance_list($top);
|
288 |
|
|
@insts=get_diff_array(\@insts,\@exceptions);
|
289 |
|
|
foreach my $inst (@insts){
|
290 |
|
|
my @params=$top->top_get_parameter_list($inst);
|
291 |
|
|
foreach my $p (@params){
|
292 |
|
|
my ($default,$type,$content,$info,$global_param,$redefine)=$top->top_get_parameter($inst,$p);
|
293 |
48 |
alirezamon |
my $show = ($type ne "Fixed");
|
294 |
|
|
$default= $param_value{$p} if(defined $param_value{$p});
|
295 |
|
|
($row,$column)=add_param_widget($mpsoc,$p,$p, $default,$type,$content,$info, $table,$row,$column,$show,'current_tile_param',undef,undef,'vertical');
|
296 |
|
|
}
|
297 |
|
|
|
298 |
43 |
alirezamon |
|
299 |
48 |
alirezamon |
# if ($type eq "Entry"){
|
300 |
|
|
# my $entry=gen_entry($param_value{$p});
|
301 |
|
|
# $table->attach_defaults ($entry, 3, 6, $row, $row+1);
|
302 |
|
|
# $entry-> signal_connect("changed" => sub{$param_value{$p}=$entry->get_text();});
|
303 |
|
|
# }
|
304 |
|
|
# elsif ($type eq "Combo-box"){
|
305 |
|
|
# my @combo_list=split(/\s*,\s*/,$content);
|
306 |
|
|
# my $pos=get_item_pos($param_value{$p}, @combo_list) if(defined $param_value{$p});
|
307 |
|
|
# my $combo=gen_combo(\@combo_list, $pos);
|
308 |
|
|
# $table->attach_defaults ($combo, 3, 6, $row, $row+1);
|
309 |
|
|
# $combo-> signal_connect("changed" => sub{$param_value{$p}=$combo->get_active_text();});
|
310 |
|
|
#
|
311 |
|
|
# }
|
312 |
|
|
# elsif ($type eq "Spin-button"){
|
313 |
|
|
# my ($min,$max,$step)=split(/\s*,\s*/,$content);
|
314 |
|
|
# $param_value{$p}=~ s/\D//g;
|
315 |
|
|
# $min=~ s/\D//g;
|
316 |
|
|
# $max=~ s/\D//g;
|
317 |
|
|
# $step=~ s/\D//g;
|
318 |
|
|
# my $spin=gen_spin($min,$max,$step);
|
319 |
|
|
# $spin->set_value($param_value{$p});
|
320 |
|
|
# $table->attach_defaults ($spin, 3, 4, $row, $row+1);
|
321 |
|
|
# $spin-> signal_connect("value_changed" => sub{$param_value{$p}=$spin->get_value_as_int();});
|
322 |
|
|
#
|
323 |
|
|
# # $box=def_label_spin_help_box ($param,$info, $value,$min,$max,$step, 2);
|
324 |
|
|
# }
|
325 |
|
|
# my $label =gen_label_in_center($p);
|
326 |
|
|
# $table->attach_defaults ($label, 0, 3, $row, $row+1);
|
327 |
|
|
# if (defined $info){
|
328 |
|
|
# my $info_button=def_image_button('icons/help.png');
|
329 |
|
|
# $table->attach_defaults ($info_button, 6, 7, $row, $row+1);
|
330 |
|
|
# $info_button->signal_connect('clicked'=>sub{
|
331 |
|
|
# message_dialog($info);
|
332 |
|
|
#
|
333 |
|
|
# });
|
334 |
|
|
#
|
335 |
|
|
# }
|
336 |
|
|
# $row++;
|
337 |
|
|
#
|
338 |
|
|
#
|
339 |
|
|
# }
|
340 |
43 |
alirezamon |
}
|
341 |
|
|
|
342 |
|
|
my $ok = def_image_button('icons/select.png','OK');
|
343 |
|
|
my $okbox=def_hbox(TRUE,0);
|
344 |
|
|
$okbox->pack_start($ok, FALSE, FALSE,0);
|
345 |
|
|
|
346 |
|
|
|
347 |
|
|
my $mtable = def_table(10, 1, TRUE);
|
348 |
16 |
alirezamon |
|
349 |
43 |
alirezamon |
$mtable->attach_defaults($scrolled_win,0,1,0,9);
|
350 |
|
|
$mtable->attach_defaults($okbox,0,1,9,10);
|
351 |
|
|
|
352 |
48 |
alirezamon |
|
353 |
43 |
alirezamon |
|
354 |
|
|
$ok-> signal_connect("clicked" => sub{
|
355 |
48 |
alirezamon |
$window->destroy if(defined $window);
|
356 |
43 |
alirezamon |
#save new values
|
357 |
48 |
alirezamon |
my $ref=$mpsoc->object_get_attribute('current_tile_param');
|
358 |
|
|
%param_value=%{$ref};
|
359 |
|
|
|
360 |
|
|
# if(!defined $tile ) {
|
361 |
|
|
# $top->top_add_default_soc_param(\%param_value);
|
362 |
|
|
# $mpsoc->object_add_attribute('soc_param',"default",\%param_value);
|
363 |
|
|
# }
|
364 |
|
|
# else {
|
365 |
|
|
foreach my $tile (@tiles){
|
366 |
46 |
alirezamon |
$top->top_add_custom_soc_param(\%param_value,$tile);
|
367 |
48 |
alirezamon |
$mpsoc->object_add_attribute('soc_param',"custom_${soc_name}",\%param_value);
|
368 |
43 |
alirezamon |
}
|
369 |
48 |
alirezamon |
$mpsoc->object_add_attribute('current_tile_param',undef,undef);
|
370 |
|
|
set_gui_status($mpsoc,"refresh_soc",1);
|
371 |
|
|
|
372 |
43 |
alirezamon |
|
373 |
48 |
alirezamon |
});
|
374 |
|
|
$mtable->show_all();
|
375 |
|
|
return $mtable;
|
376 |
16 |
alirezamon |
}
|
377 |
|
|
|
378 |
|
|
################
|
379 |
43 |
alirezamon |
# tile_set_widget
|
380 |
16 |
alirezamon |
################
|
381 |
|
|
|
382 |
|
|
sub tile_set_widget{
|
383 |
43 |
alirezamon |
my ($mpsoc,$soc_name,$num,$table,$show,$row)=@_;
|
384 |
48 |
alirezamon |
#my $label=gen_label_in_left($soc);
|
385 |
43 |
alirezamon |
my @all_num= $mpsoc->mpsoc_get_soc_tiles_num($soc_name);
|
386 |
|
|
my $init=compress_nums(@all_num);
|
387 |
|
|
my $entry;
|
388 |
|
|
if (defined $init){$entry=gen_entry($init) ;}
|
389 |
|
|
else {$entry=gen_entry();}
|
390 |
|
|
my $set= def_image_button('icons/right.png');
|
391 |
|
|
my $remove= def_image_button('icons/cancel.png');
|
392 |
|
|
#my $setting= def_image_button('icons/setting.png','setting');
|
393 |
48 |
alirezamon |
|
394 |
|
|
|
395 |
|
|
my $button = def_colored_button($soc_name,$num);
|
396 |
43 |
alirezamon |
$button->signal_connect("clicked"=> sub{
|
397 |
48 |
alirezamon |
# get_soc_parameter_setting($mpsoc,$soc_name,undef);
|
398 |
|
|
});
|
399 |
43 |
alirezamon |
|
400 |
|
|
$set->signal_connect("clicked"=> sub{
|
401 |
|
|
my $data=$entry->get_text();
|
402 |
48 |
alirezamon |
my $r=check_inserted_ip_nums($mpsoc,$soc_name,$data);
|
403 |
|
|
if(defined $r){
|
404 |
|
|
my @all_num = @{$r};
|
405 |
|
|
get_soc_parameter_setting($mpsoc,$soc_name,\@all_num);
|
406 |
|
|
}
|
407 |
43 |
alirezamon |
});
|
408 |
48 |
alirezamon |
|
409 |
43 |
alirezamon |
$remove->signal_connect("clicked"=> sub{
|
410 |
|
|
$mpsoc->mpsoc_remove_soc($soc_name);
|
411 |
|
|
set_gui_status($mpsoc,"ref",1);
|
412 |
|
|
});
|
413 |
16 |
alirezamon |
|
414 |
43 |
alirezamon |
|
415 |
16 |
alirezamon |
if($show){
|
416 |
43 |
alirezamon |
$table->attach ( $button, 0, 1, $row,$row+1,'fill','fill',2,2);
|
417 |
|
|
$table->attach ( $remove, 1, 2, $row,$row+1,'fill','shrink',2,2);
|
418 |
|
|
$table->attach ( $entry , 2, 3, $row,$row+1,'fill','shrink',2,2);
|
419 |
|
|
$table->attach ( $set, 3, 4, $row,$row+1,'fill','shrink',2,2);
|
420 |
|
|
|
421 |
16 |
alirezamon |
|
422 |
43 |
alirezamon |
|
423 |
|
|
$row++;
|
424 |
|
|
}
|
425 |
|
|
|
426 |
|
|
return $row;
|
427 |
|
|
|
428 |
|
|
|
429 |
|
|
}
|
430 |
16 |
alirezamon |
|
431 |
|
|
|
432 |
|
|
|
433 |
|
|
|
434 |
|
|
##################
|
435 |
43 |
alirezamon |
# defualt_tilles_setting
|
436 |
16 |
alirezamon |
###################
|
437 |
|
|
|
438 |
|
|
sub defualt_tilles_setting {
|
439 |
43 |
alirezamon |
my ($mpsoc,$table,$show,$row,$info)=@_;
|
440 |
|
|
|
441 |
|
|
#title
|
442 |
48 |
alirezamon |
my $separator1 = gen_Hsep();
|
443 |
|
|
my $separator2 = gen_Hsep();
|
444 |
43 |
alirezamon |
my $title2=gen_label_in_center("Tile Configuration");
|
445 |
|
|
my $box1=def_vbox(FALSE, 1);
|
446 |
|
|
$box1->pack_start( $separator1, FALSE, FALSE, 3);
|
447 |
|
|
$box1->pack_start( $title2, FALSE, FALSE, 3);
|
448 |
|
|
$box1->pack_start( $separator2, FALSE, FALSE, 3);
|
449 |
|
|
if($show){$table->attach_defaults ($box1 ,0,4, $row,$row+1);$row++;}
|
450 |
48 |
alirezamon |
|
451 |
43 |
alirezamon |
|
452 |
|
|
my $label = gen_label_in_left("Tiles path:");
|
453 |
48 |
alirezamon |
my $entry = gen_entry();
|
454 |
43 |
alirezamon |
my $browse= def_image_button("icons/browse.png");
|
455 |
|
|
my $file= $mpsoc->object_get_attribute('setting','soc_path');
|
456 |
|
|
if(defined $file){$entry->set_text($file);}
|
457 |
|
|
|
458 |
|
|
|
459 |
48 |
alirezamon |
$browse->signal_connect("clicked"=> sub{
|
460 |
|
|
my $entry_ref=$_[1];
|
461 |
|
|
my $file;
|
462 |
|
|
my $dialog = gen_folder_dialog('Select tile directory');
|
463 |
|
|
if ( "ok" eq $dialog->run ) {
|
464 |
|
|
$file = $dialog->get_filename;
|
465 |
43 |
alirezamon |
$$entry_ref->set_text($file);
|
466 |
|
|
$mpsoc->object_add_attribute('setting','soc_path',$file);
|
467 |
|
|
$mpsoc->mpsoc_remove_all_soc();
|
468 |
|
|
set_gui_status($mpsoc,"ref",1);
|
469 |
|
|
#check_input_file($file,$socgen,$info);
|
470 |
|
|
#print "file = $file\n";
|
471 |
48 |
alirezamon |
}
|
472 |
|
|
$dialog->destroy;
|
473 |
16 |
alirezamon |
|
474 |
43 |
alirezamon |
} , \$entry);
|
475 |
48 |
alirezamon |
|
476 |
43 |
alirezamon |
|
477 |
|
|
$entry->signal_connect("activate"=>sub{
|
478 |
|
|
my $file_name=$entry->get_text();
|
479 |
|
|
$mpsoc->object_add_attribute('setting','soc_path',$file_name);
|
480 |
|
|
$mpsoc->mpsoc_remove_all_soc();
|
481 |
|
|
set_gui_status($mpsoc,"ref",1);
|
482 |
|
|
#check_input_file($file_name,$socgen,$info);
|
483 |
|
|
});
|
484 |
|
|
|
485 |
|
|
|
486 |
|
|
|
487 |
|
|
if($show){
|
488 |
|
|
my $tmp=gen_label_in_left(" ");
|
489 |
|
|
$table->attach ($label, 0, 1 , $row,$row+1,'fill','shrink',2,2);
|
490 |
|
|
$table->attach ($tmp, 1, 2 , $row,$row+1,'fill','shrink',2,2);
|
491 |
|
|
$table->attach ($entry, 2, 3 , $row,$row+1,'fill','shrink',2,2);
|
492 |
|
|
$table->attach ($browse, 3, 4, $row,$row+1,'fill','shrink',2,2);
|
493 |
|
|
$row++;
|
494 |
|
|
}
|
495 |
|
|
|
496 |
|
|
|
497 |
|
|
|
498 |
|
|
my @socs=$mpsoc->mpsoc_get_soc_list();
|
499 |
|
|
if( scalar @socs == 0){
|
500 |
|
|
@socs=get_soc_list($mpsoc,$info);
|
501 |
|
|
|
502 |
|
|
}
|
503 |
|
|
@socs=$mpsoc->mpsoc_get_soc_list();
|
504 |
46 |
alirezamon |
|
505 |
43 |
alirezamon |
|
506 |
|
|
|
507 |
|
|
my $lab1=gen_label_in_center(' Tile name');
|
508 |
|
|
|
509 |
|
|
my $lab2=gen_label_help('Define the tile numbers that each IP is mapped to.
|
510 |
16 |
alirezamon |
you can add individual numbers or ranges as follow
|
511 |
48 |
alirezamon |
e.g. individual numbers: 5,6,7,8,9,10
|
512 |
|
|
e.g. range: 5:10
|
513 |
43 |
alirezamon |
', ' Tile numbers ');
|
514 |
|
|
if($show){
|
515 |
|
|
$table->attach_defaults ($lab1 ,0,1, $row,$row+1);
|
516 |
|
|
$table->attach_defaults ($lab2 ,2,3, $row,$row+1);$row++;
|
517 |
|
|
}
|
518 |
|
|
|
519 |
|
|
my $soc_num=0;
|
520 |
|
|
foreach my $soc_name (@socs){
|
521 |
|
|
$row=tile_set_widget ($mpsoc,$soc_name,$soc_num,$table,$show,$row);
|
522 |
|
|
$soc_num++;
|
523 |
|
|
|
524 |
|
|
}
|
525 |
|
|
return $row;
|
526 |
|
|
|
527 |
16 |
alirezamon |
}
|
528 |
|
|
|
529 |
|
|
|
530 |
|
|
|
531 |
|
|
|
532 |
|
|
#######################
|
533 |
|
|
# noc_config
|
534 |
|
|
######################
|
535 |
|
|
|
536 |
48 |
alirezamon |
|
537 |
|
|
sub noc_topology_setting_gui {
|
538 |
|
|
my ($mpsoc,$table,$txview,$row,$show_noc)=@_;
|
539 |
|
|
my $coltmp=0;
|
540 |
|
|
# topology
|
541 |
|
|
my $label='Topology';
|
542 |
|
|
my $param='TOPOLOGY';
|
543 |
|
|
my $default='"MESH"';
|
544 |
|
|
my $content='"MESH","FMESH","TORUS","RING","LINE","FATTREE","TREE","STAR","CUSTOM"';
|
545 |
|
|
my $type='Combo-box';
|
546 |
|
|
my $info="NoC topology";
|
547 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$show_noc,'noc_param',1);
|
548 |
|
|
|
549 |
|
|
my $topology=$mpsoc->object_get_attribute('noc_param','TOPOLOGY');
|
550 |
|
|
|
551 |
|
|
if($topology ne '"CUSTOM"' ){
|
552 |
|
|
#topology T1 parameter
|
553 |
|
|
$label=
|
554 |
|
|
($topology eq '"FATTREE"' || $topology eq '"TREE"')? 'K' :
|
555 |
|
|
($topology eq '"STAR"')? "Total Endpoint number" : 'Routers per row';
|
556 |
|
|
$param= 'T1';
|
557 |
|
|
$default= '2';
|
558 |
|
|
$content=
|
559 |
|
|
($topology eq '"MESH"' || $topology eq '"TORUS"') ? '2,16,1':
|
560 |
|
|
($topology eq '"FMESH"')? '1,16,1':
|
561 |
|
|
($topology eq '"FATTREE"' || $topology eq '"TREE"' )? '2,6,1':'2,64,1';
|
562 |
|
|
$info= ($topology eq '"FATTREE"' || $topology eq '"TREE"' )? 'number of last level individual router`s endpoints.' :'Number of NoC routers in row (X dimension)';
|
563 |
|
|
$type= 'Spin-button';
|
564 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$show_noc,'noc_param',1);
|
565 |
|
|
|
566 |
43 |
alirezamon |
|
567 |
48 |
alirezamon |
#Topology T2 parameter
|
568 |
|
|
if($topology eq '"MESH"' || $topology eq '"FMESH"' || $topology eq '"TORUS"' || $topology eq '"FATTREE"' || $topology eq '"TREE"' ) {
|
569 |
|
|
$label= ($topology eq '"FATTREE"' || $topology eq '"TREE"')? 'L' :'Routers per column';
|
570 |
|
|
$param= 'T2';
|
571 |
|
|
$default='2';
|
572 |
|
|
$content= ($topology eq '"FMESH"')? '1,16,1': '2,16,1';
|
573 |
|
|
$info= ($topology eq '"FATTREE"' || $topology eq '"TREE"')? 'Fattree layer number (The height of FT)':'Number of NoC routers in column (Y dimension)';
|
574 |
|
|
$type= 'Spin-button';
|
575 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$show_noc,'noc_param',1);
|
576 |
|
|
} else {
|
577 |
|
|
$mpsoc->object_add_attribute('noc_param','T2',1);
|
578 |
|
|
}
|
579 |
|
|
|
580 |
|
|
#Topology T3 parameter
|
581 |
|
|
if($topology eq '"MESH"' || $topology eq '"FMESH"' || $topology eq '"TORUS"' || $topology eq '"RING"' || $topology eq '"LINE"') {
|
582 |
|
|
$label="Router's endpoint number";
|
583 |
|
|
$param= 'T3';
|
584 |
|
|
$default='1';
|
585 |
|
|
$content='1,4,1';
|
586 |
|
|
$info= "In $topology topology, each router can have up to 4 endpoint processing tile.";
|
587 |
|
|
$type= 'Spin-button';
|
588 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$show_noc,'noc_param',1);
|
589 |
|
|
}
|
590 |
|
|
|
591 |
|
|
|
592 |
|
|
|
593 |
|
|
|
594 |
|
|
}else{#its a custom Topology
|
595 |
|
|
($row,$coltmp)=config_custom_topology_gui($mpsoc,$table,$txview,$row);
|
596 |
|
|
}
|
597 |
|
|
return ($row,$coltmp);
|
598 |
16 |
alirezamon |
|
599 |
48 |
alirezamon |
}
|
600 |
|
|
|
601 |
|
|
|
602 |
|
|
|
603 |
|
|
sub noc_config{
|
604 |
|
|
my ($mpsoc,$table,$txview)=@_;
|
605 |
43 |
alirezamon |
|
606 |
|
|
#title
|
607 |
|
|
my $row=0;
|
608 |
|
|
my $title=gen_label_in_center("NoC Configuration");
|
609 |
|
|
$table->attach ($title , 0, 4, $row, $row+1,'expand','shrink',2,2); $row++;
|
610 |
48 |
alirezamon |
add_Hsep_to_table ($table,0,4,$row); $row++;
|
611 |
|
|
|
612 |
43 |
alirezamon |
my $label;
|
613 |
|
|
my $param;
|
614 |
|
|
my $default;
|
615 |
|
|
my $type;
|
616 |
|
|
my $content;
|
617 |
|
|
my $info;
|
618 |
|
|
|
619 |
|
|
|
620 |
|
|
#parameter start
|
621 |
|
|
my $b1;
|
622 |
|
|
my $show_noc=$mpsoc->object_get_attribute('setting','show_noc_setting');
|
623 |
|
|
if(!defined $show_noc){
|
624 |
|
|
$show_noc=1;
|
625 |
|
|
$mpsoc->object_add_attribute('setting','show_noc_setting',$show_noc);
|
626 |
|
|
|
627 |
|
|
}
|
628 |
|
|
if($show_noc == 0){
|
629 |
|
|
$b1= def_image_button("icons/down.png","NoC Parameters");
|
630 |
|
|
$label=gen_label_in_center(' ');
|
631 |
|
|
$table->attach ( $label , 2, 3, $row,$row+1 ,'fill','shrink',2,2);
|
632 |
|
|
$table->attach ( $b1 , 0, 2, $row,$row+1,'fill','shrink',2,2);
|
633 |
|
|
$row++;
|
634 |
|
|
}
|
635 |
|
|
|
636 |
|
|
my $coltmp=0;
|
637 |
|
|
|
638 |
|
|
#Router type
|
639 |
|
|
$label='Router Type';
|
640 |
|
|
$param='ROUTER_TYPE';
|
641 |
|
|
$default='"VC_BASED"';
|
642 |
|
|
$content='"INPUT_QUEUED","VC_BASED"';
|
643 |
|
|
$type='Combo-box';
|
644 |
22 |
alirezamon |
$info=" Input-queued: simple router with low performance and does not support fully adaptive routing.
|
645 |
|
|
VC-based routers offer higher performance, fully adaptive routing and traffic isolation for different packet classes.";
|
646 |
43 |
alirezamon |
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$show_noc,'noc_type',1);
|
647 |
|
|
my $router_type=$mpsoc->object_get_attribute('noc_type',"ROUTER_TYPE");
|
648 |
|
|
|
649 |
|
|
|
650 |
48 |
alirezamon |
($row,$coltmp) =noc_topology_setting_gui($mpsoc,$table,$txview,$row,$show_noc);
|
651 |
|
|
my $topology=$mpsoc->object_get_attribute('noc_param','TOPOLOGY');
|
652 |
|
|
|
653 |
43 |
alirezamon |
#VC number per port
|
654 |
|
|
if($router_type eq '"VC_BASED"'){
|
655 |
|
|
my $v=$mpsoc->object_get_attribute('noc_param','V');
|
656 |
|
|
if(defined $v){ $mpsoc->object_add_attribute('noc_param','V',2) if($v eq 1);}
|
657 |
|
|
$label='VC number per port';
|
658 |
|
|
$param='V';
|
659 |
|
|
$default='2';
|
660 |
|
|
$type='Spin-button';
|
661 |
|
|
$content='2,16,1';
|
662 |
48 |
alirezamon |
$info='Number of Virtual chanel per each router port';
|
663 |
43 |
alirezamon |
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$show_noc,'noc_param',1);
|
664 |
|
|
} else {
|
665 |
|
|
$mpsoc->object_add_attribute('noc_param','V',1);
|
666 |
|
|
$mpsoc->object_add_attribute('noc_param','C',0);
|
667 |
|
|
}
|
668 |
|
|
|
669 |
|
|
#buffer width per VC
|
670 |
|
|
$label=($router_type eq '"VC_BASED"')? 'Buffer flits per VC': "Buffer flits";
|
671 |
|
|
$param='B';
|
672 |
16 |
alirezamon |
$default='4';
|
673 |
|
|
$content='2,256,1';
|
674 |
|
|
$type='Spin-button';
|
675 |
43 |
alirezamon |
$info=($router_type eq '"VC_BASED"')? 'Buffer queue size per VC in flits' : 'Buffer queue size in flits';
|
676 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$show_noc,'noc_param',undef);
|
677 |
|
|
|
678 |
48 |
alirezamon |
|
679 |
|
|
#Local port buffer width per VC
|
680 |
|
|
$label=($router_type eq '"VC_BASED"')? 'Local port Buffer flits per VC': "Local Port Buffer flits";
|
681 |
|
|
$param='LB';
|
682 |
|
|
$default='4';
|
683 |
|
|
$content='2,256,1';
|
684 |
|
|
$type='Spin-button';
|
685 |
|
|
$info = "The Local router ports buffer width (LB) is the width of the ports connected to the endpoints and can take different buffer sizes than other routers ports buffer width (B) connected to neighboring routers .It is valid only for MESH,FMESH, TORUS,LINE and RING topologies. In FMESH topology, this parameter does not affect the width of extra endpoints connected to edge routers.";
|
686 |
|
|
|
687 |
|
|
if ($topology eq '"MESH"' || $topology eq '"FMESH"' || $topology eq '"TORUS"' || $topology eq '"RING"' || $topology eq '"LINE"'){
|
688 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$show_noc,'noc_param',undef);
|
689 |
|
|
}else{
|
690 |
|
|
$mpsoc->object_add_attribute('noc_param','LB','B');
|
691 |
|
|
}
|
692 |
|
|
|
693 |
|
|
|
694 |
|
|
|
695 |
|
|
|
696 |
43 |
alirezamon |
#packet payload width
|
697 |
|
|
$label='Payload width';
|
698 |
|
|
$param='Fpay';
|
699 |
|
|
$default='32';
|
700 |
|
|
$content='32,256,32';
|
701 |
|
|
$type='Spin-button';
|
702 |
16 |
alirezamon |
$info="The packet payload width in bits";
|
703 |
43 |
alirezamon |
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info,$table,$row,undef,$show_noc,'noc_param',undef);
|
704 |
16 |
alirezamon |
|
705 |
48 |
alirezamon |
if($topology ne '"CUSTOM"' ){
|
706 |
43 |
alirezamon |
#routing algorithm
|
707 |
|
|
$label='Routing Algorithm';
|
708 |
|
|
$param="ROUTE_NAME";
|
709 |
|
|
$type="Combo-box";
|
710 |
|
|
if($router_type eq '"VC_BASED"'){
|
711 |
48 |
alirezamon |
$content=($topology eq '"MESH"' || $topology eq '"FMESH"')? '"XY","WEST_FIRST","NORTH_LAST","NEGETIVE_FIRST","ODD_EVEN","DUATO"' :
|
712 |
43 |
alirezamon |
($topology eq '"TORUS"')? '"TRANC_XY","TRANC_WEST_FIRST","TRANC_NORTH_LAST","TRANC_NEGETIVE_FIRST","TRANC_DUATO"':
|
713 |
|
|
($topology eq '"RING"')? '"TRANC_XY"' :
|
714 |
|
|
($topology eq '"LINE"')? '"XY"':
|
715 |
|
|
($topology eq '"FATTREE"')? '"NCA_RND_UP","NCA_STRAIGHT_UP","NCA_DST_UP"':
|
716 |
|
|
($topology eq '"TREE"')? '"NCA"' : '"UNKNOWN"';
|
717 |
|
|
}else{
|
718 |
48 |
alirezamon |
$content=($topology eq '"MESH"' || $topology eq '"FMESH"')? '"XY","WEST_FIRST","NORTH_LAST","NEGETIVE_FIRST","ODD_EVEN"' :
|
719 |
43 |
alirezamon |
($topology eq '"TORUS"')? '"TRANC_XY","TRANC_WEST_FIRST","TRANC_NORTH_LAST","TRANC_NEGETIVE_FIRST"':
|
720 |
|
|
($topology eq '"RING"')? '"TRANC_XY"' :
|
721 |
|
|
($topology eq '"LINE"')? '"XY"':
|
722 |
|
|
($topology eq '"FATTREE"')? '"NCA_RND_UP","NCA_STRAIGHT_UP","NCA_DST_UP"' :
|
723 |
|
|
($topology eq '"TREE"')? '"NCA"' : '"UNKNOWN"';
|
724 |
|
|
|
725 |
|
|
}
|
726 |
48 |
alirezamon |
$default=($topology eq '"MESH"' || $topology eq '"FMESH"' || $topology eq '"LINE"' )? '"XY"':
|
727 |
43 |
alirezamon |
($topology eq '"TORUS"'|| $topology eq '"RING"')? '"TRANC_XY"' :
|
728 |
|
|
($topology eq '"FATTREE"')? '"NCA_STRAIGHT_UP"' :
|
729 |
|
|
($topology eq '"TREE"')? '"NCA"' : '"UNKNOWN"';
|
730 |
|
|
|
731 |
|
|
my $info_mesh="Select the routing algorithm: XY(DoR) , partially adaptive (Turn models). Fully adaptive (Duato) ";
|
732 |
48 |
alirezamon |
my $info_fat="Nearest common ancestor (NCA) where the up port is selected randomly (RND), based on destination endpoint address (DST) or it is the top port that is located in front of the port which has received the packet (STRAIGHT) ";
|
733 |
43 |
alirezamon |
|
734 |
|
|
$info=($topology eq '"FATTREE"')? $info_fat :
|
735 |
|
|
($topology eq '"TREE"') ? "Nearest common ancestor": $info_mesh;
|
736 |
48 |
alirezamon |
my $show_routing =($topology eq '"STAR"' )? 0 : $show_noc;
|
737 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$show_routing,'noc_param',1);
|
738 |
16 |
alirezamon |
|
739 |
48 |
alirezamon |
}
|
740 |
16 |
alirezamon |
|
741 |
48 |
alirezamon |
#PCK_TYPE
|
742 |
|
|
$label='Packet type';
|
743 |
|
|
$param='PCK_TYPE';
|
744 |
|
|
$default='"MULTI_FLIT"';
|
745 |
|
|
$content='"MULTI_FLIT","SINGLE_FLIT"';
|
746 |
|
|
$type="Combo-box";
|
747 |
|
|
$info="Define packet type: SINGLE_FLIT: all packets send to NoC are single-flit sized.
|
748 |
|
|
Multi-flit: packets can be consists of one or several flits. A multi-flit packet can be
|
749 |
|
|
a)single-flit sized : both headr and tail flag must be asserted for this flit,
|
750 |
|
|
b)two-flit sized: a header flit and a tail flit, or
|
751 |
|
|
c)more than 2 fits: start with a headr flit, continued with one or more body flits and end up with a tail flit
|
752 |
|
|
For MULTI-FLIT packet you need to defin ethe minum size of a paket that can be injecte to the NoC.
|
753 |
|
|
";
|
754 |
|
|
|
755 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$show_noc,'noc_param',1);
|
756 |
|
|
|
757 |
|
|
my $pck_type=$mpsoc->object_get_attribute('noc_param','PCK_TYPE');
|
758 |
|
|
|
759 |
|
|
if($pck_type eq '"MULTI_FLIT"'){
|
760 |
25 |
alirezamon |
|
761 |
48 |
alirezamon |
#MIN_PCK_SIZE
|
762 |
|
|
# 2 //minimum packet size in flits. The minimum value is 1.
|
763 |
|
|
$label='Minimum packet size';
|
764 |
|
|
$param='MIN_PCK_SIZE';
|
765 |
|
|
$default='2';
|
766 |
|
|
$content='1,65535,1';
|
767 |
|
|
$type='Spin-button';
|
768 |
|
|
$info="The minimum packet size in flits. In atomic VC re-allocation, it is just important to define if the single-flit sized packets are allowed to be injected to the NoC by defining this parameter value as one. Setting any larger value than one results in the same architecture and the NoC works correctly even if it receives smaller packets size as while as they are not single flit -sized packets. However, for non-atomic VC reallocation NoCs, you have to define the exact value as it defines the NoC control registers' internal buffers. The NoC may crash once it receives packets having smaler size than the defined minimum packet size.";
|
769 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$show_noc,'noc_param',undef);
|
770 |
|
|
}else{
|
771 |
|
|
$mpsoc->object_add_attribute('noc_param','MIN_PCK_SIZE',1);
|
772 |
|
|
}
|
773 |
25 |
alirezamon |
|
774 |
48 |
alirezamon |
# BYTE_EN
|
775 |
|
|
$label='Byte Enable';
|
776 |
|
|
$param='BYTE_EN';
|
777 |
|
|
$default= 0;
|
778 |
|
|
$info='0:disable, 1: enable. Add byte enable (BE) filed to header flit which shows the location of last valid byte in tail flit. It is needed once the send data unit is smaller than Fpay.';
|
779 |
|
|
$content='0,1';
|
780 |
|
|
$type="Combo-box";
|
781 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$show_noc,'noc_param');
|
782 |
43 |
alirezamon |
|
783 |
|
|
if($show_noc == 1){
|
784 |
|
|
$b1= def_image_button("icons/up.png","NoC Parameters");
|
785 |
|
|
$table->attach ( $b1 , 0, 2, $row,$row+1,'fill','shrink',2,2);
|
786 |
|
|
$row++;
|
787 |
|
|
}
|
788 |
|
|
$b1->signal_connect("clicked" => sub{
|
789 |
|
|
$show_noc=($show_noc==1)?0:1;
|
790 |
|
|
$mpsoc->object_add_attribute('setting','show_noc_setting',$show_noc);
|
791 |
|
|
set_gui_status($mpsoc,"ref",1);
|
792 |
|
|
});
|
793 |
|
|
|
794 |
|
|
#advance parameter start
|
795 |
|
|
my $advc;
|
796 |
|
|
my $adv_set=$mpsoc->object_get_attribute('setting','show_adv_setting');
|
797 |
|
|
if($adv_set == 0){
|
798 |
|
|
$advc= def_image_button("icons/down.png","Advance Parameters");
|
799 |
|
|
$table->attach ( $advc , 0, 2, $row,$row+1,'fill','shrink',2,2);
|
800 |
|
|
$row++;
|
801 |
|
|
}
|
802 |
|
|
|
803 |
|
|
|
804 |
48 |
alirezamon |
#SSA
|
805 |
|
|
$label='SSA Enable';
|
806 |
|
|
$param='SSA_EN';
|
807 |
|
|
$default='"NO"';
|
808 |
|
|
$content='"YES","NO"';
|
809 |
|
|
$type='Combo-box';
|
810 |
|
|
$info="Enable single cycle latency on packets traversing in the same direction using static straight allocator (SSA)";
|
811 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$adv_set,'noc_param',undef);
|
812 |
|
|
|
813 |
|
|
#SMART
|
814 |
|
|
$label='Max Straight Bypass';
|
815 |
|
|
$param='SMART_MAX';
|
816 |
|
|
$default='0';
|
817 |
|
|
$content="0,1,2,3,4,5,6,7,8,9";
|
818 |
|
|
$type='Combo-box';
|
819 |
|
|
$info="If Max Straight Bypass (SMART_MAX) is defined as n>0 then packets are allowed to bypass Maximum of n routers in Straight direction in single cycle.";
|
820 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$adv_set,'noc_param',undef);
|
821 |
|
|
|
822 |
|
|
|
823 |
|
|
|
824 |
43 |
alirezamon |
#Fully and partially adaptive routing setting
|
825 |
|
|
my $route=$mpsoc->object_get_attribute('noc_param',"ROUTE_NAME");
|
826 |
|
|
$label="Congestion index";
|
827 |
|
|
$param="CONGESTION_INDEX";
|
828 |
|
|
$type="Spin-button";
|
829 |
|
|
$content="0,12,1";
|
830 |
|
|
$info="Congestion index determines how congestion information is collected from neighboring routers. Please refer to the usere manual for more information";
|
831 |
|
|
$default=3;
|
832 |
48 |
alirezamon |
if($topology ne '"CUSTOM"' && $route ne '"XY"' && $route ne '"TRANC_XY"' ){
|
833 |
43 |
alirezamon |
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$adv_set,'noc_param',undef);
|
834 |
|
|
} else {
|
835 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,0,'noc_param',undef);
|
836 |
|
|
}
|
837 |
|
|
|
838 |
|
|
#Fully adaptive routing setting
|
839 |
|
|
my $v=$mpsoc->object_get_attribute('noc_param',"V");
|
840 |
|
|
$label="Select Escap VC";
|
841 |
|
|
$param="ESCAP_VC_MASK";
|
842 |
|
|
$type="Check-box";
|
843 |
|
|
$content=$v;
|
844 |
|
|
$default="$v\'b";
|
845 |
|
|
for (my $i=1; $i<=$v-1; $i++){$default= "${default}0";}
|
846 |
|
|
$default= "${default}1";
|
847 |
|
|
$info="Select the escap VC for fully adaptive routing.";
|
848 |
|
|
if( $route eq '"TRANC_DUATO"' or $route eq '"DUATO"' ){
|
849 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$adv_set, 'noc_param',undef);
|
850 |
|
|
}
|
851 |
|
|
else{
|
852 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,0, 'noc_param',undef);
|
853 |
|
|
}
|
854 |
|
|
|
855 |
|
|
# VC reallocation type
|
856 |
|
|
$label=($router_type eq '"VC_BASED"')? 'VC reallocation type': 'Queue reallocation type';
|
857 |
|
|
$param='VC_REALLOCATION_TYPE';
|
858 |
38 |
alirezamon |
$info="VC reallocation type: If set as atomic only empty VCs can be allocated for new packets. Whereas, in non-atomic a non-empty VC which has received the last packet tail flit can accept a new packet";
|
859 |
|
|
$default='"NONATOMIC"';
|
860 |
|
|
$content='"ATOMIC","NONATOMIC"';
|
861 |
|
|
$type='Combo-box';
|
862 |
43 |
alirezamon |
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$adv_set,'noc_param',undef);
|
863 |
16 |
alirezamon |
|
864 |
|
|
|
865 |
43 |
alirezamon |
#vc/sw allocator type
|
866 |
|
|
$label = 'VC/SW combination type';
|
867 |
|
|
$param='COMBINATION_TYPE';
|
868 |
38 |
alirezamon |
$default='"COMB_NONSPEC"';
|
869 |
|
|
$content='"BASELINE","COMB_SPEC1","COMB_SPEC2","COMB_NONSPEC"';
|
870 |
|
|
$type='Combo-box';
|
871 |
48 |
alirezamon |
$info="The joint VC/ switch allocator type. using canonical combination is not recommended";
|
872 |
43 |
alirezamon |
if ($router_type eq '"VC_BASED"'){
|
873 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$adv_set,'noc_param',undef);
|
874 |
|
|
} else{
|
875 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,0,'noc_param',undef);
|
876 |
|
|
}
|
877 |
38 |
alirezamon |
|
878 |
43 |
alirezamon |
# Crossbar mux type
|
879 |
|
|
$label='Crossbar mux type';
|
880 |
|
|
$param='MUX_TYPE';
|
881 |
|
|
$default='"BINARY"';
|
882 |
|
|
$content='"ONE_HOT","BINARY"';
|
883 |
|
|
$type='Combo-box';
|
884 |
|
|
$info="Crossbar multiplexer type";
|
885 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$adv_set,'noc_param',undef);
|
886 |
|
|
|
887 |
38 |
alirezamon |
#class
|
888 |
43 |
alirezamon |
if($router_type eq '"VC_BASED"'){
|
889 |
|
|
$label='class number';
|
890 |
|
|
$param='C';
|
891 |
|
|
$default= 0;
|
892 |
|
|
$info='Number of message classes. Each specific class can use different set of VC';
|
893 |
|
|
$content='0,16,1';
|
894 |
|
|
$type='Spin-button';
|
895 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$adv_set,'noc_param',5);
|
896 |
|
|
|
897 |
16 |
alirezamon |
|
898 |
43 |
alirezamon |
my $class=$mpsoc->object_get_attribute('noc_param',"C");
|
899 |
|
|
my $v=$mpsoc->object_get_attribute('noc_param',"V");
|
900 |
|
|
$default= "$v\'b";
|
901 |
|
|
for (my $i=1; $i<=$v; $i++){
|
902 |
|
|
$default= "${default}1";
|
903 |
|
|
}
|
904 |
|
|
#print "\$default=$default\n";
|
905 |
|
|
for (my $i=0; $i<=$class-1; $i++){
|
906 |
|
|
|
907 |
|
|
$label="Class $i Permitted VCs";
|
908 |
|
|
$param="Cn_$i";
|
909 |
|
|
$type="Check-box";
|
910 |
|
|
$content=$v;
|
911 |
|
|
$info="Select the permitted VCs which the message class $i can be sent via them.";
|
912 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$adv_set,'class_param',undef);
|
913 |
|
|
}
|
914 |
|
|
|
915 |
|
|
}#($router_type eq '"VC_BASED"')
|
916 |
|
|
|
917 |
|
|
|
918 |
16 |
alirezamon |
|
919 |
43 |
alirezamon |
#simulation debuge enable
|
920 |
|
|
$label='Debug enable';
|
921 |
|
|
$param='DEBUG_EN';
|
922 |
48 |
alirezamon |
$info= "Add extra Verilog code for debugging NoC for simulation";
|
923 |
43 |
alirezamon |
$default='0';
|
924 |
|
|
$content='0,1';
|
925 |
|
|
$type='Combo-box';
|
926 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$adv_set,'noc_param');
|
927 |
16 |
alirezamon |
|
928 |
43 |
alirezamon |
|
929 |
|
|
#pipeline reg
|
930 |
|
|
$label="Add pipeline reg after crossbar";
|
931 |
|
|
$param="ADD_PIPREG_AFTER_CROSSBAR";
|
932 |
|
|
$type="Check-box";
|
933 |
|
|
$content=1;
|
934 |
|
|
$default="1\'b0";
|
935 |
48 |
alirezamon |
$info="If is enabled it adds a pipeline register at the output port of the router.";
|
936 |
43 |
alirezamon |
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$adv_set,'noc_param');
|
937 |
|
|
|
938 |
|
|
|
939 |
48 |
alirezamon |
#MAX_SMART_NUM = 4 //
|
940 |
43 |
alirezamon |
$label="Number of multiple router bypassing ";
|
941 |
48 |
alirezamon |
$param="MAX_SMART_NUM ";
|
942 |
43 |
alirezamon |
$type='Spin-button';
|
943 |
|
|
$content='0,1,1';
|
944 |
|
|
$default=0;
|
945 |
|
|
$info="maximum number of routers which a packet can by pass during one clock cycle. Define it as zero will disable bypassing.";
|
946 |
|
|
#($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'noc_param');
|
947 |
|
|
|
948 |
|
|
|
949 |
|
|
#FIRST_ARBITER_EXT_P_EN
|
950 |
|
|
$label='Swich allocator first level
|
951 |
42 |
alirezamon |
arbiters external priority enable';
|
952 |
43 |
alirezamon |
$param='FIRST_ARBITER_EXT_P_EN';
|
953 |
|
|
$default= 1;
|
954 |
|
|
$info='If set as 1 then the switch allocator\'s input (first) arbiters\' priority registers are enabled only when a request get both input and output arbiters\' grants';
|
955 |
|
|
$content='0,1';
|
956 |
|
|
$type="Combo-box";
|
957 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info,$table,$row,undef,$adv_set,'noc_param');
|
958 |
|
|
|
959 |
|
|
|
960 |
|
|
#Arbiter type
|
961 |
|
|
$label='SW allocator arbitration type';
|
962 |
|
|
$param='SWA_ARBITER_TYPE';
|
963 |
|
|
$default='"RRA"';
|
964 |
|
|
$content='"RRA","WRRA"'; #,"WRRA_CLASSIC"';
|
965 |
|
|
$type='Combo-box';
|
966 |
48 |
alirezamon |
$info="Switch allocator arbiter type:
|
967 |
38 |
alirezamon |
RRA: Round robin arbiter. Only local fairness in a router.
|
968 |
|
|
WRRA: Weighted round robin arbiter. Results in global fairness in the NoC.
|
969 |
48 |
alirezamon |
Switch allocation requests are grated according to their weight which increases due to contention";
|
970 |
43 |
alirezamon |
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$adv_set,'noc_param',1);
|
971 |
|
|
|
972 |
|
|
|
973 |
|
|
|
974 |
38 |
alirezamon |
my $arbiter=$mpsoc->object_get_attribute('noc_param',"SWA_ARBITER_TYPE");
|
975 |
|
|
my $wrra_show = ($arbiter ne '"RRA"' && $adv_set == 1 )? 1 : 0;
|
976 |
43 |
alirezamon |
# weight width
|
977 |
|
|
$label='Weight width';
|
978 |
|
|
$param='WEIGHTw';
|
979 |
|
|
$default='4';
|
980 |
|
|
$content='2,7,1';
|
981 |
|
|
$info= 'Maximum weight width';
|
982 |
|
|
$type= 'Spin-button';
|
983 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$wrra_show,'noc_param',undef);
|
984 |
|
|
|
985 |
48 |
alirezamon |
|
986 |
|
|
|
987 |
|
|
$label='Self loop enable';
|
988 |
|
|
$param='SELF_LOOP_EN';
|
989 |
|
|
$default='"NO"';
|
990 |
|
|
$content='"NO","YES"';
|
991 |
|
|
$type='Combo-box';
|
992 |
|
|
$info="If the self loop is enabled, it allows a router input port sends packet to its own output port. Enabling it allows a tile to be able to sent packet to itself too.";
|
993 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$adv_set,'noc_param',1);
|
994 |
|
|
|
995 |
|
|
|
996 |
|
|
|
997 |
43 |
alirezamon |
#WRRA_CONFIG_INDEX
|
998 |
|
|
$label='Weight configuration index';
|
999 |
|
|
$param='WRRA_CONFIG_INDEX';
|
1000 |
|
|
$default='0';
|
1001 |
|
|
$content='0,7,1';
|
1002 |
|
|
$info= 'WRRA_CONFIG_INDEX:
|
1003 |
16 |
alirezamon |
|
1004 |
38 |
alirezamon |
';
|
1005 |
43 |
alirezamon |
$type= 'Spin-button';
|
1006 |
|
|
#($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$wrra_show,'noc_param',undef);
|
1007 |
38 |
alirezamon |
|
1008 |
43 |
alirezamon |
|
1009 |
|
|
|
1010 |
|
|
if($adv_set == 1){
|
1011 |
|
|
$advc= def_image_button("icons/up.png","Advance Parameters");
|
1012 |
|
|
$table->attach ( $advc , 0, 2, $row,$row+1,'fill','shrink',2,2);
|
1013 |
|
|
$row++;
|
1014 |
|
|
}
|
1015 |
|
|
$advc->signal_connect("clicked" => sub{
|
1016 |
|
|
$adv_set=($adv_set==1)?0:1;
|
1017 |
|
|
$mpsoc->object_add_attribute('setting','show_adv_setting',$adv_set);
|
1018 |
|
|
set_gui_status($mpsoc,"ref",1);
|
1019 |
|
|
});
|
1020 |
|
|
|
1021 |
|
|
|
1022 |
|
|
#other fixed parameters
|
1023 |
|
|
|
1024 |
|
|
|
1025 |
|
|
# AVC_ATOMIC_EN
|
1026 |
|
|
$label='AVC_ATOMIC_EN';
|
1027 |
|
|
$param='AVC_ATOMIC_EN';
|
1028 |
|
|
$default= 0;
|
1029 |
|
|
$info='AVC_ATOMIC_EN';
|
1030 |
|
|
$content='0,1';
|
1031 |
|
|
$type="Combo-box";
|
1032 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,0,'noc_param');
|
1033 |
|
|
|
1034 |
|
|
|
1035 |
|
|
#ROUTE_SUBFUNC
|
1036 |
|
|
#$label='ROUTE_SUBFUNC';
|
1037 |
|
|
#$param='ROUTE_SUBFUNC';
|
1038 |
|
|
#$default= '"XY"';
|
1039 |
|
|
#$info='ROUTE_SUBFUNC';
|
1040 |
|
|
#$content='"XY"';
|
1041 |
|
|
#$type="Combo-box";
|
1042 |
|
|
#($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,0,'noc_param');
|
1043 |
|
|
|
1044 |
|
|
return $row;
|
1045 |
25 |
alirezamon |
}
|
1046 |
|
|
|
1047 |
|
|
|
1048 |
48 |
alirezamon |
#############
|
1049 |
|
|
# config_custom_topology_gui
|
1050 |
|
|
############
|
1051 |
|
|
|
1052 |
|
|
sub config_custom_topology_gui{
|
1053 |
|
|
my($mpsoc,$table,$txview,$row)=@_;
|
1054 |
|
|
|
1055 |
|
|
my $coltmp=0;
|
1056 |
|
|
#read param.obj file to load cutom topology info
|
1057 |
|
|
my $dir =get_project_dir()."/mpsoc/rtl/src_topolgy";
|
1058 |
|
|
my $file="$dir/param.obj";
|
1059 |
|
|
unless (-f $file){
|
1060 |
|
|
add_colored_info($txview,"No Custom topology find in $dir. You can define a Custom Topology using ProNoC Topology maker.\n",'red');
|
1061 |
|
|
return;
|
1062 |
|
|
}
|
1063 |
|
|
|
1064 |
|
|
my %param;
|
1065 |
|
|
my ($pp,$r,$err) = regen_object($file );
|
1066 |
|
|
if ($r){
|
1067 |
|
|
add_colored_info($txview,"Error: cannot open $file file: $err\n",'red');
|
1068 |
|
|
return;
|
1069 |
|
|
}
|
1070 |
|
|
|
1071 |
|
|
%param=%{$pp};
|
1072 |
|
|
my @topologies=sort keys %param;
|
1073 |
|
|
|
1074 |
|
|
my $label='Topology_name';
|
1075 |
|
|
my $param='CUSTOM_TOPOLOGY_NAME';
|
1076 |
|
|
my $default=$topologies[0];
|
1077 |
|
|
my $content= join(",", @topologies);
|
1078 |
|
|
my $type='Combo-box';
|
1079 |
|
|
my $info="Custom topology name";
|
1080 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,1,'noc_param',1);
|
1081 |
|
|
|
1082 |
|
|
my $topology_name=$mpsoc->object_get_attribute('noc_param','CUSTOM_TOPOLOGY_NAME');
|
1083 |
|
|
|
1084 |
|
|
|
1085 |
|
|
$label='Routing Algorithm';
|
1086 |
|
|
$param="ROUTE_NAME";
|
1087 |
|
|
$type="Combo-box";
|
1088 |
|
|
$content=$param{$topology_name}{'ROUTE_NAME'};
|
1089 |
|
|
my @rr=split(/\s*,\s*/,$content);
|
1090 |
|
|
$default=$rr[0];
|
1091 |
|
|
$info="Select the routing algorithm";
|
1092 |
|
|
($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,1,'noc_param',1);
|
1093 |
|
|
|
1094 |
|
|
$mpsoc->object_add_attribute('noc_param','T1',$param{$topology_name}{'T1'});
|
1095 |
|
|
$mpsoc->object_add_attribute('noc_param','T2',$param{$topology_name}{'T2'});
|
1096 |
|
|
$mpsoc->object_add_attribute('noc_param','T3',$param{$topology_name}{'T3'});
|
1097 |
|
|
$mpsoc->object_add_attribute('noc_connection','er_addr',$param{$topology_name}{'er_addr'});
|
1098 |
|
|
|
1099 |
|
|
|
1100 |
|
|
return ($row,$coltmp);
|
1101 |
|
|
|
1102 |
|
|
}
|
1103 |
|
|
|
1104 |
|
|
|
1105 |
|
|
|
1106 |
|
|
|
1107 |
25 |
alirezamon |
#######################
|
1108 |
|
|
# get_config
|
1109 |
|
|
######################
|
1110 |
|
|
|
1111 |
|
|
sub get_config{
|
1112 |
43 |
alirezamon |
my ($mpsoc,$info)=@_;
|
1113 |
|
|
my $table=def_table(20,10,FALSE);# my ($row,$col,$homogeneous)=@_;
|
1114 |
48 |
alirezamon |
|
1115 |
25 |
alirezamon |
|
1116 |
43 |
alirezamon |
#noc_setting
|
1117 |
48 |
alirezamon |
my $row=noc_config ($mpsoc,$table,$info);
|
1118 |
43 |
alirezamon |
|
1119 |
|
|
|
1120 |
|
|
#tiles setting
|
1121 |
|
|
my $tile_set;
|
1122 |
|
|
my $show=$mpsoc->object_get_attribute('setting','show_tile_setting');
|
1123 |
|
|
|
1124 |
|
|
if($show == 0){
|
1125 |
|
|
$tile_set= def_image_button("icons/down.png","Tiles setting");
|
1126 |
|
|
$table->attach ( $tile_set , 0, 2, $row,$row+1,'fill','shrink',2,2);
|
1127 |
|
|
$row++;
|
1128 |
|
|
|
1129 |
|
|
}
|
1130 |
|
|
|
1131 |
|
|
$row=defualt_tilles_setting($mpsoc,$table,$show,$row,$info);
|
1132 |
|
|
|
1133 |
16 |
alirezamon |
|
1134 |
43 |
alirezamon |
#end tile setting
|
1135 |
|
|
if($show == 1){
|
1136 |
|
|
$tile_set= def_image_button("icons/up.png","Tiles setting");
|
1137 |
|
|
$table->attach ( $tile_set , 0, 2, $row,$row+1,'fill','shrink',2,2);
|
1138 |
|
|
$row++;
|
1139 |
|
|
}
|
1140 |
|
|
$tile_set->signal_connect("clicked" => sub{
|
1141 |
|
|
$show=($show==1)?0:1;
|
1142 |
|
|
$mpsoc->object_add_attribute('setting','show_tile_setting',$show);
|
1143 |
|
|
set_gui_status($mpsoc,"ref",1);
|
1144 |
16 |
alirezamon |
|
1145 |
|
|
|
1146 |
43 |
alirezamon |
});
|
1147 |
16 |
alirezamon |
|
1148 |
48 |
alirezamon |
my $scrolled_win = gen_scr_win_with_adjst($mpsoc,'get_config_adj');
|
1149 |
|
|
add_widget_to_scrolled_win($table,$scrolled_win);
|
1150 |
|
|
return $scrolled_win;
|
1151 |
16 |
alirezamon |
}
|
1152 |
|
|
|
1153 |
|
|
|
1154 |
|
|
#############
|
1155 |
43 |
alirezamon |
# gen_all_tiles
|
1156 |
16 |
alirezamon |
###########
|
1157 |
|
|
|
1158 |
28 |
alirezamon |
sub gen_all_tiles{
|
1159 |
43 |
alirezamon |
my ($mpsoc,$info, $hw_dir,$sw_dir)=@_;
|
1160 |
|
|
my ($NE, $NR, $RAw, $EAw, $Fw)=get_topology_info($mpsoc);
|
1161 |
|
|
my $mpsoc_name=$mpsoc->object_get_attribute('mpsoc_name');
|
1162 |
|
|
my $target_dir = "$ENV{'PRONOC_WORK'}/MPSOC/$mpsoc_name";
|
1163 |
|
|
my @generated_tiles;
|
1164 |
|
|
for (my $tile_num=0;$tile_num<$NE;$tile_num++){
|
1165 |
|
|
#print "$tile_num\n";
|
1166 |
|
|
my ($soc_name,$num)= $mpsoc->mpsoc_get_tile_soc_name($tile_num);
|
1167 |
|
|
next if(!defined $soc_name);
|
1168 |
|
|
|
1169 |
|
|
|
1170 |
|
|
my $path=$mpsoc->object_get_attribute('setting','soc_path');
|
1171 |
|
|
$path=~ s/ /\\ /g;
|
1172 |
|
|
my $p = "$path/$soc_name.SOC";
|
1173 |
|
|
my ($soc,$r,$err) = regen_object($p);
|
1174 |
|
|
if ($r){
|
1175 |
48 |
alirezamon |
show_info($info,"**Error reading $p file: $err\n");
|
1176 |
43 |
alirezamon |
next;
|
1177 |
|
|
}
|
1178 |
|
|
|
1179 |
|
|
#update core id
|
1180 |
|
|
$soc->object_add_attribute('global_param','CORE_ID',$tile_num);
|
1181 |
|
|
#update NoC param
|
1182 |
|
|
#my %nocparam = %{$mpsoc->object_get_attribute('noc_param',undef)};
|
1183 |
|
|
my $nocparam =$mpsoc->object_get_attribute('noc_param',undef);
|
1184 |
|
|
my $top=$mpsoc->mpsoc_get_soc($soc_name);
|
1185 |
|
|
my @nis=get_NI_instance_list($top);
|
1186 |
|
|
$soc->soc_add_instance_param($nis[0] ,$nocparam );
|
1187 |
48 |
alirezamon |
my %z;
|
1188 |
|
|
foreach my $p (sort keys %{$nocparam}){
|
1189 |
|
|
$z{$p}="Parameter";
|
1190 |
|
|
}
|
1191 |
|
|
$soc->soc_add_instance_param_type($nis[0] ,\%z);
|
1192 |
43 |
alirezamon |
#foreach my $p ( sort keys %nocparam ) {
|
1193 |
|
|
|
1194 |
|
|
# print "$p = $nocparam{$p} \n";
|
1195 |
|
|
#}
|
1196 |
29 |
alirezamon |
|
1197 |
43 |
alirezamon |
my $sw_path = "$sw_dir/tile$tile_num";
|
1198 |
|
|
#print "$sw_path\n";
|
1199 |
|
|
if( grep (/^$soc_name$/,@generated_tiles)){ # This soc is generated before only create the software file
|
1200 |
48 |
alirezamon |
generate_soc($soc,$info,$target_dir,$hw_dir,$sw_path,0,0,undef,1);
|
1201 |
43 |
alirezamon |
}else{
|
1202 |
48 |
alirezamon |
generate_soc($soc,$info,$target_dir,$hw_dir,$sw_path,0,1,"merge",1);
|
1203 |
|
|
move ("$hw_dir/$soc_name.sv","$hw_dir/tiles/");
|
1204 |
|
|
my @tmp= ("$hw_dir/tiles/$soc_name.sv");
|
1205 |
43 |
alirezamon |
add_to_project_file_list(\@tmp,"$hw_dir/tiles",$hw_dir);
|
1206 |
|
|
|
1207 |
|
|
}
|
1208 |
|
|
}#$tile_num
|
1209 |
|
|
|
1210 |
|
|
|
1211 |
16 |
alirezamon |
}
|
1212 |
|
|
|
1213 |
28 |
alirezamon |
|
1214 |
16 |
alirezamon |
################
|
1215 |
43 |
alirezamon |
# generate_soc
|
1216 |
16 |
alirezamon |
#################
|
1217 |
|
|
|
1218 |
|
|
sub generate_soc_files{
|
1219 |
43 |
alirezamon |
my ($mpsoc,$soc,$info)=@_;
|
1220 |
|
|
my $mpsoc_name=$mpsoc->object_get_attribute('mpsoc_name');
|
1221 |
|
|
my $soc_name=$soc->object_get_attribute('soc_name');
|
1222 |
|
|
|
1223 |
|
|
# copy all files in project work directory
|
1224 |
|
|
my $dir = Cwd::getcwd();
|
1225 |
|
|
my $project_dir = abs_path("$dir/../../");
|
1226 |
|
|
#make target dir
|
1227 |
|
|
my $target_dir = "$ENV{'PRONOC_WORK'}/MPSOC/$mpsoc_name";
|
1228 |
|
|
mkpath("$target_dir/src_verilog/lib/",1,0755);
|
1229 |
|
|
mkpath("$target_dir/src_verilog/tiles/",1,0755);
|
1230 |
|
|
mkpath("$target_dir/sw",1,0755);
|
1231 |
34 |
alirezamon |
|
1232 |
48 |
alirezamon |
my ($file_v,$tmp)=soc_generate_verilog($soc,"$target_dir/sw",$info);
|
1233 |
43 |
alirezamon |
|
1234 |
|
|
# Write object file
|
1235 |
|
|
open(FILE, ">lib/soc/$soc_name.SOC") || die "Can not open: $!";
|
1236 |
|
|
print FILE perl_file_header("$soc_name.SOC");
|
1237 |
|
|
print FILE Data::Dumper->Dump([\%$soc],['soc']);
|
1238 |
|
|
close(FILE) || die "Error closing file: $!";
|
1239 |
|
|
|
1240 |
|
|
# Write verilog file
|
1241 |
48 |
alirezamon |
open(FILE, ">lib/verilog/$soc_name.sv") || die "Can not open: $!";
|
1242 |
43 |
alirezamon |
print FILE $file_v;
|
1243 |
|
|
close(FILE) || die "Error closing file: $!";
|
1244 |
|
|
|
1245 |
48 |
alirezamon |
|
1246 |
43 |
alirezamon |
|
1247 |
48 |
alirezamon |
#copy hdl codes in src_verilog
|
1248 |
18 |
alirezamon |
my ($hdl_ref,$warnings)= get_all_files_list($soc,"hdl_files");
|
1249 |
48 |
alirezamon |
my ($sim_ref,$warnings2)= get_all_files_list($soc,"hdl_files_ticked");
|
1250 |
|
|
#hdl_ref-sim_ref
|
1251 |
|
|
my @n= get_diff_array($hdl_ref,$sim_ref);
|
1252 |
|
|
$hdl_ref=\@n;
|
1253 |
|
|
|
1254 |
|
|
foreach my $f(@{$hdl_ref}){
|
1255 |
43 |
alirezamon |
my $n="$project_dir$f";
|
1256 |
|
|
if (-f "$n") {
|
1257 |
|
|
copy ("$n","$target_dir/src_verilog/lib");
|
1258 |
|
|
}elsif(-f "$f" ){
|
1259 |
48 |
alirezamon |
copy ("$f","$target_dir/src_verilog/lib");
|
1260 |
|
|
}
|
1261 |
16 |
alirezamon |
}
|
1262 |
48 |
alirezamon |
show_colored_info($info,$warnings,'green') if(defined $warnings);
|
1263 |
42 |
alirezamon |
|
1264 |
48 |
alirezamon |
|
1265 |
|
|
|
1266 |
|
|
foreach my $f(@{$sim_ref}){
|
1267 |
|
|
my $n="$project_dir$f";
|
1268 |
|
|
if (-f "$n") {
|
1269 |
|
|
copy ("$n","$target_dir/src_sim");
|
1270 |
|
|
}elsif(-f "$f" ){
|
1271 |
|
|
copy ("$f","$target_dir/src_sim");
|
1272 |
|
|
}
|
1273 |
|
|
}
|
1274 |
|
|
show_colored_info($info,$warnings2,'green') if(defined $warnings2);
|
1275 |
|
|
|
1276 |
|
|
|
1277 |
42 |
alirezamon |
#save project hdl file/folder list
|
1278 |
|
|
my @new_file_ref;
|
1279 |
48 |
alirezamon |
foreach my $f(@{$hdl_ref}){
|
1280 |
43 |
alirezamon |
my ($name,$path,$suffix) = fileparse("$f",qr"\..[^.]*$");
|
1281 |
|
|
push(@new_file_ref,"$target_dir/src_verilog/lib/$name$suffix");
|
1282 |
|
|
}
|
1283 |
48 |
alirezamon |
foreach my $f(@{$sim_ref}){
|
1284 |
|
|
my ($name,$path,$suffix) = fileparse("$f",qr"\..[^.]*$");
|
1285 |
|
|
push(@new_file_ref,"$target_dir/src_sim/$name$suffix");
|
1286 |
|
|
}
|
1287 |
42 |
alirezamon |
open(FILE, ">$target_dir/src_verilog/file_list") || die "Can not open: $!";
|
1288 |
43 |
alirezamon |
print FILE Data::Dumper->Dump([\@new_file_ref],['files']);
|
1289 |
|
|
close(FILE) || die "Error closing file: $!";
|
1290 |
|
|
|
1291 |
|
|
|
1292 |
|
|
|
1293 |
|
|
|
1294 |
48 |
alirezamon |
move ("$dir/lib/verilog/$soc_name.sv","$target_dir/src_verilog/tiles/");
|
1295 |
|
|
copy_noc_files($project_dir,"$target_dir/src_verilog/lib");
|
1296 |
43 |
alirezamon |
|
1297 |
|
|
|
1298 |
48 |
alirezamon |
# Write header file
|
1299 |
|
|
generate_header_file($soc,$project_dir,$target_dir,$target_dir,$dir);
|
1300 |
|
|
#use File::Copy::Recursive qw(dircopy);
|
1301 |
|
|
#dircopy("$dir/../src_processor/aeMB/compiler","$target_dir/sw/") or die("$!\n");
|
1302 |
|
|
my $msg="SoC \"$soc_name\" has been created successfully at $target_dir/ ";
|
1303 |
|
|
return $msg;
|
1304 |
43 |
alirezamon |
}
|
1305 |
16 |
alirezamon |
|
1306 |
48 |
alirezamon |
|
1307 |
34 |
alirezamon |
sub generate_mpsoc_lib_file {
|
1308 |
43 |
alirezamon |
my ($mpsoc,$info) = @_;
|
1309 |
48 |
alirezamon |
my $tmp = $mpsoc;
|
1310 |
43 |
alirezamon |
my $name=$mpsoc->object_get_attribute('mpsoc_name');
|
1311 |
48 |
alirezamon |
|
1312 |
43 |
alirezamon |
open(FILE, ">lib/mpsoc/$name.MPSOC") || die "Can not open: $!";
|
1313 |
|
|
print FILE perl_file_header("$name.MPSOC");
|
1314 |
48 |
alirezamon |
print FILE Data::Dumper->Dump([\%$tmp],['mpsoc']);
|
1315 |
43 |
alirezamon |
close(FILE) || die "Error closing file: $!";
|
1316 |
48 |
alirezamon |
|
1317 |
|
|
#get_soc_list($mpsoc,$info);
|
1318 |
43 |
alirezamon |
|
1319 |
|
|
}
|
1320 |
34 |
alirezamon |
|
1321 |
48 |
alirezamon |
sub check_mpsoc_name {
|
1322 |
|
|
my ($name,$info)= @_;
|
1323 |
|
|
my $error = check_verilog_identifier_syntax($name);
|
1324 |
|
|
if ( defined $error ){
|
1325 |
|
|
#message_dialog("The \"$name\" is given with an unacceptable formatting. The mpsoc name will be used as top level verilog module name so it must follow Verilog identifier declaration formatting:\n $error");
|
1326 |
|
|
my $message = "The \"$name\" is given with an unacceptable formatting. The mpsoc name will be used as top level Verilog module name so it must follow Verilog identifier declaration formatting:\n $error";
|
1327 |
|
|
add_colored_info($info, $message,'red' );
|
1328 |
|
|
return 1;
|
1329 |
|
|
}
|
1330 |
|
|
my $size= (defined $name)? length($name) :0;
|
1331 |
|
|
if ($size ==0) {
|
1332 |
|
|
message_dialog("Please define the MPSoC name!");
|
1333 |
|
|
return 1;
|
1334 |
|
|
}
|
1335 |
|
|
return 0;
|
1336 |
|
|
}
|
1337 |
34 |
alirezamon |
|
1338 |
43 |
alirezamon |
|
1339 |
16 |
alirezamon |
################
|
1340 |
43 |
alirezamon |
# generate_mpsoc
|
1341 |
16 |
alirezamon |
#################
|
1342 |
|
|
|
1343 |
|
|
sub generate_mpsoc{
|
1344 |
43 |
alirezamon |
my ($mpsoc,$info,$show_sucess_msg)=@_;
|
1345 |
|
|
my $name=$mpsoc->object_get_attribute('mpsoc_name');
|
1346 |
48 |
alirezamon |
return 0 if (check_mpsoc_name($name,$info));
|
1347 |
|
|
|
1348 |
43 |
alirezamon |
# make target dir
|
1349 |
|
|
my $dir = Cwd::getcwd();
|
1350 |
|
|
my $target_dir = "$ENV{'PRONOC_WORK'}/MPSOC/$name";
|
1351 |
|
|
my $hw_dir = "$target_dir/src_verilog";
|
1352 |
|
|
my $sw_dir = "$target_dir/sw";
|
1353 |
|
|
|
1354 |
|
|
# rmtree ($hw_dir);
|
1355 |
|
|
mkpath("$hw_dir",1,01777);
|
1356 |
|
|
mkpath("$hw_dir/lib/",1,0755);
|
1357 |
|
|
mkpath("$hw_dir/tiles",1,0755);
|
1358 |
|
|
mkpath("$sw_dir",1,0755);
|
1359 |
48 |
alirezamon |
|
1360 |
43 |
alirezamon |
#remove old rtl files that were copied by ProNoC
|
1361 |
|
|
my ($old_file_ref,$r,$err) = regen_object("$hw_dir/file_list");
|
1362 |
|
|
if (defined $old_file_ref){
|
1363 |
|
|
remove_file_and_folders($old_file_ref,$target_dir);
|
1364 |
|
|
}
|
1365 |
|
|
unlink "$hw_dir/file_list";
|
1366 |
|
|
|
1367 |
|
|
#generate/copy all tiles HDL/SW codes
|
1368 |
|
|
gen_all_tiles($mpsoc,$info, $hw_dir,$sw_dir );
|
1369 |
|
|
|
1370 |
48 |
alirezamon |
#copy clk setting hdl codes in src_verilog
|
1371 |
|
|
my $project_dir = abs_path("$dir/../../");
|
1372 |
|
|
my $sc_soc =get_source_set_top($mpsoc,'mpsoc');
|
1373 |
|
|
my ($file_ref,$warnings)= get_all_files_list($sc_soc,"hdl_files");
|
1374 |
|
|
my ($sim_ref,$warnings2)= get_all_files_list($sc_soc,"hdl_files_ticked");
|
1375 |
|
|
#file_ref-sim_ref
|
1376 |
|
|
my @n= get_diff_array($file_ref,$sim_ref);
|
1377 |
|
|
$file_ref=\@n;
|
1378 |
|
|
|
1379 |
|
|
copy_file_and_folders($file_ref,$project_dir,"$hw_dir/lib");
|
1380 |
|
|
show_colored_info($info,$warnings,'green') if(defined $warnings);
|
1381 |
|
|
add_to_project_file_list($file_ref,"$hw_dir/lib/",$hw_dir);
|
1382 |
|
|
|
1383 |
|
|
copy_file_and_folders($sim_ref,$project_dir,"$hw_dir/../src_sim");
|
1384 |
|
|
show_colored_info($info,$warnings2,'green') if(defined $warnings2);
|
1385 |
|
|
add_to_project_file_list($sim_ref,"$hw_dir/../src_sim",$hw_dir);
|
1386 |
|
|
|
1387 |
|
|
|
1388 |
|
|
|
1389 |
43 |
alirezamon |
#generate header file containig the tiles physical addresses
|
1390 |
|
|
gen_tiles_physical_addrsses_header_file($mpsoc,"$sw_dir/phy_addr.h");
|
1391 |
|
|
|
1392 |
|
|
#copy all NoC HDL files
|
1393 |
48 |
alirezamon |
#my @files = glob( "$dir/../rtl/src_noc/*.v" );
|
1394 |
|
|
#copy_file_and_folders(\@files,$project_dir,"$hw_dir/lib/");
|
1395 |
|
|
#add_to_project_file_list(\@files,"$hw_dir/lib/",$hw_dir);
|
1396 |
|
|
my ($file_v,$top_v, $noc_param_v)=mpsoc_generate_verilog($mpsoc,$sw_dir,$info);
|
1397 |
43 |
alirezamon |
|
1398 |
48 |
alirezamon |
#if Topology is custom copy custom topology files
|
1399 |
|
|
my $topology=$mpsoc->object_get_attribute('noc_param','TOPOLOGY');
|
1400 |
|
|
if ($topology eq '"CUSTOM"'){
|
1401 |
|
|
my $Tname=$mpsoc->object_get_attribute('noc_param','CUSTOM_TOPOLOGY_NAME');
|
1402 |
|
|
$Tname=~s/["]//gs;
|
1403 |
|
|
my $dir1= get_project_dir()."/mpsoc/rtl/src_topolgy/$Tname";
|
1404 |
|
|
my $dir2= get_project_dir()."/mpsoc/rtl/src_topolgy/common";
|
1405 |
|
|
my @files = File::Find::Rule->file()
|
1406 |
|
|
->name( '*.v','*.V')
|
1407 |
|
|
->in( "$dir1" );
|
1408 |
|
|
copy_file_and_folders (\@files,$project_dir,"$hw_dir/lib/");
|
1409 |
|
|
|
1410 |
|
|
@files = File::Find::Rule->file()
|
1411 |
|
|
->name( '*.v','*.V')
|
1412 |
|
|
->in( "$dir2" );
|
1413 |
|
|
|
1414 |
|
|
copy_file_and_folders (\@files,$project_dir,"$hw_dir/lib/");
|
1415 |
|
|
}
|
1416 |
|
|
|
1417 |
43 |
alirezamon |
|
1418 |
|
|
# Write object file
|
1419 |
|
|
generate_mpsoc_lib_file($mpsoc,$info);
|
1420 |
48 |
alirezamon |
|
1421 |
43 |
alirezamon |
# Write verilog file
|
1422 |
48 |
alirezamon |
open(FILE, ">$target_dir/src_verilog/$name.sv") || die "Can not open: $!";
|
1423 |
43 |
alirezamon |
print FILE $file_v;
|
1424 |
|
|
close(FILE) || die "Error closing file: $!";
|
1425 |
|
|
|
1426 |
|
|
my $l=autogen_warning().get_license_header("${name}_top.v");
|
1427 |
48 |
alirezamon |
open(FILE, ">$target_dir/src_verilog/${name}_top.v") || die "Can not open: $!";
|
1428 |
43 |
alirezamon |
print FILE "$l\n$top_v";
|
1429 |
48 |
alirezamon |
close(FILE) || die "Error closing file: $!";
|
1430 |
43 |
alirezamon |
|
1431 |
48 |
alirezamon |
gen_noc_localparam_v_file($mpsoc,"$target_dir/src_verilog/lib/src_noc");
|
1432 |
|
|
|
1433 |
|
|
|
1434 |
43 |
alirezamon |
|
1435 |
28 |
alirezamon |
|
1436 |
48 |
alirezamon |
|
1437 |
|
|
|
1438 |
|
|
# $l=autogen_warning().get_license_header("${name}_mp.v");
|
1439 |
|
|
# open(FILE, ">$target_dir/src_verilog/${name}_mp.v") || die "Can not open: $!";
|
1440 |
|
|
# print FILE "$l\n$mp_v";
|
1441 |
|
|
# close(FILE) || die "Error closing file: $!";
|
1442 |
|
|
|
1443 |
|
|
|
1444 |
28 |
alirezamon |
#generate makefile
|
1445 |
|
|
open(FILE, ">$sw_dir/Makefile") || die "Can not open: $!";
|
1446 |
43 |
alirezamon |
print FILE mpsoc_sw_make();
|
1447 |
|
|
close(FILE) || die "Error closing file: $!";
|
1448 |
|
|
|
1449 |
48 |
alirezamon |
my $m_chain = $mpsoc->object_get_attribute('JTAG','M_CHAIN');
|
1450 |
|
|
|
1451 |
43 |
alirezamon |
#generate prog_mem
|
1452 |
28 |
alirezamon |
open(FILE, ">$sw_dir/program.sh") || die "Can not open: $!";
|
1453 |
48 |
alirezamon |
print FILE mpsoc_mem_prog($m_chain);
|
1454 |
43 |
alirezamon |
close(FILE) || die "Error closing file: $!";
|
1455 |
|
|
|
1456 |
48 |
alirezamon |
my @ff= ("$target_dir/src_verilog/$name.sv","$target_dir/src_verilog/${name}_top.v");
|
1457 |
|
|
add_to_project_file_list(\@ff,"$hw_dir/lib/",$hw_dir);
|
1458 |
45 |
alirezamon |
|
1459 |
|
|
#write perl_object_file
|
1460 |
|
|
mkpath("$target_dir/perl_lib/",1,01777);
|
1461 |
48 |
alirezamon |
open(FILE, ">$target_dir/perl_lib/$name.MPSOC") || die "Can not open: $!";
|
1462 |
45 |
alirezamon |
print FILE perl_file_header("$name.MPSOC");
|
1463 |
48 |
alirezamon |
print FILE Data::Dumper->Dump([\%$mpsoc],['mpsoc']);
|
1464 |
45 |
alirezamon |
|
1465 |
48 |
alirezamon |
#regenerate linker var file
|
1466 |
|
|
create_linker_var_file($mpsoc);
|
1467 |
|
|
|
1468 |
|
|
|
1469 |
42 |
alirezamon |
message_dialog("MPSoC \"$name\" has been created successfully at $target_dir/ " ) if($show_sucess_msg);
|
1470 |
48 |
alirezamon |
return 1;
|
1471 |
43 |
alirezamon |
}
|
1472 |
16 |
alirezamon |
|
1473 |
28 |
alirezamon |
sub mpsoc_sw_make {
|
1474 |
48 |
alirezamon |
my $make="TOPTARGETS := all clean
|
1475 |
|
|
SUBDIRS := \$(wildcard */.)
|
1476 |
|
|
\$(TOPTARGETS): \$(SUBDIRS)
|
1477 |
43 |
alirezamon |
\$(SUBDIRS):
|
1478 |
48 |
alirezamon |
\t\$(MAKE) -C \$@ \$(MAKECMDGOALS)
|
1479 |
16 |
alirezamon |
|
1480 |
48 |
alirezamon |
.PHONY: \$(TOPTARGETS) \$(SUBDIRS)
|
1481 |
43 |
alirezamon |
";
|
1482 |
48 |
alirezamon |
return $make;
|
1483 |
28 |
alirezamon |
}
|
1484 |
16 |
alirezamon |
|
1485 |
|
|
|
1486 |
28 |
alirezamon |
sub mpsoc_mem_prog {
|
1487 |
48 |
alirezamon |
my $chain=shift;
|
1488 |
|
|
|
1489 |
|
|
my $string="#!/bin/bash
|
1490 |
28 |
alirezamon |
|
1491 |
|
|
|
1492 |
48 |
alirezamon |
#JTAG_INTFC=\"\$PRONOC_WORK/toolchain/bin/JTAG_INTFC\"
|
1493 |
38 |
alirezamon |
source ./jtag_intfc.sh
|
1494 |
28 |
alirezamon |
|
1495 |
38 |
alirezamon |
|
1496 |
28 |
alirezamon |
#reset and disable cpus, then release the reset but keep the cpus disabled
|
1497 |
|
|
|
1498 |
48 |
alirezamon |
\$JTAG_INTFC -t $chain -n 127 -d \"I:1,D:2:3,D:2:2,I:0\"
|
1499 |
28 |
alirezamon |
|
1500 |
|
|
# jtag instruction
|
1501 |
43 |
alirezamon |
# 0: bypass
|
1502 |
|
|
# 1: getting data
|
1503 |
28 |
alirezamon |
# jtag data :
|
1504 |
43 |
alirezamon |
# bit 0 is reset
|
1505 |
|
|
# bit 1 is disable
|
1506 |
28 |
alirezamon |
# I:1 set jtag_enable in active mode
|
1507 |
|
|
# D:2:3 load jtag_enable data register with 0x3 reset=1 disable=1
|
1508 |
|
|
# D:2:2 load jtag_enable data register with 0x2 reset=0 disable=1
|
1509 |
|
|
# I:0 set jtag_enable in bypass mode
|
1510 |
|
|
|
1511 |
|
|
|
1512 |
|
|
|
1513 |
|
|
#programe the memory
|
1514 |
48 |
alirezamon |
for i in \$(ls -d */); do
|
1515 |
|
|
echo \"Enter \${i\%\%/}\"
|
1516 |
|
|
cd \${i\%\%/}
|
1517 |
45 |
alirezamon |
bash write_memory.sh
|
1518 |
43 |
alirezamon |
cd ..
|
1519 |
28 |
alirezamon |
done
|
1520 |
|
|
|
1521 |
|
|
#Enable the cpu
|
1522 |
48 |
alirezamon |
\$JTAG_INTFC -t $chain -n 127 -d \"I:1,D:2:0,I:0\"
|
1523 |
28 |
alirezamon |
# I:1 set jtag_enable in active mode
|
1524 |
|
|
# D:2:0 load jtag_enable data register with 0x0 reset=0 disable=0
|
1525 |
|
|
# I:0 set jtag_enable in bypass mode
|
1526 |
48 |
alirezamon |
";
|
1527 |
|
|
return $string;
|
1528 |
28 |
alirezamon |
}
|
1529 |
|
|
|
1530 |
|
|
|
1531 |
16 |
alirezamon |
sub get_tile_LIST{
|
1532 |
48 |
alirezamon |
my ($mpsoc,$x,$y,$soc_num,$row,$table)=@_;
|
1533 |
43 |
alirezamon |
my $instance_name=$mpsoc->mpsoc_get_instance_info($soc_num);
|
1534 |
|
|
if(!defined $instance_name){
|
1535 |
|
|
$mpsoc->mpsoc_set_default_ip($soc_num);
|
1536 |
|
|
$instance_name=$mpsoc->mpsoc_get_instance_info($soc_num);
|
1537 |
|
|
}
|
1538 |
16 |
alirezamon |
|
1539 |
43 |
alirezamon |
#ipname
|
1540 |
|
|
my $col=0;
|
1541 |
|
|
my $label=gen_label_in_left("IP_$soc_num($x,$y)");
|
1542 |
|
|
$table->attach_defaults ( $label, $col, $col+1 , $row, $row+1);$col+=2;
|
1543 |
|
|
#instance name
|
1544 |
|
|
my $entry=gen_entry($instance_name);
|
1545 |
|
|
$table->attach_defaults ( $entry, $col, $col+1 , $row, $row+1);$col+=2;
|
1546 |
|
|
$entry->signal_connect( 'changed'=> sub{
|
1547 |
|
|
my $new_instance=$entry->get_text();
|
1548 |
|
|
$mpsoc->mpsoc_set_ip_inst_name($soc_num,$new_instance);
|
1549 |
|
|
set_gui_status($mpsoc,"ref",20);
|
1550 |
|
|
print "changed to $new_instance\n ";
|
1551 |
|
|
});
|
1552 |
16 |
alirezamon |
|
1553 |
43 |
alirezamon |
#combo box
|
1554 |
|
|
my @list=('A','B');
|
1555 |
|
|
my $combo=gen_combo(\@list,0);
|
1556 |
|
|
$table->attach_defaults ( $combo, $col, $col+1 , $row, $row+1);$col+=2;
|
1557 |
|
|
#setting
|
1558 |
|
|
my $setting= def_image_button("icons/setting.png","Browse");
|
1559 |
|
|
$table->attach_defaults ( $setting, $col, $col+1 , $row, $row+1);$col+=2;
|
1560 |
16 |
alirezamon |
}
|
1561 |
|
|
|
1562 |
|
|
sub get_tile{
|
1563 |
43 |
alirezamon |
my ($mpsoc,$tile)=@_;
|
1564 |
|
|
my ($soc_name,$num)= $mpsoc->mpsoc_get_tile_soc_name($tile);
|
1565 |
|
|
my $button;
|
1566 |
|
|
my $topology=$mpsoc->object_get_attribute('noc_param','TOPOLOGY');
|
1567 |
|
|
|
1568 |
|
|
if( defined $soc_name){
|
1569 |
|
|
my $setting=$mpsoc->mpsoc_get_tile_param_setting($tile);
|
1570 |
|
|
$button=($setting eq 'Custom')? def_colored_button("Tile $tile*\n$soc_name",$num) : def_colored_button("Tile $tile\n$soc_name",$num) ;
|
1571 |
|
|
}else {
|
1572 |
|
|
$button =def_colored_button("Tile $tile\n",50) if(! defined $soc_name);
|
1573 |
|
|
}
|
1574 |
|
|
|
1575 |
|
|
$button->signal_connect("clicked" => sub{
|
1576 |
48 |
alirezamon |
get_tile_setting ($mpsoc,$tile);
|
1577 |
|
|
});
|
1578 |
|
|
|
1579 |
|
|
#$button->show_all;
|
1580 |
|
|
return $button;
|
1581 |
|
|
}
|
1582 |
|
|
|
1583 |
|
|
sub define_empty_param_setting {
|
1584 |
|
|
my ($mpsoc,$window)=@_;
|
1585 |
|
|
my $ok = def_image_button('icons/select.png','OK');
|
1586 |
|
|
my $okbox=def_hbox(TRUE,0);
|
1587 |
|
|
$okbox->pack_start($ok, FALSE, FALSE,0);
|
1588 |
|
|
$ok-> signal_connect("clicked" => sub{
|
1589 |
|
|
set_gui_status($mpsoc,"refresh_soc",1);
|
1590 |
|
|
$window->destroy;
|
1591 |
|
|
|
1592 |
|
|
});
|
1593 |
|
|
my $param_table = def_table(1, 1, TRUE);
|
1594 |
|
|
$param_table->attach_defaults($okbox,0,1,3,4);
|
1595 |
|
|
return $param_table;
|
1596 |
|
|
|
1597 |
|
|
|
1598 |
|
|
}
|
1599 |
|
|
|
1600 |
|
|
sub get_tile_setting {
|
1601 |
|
|
my($mpsoc,$tile)=@_;
|
1602 |
|
|
my $window = def_popwin_size(50,40,"Parameter setting for Tile $tile ",'percent');
|
1603 |
|
|
my $table = def_table(6, 2, FALSE);
|
1604 |
43 |
alirezamon |
|
1605 |
48 |
alirezamon |
my $scrolled_win = add_widget_to_scrolled_win($table);
|
1606 |
43 |
alirezamon |
my $row=0;
|
1607 |
|
|
my ($soc_name,$g,$t)=$mpsoc->mpsoc_get_tile_soc_name($tile);
|
1608 |
48 |
alirezamon |
|
1609 |
43 |
alirezamon |
my @socs=$mpsoc->mpsoc_get_soc_list();
|
1610 |
|
|
my @list=(' ',@socs);
|
1611 |
|
|
my $pos=(defined $soc_name)? get_scolar_pos($soc_name,@list): 0;
|
1612 |
|
|
my $combo=gen_combo(\@list, $pos);
|
1613 |
48 |
alirezamon |
my $label=gen_label_in_left(" Processing tile name:");
|
1614 |
|
|
$table->attach($label,0,2,$row,$row+1,'shrink','shrink',2,2);
|
1615 |
|
|
$table->attach($combo,2,3,$row,$row+1,'shrink','shrink',2,2);$row++;
|
1616 |
|
|
add_Hsep_to_table($table,0,3,$row);$row++;
|
1617 |
|
|
$soc_name = ' ' if (!defined $soc_name);
|
1618 |
|
|
my $param_table = ($soc_name eq ' ')? define_empty_param_setting($mpsoc,$window) :
|
1619 |
|
|
get_soc_parameter_setting_table($mpsoc,$soc_name,$window,[$tile]);
|
1620 |
|
|
|
1621 |
|
|
$table->attach_defaults($param_table,0,3,2,3);
|
1622 |
|
|
|
1623 |
|
|
|
1624 |
|
|
$combo->signal_connect('changed'=>sub{
|
1625 |
43 |
alirezamon |
my $new_soc=$combo->get_active_text();
|
1626 |
|
|
if ($new_soc eq ' '){
|
1627 |
|
|
#unconnect tile
|
1628 |
|
|
$mpsoc->mpsoc_set_tile_free($tile);
|
1629 |
48 |
alirezamon |
$param_table->destroy;
|
1630 |
|
|
$param_table= define_empty_param_setting($mpsoc,$window);
|
1631 |
|
|
$table->attach_defaults($param_table,0,3,2,3);
|
1632 |
|
|
$window->show_all;
|
1633 |
43 |
alirezamon |
}else {
|
1634 |
|
|
$mpsoc->mpsoc_set_tile_soc_name($tile,$new_soc);
|
1635 |
48 |
alirezamon |
$param_table->destroy;
|
1636 |
|
|
$param_table = get_soc_parameter_setting_table($mpsoc,$new_soc,$window,[$tile]);
|
1637 |
|
|
$table->attach_defaults($param_table,0,3,2,3);
|
1638 |
|
|
$window->show_all;
|
1639 |
43 |
alirezamon |
}
|
1640 |
|
|
});
|
1641 |
48 |
alirezamon |
$window->add($scrolled_win);
|
1642 |
|
|
$window->show_all;
|
1643 |
16 |
alirezamon |
}
|
1644 |
|
|
|
1645 |
|
|
|
1646 |
|
|
##########
|
1647 |
43 |
alirezamon |
# gen_tiles
|
1648 |
16 |
alirezamon |
#########
|
1649 |
|
|
sub gen_tiles{
|
1650 |
43 |
alirezamon |
my ($mpsoc)=@_;
|
1651 |
|
|
my ($NE, $NR, $RAw, $EAw, $Fw)=get_topology_info($mpsoc);
|
1652 |
|
|
my $table;
|
1653 |
|
|
my $dim_y = floor(sqrt($NE));
|
1654 |
48 |
alirezamon |
$table=def_table($NE%8,$NE/8,FALSE);# my ($row,$col,$homogeneous)=@_;
|
1655 |
|
|
for (my $i=0; $i<$NE;$i++){
|
1656 |
|
|
my $tile=get_tile($mpsoc,$i);
|
1657 |
|
|
my $y= int($i/$dim_y);
|
1658 |
|
|
my $x= $i % $dim_y;
|
1659 |
|
|
$table->attach_defaults ($tile, $x, $x+1 , $y, $y+1);
|
1660 |
|
|
}
|
1661 |
|
|
|
1662 |
|
|
my $scrolled_win = gen_scr_win_with_adjst($mpsoc,'gen_tiles_adj');
|
1663 |
|
|
add_widget_to_scrolled_win($table,$scrolled_win);
|
1664 |
|
|
return $scrolled_win;
|
1665 |
|
|
}
|
1666 |
16 |
alirezamon |
|
1667 |
48 |
alirezamon |
|
1668 |
|
|
sub get_elf_file_addr_range {
|
1669 |
|
|
my ($file,$tview)=@_;
|
1670 |
|
|
#my $command= "size -A $file";
|
1671 |
|
|
my $command= "nm $file";
|
1672 |
|
|
#add_info($tview,"$command\n");
|
1673 |
|
|
my ($stdout,$exit,$stderr)=run_cmd_in_back_ground_get_stdout($command);
|
1674 |
|
|
if(length $stderr>1){
|
1675 |
|
|
add_colored_info($tview,"$stderr\n",'red');
|
1676 |
|
|
add_colored_info($tview,"$command was not run successfully!\n",'red');
|
1677 |
|
|
return ("Err","Err");
|
1678 |
|
|
}
|
1679 |
|
|
if($exit){
|
1680 |
|
|
add_colored_info($tview,"$stdout\n",'red');
|
1681 |
|
|
add_colored_info($tview,"$command was not run successfully!\n",'red');
|
1682 |
|
|
return ("Err","Err");
|
1683 |
|
|
}
|
1684 |
|
|
|
1685 |
|
|
my @lines = split ("\n" ,$stdout);
|
1686 |
|
|
my $max_addr=0;
|
1687 |
|
|
my $sec_name;
|
1688 |
|
|
|
1689 |
|
|
foreach my $p (@lines ){
|
1690 |
|
|
$p =~ s/\s+/ /g; # remove extra spaces
|
1691 |
|
|
$p =~ s/^\s+//; #ltrim
|
1692 |
|
|
my ($addr,$type,$name)= sscanf("%x %s %s","$p");
|
1693 |
|
|
if(defined $addr && defined $name){
|
1694 |
|
|
if($max_addr < $addr) {
|
1695 |
|
|
$max_addr = $addr;
|
1696 |
|
|
$sec_name = $name;
|
1697 |
|
|
}
|
1698 |
|
|
}
|
1699 |
|
|
}
|
1700 |
|
|
return ($max_addr,$sec_name);
|
1701 |
|
|
}
|
1702 |
|
|
|
1703 |
|
|
|
1704 |
|
|
sub show_reqired_brams{
|
1705 |
|
|
my ($self,$tview)=@_;
|
1706 |
|
|
my $win=def_popwin_size (50,50,"BRAM info", 'percent');
|
1707 |
|
|
my $sc_win = gen_scr_win_with_adjst($self,'liststore');
|
1708 |
|
|
my $table= def_table(10,10,FALSE);
|
1709 |
|
|
add_widget_to_scrolled_win($table,$sc_win);
|
1710 |
|
|
my $row=0;
|
1711 |
|
|
my $col=0;
|
1712 |
16 |
alirezamon |
|
1713 |
48 |
alirezamon |
my @clmns =('Tile#', 'Section located in Upper Bound Address (UBA) ','UBA in Bytes','UBA in Words','Minimum Memory Address Width');
|
1714 |
|
|
my $target_dir;
|
1715 |
|
|
my @data;
|
1716 |
|
|
|
1717 |
|
|
my $mpsoc_name=$self->object_get_attribute('mpsoc_name');
|
1718 |
|
|
if(defined $mpsoc_name){#it is an soc
|
1719 |
|
|
|
1720 |
|
|
my ($NE, $NR, $RAw, $EAw, $Fw)=get_topology_info($self);
|
1721 |
|
|
|
1722 |
|
|
$target_dir = "$ENV{'PRONOC_WORK'}/MPSOC/$mpsoc_name";
|
1723 |
|
|
|
1724 |
|
|
for (my $tile_num=0;$tile_num<$NE;$tile_num++){
|
1725 |
|
|
my $ram_file = "$target_dir/sw/tile$tile_num/image";
|
1726 |
|
|
my ($size,$sec) = get_elf_file_addr_range($ram_file,$tview);
|
1727 |
|
|
my %clmn;
|
1728 |
|
|
$clmn{0}="tile$tile_num";
|
1729 |
|
|
$clmn{1}= "$sec";
|
1730 |
|
|
$clmn{2}="$size";
|
1731 |
|
|
my $w=$size/4;
|
1732 |
|
|
$clmn{3}="$w";
|
1733 |
|
|
$clmn{4}=ceil(log($w)/log(2));
|
1734 |
|
|
push(@data,\%clmn);
|
1735 |
|
|
|
1736 |
|
|
}#$tile_num
|
1737 |
|
|
}
|
1738 |
|
|
else
|
1739 |
|
|
{
|
1740 |
|
|
my $soc_name=$self->object_get_attribute('soc_name');
|
1741 |
|
|
$target_dir = "$ENV{'PRONOC_WORK'}/SOC/$soc_name";
|
1742 |
|
|
my $ram_file = "$target_dir/sw/image";
|
1743 |
|
|
my ($size,$sec) = get_elf_file_addr_range($ram_file,$tview);
|
1744 |
|
|
my %clmn;
|
1745 |
|
|
$clmn{0}="$soc_name";
|
1746 |
|
|
$clmn{1}= "$sec";
|
1747 |
|
|
$clmn{2}="$size";
|
1748 |
|
|
my $w=$size/4;
|
1749 |
|
|
$clmn{3}="$w";
|
1750 |
|
|
$clmn{4}=ceil(log($w)/log(2));
|
1751 |
|
|
push(@data,\%clmn);
|
1752 |
|
|
}
|
1753 |
|
|
|
1754 |
|
|
my @clmn_type = (#'Glib::Boolean', # => G_TYPE_BOOLEAN
|
1755 |
|
|
#'Glib::Uint', # => G_TYPE_UINT
|
1756 |
|
|
'Glib::String', # => G_TYPE_STRING
|
1757 |
|
|
'Glib::String',
|
1758 |
|
|
'Glib::String',
|
1759 |
|
|
'Glib::String',
|
1760 |
|
|
'Glib::String'); # you get the idea
|
1761 |
|
|
|
1762 |
|
|
my $list= gen_list_store (\@data,\@clmn_type,\@clmns);
|
1763 |
|
|
$table-> attach ($list, $col, $col+1, $row, $row+1,'shrink','shrink',2,2); $row++;
|
1764 |
|
|
|
1765 |
|
|
$win->add($sc_win);
|
1766 |
|
|
$win->show_all();
|
1767 |
38 |
alirezamon |
}
|
1768 |
16 |
alirezamon |
|
1769 |
48 |
alirezamon |
sub check_conflict {
|
1770 |
|
|
my ($self,$tile_num,$label)=@_;
|
1771 |
|
|
|
1772 |
|
|
my $r1 =$self->object_get_attribute("ROM$tile_num",'end');
|
1773 |
|
|
my $r2 =$self->object_get_attribute("RAM$tile_num",'start');
|
1774 |
|
|
|
1775 |
|
|
if(defined $r1 && defined $r2){
|
1776 |
|
|
if(hex($r1)> hex($r2)){
|
1777 |
|
|
$label->set_markup("<span foreground= 'red' ><b>RAM-ROM range Conflict</b></span>");
|
1778 |
|
|
|
1779 |
|
|
}else {
|
1780 |
|
|
$label->set_label(" ");
|
1781 |
|
|
|
1782 |
|
|
}
|
1783 |
|
|
}else {
|
1784 |
|
|
$label->set_label(" ");
|
1785 |
|
|
|
1786 |
|
|
}
|
1787 |
|
|
}
|
1788 |
16 |
alirezamon |
|
1789 |
|
|
|
1790 |
48 |
alirezamon |
sub update_ram_rom_size {
|
1791 |
|
|
my ($self,$tile_num,$name,$label,$start,$end,$conflict)=@_;
|
1792 |
|
|
my $s = $start->get_value();
|
1793 |
|
|
my $e = $end->get_value();
|
1794 |
38 |
alirezamon |
|
1795 |
48 |
alirezamon |
$self->object_add_attribute($name.$tile_num,'start',$start->get_value());
|
1796 |
|
|
$self->object_add_attribute($name.$tile_num,'end',$end->get_value());
|
1797 |
|
|
if($e <= $s){
|
1798 |
|
|
#$label->set_label("Invalid range" );
|
1799 |
|
|
$label->set_markup("<span foreground= 'red' ><b>Invalid range</b></span>");
|
1800 |
|
|
|
1801 |
|
|
}else {
|
1802 |
|
|
$label->set_label( metric_conversion($e - $s) . "B");
|
1803 |
|
|
|
1804 |
|
|
}
|
1805 |
|
|
|
1806 |
|
|
check_conflict($self,$tile_num,$conflict);
|
1807 |
|
|
|
1808 |
|
|
|
1809 |
|
|
|
1810 |
|
|
}
|
1811 |
38 |
alirezamon |
|
1812 |
48 |
alirezamon |
sub get_tile_peripheral_patameter {
|
1813 |
|
|
my ($mpsoc,$tile_num,$peripheral,$param_name)=@_;
|
1814 |
|
|
my ($soc_name,$n,$soc_num)=$mpsoc->mpsoc_get_tile_soc_name($tile_num);
|
1815 |
|
|
if(defined $soc_name) {
|
1816 |
|
|
my $top=$mpsoc->mpsoc_get_soc($soc_name);
|
1817 |
|
|
my @insts=$top->top_get_all_instances();
|
1818 |
|
|
foreach my $id (@insts){
|
1819 |
|
|
if ($id =~/$peripheral[0-9]/){
|
1820 |
|
|
my $name=$top->top_get_def_of_instance($id,'instance');
|
1821 |
|
|
|
1822 |
|
|
my %params;
|
1823 |
|
|
my $setting=$mpsoc->mpsoc_get_tile_param_setting($tile_num);
|
1824 |
|
|
#if ($setting eq 'Custom'){
|
1825 |
|
|
%params= $top->top_get_custom_soc_param($tile_num);
|
1826 |
|
|
#}else{
|
1827 |
|
|
# %params=$top->top_get_default_soc_param();
|
1828 |
|
|
#}
|
1829 |
|
|
return $params{"${name}_$param_name"};
|
1830 |
|
|
}
|
1831 |
|
|
}
|
1832 |
|
|
}
|
1833 |
|
|
return undef;
|
1834 |
|
|
|
1835 |
|
|
}
|
1836 |
38 |
alirezamon |
|
1837 |
48 |
alirezamon |
sub get_soc_peripheral_parameter {
|
1838 |
|
|
my ($soc,$peripheral,$param_nam)=@_;
|
1839 |
|
|
my @instances=$soc->soc_get_all_instances();
|
1840 |
|
|
foreach my $id (@instances){
|
1841 |
|
|
if ($id =~/$peripheral[0-9]/){
|
1842 |
|
|
return $soc->soc_get_module_param_value ($id,$param_nam) if (defined $param_nam);
|
1843 |
|
|
}
|
1844 |
|
|
}
|
1845 |
|
|
return undef;
|
1846 |
|
|
}
|
1847 |
|
|
|
1848 |
|
|
|
1849 |
|
|
sub linker_initial_setting {
|
1850 |
|
|
my ($self,$tview)=@_;
|
1851 |
|
|
my $mpsoc_name=$self->object_get_attribute('mpsoc_name');
|
1852 |
|
|
my $tnum;
|
1853 |
|
|
my $target_dir;
|
1854 |
|
|
if(defined $mpsoc_name){#it is an mpsoc
|
1855 |
|
|
|
1856 |
|
|
my ($NE, $NR, $RAw, $EAw, $Fw)=get_topology_info($self);
|
1857 |
|
|
|
1858 |
|
|
$target_dir = "$ENV{'PRONOC_WORK'}/MPSOC/$mpsoc_name";
|
1859 |
|
|
for (my $tile_num=0;$tile_num<$NE;$tile_num++){
|
1860 |
|
|
|
1861 |
|
|
my $v=get_tile_peripheral_patameter($self,$tile_num,"_ram","Aw");
|
1862 |
|
|
$v = 13 if (!defined $v);
|
1863 |
|
|
$self->object_add_attribute('MEM'.$tile_num,'width',$v);
|
1864 |
|
|
$self->object_add_attribute('MEM'.$tile_num,'percent',75);
|
1865 |
|
|
|
1866 |
|
|
my $s =(1 << ($v+2)) ;
|
1867 |
|
|
my $p = 75;
|
1868 |
|
|
|
1869 |
|
|
my $rom_start = 0;
|
1870 |
|
|
my $rom_end= int ( ($s*$p)/100);
|
1871 |
|
|
my $ram_start= int (($s*$p)/100);
|
1872 |
|
|
my $ram_end= $s;
|
1873 |
|
|
|
1874 |
|
|
$self->object_add_attribute('ROM'.$tile_num,'start',$rom_start);
|
1875 |
|
|
$self->object_add_attribute('ROM'.$tile_num,'end',$rom_end);
|
1876 |
|
|
$self->object_add_attribute('RAM'.$tile_num,'start',$ram_start);
|
1877 |
|
|
$self->object_add_attribute('RAM'.$tile_num,'end',$ram_end);
|
1878 |
|
|
|
1879 |
|
|
|
1880 |
|
|
}
|
1881 |
|
|
|
1882 |
|
|
|
1883 |
|
|
}
|
1884 |
|
|
else
|
1885 |
|
|
{
|
1886 |
|
|
my $v=get_soc_peripheral_parameter ($self,"_ram","Aw");
|
1887 |
|
|
$v = 13 if (!defined $v);
|
1888 |
|
|
$self->object_add_attribute('MEM0','width',$v);
|
1889 |
|
|
$self->object_add_attribute('MEM0','percent',75);
|
1890 |
|
|
my $s =(1 << ($v+2)) ;
|
1891 |
|
|
my $p = 75;
|
1892 |
|
|
|
1893 |
|
|
my $rom_start = 0;
|
1894 |
|
|
my $rom_end= int ( ($s*$p)/100);
|
1895 |
|
|
my $ram_start= int (($s*$p)/100);
|
1896 |
|
|
my $ram_end= $s;
|
1897 |
|
|
|
1898 |
|
|
$self->object_add_attribute('ROM0','start',$rom_start);
|
1899 |
|
|
$self->object_add_attribute('ROM0','end',$rom_end);
|
1900 |
|
|
$self->object_add_attribute('RAM0','start',$ram_start);
|
1901 |
|
|
$self->object_add_attribute('RAM0','end',$ram_end);
|
1902 |
|
|
}
|
1903 |
|
|
|
1904 |
|
|
|
1905 |
|
|
}
|
1906 |
|
|
|
1907 |
|
|
|
1908 |
|
|
|
1909 |
|
|
sub linker_setting{
|
1910 |
|
|
my ($self,$tview)=@_;
|
1911 |
|
|
my $win=def_popwin_size (80,50,"BRAM info", 'percent');
|
1912 |
|
|
my $sc_win = gen_scr_win_with_adjst($self,'liststore');
|
1913 |
|
|
my $table= def_table(10,10,FALSE);
|
1914 |
|
|
|
1915 |
|
|
|
1916 |
|
|
my $row=0;
|
1917 |
|
|
my $col=0;
|
1918 |
|
|
|
1919 |
|
|
$table-> attach (gen_label_in_center("Tile"), $col, $col+1, $row, $row+1,'shrink','shrink',2,2); $col+=1;
|
1920 |
|
|
$table-> attach (gen_label_in_center("Memory Addr"), $col, $col+1, $row, $row+1,'shrink','shrink',2,2); $col+=1;
|
1921 |
|
|
$table-> attach (gen_label_in_center("ROM/(ROM+RAM)"), $col, $col+1, $row, $row+1,'shrink','shrink',2,2); $col+=1;
|
1922 |
|
|
|
1923 |
|
|
$table-> attach (gen_label_in_center("ROM index addr (hex)"), $col, $col+2, $row, $row+1,'shrink','shrink',2,2); $col+=3;
|
1924 |
|
|
$table-> attach (gen_label_in_center("RAM index addr (hex)"), $col, $col+2, $row, $row+1,'shrink','shrink',2,2); $col+=3;
|
1925 |
|
|
|
1926 |
|
|
|
1927 |
|
|
$col=0;$row++;
|
1928 |
|
|
$table-> attach (gen_label_in_center("#"), $col, $col+1, $row, $row+1,'shrink','shrink',2,2); $col++;
|
1929 |
|
|
$table-> attach (gen_label_in_center("Width"), $col, $col+1, $row, $row+1,'shrink','shrink',2,2); $col++;
|
1930 |
|
|
$table-> attach (gen_label_in_center("(%)"), $col, $col+1, $row, $row+1,'shrink','shrink',2,2); $col++;
|
1931 |
|
|
|
1932 |
|
|
$table-> attach (gen_label_in_center("Beginning"), $col, $col+1, $row, $row+1,'shrink','shrink',2,2); $col+=1;
|
1933 |
|
|
$table-> attach (gen_label_in_center("End"), $col, $col+1, $row, $row+1,'shrink','shrink',2,2); $col++;
|
1934 |
|
|
$table-> attach (gen_label_in_center("Size"), $col, $col+1, $row, $row+1,'shrink','shrink',2,2); $col++;
|
1935 |
|
|
|
1936 |
|
|
$table-> attach (gen_label_in_center("Beginning"), $col, $col+1, $row, $row+1,'shrink','shrink',2,2); $col+=1;
|
1937 |
|
|
$table-> attach (gen_label_in_center("End"), $col, $col+1, $row, $row+1,'shrink','shrink',2,2); $col++;
|
1938 |
|
|
$table-> attach (gen_label_in_center("Size"), $col, $col+1, $row, $row+1,'shrink','shrink',2,2); $col++;
|
1939 |
|
|
|
1940 |
|
|
|
1941 |
|
|
$col=0;$row++;
|
1942 |
|
|
|
1943 |
|
|
my $target_dir;
|
1944 |
|
|
my @data;
|
1945 |
|
|
|
1946 |
|
|
my $mpsoc_name=$self->object_get_attribute('mpsoc_name');
|
1947 |
|
|
my $tnum;
|
1948 |
|
|
if(defined $mpsoc_name){#it is an mpsoc
|
1949 |
|
|
|
1950 |
|
|
my ($NE, $NR, $RAw, $EAw, $Fw)=get_topology_info($self);
|
1951 |
|
|
$tnum=$NE;
|
1952 |
|
|
$target_dir = "$ENV{'PRONOC_WORK'}/MPSOC/$mpsoc_name";
|
1953 |
|
|
}
|
1954 |
|
|
else
|
1955 |
|
|
{
|
1956 |
|
|
my $soc_name=$self->object_get_attribute('soc_name');
|
1957 |
|
|
$target_dir = "$ENV{'PRONOC_WORK'}/SOC/$soc_name";
|
1958 |
|
|
$tnum=1;
|
1959 |
|
|
}
|
1960 |
|
|
for (my $j=0;$j<$tnum;$j++){
|
1961 |
|
|
my $tile_num=$j;
|
1962 |
|
|
my $conflict =gen_label_in_center(" ") ;
|
1963 |
|
|
|
1964 |
|
|
$table-> attach (gen_label_in_center("$tile_num"), $col, $col+1, $row, $row+1,'shrink','shrink',2,2);$col++;
|
1965 |
|
|
my $ram_width = gen_spin(2,64,1);
|
1966 |
|
|
my $width = $self->object_get_attribute('MEM'.$tile_num,'width');
|
1967 |
|
|
if(!defined $width){
|
1968 |
|
|
linker_initial_setting ($self,$tview);
|
1969 |
|
|
$width = $self->object_get_attribute('MEM'.$tile_num,'width');
|
1970 |
|
|
}
|
1971 |
|
|
$ram_width->set_value($width);
|
1972 |
|
|
my $size =gen_label_in_center(metric_conversion(1 << 15). "B") ;
|
1973 |
|
|
|
1974 |
|
|
|
1975 |
|
|
$table-> attach (def_pack_hbox('FALSE',0,$ram_width,$size), $col, $col+1, $row, $row+1,'shrink','shrink',2,2); $col++;
|
1976 |
|
|
|
1977 |
|
|
|
1978 |
|
|
|
1979 |
|
|
|
1980 |
|
|
my $percent = gen_spin_float(6.25,93.75,6.25,2);
|
1981 |
|
|
my $p=$self->object_get_attribute('MEM'.$tile_num,'percent');
|
1982 |
|
|
$percent->set_value($p);
|
1983 |
|
|
|
1984 |
|
|
my $enter= def_image_button("icons/enter.png");
|
1985 |
|
|
$table-> attach (def_pack_hbox('FALSE',0,$percent,$enter), $col, $col+1, $row, $row+1,'shrink','shrink',2,2); $col++;
|
1986 |
|
|
|
1987 |
|
|
my $rom_start_v =$self->object_get_attribute('ROM'.$tile_num,'start');
|
1988 |
|
|
my $rom_end_v = $self->object_get_attribute('ROM'.$tile_num,'end');
|
1989 |
|
|
my $ram_start_v = $self->object_get_attribute('RAM'.$tile_num,'start');
|
1990 |
|
|
my $ram_end_v = $self->object_get_attribute('RAM'.$tile_num,'end');
|
1991 |
|
|
|
1992 |
|
|
|
1993 |
|
|
|
1994 |
|
|
my $rom_start = HexSpin->new ( $rom_start_v, 0, 0xffffffff ,4);
|
1995 |
|
|
$rom_start->set_digits(8);
|
1996 |
|
|
$table-> attach ($rom_start, $col, $col+1, $row, $row+1,'shrink','shrink',2,2); $col++;
|
1997 |
|
|
|
1998 |
|
|
|
1999 |
|
|
|
2000 |
|
|
my $rom_end = HexSpin->new ( $rom_end_v, 0, 0xffffffff ,4);
|
2001 |
|
|
$rom_end->set_digits(8);
|
2002 |
|
|
$table-> attach ($rom_end, $col, $col+1, $row, $row+1,'shrink','shrink',2,2); $col++;
|
2003 |
|
|
|
2004 |
|
|
my $rom_size =gen_label_in_center(" ") ;
|
2005 |
|
|
$table-> attach ($rom_size, $col, $col+1, $row, $row+1,'shrink','shrink',2,2); $col++;
|
2006 |
|
|
update_ram_rom_size($self,$tile_num,'ROM',$rom_size,$rom_start,$rom_end,$conflict);
|
2007 |
|
|
$rom_start->signal_connect ( 'changed', sub {update_ram_rom_size($self,$tile_num,'ROM',$rom_size,$rom_start,$rom_end,$conflict);});
|
2008 |
|
|
$rom_end->signal_connect ( 'changed', sub {update_ram_rom_size($self,$tile_num,'ROM',$rom_size,$rom_start,$rom_end,$conflict);});
|
2009 |
|
|
|
2010 |
|
|
my $ram_start = HexSpin->new ( $ram_start_v, 0, 0xffffffff ,4);
|
2011 |
|
|
$ram_start->set_digits(8);
|
2012 |
|
|
$table-> attach ($ram_start, $col, $col+1, $row, $row+1,'shrink','shrink',2,2); $col++;
|
2013 |
|
|
|
2014 |
|
|
|
2015 |
|
|
my $ram_end = HexSpin->new ( $ram_end_v, 0, 0xffffffff ,4);
|
2016 |
|
|
$ram_end->set_digits(8);
|
2017 |
|
|
$table-> attach ($ram_end, $col, $col+1, $row, $row+1,'shrink','shrink',2,2); $col++;
|
2018 |
|
|
|
2019 |
|
|
my $ram_size =gen_label_in_center(" ") ;
|
2020 |
|
|
$table-> attach ($ram_size, $col, $col+1, $row, $row+1,'shrink','shrink',2,2); $col++;
|
2021 |
|
|
|
2022 |
|
|
|
2023 |
|
|
|
2024 |
|
|
|
2025 |
|
|
update_ram_rom_size($self,$tile_num,'RAM',$ram_size,$ram_start,$ram_end,$conflict);
|
2026 |
|
|
|
2027 |
|
|
$ram_start->signal_connect ( 'changed', sub {update_ram_rom_size($self,$tile_num,'RAM',$ram_size,$ram_start,$ram_end,$conflict);});
|
2028 |
|
|
$ram_end->signal_connect ( 'changed', sub {update_ram_rom_size($self,$tile_num,'RAM',$ram_size,$ram_start,$ram_end,$conflict);});
|
2029 |
|
|
|
2030 |
|
|
$ram_width->signal_connect("value_changed" => sub{
|
2031 |
|
|
my $w=$ram_width->get_value();
|
2032 |
|
|
$self->object_add_attribute('MEM'.$tile_num,'width',$w);
|
2033 |
|
|
$size->set_label (metric_conversion(1 << ($w+2)). "B") ;
|
2034 |
|
|
$size->show_all;
|
2035 |
|
|
$enter->clicked;
|
2036 |
|
|
});
|
2037 |
|
|
$percent->signal_connect("value_changed" => sub{
|
2038 |
|
|
$self->object_add_attribute('MEM'.$tile_num,'percent',$percent->get_value());
|
2039 |
|
|
});
|
2040 |
|
|
|
2041 |
|
|
$table-> attach ($conflict, $col, $col+1, $row, $row+1,'shrink','shrink',2,2); $col++;
|
2042 |
|
|
|
2043 |
|
|
|
2044 |
|
|
|
2045 |
|
|
|
2046 |
|
|
$enter-> signal_connect ( 'clicked' , sub {
|
2047 |
|
|
my $w=$ram_width->get_value();
|
2048 |
|
|
my $s =(1 << ($w+2));
|
2049 |
|
|
my $p = $percent->get_value();
|
2050 |
|
|
|
2051 |
|
|
my $rom_start_v = 0;
|
2052 |
|
|
my $rom_end_v= int ( ($s*$p)/100);
|
2053 |
|
|
my $ram_start_v= int (($s*$p)/100);
|
2054 |
|
|
my $ram_end_v= $s;
|
2055 |
|
|
|
2056 |
|
|
$rom_start->set_value($rom_start_v);
|
2057 |
|
|
$rom_end->set_value($rom_end_v);
|
2058 |
|
|
$ram_start->set_value($ram_start_v);
|
2059 |
|
|
$ram_end->set_value($ram_end_v);
|
2060 |
|
|
update_ram_rom_size($self,$tile_num,'ROM',$rom_size,$rom_start,$rom_end,$conflict);
|
2061 |
|
|
update_ram_rom_size($self,$tile_num,'RAM',$ram_size,$ram_start,$ram_end,$conflict);
|
2062 |
|
|
|
2063 |
|
|
});
|
2064 |
|
|
|
2065 |
|
|
$col=0; $row++;
|
2066 |
|
|
|
2067 |
|
|
}#$tile_num
|
2068 |
|
|
|
2069 |
|
|
my $main_table=def_table(10,10,FALSE);
|
2070 |
|
|
|
2071 |
|
|
my $ok = def_image_button('icons/select.png','OK');
|
2072 |
|
|
$main_table->attach_defaults ($table , 0, 12, 0,11);
|
2073 |
|
|
$main_table->attach ($ok,5, 6, 11,12,'shrink','shrink',0,0);
|
2074 |
|
|
|
2075 |
|
|
$ok->signal_connect('clicked', sub {
|
2076 |
|
|
for (my $t=0;$t<$tnum;$t++){
|
2077 |
|
|
my $r0 =$self->object_get_attribute("ROM$t",'start');
|
2078 |
|
|
my $r1 =$self->object_get_attribute("ROM$t",'end');
|
2079 |
|
|
my $r2 =$self->object_get_attribute("RAM$t",'start');
|
2080 |
|
|
my $r3 =$self->object_get_attribute("RAM$t",'end');
|
2081 |
|
|
if(hex($r1) <hex($r0) || hex($r3) <hex($r2) ){
|
2082 |
|
|
message_dialog("Please fix tile $t invalid range !");
|
2083 |
|
|
return ;
|
2084 |
|
|
|
2085 |
|
|
}
|
2086 |
|
|
|
2087 |
|
|
if(hex($r1) > hex($r2) ){
|
2088 |
|
|
message_dialog("Please fix tile $t conflict range !");
|
2089 |
|
|
return ;
|
2090 |
|
|
|
2091 |
|
|
}
|
2092 |
|
|
|
2093 |
|
|
|
2094 |
|
|
|
2095 |
|
|
}
|
2096 |
|
|
create_linker_var_file($self);
|
2097 |
|
|
$win->destroy();
|
2098 |
|
|
|
2099 |
|
|
|
2100 |
|
|
});
|
2101 |
|
|
|
2102 |
|
|
|
2103 |
|
|
add_widget_to_scrolled_win($main_table,$sc_win);
|
2104 |
|
|
$win->add($sc_win);
|
2105 |
|
|
$win->show_all();
|
2106 |
|
|
|
2107 |
|
|
}
|
2108 |
|
|
|
2109 |
|
|
|
2110 |
|
|
sub create_linker_var_file{
|
2111 |
|
|
my ($self)=@_;
|
2112 |
|
|
my $mpsoc_name=$self->object_get_attribute('mpsoc_name');
|
2113 |
|
|
my $tnum;
|
2114 |
|
|
|
2115 |
|
|
my $width = $self->object_get_attribute('MEM0','width');
|
2116 |
|
|
if(!defined $width){
|
2117 |
|
|
linker_initial_setting ($self);
|
2118 |
|
|
}
|
2119 |
|
|
|
2120 |
|
|
if(defined $mpsoc_name){#it is an mpsoc
|
2121 |
|
|
my ($NE, $NR, $RAw, $EAw, $Fw)=get_topology_info($self);
|
2122 |
|
|
$tnum=$NE;
|
2123 |
|
|
}
|
2124 |
|
|
else
|
2125 |
|
|
{
|
2126 |
|
|
|
2127 |
|
|
$tnum=1;
|
2128 |
|
|
}
|
2129 |
|
|
|
2130 |
|
|
for (my $t=0;$t<$tnum;$t++){
|
2131 |
|
|
my $r0 =$self->object_get_attribute("ROM$t",'start');
|
2132 |
|
|
my $r1 =$self->object_get_attribute("ROM$t",'end');
|
2133 |
|
|
my $r2 =$self->object_get_attribute("RAM$t",'start');
|
2134 |
|
|
my $r3 =$self->object_get_attribute("RAM$t",'end');
|
2135 |
|
|
|
2136 |
|
|
my $file=sprintf("
|
2137 |
|
|
|
2138 |
|
|
MEMORY
|
2139 |
|
|
{
|
2140 |
|
|
rom (rx) : ORIGIN = 0x%x , LENGTH = 0x%x /* %s B- Rom space */
|
2141 |
|
|
ram (wrx) : ORIGIN = 0x%x , LENGTH = 0x%x /* %s B- Ram space */
|
2142 |
|
|
}
|
2143 |
|
|
|
2144 |
|
|
",$r0,$r1 - $r0, metric_conversion($r1 - $r0),$r2,$r3- $r2,metric_conversion($r3 - $r2));
|
2145 |
|
|
|
2146 |
|
|
if(defined $mpsoc_name){
|
2147 |
|
|
save_file ("$ENV{'PRONOC_WORK'}/MPSOC/$mpsoc_name/sw/tile$t/linkvar.ld",$file) if(-d "$ENV{'PRONOC_WORK'}/MPSOC/$mpsoc_name/sw/tile$t/");
|
2148 |
|
|
}else{
|
2149 |
|
|
my $soc_name=$self->object_get_attribute('soc_name');
|
2150 |
|
|
my $p1="$ENV{'PRONOC_WORK'}/SOC/$soc_name/sw/";
|
2151 |
|
|
mkpath("$p1",1,0755) unless (-d "$p1");
|
2152 |
|
|
save_file ("$p1/linkvar.ld",$file)
|
2153 |
|
|
}
|
2154 |
|
|
}
|
2155 |
|
|
|
2156 |
|
|
}
|
2157 |
|
|
|
2158 |
|
|
|
2159 |
34 |
alirezamon |
sub software_edit_mpsoc {
|
2160 |
43 |
alirezamon |
my $self=shift;
|
2161 |
|
|
my $name=$self->object_get_attribute('mpsoc_name');
|
2162 |
|
|
if (length($name)==0){
|
2163 |
|
|
message_dialog("Please define the MPSoC name!");
|
2164 |
|
|
return ;
|
2165 |
|
|
}
|
2166 |
|
|
my $target_dir = "$ENV{'PRONOC_WORK'}/MPSOC/$name";
|
2167 |
|
|
my $sw = "$target_dir/sw";
|
2168 |
|
|
|
2169 |
48 |
alirezamon |
my $orcc_page=select_orcc_generated_srcs($self);
|
2170 |
|
|
my $orcc_lable=def_image_label('icons/orcc.png','Auto-generate Software using ORCC');
|
2171 |
|
|
my @pages=($orcc_page);
|
2172 |
|
|
my @pages_lables=($orcc_lable);
|
2173 |
|
|
my ($app,$table,$tview) = software_main($sw,undef,\@pages,\@pages_lables);
|
2174 |
43 |
alirezamon |
|
2175 |
48 |
alirezamon |
my $prog= def_image_button('icons/write.png','Program FPGA\'s BRAMs');
|
2176 |
|
|
my $linker = def_image_button('icons/setting.png','LD Linker',FALSE,1);
|
2177 |
|
|
my $make = def_image_button('icons/gen.png','_Compile',FALSE,1);
|
2178 |
|
|
my $ram = def_image_button('icons/info.png',"Required BRAMs\' size",FALSE,1);
|
2179 |
43 |
alirezamon |
|
2180 |
48 |
alirezamon |
$table->attach ($ram,0, 1, 1,2,'shrink','shrink',0,0);
|
2181 |
|
|
$table->attach ($linker,4, 5, 1,2,'shrink','shrink',0,0);
|
2182 |
43 |
alirezamon |
$table->attach ($make,5, 6, 1,2,'shrink','shrink',0,0);
|
2183 |
|
|
$table->attach ($prog,9, 10, 1,2,'shrink','shrink',0,0);
|
2184 |
|
|
|
2185 |
48 |
alirezamon |
$ram -> signal_connect("clicked" => sub{
|
2186 |
|
|
show_reqired_brams($self,$tview);
|
2187 |
|
|
});
|
2188 |
|
|
|
2189 |
|
|
my $load;
|
2190 |
|
|
|
2191 |
43 |
alirezamon |
$make -> signal_connect("clicked" => sub{
|
2192 |
48 |
alirezamon |
$load->destroy if(defined $load);
|
2193 |
|
|
$load= show_gif("icons/load.gif");
|
2194 |
43 |
alirezamon |
$table->attach ($load,7, 8, 1,2,'shrink','shrink',0,0);
|
2195 |
|
|
$load->show_all;
|
2196 |
48 |
alirezamon |
$app->ask_to_save_changes();
|
2197 |
|
|
add_info($tview,' ');
|
2198 |
|
|
unless (run_make_file($sw,$tview,'clean')){
|
2199 |
|
|
$load->destroy;
|
2200 |
|
|
$load=def_icon("icons/cancel.png");
|
2201 |
|
|
$table->attach ($load,7, 8, 1,2,'shrink','shrink',0,0);
|
2202 |
|
|
$load->show_all;
|
2203 |
|
|
return;
|
2204 |
|
|
};
|
2205 |
|
|
unless (run_make_file($sw,$tview)){
|
2206 |
|
|
$load->destroy;
|
2207 |
|
|
$load=def_icon("icons/cancel.png");
|
2208 |
|
|
$table->attach ($load,7, 8, 1,2,'shrink','shrink',0,0);
|
2209 |
|
|
$load->show_all;
|
2210 |
|
|
return;
|
2211 |
|
|
}
|
2212 |
|
|
$load->destroy;
|
2213 |
|
|
$load=def_icon("icons/button_ok.png");
|
2214 |
|
|
$table->attach ($load,7, 8, 1,2,'shrink','shrink',0,0);
|
2215 |
|
|
$load->show_all;
|
2216 |
|
|
|
2217 |
16 |
alirezamon |
|
2218 |
43 |
alirezamon |
});
|
2219 |
|
|
|
2220 |
|
|
#Programe the board
|
2221 |
|
|
$prog-> signal_connect("clicked" => sub{
|
2222 |
|
|
my $error = 0;
|
2223 |
|
|
my $bash_file="$sw/program.sh";
|
2224 |
|
|
my $jtag_intfc="$sw/jtag_intfc.sh";
|
2225 |
|
|
|
2226 |
48 |
alirezamon |
add_info($tview,"Program the board using quartus_pgm and $bash_file file\n");
|
2227 |
43 |
alirezamon |
#check if the programming file exists
|
2228 |
|
|
unless (-f $bash_file) {
|
2229 |
48 |
alirezamon |
add_colored_info($tview,"\tThe $bash_file does not exists! \n", 'red');
|
2230 |
43 |
alirezamon |
$error=1;
|
2231 |
|
|
}
|
2232 |
|
|
#check if the jtag_intfc.sh file exists
|
2233 |
|
|
unless (-f $jtag_intfc) {
|
2234 |
48 |
alirezamon |
add_colored_info($tview,"\tThe $jtag_intfc does not exists!. Press the compile button and select your FPGA board first to generate $jtag_intfc file\n", 'red');
|
2235 |
43 |
alirezamon |
$error=1;
|
2236 |
|
|
}
|
2237 |
|
|
|
2238 |
|
|
return if($error);
|
2239 |
45 |
alirezamon |
my $command = "cd $sw; bash program.sh";
|
2240 |
48 |
alirezamon |
add_info($tview,"$command\n");
|
2241 |
43 |
alirezamon |
my ($stdout,$exit,$stderr)=run_cmd_in_back_ground_get_stdout($command);
|
2242 |
|
|
if(length $stderr>1){
|
2243 |
48 |
alirezamon |
add_colored_info($tview,"$stderr\n",'red');
|
2244 |
|
|
add_colored_info($tview,"Memory was not programmed successfully!\n",'red');
|
2245 |
43 |
alirezamon |
}else {
|
2246 |
16 |
alirezamon |
|
2247 |
43 |
alirezamon |
if($exit){
|
2248 |
48 |
alirezamon |
add_colored_info($tview,"$stdout\n",'red');
|
2249 |
|
|
add_colored_info($tview,"Memory was not programmed successfully!\n",'red');
|
2250 |
43 |
alirezamon |
}else{
|
2251 |
48 |
alirezamon |
add_info($tview,"$stdout\n");
|
2252 |
|
|
add_colored_info($tview,"Memory is programmed successfully!\n",'blue');
|
2253 |
42 |
alirezamon |
|
2254 |
43 |
alirezamon |
}
|
2255 |
|
|
|
2256 |
|
|
}
|
2257 |
|
|
});
|
2258 |
48 |
alirezamon |
|
2259 |
|
|
|
2260 |
|
|
$linker -> signal_connect("clicked" => sub{
|
2261 |
|
|
linker_setting($self,$tview);
|
2262 |
|
|
});
|
2263 |
42 |
alirezamon |
|
2264 |
34 |
alirezamon |
}
|
2265 |
16 |
alirezamon |
|
2266 |
|
|
|
2267 |
34 |
alirezamon |
|
2268 |
38 |
alirezamon |
#############
|
2269 |
43 |
alirezamon |
# load_mpsoc
|
2270 |
38 |
alirezamon |
#############
|
2271 |
34 |
alirezamon |
|
2272 |
38 |
alirezamon |
sub load_mpsoc{
|
2273 |
43 |
alirezamon |
my ($mpsoc,$info)=@_;
|
2274 |
|
|
my $file;
|
2275 |
48 |
alirezamon |
my $dialog = gen_file_dialog (undef, 'MPSOC');
|
2276 |
|
|
my $dir = Cwd::getcwd();
|
2277 |
43 |
alirezamon |
$dialog->set_current_folder ("$dir/lib/mpsoc") ;
|
2278 |
|
|
my @newsocs=$mpsoc->mpsoc_get_soc_list();
|
2279 |
48 |
alirezamon |
add_info($info,'');
|
2280 |
43 |
alirezamon |
if ( "ok" eq $dialog->run ) {
|
2281 |
|
|
$file = $dialog->get_filename;
|
2282 |
|
|
my ($name,$path,$suffix) = fileparse("$file",qr"\..[^.]*$");
|
2283 |
|
|
if($suffix eq '.MPSOC'){
|
2284 |
|
|
my ($pp,$r,$err) = regen_object($file );
|
2285 |
|
|
if ($r){
|
2286 |
48 |
alirezamon |
add_info($info,"**Error: cannot open $file file: $err\n");
|
2287 |
|
|
$dialog->destroy;
|
2288 |
43 |
alirezamon |
return;
|
2289 |
|
|
}
|
2290 |
|
|
|
2291 |
34 |
alirezamon |
|
2292 |
43 |
alirezamon |
clone_obj($mpsoc,$pp);
|
2293 |
|
|
#read save mpsoc socs
|
2294 |
|
|
my @oldsocs=$mpsoc->mpsoc_get_soc_list();
|
2295 |
48 |
alirezamon |
#add existing SoCs and add them to mpsoc
|
2296 |
43 |
alirezamon |
|
2297 |
|
|
my $error;
|
2298 |
|
|
#print "old: @oldsocs\n new @newsocs \n";
|
2299 |
|
|
foreach my $p (@oldsocs) {
|
2300 |
|
|
#print "$p\n";
|
2301 |
|
|
my @num= $mpsoc->mpsoc_get_soc_tiles_num($p);
|
2302 |
|
|
if (scalar @num && ( grep (/^$p$/,@newsocs)==0)){
|
2303 |
48 |
alirezamon |
my $m="Processing tile $p that has been used for ties @num but is not located in library anymore\n";
|
2304 |
43 |
alirezamon |
$error = (defined $error ) ? "$error $m" : $m;
|
2305 |
|
|
}
|
2306 |
|
|
$mpsoc->mpsoc_remove_soc ($p) if (grep (/^$p$/,@newsocs)==0);
|
2307 |
|
|
|
2308 |
34 |
alirezamon |
|
2309 |
43 |
alirezamon |
}
|
2310 |
|
|
@newsocs=get_soc_list($mpsoc,$info); # add all existing socs
|
2311 |
48 |
alirezamon |
add_info($info,"**Error: \n $error\n") if(defined $error);
|
2312 |
38 |
alirezamon |
|
2313 |
43 |
alirezamon |
set_gui_status($mpsoc,"load_file",0);
|
2314 |
|
|
|
2315 |
|
|
}
|
2316 |
38 |
alirezamon |
}
|
2317 |
|
|
$dialog->destroy;
|
2318 |
|
|
}
|
2319 |
|
|
|
2320 |
48 |
alirezamon |
#######
|
2321 |
|
|
# CLK setting
|
2322 |
|
|
#######
|
2323 |
|
|
|
2324 |
|
|
sub clk_setting_win1{
|
2325 |
|
|
my ($self,$info,$type)=@_;
|
2326 |
|
|
|
2327 |
|
|
my $window = def_popwin_size(80,80,"CLK setting",'percent');
|
2328 |
|
|
|
2329 |
|
|
my $next=def_image_button('icons/right.png','Next');
|
2330 |
|
|
my $mtable = def_table(10, 1, FALSE);
|
2331 |
|
|
#get the list of all tiles clk sources
|
2332 |
|
|
|
2333 |
|
|
my @sources=('clk','reset');
|
2334 |
|
|
|
2335 |
|
|
my $table = def_table(10, 7, FALSE);
|
2336 |
|
|
my $notebook = gen_notebook();
|
2337 |
|
|
$notebook->set_scrollable(TRUE);
|
2338 |
|
|
#$notebook->can_focus(FALSE);
|
2339 |
|
|
$notebook->set_tab_pos ('left');
|
2340 |
|
|
|
2341 |
|
|
|
2342 |
|
|
|
2343 |
|
|
my($row,$column)=(0,0);
|
2344 |
|
|
|
2345 |
|
|
my %all = ($type eq 'mpsoc') ? get_all_tiles_clk_sources_list($self): get_soc_clk_source_list($self) ;
|
2346 |
|
|
foreach my $s (@sources){
|
2347 |
|
|
my $spin;
|
2348 |
|
|
($row,$column,$spin)= add_param_widget($self,"$s number","${s}_number", 1,'Spin-button',"1,1024,1","Define total number of ${s} input ports mpsoc", $table,$row,$column,1,'SOURCE_SET',undef,undef,'horizontal');
|
2349 |
|
|
|
2350 |
|
|
my $w=get_source_assignment_win($self,$s,$all{$s},$type);
|
2351 |
|
|
my $box=def_hbox(FALSE,0);
|
2352 |
|
|
$box->pack_start($w, TRUE, TRUE, 0);
|
2353 |
|
|
$notebook->append_page ($box,gen_label_in_center ($s));
|
2354 |
|
|
$spin->signal_connect("value_changed" => sub{
|
2355 |
|
|
$self->object_add_attribute('SOURCE_SET',"REDEFINE_TOP",1);
|
2356 |
|
|
$w->destroy;
|
2357 |
|
|
$w=get_source_assignment_win($self,$s,$all{$s},$type);
|
2358 |
|
|
$box->pack_start($w, TRUE, TRUE, 0);
|
2359 |
|
|
$box->show_all;
|
2360 |
|
|
|
2361 |
|
|
});
|
2362 |
|
|
|
2363 |
|
|
}
|
2364 |
|
|
|
2365 |
|
|
$mtable->attach_defaults($table,0,1,0,1);
|
2366 |
|
|
$mtable->attach_defaults( $notebook,0,1,1,20);
|
2367 |
|
|
$mtable->attach($next,0,1,20,21,'expand','fill',2,2);
|
2368 |
|
|
$window->add ($mtable);
|
2369 |
|
|
$window->show_all();
|
2370 |
|
|
$next-> signal_connect("clicked" => sub{
|
2371 |
|
|
clk_setting_win2($self,$info,$type);
|
2372 |
|
|
$window->destroy;
|
2373 |
|
|
|
2374 |
|
|
});
|
2375 |
|
|
|
2376 |
|
|
}
|
2377 |
|
|
|
2378 |
|
|
|
2379 |
|
|
sub update_wave_form {
|
2380 |
|
|
my ($period,$rise,$fall,$r_lab,$f_lab)=@_;
|
2381 |
|
|
my $p =$period->get_value();
|
2382 |
|
|
my $n =$rise->get_value();
|
2383 |
|
|
my $v= ($p * $n)/100;
|
2384 |
|
|
$r_lab->set_text("=$v ns");
|
2385 |
|
|
$n =$fall->get_value();
|
2386 |
|
|
$v= ($p * $n)/100;
|
2387 |
|
|
$f_lab->set_text("=$v ns");
|
2388 |
|
|
}
|
2389 |
|
|
|
2390 |
|
|
sub get_source_assignment_win{
|
2391 |
|
|
my ($mpsoc,$s,$ports_ref,$type)=@_;
|
2392 |
|
|
my$row=0;
|
2393 |
|
|
my $column=0;
|
2394 |
|
|
my $num = $mpsoc->object_get_attribute('SOURCE_SET',"${s}_number");
|
2395 |
|
|
my $table1 = def_table(20, 20, FALSE);
|
2396 |
|
|
my $win1=add_widget_to_scrolled_win($table1);
|
2397 |
|
|
my $win2;
|
2398 |
|
|
my $v2;
|
2399 |
|
|
|
2400 |
|
|
#if($s eq 'clk'){
|
2401 |
|
|
# my @labels=("clk name", 'Frequency MHz', 'Period ns', 'rise edge times ns', 'fall edge times ns');
|
2402 |
|
|
# foreach my $l (@labels){
|
2403 |
|
|
# $table1->attach (gen_label_in_center($l),$column,$column+1,$row,$row+1,'fill','shrink',2,2);$column+=5;
|
2404 |
|
|
# }
|
2405 |
|
|
#$row++;
|
2406 |
|
|
#$column=0;
|
2407 |
|
|
#}
|
2408 |
|
|
|
2409 |
|
|
#get source signal names
|
2410 |
|
|
my $loc = 'vertical';
|
2411 |
|
|
for(my $n=0;$n<$num; $n++ ){
|
2412 |
|
|
my $entry;
|
2413 |
|
|
my $enter= def_image_button("icons/enter.png");
|
2414 |
|
|
my $box=def_hbox(FALSE,0);
|
2415 |
|
|
$box->pack_start( $enter, FALSE, FALSE, 0);
|
2416 |
|
|
|
2417 |
|
|
($row,$column,$entry)= add_param_widget($mpsoc,"$n-","${s}_${n}_name", "${s}$n",'Entry',undef,undef, $table1,$row,$column,1,'SOURCE_SET',undef,undef,'horizontal');
|
2418 |
|
|
$table1->attach ($box,$column,$column+1,$row,$row+1,'fill','shrink',2,2);$column++;
|
2419 |
|
|
|
2420 |
|
|
$enter->signal_connect ("clicked" => sub{
|
2421 |
|
|
$mpsoc->object_add_attribute('SOURCE_SET',"REDEFINE_TOP",1);
|
2422 |
|
|
$win2->destroy;
|
2423 |
|
|
$win2= get_source_assignment_win2($mpsoc,$s,$ports_ref,$type);
|
2424 |
|
|
$v2-> pack2($win2, TRUE, TRUE);
|
2425 |
|
|
$v2->show_all;
|
2426 |
|
|
});
|
2427 |
|
|
|
2428 |
|
|
|
2429 |
|
|
if($s eq 'clk'){
|
2430 |
|
|
($column,$row)=get_clk_constrain_widget($mpsoc,$table1,$column,$row, $s,$n);
|
2431 |
|
|
}
|
2432 |
|
|
|
2433 |
|
|
|
2434 |
|
|
|
2435 |
|
|
# if((($n+1) % 4)==0){
|
2436 |
|
|
$column=0;
|
2437 |
|
|
$row++;
|
2438 |
|
|
#}
|
2439 |
|
|
}
|
2440 |
|
|
|
2441 |
|
|
#source assigmnmet
|
2442 |
|
|
$win2= get_source_assignment_win2($mpsoc,$s,$ports_ref,$type);
|
2443 |
|
|
$v2=gen_vpaned($win1,.2,$win2);
|
2444 |
|
|
return $v2;
|
2445 |
|
|
}
|
2446 |
|
|
|
2447 |
|
|
|
2448 |
|
|
sub get_clk_constrain_widget {
|
2449 |
|
|
my ($self,$table,$column,$row, $s,$n)=@_;
|
2450 |
|
|
$table->attach (gen_Vsep() , $column,$column+1,$row,$row+1,'fill','fill',2,2);$column+=1;
|
2451 |
|
|
return ($column,$row);
|
2452 |
|
|
my $frequency;
|
2453 |
|
|
($row,$column,$frequency)= add_param_widget($self,"Frequency(MHz)","${s}_${n}_mhz", 100,'Spin-button',"1,1024,0.01",undef, $table,$row,$column,1,'SOURCE_SET',undef,undef,'horizontal');
|
2454 |
|
|
$table->attach (gen_Vsep() , $column,$column+1,$row,$row+1,'fill','fill',2,2);$column+=1;
|
2455 |
|
|
my $period;
|
2456 |
|
|
($row,$column,$period)= add_param_widget($self,"Period(ns)","${s}_${n}_period", 10,'Spin-button',"0,1024,0.01",undef, $table,$row,$column,1,'SOURCE_SET',undef,undef,'horizontal');
|
2457 |
|
|
$table->attach (gen_Vsep() , $column,$column+1,$row,$row+1,'fill','fill',2,2);$column+=1;
|
2458 |
|
|
my $rise;
|
2459 |
|
|
($row,$column,$rise)= add_param_widget($self,"rising edge(%)","${s}_${n}_rise", 0,'Spin-button',"0,100,0.1",undef, $table,$row,$column,1,'SOURCE_SET',undef,undef,'horizontal');
|
2460 |
|
|
my $r_lab=gen_label_in_center('=0 ns');
|
2461 |
|
|
$table->attach ($r_lab,$column,$column+1,$row,$row+1,'fill','shrink',2,2);$column+=1;
|
2462 |
|
|
$table->attach (gen_Vsep() , $column,$column+1,$row,$row+1,'fill','fill',2,2);$column+=1;
|
2463 |
|
|
my $fall;
|
2464 |
|
|
($row,$column,$fall)= add_param_widget($self,"falling edge(%)","${s}_${n}_fall", 50,'Spin-button',"0,100,0.1",undef, $table,$row,$column,1,'SOURCE_SET',undef,undef,'horizontal');
|
2465 |
|
|
my $f_lab=gen_label_in_center('=5 ns');
|
2466 |
|
|
$table->attach ($f_lab,$column,$column+1,$row,$row+1,'fill','shrink',2,2);$column+=1;
|
2467 |
|
|
update_wave_form($period,$rise,$fall,$r_lab,$f_lab);
|
2468 |
|
|
$frequency-> signal_connect("value_changed" => sub{
|
2469 |
|
|
my $fr =$frequency->get_value();
|
2470 |
|
|
my $p = 1000/$fr;
|
2471 |
|
|
$period->set_value($p);
|
2472 |
|
|
update_wave_form($period,$rise,$fall,$r_lab,$f_lab);
|
2473 |
|
|
});
|
2474 |
|
|
$period-> signal_connect("value_changed" => sub{
|
2475 |
|
|
my $p =$period->get_value();
|
2476 |
|
|
my $fr = 1000/$p;
|
2477 |
|
|
$frequency->set_value($fr);
|
2478 |
|
|
update_wave_form($period,$rise,$fall,$r_lab,$f_lab);
|
2479 |
|
|
});
|
2480 |
|
|
$rise-> signal_connect("value_changed" => sub{
|
2481 |
|
|
update_wave_form($period,$rise,$fall,$r_lab,$f_lab);
|
2482 |
|
|
});
|
2483 |
|
|
$fall-> signal_connect("value_changed" => sub{
|
2484 |
|
|
update_wave_form($period,$rise,$fall,$r_lab,$f_lab);
|
2485 |
|
|
});
|
2486 |
|
|
return ($column,$row);
|
2487 |
|
|
}
|
2488 |
|
|
|
2489 |
|
|
|
2490 |
|
|
|
2491 |
|
|
sub get_source_assignment_win2{
|
2492 |
|
|
my ($mpsoc,$s,$ports_ref,$type)=@_;
|
2493 |
|
|
my $num = $mpsoc->object_get_attribute('SOURCE_SET',"${s}_number");
|
2494 |
|
|
my $table2 = def_table(10, 7, FALSE);
|
2495 |
|
|
my $win2=add_widget_to_scrolled_win($table2);
|
2496 |
|
|
my %ports = %{$ports_ref} if(defined $ports_ref);
|
2497 |
|
|
|
2498 |
|
|
my $contents;
|
2499 |
|
|
for(my $n=0;$n<$num; $n++ ){
|
2500 |
|
|
my $m=$mpsoc->object_get_attribute('SOURCE_SET',"${s}_${n}_name");
|
2501 |
|
|
$contents=(defined $contents)? "$contents,$m":$m;
|
2502 |
|
|
}
|
2503 |
|
|
my $default=$mpsoc->object_get_attribute('SOURCE_SET',"${s}_0_name");
|
2504 |
|
|
my $n=0;
|
2505 |
|
|
my($row,$column)=(0,0);
|
2506 |
|
|
if($type eq 'mpsoc' ) {
|
2507 |
|
|
add_param_widget($mpsoc," NoC $s","NoC_${s}", $default,'Combo-box',$contents,undef, $table2,$row,$column,1,'SOURCE_SET_CONNECT',undef,undef,'horizontal');
|
2508 |
|
|
($row,$column)=(1,0);
|
2509 |
|
|
}
|
2510 |
|
|
|
2511 |
|
|
foreach my $p (sort keys %ports){
|
2512 |
|
|
my @array=@{$ports{$p}};
|
2513 |
|
|
foreach my $q (@array){
|
2514 |
|
|
my $param="${p}_$q";
|
2515 |
|
|
my $label=" ${p}_$q";
|
2516 |
|
|
($row,$column)= add_param_widget($mpsoc,$label,$param, $default,'Combo-box',$contents,undef, $table2,$row,$column,1,'SOURCE_SET_CONNECT',undef,undef,'horizontal');
|
2517 |
|
|
if((($n+1) % 4)==0){$column=0;$row++;}$n++;
|
2518 |
|
|
}
|
2519 |
|
|
}
|
2520 |
|
|
return $win2;
|
2521 |
|
|
|
2522 |
|
|
}
|
2523 |
|
|
|
2524 |
|
|
|
2525 |
|
|
sub get_all_tiles_clk_sources_list{
|
2526 |
|
|
my $mpsoc=shift;
|
2527 |
|
|
my ($NE, $NR, $RAw, $EAw, $Fw)= get_topology_info ($mpsoc);
|
2528 |
|
|
my %all_sources;
|
2529 |
|
|
for (my $tile_num=0;$tile_num<$NE;$tile_num++){
|
2530 |
|
|
my ($soc_name,$n,$soc_num)=$mpsoc->mpsoc_get_tile_soc_name($tile_num);
|
2531 |
|
|
next if(!defined $soc_name);
|
2532 |
|
|
my $top=$mpsoc->mpsoc_get_soc($soc_name);
|
2533 |
|
|
my @intfcs=$top->top_get_intfc_list();
|
2534 |
|
|
|
2535 |
|
|
my @sources=('clk','reset');
|
2536 |
|
|
|
2537 |
|
|
foreach my $intfc (@intfcs){
|
2538 |
|
|
my($type,$name,$num)= split("[:\[ \\]]", $intfc);
|
2539 |
|
|
foreach my $s (@sources){
|
2540 |
|
|
if ($intfc =~ /plug:$s/){
|
2541 |
|
|
my @ports=$top->top_get_intfc_ports_list($intfc);
|
2542 |
|
|
$all_sources{$s}{"T$tile_num"}=\@ports;
|
2543 |
|
|
}
|
2544 |
|
|
}
|
2545 |
|
|
|
2546 |
|
|
}
|
2547 |
|
|
}
|
2548 |
|
|
return %all_sources;
|
2549 |
|
|
}
|
2550 |
|
|
|
2551 |
|
|
|
2552 |
|
|
|
2553 |
|
|
sub clk_setting_win2{
|
2554 |
|
|
my ($self,$info,$type)=@_;
|
2555 |
|
|
|
2556 |
|
|
my $window = def_popwin_size(70,70,"CLK setting",'percent');
|
2557 |
|
|
my $table = def_table(10, 7, FALSE);
|
2558 |
|
|
my $scrolled_win=add_widget_to_scrolled_win($table);
|
2559 |
|
|
my $ok = def_image_button('icons/select.png','OK');
|
2560 |
|
|
my $back = def_image_button('icons/left.png',undef);
|
2561 |
|
|
my $diagram = def_image_button('icons/diagram.png','Diagram');
|
2562 |
|
|
my $ip = ip->lib_new ();
|
2563 |
|
|
#print "get_top_ip(\$self,$type);\n";
|
2564 |
|
|
my $mpsoc_ip=get_top_ip($self,$type);
|
2565 |
|
|
|
2566 |
|
|
$ip->add_ip($mpsoc_ip);
|
2567 |
|
|
my $soc =get_source_set_top($self,$type);
|
2568 |
|
|
my $infc = interface->interface_new();
|
2569 |
|
|
|
2570 |
|
|
|
2571 |
|
|
set_gui_status($soc,"ideal",0);
|
2572 |
|
|
# A tree view for holding a library
|
2573 |
|
|
my %tree_text;
|
2574 |
|
|
my @categories= ('Source');
|
2575 |
|
|
foreach my $p (@categories)
|
2576 |
|
|
{
|
2577 |
|
|
my @modules= $ip->get_modules($p);
|
2578 |
|
|
$tree_text{$p}=\@modules;
|
2579 |
|
|
}
|
2580 |
|
|
|
2581 |
|
|
my $tree_box = create_tree ($soc,'IP list', $info,\%tree_text,\&tmp,\&add_module_to_mpsoc);
|
2582 |
|
|
my $device_win=show_active_dev($soc,$ip,$infc,$info);
|
2583 |
|
|
my $h1=gen_hpaned($tree_box,.15,$device_win);
|
2584 |
|
|
$table->attach_defaults ($h1,0, 10, 0, 10);
|
2585 |
|
|
|
2586 |
|
|
my $event =Event->timer (after => 1, interval => 1, cb => sub {
|
2587 |
|
|
|
2588 |
|
|
my ($state,$timeout)= get_gui_status($soc);
|
2589 |
|
|
|
2590 |
|
|
|
2591 |
|
|
if ($timeout>0){
|
2592 |
|
|
$timeout--;
|
2593 |
|
|
set_gui_status($soc,$state,$timeout);
|
2594 |
|
|
}
|
2595 |
|
|
elsif( $state ne "ideal" ){
|
2596 |
|
|
|
2597 |
|
|
#check if top is removed add it
|
2598 |
|
|
my @instances=$soc->soc_get_all_instances();
|
2599 |
|
|
my $redefine =1;
|
2600 |
|
|
foreach my $inst (@instances){
|
2601 |
|
|
$redefine = 0 if ($inst eq 'TOP');
|
2602 |
|
|
}
|
2603 |
|
|
if($redefine == 1){
|
2604 |
|
|
my $ip = ip->lib_new ();
|
2605 |
|
|
#print "get_top_ip(\$self,$type);\n";
|
2606 |
|
|
my $mpsoc_ip=get_top_ip($self,$type);
|
2607 |
|
|
|
2608 |
|
|
$ip->add_ip($mpsoc_ip);
|
2609 |
|
|
$soc ->object_add_attribute('SOURCE_SET',"IP",$mpsoc_ip);
|
2610 |
|
|
$self->object_add_attribute('SOURCE_SET',"REDEFINE_TOP",0);
|
2611 |
|
|
add_mpsoc_to_device($soc,$ip);
|
2612 |
|
|
$self->object_add_attribute('SOURCE_SET',"SOC",$soc);
|
2613 |
|
|
}
|
2614 |
|
|
|
2615 |
|
|
$device_win->destroy;
|
2616 |
|
|
|
2617 |
|
|
$device_win=show_active_dev($soc,$ip,$infc,$info);
|
2618 |
|
|
$h1 -> pack2($device_win, TRUE, TRUE);
|
2619 |
|
|
$h1 -> show_all;
|
2620 |
|
|
$table->show_all();
|
2621 |
|
|
$device_win->show_all();
|
2622 |
|
|
|
2623 |
|
|
$self->object_add_attribute('SOURCE_SET',"SOC",$soc);
|
2624 |
|
|
set_gui_status($soc,"ideal",0);
|
2625 |
|
|
|
2626 |
|
|
}
|
2627 |
|
|
return TRUE;
|
2628 |
|
|
|
2629 |
|
|
|
2630 |
|
|
});
|
2631 |
|
|
|
2632 |
|
|
my $mtable = def_table(10, 5, FALSE);
|
2633 |
|
|
$mtable->attach_defaults($scrolled_win,0,5,0,9);
|
2634 |
|
|
$mtable->attach($back,0,1,9,10,'expand','fill',2,2) if($type ne 'soc');
|
2635 |
|
|
$mtable->attach($diagram,2,4,9,10,'expand','fill',2,2);
|
2636 |
|
|
$mtable->attach($ok,4,5,9,10,'expand','fill',2,2);
|
2637 |
|
|
|
2638 |
|
|
$window->add ($mtable);
|
2639 |
|
|
$window->show_all();
|
2640 |
|
|
$self->object_add_attribute('SOURCE_SET',"SOC",$soc);
|
2641 |
|
|
$back-> signal_connect("clicked" => sub{
|
2642 |
|
|
$self->object_add_attribute('SOURCE_SET',"SOC",$soc);
|
2643 |
|
|
clk_setting_win1($self,$info,$type);
|
2644 |
|
|
$window->destroy;
|
2645 |
|
|
$event->cancel;
|
2646 |
|
|
});
|
2647 |
|
|
|
2648 |
|
|
$diagram-> signal_connect("clicked" => sub{
|
2649 |
|
|
show_tile_diagram ($soc);
|
2650 |
|
|
});
|
2651 |
|
|
|
2652 |
|
|
$ok-> signal_connect("clicked" => sub{
|
2653 |
|
|
set_gui_status($self,"ref",1);
|
2654 |
|
|
$window->destroy;
|
2655 |
|
|
$event->cancel;
|
2656 |
|
|
});
|
2657 |
|
|
|
2658 |
|
|
|
2659 |
|
|
|
2660 |
|
|
|
2661 |
|
|
|
2662 |
|
|
|
2663 |
|
|
}
|
2664 |
|
|
|
2665 |
|
|
sub tmp{
|
2666 |
|
|
|
2667 |
|
|
}
|
2668 |
|
|
|
2669 |
|
|
sub add_module_to_mpsoc{
|
2670 |
|
|
my ($soc,$category,$module,$info)=@_;
|
2671 |
|
|
my $ip = ip->lib_new ();
|
2672 |
|
|
|
2673 |
|
|
my ($instance_id,$id)= get_instance_id($soc,$category,$module);
|
2674 |
|
|
|
2675 |
|
|
#add module instance
|
2676 |
|
|
my $result=$soc->soc_add_instance($instance_id,$category,$module,$ip);
|
2677 |
|
|
|
2678 |
|
|
if($result == 0){
|
2679 |
|
|
my $info_text= "Failed to add \"$instance_id\" to SoC. $instance_id is already exist.";
|
2680 |
|
|
show_info($info,$info_text);
|
2681 |
|
|
return;
|
2682 |
|
|
}
|
2683 |
|
|
$soc->soc_add_instance_order($instance_id);
|
2684 |
|
|
# Add IP version
|
2685 |
|
|
my $v=$ip->ip_get($category,$module,"version");
|
2686 |
|
|
$v = 0 if(!defined $v);
|
2687 |
|
|
#print "$v\n";
|
2688 |
|
|
$soc->object_add_attribute($instance_id,"version",$v);
|
2689 |
|
|
# Read default parameter from lib and add them to soc
|
2690 |
|
|
my %param_default= $ip->get_param_default($category,$module);
|
2691 |
|
|
|
2692 |
|
|
my $rr=$soc->soc_add_instance_param($instance_id,\%param_default);
|
2693 |
|
|
if($rr == 0){
|
2694 |
|
|
my $info_text= "Failed to add default parameter to \"$instance_id\". $instance_id does not exist.";
|
2695 |
|
|
show_info($info,$info_text);
|
2696 |
|
|
return;
|
2697 |
|
|
}
|
2698 |
|
|
my @r=$ip->ip_get_param_order($category,$module);
|
2699 |
|
|
$soc->soc_add_instance_param_order($instance_id,\@r);
|
2700 |
|
|
|
2701 |
|
|
get_module_parameter($soc,$ip,$instance_id);
|
2702 |
|
|
undef $ip;
|
2703 |
|
|
set_gui_status($soc,"refresh_soc",0);
|
2704 |
|
|
}
|
2705 |
|
|
|
2706 |
|
|
|
2707 |
|
|
|
2708 |
|
|
|
2709 |
|
|
#$mpsoc,$top_ip,$sw_dir,$soc_name,$id,$soc_num,$txview
|
2710 |
|
|
sub get_top_ip{
|
2711 |
|
|
my ($self,$type)=@_;
|
2712 |
|
|
|
2713 |
|
|
my $mpsoc_ip=ip_gen->ip_gen_new();
|
2714 |
|
|
$mpsoc_ip->ipgen_add("module_name",'TOP');
|
2715 |
|
|
$mpsoc_ip->ipgen_add("ip_name",'TOP');
|
2716 |
|
|
$mpsoc_ip->ipgen_add("category",'TOP');
|
2717 |
|
|
$mpsoc_ip->ipgen_add('GUI_REMOVE_SET','DISABLE');
|
2718 |
|
|
if($type eq 'mpsoc'){
|
2719 |
|
|
my @sources=('clk','reset');
|
2720 |
|
|
foreach my $s (@sources){
|
2721 |
|
|
my $num = $self->object_get_attribute('SOURCE_SET',"${s}_number");
|
2722 |
|
|
$num=1 if(!defined $num);
|
2723 |
|
|
$mpsoc_ip->ipgen_add_plug("$s",'num',$num);
|
2724 |
|
|
for (my $n=0; $n<$num; $n++ ){
|
2725 |
|
|
|
2726 |
|
|
my $name=$self->object_get_attribute('SOURCE_SET',"${s}_${n}_name");
|
2727 |
|
|
$mpsoc_ip->ipgen_set_plug_name($s,$n,$name);
|
2728 |
|
|
$mpsoc_ip->ipgen_add_port($name,undef,'input',"plug:${s}\[$n\]","${s}_i");
|
2729 |
|
|
|
2730 |
|
|
}
|
2731 |
|
|
}
|
2732 |
|
|
# add_mpsoc_ip_other_interfaces($mpsoc,$mpsoc_ip);
|
2733 |
|
|
}
|
2734 |
|
|
else{
|
2735 |
|
|
my %sources = get_soc_clk_source_list($self);
|
2736 |
|
|
foreach my $s (sort keys %sources){
|
2737 |
|
|
my @ports = @{$sources{$s}} if (defined $sources{$s});
|
2738 |
|
|
my $num=scalar @ports;
|
2739 |
|
|
$mpsoc_ip->ipgen_add_plug("$s",'num',$num);
|
2740 |
|
|
my $n=0;
|
2741 |
|
|
foreach my $p (@ports){
|
2742 |
|
|
$mpsoc_ip->ipgen_set_plug_name($s,$n,$p);
|
2743 |
|
|
$mpsoc_ip->ipgen_add_port($p,undef,'input',"plug:${s}\[$n\]","${s}_i");
|
2744 |
|
|
$n++;
|
2745 |
|
|
}
|
2746 |
|
|
}
|
2747 |
|
|
}
|
2748 |
|
|
return $mpsoc_ip;
|
2749 |
|
|
}
|
2750 |
|
|
|
2751 |
|
|
|
2752 |
|
|
sub add_mpsoc_ip_other_interfaces{
|
2753 |
|
|
my ($mpsoc,$mpsoc_ip)=@_;
|
2754 |
|
|
my ($NE, $NR, $RAw, $EAw, $Fw)= get_topology_info ($mpsoc);
|
2755 |
|
|
my $processors_en=0;
|
2756 |
|
|
my %intfc_num;
|
2757 |
|
|
my @parameters_order;
|
2758 |
|
|
for (my $tile_num=0;$tile_num<$NE;$tile_num++){
|
2759 |
|
|
my ($soc_name,$n,$soc_num)=$mpsoc->mpsoc_get_tile_soc_name($tile_num);
|
2760 |
|
|
|
2761 |
|
|
|
2762 |
|
|
my $top=$mpsoc->mpsoc_get_soc($soc_name);
|
2763 |
|
|
my @nis=get_NI_instance_list($top);
|
2764 |
|
|
my @noc_param=$top->top_get_parameter_list($nis[0]);
|
2765 |
|
|
my $inst_name=$top->top_get_def_of_instance($nis[0],'instance');
|
2766 |
|
|
|
2767 |
|
|
#other parameters
|
2768 |
|
|
my %params=$top->top_get_default_soc_param();
|
2769 |
|
|
|
2770 |
|
|
my @intfcs=$top->top_get_intfc_list();
|
2771 |
|
|
|
2772 |
|
|
my $i=0;
|
2773 |
|
|
|
2774 |
|
|
my $dir = Cwd::getcwd();
|
2775 |
|
|
my $mpsoc_name=$mpsoc->object_get_attribute('mpsoc_name');
|
2776 |
|
|
my $target_dir = "$ENV{'PRONOC_WORK'}/MPSOC/$mpsoc_name";
|
2777 |
|
|
my $soc_file="$target_dir/src_verilog/tiles/$soc_name.sv";
|
2778 |
|
|
|
2779 |
|
|
my $vdb =read_verilog_file($soc_file);
|
2780 |
|
|
|
2781 |
|
|
my %soc_localparam = $vdb->get_modules_parameters($soc_name);
|
2782 |
|
|
|
2783 |
|
|
|
2784 |
|
|
foreach my $intfc (@intfcs){
|
2785 |
|
|
|
2786 |
|
|
# Auto connected/not connected interface
|
2787 |
|
|
if( $intfc eq 'socket:ni[0]' || ($intfc =~ /plug:clk\[/) || ( $intfc =~ /plug:reset\[/)|| ($intfc =~ /socket:RxD_sim\[/ ) || $intfc =~ /plug:enable\[/){
|
2788 |
|
|
#do nothing
|
2789 |
|
|
}
|
2790 |
|
|
elsif( $intfc eq 'IO' ){
|
2791 |
|
|
my @ports=$top->top_get_intfc_ports_list($intfc);
|
2792 |
|
|
foreach my $p (@ports){
|
2793 |
|
|
my ($io_port,$type,$new_range,$intfc_name,$intfc_port)= get_top_port_io_info($top,$p,$tile_num,\%params,\%soc_localparam);
|
2794 |
|
|
$mpsoc_ip->ipgen_add_port($io_port,$new_range,$type,'IO','IO');
|
2795 |
|
|
|
2796 |
|
|
|
2797 |
|
|
}
|
2798 |
|
|
|
2799 |
|
|
}
|
2800 |
|
|
|
2801 |
|
|
else {
|
2802 |
|
|
#other interface
|
2803 |
|
|
my($if_type,$if_name,$if_num)= split("[:\[ \\]]", $intfc);
|
2804 |
|
|
print "my($if_type,$if_name,$if_num)= split(, $intfc); \n";
|
2805 |
|
|
my $num = (defined $intfc_num{"$if_type:$if_name"})? $intfc_num{"$if_type:$if_name"}+1:0;
|
2806 |
|
|
$intfc_num{"$if_type:$if_name"}=$num;
|
2807 |
|
|
$mpsoc_ip->ipgen_add_plug("$if_name",'num',$num) if ($if_type eq 'plug');
|
2808 |
|
|
$mpsoc_ip->ipgen_add_soket("$if_name",'num',$num) if ($if_type eq 'socket');
|
2809 |
|
|
|
2810 |
|
|
my @ports=$top->top_get_intfc_ports_list($intfc);
|
2811 |
|
|
foreach my $p (@ports){
|
2812 |
|
|
my ($io_port,$type,$new_range,$intfc_name,$intfc_port)= get_top_port_io_info($top,$p,$tile_num,\%params,\%soc_localparam);
|
2813 |
|
|
$mpsoc_ip->ipgen_add_port($io_port,$new_range,$type,"$if_type:$if_name\[$num\]",$intfc_port);
|
2814 |
|
|
|
2815 |
|
|
}
|
2816 |
|
|
}
|
2817 |
|
|
}
|
2818 |
|
|
|
2819 |
|
|
|
2820 |
|
|
my $setting=$mpsoc->mpsoc_get_tile_param_setting($tile_num);
|
2821 |
|
|
#if ($setting eq 'Custom'){
|
2822 |
|
|
%params= $top->top_get_custom_soc_param($tile_num);
|
2823 |
|
|
#}else{
|
2824 |
|
|
# %params=$top->top_get_default_soc_param();
|
2825 |
|
|
#}
|
2826 |
|
|
|
2827 |
|
|
foreach my $p (sort keys %params){
|
2828 |
|
|
$params{$p}=add_instantc_name_to_parameters(\%params,"T$tile_num",$params{$p});
|
2829 |
|
|
$params{$p}=add_instantc_name_to_parameters(\%soc_localparam,"T$tile_num",$params{$p});
|
2830 |
|
|
my $pname="T${tile_num}_$p";
|
2831 |
|
|
$mpsoc_ip-> ipgen_add_parameter ($pname,$params{$p},'Fixed',undef,undef,'Localparam',1);
|
2832 |
|
|
push (@parameters_order,$pname);
|
2833 |
|
|
|
2834 |
|
|
}
|
2835 |
|
|
foreach my $p (sort keys %soc_localparam){
|
2836 |
|
|
$soc_localparam{$p}=add_instantc_name_to_parameters(\%params,"T$tile_num",$soc_localparam{$p});
|
2837 |
|
|
$soc_localparam{$p}=add_instantc_name_to_parameters(\%soc_localparam,"T$tile_num",$soc_localparam{$p});
|
2838 |
|
|
my $pname="T${tile_num}_$p";
|
2839 |
|
|
$mpsoc_ip-> ipgen_add_parameter ($pname,$soc_localparam{$p},'Fixed',undef,undef,'Localparam',0);
|
2840 |
|
|
push (@parameters_order,$pname);
|
2841 |
|
|
|
2842 |
|
|
}
|
2843 |
|
|
|
2844 |
|
|
|
2845 |
|
|
|
2846 |
|
|
}
|
2847 |
|
|
#TODO get parameter order
|
2848 |
|
|
$mpsoc_ip->ipgen_add("parameters_order",\@parameters_order);
|
2849 |
|
|
|
2850 |
|
|
}
|
2851 |
|
|
|
2852 |
|
|
sub get_source_set_top{
|
2853 |
|
|
my ($self,$type)=@_;
|
2854 |
|
|
my $soc =$self->object_get_attribute('SOURCE_SET',"SOC");
|
2855 |
|
|
my $redefine =$self->object_get_attribute('SOURCE_SET',"REDEFINE_TOP");
|
2856 |
|
|
$redefine=1 if(!defined $redefine);
|
2857 |
|
|
if(!defined $soc){
|
2858 |
|
|
$soc = soc->soc_new();
|
2859 |
|
|
$soc->object_add_attribute('soc_name','TOP');
|
2860 |
|
|
$redefine=1;
|
2861 |
|
|
}
|
2862 |
|
|
if($redefine==1){
|
2863 |
|
|
my $ip = ip->lib_new ();
|
2864 |
|
|
#print "get_top_ip(\$self,$type);\n";
|
2865 |
|
|
my $mpsoc_ip=get_top_ip($self,$type);
|
2866 |
|
|
|
2867 |
|
|
$ip->add_ip($mpsoc_ip);
|
2868 |
|
|
$soc ->object_add_attribute('SOURCE_SET',"IP",$mpsoc_ip);
|
2869 |
|
|
$self->object_add_attribute('SOURCE_SET',"REDEFINE_TOP",0);
|
2870 |
|
|
add_mpsoc_to_device($soc,$ip);
|
2871 |
|
|
$self->object_add_attribute('SOURCE_SET',"SOC",$soc);
|
2872 |
|
|
}
|
2873 |
|
|
return $soc;
|
2874 |
|
|
}
|
2875 |
|
|
|
2876 |
|
|
|
2877 |
|
|
sub add_mpsoc_to_device{
|
2878 |
|
|
my ($soc,$ip)=@_;
|
2879 |
|
|
my $category='TOP';
|
2880 |
|
|
my $module='TOP';
|
2881 |
|
|
my ($instance_id,$id) =('TOP',1);
|
2882 |
|
|
|
2883 |
|
|
#my ($instance_id,$id)= get_instance_id($soc,$category,$module);
|
2884 |
|
|
|
2885 |
|
|
remove_instance_from_soc($soc,$instance_id);
|
2886 |
|
|
|
2887 |
|
|
#add module instanance
|
2888 |
|
|
my $result=$soc->soc_add_instance($instance_id,$category,$module,$ip);
|
2889 |
|
|
|
2890 |
|
|
if($result == 0){
|
2891 |
|
|
my $info_text= "Failed to add \"$instance_id\" to SoC. $instance_id is already exist.";
|
2892 |
|
|
# show_info($info,$info_text);
|
2893 |
|
|
return;
|
2894 |
|
|
}
|
2895 |
|
|
$soc->soc_add_instance_order($instance_id);
|
2896 |
|
|
# Add IP version
|
2897 |
|
|
my $v=$ip->ip_get($category,$module,"version");
|
2898 |
|
|
$v = 0 if(!defined $v);
|
2899 |
|
|
#print "$v\n";
|
2900 |
|
|
$soc->object_add_attribute($instance_id,"version",$v);
|
2901 |
|
|
# Read default parameter from lib and add them to soc
|
2902 |
|
|
my %param_default= $ip->get_param_default($category,$module);
|
2903 |
|
|
|
2904 |
|
|
my $rr=$soc->soc_add_instance_param($instance_id,\%param_default);
|
2905 |
|
|
if($rr == 0){
|
2906 |
|
|
my $info_text= "Failed to add default parameter to \"$instance_id\". $instance_id does not exist.";
|
2907 |
|
|
# show_info($info,$info_text);
|
2908 |
|
|
return;
|
2909 |
|
|
}
|
2910 |
|
|
my @r=$ip->ip_get_param_order($category,$module);
|
2911 |
|
|
$soc->soc_add_instance_param_order($instance_id,\@r);
|
2912 |
|
|
|
2913 |
|
|
#get_module_parameter($soc,$ip,$instance_id);
|
2914 |
|
|
undef $ip;
|
2915 |
|
|
set_gui_status($soc,"refresh_soc",0);
|
2916 |
|
|
}
|
2917 |
|
|
|
2918 |
|
|
######
|
2919 |
|
|
# ctrl
|
2920 |
|
|
######
|
2921 |
|
|
|
2922 |
|
|
sub ctrl_box{
|
2923 |
|
|
my ($mpsoc,$info)=@_;
|
2924 |
|
|
my $table = def_table (1, 12, FALSE);
|
2925 |
|
|
my $generate = def_image_button('icons/gen.png','_Generate RTL',FALSE,1);
|
2926 |
|
|
my $open = def_image_button('icons/browse.png','_Load MPSoC',FALSE,1);
|
2927 |
|
|
my $compile = def_image_button('icons/gate.png','_Compile RTL',FALSE,1);
|
2928 |
|
|
my $software = def_image_button('icons/binary.png','_Software',FALSE,1);
|
2929 |
|
|
my $entry=gen_entry_object($mpsoc,'mpsoc_name',undef,undef,undef,undef);
|
2930 |
|
|
my $entrybox=gen_label_info(" MPSoC name:",$entry);
|
2931 |
|
|
my $save = def_image_button('icons/save.png');
|
2932 |
|
|
my $open_dir = def_image_button('icons/open-folder.png');
|
2933 |
|
|
set_tip($save, "Save current MPSoC configuration setting");
|
2934 |
|
|
set_tip($open_dir, "Open target MPSoC folder");
|
2935 |
|
|
|
2936 |
|
|
$entrybox->pack_start( $save, FALSE, FALSE, 0);
|
2937 |
|
|
$entrybox->pack_start( $open_dir , FALSE, FALSE, 0);
|
2938 |
|
|
my $diagram = def_image_button('icons/diagram.png','Diagram');
|
2939 |
|
|
my $clk= def_image_button('icons/clk.png','CLK setting');
|
2940 |
|
|
|
2941 |
|
|
my $row=0;
|
2942 |
|
|
$table->attach ($open,$row, $row+2, 0,1,'expand','shrink',2,2);$row+=2;
|
2943 |
|
|
$table->attach ($entrybox,$row, $row+2, 0,1,'expand','shrink',2,2);$row+=2;
|
2944 |
|
|
$table->attach ($diagram, $row, $row+1, 0,1,'expand','shrink',2,2);$row++;
|
2945 |
|
|
$table->attach ($clk, $row, $row+1, 0,1,'expand','shrink',2,2);$row++;
|
2946 |
|
|
$table->attach ($generate, $row, $row+1, 0,1,'expand','shrink',2,2);$row++;
|
2947 |
|
|
$table->attach ($software, $row, $row+1, 0,1,'expand','shrink',2,2);$row++;
|
2948 |
|
|
$table->attach ($compile, $row, $row+1, 0,1,'expand','shrink',2,2);$row++;
|
2949 |
|
|
|
2950 |
|
|
$generate-> signal_connect("clicked" => sub{
|
2951 |
|
|
generate_mpsoc($mpsoc,$info,1);
|
2952 |
|
|
set_gui_status($mpsoc,"refresh_soc",1);
|
2953 |
|
|
});
|
2954 |
|
|
|
2955 |
|
|
$save-> signal_connect("clicked" => sub{
|
2956 |
|
|
my $name=$mpsoc->object_get_attribute('mpsoc_name');
|
2957 |
|
|
return if (check_mpsoc_name($name,$info));
|
2958 |
|
|
generate_mpsoc_lib_file($mpsoc,$info);
|
2959 |
|
|
message_dialog("MPSOC \"$name\" is saved as lib/mpsoc/$name.MPSOC.");
|
2960 |
|
|
|
2961 |
|
|
});
|
2962 |
|
|
|
2963 |
|
|
|
2964 |
|
|
$open-> signal_connect("clicked" => sub{
|
2965 |
|
|
set_gui_status($mpsoc,"ref",5);
|
2966 |
|
|
load_mpsoc($mpsoc,$info);
|
2967 |
|
|
});
|
2968 |
|
|
|
2969 |
|
|
|
2970 |
|
|
$compile -> signal_connect("clicked" => sub{
|
2971 |
|
|
$mpsoc->object_add_attribute('compile','compilers',"QuartusII,Vivado,Verilator,Modelsim");
|
2972 |
|
|
my $name=$mpsoc->object_get_attribute('mpsoc_name');
|
2973 |
|
|
$name="" if (!defined $name);
|
2974 |
|
|
if (length($name)==0){
|
2975 |
|
|
message_dialog("Please define the MPSoC name!");
|
2976 |
|
|
return ;
|
2977 |
|
|
}
|
2978 |
|
|
my $target_dir = "$ENV{'PRONOC_WORK'}/MPSOC/$name";
|
2979 |
|
|
my $top_file = "$target_dir/src_verilog/${name}_top.v";
|
2980 |
|
|
if (-f $top_file){
|
2981 |
|
|
my $answer = yes_no_dialog ("Do you want to Regenearte the MPSoC RTL code too?");
|
2982 |
|
|
generate_mpsoc($mpsoc,$info,0) if ($answer eq 'yes');
|
2983 |
|
|
select_compiler($mpsoc,$name,$top_file,$target_dir);
|
2984 |
|
|
} else {
|
2985 |
|
|
message_dialog("Cannot find $top_file file. Please run RTL Generator first!");
|
2986 |
|
|
return;
|
2987 |
|
|
}
|
2988 |
|
|
});
|
2989 |
|
|
|
2990 |
|
|
$software -> signal_connect("clicked" => sub{
|
2991 |
|
|
my $name=$mpsoc->object_get_attribute('mpsoc_name');
|
2992 |
|
|
$name="" if (!defined $name);
|
2993 |
|
|
if (length($name)==0){
|
2994 |
|
|
message_dialog("Please define the MPSoC name!");
|
2995 |
|
|
return ;
|
2996 |
|
|
}
|
2997 |
|
|
my $target_dir = "$ENV{'PRONOC_WORK'}/MPSOC/$name";
|
2998 |
|
|
my $sw_folder = "$target_dir/sw";
|
2999 |
|
|
unless (-d $sw_folder){
|
3000 |
|
|
message_dialog("Cannot find $sw_folder. Please run RTL Generator first!");
|
3001 |
|
|
return;
|
3002 |
|
|
}
|
3003 |
|
|
software_edit_mpsoc($mpsoc);
|
3004 |
|
|
|
3005 |
|
|
});
|
3006 |
|
|
|
3007 |
|
|
$diagram-> signal_connect("clicked" => sub{
|
3008 |
|
|
show_topology_diagram ($mpsoc);
|
3009 |
|
|
});
|
3010 |
|
|
|
3011 |
|
|
|
3012 |
|
|
$clk-> signal_connect("clicked" => sub{
|
3013 |
|
|
clk_setting_win1($mpsoc,$info,'mpsoc');
|
3014 |
|
|
});
|
3015 |
|
|
|
3016 |
|
|
$open_dir-> signal_connect("clicked" => sub{
|
3017 |
|
|
my $name=$mpsoc->object_get_attribute('mpsoc_name');
|
3018 |
|
|
$name="" if (!defined $name);
|
3019 |
|
|
if (length($name)==0){
|
3020 |
|
|
message_dialog("Please define the MPSoC name!");
|
3021 |
|
|
return ;
|
3022 |
|
|
}
|
3023 |
|
|
my $target_dir = "$ENV{'PRONOC_WORK'}/MPSOC/$name";
|
3024 |
|
|
unless (-d $target_dir){
|
3025 |
|
|
message_dialog("Cannot find $target_dir.\n Please run RTL Generator first!",'error');
|
3026 |
|
|
return;
|
3027 |
|
|
}
|
3028 |
|
|
system "xdg-open $target_dir";
|
3029 |
|
|
|
3030 |
|
|
});
|
3031 |
|
|
|
3032 |
|
|
|
3033 |
|
|
return $table;
|
3034 |
|
|
}
|
3035 |
|
|
|
3036 |
16 |
alirezamon |
############
|
3037 |
|
|
# main
|
3038 |
|
|
############
|
3039 |
|
|
sub mpsocgen_main{
|
3040 |
43 |
alirezamon |
my $infc = interface->interface_new();
|
3041 |
|
|
my $soc = ip->lib_new ();
|
3042 |
|
|
my $mpsoc= mpsoc->mpsoc_new();
|
3043 |
48 |
alirezamon |
|
3044 |
43 |
alirezamon |
set_gui_status($mpsoc,"ideal",0);
|
3045 |
48 |
alirezamon |
my $main_table = def_table (25, 12, FALSE);
|
3046 |
43 |
alirezamon |
|
3047 |
48 |
alirezamon |
# The box which holds the info, warning, error ... messages
|
3048 |
|
|
my ($infobox,$info)= create_txview();
|
3049 |
43 |
alirezamon |
|
3050 |
|
|
my $noc_conf_box=get_config ($mpsoc,$info);
|
3051 |
|
|
my $noc_tiles=gen_tiles($mpsoc);
|
3052 |
48 |
alirezamon |
|
3053 |
16 |
alirezamon |
|
3054 |
43 |
alirezamon |
$main_table->set_row_spacings (4);
|
3055 |
|
|
$main_table->set_col_spacings (1);
|
3056 |
48 |
alirezamon |
my $ctrl=ctrl_box($mpsoc,$info);
|
3057 |
|
|
my $h1=gen_hpaned($noc_conf_box,.3,$noc_tiles);
|
3058 |
43 |
alirezamon |
my $v2=gen_vpaned($h1,.55,$infobox);
|
3059 |
48 |
alirezamon |
my $row=0;
|
3060 |
43 |
alirezamon |
$main_table->attach_defaults ($v2 , 0, 12, 0,24);
|
3061 |
48 |
alirezamon |
#$main_table->attach_defaults ($ctrl,0, 12, 24,25);
|
3062 |
|
|
$main_table->attach ($ctrl,0, 12, 24,25, 'fill','fill',2,2);
|
3063 |
16 |
alirezamon |
|
3064 |
48 |
alirezamon |
#check soc status every 0.5 second. refresh device table if there is any changes
|
3065 |
43 |
alirezamon |
Glib::Timeout->add (100, sub{
|
3066 |
|
|
my ($state,$timeout)= get_gui_status($mpsoc);
|
3067 |
|
|
if ($timeout>0){
|
3068 |
|
|
$timeout--;
|
3069 |
|
|
set_gui_status($mpsoc,$state,$timeout);
|
3070 |
|
|
}elsif ($state eq 'save_project'){
|
3071 |
|
|
# Write object file
|
3072 |
|
|
my $name=$mpsoc->object_get_attribute('mpsoc_name');
|
3073 |
|
|
open(FILE, ">lib/mpsoc/$name.MPSOC") || die "Can not open: $!";
|
3074 |
|
|
print FILE perl_file_header("$name.MPSOC");
|
3075 |
|
|
print FILE Data::Dumper->Dump([\%$mpsoc],[$name]);
|
3076 |
48 |
alirezamon |
close(FILE) || die "Error closing file: $!";
|
3077 |
43 |
alirezamon |
set_gui_status($mpsoc,"ideal",0);
|
3078 |
|
|
}
|
3079 |
|
|
elsif( $state ne "ideal" ){
|
3080 |
|
|
$noc_conf_box->destroy();
|
3081 |
|
|
$noc_conf_box=get_config ($mpsoc,$info);
|
3082 |
|
|
$noc_tiles->destroy();
|
3083 |
48 |
alirezamon |
$noc_tiles=gen_tiles($mpsoc);
|
3084 |
|
|
$h1 -> pack1($noc_conf_box, TRUE, TRUE);
|
3085 |
|
|
$h1 -> pack2($noc_tiles, TRUE, TRUE);
|
3086 |
43 |
alirezamon |
$v2-> pack1($h1, TRUE, TRUE);
|
3087 |
|
|
$h1->show_all;
|
3088 |
48 |
alirezamon |
$ctrl->destroy;
|
3089 |
|
|
$ctrl=ctrl_box($mpsoc,$info);
|
3090 |
|
|
$main_table->attach ($ctrl,0, 12, 24,25,'fill','fill',2,2);
|
3091 |
43 |
alirezamon |
$main_table->show_all();
|
3092 |
48 |
alirezamon |
|
3093 |
|
|
|
3094 |
43 |
alirezamon |
set_gui_status($mpsoc,"ideal",0);
|
3095 |
|
|
|
3096 |
|
|
|
3097 |
|
|
}
|
3098 |
|
|
return TRUE;
|
3099 |
|
|
|
3100 |
|
|
} );
|
3101 |
|
|
|
3102 |
48 |
alirezamon |
my $sc_win = add_widget_to_scrolled_win($main_table);
|
3103 |
34 |
alirezamon |
|
3104 |
43 |
alirezamon |
return $sc_win;
|
3105 |
16 |
alirezamon |
}
|
3106 |
|
|
|
3107 |
|
|
|