URL
https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk
Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc
Compare Revisions
- This comparison shows the changes necessary to convert path
/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk/mpsoc/perl_gui/lib/perl
- from Rev 24 to Rev 25
- ↔ Reverse comparison
Rev 24 → Rev 25
/noc_sim.pl
File deleted
/emulate_ram_gen.pl
0,0 → 1,386
#!/usr/bin/perl -w |
use strict; |
use warnings; |
use List::Util 'shuffle'; |
require "widget.pl"; |
|
|
use constant RESET_CMD => " $ENV{'PRONOC_WORK'}/toolchain/bin/jtag_main -n 127 -d \"I:1,D:1:1,I:0\" "; |
use constant UNRESET_CMD => " $ENV{'PRONOC_WORK'}/toolchain/bin/jtag_main -n 127 -d \"I:1,D:1:0,I:0\" "; |
use constant READ_DONE_CMD => " $ENV{'PRONOC_WORK'}/toolchain/bin/jtag_main -n 127 -d \"I:2,R:1:0,I:0\" "; |
use constant UPDATE_WB_ADDR => 0x7; |
use constant UPDATE_WB_WR_DATA => 0x6; |
use constant UPDATE_WB_RD_DATA => 0x5; |
use constant RD_WR_STATUS => 0x4; |
use constant PROBE_ST => 0x2; |
use constant SOURCE_ST => 0x1; |
use constant BYPAS_ST => 0x0; |
|
|
sub get_data{ |
|
my ( $x, $y, $ref, $traffic, $ratio_in,$num, $line_num, $dest)=@_; |
my %noc_info= %$ref; |
my $C=$noc_info{C}; |
my $xn=$noc_info{NX}; |
my $yn=$noc_info{NY}; |
my $MAX_PCK_NUM = $noc_info{MAX_PCK_NUM}; |
my $MAX_SIM_CLKs = $noc_info{MAX_SIM_CLKs}; |
my $MAX_PCK_SIZ = $noc_info{MAX_PCK_SIZ}; |
|
|
my $Xw = log2($xn); # number of node in x axis |
my $Yw = log2($yn); # number of node in y axis |
my $Cw = ($C > 1)? log2($C): 1; |
#$Fw = 2+V+Fpay, |
my $RATIOw = log2(100), |
my $PCK_CNTw = log2($MAX_PCK_NUM+1), |
my $CLK_CNTw = log2($MAX_SIM_CLKs+1), |
my $PCK_SIZw = log2($MAX_PCK_SIZ+1); |
|
my $Dw=$PCK_CNTw+ $RATIOw + $PCK_SIZw + $Xw + $Yw + $Cw +1; |
my $val=0; |
my $q=0; |
my $i=0; |
my $last_adr=($traffic eq 'random' && $line_num<($xn* $yn)-2 )? 0 : 1; |
#print "my $last_adr=($traffic eq 'random' && $line_num<($xn* $yn)-2 )? 0 : 1; \n"; |
my @fileds=get_ram_line($C, $x, $y, $xn, $yn, $traffic,$ratio_in,$line_num,$dest,$last_adr); |
my ($pck_num_to_send_,$ratio_in_,$pck_size_,$dest_x_,$dest_y_,$pck_class_in_,$last_adr_)=@fileds; |
my @sizes= ($PCK_CNTw, $RATIOw , $PCK_SIZw , $Xw , $Yw , $Cw ,1); |
|
foreach my $p (@fileds){ |
$val= $val << $q; |
$val= $val + $p; |
$i++; |
$q=$sizes[$i] if(defined $sizes[$i]); |
} |
|
my $sum = 0; |
|
foreach my $num (@sizes){ |
$sum = $sum + $num; |
} |
my $result = sprintf("%010x", $val); |
#print"$result\n"; |
return ($result,$last_adr,$Dw); |
|
|
|
|
|
#ram_do= {pck_num_to_send_,ratio_in_,pck_size_,dest_x_,dest_y_,pck_class_in_,last_adr_}; |
|
|
} |
|
sub get_ram_line{ |
my ($C, $x, $y, $xn, $yn, $traffic,$ratio_in,$line_num,$dest,$last_adr_)=@_; |
|
my $pck_num_to_send_=2000000; |
my $pck_size_=4; |
my $pck_class_in_=0; |
|
|
my $xw=log2($xn); |
my $yw=log2($yn); |
|
#print "$traffic\n"; |
my $dest_x_; |
my $dest_y_; |
|
if( $traffic eq "transposed 1"){ |
$dest_x_= $xn-$y-1; |
$dest_y_= $yn-$x-1; |
|
} elsif( $traffic eq "transposed 2"){ |
|
$dest_x_ = $y; |
$dest_y_ = $x; |
} elsif( $traffic eq "bit reverse"){ |
my $joint_addr= ($x << log2($xn))+$y; |
my $reverse_addr=0; |
my $pos=0; |
for(my $i=0; $i<($xw+$yw); $i++){#reverse the address |
$pos= ((($xw+$yw)-1)-$i); |
$reverse_addr|= (($joint_addr >> $pos) & 0x01) << $i; |
# reverse_addr[i] = joint_addr [((Xw+Yw)-1)-i]; |
} |
$dest_x_ = $reverse_addr>>$yw; |
$dest_y_ = $reverse_addr&(0xFF>> (8-$yw)); |
|
} elsif( $traffic eq "bit complement") { |
|
$dest_x_ = (~$x) &(0xFF>> (8-$xw)); |
$dest_y_ = (~$y) &(0xFF>> (8-$yw)); |
|
|
} elsif( $traffic eq "tornado") { |
|
#[(x+(k/2-1)) mod k, (y+(k/2-1)) mod k], |
$dest_x_ = (($x + (($xn/2)-1))%$xn); |
$dest_y_ = (($y + (($yn/2)-1))%$yn); |
|
} elsif( $traffic eq "random") { |
#my $num=($y * $xn) + $x; |
$pck_num_to_send_=2; |
$dest_x_ = $dest % $xn; |
$dest_y_ = $dest / $xn; |
|
|
|
}else{#off |
print "***********************************$traffic is not defined*******************************************\n"; |
$dest_x_= $x; |
$dest_y_= $y; |
|
} |
|
#print" ($pck_num_to_send_,$ratio_in,$pck_size_,$dest_x_,$dest_y_,$pck_class_in_,$last_adr_);\n"; |
return ($pck_num_to_send_,$ratio_in,$pck_size_,$dest_x_,$dest_y_,$pck_class_in_,$last_adr_); |
|
|
} |
|
|
|
|
|
sub help { |
print |
" usage: ./ram_gen X Y TRAFFIC |
X: number of node in X direction 2<x<=16 |
Y: number of node in Y direction 2<y<=16 |
TRAFFIC : select one of the following traffic patterns : |
tornado, |
transposed 1, |
transposed 2, |
random, |
|
"; |
|
} |
|
|
|
|
|
|
sub gen_ram{ |
my ($data,$mem_width)=get_data(@_); |
my $result = sprintf("%8x", $data); |
|
|
|
return $result; |
|
|
} |
|
sub random_dest_gen { |
my $n=shift; |
my @c=(0..$n-1); |
my @o; |
for (my $i=0; $i<$n; $i++){ |
my @l= shuffle @c; |
@l=remove_scolar_from_array(\@l,$i); |
$o[$i]=\@l; |
|
} |
return \@o; |
|
} |
|
sub run_cmd_update_info { |
my ($cmd,$info)=@_; |
my ($stdout,$exit,$stderr)=run_cmd_in_back_ground_get_stdout($cmd); |
if($exit){ |
add_info($info, "$stdout\n") if(defined $stdout); |
add_info($info, "$stderr\n") if(defined $stderr); |
|
} |
return $exit; |
} |
|
|
|
|
|
|
|
|
sub programe_pck_gens{ |
my ($ref, $traffic,$ratio_in,$info)= @_; |
my %noc_info= %$ref; |
my $C=$noc_info{C}; |
my $xn=$noc_info{NX}; |
my $yn=$noc_info{NY}; |
#print( "@_\n" ); |
my @traffics=("tornado", "transposed 1", "transposed 2", "bit reverse", "bit complement","random", "hot spot" ); |
my $xc=$xn * $yn; |
my @randoms=@{random_dest_gen($xc)}; |
|
if ( !defined $xn || $xn!~ /\s*\d+\b/ ){ add_info($info,"programe_pck_gens:invalid X value\n"); help(); return 0;} |
if ( !defined $yn || $yn!~ /\s*\d+\b/ ){ add_info($info,"programe_pck_gens:invalid Y value\n"); help(); return 0;} |
if ( !grep( /^$traffic$/, @traffics ) ){add_info($info,"programe_pck_gens:$traffic is an invalid Traffic name\n"); help(); return 0;} |
if ( $xn <2 || $xn >16 ){ add_info($info,"programe_pck_gens:invalid X value: ($xn). should be between 2 and 16 \n"); help(); return 0;} |
if ( $yn <2 || $yn >16 ){ add_info($info,"programe_pck_gens:invalid Y value:($yn). should be between 2 and 16 \n"); help(); return 0;} |
|
#reset the FPGA board |
#run_cmd_in_back_ground("quartus_stp -t ./lib/tcl/mem.tcl reset"); |
return if(run_cmd_update_info(RESET_CMD,$info)); |
|
|
my $argument=''; |
my $argument2=''; |
|
for (my $x=0; $x<$xn; $x=$x+1){ |
for (my $y=0; $y<$yn; $y=$y+1){ |
my $num=($y * $xn) + $x; |
$num= ($num<=9)? "0$num" : $num; |
#add_info($info, "programe M$num\n"); |
my $line=0; |
my ($ram_val,$end,$Dw); |
my $repeat=($traffic eq 'random')? "0x2710" : "0x0"; # 10000 : 0; |
|
$argument=undef; |
do{ |
($ram_val,$end,$Dw)=get_data($x, $y, $ref, $traffic,$ratio_in,$num,$line,@{$randoms[$num]}[$line]); |
if(!defined $argument ) { #first row |
$argument="-n $num -d \"I:".UPDATE_WB_ADDR.",D:$Dw:0,I:".UPDATE_WB_WR_DATA.",D:$Dw:0x$ram_val"; |
} |
#$argument="$argument M$num $line $ram_val"; |
else { |
$argument=$argument.",D:$Dw:0x$ram_val"; |
|
} |
#$argument="$argument M$num $line $ram_val"; |
$line++; |
#print "\$line=$line\n"; |
} while($end == 0); |
$argument=$argument.",I:0\""; |
#program the memory |
#print "$cmd\n"; |
my $cmd="$ENV{'PRONOC_WORK'}/toolchain/bin/jtag_main $argument"; |
return if(run_cmd_update_info ($cmd,$info)); |
my $source_index=$num+128; |
|
$cmd= "$ENV{'PRONOC_WORK'}/toolchain/bin/jtag_main -n $source_index -d \"I:".SOURCE_ST.",D:100:$repeat,I:0\""; |
return if(run_cmd_update_info ($cmd,$info)); |
#$argument2="$argument2 P$num $repeat"; |
|
|
|
#my $file="./RAM/M$num.mif\n"; |
#unless(open FILE, '>'.$file) { die "\nUnable to create $file\n";} |
|
# Write data to the file. |
#my $ram_content= gen_ram(0, $x, $y, $xn, $yn, $traffic,"M$num"); |
#print FILE $ram_content; |
# close the file. |
#close FILE; |
|
} |
} |
#print "quartus_stp -t ./lib/tcl/mem.tcl $argument\n"; |
# ($result,$exit)=run_cmd_in_back_ground_get_stdout("quartus_stp -t ./lib/tcl/mem.tcl $argument"); |
#add_info($info,"update packet generators\n"); |
#print "($result,$exit)\n"; |
#return 0 if ($exit); |
#print "quartus_stp -t ./lib/tcl/source.tcl $argument2\n"; |
#($result,$exit)=run_cmd_in_back_ground_get_stdout("quartus_stp -t ./lib/tcl/source.tcl $argument2"); |
#print "($result,$exit)\n"; |
#return 0 if ($exit); |
|
# deassert the reset |
|
return if(run_cmd_update_info (UNRESET_CMD,$info)); |
#run_cmd_in_back_ground("quartus_stp -t ./lib/tcl/mem.tcl unreset"); |
#add_info($info,"$r\n"); |
|
return 1; |
|
} |
|
|
|
sub read_pack_gen{ |
my ($ref,$info)= @_; |
my %noc_info= %$ref; |
my $xn=$noc_info{NX}; |
my $yn=$noc_info{NY}; |
#wait for done |
add_info($info, "wait for done\n"); |
my $done=0; |
my $counter=0; |
while ($done ==0){ |
|
#my ($result,$exit) = run_cmd_in_back_ground_get_stdout("quartus_stp -t ./lib/tcl/read.tcl done"); |
my ($result,$exit) = run_cmd_in_back_ground_get_stdout(READ_DONE_CMD); |
my @q =split (/###read data#/,$result); |
#print "\$result=$result\n"; |
|
|
$done=($q[1] eq "0x0")? 0 : 1; |
#print "\$q[1]=$q[1] done=$done\n"; |
usleep(9000); |
$counter++; |
if($counter == 15){ # |
add_info($info,"Done is not asserted. I reset the board and try again\n"); |
return if(run_cmd_update_info (RESET_CMD,$info)); |
#run_cmd_in_back_ground("quartus_stp -t ./lib/tcl/mem.tcl reset"); |
usleep(300000); |
return if(run_cmd_update_info (UNRESET_CMD,$info)); |
#run_cmd_in_back_ground("quartus_stp -t ./lib/tcl/mem.tcl unreset"); |
} |
if($counter>30){ |
#something is wrong |
add_info($info,"Done is not asserted again. I am going to ignore this test case"); |
return undef; |
} |
} |
|
add_info($info,"Done is asserted\n"); |
#my $i=0; |
my %results; |
my $sum_of_latency=0; |
my $sum_of_pck=0; |
for (my $x=0; $x<$xn; $x=$x+1){ |
for (my $y=0; $y<$yn; $y=$y+1){ |
my $num=($y * $xn) + $x; |
my $source_index=$num+128; |
my $cmd= "$ENV{'PRONOC_WORK'}/toolchain/bin/jtag_main -n $source_index -d \"I:".PROBE_ST.",R:100:0,I:0\""; |
my ($result,$exit) = run_cmd_in_back_ground_get_stdout($cmd); |
my @q =split (/###read data#/,$result); |
|
|
|
my $d=$q[1]; |
#print "num=$num: ddddd=$d\n"; |
my $s= substr $d,2; |
#print "dddddddd=$s\n"; |
my $latency =substr $s, 0,9; |
my $got_pck= substr $s, -16, 8; |
my $sent_pck= substr $s, -8; |
#print "$latency, $got_pck, $sent_pck\n"; |
|
|
$results{$num}{latency}=hex($latency); |
$results{$num}{got_pck}=hex($got_pck); |
$results{$num}{sent_pck}=hex($sent_pck); |
$sum_of_latency+=hex($latency); |
$sum_of_pck+=hex($got_pck); |
#$i=$i+2; |
}} |
|
foreach my $p (sort keys %results){ |
|
|
#print "$p : \n latency: $results{$p}{latency}\n"; |
#print " got_pck : $results{$p}{got_pck}\n"; |
#print "sent_pck:$results{$p}{sent_pck}\n\n"; |
|
} |
my $avg= ($sum_of_pck>0)? $sum_of_latency/$sum_of_pck : 0; |
return sprintf("%.1f", $avg); |
} |
|
emulate_ram_gen.pl
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: emulator.pl
===================================================================
--- emulator.pl (nonexistent)
+++ emulator.pl (revision 25)
@@ -0,0 +1,1349 @@
+#! /usr/bin/perl -w
+use Glib qw/TRUE FALSE/;
+use strict;
+use warnings;
+use Gtk2;
+use Gtk2::Ex::Graph::GD;
+use GD::Graph::Data;
+use emulator;
+use IO::CaptureOutput qw(capture qxx qxy);
+use GD::Graph::colour qw/:colours/;
+use Proc::Background;
+use Time::HiRes qw( usleep ualarm gettimeofday tv_interval nanosleep clock_gettime clock_getres clock_nanosleep clock stat );
+
+use File::Basename;
+use File::Path qw/make_path/;
+
+require "widget.pl";
+require "emulate_ram_gen.pl";
+require "mpsoc_gen.pl";
+require "mpsoc_verilog_gen.pl";
+require "readme_gen.pl";
+
+use List::MoreUtils qw(uniq);
+
+
+
+
+
+sub gen_chart {
+ my $emulate=shift;
+ my($width,$hight)=max_win_size();
+ my $graph_w=$width/2.5;
+ my $graph_h=$hight/2.5;
+ my $graph = Gtk2::Ex::Graph::GD->new($graph_w, $graph_h, 'linespoints');
+ my @x;
+ my @legend_keys;
+ my $sample_num=$emulate->object_get_attribute("emulate_num",undef);
+ my $scale= $emulate->object_get_attribute("graph_scale",undef);
+ my @results;
+ $results[0]=[0];
+ $results[1]= [0];
+my $legend_info="This attribute controls placement of the legend within the graph image. The value is supplied as a two-letter string, where the first letter is placement (a B or an R for bottom or right, respectively) and the second is alignment (L, R, C, T, or B for left, right, center, top, or bottom, respectively). ";
+
+my @ginfo = (
+{ label=>"Graph Title", param_name=>"G_Title", type=>"Entry", default_val=>undef, content=>undef, info=>undef, param_parent=>'graph_param', ref_delay=>undef },
+{ label=>"Y Axix Title", param_name=>"Y_Title", type=>"Entry", default_val=>'Latency (clock)', content=>undef, info=>undef, param_parent=>'graph_param', ref_delay=>undef },
+ { label=>"X Axix Title", param_name=>"X_Title", type=>"Entry", default_val=>'Load per router (flits/clock (%))', content=>undef, info=>undef, param_parent=>'graph_param',ref_delay=>undef },
+ { label=>"legend placement", param_name=>"legend_placement", type=>'Combo-box', default_val=>'BL', content=>"BL,BC,BR,RT,RC,RB", info=>$legend_info, param_parent=>'graph_param', ref_delay=>undef},
+ { label=>"Y min", param_name=>"Y_MIN", type=>'Spin-button', default_val=>0, content=>"0,1024,1", info=>"Y axix minimum value", param_parent=>'graph_param', ref_delay=> 5},
+ { label=>"X min", param_name=>"X_MIN", type=>'Spin-button', default_val=>0, content=>"0,1024,1", info=>"X axix minimum value", param_parent=>'graph_param', ref_delay=> 5},
+ { label=>"Line Width", param_name=>"LINEw", type=>'Spin-button', default_val=>3, content=>"1,20,1", info=>undef, param_parent=>'graph_param', ref_delay=> 5},
+
+
+);
+
+ if(defined $sample_num){
+ my @color;
+ my $min_y=200;
+ for (my $i=1;$i<=$sample_num; $i++) {
+ my $color_num=$emulate->object_get_attribute("sample$i","color");
+ my $l_name= $emulate->object_get_attribute("sample$i","line_name");
+ $legend_keys[$i-1]= (defined $l_name)? $l_name : "NoC$i";
+ $color_num=$i+1 if(!defined $color_num);
+ push(@color, "my_color$color_num");
+ my $ref=$emulate->object_get_attribute ("sample$i","result");
+ if(defined $ref) {
+ push(@x, sort {$a<=>$b} keys $ref);
+ }
+
+ }#for
+ my @x1;
+ @x1 = uniq(sort {$a<=>$b} @x) if (scalar @x);
+
+ if (scalar @x1){
+ $results[0]=\@x1;
+ for (my $i=1;$i<=$sample_num; $i++) {
+ my $j=0;
+ my $ref=$emulate->object_get_attribute ("sample$i","result");
+ if(defined $ref){
+ my %line=%$ref;
+ foreach my $k (@x1){
+ $results[$i][$j]=$line{$k};
+ $min_y= $line{$k} if (defined $line{$k} && $line{$k}!=0 && $min_y > $line{$k});
+ $j++;
+ }#$k
+ }#if
+ }#$i
+
+ }#if
+
+ my $max_y=$min_y*$scale;
+
+
+
+ my $graphs_info;
+ foreach my $d ( @ginfo){
+ $graphs_info->{$d->{param_name}}=$emulate->object_get_attribute( 'graph_param',$d->{param_name});
+ $graphs_info->{$d->{param_name}}= $d->{default_val} if(!defined $graphs_info->{$d->{param_name}});
+ }
+
+ #print "gggggggggggggggg=".$graphs_info->{X_Title};
+
+ $graph->set (
+ x_label => $graphs_info->{X_Title},
+ y_label => $graphs_info->{Y_Title},
+ y_max_value => $max_y,
+ y_min_value => $graphs_info->{Y_MIN},
+ x_min_value => $graphs_info->{X_MIN}, # dosent work?
+ title => $graphs_info->{G_Title},
+ bar_spacing => 1,
+ shadowclr => 'dred',
+ transparent => 0,
+ line_width => $graphs_info->{LINEw},
+ cycle_clrs => 'blue',
+ legend_placement => $graphs_info->{legend_placement},
+ dclrs=>\@color,
+ );
+ }#if
+ $graph->set_legend(@legend_keys);
+
+
+ my $data = GD::Graph::Data->new(\@results) or die GD::Graph::Data->error;
+ my $image = my_get_image($emulate,$graph,$data);
+
+
+
+
+
+
+
+
+ my $table = Gtk2::Table->new (25, 10, FALSE);
+
+
+ my $box = Gtk2::HBox->new (TRUE, 2);
+ my $filename;
+ $box->set_border_width (4);
+ my $align = Gtk2::Alignment->new (0.5, 0.5, 0, 0);
+ my $frame = Gtk2::Frame->new;
+ $frame->set_shadow_type ('in');
+ $frame->add ($image);
+ $align->add ($frame);
+
+
+ my $plus = def_image_button('icons/plus.png',undef,TRUE);
+ my $minues = def_image_button('icons/minus.png',undef,TRUE);
+ my $setting = def_image_button('icons/setting.png',undef,TRUE);
+ my $save = def_image_button('icons/save.png',undef,TRUE);
+
+ $minues -> signal_connect("clicked" => sub{
+ $emulate->object_add_attribute("graph_scale",undef,$scale+0.5);
+ set_gui_status($emulate,"ref",1);
+ });
+
+ $plus -> signal_connect("clicked" => sub{
+ $emulate->object_add_attribute("graph_scale",undef,$scale-0.5) if( $scale>0.5);
+ set_gui_status($emulate,"ref",5);
+ });
+
+ $setting -> signal_connect("clicked" => sub{
+ get_graph_setting ($emulate,\@ginfo);
+ });
+
+ $save-> signal_connect("clicked" => sub{
+ my $G = $graph->{graph};
+ my @imags=$G->export_format();
+ save_graph_as ($emulate,\@imags);
+ });
+
+
+
+
+ $table->attach_defaults ($align , 0, 9, 0, 25);
+ my $row=0;
+ $table->attach ($plus , 9, 10, $row, $row+1,'shrink','shrink',2,2); $row++;
+ $table->attach ($minues, 9, 10, $row, $row+1,'shrink','shrink',2,2); $row++;
+ $table->attach ($setting, 9, 10, $row, $row+1,'shrink','shrink',2,2); $row++;
+ $table->attach ($save, 9, 10, $row, $row+1,'shrink','shrink',2,2); $row++;
+ while ($row<10){
+
+ my $tmp=gen_label_in_left('');
+ $table->attach_defaults ($tmp, 9, 10, $row, $row+1);$row++;
+ }
+
+ return $table;
+
+}
+
+
+##############
+# save_graph_as
+##############
+
+sub save_graph_as {
+ my ($emulate,$ref)=@_;
+
+ my $file;
+ my $title ='Save as';
+
+
+
+ my @extensions=@$ref;
+ my $open_in=undef;
+ my $dialog = Gtk2::FileChooserDialog->new(
+ 'Save file', undef,
+ 'save',
+ 'gtk-cancel' => 'cancel',
+ 'gtk-ok' => 'ok',
+ );
+ # if(defined $extension){
+
+ foreach my $ext (@extensions){
+ my $filter = Gtk2::FileFilter->new();
+ $filter->set_name($ext);
+ $filter->add_pattern("*.$ext");
+ $dialog->add_filter ($filter);
+ }
+
+ # }
+ if(defined $open_in){
+ $dialog->set_current_folder ($open_in);
+ # print "$open_in\n";
+
+ }
+
+ if ( "ok" eq $dialog->run ) {
+ $file = $dialog->get_filename;
+ my $ext = $dialog->get_filter;
+ $ext=$ext->get_name;
+ my ($name,$path,$suffix) = fileparse("$file",qr"\..[^.]*$");
+ $file = ($suffix eq ".$ext" )? $file : "$file.$ext";
+
+ $emulate->object_add_attribute("graph_save","name",$file);
+ $emulate->object_add_attribute("graph_save","extension",$ext);
+ $emulate->object_add_attribute("graph_save","save",1);
+ set_gui_status($emulate,"ref",1);
+
+
+
+ }
+ $dialog->destroy;
+
+
+
+
+
+
+}
+
+
+
+
+sub my_get_image {
+ my ($emulate,$self, $data) = @_;
+ $self->{graphdata} = $data;
+ my $graph = $self->{graph};
+ my $gd1=$graph->plot($data) or warn $graph->error;
+ my $loader = Gtk2::Gdk::PixbufLoader->new;
+
+
+
+ #my $gd2=$graph->plot([[0],[0]]) or warn $graph->error;
+ #$gd2->copy( $gd1, 0, 20, 0, 20, 500, 230 );
+
+
+ $loader->write ($gd1->png);
+ $loader->close;
+
+ my $save=$emulate->object_get_attribute("graph_save","save");
+ $save=0 if (!defined $save);
+ if ($save ==1){
+ my $file=$emulate->object_get_attribute("graph_save","name");
+ my $ext=$emulate->object_get_attribute("graph_save","extension");
+ $emulate->object_add_attribute("graph_save","save",0);
+
+
+ open(my $out, '>', $file);
+ if (tell $out )
+ {
+ warn "Cannot open '$file' for write: $!";
+ }else
+ {
+ #my @extens=$graph->export_format();
+ binmode $out;
+ print $out $gd1->$ext;# if($ext eq 'png');
+ #print $out $gd1->gif if($ext eq 'gif');
+ close $out;
+ }
+
+ }
+
+
+
+ my $image = Gtk2::Image->new_from_pixbuf($loader->get_pixbuf);
+ $self->{graphimage} = $image;
+ my $hotspotlist;
+ if ($self->{graphtype} eq 'bars' or
+ $self->{graphtype} eq 'lines' or
+ $self->{graphtype} eq 'linespoints') {
+ foreach my $hotspot ($graph->get_hotspot) {
+ push @$hotspotlist, $hotspot if $hotspot;
+ }
+ }
+ $self->{hotspotlist} = $hotspotlist;
+ my $eventbox = $self->{eventbox};
+ my @children = $eventbox->get_children;
+ foreach my $child (@children) {
+ $eventbox->remove($child);
+ }
+
+
+
+
+ $eventbox->add ($image);
+
+ $eventbox->signal_connect ('button-press-event' =>
+ sub {
+ my ($widget, $event) = @_;
+ return TRUE;
+ return FALSE unless $event->button == 3;
+ $self->{optionsmenu}->popup(
+ undef, # parent menu shell
+ undef, # parent menu item
+ undef, # menu pos func
+ undef, # data
+ $event->button,
+ $event->time
+ );
+ }
+ );
+ $eventbox->show_all;
+ return $eventbox;
+}
+
+
+############
+# get_graph_setting
+###########
+
+sub get_graph_setting {
+ my ($emulate,$ref)=@_;
+ my($width,$hight)=max_win_size();
+ my $window=def_popwin_size($width/3,$hight/3,'Graph Setting');
+ my $table = def_table(10, 2, FALSE);
+ my $row=0;
+
+
+my @data=@$ref;
+foreach my $d (@data) {
+ $row=noc_param_widget ($emulate, $d->{label}, $d->{param_name}, $d->{default_val}, $d->{type}, $d->{content}, $d->{info}, $table,$row,1, $d->{param_parent}, $d->{ref_delay});
+}
+
+
+
+
+ my $scrolled_win = new Gtk2::ScrolledWindow (undef, undef);
+ $scrolled_win->set_policy( "automatic", "automatic" );
+ $scrolled_win->add_with_viewport($table);
+ my $ok = def_image_button('icons/select.png',' OK ');
+
+
+ my $mtable = def_table(10, 1, FALSE);
+ $mtable->attach_defaults($scrolled_win,0,1,0,9);
+ $mtable->attach($ok,0,1,9,10,'shrink','shrink',2,2);
+ $window->add ($mtable);
+ $window->show_all();
+
+ $ok-> signal_connect("clicked" => sub{
+ $window->destroy;
+ set_gui_status($emulate,"ref",1);
+ });
+
+
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+ ################
+ # get_color_window
+ ###############
+
+ sub get_color_window{
+ my ($emulate,$atrebute1,$atrebute2)=@_;
+ my $window=def_popwin_size(800,600,"Select line color");
+ my ($r,$c)=(4,8);
+ my $table= def_table(5,6,TRUE);
+ for (my $col=0;$col<$c;$col++){
+ for (my $row=0;$row<$r;$row++){
+ my $color_num=$row*$c+$col;
+ my $color=def_colored_button(" ",$color_num);
+ $table->attach_defaults ($color, $col, $col+1, $row, $row+1);
+ $color->signal_connect("clicked"=> sub{
+ $emulate->object_add_attribute($atrebute1,$atrebute2,$color_num);
+ #print "$emulate->object_add_attribute($atrebute1,$atrebute2,$color_num);\n";
+ set_gui_status($emulate,"ref",1);
+ $window->destroy;
+ });
+ }
+ }
+
+ $window->add($table);
+
+ $window->show_all();
+
+}
+
+
+
+
+sub check_inserted_ratios {
+ my $str=shift;
+ my @ratios;
+
+ my @chunks=split(',',$str);
+ foreach my $p (@chunks){
+ if($p !~ /^[0-9.:,]+$/){ message_dialog ("$p has invalid character(S)" ); return undef; }
+ my @range=split(':',$p);
+ my $size= scalar @range;
+ if($size==1){ # its a number
+ if ( $range[0] <= 0 || $range[0] >100 ) { message_dialog ("$range[0] is out of boundery (1:100)" ); return undef; }
+ push(@ratios,$range[0]);
+ }elsif($size ==3){# its a range
+ my($min,$max,$step)=@range;
+ if ( $min <= 0 || $min >100 ) { message_dialog ("$min in $p is out of boundery (1:100)" ); return undef; }
+ if ( $max <= 0 || $max >100 ) { message_dialog ("$max in $p is out of boundery (1:100)" ); return undef; }
+ for (my $i=$min; $i<=$max; $i=$i+$step){
+ push(@ratios,$i);
+ }
+
+ }else{
+ message_dialog ("$p has invalid format. The correct format for range is \$min:\$max:\$step" );
+
+ }
+
+
+
+ }#foreach
+ my @r=uniq(sort {$a<=>$b} @ratios);
+ return \@r;
+
+}
+
+
+
+
+
+
+
+sub get_injection_ratios{
+ my ($emulate,$atrebute1,$atrebute2)=@_;
+ my $box = Gtk2::HBox->new( FALSE, 0 );
+ my $init=$emulate->object_get_attribute($atrebute1,$atrebute2);
+ my $entry=gen_entry($init);
+ my $button=def_image_button("icons/right.png",'Check');
+ $button->signal_connect("clicked" => sub {
+ my $text= $entry->get_text();
+ my $r=check_inserted_ratios($text);
+ if(defined $r){
+ my $all= join (',',@$r);
+ message_dialog ("$all" );
+ }
+
+
+ });
+ $entry->signal_connect ("changed" => sub {
+ my $text= $entry->get_text();
+ $emulate->object_add_attribute($atrebute1,$atrebute2,$text);
+
+ });
+ $box->pack_start( $entry, 1,1, 0);
+ $box->pack_start( $button, 0, 1, 3);
+ return $box;
+}
+
+
+
+sub get_noc_configuration{
+ my ($emulate,$n) =@_;
+ my($width,$hight)=max_win_size();
+ my $win=def_popwin_size($width/2.5,$hight*.8,"NoC configuration setting");
+ my $table=def_table(10,2,FALSE);
+ my $entry=gen_entry();
+ my $row=0;
+ my @l;
+ my @u;
+
+ my $traffics="tornado,transposed 1,transposed 2,bit reverse,bit complement,random"; #TODO hot spot
+
+ $l[$row]=gen_label_help("Select the SRAM Object File (sof) for this NoC configration.","SoF file:");
+ my $dir = Cwd::getcwd();
+
+
+ my $open_in = abs_path("$ENV{PRONOC_WORK}/emulate/sof");
+ $u[$row]= get_file_name_object ($emulate,"sample$n","sof_file",'sof',$open_in);
+ $row++;
+ $l[$row]=gen_label_help("NoC configration name. This name will be shown in load-latency graph for this configuration","Configuration name:");
+ $u[$row]=gen_entry_object ($emulate,"sample$n","line_name","NoC$n");
+ $row++;
+ $l[$row]=gen_label_help("Traffic name","Traffic name:");
+ $u[$row]=gen_combobox_object ($emulate,"sample$n","traffic",$traffics,"random");
+ $row++;
+ $l[$row]=gen_label_help("Define injection ratios. You can define individual ratios seprating by comma (\',\') or define a range of injection ratios with \$min:\$max:\$step format.
+ As an example definnig 2,3,4:10:2 will results in (2,3,4,6,8,10) injection ratios.","Injection ratios:");
+ $u[$row]=get_injection_ratios ($emulate,"sample$n","ratios");
+ $row++;
+ my $i=0;
+ for ( $i=0; $i<12; $i++){
+ if($i<$row){
+ $table->attach ($l[$i] , 0, 1, $i, $i+1,'fill','shrink',2,2);
+ $table->attach ($u[$i] , 1, 2, $i, $i+1,'fill','shrink',2,2);
+ }else{
+ my $l=gen_label_in_left(" ");
+ $table->attach_defaults ($l , 0, 1, $i, $i+1);
+ }
+ }
+
+
+ my $ok = def_image_button('icons/select.png','OK');
+
+
+ $table->attach ($ok , 1, 2, $i, $i+1,'expand','shrink',2,2);
+
+ $ok->signal_connect("clicked"=> sub{
+ #check if sof file has been selected
+ my $s=$emulate->object_get_attribute("sample$n","sof_file");
+ #check if injection ratios are valid
+ my $r=$emulate->object_get_attribute("sample$n","ratios");
+ if(defined $s && defined $r) {
+ $win->destroy;
+ set_gui_status($emulate,"ref",1);
+ } else {
+
+ if(!defined $s){
+ message_dialog("Please select sof file!")
+ } else {
+ message_dialog("Please define valid injection ratio(s)!")
+ }
+ }
+ });
+
+ $win->add($table);
+ $win->show_all;
+
+
+}
+
+
+
+#####################
+# gen_widgets_column
+###################
+
+sub gen_emulation_column {
+ my ($emulate,$title, $row_num,$info)=@_;
+ my $table=def_table($row_num,10,FALSE);
+ my $scrolled_win = new Gtk2::ScrolledWindow (undef, undef);
+ $scrolled_win->set_policy( "automatic", "automatic" );
+ $scrolled_win->add_with_viewport($table);
+ my $row=0;
+ #title
+ if(defined $title){
+ my $title=gen_label_in_center($title);
+ my $box=def_vbox(FALSE, 1);
+ $box->pack_start( $title, FALSE, FALSE, 3);
+ my $separator = Gtk2::HSeparator->new;
+ $box->pack_start( $separator, FALSE, FALSE, 3);
+ $table->attach_defaults ($box , 0, 10, $row, $row+1); $row++;
+ }
+
+
+ my $lb=gen_label_in_left("Number of emulations");
+ my $spin= gen_spin_object ($emulate,"emulate_num",undef,"1,100,1",1,'ref','1');
+ $table->attach_defaults ($lb, 0, 2, $row, $row+1);
+ $table->attach_defaults ($spin, 2, 4, $row, $row+1);$row++;
+
+
+
+
+ my @positions=(0,1,2,3,6,7);
+ my $col=0;
+
+ my @title=(" NoC configuration", "Line's color", "Clear Graph"," ");
+ foreach my $t (@title){
+
+ $table->attach_defaults (gen_label_in_center($title[$col]), $positions[$col], $positions[$col+1], $row, $row+1);$col++;
+ }
+
+ my $traffics="Random,Transposed 1,Transposed 2,Tornado";
+
+ $col=0;
+ $row++;
+ @positions=(0,1,2,3,4,5,6,7);
+
+ my $sample_num=$emulate->object_get_attribute("emulate_num",undef);
+ if(!defined $sample_num){
+ $sample_num=1;
+ $emulate->object_add_attribute("emulate_num",undef,1);
+ }
+ my $i=0;
+ for ($i=1;$i<=$sample_num; $i++){
+ $col=0;
+ my $sample="sample$i";
+ my $n=$i;
+ my $set=def_image_button("icons/setting.png");
+ my $name=$emulate->object_get_attribute($sample,"line_name");
+ my $l;
+ if (defined $name){
+ $l=gen_label_in_left($name);
+ } else {
+ $l=gen_label_in_center("Define NoC configuration");
+ $l->set_markup("Define NoC configuration");
+ }
+ my $box=def_pack_hbox(FALSE,0,(gen_label_in_left("$i- "),$l,$set));
+ $table->attach ($box, $positions[$col], $positions[$col+1], $row, $row+1,'expand','shrink',2,2);$col++;
+ $set->signal_connect("clicked"=> sub{
+ get_noc_configuration($emulate,$n);
+ });
+
+
+
+ my $color_num=$emulate->object_get_attribute($sample,"color");
+ if(!defined $color_num){
+ $color_num = $i+1;
+ $emulate->object_add_attribute($sample,"color",$color_num);
+ }
+ my $color=def_colored_button(" ",$color_num);
+ $table->attach ($color, $positions[$col], $positions[$col+1], $row, $row+1,'expand','shrink',2,2);$col++;
+
+
+
+
+
+
+ $color->signal_connect("clicked"=> sub{
+ get_color_window($emulate,$sample,"color");
+ });
+
+ #clear line
+ my $clear = def_image_button('icons/clear.png');
+ $clear->signal_connect("clicked"=> sub{
+ $emulate->object_add_attribute ($sample,'result',undef);
+ set_gui_status($emulate,"ref",2);
+ });
+ $table->attach ($clear, $positions[$col], $positions[$col+1], $row, $row+1,'expand','shrink',2,2);$col++;
+ #run/pause
+ my $run = def_image_button('icons/run.png','Run');
+ $table->attach ($run, $positions[$col], $positions[$col+1], $row, $row+1,'expand','shrink',2,2);$col++;
+ $run->signal_connect("clicked"=> sub{
+ $emulate->object_add_attribute ($sample,"status","run");
+ #start the emulator if it is not running
+ my $status= $emulate->object_get_attribute('status',undef);
+ if($status ne 'run'){
+
+ run_emulator($emulate,$info);
+ set_gui_status($emulate,"ref",2);
+ }
+
+ });
+
+ my $image = gen_noc_status_image($emulate,$i);
+
+ $table->attach_defaults ($image, $positions[$col], $positions[$col+1], $row, $row+1);
+
+
+ $row++;
+
+ }
+ while ( $row<15){
+ $table->attach_defaults (gen_label_in_left(' '), 0, 1, $row, $row+1); $row++;
+ }
+
+
+
+
+ return $scrolled_win;
+}
+
+
+
+
+##########
+#
+##########
+
+sub check_sample{
+ my ($emulate,$i,$info)=@_;
+ my $status=1;
+ my $sof=$emulate->object_get_attribute ("sample$i","sof_file");
+ # ckeck if sample have sof file
+ if(!defined $sof){
+ add_info($info, "Error: SoF file has not set for NoC$i!\n");
+ $emulate->object_add_attribute ("sample$i","status","failed");
+ $status=0;
+ } else {
+ # ckeck if sof file has info file
+ my ($name,$path,$suffix) = fileparse("$sof",qr"\..[^.]*$");
+ my $sof_info="$path$name.inf";
+ if(!(-f $sof_info)){
+ add_info($info, "Could not find $name.inf file in $path. An information file is required for each sof file containig the device name and NoC configuration. Press F4 for more help.\n");
+ $emulate->object_add_attribute ("sample$i","status","failed");
+ $status=0;
+ }else { #add info
+ my $p= do $sof_info ;
+ $status=0 if $@;
+ message_dialog("Error reading: $@") if $@;
+ if ($status==1){
+ $emulate->object_add_attribute ("sample$i","noc_info",$p) ;
+ #print"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh\n";
+
+ }
+
+
+
+ }
+ }
+
+
+ return $status;
+
+
+}
+
+
+
+
+##########
+# run external commands
+##########
+
+
+
+
+
+sub run_cmd_in_back_ground
+{
+ my $command = shift;
+
+
+
+
+
+
+ ### Start running the Background Job:
+ my $proc = Proc::Background->new($command);
+ my $PID = $proc->pid;
+ my $start_time = $proc->start_time;
+ my $alive = $proc->alive;
+
+ ### While $alive is NOT '0', then keep checking till it is...
+ # *When $alive is '0', it has finished executing.
+ while($alive ne 0)
+ {
+ $alive = $proc->alive;
+
+ # This while loop will cause Gtk2 to conti processing events, if
+ # there are events pending... *which there are...
+ while (Gtk2->events_pending) {
+ Gtk2->main_iteration;
+ }
+ Gtk2::Gdk->flush;
+
+ usleep(1000);
+ }
+
+ my $end_time = $proc->end_time;
+ # print "*Command Completed at $end_time, with PID = $PID\n\n";
+
+ # Since the while loop has exited, the BG job has finished running:
+ # so close the pop-up window...
+ # $popup_window->hide;
+
+ # Get the RETCODE from the Background Job using the 'wait' method
+ my $retcode = $proc->wait;
+ $retcode /= 256;
+
+ print "\t*RETCODE == $retcode\n\n";
+ Gtk2::Gdk->flush;
+ ### Check if the RETCODE returned with an Error:
+ if ($retcode ne 0) {
+ print "Error: The Background Job ($command) returned with an Error...!\n";
+ return 1;
+ } else {
+ #print "Success: The Background Job Completed Successfully...!\n";
+ return 0;
+ }
+
+}
+
+
+
+
+sub run_cmd_in_back_ground_get_stdout
+{
+ my $cmd=shift;
+ my $exit;
+ my ($stdout, $stderr);
+ capture { $exit=run_cmd_in_back_ground($cmd) } \$stdout, \$stderr;
+ return ($stdout,$exit,$stderr);
+
+}
+
+
+#############
+# images
+##########
+sub get_status_gif{
+ my $emulate=shift;
+ my $status= $emulate->object_get_attribute('status',undef);
+ if($status eq 'ideal'){
+ return show_gif ("icons/ProNoC.png");
+ } elsif ($status eq 'run') {
+ my($width,$hight)=max_win_size();
+ my $image=($width>=1600)? "icons/hamster_l.gif":
+ ($width>=1200)? "icons/hamster_m.gif": "icons/hamster_s.gif";
+
+ return show_gif ($image);
+ } elsif ($status eq 'programer_failed') {
+ return show_gif ("icons/Error.png");
+ }
+
+}
+
+
+
+
+sub gen_noc_status_image {
+ my ($emulate,$i)=@_;
+ my $status= $emulate->object_get_attribute ("sample$i","status");
+ $status='' if(!defined $status);
+ my $image;
+ my $vbox = Gtk2::HBox->new (TRUE,1);
+ $image = Gtk2::Image->new_from_file ("icons/load.gif") if($status eq "run");
+ $image = def_image("icons/button_ok.png") if($status eq "done");
+ $image = def_image("icons/cancel.png") if($status eq "failed");
+ #$image_file = "icons/load.gif" if($status eq "run");
+
+ if (defined $image) {
+ my $align = Gtk2::Alignment->new (0.5, 0.5, 0, 0);
+ my $frame = Gtk2::Frame->new;
+ $frame->set_shadow_type ('in');
+ # Animation
+ $frame->add ($image);
+ $align->add ($frame);
+ $vbox->pack_start ($align, FALSE, FALSE, 0);
+ }
+ return $vbox;
+
+}
+
+
+############
+# run_emulator
+###########
+
+sub run_emulator {
+ my ($emulate,$info)=@_;
+ #return if(!check_samples($emulate,$info));
+ $emulate->object_add_attribute('status',undef,'run');
+ set_gui_status($emulate,"ref",1);
+ show_info($info, "start emulation\n");
+
+ #search for available usb blaster
+ my $cmd = "jtagconfig";
+ my ($stdout,$exit)=run_cmd_in_back_ground_get_stdout("$cmd");
+ my @matches= ($stdout =~ /USB-Blaster.*/g);
+ my $usb_blaster=$matches[0];
+ if (!defined $usb_blaster){
+ add_info($info, "jtagconfig could not find any USB blaster cable: $stdout \n");
+ $emulate->object_add_attribute('status',undef,'programer_failed');
+ set_gui_status($emulate,"ref",2);
+ return;
+ }else{
+ add_info($info, "find $usb_blaster\n");
+ }
+ my $sample_num=$emulate->object_get_attribute("emulate_num",undef);
+ for (my $i=1; $i<=$sample_num; $i++){
+ my $status=$emulate->object_get_attribute ("sample$i","status");
+ next if($status ne "run");
+ next if(!check_sample($emulate,$i,$info));
+ my $r= $emulate->object_get_attribute("sample$i","ratios");
+ my @ratios=@{check_inserted_ratios($r)};
+ #$emulate->object_add_attribute ("sample$i","status","run");
+ my $sof=$emulate->object_get_attribute ("sample$i","sof_file");
+ add_info($info, "Programe FPGA device using $sof\n");
+ my $Quartus_bin= $ENV{QUARTUS_BIN};
+
+
+ my $cmd = "$Quartus_bin/quartus_pgm -c \"$usb_blaster\" -m jtag -o \"p;$sof\"";
+ #my $output = `$cmd 2>&1 1>/dev/null`; # either with backticks
+ my ($stdout,$exit)=run_cmd_in_back_ground_get_stdout("$cmd");
+ if($exit){#programming FPGA board has failed
+ $emulate->object_add_attribute('status',undef,'programer_failed');
+ add_info($info, "$stdout\n");
+ $emulate->object_add_attribute ("sample$i","status","failed");
+ set_gui_status($emulate,"ref",2);
+ next;
+ }
+ # read noc configuration
+ my $traffic = $emulate->object_get_attribute("sample$i","traffic");
+
+
+ my $ref=$emulate->object_get_attribute("sample$i","noc_info");
+
+ foreach my $ratio_in (@ratios){
+
+
+ add_info($info, "Configure packet generators for injection ratio of $ratio_in \% \n");
+ next if(!programe_pck_gens($ref,$traffic,$ratio_in,$info));
+
+ my $avg=read_pack_gen($ref,$info);
+ my $ref=$emulate->object_get_attribute ("sample$i","result");
+ my %results;
+ %results= %{$ref} if(defined $ref);
+ #push(@results,$avg);
+ $results{$ratio_in}=$avg;
+ $emulate->object_add_attribute ("sample$i","result",\%results);
+ set_gui_status($emulate,"ref",2);
+
+ }
+ $emulate->object_add_attribute ("sample$i","status","done");
+
+ }
+
+ add_info($info, "End emulation!\n");
+ $emulate->object_add_attribute('status',undef,'ideal');
+ set_gui_status($emulate,"ref",1);
+}
+
+
+
+
+
+
+
+
+
+
+sub process_notebook_gen{
+ my ($emulate,$info)=@_;
+ my $notebook = Gtk2::Notebook->new;
+ $notebook->set_tab_pos ('left');
+ $notebook->set_scrollable(TRUE);
+ $notebook->can_focus(FALSE);
+ my $page1=gen_emulation_column($emulate,"NoC Configuration",10,$info);
+ $notebook->append_page ($page1,Gtk2::Label->new_with_mnemonic (" _Run emulator "));
+
+
+ my $page2=get_noc_setting_gui ($emulate,$info);
+ my $pp=$notebook->append_page ($page2,Gtk2::Label->new_with_mnemonic (" _Generate sof "));
+
+
+
+
+ my $scrolled_win = new Gtk2::ScrolledWindow (undef, undef);
+ $scrolled_win->set_policy( "automatic", "automatic" );
+ $scrolled_win->add_with_viewport($notebook);
+ $scrolled_win->show_all;
+ my $page_num=$emulate->object_get_attribute ("process_notebook","currentpage");
+ $notebook->set_current_page ($page_num) if(defined $page_num);
+ $notebook->signal_connect( 'switch-page'=> sub{
+ $emulate->object_add_attribute ("process_notebook","currentpage",$_[2]); #save the new pagenumber
+
+ });
+
+ return $scrolled_win;
+
+}
+
+
+sub get_noc_setting_gui {
+ my ($emulate,$info_text)=@_;
+ my $table=def_table(20,10,FALSE);# my ($row,$col,$homogeneous)=@_;
+ my $scrolled_win = new Gtk2::ScrolledWindow (undef, undef);
+ $scrolled_win->set_policy( "automatic", "automatic" );
+ $scrolled_win->add_with_viewport($table);
+ my $row=noc_config ($emulate,$table);
+
+ my($label,$param,$default,$content,$type,$info);
+ my @dirs = grep {-d} glob("../src_emulate/fpga/*");
+ my $fpgas;
+ foreach my $dir (@dirs) {
+ my ($name,$path,$suffix) = fileparse("$dir",qr"\..[^.]*$");
+ $default=$name;
+ $fpgas= (defined $fpgas)? "$fpgas,$name" : "$name";
+
+ }
+
+
+
+ $label='simulation param';
+ $content=$fpgas;
+ $type='Entry';
+ $info=" I will add later";
+
+ my %simparam;
+ $simparam{'MAX_PCK_NUM'}=2560000;
+ $simparam{'MAX_SIM_CLKs'}=1000000;
+ $simparam{'MAX_PCK_SIZ'}=10;
+ $simparam{'TIMSTMP_FIFO_NUM'}=16;
+
+ foreach my $p (sort keys %simparam){
+ # print "\$p, \$simparam{\$p}=$p, $simparam{$p}\n";
+ $row=noc_param_widget ($emulate,$label,$p, $simparam{$p},$type,$content,$info, $table,$row,0,'noc_param');
+ }
+
+
+ #FPGA NAME
+ $label='FPGA board';
+ $param='FPGA_BOARD';
+ $content=$fpgas;
+ $type='Combo-box';
+ $info=" I will add later";
+ $row=noc_param_widget ($emulate,$label,$param, $default,$type,$content,$info, $table,$row,1,'fpga_param');
+
+
+ #save as
+ $label='Save as:';
+ $param='SAVE_NAME';
+ $default='emulate1';
+ $content=undef;
+ $type="Entry";
+ $info="define generated sof file's name";
+ $row=noc_param_widget ($emulate,$label,$param, $default,$type,$content,$info, $table,$row,1,'fpga_param');
+
+
+ #Project_dir
+ $label='Project directory';
+ $param='SOF_DIR';
+ $default="../../mpsoc_work/emulate";
+ $content=undef;
+ $type="DIR_path";
+ $info="Define the working directory for generating .sof file";
+ $row=noc_param_widget ($emulate,$label,$param, $default,$type,$content,$info, $table,$row,1,'fpga_param');
+
+
+
+
+ my $generate = def_image_button('icons/gen.png','Generate');
+
+
+ $table->attach ($generate, 0,3, $row, $row+1,'expand','shrink',2,2);
+
+ $generate->signal_connect ('clicked'=> sub{
+ generate_sof_file($emulate,$info_text);
+
+ });
+
+
+ return $scrolled_win;
+
+}
+
+
+
+
+
+
+
+sub generate_sof_file {
+ my ($emulate,$info)=@_;
+ print "start compilation\n";
+ my $fpga_board= $emulate->object_get_attribute ('fpga_param',"FPGA_BOARD");
+ #create work directory
+ my $dir_name=$emulate->object_get_attribute ('fpga_param',"SOF_DIR");
+ my $save_name=$emulate->object_get_attribute ('fpga_param',"SAVE_NAME");
+ $save_name=$fpga_board if (!defined $save_name);
+ $dir_name= "$dir_name/$save_name";
+
+ show_info($info, "generate working directory: $dir_name\n");
+
+
+ #copy all noc source codes
+ my @files =("mpsoc/src_noc/*", "mpsoc/src_emulate/rtl/*","mpsoc/src_peripheral/jtag/jtag_wb/*");
+
+
+ my $dir = Cwd::getcwd();
+ my $project_dir = abs_path("$dir/../../");
+ my ($stdout,$exit)=run_cmd_in_back_ground_get_stdout("mkdir -p $dir_name/src/" );
+ foreach my $f (@files){
+ ($stdout,$exit) =run_cmd_in_back_ground_get_stdout("cp -Rf \"$project_dir\"/$f \"$dir_name/src/\"" );
+ if($exit != 0 ){ print "$stdout\n"; message_dialog($stdout); return;}
+ }
+
+
+
+ #copy fpga board files
+
+ ($stdout,$exit)=run_cmd_in_back_ground_get_stdout("cp -Rf \"$project_dir/mpsoc/src_emulate/fpga/$fpga_board\"/* \"$dir_name/\"");
+ if($exit != 0 ){ print "$stdout\n"; message_dialog($stdout); return;}
+
+ #generate emulator_top.v file
+
+ open(FILE, ">$dir_name/emulator_top.v") || die "Can not open: $!";
+ print FILE gen_emulate_top_v($emulate);
+ close(FILE) || die "Error closing file: $!";
+
+
+ #compile the code
+ my $Quartus_bin= $ENV{QUARTUS_BIN};
+ add_info($info, "Start Quartus compilation\n $stdout\n");
+ ($stdout,$exit)=run_cmd_in_back_ground_get_stdout( " cd \"$dir_name/\"
+ xterm -e $Quartus_bin/quartus_map --64bit $fpga_board --read_settings_files=on
+ xterm -e $Quartus_bin/quartus_fit --64bit $fpga_board --read_settings_files=on
+ xterm -e $Quartus_bin/quartus_asm --64bit $fpga_board --read_settings_files=on
+ xterm -e $Quartus_bin/quartus_sta --64bit $fpga_board
+ ");
+ if($exit != 0){
+ print "Quartus compilation failed !\n";
+ add_info($info, "Quartus compilation failed !\n $stdout\n");
+ return;
+
+ } else {
+ #save sof file
+ my $sofdir="$ENV{PRONOC_WORK}/emulate/sof";
+ mkpath("$sofdir/",1,01777);
+ open(FILE, ">$sofdir/$save_name.inf") || die "Can not open: $!";
+ print FILE perl_file_header("$save_name.inf");
+ print FILE Data::Dumper->Dump([$emulate->{'noc_param'}],["NoCparam"]);
+ close(FILE) || die "Error closing file: $!";
+ ($stdout,$exit)=run_cmd_in_back_ground_get_stdout("cp $dir_name/output_files/$fpga_board.sof $sofdir/$save_name.sof");
+ if($exit != 0 ){ print "$stdout\n"; message_dialog($stdout); return;}
+ message_dialog("sof file has been generated successfully"); return;
+ }
+
+
+
+}
+
+##########
+# save_emulation
+##########
+sub save_emulation {
+ my ($emulate)=@_;
+ # read emulation name
+ my $name=$emulate->object_get_attribute ("emulate_name",undef);
+ my $s= (!defined $name)? 0 : (length($name)==0)? 0 :1;
+ if ($s == 0){
+ message_dialog("Please set emulation name!");
+ return 0;
+ }
+ # Write object file
+ open(FILE, ">lib/emulate/$name.EML") || die "Can not open: $!";
+ print FILE perl_file_header("$name.EML");
+ print FILE Data::Dumper->Dump([\%$emulate],[$name]);
+ close(FILE) || die "Error closing file: $!";
+ message_dialog("Emulation saved as lib/emulate/$name.EML!");
+ return 1;
+}
+
+#############
+# load_emulation
+############
+
+sub load_emulation {
+ my ($emulate,$info)=@_;
+ my $file;
+ my $dialog = Gtk2::FileChooserDialog->new(
+ 'Select a File', undef,
+ 'open',
+ 'gtk-cancel' => 'cancel',
+ 'gtk-ok' => 'ok',
+ );
+
+ my $filter = Gtk2::FileFilter->new();
+ $filter->set_name("EML");
+ $filter->add_pattern("*.EML");
+ $dialog->add_filter ($filter);
+ my $dir = Cwd::getcwd();
+ $dialog->set_current_folder ("$dir/lib/emulate");
+
+
+ if ( "ok" eq $dialog->run ) {
+ $file = $dialog->get_filename;
+ my ($name,$path,$suffix) = fileparse("$file",qr"\..[^.]*$");
+ if($suffix eq '.EML'){
+ my $pp= eval { do $file };
+ if ($@ || !defined $pp){
+ add_info($info,"**Error reading $file file: $@\n");
+ $dialog->destroy;
+ return;
+ }
+
+ clone_obj($emulate,$pp);
+ #message_dialog("done!");
+ }
+ }
+ $dialog->destroy;
+}
+
+############
+# main
+############
+sub emulator_main{
+
+ add_color_to_gd();
+ my $emulate= emulator->emulator_new();
+ set_gui_status($emulate,"ideal",0);
+ my $left_table = Gtk2::Table->new (25, 6, FALSE);
+ my $right_table = Gtk2::Table->new (25, 6, FALSE);
+
+ my $main_table = Gtk2::Table->new (25, 12, FALSE);
+ my ($infobox,$info)= create_text();
+ my $refresh = Gtk2::Button->new_from_stock('ref');
+
+
+
+
+
+ my $conf_box=process_notebook_gen($emulate,\$info);
+ my $chart =gen_chart ($emulate);
+
+
+
+ $main_table->set_row_spacings (4);
+ $main_table->set_col_spacings (1);
+
+ #my $device_win=show_active_dev($soc,$soc,$infc,$soc_state,\$refresh,$info);
+
+
+ my $generate = def_image_button('icons/forward.png','Run all');
+ my $open = def_image_button('icons/browse.png','Load');
+
+
+
+
+ my ($entrybox,$entry) = def_h_labeled_entry('Save as:',undef);
+ $entry->signal_connect( 'changed'=> sub{
+ my $name=$entry->get_text();
+ $emulate->object_add_attribute ("emulate_name",undef,$name);
+ });
+ my $save = def_image_button('icons/save.png','Save');
+ $entrybox->pack_end($save, FALSE, FALSE,0);
+
+
+ #$table->attach_defaults ($event_box, $col, $col+1, $row, $row+1);
+ my $image = get_status_gif($emulate);
+
+
+
+
+
+ $left_table->attach_defaults ($conf_box , 0, 6, 0, 20);
+ $left_table->attach_defaults ($image , 0, 6, 20, 24);
+ $left_table->attach ($open,0, 3, 24,25,'expand','shrink',2,2);
+ $left_table->attach ($entrybox,3, 6, 24,25,'expand','shrink',2,2);
+ $right_table->attach_defaults ($infobox , 0, 6, 0,12);
+ $right_table->attach_defaults ($chart , 0, 6, 12, 24);
+ $right_table->attach ($generate, 4, 6, 24,25,'expand','shrink',2,2);
+ $main_table->attach_defaults ($left_table , 0, 6, 0, 25);
+ $main_table->attach_defaults ($right_table , 6, 12, 0, 25);
+
+
+
+ #referesh the mpsoc generator
+ $refresh-> signal_connect("clicked" => sub{
+ my $name=$emulate->object_get_attribute ("emulate_name",undef);
+ $entry->set_text($name) if(defined $name);
+
+
+ $conf_box->destroy();
+ $chart->destroy();
+ $image->destroy();
+ $image = get_status_gif($emulate);
+ $conf_box=process_notebook_gen($emulate,\$info);
+ $chart =gen_chart ($emulate);
+ $left_table->attach_defaults ($image , 0, 6, 20, 24);
+ $left_table->attach_defaults ($conf_box , 0, 6, 0, 12);
+ $right_table->attach_defaults ($chart , 0, 6, 12, 24);
+
+ $conf_box->show_all();
+ $main_table->show_all();
+
+
+ });
+
+
+
+ #check soc status every 0.5 second. referesh device table if there is any changes
+ Glib::Timeout->add (100, sub{
+
+ my ($state,$timeout)= get_gui_status($emulate);
+
+ if ($timeout>0){
+ $timeout--;
+ set_gui_status($emulate,$state,$timeout);
+
+ }
+ elsif( $state ne "ideal" ){
+ $refresh->clicked;
+ #my $saved_name=$mpsoc->mpsoc_get_mpsoc_name();
+ #if(defined $saved_name) {$entry->set_text($saved_name);}
+ set_gui_status($emulate,"ideal",0);
+
+ }
+ return TRUE;
+
+ } );
+
+
+ $generate-> signal_connect("clicked" => sub{
+ my $sample_num=$emulate->object_get_attribute("emulate_num",undef);
+ for (my $i=1; $i<=$sample_num; $i++){
+ $emulate->object_add_attribute ("sample$i","status","run");
+ }
+ run_emulator($emulate,\$info);
+ #set_gui_status($emulate,"ideal",2);
+
+ });
+
+# $wb-> signal_connect("clicked" => sub{
+# wb_address_setting($mpsoc);
+#
+# });
+
+ $open-> signal_connect("clicked" => sub{
+
+ load_emulation($emulate,\$info);
+ set_gui_status($emulate,"ref",5);
+
+ });
+
+ $save-> signal_connect("clicked" => sub{
+ save_emulation($emulate);
+ set_gui_status($emulate,"ref",5);
+
+
+ });
+
+ my $sc_win = new Gtk2::ScrolledWindow (undef, undef);
+ $sc_win->set_policy( "automatic", "automatic" );
+ $sc_win->add_with_viewport($main_table);
+
+ return $sc_win;
+
+
+}
+
+
+
emulator.pl
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: emulator.pm
===================================================================
--- emulator.pm (nonexistent)
+++ emulator.pm (revision 25)
@@ -0,0 +1,84 @@
+#!/usr/bin/perl -w -I ..
+###############################################################################
+#
+# File: emulator.pm
+#
+#
+###############################################################################
+use warnings;
+use strict;
+
+
+
+package emulator;
+
+
+
+sub emulator_new {
+ # be backwards compatible with non-OO call
+ my $class = ("ARRAY" eq ref $_[0]) ? "mpsoc" : shift;
+ my $self;
+
+
+ $self = {};
+ $self->{file_name} = (); # information on each file
+ emulator_initial_setting($self);
+
+
+ bless($self,$class);
+
+
+ return $self;
+}
+
+sub emulator_initial_setting{
+ my $self=shift;
+ $self->{status}="ideal";
+ $self->{graph_scale}=5;
+ $self->{setting}{show_noc_setting}=1;
+ $self->{setting}{show_adv_setting}=0;
+ $self->{setting}{show_tile_setting}=0;
+ $self->{setting}{soc_path}="lib/soc";
+
+}
+
+
+
+
+
+
+
+
+sub object_add_attribute{
+ my ($self,$attribute1,$attribute2,$value)=@_;
+ if(!defined $attribute2){$self->{$attribute1}=$value;}
+ else {$self->{$attribute1}{$attribute2}=$value;}
+
+}
+
+sub object_get_attribute{
+ my ($self,$attribute1,$attribute2)=@_;
+ if(!defined $attribute2) {return $self->{$attribute1};}
+ return $self->{$attribute1}{$attribute2};
+
+
+}
+
+sub object_add_attribute_order{
+ my ($self,$attribute,@param)=@_;
+ $self->{'parameters_order'}{$attribute}=[] if (!defined $self->{parameters_order}{$attribute});
+ foreach my $p (@param){
+ push (@{$self->{parameters_order}{$attribute}},$p);
+
+ }
+}
+
+sub object_get_attribute_order{
+ my ($self,$attribute)=@_;
+ return @{$self->{parameters_order}{$attribute}};
+}
+
+
+
+
+1
emulator.pm
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: hdr_file_gen.pl
===================================================================
--- hdr_file_gen.pl (revision 24)
+++ hdr_file_gen.pl (revision 25)
@@ -22,6 +22,8 @@
my @plugs= $soc->soc_get_all_plugs_of_an_instance($id);
my %params= $soc->soc_get_module_param($id);
#add two extra variable the instance name and base addresses
+ my $core_id= $soc->object_add_attribute('global_param','CORE_ID');
+ $params{CORE_ID}=(defined $core_id)? $core_id: 0;
$params{IP}=$inst;
$params{CORE}=$id;
foreach my $plug (@plugs){
@@ -63,7 +65,7 @@
sub generate_header_file{
my ($soc,$project_dir,$target_dir,$dir)= @_;
- my $soc_name=$soc->soc_get_soc_name();
+ my $soc_name=$soc->object_get_attribute('soc_name');
$soc_name = uc($soc_name);
if(!defined $soc_name){$soc_name='soc'};
@@ -82,7 +84,7 @@
my $inst =$soc->soc_get_instance_name($id);
add_text_to_string(\$system_h,"\n \n /* $inst */ \n");
- $inst=uc($inst);
+ #$inst=uc($inst);
# print base address
my @plugs= $soc->soc_get_all_plugs_of_an_instance($id);
@@ -128,10 +130,10 @@
if(defined $rename){
- open(FILE, ">lib/verilog/$rename") || die "Can not open: $!";
+ open(FILE, ">lib/verilog/tmp") || die "Can not open: $!";
print FILE $content;
close(FILE) || die "Error closing file: $!";
- move ("$dir/lib/verilog/$rename","$target_dir/sw/");
+ move ("$dir/lib/verilog/tmp","$target_dir/sw/$rename");
}
@@ -142,7 +144,7 @@
}
add_text_to_string(\$system_h,"#endif\n");
- my $name=$soc->soc_get_soc_name();
+ my $name=$soc->object_get_attribute('soc_name');
open(FILE, ">lib/verilog/$name.h") || die "Can not open: $!";
print FILE $system_h;
close(FILE) || die "Error closing file: $!";
/interface.pm
249,11 → 249,11
|
my ($self,$infc_gen) =@_; |
|
my $intfc_name=$infc_gen->intfc_get_interface_name(); |
my $connection_num=$infc_gen->intfc_get_connection_num(); |
my $intfc_type=$infc_gen->intfc_get_interface_type(); |
my $intfc_info=$infc_gen->intfc_get_description(); |
my $intfc_category=$infc_gen->intfc_get_category(); |
my $intfc_name=$infc_gen->object_get_attribute('name'); |
my $connection_num=$infc_gen->object_get_attribute('connection_num'); |
my $intfc_type=$infc_gen->object_get_attribute('type'); |
my $intfc_info=$infc_gen->object_get_attribute('description'); |
my $intfc_category=$infc_gen->object_get_attribute('category'); |
|
|
my(%types,%ranges,%names,%connect_types,%connect_ranges,%connect_names,%outport_types,%default_outs); |
/interface_gen.pl
13,7 → 13,7
|
|
sub read_file_modules{ |
my ($file,$intfc_gen,$soc_state,$info)=@_; |
my ($file,$intfc_gen,$info)=@_; |
|
if (!defined $file) {return; } |
if (-e $file) { |
24,7 → 24,7
$intfc_gen->intfc_set_module_name($modules[0]); |
$intfc_gen->intfc_add_module_list(@modules); |
|
set_state($soc_state,"file_selected",1); |
set_gui_status($intfc_gen,"file_selected",1); |
show_info(\$info,"Select the module which contain the interface ports\n "); |
|
} |
40,15 → 40,15
################ |
|
sub check_input_intfc_file{ |
my ($file,$intfc_gen,$soc_state,$info)=@_; |
my ($file,$intfc_gen,$info)=@_; |
my ($name,$path,$suffix) = fileparse("$file",qr"\..[^.]*$"); |
if($suffix eq '.ITC'){ |
$intfc_gen->intfc_set_interface_file($file); |
set_state($soc_state,"load_file",0); |
set_gui_status($intfc_gen,"load_file",0); |
|
|
}else{ |
read_file_modules($file,$intfc_gen,$soc_state,$info); |
read_file_modules($file,$intfc_gen,$info); |
|
} |
|
56,15 → 56,16
} |
|
sub file_box { |
my ($intfc_gen,$soc_state,$info,$table,$row)=@_; |
my ($intfc_gen,$info)=@_; |
my $label = gen_label_in_left("Select file:"); |
my $entry = Gtk2::Entry->new; |
my $open= def_image_button("icons/select.png","Open"); |
my $browse= def_image_button("icons/browse.png","Browse"); |
my $file= $intfc_gen->intfc_get_interface_file(); |
my $intfc_info= def_image_button("icons/info.png","Description"); |
my $intfc_info= def_image_button("icons/add_info.png","Description"); |
my $table = def_table(1,10,TRUE); |
$intfc_info->signal_connect("clicked"=> sub{ |
get_intfc_description($intfc_gen,$soc_state,$info); |
get_intfc_description($intfc_gen,$info); |
|
|
}); |
94,8 → 95,8
if ( "ok" eq $dialog->run ) { |
$file = $dialog->get_filename; |
$$entry_ref->set_text($file); |
check_input_intfc_file($file,$intfc_gen,$soc_state,$info); |
#read_file_modules($file,$intfc_gen,$soc_state,$info); |
check_input_intfc_file($file,$intfc_gen,$info); |
#read_file_modules($file,$intfc_gen,$info); |
#print "file = $file\n"; |
} |
$dialog->destroy; |
106,13 → 107,13
|
$open->signal_connect("clicked"=> sub{ |
my $file_name=$entry->get_text(); |
check_input_intfc_file($file,$intfc_gen,$soc_state,$info); |
#read_file_modules($file_name,$intfc_gen,$soc_state,$info); |
check_input_intfc_file($file,$intfc_gen,$info); |
#read_file_modules($file_name,$intfc_gen,$info); |
|
}); |
$entry->signal_connect("activate"=>sub{ |
my $file_name=$entry->get_text(); |
read_file_modules($file_name,$intfc_gen,$soc_state,$info); |
read_file_modules($file_name,$intfc_gen,$info); |
}); |
|
$entry->signal_connect("changed"=>sub{ |
119,13 → 120,14
show_info(\$info,"Please select the verilog file containig the interface\n"); |
}); |
|
my $row=0; |
$table->attach_defaults ($label, 0, 1 , $row, $row+1); |
$table->attach_defaults ($entry, 1, 7 , $row, $row+1); |
$table->attach_defaults ($browse, 7, 8, $row, $row+1); |
$table->attach_defaults ($intfc_info, 8, 9 , $row, $row+1); |
$table->attach ($browse, 7, 8, $row, $row+1,'shrink','shrink',2,2); |
$table->attach ($intfc_info, 8, 9 , $row, $row+1,'shrink','shrink',2,2); |
#$table->attach_defaults ($open, 9, 10, $row, $row+1); |
#$table->attach_defaults ($entry, $col, $col+1, $row, $row+1); |
#return $table; |
return $table; |
|
|
} |
174,12 → 176,12
|
|
sub get_interface_ports { |
my ($infc_gen,$soc_state,$info)=@_; |
my ($intfc_gen,$info)=@_; |
my $window=def_popwin_size(800,600,"Import Ports"); |
|
my $file=$infc_gen->intfc_get_interface_file(); |
my $file=$intfc_gen->intfc_get_interface_file(); |
if (!defined $file){show_info(\$info,"File name has not been defined yet!"); return;} |
my $module=$infc_gen->intfc_get_module_name(); |
my $module=$intfc_gen->intfc_get_module_name(); |
if (!defined $module){ show_info(\$info,"Module name has not been selected yet!"); return;} |
my $vdb=read_file($file); |
my %port_type=get_ports_type($vdb,$module); |
212,7 → 214,7
$table->attach_defaults($separator, 0,8, $row, $row+1); |
|
$row++; |
$infc_gen->intfc_remove_ports(); |
$intfc_gen->intfc_remove_ports(); |
foreach my $p (sort keys %port_type){ |
my $port_id= $p; |
my $porttype=$port_type{$p}; |
240,13 → 242,13
my $in=$widget->get_active(); |
if ($in eq 1){ |
my $connect_type=($porttype eq "input")? "output" : ($porttype eq "output")? "input" : $porttype; |
$infc_gen->intfc_add_port($port_id,$porttype,$portrange,$p,$connect_type,$portrange,$p,"concatenate","Active low"); |
$intfc_gen->intfc_add_port($port_id,$porttype,$portrange,$p,$connect_type,$portrange,$p,"concatenate","Active low"); |
|
|
|
#print "chanhed to $in \n"; |
}else { |
$infc_gen->intfc_remove_port($port_id); |
$intfc_gen->intfc_remove_port($port_id); |
|
#print "chanhed to 0 \n"; |
|
259,11 → 261,11
|
|
my $ok= def_image_button("icons/select.png","ok"); |
$table->attach_defaults($ok, 3,5, $row, $row+1); |
$table->attach($ok, 3,5, $row, $row+1,'shrink','shrink',2,2); |
|
$ok->signal_connect("clicked"=>sub{ |
$window->destroy; |
set_state($soc_state,"refresh",1); |
set_gui_status($intfc_gen,"refresh",1); |
|
|
}); |
279,99 → 281,59
|
|
sub module_select{ |
my ($infc_gen,$soc_state,$info,$table,$row)=@_; |
my $file= $infc_gen->intfc_get_interface_file(); |
my $label = gen_label_in_left("Select module:"); |
my ($intfc_gen,$info)=@_; |
my $file= $intfc_gen->intfc_get_interface_file(); |
|
my @modules= $infc_gen->intfc_get_module_list(); |
my $saved_module=$infc_gen->intfc_get_module_name(); |
my $pos=(defined $saved_module ) ? get_scolar_pos( $saved_module,@modules) : 0; |
my $combo = gen_combo(\@modules, $pos); |
my $table = def_table(1,10,TRUE); |
|
|
|
my @modules= $intfc_gen->intfc_get_module_list(); |
my $combo=gen_combobox_object($intfc_gen,'module_name',undef,join(',', @modules),undef,'refresh',1); |
my $modul_name=labele_widget_info(" Select module:",$combo); |
|
|
my $port= def_image_button("icons/import.png","Import Ports"); |
my $label2= gen_label_in_left(" Select Category:"); |
my ($category,$category_entry)=gen_entry_help('Define the Interface category:e.g RAM, wishbone,...'); |
my $saved_category=$infc_gen->intfc_get_category(); |
if(defined $saved_category){$category_entry->set_text($saved_category);} |
my $category_entry=gen_entry_object($intfc_gen,'category',undef,undef,undef,undef); |
my $category=labele_widget_info(" Select Category:",$category_entry,'Define the Interface category:e.g RAM, wishbone,...'); |
|
|
|
$table->attach_defaults ($label, 0, 1 , $row, $row+1); |
$table->attach_defaults ($combo, 1, 3 , $row,$row+1); |
$table->attach_defaults ($port, 3, 4 , $row, $row+1); |
$table->attach_defaults ($label2, 4, 5 , $row, $row+1); |
$table->attach_defaults ($category, 5, 6 , $row, $row+1); |
|
my $row=0; |
#$table->attach_defaults ($label, 0, 1 , $row, $row+1); |
$table->attach ($modul_name, 0, 3 , $row,$row+1,'shrink','shrink',2,2); |
$table->attach ($port, 4, 6 , $row, $row+1,'shrink','shrink',2,2); |
$table->attach_defaults ($category, 7, 10 , $row, $row+1); |
|
|
$combo->signal_connect("changed"=> sub{ |
my $module= $combo->get_active_text(); |
$infc_gen->intfc_set_module_name($module); |
|
|
}); |
|
|
$port->signal_connect("clicked"=> sub{ |
get_interface_ports($infc_gen,$soc_state,$info); |
get_interface_ports($intfc_gen,$info); |
|
|
}); |
$category_entry->signal_connect("changed"=> sub{ |
my $name=$category_entry->get_text(); |
$infc_gen->intfc_set_category($name); |
|
}); |
|
|
|
return $table; |
|
|
} |
|
sub interface_type_select { |
my ($infc_gen,$soc_state,$info,$table,$row)=@_; |
my $saved_intfc_type= $infc_gen->intfc_get_interface_type(); |
my $label = gen_label_in_left("Interface name:"); |
my ($intfc_gen,$info,$table,$row)=@_; |
|
my $entry=gen_entry_object($intfc_gen,'name',undef,undef,"refresh",50); |
my $entrybox=labele_widget_info(" Interface name:",$entry); |
|
my $combo=gen_combobox_object($intfc_gen,'connection_num',undef,"single connection,multi connection","single connection",'refresh',1); |
my $combo_box=labele_widget_info(" Select soket type:",$combo,'Define the soket as multi connection if only all interfaces ports all output and they can feed more than one plug connection'); |
|
$table->attach_defaults ($entrybox, 0, 2 , $row, $row+1); |
$table->attach_defaults ($combo_box, 3, 5 , $row, $row+1); |
|
my $saved_name=$infc_gen->intfc_get_interface_name(); |
my $entry=gen_entry($saved_name); |
|
$entry->signal_connect("changed"=>sub{ |
my $widget=shift; |
my $name=$widget->get_text(); |
$infc_gen->intfc_set_interface_name($name); |
set_state($soc_state,"refresh",50); |
|
} |
); |
|
my $saved_connection_num= $infc_gen->intfc_get_connection_num(); |
my $label2 = gen_label_in_left("Select soket type:"); |
|
my @connection_nums=("single connection","multi connection"); |
my $pos; |
if(defined $saved_connection_num){ |
$pos= get_scolar_pos( $saved_connection_num,@connection_nums); |
} |
else { |
$pos= 0; |
$infc_gen->intfc_set_connection_num($connection_nums[0]); |
} |
my $combo=gen_combo(\@connection_nums,$pos); |
|
$combo->signal_connect("changed"=>sub{ |
my $widget=shift; |
my $connection_num=$widget->get_active_text(); |
$infc_gen->intfc_set_connection_num($connection_num); |
set_state($soc_state,"refresh",1); |
|
}); |
$table->attach_defaults ($label, 0, 1 , $row, $row+1); |
$table->attach_defaults ($entry, 1, 2 , $row, $row+1); |
$table->attach_defaults ($label2, 2, 3 , $row, $row+1); |
$table->attach_defaults ($combo, 3, 4 , $row, $row+1); |
|
|
|
} |
|
|
380,9 → 342,9
|
|
sub port_select{ |
my ($infc_gen,$soc_state,$info,$table,$row)=@_; |
my ($intfc_gen,$info,$table,$row)=@_; |
my(%types,%ranges,%names,%connect_types,%connect_ranges,%connect_names,%outport_types,%default_outs); |
$infc_gen->intfc_get_ports(\%types,\%ranges,\%names,\%connect_types,\%connect_ranges,\%connect_names,\%outport_types,\%default_outs); |
$intfc_gen->intfc_get_ports(\%types,\%ranges,\%names,\%connect_types,\%connect_ranges,\%connect_names,\%outport_types,\%default_outs); |
|
my $size = keys %types; |
if($size >0){ |
393,23 → 355,23
my $swap= def_image_button("icons/swap.png","swap"); |
|
$swap->signal_connect('clicked'=>sub{ |
my $type=$infc_gen->intfc_get_interface_type(); |
my $type=$intfc_gen->intfc_get_interface_type(); |
if($type eq 'plug'){ |
$infc_gen->intfc_set_interface_type('socket'); |
$intfc_gen->intfc_set_interface_type('socket'); |
} |
else { |
$infc_gen->intfc_set_interface_type('plug'); |
$intfc_gen->intfc_set_interface_type('plug'); |
} |
set_state($soc_state,"refresh",1); |
set_gui_status($intfc_gen,"refresh",1); |
|
}); |
|
|
my @intfcs=("plug","socket"); |
my $inttype=$infc_gen->intfc_get_interface_type(); |
my $inttype=$intfc_gen->intfc_get_interface_type(); |
if (!defined $inttype){ |
$inttype='plug'; |
$infc_gen->intfc_set_interface_type($inttype); |
$intfc_gen->intfc_set_interface_type($inttype); |
} |
|
#my $lab1= gen_label_in_center($inttype); |
426,9 → 388,9
my $sep2 = Gtk2::HSeparator->new; |
|
|
$table->attach_defaults ($lab1, 1, 2 , $row, $row+1); |
$table->attach_defaults ($swap, 3, 4 , $row, $row+1); |
$table->attach_defaults ($lab2, 5, 6 , $row, $row+1); $row++; |
$table->attach ($lab1, 1, 2 , $row, $row+1,'shrink','shrink',2,2); |
$table->attach ($swap, 3, 4 , $row, $row+1,'shrink','shrink',2,2); |
$table->attach ($lab2, 5, 6 , $row, $row+1,'shrink','shrink',2,2); $row++; |
$table->attach_defaults ($sep2, 0, 9 , $row, $row+1); $row++; |
|
|
459,7 → 421,7
my $default_out=$default_outs{$id}; |
if(! defined $default_out){ |
$default_out = "Active low"; # port_width_repeat($connect_range,"1\'b0"); |
$infc_gen->intfc_add_port($id,$type,$range,$name,$connect_type,$connect_range,$connect_name,$outport_type,$default_out); |
$intfc_gen->intfc_add_port($id,$type,$range,$name,$connect_type,$connect_range,$connect_name,$outport_type,$default_out); |
print "\$default_out is set to: $default_out\n "; |
} |
|
507,45 → 469,45
$combo1->signal_connect("changed"=>sub{ |
my $new_type=$combo1->get_active_text(); |
my $new_connect_type=($new_type eq "input")? "output" : ($new_type eq "output")? "input" : $new_type; |
$infc_gen->intfc_add_port($id,$new_type,$range,$name,$new_connect_type,$connect_range,$connect_name,$outport_type,$default_out); |
set_state($soc_state,"refresh",1); |
$intfc_gen->intfc_add_port($id,$new_type,$range,$name,$new_connect_type,$connect_range,$connect_name,$outport_type,$default_out); |
set_gui_status($intfc_gen,"refresh",1); |
|
}); |
$entry2->signal_connect("changed"=>sub{ |
$range=$entry2->get_text(); |
$infc_gen->intfc_add_port($id,$type,$range,$name,$connect_type,$connect_range,$connect_name,$outport_type,$default_out); |
set_state($soc_state,"refresh",50); |
$intfc_gen->intfc_add_port($id,$type,$range,$name,$connect_type,$connect_range,$connect_name,$outport_type,$default_out); |
set_gui_status($intfc_gen,"refresh",50); |
|
}); |
$entry3->signal_connect("changed"=>sub{ |
$name=$entry3->get_text(); |
$infc_gen->intfc_add_port($id,$type,$range,$name,$connect_type,$connect_range,$connect_name,$outport_type,$default_out); |
set_state($soc_state,"refresh",50); |
$intfc_gen->intfc_add_port($id,$type,$range,$name,$connect_type,$connect_range,$connect_name,$outport_type,$default_out); |
set_gui_status($intfc_gen,"refresh",50); |
|
}); |
|
$entry4->signal_connect("changed"=>sub{ |
$connect_range=$entry4->get_text(); |
$infc_gen->intfc_add_port($id,$type,$range,$name,$connect_type,$connect_range,$connect_name,$outport_type,$default_out); |
set_state($soc_state,"refresh",50); |
$intfc_gen->intfc_add_port($id,$type,$range,$name,$connect_type,$connect_range,$connect_name,$outport_type,$default_out); |
set_gui_status($intfc_gen,"refresh",50); |
|
}); |
$entry5->signal_connect("changed"=>sub{ |
$connect_name=$entry5->get_text(); |
$infc_gen->intfc_add_port($id,$type,$range,$name,$connect_type,$connect_range,$connect_name,$outport_type,$default_out); |
set_state($soc_state,"refresh",50); |
$intfc_gen->intfc_add_port($id,$type,$range,$name,$connect_type,$connect_range,$connect_name,$outport_type,$default_out); |
set_gui_status($intfc_gen,"refresh",50); |
|
}); |
$combo2->signal_connect("changed"=>sub{ |
my $new_outport_type=$combo2->get_active_text(); |
$infc_gen->intfc_add_port($id,$type,$range,$name,$connect_type,$connect_range,$connect_name,$new_outport_type,$default_out); |
set_state($soc_state,"refresh",1); |
$intfc_gen->intfc_add_port($id,$type,$range,$name,$connect_type,$connect_range,$connect_name,$new_outport_type,$default_out); |
set_gui_status($intfc_gen,"refresh",1); |
|
}); |
($combentry->child)->signal_connect('changed' => sub { |
my ($entry) = @_; |
$default_out=$entry->get_text(); |
$infc_gen->intfc_add_port($id,$type,$range,$name,$connect_type,$connect_range,$connect_name,$outport_type,$default_out); |
$intfc_gen->intfc_add_port($id,$type,$range,$name,$connect_type,$connect_range,$connect_name,$outport_type,$default_out); |
|
|
}); |
571,50 → 533,29
|
|
|
sub dev_box_gen{ |
my($infc_gen,$soc_state,$info)=@_; |
|
|
|
sub dev_box_show{ |
my($intfc_gen,$info)=@_; |
|
my $table = def_table(20,10,FALSE); |
|
file_box($infc_gen,$soc_state,$info,$table,0); |
module_select($infc_gen,$soc_state,$info,$table,1); |
interface_type_select($infc_gen,$soc_state,$info,$table,2); |
my $row=port_select($infc_gen,$soc_state,$info,$table,3); |
|
interface_type_select($intfc_gen,$info,$table,0); |
my $row=port_select($intfc_gen,$info,$table,1); |
for (my $i=$row; $i<20; $i++){ |
my $temp=gen_label_in_center(""); |
my $temp=gen_label_in_center(" "); |
$table->attach_defaults ($temp, 0, 1 , $i, $i+1); |
} |
|
return $table; |
} |
|
|
|
|
|
sub dev_box_show{ |
my($infc_gen,$soc_state,$info,$refresh_ref)=@_; |
my $box= def_table (1, 1, TRUE); |
my $dev_table = dev_box_gen($infc_gen,$soc_state,$info); |
my $scrolled_win = new Gtk2::ScrolledWindow (undef, undef); |
$scrolled_win->set_policy( "automatic", "automatic" ); |
$scrolled_win->add_with_viewport($dev_table); |
$scrolled_win->add_with_viewport($table); |
|
|
|
$$refresh_ref-> signal_connect("clicked" => sub{ |
$dev_table->destroy; |
select(undef, undef, undef, 0.1); #wait 10 ms |
$dev_table = dev_box_gen($infc_gen,$soc_state,$info); |
#$box->attach_defaults ($dev_table, 0, 1, 0, 1);#( $dev_table, FALSE, FALSE, 3); |
$scrolled_win->add_with_viewport($dev_table); |
$dev_table->show; |
$scrolled_win->show_all; |
|
|
|
}); |
#$box->attach_defaults ($dev_table, 0, 1, 0, 1);#$box->pack_start( $dev_table, FALSE, FALSE, 3); |
#$box->show_all; |
|
|
return $scrolled_win; |
|
} |
646,10 → 587,11
sub generate_lib{ |
my $intfc_gen=shift; |
my $name=$intfc_gen->intfc_get_interface_name(); |
my $category=$intfc_gen->intfc_get_category(); |
my $category=$intfc_gen->object_get_attribute('category'); |
# Write |
if(defined ($category)){ |
open(FILE, ">lib/interface/$name.ITC") || die "Can not open: $!"; |
print FILE perl_file_header("$name.ITC"); |
print FILE Data::Dumper->Dump([\%$intfc_gen],["HashRef"]); |
close(FILE) || die "Error closing file: $!"; |
#store \%$intfc_gen, "lib/$name.ITC"; |
674,7 → 616,7
######### |
|
sub get_intfc_description{ |
my ($intfc_gen,$soc_state,$info)=@_; |
my ($intfc_gen,$info)=@_; |
my $description = $intfc_gen->intfc_get_description(); |
my $table = Gtk2::Table->new (15, 15, TRUE); |
my $window=def_popwin_size(500,500,"Add description"); |
704,7 → 646,7
|
|
sub load_interface{ |
my ($intfc_gen,$soc_state)=@_; |
my ($intfc_gen)=@_; |
my $file; |
my $dialog = Gtk2::FileChooserDialog->new( |
'Select a File', undef, |
726,7 → 668,7
my ($name,$path,$suffix) = fileparse("$file",qr"\..[^.]*$"); |
if($suffix eq '.ITC'){ |
$intfc_gen->intfc_set_interface_file($file); |
set_state($soc_state,"load_file",0); |
set_gui_status($intfc_gen,"load_file",0); |
} |
} |
$dialog->destroy; |
743,13 → 685,10
sub intfc_main{ |
|
my $intfc_gen= intfc_gen->interface_generator(); |
|
my $soc_state= def_state("ideal"); |
# main window |
#my $window = def_win_size(1000,800,"Top"); |
# The main table containg the lib tree, selected modules and info section |
set_gui_status($intfc_gen,"ideal",0); |
my $main_table = Gtk2::Table->new (15, 12, FALSE); |
|
$main_table->set_row_spacings (4); |
$main_table->set_col_spacings (1); |
# The box which holds the info, warning, error ... mesages |
my ($infobox,$info)= create_text(); |
|
756,36 → 695,55
|
my $refresh = Gtk2::Button->new_from_stock('ref'); |
my $generate = def_image_button('icons/gen.png','Generate'); |
my $genbox=def_hbox(TRUE,5); |
$genbox->pack_start($generate, FALSE, FALSE,3); |
|
# A tree view for holding a library |
#my $tree_box = create_tree ($info,$lib,$soc,$soc_state); |
|
|
|
$main_table->set_row_spacings (4); |
$main_table->set_col_spacings (1); |
my $fbox=file_box($intfc_gen,$info); |
my $sbox=module_select($intfc_gen,$info); |
|
my $devbox=dev_box_show($intfc_gen,$soc_state,$info,\$refresh); |
|
$main_table->attach_defaults ($devbox , 0, 12, 0,12); |
my $devbox=dev_box_show($intfc_gen,$info); |
|
$main_table->attach_defaults ($fbox , 0, 12, 0,1); |
$main_table->attach_defaults ($sbox , 0, 12, 1,2); |
$main_table->attach_defaults ($devbox , 0, 12, 2,12); |
$main_table->attach_defaults ($infobox , 0, 12, 12,14); |
$main_table->attach_defaults ($genbox , 6, 8, 14,15); |
$main_table->attach ($generate , 6, 8, 14,15,'shrink','shrink',2,2); |
|
|
my $open = def_image_button('icons/browse.png','Load Interface'); |
my $openbox=def_hbox(TRUE,0); |
$openbox->pack_start($open, FALSE, FALSE,0); |
$main_table->attach_defaults ($openbox,0, 2, 14,15); |
$main_table->attach ($openbox,0, 2, 14,15,'shrink','shrink',2,2); |
|
#referesh the mpsoc generator |
$refresh-> signal_connect("clicked" => sub{ |
$devbox->destroy(); |
$fbox->destroy(); |
$sbox->destroy(); |
select(undef, undef, undef, 0.1); #wait 10 ms |
$devbox=dev_box_show($intfc_gen,$info); |
$fbox=file_box($intfc_gen,$info); |
$sbox=module_select($intfc_gen,$info); |
$main_table->attach_defaults ($fbox , 0, 12, 0,1); |
$main_table->attach_defaults ($sbox , 0, 12, 1,2); |
$main_table->attach_defaults ($devbox , 0, 12, 3,12); |
|
$devbox->show_all(); |
$sbox->show_all(); |
$fbox->show_all(); |
}); |
|
|
|
|
#check soc status every 0.5 second. referesh gui if there is any changes |
Glib::Timeout->add (100, sub{ |
|
my ($state,$timeout)= get_state($soc_state); |
my ($state,$timeout)= get_gui_status($intfc_gen); |
if ($timeout>0){ |
$timeout--; |
set_state($soc_state,$state,$timeout); |
set_gui_status($intfc_gen,$state,$timeout); |
} |
elsif($state eq "load_file"){ |
my $file=$intfc_gen->intfc_get_interface_file(); |
793,13 → 751,13
clone_obj($intfc_gen,$pp); |
|
|
set_state($soc_state,"ref",1); |
set_gui_status($intfc_gen,"ref",1); |
|
|
} |
elsif( $state ne "ideal" ){ |
$refresh->clicked; |
set_state($soc_state,"ideal",0); |
set_gui_status($intfc_gen,"ideal",0); |
|
} |
return TRUE; |
807,7 → 765,7
} ); |
|
$open-> signal_connect("clicked" => sub{ |
load_interface($intfc_gen,$soc_state); |
load_interface($intfc_gen); |
|
}); |
|
/intfc_gen.pm
198,20 → 198,8
} |
|
|
sub intfc_set_category{ |
my ($self,$category)=@_; |
$self->{category}=$category; |
} |
|
|
sub intfc_get_category{ |
my ($self)=@_; |
my $category; |
if(exists ($self->{category})){ |
$category=$self->{category}; |
} |
return $category; |
} |
|
sub intfc_set_description{ |
my ($self,$description)=@_; |
231,4 → 219,38
|
|
|
|
sub object_add_attribute{ |
my ($self,$attribute1,$attribute2,$value)=@_; |
if(!defined $attribute2){$self->{$attribute1}=$value;} |
else {$self->{$attribute1}{$attribute2}=$value;} |
|
} |
|
sub object_get_attribute{ |
my ($self,$attribute1,$attribute2)=@_; |
if(!defined $attribute2) {return $self->{$attribute1};} |
return $self->{$attribute1}{$attribute2}; |
|
|
} |
|
sub object_add_attribute_order{ |
my ($self,$attribute,@param)=@_; |
$self->{'parameters_order'}{$attribute}=[] if (!defined $self->{parameters_order}{$attribute}); |
foreach my $p (@param){ |
push (@{$self->{parameters_order}{$attribute}},$p); |
|
} |
} |
|
sub object_get_attribute_order{ |
my ($self,$attribute)=@_; |
return @{$self->{parameters_order}{$attribute}}; |
} |
|
|
|
|
|
1 |
/ip.pm
20,7 → 20,7
$self = {}; |
my $dir = Cwd::getcwd(); |
$dir =~ s/ /\\ /g; |
my @files = glob "$dir/lib/ip/*.IP"; |
my @files = glob "$dir/lib/ip/*/*.IP"; |
for my $p (@files){ |
|
# Read |
27,9 → 27,12
my $ipgen; |
$ipgen = eval { do $p }; |
# Might need "no strict;" before and "use strict;" after "do" |
die "Error reading: $@" if $@; |
if ($@ || !defined $ipgen){ |
print "\n**Warning: skipping $p file due to error in reading: $@\n"; |
next; |
} |
add_ip($self,$ipgen); |
|
add_ip($self,$ipgen); |
} |
|
|
66,19 → 69,7
} |
|
|
sub ip_get_module_parameters{ |
my ($self,$category,$module)=@_; |
my @parameters; |
if ( exists ($self->{categories}{$category}{names}{$module}) ){ |
foreach my $p (keys %{$self->{categories}{$category}{names}{$module}{parameters}}){ |
push(@parameters,$p); |
|
}#for |
}#if |
return @parameters; |
} |
|
|
sub ip_get_parameter { |
my ($self,$category,$module,$parameter)=@_; |
my ($deafult,$type,$content,$info,$glob_param,$redefine_param); |
/ip_gen.pl
10,13 → 10,14
use Cwd 'abs_path'; |
|
use File::Basename; |
use File::Path qw/make_path/; |
|
use Gtk2; |
|
|
require "widget.pl"; |
require "readme_gen.pl"; |
|
|
use String::Similarity; |
|
|
50,15 → 51,15
################ |
|
sub check_input_file{ |
my ($file,$ipgen,$soc_state,$info)=@_; |
my ($file,$ipgen,$info)=@_; |
my ($name,$path,$suffix) = fileparse("$file",qr"\..[^.]*$"); |
if($suffix eq '.IP'){ |
$ipgen->ipgen_add("file_name",$file); |
set_state($soc_state,"load_file",0); |
set_gui_status($ipgen,"load_file",0); |
|
|
}else{ |
read_all_module ($file,$ipgen,$soc_state,$info); |
read_all_module ($file,$ipgen,$info); |
|
} |
|
67,7 → 68,7
|
|
sub read_all_module{ |
my ($file,$ipgen,$soc_state,$info)=@_; |
my ($file,$ipgen,$info)=@_; |
|
if (!defined $file) {return; } |
if (-e $file) { |
83,7 → 84,7
load_deafult_setting($ipgen,$modules[0]); |
|
|
set_state($soc_state,"file_selected",1); |
set_gui_status($ipgen,"file_selected",1); |
show_info(\$info,"Select the module which contain the interface ports\n "); |
|
} |
98,7 → 99,7
# create_interface_tree |
############## |
sub create_interface_tree { |
my ($info,$intfc,$ipgen,$soc_state)=@_; |
my ($info,$intfc,$ipgen)=@_; |
my $model = Gtk2::TreeStore->new ('Glib::String', 'Glib::String', 'Glib::Scalar', 'Glib::Boolean'); |
my $tree_view = Gtk2::TreeView->new; |
$tree_view->set_model ($model); |
105,7 → 106,7
my $selection = $tree_view->get_selection; |
|
$selection->set_mode ('browse'); |
$tree_view->set_size_request (200, -1); |
# $tree_view->set_size_request (200, -1); |
|
|
# my @interface= $intfc->get_interfaces(); |
144,7 → 145,7
my $cell = Gtk2::CellRendererText->new; |
$cell->set ('style' => 'italic'); |
my $column = Gtk2::TreeViewColumn->new_with_attributes |
("Double click to add the interface", |
("Interfaces list", |
$cell, |
'text' => DISPLY_COLUMN, |
'style_set' => ITAL_COLUMN); |
185,7 → 186,7
|
if($name){ |
#print "$infc_name-$infc_type is selected via row activaton!\n"; |
add_intfc_to_ip($intfc,$ipgen,$name,'plug',\$info,$soc_state); |
add_intfc_to_ip($intfc,$ipgen,$name,'plug',\$info); |
|
} |
|
198,7 → 199,7
$scrolled_window->set_shadow_type ('in'); |
$scrolled_window->add($tree_view); |
|
my $hbox = Gtk2::HBox->new (TRUE, 0); |
my $hbox = Gtk2::HBox->new (FALSE, 0); |
$hbox->pack_start ( $scrolled_window, TRUE, TRUE, 0); |
|
|
233,17 → 234,20
############# |
|
sub ip_file_box { |
my ($ipgen,$soc_state,$info,$table,$row)=@_; |
my ($ipgen,$info,$table,$row)=@_; |
my $label = gen_label_in_left(" Select file:"); |
my $entry = Gtk2::Entry->new; |
#my $open= def_image_button("icons/select.png","Open"); |
my $browse= def_image_button("icons/browse.png","Browse"); |
my $label2= gen_label_in_left(" IP name:"); |
my $entry2= gen_entry(); |
my $file= $ipgen->ipgen_get("file_name"); |
if(defined $file){$entry->set_text($file);} |
my $ip_name= $ipgen->ipgen_get("ip_name"); |
if(defined $ip_name){$entry2->set_text($ip_name);} |
|
|
|
my $entry2=labele_widget_info(" IP name:",gen_entry_object($ipgen,'ip_name',undef,undef,undef,undef)); |
|
|
|
show_info(\$info,"Please select the verilog file containig the ip module\n"); |
$browse->signal_connect("clicked"=> sub{ |
my $entry_ref=$_[1]; |
267,7 → 271,7
if ( "ok" eq $dialog->run ) { |
$file = $dialog->get_filename; |
$$entry_ref->set_text($file); |
check_input_file($file,$ipgen,$soc_state,$info); |
check_input_file($file,$ipgen,$info); |
#print "file = $file\n"; |
} |
$dialog->destroy; |
278,34 → 282,23
|
|
|
#$open->signal_connect("clicked"=> sub{ |
#my $file_name=$entry->get_text(); |
#check_input_file($file_name,$ipgen,$soc_state,$info); |
|
#}); |
|
$entry->signal_connect("activate"=>sub{ |
my $file_name=$entry->get_text(); |
check_input_file($file_name,$ipgen,$soc_state,$info); |
check_input_file($file_name,$ipgen,$info); |
}); |
|
$entry->signal_connect("changed"=>sub{ |
show_info(\$info,"Please select the verilog file containig the interface\n"); |
}); |
$entry2->signal_connect("changed"=>sub{ |
my $name=$entry2->get_text(); |
$ipgen->ipgen_add("ip_name",$name); |
|
}); |
|
$table->attach_defaults ($label, 0, 1 , $row, $row+1); |
$table->attach_defaults ($entry, 1, 8 , $row, $row+1); |
$table->attach_defaults ($browse, 8, 9, $row, $row+1); |
$table->attach_defaults ($label2, 9, 10, $row, $row+1); |
$table->attach_defaults ($entry2, 10, 11, $row, $row+1); |
#$table->attach_defaults ($open, 7, 8, $row, $row+1); |
#$table->attach_defaults ($entry, $col, $col+1, $row, $row+1); |
#return $table; |
$table->attach ($browse, 8, 9, $row, $row+1,,'expand','shrink',2,2); |
$table->attach_defaults ($entry2, 9, 11, $row, $row+1); |
|
|
|
} |
|
|
312,31 → 305,48
|
|
sub select_module{ |
my ($ipgen,$soc_state,$info,$table,$row)=@_; |
my $label= gen_label_in_left(" Select\n module:"); |
my ($ipgen,$info,$table,$row)=@_; |
|
|
my @modules= $ipgen->ipgen_get_module_list(); |
my $saved_module=$ipgen->ipgen_get("module_name"); |
my $pos=(defined $saved_module ) ? get_scolar_pos( $saved_module,@modules) : 0; |
my $combo = gen_combo(\@modules, $pos); |
my $top_module=labele_widget_info(" Select\n module:",$combo); |
|
|
|
|
my $param= def_image_button("icons/setting.png","Parameter\n setting"); |
my $def= def_image_button("icons/setting.png","Definition\n file setting"); |
my $label2= gen_label_in_left(" Select\n Category:"); |
my ($category,$category_entry)=gen_entry_help('Define the IP category:e.g RAM, GPIO,...'); |
|
|
|
#Category |
my $ip = ip->lib_new (); |
my @categories= $ip->ip_get_categories(); |
$ip =undef; |
my $saved_category=$ipgen->ipgen_get("category"); |
if(defined $saved_category){$category_entry->set_text($saved_category);} |
my $ipinfo= def_image_button("icons/info.png"," IP\n Description"); |
if(defined $saved_category ){ push(@categories,$saved_category) if(!( grep /^$saved_category$/, @categories ));} |
my $content=join( ',', @categories); |
my $combentry=gen_comboentry_object ($ipgen,'category',undef,$content,$saved_category,undef,undef); |
my $category=labele_widget_info(" Select\n Category:",$combentry,"Select the IP category form the given list or you can add a new category."); |
|
|
|
my $ipinfo= def_image_button("icons/add_info.png"," IP\n Description"); |
my $header_h= def_image_button("icons/h_file.png","Add Software\n files"); |
my $lib_hdl= def_image_button("icons/add-notes.png","Add HDL\n files"); |
|
$table->attach_defaults ($label, 0, 1 , $row, $row+1); |
$table->attach_defaults ($combo, 1, 4 , $row,$row+1); |
$table->attach_defaults ($param, 4, 6 , $row, $row+1); |
#$table->attach_defaults ($def, 5, 6 , $row, $row+1); |
$table->attach_defaults ($label2, 6, 7 , $row, $row+1); |
$table->attach_defaults ($category, 7, 8 , $row, $row+1); |
$table->attach_defaults ($ipinfo, 8, 9 , $row, $row+1); |
$table->attach_defaults ($header_h, 9, 10 , $row, $row+1); |
$table->attach_defaults ($lib_hdl, 10, 11 , $row, $row+1); |
|
#$table->attach_defaults ($top_module, 0, 1 , $row, $row+1); |
$table->attach ($top_module, 0, 4 , $row,$row+1,'fill','shrink',2,2); |
$table->attach ($param, 4, 6 , $row, $row+1,'expand','shrink',2,2); |
|
$table->attach ($category, 6, 8 , $row, $row+1,'expand','shrink',2,2); |
$table->attach ($ipinfo, 8, 9 , $row, $row+1,'expand','shrink',2,2); |
$table->attach ($header_h, 9, 10 , $row, $row+1,'expand','shrink',2,2); |
$table->attach ($lib_hdl, 10, 11 , $row, $row+1,'expand','shrink',2,2); |
|
|
$combo->signal_connect("changed"=> sub{ |
343,29 → 353,25
|
my $module= $combo->get_active_text(); |
load_deafult_setting($ipgen,$module); |
set_state($soc_state,'intfc_changed',0); |
set_gui_status($ipgen,'intfc_changed',0); |
|
|
}); |
|
$param->signal_connect("clicked"=> sub{ |
get_parameter_setting($ipgen,$soc_state,$info); |
get_parameter_setting($ipgen,$info); |
|
|
}); |
|
$def->signal_connect("clicked"=> sub{ |
get_def_setting($ipgen,$soc_state,$info); |
get_def_setting($ipgen,$info); |
|
|
}); |
$category_entry->signal_connect("changed"=> sub{ |
my $name=$category_entry->get_text(); |
$ipgen->ipgen_add("category",$name); |
|
}); |
|
$ipinfo->signal_connect("clicked"=> sub{ |
get_Description($ipgen,$soc_state,$info); |
get_Description($ipgen,$info); |
|
}); |
$header_h->signal_connect("clicked"=> sub{ |
406,8 → 412,8
$page_info{2}{help}=$help3; |
|
|
get_source_file($ipgen,$soc_state,$info,0,"Add software file(s)","SW",\%page_info); |
#get_software_file($ipgen,$soc_state,$info,0); |
get_source_file($ipgen,$info,0,"Add software file(s)","SW",\%page_info); |
#get_software_file($ipgen,$info,0); |
|
}); |
$lib_hdl->signal_connect("clicked"=> sub{ |
420,9 → 426,9
$page_info{0}{folder_en}=1; |
$page_info{0}{help}=$help1; |
|
get_source_file($ipgen,$soc_state,$info,0,"Add HDL file(s)", "hw",\%page_info); |
get_source_file($ipgen,$info,0,"Add HDL file(s)", "hw",\%page_info); |
|
#get_hdl_file($ipgen,$soc_state,$info); |
#get_hdl_file($ipgen,$info); |
|
|
}); |
444,7 → 450,7
#print "$p\n"; |
my $v = $parameters{$p}; |
$v =~s/[\n]//gs; |
$ipgen->ipgen_add_parameter($p,$v,'Fixed',''); |
$ipgen->ipgen_add_parameter($p,$v,'Fixed','','Parameter',1); |
|
} |
#add parameter order. |
460,12 → 466,12
} |
|
sub file_info_box { |
my($ipgen,$soc_state,$info)=@_; |
my($ipgen,$info)=@_; |
my $table=def_table(2,11,FALSE); |
my $table1=def_table(1,11,FALSE); |
my $table2=def_table(1,11,FALSE); |
ip_file_box ($ipgen,$soc_state,$info,$table1,0); |
select_module($ipgen,$soc_state,$info,$table2,0); |
ip_file_box ($ipgen,$info,$table1,0); |
select_module($ipgen,$info,$table2,0); |
$table->attach_defaults($table1,0,11,0,1); |
$table->attach_defaults($table2,0,11,1,2); |
return $table; |
477,8 → 483,8
|
|
sub show_file_info{ |
my($ipgen,$soc_state,$info,$refresh_ref)=@_; |
my $table = file_info_box($ipgen,$soc_state,$info,$info); |
my($ipgen,$info,$refresh_ref)=@_; |
my $table = file_info_box($ipgen,$info,$info); |
my $scrolled_win = new Gtk2::ScrolledWindow (undef, undef); |
$scrolled_win->set_policy( "automatic", "never" ); |
$scrolled_win->add_with_viewport($table); |
487,7 → 493,7
|
$$refresh_ref-> signal_connect("clicked" => sub{ |
$table->destroy; |
$table = file_info_box($ipgen,$soc_state,$info,$info); |
$table = file_info_box($ipgen,$info,$info); |
|
$scrolled_win->add_with_viewport($table); |
$table->show; |
505,8 → 511,8
|
|
sub show_port_info{ |
my($intfc,$ipgen,$soc_state,$info,$refresh_ref)=@_; |
my $table = port_info_box($intfc,$ipgen,$soc_state,$info,$info); |
my($intfc,$ipgen,$info,$refresh_ref)=@_; |
my $table = port_info_box($intfc,$ipgen,$info,$info); |
my $scrolled_win = new Gtk2::ScrolledWindow (undef, undef); |
$scrolled_win->set_policy( "automatic", "automatic" ); |
$scrolled_win->add_with_viewport($table); |
515,7 → 521,7
|
$$refresh_ref-> signal_connect("clicked" => sub{ |
$table->destroy; |
$table = port_info_box($intfc,$ipgen,$soc_state,$info,$info); |
$table = port_info_box($intfc,$ipgen,$info,$info); |
|
$scrolled_win->add_with_viewport($table); |
$table->show; |
532,8 → 538,8
|
|
sub show_interface_info{ |
my($intfc,$ipgen,$soc_state,$info,$refresh_ref)=@_; |
my $table = interface_info_box($intfc,$ipgen,$soc_state,$info,$info); |
my($intfc,$ipgen,$info,$refresh_ref)=@_; |
my $table = interface_info_box($intfc,$ipgen,$info,$info); |
my $scrolled_win = new Gtk2::ScrolledWindow (undef, undef); |
$scrolled_win->set_policy( "automatic", "automatic" ); |
$scrolled_win->add_with_viewport($table); |
543,7 → 549,7
$$refresh_ref-> signal_connect("clicked" => sub{ |
$table->destroy; |
select(undef, undef, undef, 0.1); #wait 10 ms |
$table = interface_info_box($intfc,$ipgen,$soc_state,$info,$info); |
$table = interface_info_box($intfc,$ipgen,$info,$info); |
|
$scrolled_win->add_with_viewport($table); |
$table->show; |
569,9 → 575,9
# get_parameter_setting |
########## |
sub get_parameter_setting { |
my ($ipgen,$soc_state,$info)=@_; |
my ($ipgen,$info)=@_; |
|
my $module = $ipgen->ipgen_get("module_name"); |
|
my $file= $ipgen->ipgen_get("file_name"); |
if (!defined $file) { |
message_dialog("The input verilog file is empty"); |
578,15 → 584,16
return; |
|
} |
my $module = $ipgen->ipgen_get("module_name"); |
|
#my $titelbox=def_title_box(TRUE,5,("Parameter name","Deafult value","Widget type","Widget content","Global param Optional info",)); |
my($width,$hight)=max_win_size(); |
my $window = def_popwin_size(.85*$width,.5*$hight,"Define parameters detail"); |
|
|
|
|
|
my @widget_type_list=("Fixed","Entry","Combo-box","Spin-button"); |
my @param_type_list=("localparam-pass", "parameter-pass", "localparam-notpass","parameter-notpass"); |
my @param_type_list=("Parameter","Localparam","Don't include"); |
my $type_info="Define the parameter type: |
|
Fixed: The parameter is fixed and get the default value. Users can not see or change the parameter value. |
600,8 → 607,7
For Fixed and Entry leave it empty. |
For Combo box define the parameters which must be shown in combo box as: "PAEAMETER1","PARAMETER2"...,"PARAMETERn". |
For Spin button define it as "minimum, maximum, step" e.g 0,10,1.'; |
my $param_info=' |
If checked, the parameter will be defined as parameter in SoC file too, otherwise it will be defined as localparam.'; |
my $param_info='Define how parameter is included in the top module containig this IP core.'; |
|
my $redefine_info=' |
If checked, the defined parameter/localparam in SoC will be passed to the IP core'; |
623,16 → 629,16
|
|
foreach my $t (@title){ |
$table->attach_defaults ($title[$col], $positions[$col], $positions[$col+1], 0, 1);$col++; |
$table->attach ($title[$col], $positions[$col], $positions[$col+1], 0, 1,'expand','shrink',2,2); $col++; |
|
} |
|
|
|
my ($box,$window)=def_scrolled_window_box(1200,500,"Define parameters detail"); |
|
|
|
|
|
my @parameters=$ipgen->ipgen_get_all_parameters_list(); |
my @params_order= $ipgen->ipgen_get_list("parameters_order"); |
639,8 → 645,7
if((@params_order)) {@parameters=@params_order;} |
|
my $ok = def_image_button('icons/select.png','OK'); |
my $okbox=def_hbox(TRUE,0); |
$okbox->pack_start($ok, FALSE, FALSE,0); |
|
|
my ($b,$new_param)= def_h_labeled_entry("Add new parameter name:"); |
my $add = def_image_button('icons/plus.png','Add parameter'); |
654,7 → 659,7
|
push(@parameters,"#new#"); |
foreach my $p (@parameters) { |
my ($saved_deafult,$saved_widget_type,$saved_content,$saved_info,$global_param,$redefine_param)= $ipgen->ipgen_get_parameter_detail($p); |
my ($saved_deafult,$saved_widget_type,$saved_content,$saved_info,$vfile_param_type,$redefine_param)= $ipgen->ipgen_get_parameter_detail($p); |
#print "($saved_deafult,$saved_type,$saved_content)\n"; |
my $parameter_box = def_hbox(TRUE,5); |
my $param_name; |
671,8 → 676,17
my $pos=(defined $saved_widget_type ) ? get_scolar_pos( $saved_widget_type,@widget_type_list) : 0; |
my $widget_type_combo=gen_combo(\@widget_type_list, $pos); |
my $content_entry= gen_entry($saved_content); |
my $check_param= Gtk2::CheckButton->new('Parameter'); |
$check_param->set_active($global_param) if(defined $global_param ); |
|
|
|
$vfile_param_type= "Don't include" if (!defined $vfile_param_type ); |
$vfile_param_type= "Parameter" if ($vfile_param_type eq 1); |
$vfile_param_type= "Localparam" if ($vfile_param_type eq 0); |
$pos=get_scolar_pos($vfile_param_type,@param_type_list); |
my $check_param= gen_combo(\@param_type_list, $pos); |
|
|
#$check_param->set_active($vfile_param_type) if(defined $vfile_param_type ); |
my $check_redefine= Gtk2::CheckButton->new('Redefine'); |
$check_redefine->set_active(1) ; |
$check_redefine->set_active($redefine_param) if(defined $redefine_param ); |
682,16 → 696,16
|
|
#my $check= Gtk2::CheckButton->new; |
#$check->set_active($global_param) if(defined $global_param ); |
#$check->set_active($vfile_param_type) if(defined $vfile_param_type ); |
|
|
my $info=def_image_button("icons/addinfo.png"); |
#print "\$global_param =$global_param\n"; |
my $info=def_image_button("icons/add_info.png"); |
#print "\$vfile_param_type =$vfile_param_type\n"; |
|
$col=0; |
my @all_widget=($param_name,$deafult_entry,$widget_type_combo,$content_entry,$check_param,$check_redefine,$info,$add_remove); |
foreach my $t (@all_widget){ |
$table->attach_defaults ($t, $positions[$col], $positions[$col+1], $row, $row+1);$col++; |
$table->attach ($t, $positions[$col], $positions[$col+1], $row, $row+1,'expand','shrink',2,2);$col++; |
|
} |
|
707,11 → 721,10
my $deafult=$deafult_entry->get_text(); |
my $type= $widget_type_combo->get_active_text(); |
my $content=$content_entry->get_text(); |
my $check_result=$check_param->get_active(); |
my $global_param=($check_result eq 1)? 1:0; |
$check_result=$check_redefine->get_active(); |
my $vfile_param_type=$check_param->get_active_text(); |
my $check_result=$check_redefine->get_active(); |
my $redefine_param=($check_result eq 1)? 1:0; |
$ipgen->ipgen_add_parameter($p,$deafult,$type,$content,$saved_info,$global_param,$redefine_param); |
$ipgen->ipgen_add_parameter($p,$deafult,$type,$content,$saved_info,$vfile_param_type,$redefine_param); |
} |
}); |
$add_remove->signal_connect (clicked => sub{ |
723,13 → 736,12
my $deafult=$deafult_entry->get_text(); |
my $type=$widget_type_combo->get_active_text(); |
my $content=$content_entry->get_text(); |
my $check_result=$check_param->get_active(); |
my $global_param=($check_result eq 1)? 1:0; |
$check_result=$check_redefine->get_active(); |
my $vfile_param_type=$check_param->get_active_text(); |
my $check_result=$check_redefine->get_active(); |
my $redefine_param=($check_result eq 1)? 1:0; |
$ipgen->ipgen_add_parameter($param,$deafult,$type,$content,$saved_info,$global_param,$redefine_param); |
$ipgen->ipgen_add_parameter($param,$deafult,$type,$content,$saved_info,$vfile_param_type,$redefine_param); |
$ipgen->ipgen_push_parameters_order($param); |
set_state($soc_state,"change_parameter",0); |
set_gui_status($ipgen,"change_parameter",0); |
$ok->clicked; |
#$window->destroy(); |
} |
737,7 → 749,7
} else { #remove the parameter |
$ipgen->ipgen_remove_parameter($p); |
$ipgen->ipgen_remove_parameters_order($p); |
set_state($soc_state,"change_parameter",0); |
set_gui_status($ipgen,"change_parameter",0); |
$ok->clicked; |
#$window->destroy(); |
|
746,7 → 758,7
# if( length($param_name) ){ |
# print "$param_name\n"; |
# $ipgen->ipgen_add_parameter($param_name,undef); |
# set_state($soc_state,"change_parameter",0); |
# set_gui_status($ipgen,"change_parameter",0); |
# $window->destroy(); |
|
}); |
755,21 → 767,28
|
$row++; |
} |
$box->pack_start( $table, FALSE, FALSE, 3); |
|
|
for (my $i=$row; $i<7;$i++){ |
my $temp=gen_label_in_center(' '); |
$box->pack_start($temp, TRUE, FALSE,3); |
} |
|
|
|
$box->pack_start($okbox, TRUE, FALSE,3); |
my $scrolled_win = new Gtk2::ScrolledWindow (undef, undef); |
$scrolled_win->set_policy( "automatic", "automatic" ); |
$scrolled_win->add_with_viewport($table); |
|
|
|
|
|
|
|
|
$add->signal_connect (clicked => sub{ |
my $param_name=$new_param->get_text(); |
if( length($param_name) ){ |
#print "$param_name\n"; |
$ipgen->ipgen_add_parameter($param_name,undef); |
set_state($soc_state,"change_parameter",0); |
set_gui_status($ipgen,"change_parameter",0); |
$window->destroy(); |
} |
|
783,11 → 802,15
|
}); |
|
|
my $mtable = def_table(10, 1, FALSE); |
$mtable->attach_defaults($scrolled_win,0,1,0,9); |
$mtable->attach($ok,0,1,9,10,'expand','shrink',2,2); |
|
$window->add ($mtable); |
$window->show_all(); |
|
|
$window->show_all; |
|
} |
|
|
797,10 → 820,11
# get_def_setting |
########## |
sub get_def_setting { |
my ($ipgen,$soc_state,$info)=@_; |
my ($ipgen,$info)=@_; |
my $table = Gtk2::Table->new (15, 15, TRUE); |
my $table2 = Gtk2::Table->new (15, 15, TRUE); |
my $window=def_popwin_size(600,600,"Add definition file"); |
my($width,$hight)=max_win_size(); |
my $window = def_popwin_size(.7*$width,.7*$hight,"Add definition file"); |
my $ok=def_image_button("icons/select.png",' Ok '); |
my $scrwin= new Gtk2::ScrolledWindow (undef, undef); |
$scrwin->set_policy( "automatic", "automatic" ); |
809,9 → 833,9
my $label=gen_label_help("You ","Selecet the Verilog file containig the definitions."); |
my $brows=def_image_button("icons/browse.png",' Browse'); |
$table->attach_defaults($label,0,10,0,1); |
$table->attach_defaults($brows,10,12,1,2); |
$table->attach($brows,10,12,1,2,'expand','shrink',2,2); |
$table->attach_defaults($scrwin,0,15,2,14); |
$table->attach_defaults($ok,6,9,14,15); |
$table->attach($ok,6,9,14,15,'expand','shrink',2,2); |
|
$window->add($table); |
$window->show_all; |
825,16 → 849,17
######### |
|
sub get_Description{ |
my ($ipgen,$soc_state,$info)=@_; |
my ($ipgen,$info)=@_; |
my $description = $ipgen->ipgen_get("description"); |
my $table = Gtk2::Table->new (15, 15, TRUE); |
my $window=def_popwin_size(500,500,"Add description"); |
my $table = Gtk2::Table->new (15, 15, FALSE); |
my($width,$hight)=max_win_size(); |
my $window = def_popwin_size(.4*$width,.4*$hight, "Add description"); |
my ($scrwin,$text_view)=create_text(); |
#my $buffer = $textbox->get_buffer(); |
my $ok=def_image_button("icons/select.png",' Ok '); |
|
$table->attach_defaults($scrwin,0,15,0,14); |
$table->attach_defaults($ok,6,9,14,15); |
$table->attach($ok,6,9,14,15,'expand','shrink',2,2); |
my $text_buffer = $text_view->get_buffer; |
if(defined $description) {$text_buffer->set_text($description)}; |
|
865,14 → 890,14
my ($ipgen,$list_name,$window,$rename_file_en)=@_; |
|
|
my $table=def_table(10,10,TRUE);# my ($row,$col,$homogeneous)=@_; |
my $table=def_table(10,10,FALSE);# my ($row,$col,$homogeneous)=@_; |
my $scrolled_win = new Gtk2::ScrolledWindow (undef, undef); |
my $ok=def_image_button("icons/select.png",' Ok '); |
|
$scrolled_win->set_policy( "automatic", "automatic" ); |
$scrolled_win->add_with_viewport($table); |
$table->attach_defaults (gen_label_in_center("File path"), 0, 5 , 0, 1); |
$table->attach_defaults (gen_label_help("The target name can contain any of Global variables e.g \$IP\$.h","Copy as"), 5, 9 , 0, 1) if(defined $rename_file_en); |
$table->attach (gen_label_in_center("File path"), 0, 5 , 0, 1,'expand','shrink',2,2); |
$table->attach (gen_label_help("The target name can contain any of Global variables e.g \$IP\$.h","Copy as"), 5, 9 , 0, 1,'expand','shrink',2,2) if(defined $rename_file_en); |
my $col=0; |
my $row=1; |
my @files= $ipgen->ipgen_get_list($list_name); #@{$ref}; |
882,9 → 907,9
my $entry=gen_entry($path); |
my $entry2=gen_entry($rename) ; |
my $remove=def_image_button("icons/cancel.png"); |
$table->attach_defaults ($entry, 0, 5 , $row, $row+1); |
$table->attach_defaults ($entry2, 5, 9 , $row, $row+1) if(defined $rename_file_en); |
$table->attach_defaults ($remove, 9,10 , $row, $row+1); |
$table->attach ($entry, 0, 5 , $row, $row+1,'fill','shrink',2,2); |
$table->attach ($entry2, 5, 9 , $row, $row+1,'fill','shrink',2,2) if(defined $rename_file_en); |
$table->attach ($remove, 9,10 , $row, $row+1,'expand','shrink',2,2); |
$row++; |
$remove->signal_connect("clicked"=> sub { |
my @saved_files=$ipgen->ipgen_get_list($list_name); |
938,13 → 963,14
|
sub get_param_info{ |
my ($ipgen,$saved_info)=@_; |
my $table = Gtk2::Table->new (15, 15, TRUE); |
my $window=def_popwin_size(500,500,"Add description"); |
my $table = Gtk2::Table->new (15, 15, FALSE); |
my($width,$hight)=max_win_size(); |
my $window = def_popwin_size(.5*$width,.5*$hight,"Add description"); |
my ($scrwin,$text_view)=create_text(); |
my $ok=def_image_button("icons/select.png",' Ok '); |
|
$table->attach_defaults($scrwin,0,15,0,14); |
$table->attach_defaults($ok,6,9,14,15); |
$table->attach($ok,6,9,14,15,'expand','shrink',2,2); |
my $text_buffer = $text_view->get_buffer; |
if(defined $$saved_info) {$text_buffer->set_text($$saved_info)}; |
|
965,8 → 991,8
|
|
sub interface_info_box { |
my($intfc,$ipgen,$soc_state,$info)=@_; |
my $table=def_table(7,7,TRUE); |
my($intfc,$ipgen,$info)=@_; |
my $table=def_table(7,7,FALSE); |
my @sokets=$ipgen->ipgen_list_sokets; |
my @plugs=$ipgen->ipgen_list_plugs; |
|
975,9 → 1001,9
|
my $row=0; |
my $col=0; |
$table->attach_defaults (gen_label_in_center(" Interface name"), $positions[0], $positions[1], $row, $row+1); |
$table->attach_defaults (gen_label_in_center("Type"), $positions[1], $positions[2], $row, $row+1); |
$table->attach_defaults (gen_label_in_left("Interface Num"), $positions[2], $positions[3], $row, $row+1); |
$table->attach (gen_label_in_center(" Interface name"), $positions[0], $positions[1], $row, $row+1,'expand','shrink',2,2); |
$table->attach (gen_label_in_center("Type"), $positions[1], $positions[2], $row, $row+1,'expand','shrink',2,2); |
$table->attach (gen_label_in_left("Interface Num"), $positions[2], $positions[3], $row, $row+1,'expand','shrink',2,2); |
|
$row++; |
my @type_list=('plug','socket'); |
991,37 → 1017,39
my $name_setting=def_image_button('icons/setting.png'); |
$remove->signal_connect ('clicked'=> sub{ |
$ipgen->ipgen_remove_socket($p); |
set_state($soc_state,'intfc_changed',0); |
set_gui_status($ipgen,'intfc_changed',0); |
|
} ); |
$name_setting->signal_connect ('clicked'=> sub{ |
get_intfc_setting($ipgen,$soc_state,$p,'socket'); |
get_intfc_setting($ipgen,$p,'socket'); |
|
|
}); |
$combo_type ->signal_connect ('changed'=> sub{ |
$ipgen->ipgen_remove_socket($p); |
add_intfc_to_ip($intfc,$ipgen,$p,'plug',$info,$soc_state); |
add_intfc_to_ip($intfc,$ipgen,$p,'plug',$info); |
|
} ); |
$table->attach_defaults ($remove, $positions[4], $positions[5], $row, $row+1); |
$table->attach ($remove, $positions[4], $positions[5], $row, $row+1,'expand','shrink',2,2); |
|
|
if ($type eq 'num'){ |
my ($type_box,$type_spin)=gen_spin_help ('Define the number of this interface in module', 1,1024,1); |
$type_box->pack_start($name_setting,FALSE,FALSE,0); |
$type_spin->set_value($value); |
my $advance_button=def_image_button('icons/advance.png','separate'); |
$table->attach_defaults ($type_box, $positions[2], $positions[3], $row, $row+1); |
$table->attach_defaults ($advance_button, $positions[3], $positions[4], $row, $row+1); |
$table->attach ($type_box, $positions[2], $positions[3], $row, $row+1,'expand','shrink',2,2); |
$table->attach ($advance_button, $positions[3], $positions[4], $row, $row+1,'expand','shrink',2,2); |
$type_spin->signal_connect("value_changed"=>sub{ |
my $wiget=shift; |
my $num=$wiget->get_value_as_int(); |
$ipgen->ipgen_add_soket($p,'num',$num); |
set_state($soc_state,'intfc_changed',0); |
set_gui_status($ipgen,'intfc_changed',0); |
|
}); |
$advance_button->signal_connect("clicked"=>sub{ |
$ipgen->ipgen_add_soket($p,'param'); |
set_state($soc_state,'intfc_changed',0); |
set_gui_status($ipgen,'intfc_changed',0); |
|
}); |
|
1036,18 → 1064,18
my ($type_box,$type_combo)=gen_combo_help ('Define the parameter which determine the number of this interface in module',\@parameters,$pos); |
$type_box->pack_start($name_setting,FALSE,FALSE,0); |
my $advance_button=def_image_button('icons/advance.png','concatenate'); |
$table->attach_defaults ($type_box, $positions[2], $positions[3], $row, $row+1); |
$table->attach_defaults ($advance_button, $positions[3], $positions[4], $row, $row+1); |
$table->attach ($type_box, $positions[2], $positions[3], $row, $row+1,'expand','shrink',2,2); |
$table->attach ($advance_button, $positions[3], $positions[4], $row, $row+1,'expand','shrink',2,2); |
$type_combo->signal_connect("changed"=>sub{ |
my $wiget=shift; |
my $value=$wiget->get_active_text(); |
$ipgen->ipgen_add_soket($p,'param',$value); |
set_state($soc_state,'intfc_changed',0); |
set_gui_status($ipgen,'intfc_changed',0); |
|
}); |
$advance_button->signal_connect("clicked"=>sub{ |
$ipgen->ipgen_add_soket($p,'num',0); |
set_state($soc_state,'intfc_changed',0); |
set_gui_status($ipgen,'intfc_changed',0); |
|
}); |
|
1058,8 → 1086,8
|
|
|
$table->attach_defaults ($label_name, $positions[0], $positions[1], $row, $row+1); |
$table->attach_defaults ($combo_type, $positions[1], $positions[2], $row, $row+1); |
$table->attach ($label_name, $positions[0], $positions[1], $row, $row+1,'expand','shrink',2,2); |
$table->attach ($combo_type, $positions[1], $positions[2], $row, $row+1,'expand','shrink',2,2); |
|
|
|
1074,20 → 1102,20
my $remove= def_image_button('icons/cancel.png','Remove'); |
my $name_setting=def_image_button('icons/setting.png'); |
|
$table->attach_defaults ($remove, $positions[4], $positions[5], $row, $row+1); |
$table->attach ($remove, $positions[4], $positions[5], $row, $row+1,'expand','shrink',2,2); |
$remove->signal_connect ('clicked'=> sub{ |
$ipgen->ipgen_remove_plug($q); |
set_state($soc_state,'intfc_changed',0); |
set_gui_status($ipgen,'intfc_changed',0); |
|
} ); |
$name_setting->signal_connect ('clicked'=> sub{ |
get_intfc_setting($ipgen,$soc_state,$q,'plug'); |
get_intfc_setting($ipgen,$q,'plug'); |
|
|
} ); |
$combo_type ->signal_connect ('changed'=> sub{ |
$ipgen->ipgen_remove_plug($q); |
add_intfc_to_ip($intfc,$ipgen,$q,'socket',$info,$soc_state); |
add_intfc_to_ip($intfc,$ipgen,$q,'socket',$info); |
|
} ); |
#my $range_entry=gen_entry($range); |
1095,18 → 1123,18
my ($type_box,$type_spin)=gen_spin_help ('Define the number of this interface in module', 1,1024,1); |
$type_box->pack_start($name_setting,FALSE,FALSE,0); |
$type_spin->set_value($value); |
$table->attach_defaults ($type_box, $positions[2], $positions[3], $row, $row+1); |
$table->attach ($type_box, $positions[2], $positions[3], $row, $row+1,'expand','shrink',2,2); |
$type_spin->signal_connect("value_changed"=>sub{ |
my $wiget=shift; |
my $num=$wiget->get_value_as_int(); |
$ipgen->ipgen_add_plug($q,'num',$num); |
set_state($soc_state,'intfc_changed',0); |
set_gui_status($ipgen,'intfc_changed',0); |
|
}); |
|
} |
$table->attach_defaults ($label_name, $positions[0], $positions[1], $row, $row+1); |
$table->attach_defaults ($combo_type, $positions[1], $positions[2], $row, $row+1); |
$table->attach ($label_name, $positions[0], $positions[1], $row, $row+1,'expand','shrink',2,2); |
$table->attach ($combo_type, $positions[1], $positions[2], $row, $row+1,'expand','shrink',2,2); |
#$table->attach_defaults ($range_entry, 2, 4, $row, $row+1); |
|
#wishbone address seting |
1124,7 → 1152,7
$addr= def_image_button('icons/select.png'); |
|
} |
$table->attach_defaults ($addr, $positions[5], $positions[6], $row, $row+1); |
$table->attach ($addr, $positions[5], $positions[6], $row, $row+1,'expand','shrink',2,2); |
|
|
} |
1146,16 → 1174,15
|
sub get_intfc_setting{ |
|
my ($ipgen,$soc_state,$intfc_name, $intfc_type)=@_; |
my ($ipgen,$intfc_name, $intfc_type)=@_; |
|
|
my $window = def_popwin_size(1000,500); |
my($width,$hight)=max_win_size(); |
my $window = def_popwin_size(.7*$width,.7*$hight,"Interface parameter setting"); |
my $table=def_table(7,6,FALSE); |
my $ok = def_image_button('icons/select.png','OK'); |
my $okbox=def_hbox(TRUE,0); |
$okbox->pack_start($ok, FALSE, FALSE,0); |
|
|
|
my $scrolled_win = new Gtk2::ScrolledWindow (undef, undef); |
$scrolled_win->set_policy( "automatic", "automatic" ); |
$scrolled_win->add_with_viewport($table); |
1162,7 → 1189,7
|
#title |
my $lable1=gen_label_in_left("interface name"); |
$table->attach_defaults( $lable1,0,2,0,1); |
$table->attach ( $lable1,0,2,0,1,'expand','shrink',2,2); |
|
|
|
1184,7 → 1211,7
else {$saved_name= $ipgen->ipgen_get_socket_name($intfc_name,$number);} |
my $entry_name=gen_entry($saved_name); |
|
$table->attach_defaults($entry_name,0,2,$i+1,$i+2); |
$table->attach($entry_name,0,2,$i+1,$i+2,'expand','shrink',2,2); |
$ok->signal_connect('clicked'=>sub{ |
my $new_name=$entry_name->get_text(); |
#print "my new name is: $new_name\n"; |
1200,10 → 1227,11
#wishbone addr |
if($intfc_name eq 'wb_slave' && $intfc_type eq 'plug'){ |
my $lable2=gen_label_in_center("address range: (start end name)"); |
my $lable3=gen_label_in_center("block address width"); |
my $lable3=gen_label_help("This field defines the total memory_map address which is required by this module in byte. ( =2 ^ block_address_width). |
You can define a fixed value or assign it to any of module parameter","block address width"); |
|
$table->attach_defaults( $lable2,2,5,0,1); |
$table->attach_defaults( $lable3,5,6,0,1); |
$table->attach ( $lable2,2,5,0,1,'expand','shrink',2,2); |
$table->attach ( $lable3,5,6,0,1,'expand','shrink',2,2); |
|
my $plug=$intfc_name; |
my $wb= wb_addr->wb_addr_new(); |
1301,8 → 1329,8
$sbox->show_all(); |
}); |
|
$table->attach_defaults($name_combo,2,5,$i+1,$i+2); |
$table->attach_defaults($sbox,5,6,$i+1,$i+2); |
$table->attach ($name_combo,2,5,$i+1,$i+2 ,'expand','shrink',2,2); |
$table->attach ($sbox,5,6,$i+1,$i+2,'expand','shrink',2,2); |
$ok->signal_connect('clicked'=>sub{ |
my $addr=$name_combo->get_active_text(); |
my $in=$comb->get_active_text(); |
1318,19 → 1346,13
|
} |
|
while($i<7){ |
$i++; |
my $tmp=gen_label_in_left(' '); |
$table->attach_defaults($tmp,5,6,$i,$i+1); |
|
} |
|
|
$i=($i<7)? 7:$i; |
|
|
my $mtable = def_table(10, 1, TRUE); |
my $mtable = def_table(10, 1, FALSE); |
$mtable->attach_defaults($scrolled_win,0,1,0,9); |
$mtable->attach_defaults($okbox,0,1,9,10); |
$mtable->attach($ok,0,1,9,10,'expand','shrink',2,2); |
|
$window->add ($mtable); |
$window->show_all(); |
1340,7 → 1362,7
|
$ok->signal_connect('clicked'=>sub{ |
$window->destroy; |
set_state($soc_state,"interface_selected",1); |
set_gui_status($ipgen,"interface_selected",1); |
|
} ); |
|
1362,13 → 1384,13
|
|
sub add_intfc_to_ip{ |
my ($intfc,$ipgen,$infc_name,$infc_type,$info,$soc_state)=@_; |
my ($intfc,$ipgen,$infc_name,$infc_type,$info)=@_; |
if($infc_type eq 'socket'){ |
my ($connection_num,$connect_to)=$intfc->get_socket($infc_name); |
$ipgen->ipgen_add_soket($infc_name,'num',1,$connection_num); |
} |
else { $ipgen->ipgen_add_plug($infc_name,'num',1);} |
set_state($soc_state,"interface_selected",1); |
set_gui_status($ipgen,"interface_selected",1); |
|
} |
|
1451,7 → 1473,7
|
} |
else { |
@ports=('IO'); |
@ports=('IO','NC'); |
} |
my $saved_intfc_port=$ipgen->ipgen_get_port_intfc_port($portname); |
my $pos=(defined $saved_intfc_port ) ? get_scolar_pos( $saved_intfc_port,@ports) : undef; |
1474,8 → 1496,8
|
|
sub port_info_box { |
my($intfc,$ipgen,$soc_state,$info)=@_; |
my $table=def_table(8,10,TRUE); |
my($intfc,$ipgen,$info)=@_; |
my $table=def_table(8,10,FALSE); |
my @ports=$ipgen->ipgen_list_ports; |
my $row=0; |
my ($name_ref,$ref)=get_list_of_all_interfaces($ipgen); |
1483,11 → 1505,11
my @interfaces=@{$ref}; |
#print "@interfaces_name\n"; |
|
$table->attach_defaults (gen_label_in_left(" Type "), 0, 1, $row, $row+1); |
$table->attach_defaults (gen_label_in_left(" Port name "), 1, 3, $row, $row+1); |
$table->attach_defaults (gen_label_in_left(" Interface name "), 3, 5, $row, $row+1); |
$table->attach_defaults (gen_label_in_center(" Range "), 5, 7, $row, $row+1); |
$table->attach_defaults (gen_label_in_left(" Interface port "), 7, 9, $row, $row+1); |
$table->attach (gen_label_in_left(" Type "), 0, 1, $row, $row+1,'expand','shrink',2,2); |
$table->attach (gen_label_in_left(" Port name "), 1, 3, $row, $row+1,'expand','shrink',2,2); |
$table->attach (gen_label_in_left(" Interface name "), 3, 5, $row, $row+1,'expand','shrink',2,2); |
$table->attach (gen_label_in_center(" Interface port "), 5, 7, $row, $row+1,'fill','shrink',2,2); |
$table->attach (gen_label_in_left(" Port Range "), 7, 9, $row, $row+1,'expand','shrink',2,2); |
$row++; |
#print @interfaces; |
my @ports_order=$ipgen->ipgen_get_ports_order(); |
1499,7 → 1521,7
foreach my $p( @ports){ |
my ($range,$type,$intfc_name,$intfc_port)=$ipgen->ipgen_get_port($p); |
#my $label_name=gen_label_in_left(" $p "); |
my $name_entry=gen_entry($p); |
my $name_entry=gen_label_in_left($p); |
my $label_type=gen_label_in_left(" $type "); |
my $range_entry=gen_entry($range); |
my $pos=(defined $intfc_name ) ? get_scolar_pos( $intfc_name,@interfaces) : 0; |
1511,11 → 1533,12
my $intfc_port_combo=gen_intfc_port_combo($intfc,$ipgen,$intfc_name,$type,$p); |
|
|
$table->attach_defaults ($label_type, 0, 1, $row, $row+1); |
$table->attach_defaults ($name_entry, 1, 3, $row, $row+1); |
$table->attach_defaults ($intfc_name_combo,3, 5, $row, $row+1); |
$table->attach_defaults ($range_entry, 5, 7, $row, $row+1); |
$table->attach_defaults ($intfc_port_combo,7, 9, $row, $row+1); |
$table->attach ($label_type, 0, 1, $row, $row+1,'expand','shrink',2,2); |
$table->attach ($name_entry, 1, 3, $row, $row+1,'expand','shrink',2,2); |
$table->attach ($intfc_name_combo,3, 5, $row, $row+1,'expand','shrink',2,2); |
$table->attach ($intfc_port_combo, 5, 7, $row, $row+1,'fill','shrink',2,2); |
$table->attach ($range_entry ,7, 9, $row, $row+1,'fill','shrink',2,2); |
|
$intfc_name_combo->signal_connect('changed'=>sub{ |
my $intfc_name=$intfc_name_combo->get_active_text(); |
my $pos= get_scolar_pos( $intfc_name,@interfaces_name); |
1522,7 → 1545,7
#my($type,$name,$num)= split("[:\[ \\]]", $intfc_name); |
#print "$type,$name,$num\n"; |
$ipgen->ipgen_set_port_intfc_name($p,$interfaces[$pos]); |
set_state($soc_state,"interface_selected",1); |
set_gui_status($ipgen,"interface_selected",1); |
}); |
$range_entry->signal_connect('changed'=>sub{ |
my $new_range=$range_entry->get_text(); |
1550,6 → 1573,9
my $name=$ipgen->ipgen_get("module_name"); |
my $category=$ipgen->ipgen_get("category"); |
my $ip_name= $ipgen->ipgen_get("ip_name"); |
my $dir = Cwd::getcwd(); |
|
|
#check if name has been set |
if(defined ($name) && defined ($category)){ |
if (!defined $ip_name) {$ip_name= $name} |
1565,7 → 1591,9
my $response = $dialog->run; |
if ($response eq 'yes') { |
# Write |
open(FILE, ">lib/ip/$ip_name.IP") || die "Can not open: $!"; |
mkpath("$dir/lib/ip/$category/",1,01777); |
open(FILE, ">lib/ip/$category/$ip_name.IP") || die "Can not open: \">lib/ip/$category/$ip_name.IP\" $!"; |
print FILE perl_file_header("$ip_name.IP"); |
print FILE Data::Dumper->Dump([\%$ipgen],[$name]); |
close(FILE) || die "Error closing file: $!"; |
my $message="IP $ip_name has been generated successfully" ; |
1579,7 → 1607,9
|
}else{ |
# Write |
open(FILE, ">lib/ip/$ip_name.IP") || die "Can not open: $!"; |
mkpath("$dir/lib/ip/$category/",1,01777); |
open(FILE, ">lib/ip/$category/$ip_name.IP") || die "Can not open: $!"; |
print FILE perl_file_header("$ip_name.IP"); |
print FILE Data::Dumper->Dump([\%$ipgen],[$name]); |
close(FILE) || die "Error closing file: $!"; |
my $message="IP $ip_name has been generated successfully" ; |
1608,7 → 1638,7
######## |
|
sub load_ip{ |
my ($ipgen,$soc_state)=@_; |
my ($ipgen)=@_; |
my $file; |
my $dialog = Gtk2::FileChooserDialog->new( |
'Select a File', undef, |
1630,7 → 1660,7
my ($name,$path,$suffix) = fileparse("$file",qr"\..[^.]*$"); |
if($suffix eq '.IP'){ |
$ipgen->ipgen_add("file_name",$file); |
set_state($soc_state,"load_file",0); |
set_gui_status($ipgen,"load_file",0); |
} |
} |
$dialog->destroy; |
1651,26 → 1681,30
|
|
sub get_source_file{ |
my($ipgen,$soc_state,$info,$page,$title,$dest,$page_info_ref)=@_; |
my($ipgen,$info,$page,$title,$dest,$page_info_ref)=@_; |
|
|
my $var_list='${parameter_name}: Verilog module parameter values. |
|
${BASE}: is the wishbone base addresse(s) and will be added during soc generation to system.h. If more than one slave wishbone bus are used define them as ${BASE0}, ${BASE1}... . |
my $var_list='${parameter_name}: Verilog module parameter values. |
|
${CORE_ID} Each wishbone bus based SoC will have a unique CORE_ID that represents its location in NoC topology. CORE_ID=((y * number_of_nodes_in_x_ dimension) + x) where (x,y) are the node location in x and y axises. If the generated tile is used as top level module CORE_ID will take the default value of zero. |
|
${IP}: is the peripheral device instance name. |
|
${CORE}: is the peripheral device module name.'; |
${CORE}: is the peripheral device module name. |
|
${BASE}: is the wishbone base addresse(s) and will be added during soc generation to system.h. If more than one slave wishbone bus are used define them as ${BASE0}, ${BASE1}... . |
' |
; |
my $var_help=gen_button_message($var_list,"icons/info.png","Global variables"); |
|
my($width,$hight)=max_win_size(); |
my $window = def_popwin_size($width*2/3,$hight*2/3,$title); |
|
my $notebook=source_notebook($ipgen,$soc_state,$info,$window,$page,$dest,$page_info_ref); |
my $table=def_table (15, 15, TRUE); |
my $notebook=source_notebook($ipgen,$info,$window,$page,$dest,$page_info_ref); |
my $table=def_table (15, 15, FALSE); |
|
|
$table->attach_defaults ($var_help, 5, 7, 0, 1); |
$table->attach ($var_help, 5, 7, 0, 1,'expand','shrink',2,2); |
$table->attach_defaults ($notebook , 0, 15, 1, 15); |
|
$window->add($table); |
1684,14 → 1718,14
########## |
|
sub source_notebook{ |
my($ipgen,$soc_state,$info,$window,$page,$dest,$page_info_ref)=@_; |
my($ipgen,$info,$window,$page,$dest,$page_info_ref)=@_; |
my $notebook = Gtk2::Notebook->new; |
my %page_info=%{$page_info_ref}; |
foreach my $p (sort keys %page_info){ |
my $page_ref; |
$page_ref=get_file_folder($ipgen,$soc_state,$info,$window,$p,$page_info_ref) if($page_info{$p}{filed_type} eq "exsiting_file/folder"); |
$page_ref=get_file_folder($ipgen,$soc_state,$info,$window,$p,$page_info_ref) if($page_info{$p}{filed_type} eq "file_generators"); |
$page_ref=get_file_content($ipgen,$soc_state,$info,$window,$page_info{$p},$page_info_ref) if($page_info{$p}{filed_type} eq "file_content"); |
$page_ref=get_file_folder($ipgen,$info,$window,$p,$page_info_ref) if($page_info{$p}{filed_type} eq "exsiting_file/folder"); |
$page_ref=get_file_folder($ipgen,$info,$window,$p,$page_info_ref) if($page_info{$p}{filed_type} eq "file_generators"); |
$page_ref=get_file_content($ipgen,$info,$window,$page_info{$p},$page_info_ref) if($page_info{$p}{filed_type} eq "file_content"); |
$notebook->append_page ($page_ref,Gtk2::Label->new_with_mnemonic ($page_info{$p}{page_name})); |
|
} |
1706,18 → 1740,18
######### |
|
sub get_file_folder{ |
my ($ipgen,$soc_state,$info,$window,$page,$page_info_ref)=@_; |
my ($ipgen,$info,$window,$page,$page_info_ref)=@_; |
my %page_info=%{$page_info_ref}; |
my @sw_dir = $ipgen->ipgen_get_list($page_info{$page}{filed_name}); |
my $table = Gtk2::Table->new (15, 15, TRUE); |
my $table = Gtk2::Table->new (15, 15, FALSE); |
my $help=gen_label_help($page_info{$page}{help}); |
$table->attach_defaults($help,0,2,0,1); |
$table->attach ($help,0,2,0,1,'expand','shrink',2,2); |
my ($scrwin,$ok)=gen_file_list($ipgen,$page_info{$page}{filed_name},$window,$page_info{$page}{rename_file}); |
|
my $label=gen_label_in_left("Selecet file(s):"); |
my $brows=def_image_button("icons/browse.png",' Browse'); |
$table->attach_defaults($label,2,4,0,1); |
$table->attach_defaults($brows,4,6,0,1); |
$table->attach ($label,2,4,0,1,'expand','shrink',2,2); |
$table->attach($brows,4,6,0,1,'expand','shrink',2,2); |
|
my $dir = Cwd::getcwd(); |
my $project_dir = abs_path("$dir/../../"); #mpsoc directory address |
1750,7 → 1784,7
|
} |
$ipgen->ipgen_add($page_info{$page}{filed_name},\@sw_dir); |
get_source_file($ipgen,$soc_state,$info,$page,"Add software file(s)","SW",$page_info_ref); |
get_source_file($ipgen,$info,$page,"Add software file(s)","SW",$page_info_ref); |
$window->destroy; |
|
} |
1760,8 → 1794,8
if($page_info{$page}{folder_en} eq 1){ |
my $label2=gen_label_in_left("Selecet folder(s):"); |
my $brows2=def_image_button("icons/browse.png",' Browse'); |
$table->attach_defaults($label2,7,9,0,1); |
$table->attach_defaults($brows2,9,11,0,1); |
$table->attach($label2,7,9,0,1,'expand','shrink',2,2); |
$table->attach($brows2,9,11,0,1,'expand','shrink',2,2); |
|
$brows2->signal_connect("clicked"=> sub { |
my @files; |
1791,7 → 1825,7
} |
|
$ipgen->ipgen_add($page_info{$page}{filed_name},\@sw_dir); |
get_source_file($ipgen,$soc_state,$info,$page,"Add software file(s)","SW",$page_info_ref); |
get_source_file($ipgen,$info,$page,"Add software file(s)","SW",$page_info_ref); |
$window->destroy; |
|
|
1809,7 → 1843,7
|
|
$table->attach_defaults($scrwin,0,15,1,14); |
$table->attach_defaults($ok,6,9,14,15); |
$table->attach($ok,6,9,14,15,'expand','shrink',2,2); |
|
return ($table) |
|
1823,16 → 1857,16
######### |
|
sub get_file_content{ |
my ($ipgen,$soc_state,$info,$window,$page_info_ref)=@_; |
my ($ipgen,$info,$window,$page_info_ref)=@_; |
my %page_info=%{$page_info_ref}; |
#my $hdr = $ipgen->ipgen_get_hdr(); |
my $hdr = $ipgen-> ipgen_get($page_info{filed_name}); |
my $table = Gtk2::Table->new (14, 15, TRUE); |
my $table = Gtk2::Table->new (14, 15, FALSE); |
#my $window=def_popwin_size(600,600,"Add header file"); |
my ($scrwin,$text_view)=create_text(); |
|
my $help=gen_label_help($page_info{help}); |
$table->attach_defaults($help,0,8,0,1); |
$table->attach ($help,0,8,0,1,'expand','shrink',2,2); |
$table->attach_defaults($scrwin,0,15,1,14); |
my $text_buffer = $text_view->get_buffer; |
if(defined $hdr) {$text_buffer->set_text($hdr)}; |
1845,7 → 1879,7
|
}); |
|
$table->attach_defaults($ok,6,9,14,15); |
$table->attach($ok,6,7,14,15,'expand','shrink',2,2); |
return ($table); |
|
} |
1870,7 → 1904,7
########### |
|
sub get_unused_intfc_ports_list { |
my($intfc,$ipgen,$soc_state,$info)=@_; |
my($intfc,$ipgen,$info)=@_; |
my @ports=$ipgen->ipgen_list_ports; |
my ($name_ref,$ref)=get_list_of_all_interfaces($ipgen); |
my @interfaces_name=@{$name_ref}; |
1888,7 → 1922,7
@all_ports= $intfc->get_plug_port_list($name); |
} |
foreach my $p(@all_ports){ |
my $r= check_intfc_port_exits($intfc,$ipgen,$soc_state,$info,$intfc_name,$p); |
my $r= check_intfc_port_exits($intfc,$ipgen,$info,$intfc_name,$p); |
if ($r eq "0"){ |
$ipgen->ipgen_add_unused_intfc_port( $intfc_name,$p ); |
} |
1899,7 → 1933,7
} |
|
sub check_intfc_port_exits{ |
my($intfc,$ipgen,$soc_state,$info,$intfc_name,$intfc_port)=@_; |
my($intfc,$ipgen,$info,$intfc_name,$intfc_port)=@_; |
my @ports=$ipgen->ipgen_list_ports; |
|
|
1943,10 → 1977,8
my $ipgen=shift; |
my $intfc=interface->interface_new(); |
if(!defined $ipgen) { $ipgen=ip_gen->ip_gen_new();} |
#my $ipgen = eval { do 'lib/ip/wishbone_bus.IP' }; |
my $soc_state= def_state("ideal"); |
# main window |
#my $window = def_win_size(1000,800,"Top"); |
set_gui_status($ipgen,"ideal",0); |
|
# The main table containg the lib tree, selected modules and info section |
my $main_table = def_table (15, 12, FALSE); |
|
1956,42 → 1988,40
|
my $refresh_dev_win = Gtk2::Button->new_from_stock('ref'); |
my $generate = def_image_button('icons/gen.png','Generate'); |
my $genbox=def_hbox(TRUE,5); |
$genbox->pack_start($generate, FALSE, FALSE,3); |
|
|
# A tree view for holding a library |
my $tree_box = create_interface_tree ($info,$intfc,$ipgen,$soc_state); |
my $tree_box = create_interface_tree ($info,$intfc,$ipgen); |
|
|
my $file_info=show_file_info($ipgen,$soc_state,$info,\$refresh_dev_win); |
my $port_info=show_port_info($intfc,$ipgen,$soc_state,$info,\$refresh_dev_win); |
my $intfc_info=show_interface_info($intfc,$ipgen,$soc_state,$info,\$refresh_dev_win); |
my $file_info=show_file_info($ipgen,$info,\$refresh_dev_win); |
my $port_info=show_port_info($intfc,$ipgen,$info,\$refresh_dev_win); |
my $intfc_info=show_interface_info($intfc,$ipgen,$info,\$refresh_dev_win); |
|
|
my $open = def_image_button('icons/browse.png','Load IP'); |
my $openbox=def_hbox(TRUE,0); |
$openbox->pack_start($open, FALSE, FALSE,0); |
|
|
$main_table->set_row_spacings (4); |
$main_table->set_col_spacings (1); |
|
#my $device_win=show_active_dev($soc,$lib,$infc,$soc_state,\$refresh_dev_win,$info); |
#my $device_win=show_active_dev($soc,$lib,$infc,\$refresh_dev_win,$info); |
|
|
#$table->attach_defaults ($event_box, $col, $col+1, $row, $row+1); |
$main_table->attach_defaults ($tree_box , 0, 2, 0, 13); |
$main_table->attach_defaults ($file_info , 2, 12, 0, 2); |
$main_table->attach_defaults ($intfc_info , 2, 12, 2, 7); |
$main_table->attach_defaults ($intfc_info , 2, 12, 2, 6); |
|
$main_table->attach_defaults ($port_info , 2, 12, 7,13); |
$main_table->attach_defaults ($port_info , 2, 12, 6,13); |
$main_table->attach_defaults ($infobox , 0, 12, 13,14); |
$main_table->attach_defaults ($genbox, 6, 8, 14,15); |
$main_table->attach_defaults ($openbox,0, 1, 14,15); |
$main_table->attach ($generate, 6, 8, 14,15,'expand','shrink',2,2); |
$main_table->attach ($open,0, 1, 14,15,'expand','shrink',2,2); |
|
#check soc status every 0.5 second. referesh device table if there is any changes |
Glib::Timeout->add (100, sub{ |
|
my ($state,$timeout)= get_state($soc_state); |
my ($state,$timeout)= get_gui_status($ipgen); |
if($state eq "load_file"){ |
my $file=$ipgen->ipgen_get("file_name"); |
my $pp= eval { do $file }; |
1998,16 → 2028,16
clone_obj($ipgen,$pp); |
|
|
set_state($soc_state,"ref",1); |
set_gui_status($ipgen,"ref",1); |
|
|
}elsif ($timeout>0){ |
$timeout--; |
set_state($soc_state,$state,$timeout); |
set_gui_status($ipgen,$state,$timeout); |
} |
elsif( $state eq "change_parameter" ){ |
get_parameter_setting($ipgen,$soc_state,$info); |
set_state($soc_state,"ideal",0); |
get_parameter_setting($ipgen,$info); |
set_gui_status($ipgen,"ideal",0); |
|
|
|
2014,7 → 2044,7
} |
elsif( $state ne "ideal" ){ |
$refresh_dev_win->clicked; |
set_state($soc_state,"ideal",0); |
set_gui_status($ipgen,"ideal",0); |
|
|
} |
2022,12 → 2052,12
|
} ); |
$open-> signal_connect("clicked" => sub{ |
load_ip($ipgen,$soc_state); |
load_ip($ipgen); |
|
}); |
|
$generate-> signal_connect("clicked" => sub{ |
get_unused_intfc_ports_list ($intfc,$ipgen,$soc_state,$info); |
get_unused_intfc_ports_list ($intfc,$ipgen,$info); |
generate_ip($ipgen); |
|
$refresh_dev_win->clicked; |
/ip_gen.pm
618,6 → 618,37
return %l; |
|
} |
|
|
|
sub object_add_attribute{ |
my ($self,$attribute1,$attribute2,$value)=@_; |
if(!defined $attribute2){$self->{$attribute1}=$value;} |
else {$self->{$attribute1}{$attribute2}=$value;} |
|
} |
|
sub object_get_attribute{ |
my ($self,$attribute1,$attribute2)=@_; |
if(!defined $attribute2) {return $self->{$attribute1};} |
return $self->{$attribute1}{$attribute2}; |
|
|
} |
|
sub object_add_attribute_order{ |
my ($self,$attribute,@param)=@_; |
$self->{'parameters_order'}{$attribute}=[] if (!defined $self->{parameters_order}{$attribute}); |
foreach my $p (@param){ |
push (@{$self->{parameters_order}{$attribute}},$p); |
|
} |
} |
|
sub object_get_attribute_order{ |
my ($self,$attribute)=@_; |
return @{$self->{parameters_order}{$attribute}}; |
} |
|
|
|
/mpsoc.pm
21,7 → 21,8
$self->{file_name} = (); # information on each file |
$self->{noc_param}= {}; |
$self->{noc_indept_param}={}; |
$self->{parameters_order}=[]; |
# $self->{parameters_order}=[]; |
|
$self->{setting}={}; |
$self->{socs}={}; |
mpsoc_initial_setting($self); |
41,63 → 42,9
$self->{setting}{soc_path}="lib/soc"; |
} |
|
sub mpsoc_set_setting{ |
my ($self,$name,$value)=@_; |
$self->{setting}{$name}=$value; |
|
} |
|
sub mpsoc_get_setting{ |
my ($self,$name)=@_; |
return $self->{setting}{$name}; |
|
} |
|
|
sub mpsoc_set_mpsoc_name{ |
my ($self,$name)=@_; |
if(defined $name){$self->{mpsoc_name}=$name;} |
} |
|
sub mpsoc_get_mpsoc_name{ |
my ($self)=@_; |
my $name; |
if(exists $self->{mpsoc_name}){ $name=$self->{mpsoc_name};} |
return $name; |
} |
|
sub mpsoc_get_indept_params{ |
my $self=shift; |
return $self->{noc_indept_param}; |
} |
|
|
sub mpsoc_add_param{ |
my ($self,$param,$value)=@_; |
$self->{noc_param}{$param}=$value; |
|
} |
|
sub mpsoc_get_param{ |
my ($self,$param)=@_; |
return $self->{noc_param}{$param}; |
|
} |
sub mpsoc_add_param_order{ |
my ($self,@param)=@_; |
foreach my $p (@param){ |
push (@{$self->{parameters_order}},$p); |
|
} |
} |
sub mpsoc_get_param_order{ |
my $self=shift; |
return @{$self->{parameters_order}}; |
} |
|
|
|
|
sub mpsoc_get_instance_info{ |
my ($self,$ip_num)=@_; |
return $self->{ips}{$ip_num}{name} |
260,5 → 207,39
} |
|
|
|
sub object_add_attribute{ |
my ($self,$attribute1,$attribute2,$value)=@_; |
if(!defined $attribute2){$self->{$attribute1}=$value;} |
else {$self->{$attribute1}{$attribute2}=$value;} |
|
} |
|
|
|
sub object_get_attribute{ |
my ($self,$attribute1,$attribute2)=@_; |
if(!defined $attribute2) {return $self->{$attribute1};} |
return $self->{$attribute1}{$attribute2}; |
|
|
} |
|
|
sub object_add_attribute_order{ |
my ($self,$attribute,@param)=@_; |
$self->{'parameters_order'}{$attribute}=[] if (!defined $self->{parameters_order}{$attribute}); |
foreach my $p (@param){ |
push (@{$self->{parameters_order}{$attribute}},$p); |
|
} |
} |
sub object_get_attribute_order{ |
my ($self,$attribute)=@_; |
return @{$self->{parameters_order}{$attribute}}; |
} |
|
|
|
1 |
|
/mpsoc_gen.pl
26,8 → 26,8
require "widget.pl"; |
require "mpsoc_verilog_gen.pl"; |
require "hdr_file_gen.pl"; |
require "readme_gen.pl"; |
|
|
sub get_pos{ |
my ($item,@list)=@_; |
my $pos=0; |
42,21 → 42,26
|
|
sub noc_param_widget{ |
my ($mpsoc,$name,$param, $default,$type,$content,$info, $state,$table,$row,$show)=@_; |
my ($mpsoc,$name,$param, $default,$type,$content,$info, $table,$row,$show,$attribut1,$ref_delay)=@_; |
my $label =gen_label_in_left(" $name"); |
my $widget; |
my $value=$mpsoc->mpsoc_get_param($param); |
my $value=$mpsoc->object_get_attribute($attribut1,$param); |
if(! defined $value) { |
$mpsoc->mpsoc_add_param($param,$default); |
$mpsoc->mpsoc_add_param_order($param); |
$mpsoc->object_add_attribute($attribut1,$param,$default); |
$mpsoc->object_add_attribute_order($attribut1,$param); |
$value=$default; |
} |
if( ! defined $ref_delay){ |
$ref_delay=($type eq "Entry") ? 10 : 1; |
|
} |
if ($type eq "Entry"){ |
$widget=gen_entry($value); |
$widget-> signal_connect("changed" => sub{ |
my $new_param_value=$widget->get_text(); |
$mpsoc->mpsoc_add_param($param,$new_param_value); |
set_state($state,"ref",10); |
$mpsoc->object_add_attribute($attribut1,$param,$new_param_value); |
set_gui_status($mpsoc,"ref",$ref_delay); |
|
|
}); |
|
64,10 → 69,10
} |
elsif ($type eq "Combo-box"){ |
my @combo_list=split(",",$content); |
my $pos=get_pos($value, @combo_list); |
my $pos=get_pos($value, @combo_list) if(defined $value); |
if(!defined $pos){ |
$mpsoc->mpsoc_add_param($param,$default); |
$pos=get_item_pos($default, @combo_list); |
$mpsoc->object_add_attribute($attribut1,$param,$default); |
$pos=get_item_pos($default, @combo_list) if (defined $default); |
|
} |
#print " my $pos=get_item_pos($value, @combo_list);\n"; |
74,8 → 79,8
$widget=gen_combo(\@combo_list, $pos); |
$widget-> signal_connect("changed" => sub{ |
my $new_param_value=$widget->get_active_text(); |
$mpsoc->mpsoc_add_param($param,$new_param_value); |
set_state($state,"ref",1); |
$mpsoc->object_add_attribute($attribut1,$param,$new_param_value); |
set_gui_status($mpsoc,"ref",$ref_delay); |
|
|
}); |
91,8 → 96,8
$widget->set_value($value); |
$widget-> signal_connect("value_changed" => sub{ |
my $new_param_value=$widget->get_value_as_int(); |
$mpsoc->mpsoc_add_param($param,$new_param_value); |
set_state($state,"ref",1); |
$mpsoc->object_add_attribute($attribut1,$param,$new_param_value); |
set_gui_status($mpsoc,"ref",$ref_delay); |
|
}); |
|
111,7 → 116,7
my @chars = split("",$value); |
#check if saved value match the size of check box |
if($chars[0] ne $content ) { |
$mpsoc->mpsoc_add_param($param,$default); |
$mpsoc->object_add_attribute($attribut1,$param,$default); |
$value=$default; |
@chars = split("",$value); |
} |
133,9 → 138,9
if($check[$i]->get_active()) {$new_val="${new_val}1" ;} |
else {$new_val="${new_val}0" ;} |
} |
$mpsoc->mpsoc_add_param($param,$new_val); |
$mpsoc->object_add_attribute($attribut1,$param,$new_val); |
#print "\$new_val=$new_val\n"; |
set_state($state,"ref",1); |
set_gui_status($mpsoc,"ref",$ref_delay); |
}); |
} |
|
143,6 → 148,12
|
|
} |
elsif ( $type eq "DIR_path"){ |
$widget =get_dir_in_object ($mpsoc,$attribut1,$param,$value,'ref',10); |
} |
|
|
|
else { |
$widget =gen_label_in_left("unsuported widget type!"); |
} |
186,9 → 197,11
############ |
|
sub get_soc_list { |
my $mpsoc=shift; |
my ($mpsoc,$info)=@_; |
|
my $path=$mpsoc->mpsoc_get_setting('soc_path'); |
|
my $path=$mpsoc->object_get_attribute('setting','soc_path'); |
|
$path =~ s/ /\\ /g; |
my @socs; |
my @files = glob "$path/*.SOC"; |
196,6 → 209,10
|
# Read |
my $soc = eval { do $p }; |
if ($@ || !defined $soc){ |
add_info(\$info,"**Error reading $p file: $@\n"); |
next; |
} |
my $top=$soc->soc_get_top(); |
if (defined $top){ |
my @instance_list=$top->top_get_all_instances(); |
204,7 → 221,7
my $module=$top->top_get_def_of_instance($instanc,'module'); |
if($module eq 'ni') |
{ |
my $name=$soc->soc_get_soc_name(); |
my $name=$soc->object_get_attribute('soc_name'); |
$mpsoc->mpsoc_add_soc($name,$top); |
#print" $name\n"; |
} |
216,19 → 233,7
|
|
|
#my @instance_list=$soc->soc_get_all_instances(); |
#my $i=0; |
|
#check if the soc has ni port |
#foreach my $instanc(@instance_list){ |
# my $module=$soc->soc_get_module($instanc); |
# if($module eq 'ni') |
# { |
# my $name=$soc->soc_get_soc_name(); |
# $mpsoc->mpsoc_add_soc($name,$soc); |
# #print" $name\n"; |
# } |
#} |
|
|
}#files |
258,7 → 263,7
} |
|
sub get_conflict_decision{ |
my ($mpsoc,$name,$inserted,$conflicts,$msg,$state)=@_; |
my ($mpsoc,$name,$inserted,$conflicts,$msg)=@_; |
$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\tinsterd range or remove them from the previous ones? "; |
|
my $wind=def_popwin_size(100,300,"warning"); |
288,7 → 293,7
} |
} |
$mpsoc->mpsoc_add_soc_tiles_num($name,$inserted) if(defined $inserted ); |
set_state($state,"ref",1); |
set_gui_status($mpsoc,"ref",1); |
$wind->destroy(); |
|
}); |
297,7 → 302,7
my @new= get_diff_array($inserted,$conflicts); |
$mpsoc->mpsoc_add_soc_tiles_num($name,\@new) if(scalar @new ); |
$mpsoc->mpsoc_add_soc_tiles_num($name,undef) if(scalar @new ==0 ); |
set_state($state,"ref",1); |
set_gui_status($mpsoc,"ref",1); |
$wind->destroy(); |
|
}); |
317,7 → 322,7
|
|
sub check_inserted_ip_nums{ |
my ($mpsoc,$name,$str,$state)=@_; |
my ($mpsoc,$name,$str)=@_; |
my @all_num=(); |
$str= remove_all_white_spaces ($str); |
|
342,8 → 347,8
|
} |
#check if range does not exceed the tile numbers |
my $nx= $mpsoc->mpsoc_get_param("NX"); |
my $ny= $mpsoc->mpsoc_get_param("NY"); |
my $nx= $mpsoc->object_get_attribute('noc_param',"NX"); |
my $ny= $mpsoc->object_get_attribute('noc_param',"NY"); |
|
my $max_tile_num=$nx*$ny; |
my @f=sort { $a <=> $b } @all_num; |
372,13 → 377,13
}#if |
} |
if (defined $conflicts_msg) { |
get_conflict_decision($mpsoc,$name,\@all_num,\@conflicts,$conflicts_msg,$state); |
get_conflict_decision($mpsoc,$name,\@all_num,\@conflicts,$conflicts_msg); |
|
}else { |
#save the entered ips |
if( scalar @all_num>0){ $mpsoc->mpsoc_add_soc_tiles_num($name,\@all_num);} |
else {$mpsoc->mpsoc_add_soc_tiles_num($name,undef);} |
set_state($state,"ref",1); |
set_gui_status($mpsoc,"ref",1); |
} |
|
|
393,7 → 398,7
################ |
|
sub get_soc_parameter_setting{ |
my ($mpsoc,$soc_name,$state,$tile)=@_; |
my ($mpsoc,$soc_name,$tile)=@_; |
|
my $window = (defined $tile)? def_popwin_size(600,400,"Parameter setting for $soc_name located in tile($tile) "):def_popwin_size(600,400,"Default Parameter setting for $soc_name "); |
my $table = def_table(10, 7, TRUE); |
425,7 → 430,7
} |
elsif ($type eq "Combo-box"){ |
my @combo_list=split(",",$content); |
my $pos=get_item_pos($param_value{$p}, @combo_list); |
my $pos=get_item_pos($param_value{$p}, @combo_list) if(defined $param_value{$p}); |
my $combo=gen_combo(\@combo_list, $pos); |
$table->attach_defaults ($combo, 3, 6, $row, $row+1); |
$combo-> signal_connect("changed" => sub{$param_value{$p}=$combo->get_active_text();}); |
461,7 → 466,6
|
} |
} |
#my @parameters=$ip->ip_get_module_parameters($category,$module); |
|
|
|
483,6 → 487,7
|
|
|
|
my $ok = def_image_button('icons/select.png','OK'); |
my $okbox=def_hbox(TRUE,0); |
$okbox->pack_start($ok, FALSE, FALSE,0); |
506,7 → 511,7
$top->top_add_custom_soc_param(\%param_value,$tile); |
|
} |
#set_state($soc_state,"refresh_soc",1); |
#set_gui_status($mpsoc,"refresh_soc",1); |
#$$refresh_soc->clicked; |
|
}); |
526,7 → 531,7
################ |
|
sub tile_set_widget{ |
my ($mpsoc,$soc_name,$num,$table,$state,$show,$row)=@_; |
my ($mpsoc,$soc_name,$num,$table,$show,$row)=@_; |
#my $lable=gen_label_in_left($soc); |
my @all_num= $mpsoc->mpsoc_get_soc_tiles_num($soc_name); |
my $init=compress_nums(@all_num); |
540,7 → 545,7
|
my $button = def_colored_button($soc_name,$num); |
$button->signal_connect("clicked"=> sub{ |
get_soc_parameter_setting($mpsoc,$soc_name,$state,undef); |
get_soc_parameter_setting($mpsoc,$soc_name,undef); |
|
}); |
|
547,7 → 552,7
|
$set->signal_connect("clicked"=> sub{ |
my $data=$entry->get_text(); |
check_inserted_ip_nums($mpsoc,$soc_name,$data,$state); |
check_inserted_ip_nums($mpsoc,$soc_name,$data); |
|
|
|
554,7 → 559,7
}); |
$remove->signal_connect("clicked"=> sub{ |
$mpsoc->mpsoc_remove_soc($soc_name); |
set_state($state,"ref",1); |
set_gui_status($mpsoc,"ref",1); |
|
}); |
|
584,7 → 589,7
################### |
|
sub defualt_tilles_setting { |
my ($mpsoc,$state,$table,$show,$row)=@_; |
my ($mpsoc,$table,$show,$row,$info)=@_; |
|
#title |
my $separator1 = Gtk2::HSeparator->new; |
602,7 → 607,7
my $label = gen_label_in_left("Tiles path:"); |
my $entry = Gtk2::Entry->new; |
my $browse= def_image_button("icons/browse.png"); |
my $file= $mpsoc->mpsoc_get_setting('soc_path'); |
my $file= $mpsoc->object_get_attribute('setting','soc_path'); |
if(defined $file){$entry->set_text($file);} |
|
|
626,10 → 631,10
if ( "ok" eq $dialog->run ) { |
$file = $dialog->get_filename; |
$$entry_ref->set_text($file); |
$mpsoc->mpsoc_set_setting('soc_path',$file); |
$mpsoc->object_add_attribute('setting','soc_path',$file); |
$mpsoc->mpsoc_remove_all_soc(); |
set_state($state,"ref",1); |
#check_input_file($file,$socgen,$soc_state,$info); |
set_gui_status($mpsoc,"ref",1); |
#check_input_file($file,$socgen,$info); |
#print "file = $file\n"; |
} |
$dialog->destroy; |
643,10 → 648,10
|
$entry->signal_connect("activate"=>sub{ |
my $file_name=$entry->get_text(); |
$mpsoc->mpsoc_set_setting('soc_path',$file_name); |
$mpsoc->object_add_attribute('setting','soc_path',$file_name); |
$mpsoc->mpsoc_remove_all_soc(); |
set_state($state,"ref",1); |
#check_input_file($file_name,$socgen,$soc_state,$info); |
set_gui_status($mpsoc,"ref",1); |
#check_input_file($file_name,$socgen,$info); |
}); |
|
|
664,7 → 669,7
|
my @socs=$mpsoc->mpsoc_get_soc_list(); |
if( scalar @socs == 0){ |
@socs=get_soc_list($mpsoc); |
@socs=get_soc_list($mpsoc,$info); |
|
} |
@socs=$mpsoc->mpsoc_get_soc_list(); |
680,46 → 685,28
if($show){ |
$table->attach_defaults ($lab1 ,0,3, $row,$row+1); |
$table->attach_defaults ($lab2 ,5,10, $row,$row+1);$row++; |
} |
} |
|
|
|
my $soc_num=0; |
foreach my $soc_name (@socs){ |
$row=tile_set_widget ($mpsoc,$soc_name,$soc_num,$table,$state,$show,$row); |
$soc_num++; |
$row=tile_set_widget ($mpsoc,$soc_name,$soc_num,$table,$show,$row); |
$soc_num++; |
|
|
|
|
} |
|
|
|
|
|
} |
return $row; |
|
|
} |
|
|
|
|
|
|
|
|
####################### |
# noc_config |
###################### |
|
sub noc_config{ |
my ($mpsoc,$state)=@_; |
my $table=def_table(20,10,FALSE);# my ($row,$col,$homogeneous)=@_; |
my $scrolled_win = new Gtk2::ScrolledWindow (undef, undef); |
$scrolled_win->set_policy( "automatic", "automatic" ); |
$scrolled_win->add_with_viewport($table); |
my ($mpsoc,$table)=@_; |
|
|
|
#title |
740,7 → 727,12
|
#parameter start |
my $b1; |
my $show_noc=$mpsoc->mpsoc_get_setting('show_noc_setting'); |
my $show_noc=$mpsoc->object_get_attribute('setting','show_noc_setting'); |
if(!defined $show_noc){ |
$show_noc=1; |
$mpsoc->object_add_attribute('setting','show_noc_setting',$show_noc); |
|
} |
if($show_noc == 0){ |
$b1= def_image_button("icons/down.png","NoC Parameters"); |
$label=gen_label_in_center(' '); |
757,20 → 749,10
$type='Combo-box'; |
$info=" Input-queued: simple router with low performance and does not support fully adaptive routing. |
VC-based routers offer higher performance, fully adaptive routing and traffic isolation for different packet classes."; |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $state,$table,$row,$show_noc); |
my $router_type=$mpsoc->mpsoc_get_param("ROUTER_TYPE"); |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$show_noc,'noc_type'); |
my $router_type=$mpsoc->object_get_attribute('noc_type',"ROUTER_TYPE"); |
|
|
#P port number |
$label= 'Port Number'; |
$param= 'P'; |
$default=' 5'; |
$content='3,12,1'; |
$info= 'Number of NoC router port'; |
$type= 'Spin-button'; |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $state,$table,$row,0); |
|
|
|
|
#Routers per row |
$label= 'Routers per row'; |
779,7 → 761,7
$content='2,16,1'; |
$info= 'Number of NoC routers in row (X dimention)'; |
$type= 'Spin-button'; |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $state,$table,$row,$show_noc); |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$show_noc,'noc_param'); |
|
|
|
790,12 → 772,12
$content='2,16,1'; |
$info= 'Number of NoC routers in column (Y dimention)'; |
$type= 'Spin-button'; |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $state,$table,$row,$show_noc); |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$show_noc,'noc_param'); |
|
if($router_type eq '"VC_BASED"'){ |
#VC number per port |
my $v=$mpsoc->mpsoc_get_param('V'); |
if(defined $v){ $mpsoc->mpsoc_add_param('V',2) if($v eq 1);} |
my $v=$mpsoc->object_get_attribute('noc_param','V'); |
if(defined $v){ $mpsoc->object_add_attribute('noc_param','V',2) if($v eq 1);} |
$label='VC number per port'; |
$param='V'; |
$default='2'; |
802,10 → 784,10
$type='Spin-button'; |
$content='2,16,1'; |
$info='Number of Virtual Channel per each router port'; |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $state,$table,$row,$show_noc); |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$show_noc,'noc_param'); |
} else { |
$mpsoc->mpsoc_add_param('V',1); |
$mpsoc->mpsoc_add_param('C',0); |
$mpsoc->object_add_attribute('noc_param','V',1); |
$mpsoc->object_add_attribute('noc_param','C',0); |
|
|
} |
817,7 → 799,7
$content='2,256,1'; |
$type='Spin-button'; |
$info=($router_type eq '"VC_BASED"')? 'Buffer queue size per VC in flits' : 'Buffer queue size in flits'; |
$row= noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $state,$table,$row,$show_noc); |
$row= noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$show_noc,'noc_param'); |
|
#packet payload width |
$label='payload width'; |
826,7 → 808,7
$content='32,256,32'; |
$type='Spin-button'; |
$info="The packet payload width in bits"; |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $state,$table,$row,$show_noc); |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info,$table,$row,$show_noc,'noc_param'); |
|
#topology |
$label='Topology'; |
835,10 → 817,10
$content='"MESH","TORUS"'; |
$type='Combo-box'; |
$info="NoC topology"; |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $state,$table,$row,$show_noc); |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$show_noc,'noc_param'); |
|
#routing algorithm |
my $topology=$mpsoc->mpsoc_get_param('TOPOLOGY'); |
my $topology=$mpsoc->object_get_attribute('noc_param','TOPOLOGY'); |
$label='Routing Algorithm'; |
$param="ROUTE_NAME"; |
$type="Combo-box"; |
854,9 → 836,22
} |
$default=($topology eq '"MESH"')? '"XY"':'"TRANC_XY"'; |
$info="Select the routing algorithm: XY(DoR) , partially adaptive (Turn models). Fully adaptive (Duato) "; |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $state,$table,$row,$show_noc); |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$show_noc,'noc_param'); |
|
|
#SSA |
$label='SSA Ebable'; |
$param='SSA_EN'; |
$default='"NO"'; |
$content='"YES","NO"'; |
$type='Combo-box'; |
$info="Enable single cycle latency on packets traversing in the same direction using static straight allocator (SSA)"; |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$show_noc,'noc_param'); |
|
|
|
|
|
if($show_noc == 1){ |
$b1= def_image_button("icons/up.png","NoC Parameters"); |
$table->attach_defaults ( $b1 , 0, 2, $row,$row+1);$row++; |
863,14 → 858,14
} |
$b1->signal_connect("clicked" => sub{ |
$show_noc=($show_noc==1)?0:1; |
$mpsoc->mpsoc_set_setting('show_noc_setting',$show_noc); |
set_state($state,"ref",1); |
$mpsoc->object_add_attribute('setting','show_noc_setting',$show_noc); |
set_gui_status($mpsoc,"ref",1); |
|
}); |
|
#advance parameter start |
my $advc; |
my $adv_set=$mpsoc->mpsoc_get_setting('show_adv_setting'); |
my $adv_set=$mpsoc->object_get_attribute('setting','show_adv_setting'); |
if($adv_set == 0){ |
$advc= def_image_button("icons/down.png","Advance Parameters"); |
$table->attach_defaults ( $advc , 0, 4, $row,$row+1);$row++; |
880,7 → 875,7
|
|
#Fully and partially adaptive routing setting |
my $route=$mpsoc->mpsoc_get_param("ROUTE_NAME"); |
my $route=$mpsoc->object_get_attribute('noc_param',"ROUTE_NAME"); |
if($route ne '"XY"' and $route ne '"TRANC_XY"' ){ |
$label="Congestion index"; |
$param="CONGESTION_INDEX"; |
888,12 → 883,12
$content="0,12,1"; |
$info="Congestion index determines how congestion information is collected from neighboring routers. Please refer to the usere manual for more information"; |
$default=3; |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $state,$table,$row,$adv_set); |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'noc_param'); |
|
} |
#Fully adaptive routing setting |
if( $route eq '"TRANC_DUATO"' or $route eq '"DUATO"' ){ |
my $v=$mpsoc->mpsoc_get_param("V"); |
my $v=$mpsoc->object_get_attribute('noc_param',"V"); |
$label="Select Escap VC"; |
$param="ESCAP_VC_MASK"; |
$type="Check-box"; |
904,7 → 899,7
|
|
$info="Select the escap VC for fully adaptive routing."; |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $state,$table,$row,$adv_set,$adv_set); |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,$adv_set,'noc_param'); |
|
} |
|
915,7 → 910,7
$default='"NONATOMIC"'; |
$content='"ATOMIC","NONATOMIC"'; |
$type='Combo-box'; |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $state,$table,$row,$adv_set); |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'noc_param'); |
|
|
|
928,7 → 923,7
$content='"BASELINE","COMB_SPEC1","COMB_SPEC2","COMB_NONSPEC"'; |
$type='Combo-box'; |
$info="The joint VC/ switch allocator type. using canonical combination is not recommanded"; |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $state,$table,$row,$adv_set); |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'noc_param'); |
|
} |
|
939,7 → 934,7
$content='"ONE_HOT","BINARY"'; |
$type='Combo-box'; |
$info="Crossbar multiplexer type"; |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $state,$table,$row,$adv_set); |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'noc_param'); |
|
if($router_type eq '"VC_BASED"'){ |
#class |
949,11 → 944,11
$info='Number of message classes. Each specific class can use different set of VC'; |
$content='0,16,1'; |
$type='Spin-button'; |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $state,$table,$row,$adv_set); |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'noc_param'); |
|
|
my $class=$mpsoc->mpsoc_get_param("C"); |
my $v=$mpsoc->mpsoc_get_param("V"); |
my $class=$mpsoc->object_get_attribute('noc_param',"C"); |
my $v=$mpsoc->object_get_attribute('noc_param',"V"); |
$default= "$v\'b"; |
for (my $i=1; $i<=$v; $i++){ |
$default= "${default}1"; |
966,7 → 961,7
$type="Check-box"; |
$content=$v; |
$info="Select the permitted VCs which the message class $i can be sent via them."; |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $state,$table,$row,$adv_set); |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'noc_param'); |
|
|
} |
984,7 → 979,7
$default='0'; |
$content='0,1'; |
$type='Combo-box'; |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $state,$table,$row,$adv_set); |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'noc_param'); |
|
|
|
996,16 → 991,10
$content=1; |
$default="1\'b0"; |
$info="If ebabled it adds a pipline register at the output port of the router."; |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $state,$table,$row,0); |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'noc_param'); |
|
|
$label="Add pipeline reg befor crossbar"; |
$param="ADD_PIPREG_BEFORE_CROSSBAR"; |
$type="Check-box"; |
$content=1; |
$default="1\'b0"; |
$info="If ebabled it adds a pipline register after the input memory sd ram."; |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $state,$table,$row,0); |
|
|
|
|
1015,10 → 1004,8
} |
$advc->signal_connect("clicked" => sub{ |
$adv_set=($adv_set==1)?0:1; |
$mpsoc->mpsoc_set_setting('show_adv_setting',$adv_set); |
set_state($state,"ref",1); |
|
|
$mpsoc->object_add_attribute('setting','show_adv_setting',$adv_set); |
set_gui_status($mpsoc,"ref",1); |
}); |
|
|
1032,15 → 1019,9
$info='FIRST_ARBITER_EXT_P_EN'; |
$content='0,1'; |
$type="Combo-box"; |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $state,$table,$row,0); |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info,$table,$row,0,'noc_param'); |
|
#ROUTE_TYPE |
$param='ROUTE_TYPE'; |
$default='(ROUTE_NAME == "XY" || ROUTE_NAME == "TRANC_XY" )? "DETERMINISTIC" : |
(ROUTE_NAME == "DUATO" || ROUTE_NAME == "TRANC_DUATO" )? "FULL_ADAPTIVE": "PAR_ADAPTIVE"'; |
$info='ROUTE_TYPE'; |
$type="Entry"; |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $state,$table,$row,0); |
|
|
# AVC_ATOMIC_EN |
$label='AVC_ATOMIC_EN'; |
1049,7 → 1030,7
$info='AVC_ATOMIC_EN'; |
$content='0,1'; |
$type="Combo-box"; |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $state,$table,$row,0); |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,0,'noc_param'); |
|
|
#ROUTE_SUBFUNC |
1059,11 → 1040,49
$info='ROUTE_SUBFUNC'; |
$content='"XY"'; |
$type="Combo-box"; |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $state,$table,$row,0); |
$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,0,'noc_param'); |
|
return $row; |
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
####################### |
# get_config |
###################### |
|
sub get_config{ |
my ($mpsoc,$info)=@_; |
my $table=def_table(20,10,FALSE);# my ($row,$col,$homogeneous)=@_; |
my $scrolled_win = new Gtk2::ScrolledWindow (undef, undef); |
$scrolled_win->set_policy( "automatic", "automatic" ); |
$scrolled_win->add_with_viewport($table); |
|
#noc_setting |
my $row=noc_config ($mpsoc,$table); |
|
|
#tile setting |
my $tile_set; |
my $show=$mpsoc->mpsoc_get_setting('show_tile_setting'); |
my $show=$mpsoc->object_get_attribute('setting','show_tile_setting'); |
|
if($show == 0){ |
$tile_set= def_image_button("icons/down.png","Tiles setting"); |
$table->attach_defaults ( $tile_set , 0, 4, $row,$row+1);$row++; |
1074,7 → 1093,7
|
|
|
$row=defualt_tilles_setting($mpsoc,$state,$table,$show,$row); |
$row=defualt_tilles_setting($mpsoc,$table,$show,$row,$info); |
|
|
|
1090,8 → 1109,8
} |
$tile_set->signal_connect("clicked" => sub{ |
$show=($show==1)?0:1; |
$mpsoc->mpsoc_set_setting('show_tile_setting',$show); |
set_state($state,"ref",1); |
$mpsoc->object_add_attribute('setting','show_tile_setting',$show); |
set_gui_status($mpsoc,"ref",1); |
|
|
}); |
1121,8 → 1140,7
|
sub gen_socs { |
my ($mpsoc,$info)=@_; |
|
my $path=$mpsoc->mpsoc_get_setting('soc_path'); |
my $path=$mpsoc->object_get_attribute('setting','soc_path'); |
$path=~ s/ /\\ /g; |
my @socs; |
my @files = glob "$path/*.SOC"; |
1139,7 → 1157,11
for my $p (@files){ |
# Read |
my $soc = eval { do $p }; |
my $name=$soc->soc_get_soc_name(); |
if ($@ || !defined $soc){ |
show_info(\$info,"**Error reading $p file: $@\n"); |
next; |
} |
my $name=$soc->object_get_attribute('soc_name'); |
if( grep (/^$name$/,@used_socs)){ |
#generate the soc |
generate_soc_files($mpsoc,$soc,$info); |
1161,12 → 1183,13
|
sub generate_soc_files{ |
my ($mpsoc,$soc,$info)=@_; |
my $mpsoc_name=$mpsoc->mpsoc_get_mpsoc_name(); |
my $soc_name=$soc->soc_get_soc_name(); |
my $file_v=soc_generate_verilog($soc); |
my $mpsoc_name=$mpsoc->object_get_attribute('mpsoc_name'); |
my $soc_name=$soc->object_get_attribute('soc_name'); |
my ($file_v,$tmp)=soc_generate_verilog($soc); |
|
# Write object file |
open(FILE, ">lib/soc/$soc_name.SOC") || die "Can not open: $!"; |
print FILE perl_file_header("$soc_name.SOC"); |
print FILE Data::Dumper->Dump([\%$soc],[$soc_name]); |
close(FILE) || die "Error closing file: $!"; |
|
1247,13 → 1270,15
|
sub generate_mpsoc{ |
my ($mpsoc,$info)=@_; |
my $name=$mpsoc->mpsoc_get_mpsoc_name(); |
my $name=$mpsoc->object_get_attribute('mpsoc_name'); |
my $size= (defined $name)? length($name) :0; |
if ($size >0){ |
my $file_v=mpsoc_generate_verilog($mpsoc); |
gen_socs($mpsoc,$info); |
my ($file_v,$tmp)=mpsoc_generate_verilog($mpsoc); |
|
# Write object file |
open(FILE, ">lib/mpsoc/$name.MPSOC") || die "Can not open: $!"; |
print FILE perl_file_header("$name.MPSOC"); |
print FILE Data::Dumper->Dump([\%$mpsoc],[$name]); |
close(FILE) || die "Error closing file: $!"; |
|
1273,7 → 1298,7
mkpath("$target_dir/src_verilog/lib/",1,0755); |
mkpath("$target_dir/sw",1,0755); |
|
gen_socs($mpsoc,$info); |
#gen_socs($mpsoc,$info); |
|
move ("$dir/lib/verilog/$name.v","$target_dir/src_verilog/"); |
|
1298,7 → 1323,7
|
|
sub get_tile_LIST{ |
my ($mpsoc,$state,$x,$y,$soc_num,$row,$table)=@_; |
my ($mpsoc,$x,$y,$soc_num,$row,$table)=@_; |
my $instance_name=$mpsoc->mpsoc_get_instance_info($soc_num); |
if(!defined $instance_name){ |
$mpsoc->mpsoc_set_default_ip($soc_num); |
1316,7 → 1341,7
$entry->signal_connect( 'changed'=> sub{ |
my $new_instance=$entry->get_text(); |
$mpsoc->mpsoc_set_ip_inst_name($soc_num,$new_instance); |
set_state($state,"ref",20); |
set_gui_status($mpsoc,"ref",20); |
print "changed to $new_instance\n "; |
|
}); |
1341,10 → 1366,10
######### |
|
sub gen_tiles_LIST{ |
my ($mpsoc,$soc_state)=@_; |
my ($mpsoc)=@_; |
|
my $nx= $mpsoc->mpsoc_get_param("NX"); |
my $ny= $mpsoc->mpsoc_get_param("NY"); |
my $nx= $mpsoc->object_get_attribute('noc_param',"NX"); |
my $ny= $mpsoc->object_get_attribute('noc_param',"NY"); |
|
# print "($nx,$ny);\n"; |
my $table=def_table($nx*$ny,4,FALSE);# my ($row,$col,$homogeneous)=@_; |
1374,7 → 1399,7
my $soc_num= $y*$nx+$x; |
my $seph = Gtk2::HSeparator->new; |
$table->attach_defaults ($seph, 0, 8 , $row, $row+1);$row++; |
get_tile($mpsoc,$soc_state,$x,$y,$soc_num,$row,$table);$row++; |
get_tile($mpsoc,$x,$y,$soc_num,$row,$table);$row++; |
|
|
|
1404,7 → 1429,7
|
|
sub get_tile{ |
my ($mpsoc,$state,$tile,$x,$y)=@_; |
my ($mpsoc,$tile,$x,$y)=@_; |
|
|
my ($soc_name,$num)= $mpsoc->mpsoc_get_tile_soc_name($tile); |
1448,7 → 1473,7
@list=('Default','Custom'); |
$pos=(defined $param_setting)? get_scolar_pos($param_setting,@list): 0; |
my $nn=(defined $soc_name)? $soc_name : 'soc'; |
my ($box2,$combo2)=gen_combo_help("Defualt: the tail will get deafualt parameter setting of $nn.\n Custom: it will allow custom parameter setting for this tile only." , \@list, $pos); |
my ($box2,$combo2)=gen_combo_help("Defualt: the tail will get defualt parameter setting of $nn.\n Custom: it will allow custom parameter setting for this tile only." , \@list, $pos); |
my $lable2=gen_label_in_left(" Parameter Setting:"); |
$table->attach_defaults($lable2,0,3,$row,$row+1); |
$table->attach_defaults($box2,3,7,$row,$row+1);$row++; |
1491,16 → 1516,16
|
$ok-> signal_connect("clicked" => sub{ |
$window->destroy; |
set_state($state,"refresh_soc",1); |
set_gui_status($mpsoc,"refresh_soc",1); |
my $soc_name=$combo->get_active_text(); |
my $setting=$combo2->get_active_text(); |
if ($soc_name ne ' ' && $setting ne 'Default'){ |
get_soc_parameter_setting ($mpsoc,$soc_name,$state,$tile); |
get_soc_parameter_setting ($mpsoc,$soc_name,$tile); |
|
} |
#save new values |
#$top->top_add_default_soc_param(\%param_value); |
#set_state($soc_state,"refresh_soc",1); |
#set_gui_status($mpsoc,"refresh_soc",1); |
#$$refresh_soc->clicked; |
|
}); |
1526,10 → 1551,10
######### |
|
sub gen_tiles{ |
my ($mpsoc,$soc_state)=@_; |
my ($mpsoc)=@_; |
|
my $nx= $mpsoc->mpsoc_get_param("NX"); |
my $ny= $mpsoc->mpsoc_get_param("NY"); |
my $nx= $mpsoc->object_get_attribute('noc_param',"NX"); |
my $ny= $mpsoc->object_get_attribute('noc_param',"NY"); |
|
#print "($nx,$ny);\n"; |
my $table=def_table($nx,$ny,FALSE);# my ($row,$col,$homogeneous)=@_; |
1545,7 → 1570,7
for (my $y=0;$y<$ny;$y++){ |
for (my $x=0; $x<$nx;$x++){ |
my $tile_num=($nx*$y)+ $x; |
my $tile=get_tile($mpsoc,$soc_state,$tile_num,$x,$y); |
my $tile=get_tile($mpsoc,$tile_num,$x,$y); |
#print "($x,$y);\n"; |
$table->attach_defaults ($tile, $x, $x+1 , $y, $y+1); |
|
1572,9 → 1597,9
#my $soc = soc->soc_new(); |
|
my $mpsoc= mpsoc->mpsoc_new(); |
#my $soc= eval { do 'lib/soc/soc.SOC' }; |
|
my $soc_state= def_state("ideal"); |
set_gui_status($mpsoc,"ideal",0); |
|
# main window |
#my $window = def_win_size(1000,800,"Top"); |
# The main table containg the lib tree, selected modules and info section |
1587,8 → 1612,8
my $refresh = Gtk2::Button->new_from_stock('ref'); |
|
|
my $noc_conf_box=noc_config ($mpsoc,$soc_state); |
my $noc_tiles=gen_tiles($mpsoc,$soc_state); |
my $noc_conf_box=get_config ($mpsoc,$info); |
my $noc_tiles=gen_tiles($mpsoc); |
|
|
|
1595,49 → 1620,44
$main_table->set_row_spacings (4); |
$main_table->set_col_spacings (1); |
|
#my $device_win=show_active_dev($soc,$soc,$infc,$soc_state,\$refresh,$info); |
#my $device_win=show_active_dev($soc,$soc,$infc,\$refresh,$info); |
|
|
my $generate = def_image_button('icons/gen.png','Generate'); |
my $genbox=def_hbox(TRUE,0); |
$genbox->pack_start($generate, FALSE, FALSE,0); |
|
|
|
|
my $open = def_image_button('icons/browse.png','Load MPSoC'); |
my $openbox=def_hbox(TRUE,0); |
$openbox->pack_start($open, FALSE, FALSE,0); |
|
|
my $entry=gen_entry_object($mpsoc,'soc_name',undef,undef,undef,undef); |
my $entrybox=labele_widget_info(" MPSoC name:",$entry); |
|
my ($entrybox,$entry) = def_h_labeled_entry('MPSoC name:'); |
$entry->signal_connect( 'changed'=> sub{ |
my $name=$entry->get_text(); |
$mpsoc->mpsoc_set_mpsoc_name($name); |
}); |
|
|
#$table->attach_defaults ($event_box, $col, $col+1, $row, $row+1); |
$main_table->attach_defaults ($noc_conf_box , 0, 4, 0, 23); |
$main_table->attach_defaults ($noc_tiles , 4, 12, 0, 23); |
$main_table->attach_defaults ($infobox , 0, 12, 23,24); |
$main_table->attach_defaults ($openbox,0, 3, 24,25); |
$main_table->attach_defaults ($noc_conf_box , 0, 4, 0, 22); |
$main_table->attach_defaults ($noc_tiles , 4, 12, 0, 22); |
$main_table->attach_defaults ($infobox , 0, 12, 22,24); |
$main_table->attach ($open,0, 3, 24,25,'expand','shrink',2,2); |
$main_table->attach_defaults ($entrybox,3, 7, 24,25); |
|
$main_table->attach_defaults ($genbox, 10, 12, 24,25); |
$main_table->attach ($generate, 10, 12, 24,25,'expand','shrink',2,2); |
|
|
#referesh the mpsoc generator |
$refresh-> signal_connect("clicked" => sub{ |
$noc_conf_box->destroy(); |
$noc_conf_box=noc_config ($mpsoc,$soc_state); |
$main_table->attach_defaults ($noc_conf_box , 0, 4, 0, 23); |
$noc_conf_box=get_config ($mpsoc,$info); |
$main_table->attach_defaults ($noc_conf_box , 0, 4, 0, 22); |
$noc_conf_box->show_all(); |
|
|
|
$noc_tiles->destroy(); |
$noc_tiles=gen_tiles($mpsoc,$soc_state); |
$main_table->attach_defaults ($noc_tiles , 4, 12, 0, 23); |
$noc_tiles=gen_tiles($mpsoc); |
$main_table->attach_defaults ($noc_tiles , 4, 12, 0, 22); |
|
$main_table->show_all(); |
|
1648,19 → 1668,20
|
#check soc status every 0.5 second. referesh device table if there is any changes |
Glib::Timeout->add (100, sub{ |
|
my ($state,$timeout)= get_state($soc_state); |
my ($state,$timeout)= get_gui_status($mpsoc); |
|
|
if ($timeout>0){ |
$timeout--; |
set_state($soc_state,$state,$timeout); |
set_gui_status($mpsoc,$state,$timeout); |
} |
elsif( $state ne "ideal" ){ |
$refresh->clicked; |
my $saved_name=$mpsoc->mpsoc_get_mpsoc_name(); |
my $saved_name=$mpsoc->object_get_attribute('mpsoc_name'); |
if(defined $saved_name) {$entry->set_text($saved_name);} |
set_state($soc_state,"ideal",0); |
set_gui_status($mpsoc,"ideal",0); |
|
|
} |
return TRUE; |
|
1679,8 → 1700,8
# }); |
|
$open-> signal_connect("clicked" => sub{ |
set_state($soc_state,"ref",5); |
load_mpsoc($mpsoc,$soc_state); |
set_gui_status($mpsoc,"ref",5); |
load_mpsoc($mpsoc,$info); |
|
}); |
|
1708,7 → 1729,7
############# |
|
sub load_mpsoc{ |
my ($mpsoc,$soc_state)=@_; |
my ($mpsoc,$info)=@_; |
my $file; |
my $dialog = Gtk2::FileChooserDialog->new( |
'Select a File', undef, |
1730,8 → 1751,16
my ($name,$path,$suffix) = fileparse("$file",qr"\..[^.]*$"); |
if($suffix eq '.MPSOC'){ |
my $pp= eval { do $file }; |
if ($@ || !defined $pp){ |
show_info(\$info,"**Error reading $file file: $@\n"); |
$dialog->destroy; |
return; |
} |
|
|
clone_obj($mpsoc,$pp); |
set_state($soc_state,"load_file",0); |
set_gui_status($mpsoc,"load_file",0); |
|
} |
} |
$dialog->destroy; |
1748,7 → 1777,8
sub copy_noc_files{ |
my ($project_dir,$dest)=@_; |
|
my @noc_files=('/mpsoc/src_noc/arbiter.v', |
my @noc_files=( |
'/mpsoc/src_noc/arbiter.v', |
'/mpsoc/src_noc/baseline.v', |
'/mpsoc/src_noc/canonical_credit_count.v', |
'/mpsoc/src_noc/class_table.v', |
1769,7 → 1799,8
'/mpsoc/src_noc/router.v', |
'/mpsoc/src_noc/route_torus.v', |
'/mpsoc/src_noc/routing.v', |
'/mpsoc/src_noc/vc_alloc_request_gen.v'); |
'/mpsoc/src_noc/vc_alloc_request_gen.v', |
'/mpsoc/src_noc/ss_allocator.v'); |
foreach my $f (@noc_files){ |
copy ("$project_dir$f",$dest); |
|
/mpsoc_verilog_gen.pl
13,7 → 13,7
|
sub mpsoc_generate_verilog{ |
my $mpsoc=shift; |
my $mpsoc_name=$mpsoc->mpsoc_get_mpsoc_name(); |
my $mpsoc_name=$mpsoc->object_get_attribute('mpsoc_name'); |
my $io_v="\tclk,\n\treset"; |
my $io_def_v=" |
//IO |
24,7 → 24,7
my $socs_param= gen_socs_param($mpsoc); |
|
#generate noc_parameter |
my $noc_param=gen_noc_param_v($mpsoc); |
my ($noc_param,$pass_param)=gen_noc_param_v($mpsoc); |
|
#generate the noc |
my $noc_v=gen_noc_v(); |
70,7 → 70,7
|
|
localparam Fw = 2+V+Fpay, |
NC = NX*NY, //flit width; |
NC = (TOPOLOGY=="RING")? NX : NX*NY, //number of cores |
Xw = log2(NX), |
Yw = log2(NY) , |
Cw = (C>1)? log2(C): 1, |
90,8 → 90,8
my $mpsoc=shift; |
my $socs_param=" |
//SOC parameters\n"; |
my $nx= $mpsoc->mpsoc_get_param("NX"); |
my $ny= $mpsoc->mpsoc_get_param("NY"); |
my $nx= $mpsoc->object_get_attribute('noc_param',"NX"); |
my $ny= $mpsoc->object_get_attribute('noc_param',"NY"); |
my $processors_en=0; |
for (my $y=0;$y<$ny;$y++){ |
for (my $x=0; $x<$nx;$x++){ |
132,14 → 132,16
sub gen_noc_param_v{ |
my $mpsoc=shift; |
my $param_v="\n\n//NoC parameters\n"; |
my @params=$mpsoc->mpsoc_get_param_order(); |
my $pass_param; |
my @params=$mpsoc->object_get_attribute_order('noc_param'); |
foreach my $p (@params){ |
my $val=$mpsoc->mpsoc_get_param($p); |
my $val=$mpsoc->object_get_attribute('noc_param',$p); |
add_text_to_string (\$param_v,"\tlocalparam $p=$val;\n"); |
#print "$p\n"; |
add_text_to_string (\$pass_param,".$p($p),\n"); |
#print "$p:$val\n"; |
|
} |
my $class=$mpsoc->mpsoc_get_param("C"); |
my $class=$mpsoc->object_get_attribute('noc_param',"C"); |
my $str; |
if( $class > 1){ |
$str="CLASS_SETTING={"; |
150,17 → 152,21
$str="CLASS_SETTING={V{1\'b1}};\n"; |
} |
add_text_to_string (\$param_v,"\tlocalparam $str"); |
my $v=$mpsoc->mpsoc_get_param("V")-1; |
my $escape=$mpsoc->mpsoc_get_param("ESCAP_VC_MASK"); |
add_text_to_string (\$param_v,"\tlocalparam [$v :0] ESCAP_VC_MASK=1;\n") if (! defined $escape); |
add_text_to_string (\$pass_param,".CLASS_SETTING(CLASS_SETTING),\n"); |
my $v=$mpsoc->object_get_attribute('noc_param',"V")-1; |
my $escape=$mpsoc->object_get_attribute('noc_param',"ESCAP_VC_MASK"); |
if (! defined $escape){ |
add_text_to_string (\$param_v,"\tlocalparam [$v :0] ESCAP_VC_MASK=1;\n"); |
add_text_to_string (\$pass_param,".ESCAP_VC_MASK(ESCAP_VC_MASK),\n"); |
} |
add_text_to_string (\$param_v," \tlocalparam CVw=(C==0)? V : C * V;\n"); |
add_text_to_string (\$pass_param,".CVw(CVw)\n"); |
|
|
return ($param_v,$pass_param); |
|
return $param_v; |
|
|
|
} |
|
|
334,8 → 340,8
|
my $socs_v; |
|
my $nx= $mpsoc->mpsoc_get_param("NX"); |
my $ny= $mpsoc->mpsoc_get_param("NY"); |
my $nx= $mpsoc->object_get_attribute('noc_param',"NX"); |
my $ny= $mpsoc->object_get_attribute('noc_param',"NY"); |
my $processors_en=0; |
for (my $y=0;$y<$ny;$y++){ |
for (my $x=0; $x<$nx;$x++){ |
383,8 → 389,8
my ($mpsoc,$soc_name,$tile_num,$x,$y,$soc_num,$io_v_ref,$io_def_v)=@_; |
my $soc_v; |
my $processor_en=0; |
my $xw= log2($mpsoc->mpsoc_get_param("NX")); |
my $yw= log2($mpsoc->mpsoc_get_param("NY")); |
my $xw= log2($mpsoc->object_get_attribute('noc_param',"NX")); |
my $yw= log2($mpsoc->object_get_attribute('noc_param',"NY")); |
$soc_v="\n\n // Tile:$tile_num (x=$x,y=$y)\n \t$soc_name #(\n"; |
|
# core id |
416,6 → 422,18
my @intfcs=$top->top_get_intfc_list(); |
|
my $i=0; |
|
my $dir = Cwd::getcwd(); |
my $mpsoc_name=$mpsoc->object_get_attribute('mpsoc_name'); |
my $project_dir = abs_path("$dir/../../"); |
my $target_dir = "$project_dir/mpsoc_work/MPSOC/$mpsoc_name"; |
my $soc_file="$target_dir/src_verilog/tiles/$soc_name.v"; |
|
my $vdb =read_file($soc_file); |
|
my %soc_localparam = $vdb->get_modules_parameters($soc_name); |
|
|
foreach my $intfc (@intfcs){ |
|
# ni intfc |
477,6 → 495,19
foreach my $p (@ports){ |
my($inst,$range,$type,$intfc_name,$intfc_port)= $top->top_get_port($p); |
my $io_port="${soc_name}_${soc_num}_${p}"; |
#resolve range parameter |
if (defined $range ){ |
my @a= split (/\b/,$range); |
foreach my $l (@a){ |
#if defined in parameter list ignore it |
next if(defined $params{$l}); |
($range=$range)=~ s/\b$l\b/$soc_localparam{$l}/g if(defined $soc_localparam{$l}); |
#else s |
|
#print "$l\n"; |
} |
|
} |
#io name |
add_text_to_string($io_v_ref,",\n\t$io_port"); |
#io definition |
517,7 → 548,7
sub log2{ |
my $num=shift; |
my $log=0; |
while( (1<<$log) < $num) { |
while( (1<< $log) < $num) { |
$log++; |
} |
return $log; |
524,4 → 555,103
} |
|
|
|
sub gen_emulate_top_v{ |
my $emulate=shift; |
my ($localparam, $pass_param)=gen_noc_param_v( $emulate); |
my $top_v=" |
|
module emulator_top ( |
output [0:0]LEDR, |
output [0:0]LEDG, |
input [0:0]KEY, |
input CLOCK_50 |
); |
|
|
|
|
$localparam |
|
|
wire reset_in,jtag_reset,reset,reset_sync; |
|
assign reset_in = ~KEY[0]; |
assign LEDG[0] = reset; |
assign reset = (jtag_reset | reset_in); |
wire done; |
reg[31:0]time_cnt; |
|
// a reset source which can be controled using jtag |
jtag_source_probe #( |
.VJTAG_INDEX(127), |
.Dw(1) //source/probe width in bits |
)the_reset( |
.probe(done), |
.source(jtag_reset) |
); |
|
altera_reset_synchronizer rst_sync |
( |
.reset_in(reset), |
.clk(CLOCK_50), |
.reset_out(reset_sync) |
); |
|
|
|
noc_emulator #( |
$pass_param |
|
// simulation |
// parameter MAX_PCK_NUM=2560000, |
// parameter MAX_SIM_CLKs=1000000, |
// parameter MAX_PCK_SIZ=10, |
// parameter TIMSTMP_FIFO_NUM=16 |
) |
emulate_top |
( |
.reset(reset_sync), |
.clk(CLOCK_50), |
.done(done) |
); |
|
|
jtag_source_probe #( |
.VJTAG_INDEX(126), |
.Dw(32) //source/probe width in bits |
|
|
) |
src_pb |
( |
.probe(time_cnt), |
.source() |
); |
|
|
always @(posedge CLOCK_50 or posedge reset)begin |
if(reset) begin |
time_cnt<=0; |
end else begin |
if(!done) time_cnt<=time_cnt+1; |
end |
end |
|
|
assign LEDR[0]=done; |
|
|
endmodule |
|
|
"; |
return $top_v; |
|
|
|
|
} |
|
|
1 |
/readme_gen.pl
0,0 → 1,69
#! /usr/bin/perl -w |
|
|
|
sub get_license_header { |
my $file_name=shift; |
|
my $head=" |
/********************************************************************** |
** File: $file_name |
** |
** Copyright (C) 2014-2016 Alireza Monemi |
** |
** This file is part of ProNoC $ProNOC::VERSION |
** |
** ProNoC ( stands for Prototype Network-on-chip) is free software: |
** you can redistribute it and/or modify it under the terms of the GNU |
** Lesser General Public License as published by the Free Software Foundation, |
** either version 3 of the License, or (at your option) any later version. |
** |
** ProNoC is distributed in the hope that it will be useful, but WITHOUT |
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General |
** Public License for more details. |
** |
** You should have received a copy of the GNU Lesser General Public |
** License along with AEMB. If not, see <http:**www.gnu.org/licenses/>. |
******************************************************************************/ |
"; |
|
|
return $head; |
|
} |
|
|
sub autogen_warning { |
|
my $string =" |
/************************************************************************** |
** WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE |
** OVERWRITTEN AND LOST. Rename this file if you wish to do any modification. |
****************************************************************************/\n\n"; |
|
return $string; |
|
|
} |
|
|
sub perl_file_header { |
my $file_name=shift; |
my $head="####################################################################### |
## File: $file_name |
## |
## Copyright (C) 2014-2016 Alireza Monemi |
## |
## This file is part of ProNoC $ProNOC::VERSION |
## |
## WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT |
## MAY CAUSE UNEXPECTED BEHAIVOR. |
################################################################################ |
|
"; |
return $head; |
} |
|
|
1; |
readme_gen.pl
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: rvp.pm
===================================================================
--- rvp.pm (revision 24)
+++ rvp.pm (revision 25)
@@ -242,7 +242,7 @@
}
}
}
- $self->_add_warning("$file:$line: Could not find module $m");
+ #$self->_add_warning("$file:$line: Could not find module $m");
}
return $self;
}
Index: soc.pm
===================================================================
--- soc.pm (revision 24)
+++ soc.pm (revision 25)
@@ -235,17 +235,7 @@
return ($type,$value,$connection_num);
}
-sub soc_set_soc_name{
- my ($self,$name)=@_;
- if(defined $name){$self->{soc_name}=$name;}
-}
-sub soc_get_soc_name{
- my ($self)=@_;
- my $name;
- if(exists $self->{soc_name}){ $name=$self->{soc_name};}
- return $name;
-}
@@ -252,6 +242,8 @@
+
+
sub soc_add_instance_plug_conection{
my ($self,$instance_id,$plug,$plug_num,$id,$socket,$num)=@_;
@@ -637,4 +629,52 @@
}
+
+
+
+
+
+
+
+
+
+sub object_add_attribute{
+ my ($self,$attribute1,$attribute2,$value)=@_;
+ if(!defined $attribute2){$self->{$attribute1}=$value;}
+ else {$self->{$attribute1}{$attribute2}=$value;}
+
+}
+
+sub object_get_attribute{
+ my ($self,$attribute1,$attribute2)=@_;
+ if(!defined $attribute2) {return $self->{$attribute1};}
+ return $self->{$attribute1}{$attribute2};
+
+
+}
+
+sub object_add_attribute_order{
+ my ($self,$attribute,@param)=@_;
+ $self->{'parameters_order'}{$attribute}=[] if (!defined $self->{parameters_order}{$attribute});
+ foreach my $p (@param){
+ push (@{$self->{parameters_order}{$attribute}},$p);
+
+ }
+}
+
+sub object_get_attribute_order{
+ my ($self,$attribute)=@_;
+ return @{$self->{parameters_order}{$attribute}};
+}
+
+
+
+
+
+
+
+
+
+
+
1
/soc_gen.pl
29,7 → 29,7
|
require "widget.pl"; |
require "verilog_gen.pl"; |
|
require "readme_gen.pl"; |
require "hdr_file_gen.pl"; |
|
|
65,7 → 65,7
# add_module_to_soc |
############### |
sub add_module_to_soc{ |
my ($soc,$ip,$category,$module,$info,$soc_state)=@_; |
my ($soc,$ip,$category,$module,$info)=@_; |
my ($instance_id,$id)= get_instance_id($soc,$category,$module); |
|
#add module instanance |
78,12 → 78,12
} |
$soc->soc_add_instance_order($instance_id); |
|
# Read deafult parameter from lib and add them to soc |
# Read default parameter from lib and add them to soc |
my %param_default= $ip->get_param_default($category,$module); |
|
my $rr=$soc->soc_add_instance_param($instance_id,\%param_default); |
if($rr == 0){ |
my $info_text= "Failed to add deafualt parameter to \"$instance_id\". $instance_id does not exist exist."; |
my $info_text= "Failed to add defualt parameter to \"$instance_id\". $instance_id does not exist exist."; |
show_info($info,$info_text); |
return; |
} |
90,7 → 90,7
my @r=$ip->ip_get_param_order($category,$module); |
$soc->soc_add_instance_param_order($instance_id,\@r); |
|
get_module_parameter($soc,$ip,$instance_id,$soc_state); |
get_module_parameter($soc,$ip,$instance_id); |
|
|
|
99,10 → 99,10
# remove_instance_from_soc |
################ |
sub remove_instance_from_soc{ |
my ($soc,$instance_id,$soc_state)=@_; |
my ($soc,$instance_id)=@_; |
$soc->soc_remove_instance($instance_id); |
$soc->soc_remove_from_instance_order($instance_id); |
set_state($soc_state,"refresh_soc",0); |
set_gui_status($soc,"refresh_soc",0); |
} |
|
|
112,12 → 112,12
############## |
|
sub get_module_parameter{ |
my ($soc,$ip,$instance_id,$soc_state)=@_; |
my ($soc,$ip,$instance_id)=@_; |
|
#read module parameters from lib |
my $module=$soc->soc_get_module($instance_id); |
my $category=$soc->soc_get_category($instance_id); |
my @parameters=$ip->ip_get_module_parameters($category,$module); |
my @parameters=$ip->ip_get_param_order($category,$module); |
my $param_num = @parameters; |
|
#read soc parameters |
125,8 → 125,9
my %new_param_value=%param_value; |
#gui |
my $table_size = ($param_num<10) ? 10 : $param_num; |
my $window = def_popwin_size(600,400,"Parameter setting for $module "); |
my $table = def_table($table_size, 7, TRUE); |
my($width,$hight)=max_win_size(); |
my $window = def_popwin_size(.6*$width,.6*$hight, "Parameter setting for $module "); |
my $table = def_table($table_size, 7, FALSE); |
|
my $scrolled_win = new Gtk2::ScrolledWindow (undef, undef); |
$scrolled_win->set_policy( "automatic", "automatic" ); |
134,16 → 135,20
my $row=0; |
|
my $ok = def_image_button('icons/select.png','OK'); |
my $okbox=def_hbox(TRUE,0); |
$okbox->pack_start($ok, FALSE, FALSE,0); |
|
|
$table->attach (gen_label_in_center("Parameter name"),0, 3, $row, $row+1,'expand','shrink',2,2); |
$table->attach (gen_label_in_center("Value"),3, 6, $row, $row+1,'expand','shrink',2,2); |
$table->attach (gen_label_in_center("Description"),6, 7, $row, $row+1,'expand','shrink',2,2); |
$row++; |
foreach my $p (@parameters){ |
my ($deafult,$type,$content,$info)= $ip->ip_get_parameter($category,$module,$p); |
my ($default,$type,$content,$info)= $ip->ip_get_parameter($category,$module,$p); |
|
my $value=$param_value{$p}; |
|
if ($type eq "Entry"){ |
my $entry=gen_entry($value); |
$table->attach_defaults ($entry, 3, 6, $row, $row+1); |
$table->attach ($entry, 3, 6, $row, $row+1,'expand','shrink',2,2); |
$entry-> signal_connect("changed" => sub{$new_param_value{$p}=$entry->get_text();}); |
} |
elsif ($type eq "Combo-box"){ |
150,7 → 155,7
my @combo_list=split(",",$content); |
my $pos=get_item_pos($value, @combo_list); |
my $combo=gen_combo(\@combo_list, $pos); |
$table->attach_defaults ($combo, 3, 6, $row, $row+1); |
$table->attach ($combo, 3, 6, $row, $row+1,'expand','shrink',2,2); |
$combo-> signal_connect("changed" => sub{$new_param_value{$p}=$combo->get_active_text();}); |
|
} |
162,7 → 167,7
$step=~ s/\D//g; |
my $spin=gen_spin($min,$max,$step); |
$spin->set_value($value); |
$table->attach_defaults ($spin, 3, 4, $row, $row+1); |
$table->attach ($spin, 3, 4, $row, $row+1,'expand','shrink',2,2); |
$spin-> signal_connect("value_changed" => sub{ $new_param_value{$p}=$spin->get_value_as_int(); }); |
|
# $box=def_label_spin_help_box ($param,$info, $value,$min,$max,$step, 2); |
169,7 → 174,7
} |
if (defined $info && $type ne "Fixed"){ |
my $info_button=def_image_button('icons/help.png'); |
$table->attach_defaults ($info_button, 6, 7, $row, $row+1); |
$table->attach ($info_button, 6, 7, $row, $row+1,'expand','shrink',2,2); |
$info_button->signal_connect('clicked'=>sub{ |
message_dialog($info); |
|
179,17 → 184,22
if ($type ne "Fixed"){ |
#print "$p:val:$value\n"; |
my $label =gen_label_in_center($p); |
$table->attach_defaults ($label, 0, 3, $row, $row+1); |
$table->attach ($label, 0, 3, $row, $row+1,'expand','shrink',2,2); |
$row++; |
} |
|
|
|
} |
#if ($row== 0){ |
#my $label =gen_label_in_left("The $module IP does not have any adjatable parameter"); |
# $table->attach ($label, 0, 7, $row, $row+1,'expand','shrink',2,2); |
|
#} |
|
my $mtable = def_table(10, 1, TRUE); |
my $mtable = def_table(10, 1, FALSE); |
|
$mtable->attach_defaults($scrolled_win,0,1,0,9); |
$mtable->attach_defaults($okbox,0,1,9,10); |
$mtable->attach($ok,0,1,9,10,'expand','shrink',2,2); |
|
$window->add ($mtable); |
$window->show_all(); |
227,7 → 237,7
}#plugs |
|
|
set_state($soc_state,"refresh_soc",0); |
set_gui_status($soc,"refresh_soc",0); |
#$$refresh_soc->clicked; |
|
}); |
313,9 → 323,9
# gen_dev_box |
############## |
|
sub gen_instance{; |
#my ($soc,$ip,$infc,$instance_id,$soc_state,$info)=@_; |
my ($soc,$ip,$infc,$instance_id,$soc_state,$info,$table,$offset)=@_; |
sub gen_instance{ |
#my ($soc,$ip,$infc,$instance_id,$info)=@_; |
my ($soc,$ip,$infc,$instance_id,$info,$table,$offset)=@_; |
|
|
|
339,12 → 349,12
$box1->pack_start($param_button, FALSE, FALSE,3); |
$table->attach_defaults ($box1 ,0,1,$offset+1,$offset+2); |
$param_button->signal_connect (clicked => sub{ |
get_module_parameter($soc,$ip,$instance_id,$soc_state); |
get_module_parameter($soc,$ip,$instance_id); |
|
}); |
$up->signal_connect (clicked => sub{ |
$soc->soc_decrease_instance_order($instance_id); |
set_state($soc_state,"refresh_soc",0); |
set_gui_status($soc,"refresh_soc",0); |
|
}); |
|
358,12 → 368,12
$box2->pack_start($cancel_button, FALSE, FALSE,3); |
$table->attach_defaults ($box2,0,1,$offset+2,$offset+3); |
$cancel_button->signal_connect (clicked => sub{ |
remove_instance_from_soc($soc,$instance_id,$soc_state); |
remove_instance_from_soc($soc,$instance_id); |
|
}); |
$dwn->signal_connect (clicked => sub{ |
$soc->soc_increase_instance_order($instance_id); |
set_state($soc_state,"refresh_soc",0); |
set_gui_status($soc,"refresh_soc",0); |
|
}); |
|
390,7 → 400,7
#add instance name to soc |
$soc->soc_set_instance_name($instance_id,$instance_name); |
|
set_state($soc_state,"refresh_soc",25); |
set_gui_status($soc,"refresh_soc",25); |
|
} |
}); |
547,7 → 557,7
|
|
|
set_state($soc_state,"refresh_soc",0); |
set_gui_status($soc,"refresh_soc",0); |
},\@ll); |
|
|
591,7 → 601,7
# generate_dev_table |
############ |
sub generate_dev_table{ |
my($soc,$ip,$infc,$soc_state,$info)=@_; |
my($soc,$ip,$infc,$info)=@_; |
#my $box= def_hbox (TRUE,0); |
|
my $table=def_table(3,25,FALSE); |
603,7 → 613,7
my $i=0; |
|
foreach my $instanc(@instance_list){ |
$row=gen_instance($soc,$ip,$infc,$instanc,$soc_state,$info,$table,$row); |
$row=gen_instance($soc,$ip,$infc,$instanc,$info,$table,$row); |
|
} |
if($row<20){for ($i=$row; $i<20; $i++){ |
624,9 → 634,9
################ |
|
sub show_active_dev{ |
my($soc,$ip,$infc,$soc_state,$refresh_ref,$info)=@_; |
my($soc,$ip,$infc,$refresh_ref,$info)=@_; |
my $box= def_table (1, 1, FALSE); |
my $dev_table = generate_dev_table($soc,$ip,$infc,$soc_state,$info); |
my $dev_table = generate_dev_table($soc,$ip,$infc,$info); |
my $scrolled_win = new Gtk2::ScrolledWindow (undef, undef); |
$scrolled_win->set_policy( "automatic", "automatic" ); |
$scrolled_win->add_with_viewport($dev_table); |
637,7 → 647,7
|
$dev_table->destroy; |
select(undef, undef, undef, 0.1); #wait 10 ms |
$dev_table = generate_dev_table($soc,$ip,$infc,$soc_state,$info); |
$dev_table = generate_dev_table($soc,$ip,$infc,$info); |
#$box->attach_defaults ($dev_table, 0, 1, 0, 1);#( $dev_table, FALSE, FALSE, 3); |
$scrolled_win->add_with_viewport($dev_table); |
$dev_table->show; |
682,7 → 692,7
# create tree |
############## |
sub create_tree { |
my ($info,$ip,$soc,$soc_state)=@_; |
my ($info,$ip,$soc)=@_; |
my $model = Gtk2::TreeStore->new ('Glib::String', 'Glib::String', 'Glib::Scalar', 'Glib::Boolean'); |
my $tree_view = Gtk2::TreeView->new; |
$tree_view->set_model ($model); |
689,7 → 699,7
my $selection = $tree_view->get_selection; |
|
$selection->set_mode ('browse'); |
$tree_view->set_size_request (200, -1); |
#$tree_view->set_size_request (200, -1); |
|
# |
# this code only supports 1 level of children. If we |
733,7 → 743,7
my $cell = Gtk2::CellRendererText->new; |
$cell->set ('style' => 'italic'); |
my $column = Gtk2::TreeViewColumn->new_with_attributes |
("Double click to add the device", |
("IP list", |
$cell, |
'text' => DISPLAY_COLUMN, |
'style_set' => ITALIC_COLUMN); |
772,8 → 782,8
|
if($module){ |
#print "$module is selected via row activaton!\n"; |
add_module_to_soc($soc,$ip,$category,$module,\$info,$soc_state); |
set_state($soc_state,"refresh_soc",0); |
add_module_to_soc($soc,$ip,$category,$module,\$info); |
set_gui_status($soc,"refresh_soc",0); |
} |
|
|
792,7 → 802,7
$scrolled_window->set_shadow_type ('in'); |
$scrolled_window->add($tree_view); |
|
my $hbox = Gtk2::HBox->new (TRUE, 0); |
my $hbox = Gtk2::HBox->new (FALSE, 0); |
$hbox->pack_start ( $scrolled_window, TRUE, TRUE, 0); |
|
|
844,7 → 854,7
|
sub generate_soc{ |
my ($soc,$info)=@_; |
my $name=$soc->soc_get_soc_name(); |
my $name=$soc->object_get_attribute('soc_name'); |
if (length($name)>0){ |
my @tmp=split('_',$name); |
if ( $tmp[-1] =~ /^[0-9]+$/ ){ |
852,10 → 862,11
return 0; |
} |
|
my $file_v=soc_generate_verilog($soc); |
my ($file_v,$top_v,$readme)=soc_generate_verilog($soc); |
|
# Write object file |
open(FILE, ">lib/soc/$name.SOC") || die "Can not open: $!"; |
print FILE perl_file_header("$name.SOC"); |
print FILE Data::Dumper->Dump([\%$soc],[$name]); |
close(FILE) || die "Error closing file: $!"; |
|
864,25 → 875,39
print FILE $file_v; |
close(FILE) || die "Error closing file: $!"; |
|
# Write Top module file |
my $l=autogen_warning().get_license_header("${name}_top.v"); |
open(FILE, ">lib/verilog/${name}_top.v") || die "Can not open: $!"; |
print FILE "$l\n$top_v"; |
close(FILE) || die "Error closing file: $!"; |
|
|
# Write readme file |
open(FILE, ">lib/verilog/README") || die "Can not open: $!"; |
print FILE $readme; |
close(FILE) || die "Error closing file: $!"; |
|
|
# copy all files in project work directory |
my $dir = Cwd::getcwd(); |
#make target dir |
my $project_dir = abs_path("$dir/../../"); |
my $target_dir = "$project_dir/mpsoc_work/SOC/$name"; |
mkpath("$target_dir/src_verilog/lib/",1,0755); |
mkpath("$target_dir/sw",1,0755); |
mkpath("$target_dir/src_verilog/lib/",1,01777); |
mkpath("$target_dir/sw",1,01777); |
|
#copy hdl codes in src_verilog |
|
my ($file_ref,$warnings)= get_all_files_list($soc,"hdl_files"); |
copy_file_and_folders($file_ref,$project_dir,"$target_dir/src_verilog/lib"); |
|
copy_file_and_folders($file_ref,$project_dir,"$target_dir/src_verilog/lib"); |
|
show_info(\$info,$warnings) if(defined $warnings); |
|
|
#copy jtag control files |
my @jtags=(("/mpsoc/src_peripheral/jtag/jtag_wb"),("jtag")); |
copy_file_and_folders(\@jtags,$project_dir,"$target_dir/src_verilog/lib"); |
|
#my @pathes=("$dir/../src_peripheral","$dir/../src_noc","$dir/../src_processor"); |
#foreach my $p(@pathes){ |
# find( |
895,27 → 920,20
#} |
|
|
move ("$dir/lib/verilog/$name.v","$target_dir/src_verilog/"); |
move ("$dir/lib/verilog/$name.v","$target_dir/src_verilog/"); |
move ("$dir/lib/verilog/${name}_top.v","$target_dir/src_verilog/"); |
move ("$dir/lib/verilog/README" ,"$target_dir/sw/"); |
# Copy Software files |
($file_ref,$warnings)= get_all_files_list($soc,"sw_files"); |
copy_file_and_folders($file_ref,$project_dir,"$target_dir/sw"); |
|
|
|
# Write system.h and generated file |
# Write system.h and Software gen files |
generate_header_file($soc,$project_dir,$target_dir,$dir); |
|
|
# Write Software files |
($file_ref,$warnings)= get_all_files_list($soc,"sw_files"); |
copy_file_and_folders($file_ref,$project_dir,"$target_dir/sw"); |
|
# Write Software gen files |
($file_ref,$warnings)= get_all_files_list($soc,"gen_sw_files"); |
foreach my $f(@{$file_ref}){ |
#print "$f\n"; |
|
|
|
} |
|
|
# Write main.c file if not exist |
my $n="$target_dir/sw/main.c"; |
if (!(-f "$n")) { |
952,7 → 970,7
|
while (num>0){ |
num--; |
asm volatile (\"nop\"); |
nop(); // asm volatile (\"nop\"); |
} |
return; |
|
1031,7 → 1049,7
|
|
my $window = def_popwin_size(1200,500,"Wishbone slave port address setting"); |
my $table = def_table(10, 6, TRUE); |
my $table = def_table(10, 6, FALSE); |
|
my $scrolled_win = new Gtk2::ScrolledWindow (undef, undef); |
$scrolled_win->set_policy( "automatic", "automatic" ); |
1039,12 → 1057,12
my $row=0; |
|
#title |
$table->attach_defaults(gen_label_in_left ("Instance name"),0,1,$row,$row+1); |
$table->attach_defaults(gen_label_in_left ("Interface name"),1,2,$row,$row+1); |
$table->attach_defaults(gen_label_in_left ("Bus name"),2,3,$row,$row+1); |
$table->attach_defaults(gen_label_in_center("Base address"),3,4,$row,$row+1); |
$table->attach_defaults(gen_label_in_center("End address"),4,5,$row,$row+1); |
$table->attach_defaults(gen_label_in_center("Size (Bytes)"),5,6,$row,$row+1); |
$table->attach(gen_label_in_left ("Instance name"),0,1,$row,$row+1,'expand','shrink',2,2); |
$table->attach(gen_label_in_left ("Interface name"),1,2,$row,$row+1,'expand','shrink',2,2); |
$table->attach(gen_label_in_left ("Bus name"),2,3,$row,$row+1,'expand','shrink',2,2); |
$table->attach(gen_label_in_center("Base address"),3,4,$row,$row+1,'expand','shrink',2,2); |
$table->attach(gen_label_in_center("End address"),4,5,$row,$row+1,'expand','shrink',2,2); |
$table->attach(gen_label_in_center("Size (Bytes)"),5,6,$row,$row+1,'expand','shrink',2,2); |
|
my (@newbase,@newend,@connects); |
|
1094,14 → 1112,14
$status_all[$number]=$valid; |
|
|
$table->attach_defaults($label1,0,1,$row,$row+1); |
$table->attach_defaults($plug_name,1,2,$row,$row+1); |
$table->attach_defaults($label2,2,3,$row,$row+1); |
$table->attach_defaults($entry1,3,4,$row,$row+1); |
$table->attach_defaults($entry2,4,5,$row,$row+1); |
$table->attach($label1,0,1,$row,$row+1,'expand','shrink',2,2); |
$table->attach($plug_name,1,2,$row,$row+1,'expand','shrink',2,2); |
$table->attach($label2,2,3,$row,$row+1,'expand','shrink',2,2); |
$table->attach($entry1,3,4,$row,$row+1,'expand','shrink',2,2); |
$table->attach($entry2,4,5,$row,$row+1,'expand','shrink',2,2); |
|
|
$table->attach_defaults($box,5,7,$row,$row+1); |
$table->attach($box,5,7,$row,$row+1,'expand','shrink',2,2); |
|
|
$entry1->signal_connect('changed'=>sub{ |
1112,7 → 1130,7
$box->destroy; |
($box,$valid)=addr_box_gen($base_in, $end_in,\@newbase,\@newend,\@connects,$number); |
$status_all[$number]=$valid; |
$table->attach_defaults($box,5,7,$number+1,$number+2); |
$table->attach($box,5,7,$number+1,$number+2,'expand','shrink',2,2); |
$table->show_all; |
|
|
1125,7 → 1143,7
$box->destroy; |
($box,$valid)=addr_box_gen($base_in, $end_in,\@newbase,\@newend,\@connects,$number); |
$status_all[$number]=$valid; |
$table->attach_defaults($box,5,7,$number+1,$number+2); |
$table->attach($box,5,7,$number+1,$number+2,'expand','shrink',2,2); |
$table->show_all; |
} ); |
|
1141,9 → 1159,9
|
|
my $ok = def_image_button('icons/select.png','OK'); |
my $okbox=def_hbox(TRUE,0); |
$okbox->pack_start($ok, FALSE, FALSE,0); |
|
|
|
my $refresh = def_image_button('icons/revert.png','Revert'); |
my $refbox=def_hbox(TRUE,0); |
$refbox->pack_start($refresh, FALSE, FALSE,0); |
1195,10 → 1213,10
|
|
|
$row= ($row<9)? 9:$row; |
$table->attach_defaults($refbox,2,3,$row,$row+1); |
$table->attach_defaults($okbox,3,4,$row,$row+1); |
|
$table->attach ($refbox,2,3,$row,$row+1,'expand','shrink',2,2); |
$table->attach ($ok,3,4,$row,$row+1,'expand','shrink',2,2); |
|
$window->add($scrolled_win); |
$window->show_all; |
|
1331,7 → 1349,7
############# |
|
sub load_soc{ |
my ($soc,$soc_state)=@_; |
my ($soc,$info)=@_; |
my $file; |
my $dialog = Gtk2::FileChooserDialog->new( |
'Select a File', undef, |
1353,8 → 1371,13
my ($name,$path,$suffix) = fileparse("$file",qr"\..[^.]*$"); |
if($suffix eq '.SOC'){ |
my $pp= eval { do $file }; |
if ($@ || !defined $pp){ |
show_info(\$info,"**Error reading $file file: $@\n"); |
$dialog->destroy; |
return; |
} |
clone_obj($soc,$pp); |
set_state($soc_state,"load_file",0); |
set_gui_status($soc,"load_file",0); |
} |
} |
$dialog->destroy; |
1394,9 → 1417,10
my $infc = interface->interface_new(); |
my $ip = ip->lib_new (); |
my $soc = soc->soc_new(); |
set_gui_status($soc,"ideal",0); |
#my $soc= eval { do 'lib/soc/soc.SOC' }; |
|
my $soc_state= def_state("ideal"); |
|
# main window |
#my $window = def_win_size(1000,800,"Top"); |
# The main table containg the lib tree, selected modules and info section |
1409,7 → 1433,7
my $refresh_dev_win = Gtk2::Button->new_from_stock('ref'); |
|
# A tree view for holding a library |
my $tree_box = create_tree ($info,$ip,$soc,$soc_state); |
my $tree_box = create_tree ($info,$ip,$soc); |
|
|
|
1416,12 → 1440,11
$main_table->set_row_spacings (4); |
$main_table->set_col_spacings (1); |
|
my $device_win=show_active_dev($soc,$ip,$infc,$soc_state,\$refresh_dev_win,$info); |
my $device_win=show_active_dev($soc,$ip,$infc,\$refresh_dev_win,$info); |
|
|
my $generate = def_image_button('icons/gen.png','Generate'); |
my $genbox=def_hbox(TRUE,0); |
$genbox->pack_start($generate, FALSE, FALSE,0); |
|
|
|
|
1428,46 → 1451,40
|
|
my $wb = def_image_button('icons/setting.png','Wishbone address setting'); |
my $wbbox=def_hbox(TRUE,0); |
$wbbox->pack_start($wb, FALSE, FALSE,0); |
|
|
|
my $open = def_image_button('icons/browse.png','Load Tile'); |
my $openbox=def_hbox(TRUE,0); |
$openbox->pack_start($open, FALSE, FALSE,0); |
|
|
my $entry=gen_entry_object($soc,'soc_name',undef,undef,undef,undef); |
my $entrybox=labele_widget_info(" Tile name:",$entry); |
|
my ($entrybox,$entry) = def_h_labeled_entry('Tile name:'); |
$entry->signal_connect( 'changed'=> sub{ |
my $name=$entry->get_text(); |
$soc->soc_set_soc_name($name); |
}); |
|
#$table->attach_defaults ($event_box, $col, $col+1, $row, $row+1); |
$main_table->attach_defaults ($tree_box , 0, 2, 0, 17); |
$main_table->attach_defaults ($device_win , 2, 12, 0, 17); |
$main_table->attach_defaults ($infobox , 0, 12, 17,19); |
$main_table->attach_defaults ($openbox,0, 3, 19,20); |
$main_table->attach ($open,0, 3, 19,20,'expand','shrink',2,2); |
$main_table->attach_defaults ($entrybox,3, 7, 19,20); |
$main_table->attach_defaults ($wbbox, 7, 10, 19,20); |
$main_table->attach_defaults ($genbox, 10, 12, 19,20); |
$main_table->attach ($wb, 7, 10, 19,20,'expand','shrink',2,2); |
$main_table->attach ($generate, 10, 12, 19,20,'expand','shrink',2,2); |
|
|
#check soc status every 0.5 second. referesh device table if there is any changes |
Glib::Timeout->add (100, sub{ |
|
my ($state,$timeout)= get_state($soc_state); |
|
my ($state,$timeout)= get_gui_status($soc); |
|
if ($timeout>0){ |
$timeout--; |
set_state($soc_state,$state,$timeout); |
set_gui_status($soc,$state,$timeout); |
|
} |
elsif( $state ne "ideal" ){ |
$refresh_dev_win->clicked; |
my $saved_name=$soc->soc_get_soc_name(); |
my $saved_name=$soc->object_get_attribute('soc_name',undef); |
if(defined $saved_name) {$entry->set_text($saved_name);} |
set_state($soc_state,"ideal",0); |
|
set_gui_status($soc,"ideal",0); |
} |
return TRUE; |
|
1486,7 → 1503,7
}); |
|
$open-> signal_connect("clicked" => sub{ |
load_soc($soc,$soc_state); |
load_soc($soc,$info); |
|
}); |
|
/temp.pl
1,160 → 1,9
#!/usr/bin/perl |
use warnings; |
use strict; |
use File::System |
|
use Glib qw/TRUE FALSE/; |
use Gtk2 '-init'; |
my $fs = File::System->new('Real'); |
my $fs = File::System->new('My::File::System::Foo'); |
(system("ls")); |
|
our $spinner1; |
|
sub get_value |
{ |
my ($button, $format) = @_; |
|
if ('int' eq $format) |
{ |
$button->{val_label}->set_text (sprintf ("%d", |
$spinner1->get_value_as_int)); |
} |
else |
{ |
$button->{val_label}->set_text (sprintf ("%0.*f", |
$spinner1->get_digits, |
$spinner1->get_value)); |
} |
} |
|
$window = Gtk2::Window->new ('toplevel'); |
$window->signal_connect (destroy => sub { Gtk2->main_quit; 0; }); |
$window->set_title ("Spin Button"); |
|
$main_vbox = Gtk2::VBox->new (FALSE, 5); |
$main_vbox->set_border_width (10); |
$window->add ($main_vbox); |
|
$frame = Gtk2::Frame->new ("Not accelerated"); |
$main_vbox->pack_start ($frame, TRUE, TRUE, 0); |
|
$vbox = Gtk2::VBox->new (FALSE, 0); |
$vbox->set_border_width (10); |
$frame->add ($vbox); |
|
# Day, month, year spinners |
$hbox = Gtk2::HBox->new (FALSE, 0); |
$vbox->pack_start ($hbox, TRUE, TRUE, 5); |
|
$vbox2 = Gtk2::VBox->new (FALSE, 0); |
$hbox->pack_start ($vbox2, TRUE, TRUE, 5); |
|
$label = Gtk2::Label->new ("Day :"); |
$label->set_alignment (0.0, 0.5); # left halignment, middle valignment |
$vbox2->pack_start ($label, FALSE, TRUE, 0); |
|
$adj = Gtk2::Adjustment->new (1.0, 1.0, 31.0, 1.0, 5.0, 0.0); |
$spinner = Gtk2::SpinButton->new ($adj, 0, 0); |
$spinner->set_wrap (TRUE); |
$vbox2->pack_start ($spinner, FALSE, TRUE, 0); |
|
$vbox2 = Gtk2::VBox->new (FALSE, 0); |
$hbox->pack_start ($vbox2, TRUE, TRUE, 5); |
|
$label = Gtk2::Label->new ("Month :"); |
$label->set_alignment (0.0, 0.5); # left halignment, middle valignment |
$vbox2->pack_start ($label, FALSE, TRUE, 0); |
|
$adj = Gtk2::Adjustment->new (1.0, 1.0, 12.0, 1.0, 5.0, 0.0); |
$spinner = Gtk2::SpinButton->new ($adj, 0, 0); |
$spinner->set_wrap (TRUE); |
$vbox2->pack_start ($spinner, FALSE, TRUE, 0); |
|
$vbox2 = Gtk2::VBox->new (FALSE, 0); |
$hbox->pack_start ($vbox2, TRUE, TRUE, 5); |
|
$label = Gtk2::Label->new ("Year :"); |
$label->set_alignment (0.0, 0.5); # left halignment, middle valignment |
$vbox2->pack_start ($label, FALSE, TRUE, 0); |
|
$adj = Gtk2::Adjustment->new (1998.0, 1.0, 2100.0, 1.0, 100.0, 0.0); |
$spinner = Gtk2::SpinButton->new ($adj, 0, 0); |
$spinner->set_wrap (TRUE); |
$spinner->set_size_request (55, -1); |
$vbox2->pack_start ($spinner, FALSE, TRUE, 0); |
|
$frame = Gtk2::Frame->new ("Accelerated"); |
$main_vbox->pack_start ($frame, TRUE, TRUE, 0); |
|
$vbox = Gtk2::VBox->new (FALSE, 0); |
$vbox->set_border_width (5); |
$frame->add ($vbox); |
|
$hbox = Gtk2::HBox->new (FALSE, 0); |
$vbox->pack_start ($hbox, TRUE, TRUE, 5); |
|
$vbox2 = Gtk2::VBox->new (FALSE, 0); |
$hbox->pack_start ($vbox2, TRUE, TRUE, 5); |
|
$label = Gtk2::Label->new ("Value :"); |
$label->set_alignment (0.0, 0.5); # left halignment, middle valignment |
$vbox2->pack_start ($label, FALSE, TRUE, 0); |
|
$adj = Gtk2::Adjustment->new (0.0, -10000.0, 10000.0, 0.5, 100.0, 0.0); |
$spinner1 = Gtk2::SpinButton->new ($adj, 1.0, 2); |
$spinner1->set_wrap (TRUE); |
$spinner1->set_size_request (100, -1); |
$vbox2->pack_start ($spinner1, FALSE, TRUE, 0); |
|
$vbox2 = Gtk2::VBox->new (FALSE, 0); |
$hbox->pack_start ($vbox2, TRUE, TRUE, 5); |
|
$label = Gtk2::Label->new ("Digits :"); |
$label->set_alignment (0.0, 0.5); # left halignment, middle valignment |
$vbox2->pack_start ($label, FALSE, TRUE, 0); |
|
$adj = Gtk2::Adjustment->new (2, 1, 5, 1, 1, 0); |
$spinner2 = Gtk2::SpinButton->new ($adj, 0.0, 0); |
$spinner2->set_wrap (TRUE); |
$adj->signal_connect (value_changed => sub { |
$spinner1->set_digits ($spinner2->get_value_as_int ()); |
}); |
$vbox2->pack_start ($spinner2, FALSE, TRUE, 0); |
|
$button = Gtk2::CheckButton->new ("Snap to 0.5-ticks"); |
$button->signal_connect (clicked => sub { |
$spinner1->set_snap_to_ticks ($_[0]->get_active); |
}); |
$vbox->pack_start ($button, TRUE, TRUE, 0); |
$button->set_active (TRUE); |
|
$button = Gtk2::CheckButton->new ("Numeric only input mode"); |
$button->signal_connect (clicked => sub { |
$spinner1->set_numeric ($_[0]->get_active); |
}); |
$vbox->pack_start ($button, TRUE, TRUE, 0); |
$button->set_active (TRUE); |
|
$val_label = Gtk2::Label->new (""); |
|
$hbox = Gtk2::HBox->new (FALSE, 0); |
$vbox->pack_start ($hbox, FALSE, TRUE, 5); |
$button = Gtk2::Button->new ("Value as Int"); |
$button->{val_label} = $val_label; |
$button->signal_connect (clicked => \&get_value, 'int'); |
$hbox->pack_start ($button, TRUE, TRUE, 5); |
|
$button = Gtk2::Button->new ("Value as Float"); |
$button->{val_label} = $val_label; |
$button->signal_connect (clicked => \&get_value, 'float'); |
$hbox->pack_start ($button, TRUE, TRUE, 5); |
|
$vbox->pack_start ($val_label, TRUE, TRUE, 0); |
$val_label->set_text ("0"); |
|
$hbox = Gtk2::HBox->new (FALSE, 0); |
$main_vbox->pack_start ($hbox, FALSE, TRUE, 0); |
|
$button = Gtk2::Button->new ("Close"); |
$button->signal_connect (clicked => sub { $window->destroy; }); |
$hbox->pack_start ($button, TRUE, TRUE, 0); |
|
$window->show_all; |
|
Gtk2->main; |
|
0; |
/verilog_gen.pl
20,7 → 20,7
|
sub soc_generate_verilog{ |
my ($soc)= @_; |
my $soc_name=$soc->soc_get_soc_name(); |
my $soc_name=$soc->object_get_attribute('soc_name'); |
#my $top_ip=ip_gen->ip_gen_new(); |
my $top_ip=ip_gen->top_gen_new(); |
if(!defined $soc_name){$soc_name='soc'}; |
28,13 → 28,15
my @instances=$soc->soc_get_all_instances(); |
my $io_sim_v; |
my $param_as_in_v="\tparameter\tCORE_ID=0"; |
my $param_pass_v="\t.CORE_ID(CORE_ID)"; |
my $body_v; |
|
my ($param_v_all, $local_param_v_all, $wire_def_v_all, $inst_v_all, $plugs_assign_v_all, $sockets_assign_v_all,$io_full_v_all); |
my $wires=soc->new_wires(); |
my $intfc=interface->interface_new(); |
|
foreach my $id (@instances){ |
my ($param_v, $local_param_v, $wire_def_v, $inst_v, $plugs_assign_v, $sockets_assign_v,$io_full_v)=gen_module_inst($id,$soc,\$io_sim_v,\$param_as_in_v,$top_ip,$intfc,$wires); |
my ($param_v, $local_param_v, $wire_def_v, $inst_v, $plugs_assign_v, $sockets_assign_v,$io_full_v)=gen_module_inst($id,$soc,\$io_sim_v,\$param_as_in_v,$top_ip,$intfc,$wires,\$param_pass_v); |
my $inst = $soc->soc_get_instance_name($id); |
add_text_to_string(\$body_v,"/*******************\n*\n*\t$inst\n*\n*\n*********************/\n"); |
|
78,9 → 80,18
|
$soc->soc_add_top($top_ip); |
#print @assigned_wires; |
return "$soc_v"; |
|
#generate topmodule |
|
my $top_v = (defined $param_as_in_v )? "module ${soc_name}_top #(\n $param_as_in_v\n)(\n$io_sim_v\n);\n": "module ${soc_name}_top (\n $io_sim_v\n);\n"; |
my $ins= gen_soc_instance_v($soc,$soc_name,$param_pass_v); |
|
add_text_to_string(\$top_v,$local_param_v_all."\n".$io_full_v_all); |
add_text_to_string(\$top_v,$ins); |
my $readme=gen_system_info($soc,$param_as_in_v); |
return ("$soc_v",$top_v,$readme); |
|
|
} |
|
################# |
88,7 → 99,7
############### |
|
sub gen_module_inst { |
my ($id,$soc,$io_sim_v,$param_as_in_v,$top_ip, $intfc,$wires)=@_; |
my ($id,$soc,$io_sim_v,$param_as_in_v,$top_ip, $intfc,$wires,$param_pass_v)=@_; |
my $module =$soc->soc_get_module($id); |
my $module_name =$soc->soc_get_module_name($id); |
my $category =$soc->soc_get_category($id); |
99,16 → 110,17
my $ip = ip->lib_new (); |
|
my @ports=$ip->ip_list_ports($category,$module); |
my ($inst_v,$intfc_v,$wire_def_v,$plugs_assign_v,$sockets_assign_v,$io_full_v); |
my ($inst_v,$intfc_v,$plugs_assign_v,$sockets_assign_v,$io_full_v); |
my $wire_def_v=""; |
$plugs_assign_v="\n"; |
|
my $counter=0; |
my @param_order=$soc->soc_get_instance_param_order($id); |
|
my ($param_v,$local_param_v,$instance_param_v)= gen_parameter_v(\%params,$id,$inst,$category,$module,$ip,$param_as_in_v,\@param_order,$top_ip); |
my $param_size = keys %params; |
my ($param_v,$local_param_v,$instance_param_v)= gen_parameter_v(\%params,$id,$inst,$category,$module,$ip,$param_as_in_v,\@param_order,$top_ip,$param_pass_v); |
|
|
|
$top_ip->top_add_def_to_instance($id,'module',$module); |
$top_ip->top_add_def_to_instance($id,'module_name',$module_name); |
$top_ip->top_add_def_to_instance($id,'category',$category); |
120,12 → 132,12
|
|
#module name |
$inst_v=($param_size>0)? "$module_name #(\n": $module_name ; |
$inst_v=( defined $instance_param_v )? "$module_name #(\n": $module_name ; |
|
|
|
#module parameters |
$inst_v=($param_size>0)? "$inst_v $instance_param_v\n\t)": $inst_v; |
$inst_v=( defined $instance_param_v)? "$inst_v $instance_param_v\n\t)": $inst_v; |
#module instance name |
$inst_v="$inst_v $inst \t(\n"; |
|
158,13 → 170,17
|
} |
elsif($IO eq 'yes' || !defined $i_type || !defined $i_name || !defined $i_num){ #its an IO port |
$assigned_port="$inst\_$port"; |
$$io_sim_v= (!defined $$io_sim_v)? "\t$assigned_port" : "$$io_sim_v, \n\t$assigned_port"; |
my $new_range = add_instantc_name_to_parameters(\%params,$inst,$range); |
my $port_def=(length ($range)>1 )? "\t$type\t [ $new_range ] $assigned_port;\n": "\t$type\t\t\t$assigned_port;\n"; |
add_text_to_string(\$io_full_v,$port_def); |
# $top_ip->ipgen_add_port($assigned_port, $new_range, $type ,$intfc_name,$i_port); |
$top_ip->top_add_port($id,$assigned_port, $new_range, $type ,$intfc_name,$i_port); |
if($i_port eq 'NC'){ |
$NC='yes'; |
}else { |
$assigned_port="$inst\_$port"; |
$$io_sim_v= (!defined $$io_sim_v)? "\t$assigned_port" : "$$io_sim_v, \n\t$assigned_port"; |
my $new_range = add_instantc_name_to_parameters(\%params,$inst,$range); |
my $port_def=(length ($range)>1 )? "\t$type\t [ $new_range ] $assigned_port;\n": "\t$type\t\t\t$assigned_port;\n"; |
add_text_to_string(\$io_full_v,$port_def); |
# $top_ip->ipgen_add_port($assigned_port, $new_range, $type ,$intfc_name,$i_port); |
$top_ip->top_add_port($id,$assigned_port, $new_range, $type ,$intfc_name,$i_port); |
} |
|
|
} |
172,8 → 188,10
$assigned_port="$inst\_$i_type\_$i_name\_$i_num\_$i_port"; |
|
#create plug wires |
my $wire_string=generate_wire ($range,$assigned_port,$inst,\%params,$i_type,$i_name,$i_num,$i_port, $wires); |
add_text_to_string(\$wire_def_v,$wire_string); |
my ($wire_string,$port_name)=generate_wire ($range,$assigned_port,$inst,\%params,$i_type,$i_name,$i_num,$i_port, $wires); |
#add wire def if it is not defined before |
|
add_text_to_string(\$wire_def_v,$wire_string) if ($wire_def_v !~ /[\s\]]$port_name;/); |
|
|
|
210,15 → 228,15
my $name= $soc->soc_get_instance_name($id); |
my $joint= "$name\_$i_type\_$i_name\_$v\_$i_port"; |
|
my $wire_string=generate_wire ($i_range,"$name\_$i_type\_$i_name\_$v\_$i_port",$inst,\%params,$i_type,$i_name,$i_num,$i_port, $wires); |
add_text_to_string(\$wire_def_v,$wire_string); |
my ($wire_string,$port_name)=generate_wire ($i_range,"$name\_$i_type\_$i_name\_$v\_$i_port",$inst,\%params,$i_type,$i_name,$i_num,$i_port, $wires); |
add_text_to_string(\$wire_def_v,$wire_string) if ($wire_def_v !~ /[\s\]]$port_name;/); |
|
for(my $i=$v-1; $i>=0; $i--) { |
$joint= "$joint ,$name\_$i_type\_$i_name\_$i\_$i_port"; |
#create socket wires |
#create plug wires |
my $wire_string=generate_wire ($i_range,"$name\_$i_type\_$i_name\_$i\_$i_port",$inst,\%params,$i_type,$i_name,$i_num,$i_port, $wires); |
add_text_to_string(\$wire_def_v,$wire_string); |
my ($wire_string,$port_name)=generate_wire ($i_range,"$name\_$i_type\_$i_name\_$i\_$i_port",$inst,\%params,$i_type,$i_name,$i_num,$i_port, $wires); |
add_text_to_string(\$wire_def_v,$wire_string) if ($wire_def_v !~ /[\s\]]$port_name;/); |
|
|
|
271,7 → 289,7
|
|
|
return ($param_v, $local_param_v, $wire_def_v, $inst_v, $plugs_assign_v, $sockets_assign_v,$io_full_v); |
return ($param_v, $local_param_v, $wire_def_v, $inst_v, $plugs_assign_v, $sockets_assign_v,$io_full_v,$param_pass_v); |
|
|
} |
293,7 → 311,7
|
|
sub gen_parameter_v{ |
my ($param_ref,$id,$inst,$category,$module,$ip,$param_as_in_v,$ref_ordered,$top_ip)=@_; |
my ($param_ref,$id,$inst,$category,$module,$ip,$param_as_in_v,$ref_ordered,$top_ip,$param_pass_v)=@_; |
my %params=%$param_ref; |
my @param_order; |
@param_order=@{$ref_ordered} if(defined $ref_ordered); |
303,9 → 321,10
@list= (@param_order)? @param_order : |
sort keys%params; |
my $first_param=1; |
$instance_param_v=""; |
|
$local_param_v=""; |
$param_v=""; |
|
#add instance name to parameter value |
foreach my $param (@list){ |
$params{$param}=add_instantc_name_to_parameters(\%params,$inst,$params{$param}); |
316,27 → 335,31
#print parameters |
foreach my $param (@list){ |
my $inst_param= "$inst\_$param"; |
my ($deafult,$type,$content,$info,$glob_param,$redefine_param)= $ip->ip_get_parameter($category,$module,$param); |
if (! defined $redefine_param){$redefine_param=1;} |
if($redefine_param eq 1){ |
|
$instance_param_v=($first_param eq 1)? "$instance_param_v\t\t.$param($inst_param)" : "$instance_param_v,\n\t\t.$param($inst_param)"; |
$first_param=0; |
|
my ($deafult,$type,$content,$info,$vfile_param_type,$redefine_param)= $ip->ip_get_parameter($category,$module,$param); |
$vfile_param_type= "Don't include" if (!defined $vfile_param_type ); |
$vfile_param_type= "Parameter" if ($vfile_param_type eq 1); |
$vfile_param_type= "Localparam" if ($vfile_param_type eq 0); |
$redefine_param=1 if (! defined $redefine_param); |
$redefine_param=0 if ($vfile_param_type eq "Don't include"); |
if($redefine_param eq 1){ |
$instance_param_v=($first_param eq 1)? "\t\t.$param($inst_param)" : "$instance_param_v,\n\t\t.$param($inst_param)"; |
$first_param=0; |
|
} |
|
|
if (! defined $glob_param){$glob_param=0;} |
if($glob_param eq 0){ |
|
if($vfile_param_type eq "Localparam"){ |
$local_param_v="$local_param_v\tlocalparam\t$inst_param=$params{$param};\n"; |
}else{ |
} |
elsif($vfile_param_type eq "Parameter"){ |
$param_v="$param_v\tparameter\t$inst_param=$params{$param};\n"; |
$$param_pass_v =(defined ($$param_pass_v ))? "$$param_pass_v,\n\t.$inst_param($inst_param)": "\t.$inst_param($inst_param)"; |
$$param_as_in_v=(defined ($$param_as_in_v))? "$$param_as_in_v ,\n\tparameter\t$inst_param=$params{$param}": |
" \tparameter\t$inst_param=$params{$param}"; |
#add parameter to top |
#$top_ip $inst_param |
$top_ip->top_add_parameter($id,$inst_param,$params{$param},$type,$content,$info,$glob_param,$redefine_param); |
$top_ip->top_add_parameter($id,$inst_param,$params{$param},$type,$content,$info,$vfile_param_type,$redefine_param); |
|
} |
|
365,24 → 388,35
my $instance_name=$soc->soc_get_instance_name($instance_id); |
my @plugs= $soc->soc_get_all_plugs_of_an_instance($instance_id); |
foreach my $plug (@plugs){ |
my @nums=$soc->soc_list_plug_nums($instance_id,$plug); |
|
my @nums=$soc->soc_list_plug_nums($instance_id,$plug); |
foreach my $num (@nums){ |
my ($addr,$base,$end,$name,$connect_id,$connect_socket,$connect_socket_num)=$soc->soc_get_plug($instance_id,$plug,$num); |
if((defined $connect_socket) && ($connect_socket eq 'wb_slave')){ |
#read wishbone bus address and data width size |
my $Aw=$soc->soc_get_module_param_value ($connect_id,'Aw'); |
my $Dw=$soc->soc_get_module_param_value ($connect_id,'Dw'); |
$Aw=32 if (!defined $Aw); |
$Dw=32 if (!defined $Dw); |
add_text_to_string(\$addr_mp_v,"/* $instance_name wb_slave $num */\n"); |
my $base_hex=sprintf("32'h%08x", ($base>>2)); |
my $end_hex=sprintf("32'h%08x", ($end>>2)); |
add_text_to_string(\$instance_addr_localparam,"\tlocalparam \t$instance_name\_BASE_ADDR\t=\t$base_hex;\n"); |
add_text_to_string(\$instance_addr_localparam,"\tlocalparam \t$instance_name\_END_ADDR\t=\t$end_hex;\n"); |
#count how many nibbles we have in address size |
my $hh= ($Aw % 4)? ($Aw >> 2)+1 : ($Aw >> 2); |
$hh= "'h%0${hh}x";#hex address nibble num |
#change addresses to word as the assign addresses by ProNoC GUI are in bytes |
my $bytenum=($Dw/8); |
my $base_hex=$Aw.sprintf($hh, ($base/$bytenum)); |
my $end_hex=$Aw.sprintf($hh, ($end/$bytenum)); |
#my $base_hex=sprintf("32'h%08x", ($base>>2)); |
#my $end_hex=sprintf("32'h%08x", ($end>>2)); |
add_text_to_string(\$instance_addr_localparam,"\tlocalparam \t$instance_name\_WB$num\_BASE_ADDR\t=\t$base_hex;\n"); |
add_text_to_string(\$instance_addr_localparam,"\tlocalparam \t$instance_name\_WB$num\_END_ADDR\t=\t$end_hex;\n"); |
if($instance_name ne $instance_id){ |
add_text_to_string(\$module_addr_localparam,"\tlocalparam \t$instance_id\_BASE_ADDR\t=\t$base_hex;\n"); |
add_text_to_string(\$module_addr_localparam,"\tlocalparam \t$instance_id\_END_ADDR\t=\t$end_hex;\n"); |
add_text_to_string(\$module_addr_localparam,"\tlocalparam \t$instance_id\_WB$num\_BASE_ADDR\t=\t$base_hex;\n"); |
add_text_to_string(\$module_addr_localparam,"\tlocalparam \t$instance_id\_WB$num\_END_ADDR\t=\t$end_hex;\n"); |
} |
|
my $connect_name=$soc->soc_get_instance_name($connect_id); |
$wires->wire_add("$connect_name\_socket_wb_addr_map_0_sel_one_hot","connected",1); |
$addr_mp_v="$addr_mp_v \tassign $connect_name\_socket_wb_addr_map_0_sel_one_hot[$connect_socket_num\] = (($connect_name\_socket_wb_addr_map_0_grant_addr >= $instance_name\_BASE_ADDR) & ($connect_name\_socket_wb_addr_map_0_grant_addr <= $instance_name\_END_ADDR));\n"; |
$addr_mp_v="$addr_mp_v \tassign $connect_name\_socket_wb_addr_map_0_sel_one_hot[$connect_socket_num\] = (($connect_name\_socket_wb_addr_map_0_grant_addr >= $instance_name\_WB$num\_BASE_ADDR) & ($connect_name\_socket_wb_addr_map_0_grant_addr <= $instance_name\_WB$num\_END_ADDR));\n"; |
|
$number++; |
}#if |
431,7 → 465,7
$wires->wire_add("$port_name","i_num",$i_num); |
$wires->wire_add("$port_name","i_port",$i_port); |
|
return $wire_string; |
return ($wire_string,$port_name); |
} |
|
sub port_width_repeat{ |
489,10 → 523,246
|
|
|
sub gen_soc_instance_v{ |
my ($soc,$soc_name,$param_pass_v)=@_; |
my $soc_v; |
my $processor_en=0; |
|
add_text_to_string(\$soc_v," |
|
// Allow software to remote reset/enable the cpu via jtag |
|
wire jtag_cpu_en, jtag_system_reset; |
|
jtag_system_en jtag_en ( |
.cpu_en(jtag_cpu_en), |
.system_reset(jtag_system_reset) |
|
); |
|
|
|
|
|
|
|
"); |
|
|
my $mm="$soc_name #(\n $param_pass_v \n\t)the_${soc_name}(\n"; |
|
my $top=$soc->soc_get_top(); |
my @intfcs=$top->top_get_intfc_list(); |
|
my $i=0; |
|
|
|
|
my $ss=""; |
my $ww=""; |
|
foreach my $intfc (@intfcs){ |
|
|
|
#reset |
if( $intfc eq 'plug:reset[0]'){ |
my @ports=$top->top_get_intfc_ports_list($intfc); |
foreach my $p (@ports){ |
my($inst,$range,$type,$intfc_name,$intfc_port)= $top->top_get_port($p); |
$mm="$mm," if ($i); |
$mm="$mm\n\t\t.$p(${p}_ored_jtag)"; |
$ss="$ss\tassign ${p}_ored_jtag = (jtag_system_reset | $p);\n"; |
$ww="$ww\twire ${p}_ored_jtag;\n"; |
$i=1; |
|
} |
|
|
|
} |
#enable |
elsif( $intfc eq 'plug:enable[0]'){ |
my @ports=$top->top_get_intfc_ports_list($intfc); |
foreach my $p (@ports){ |
my($inst,$range,$type,$intfc_name,$intfc_port)= $top->top_get_port($p); |
$mm="$mm," if ($i); |
$mm="$mm\n\t\t.$p(${p}_anded_jtag)"; |
$ss="$ss\tassign ${p}_anded_jtag= (jtag_cpu_en & $p);\n"; |
$ww="$ww\twire ${p}_anded_jtag;\n"; |
$processor_en=1; |
$i=1; |
|
} |
|
|
} |
else { |
#other interface |
my @ports=$top->top_get_intfc_ports_list($intfc); |
foreach my $p (@ports){ |
my($inst,$range,$type,$intfc_name,$intfc_port)= $top->top_get_port($p); |
$mm="$mm," if ($i); |
$mm="$mm\n\t\t.$p($p)"; |
$i=1; |
|
} |
|
|
} |
|
|
} |
$mm="$mm\n\t);"; |
add_text_to_string(\$soc_v,"$ww\n"); |
add_text_to_string(\$soc_v,"$mm\n"); |
add_text_to_string(\$soc_v,"$ss\n"); |
add_text_to_string(\$soc_v,"\n endmodule\n"); |
|
|
|
|
|
|
|
return $soc_v; |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
sub gen_system_info { |
my ($soc,$param)=@_; |
my ($wb_slaves,$wb_masters,$other,$jtag); |
#my (@newbase,@newend,@connects); |
|
|
|
|
my @all_instances=$soc->soc_get_all_instances(); |
foreach my $instance_id (@all_instances){ |
my @plugs= $soc->soc_get_all_plugs_of_an_instance($instance_id); |
foreach my $plug (@plugs){ |
my @nums=$soc->soc_list_plug_nums($instance_id,$plug); |
foreach my $num (@nums){ |
my ($addr,$base,$end,$name,$connect_id,$connect_socket,$connect_socket_num)=$soc->soc_get_plug($instance_id,$plug,$num); |
my $instance_name=$soc->soc_get_instance_name($instance_id); |
my $connect_name=$soc->soc_get_instance_name($connect_id); |
#get interfaces |
if((defined $connect_socket) && ($connect_socket eq 'wb_slave')){ |
|
$base=sprintf("0x%08x", $base); |
$end=sprintf("0x%08x", $end); |
add_text_to_string(\$wb_slaves, "\t$instance_name, $name, $connect_name, $base, $end\n"); |
|
}#if |
elsif((defined $connect_socket) && ($connect_socket eq 'wb_master')){ |
add_text_to_string(\$wb_masters,"\t$instance_name, $name, $connect_name\n"); |
} |
elsif(defined $connect_socket) { |
add_text_to_string(\$other,"\t$instance_name, $name, $connect_name\n"); |
|
} |
# get jtag_wbs |
if((defined $connect_socket) && ($connect_socket eq 'wb_master') && ($instance_id =~ /jtag_wb/)){ |
my $index=$soc->soc_get_module_param_value($instance_id,'VJTAG_INDEX'); |
add_text_to_string(\$jtag, "\t$instance_name, $connect_name, $index\n"); |
|
|
} |
|
|
}#foreach my $num |
}#foreach my $plug |
}#foreach my $instance_id |
|
|
my $lisence= get_license_header("readme"); |
my $warning=autogen_warning(); |
|
|
|
|
my $readme=" |
$warning |
$lisence |
|
*********************** |
** Program the memories |
*********************** |
|
If the memory core and jtag_wb are connected to the same wishbone bus, you can program the memory using |
|
sh program.sh |
|
but first, you need to update these variables inside the program.sh file |
|
OFSSET= [offset_in_hex] |
The RAM wishbone bus offset address e.g : 0x0000000. |
BOUNDRY=[boundry_in_hex ] |
The RAM boundary address in hex e.g: 0x00003fff. |
VJTAG_INDEX=[Virtual jtag index number] |
BINFILE=[file_name] |
memory file in binary format. eg ram00.bin |
|
|
you can get OFSSET, BOUNDRY and VJTAG_INDEX values from following |
wishbone buse(s) info & Jtag to wishbone interface (jtag_wb) info sections. |
Also check the memory and jtag_wb are connected to the same bus (have same \"connected to\" filed). |
|
*************************** |
** soc parameters |
*************************** |
|
$param |
|
**************************** |
** wishbone bus(es) info |
**************************** |
#slave interfaces: |
#instance name, interface name, connected to, base address, boundray address |
$wb_slaves |
|
#master interfaces: |
#instance name, interface name, connected to |
$wb_masters |
|
**************************** |
** Jtag to wishbone interface (jtag_wb) info: |
**************************** |
|
#instance name, instance name, VJTAG_INDEX |
$jtag |
|
|
"; |
|
return $readme; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
1; |
|
|
/widget.pl
3,9 → 3,11
use strict; |
use warnings; |
|
|
|
use Gtk2::Pango; |
#use Tk::Animation; |
|
|
############## |
# combo box |
############# |
14,7 → 16,7
my $combo = Gtk2::ComboBox->new_text; |
|
combo_set_names($combo,$combo_list); |
$combo->set_active($combo_active_pos); |
$combo->set_active($combo_active_pos) if(defined $combo_active_pos); |
|
#my $font = Gtk2::Pango::FontDescription->from_string('Tahoma 5'); |
#$combo->modify_font($font); |
153,7 → 155,7
############## |
|
sub gen_combo_entry{ |
my $list_ref=shift; |
my ($list_ref,$pos)=@_; |
my @list=@{$list_ref}; |
|
my $combo_box_entry = Gtk2::ComboBoxEntry->new_text; |
160,10 → 162,23
foreach my $p (@list){ |
$combo_box_entry->append_text($p); |
} |
$combo_box_entry->set_active(0); |
$pos=0 if(! defined $pos ); |
$combo_box_entry->set_active($pos); |
return $combo_box_entry; |
} |
|
|
sub def_h_labeled_combo_entry_help{ |
my ($help,$label_name,$list_ref,$initial)=@_; |
my $box = def_hbox(TRUE,0); |
my $label= gen_label_in_left($list_ref); |
my ($b,$entry) =gen_combo_entry($help,$initial); |
$box->pack_start( $label, FALSE, FALSE, 3); |
$box->pack_start( $b, FALSE, FALSE, 3); |
return ($box,$entry); |
|
} |
|
########### |
# |
########### |
273,7 → 288,7
|
sub def_image{ |
my $image_file=shift; |
my $font_size=get_deafualt_font_size(); |
my $font_size=get_defualt_font_size(); |
my $size=($font_size==10)? 25: |
($font_size==9 )? 22: |
($font_size==8 )? 18: |
289,9 → 304,10
|
|
sub def_image_button{ |
my ($image_file, $label_text)=@_; |
my ($image_file, $label_text, $homogeneous)=@_; |
# create box for image and label |
my $box = def_hbox(FALSE,0); |
$homogeneous = FALSE if(!defined $homogeneous); |
my $box = def_hbox($homogeneous,0); |
my $image = def_image($image_file); |
|
|
358,7 → 374,7
my ($label_text,$color_num)=@_; |
# create box for image and label |
my $box = def_hbox(FALSE,0); |
my $font_size=get_deafualt_font_size(); |
my $font_size=get_defualt_font_size(); |
my $size=($font_size==10)? 25: |
($font_size==9 )? 22: |
($font_size==8 )? 18: |
385,9 → 401,54
|
|
|
sub show_gif{ |
|
my $gif = shift; |
#my $mw=def_popwin_size(400,200,'hey'); |
my $vbox = Gtk2::HBox->new (TRUE, 8); |
my $filename; |
eval { |
## $filename = demo_find_file ("floppybuddy.gif"); |
$filename = main::demo_find_file ($gif); |
}; |
|
|
my $image = Gtk2::Image->new_from_file ($gif); |
|
$vbox->set_border_width (4); |
my $align = Gtk2::Alignment->new (0.5, 0.5, 0, 0); |
|
my $frame = Gtk2::Frame->new; |
$frame->set_shadow_type ('in'); |
|
|
|
|
# Animation |
$frame->add ($image); |
$align->add ($frame); |
|
|
|
|
$vbox->pack_start ($align, FALSE, FALSE, 0); |
|
# $mw->add ($vbox); |
|
|
# Progressive |
|
|
|
|
#$mw->show_all(); |
return $vbox; |
|
|
|
|
} |
|
############ |
# message_dialog |
############ |
454,6 → 515,9
} |
|
|
|
|
|
sub def_scrolled_window_box{ |
|
my $window = def_popwin_size(@_); |
480,7 → 544,7
} |
|
|
sub get_deafualt_font_size{ |
sub get_defualt_font_size{ |
my($width,$hight)=max_win_size(); |
#print "($width,$hight)\n"; |
my $font_size=($width>=1600)? 10: |
487,63 → 551,21
($width>=1400)? 9: |
($width>=1200)? 8: |
($width>=1000)? 7:6; |
#print "$font_size\n"; |
return $font_size; |
} |
|
|
sub set_deafualt_font_size{ |
my $font_size=get_deafualt_font_size(); |
if($font_size==10){ |
sub set_defualt_font_size{ |
my $font_size=get_defualt_font_size(); |
|
Gtk2::Rc->parse_string(<<__); |
style "normal" { |
font_name ="Verdana 10" |
font_name ="Verdana $font_size" |
} |
widget "*" style "normal" |
__ |
|
} |
elsif ($font_size==9){ |
$font_size=9; |
Gtk2::Rc->parse_string(<<__); |
style "normal" { |
font_name ="Verdana 9" |
} |
widget "*" style "normal" |
__ |
|
} |
elsif ($font_size==8){ |
$font_size=8; |
Gtk2::Rc->parse_string(<<__); |
style "normal" { |
font_name ="Verdana 8" |
} |
widget "*" style "normal" |
__ |
|
} |
elsif ($font_size==7){ |
$font_size=7; |
Gtk2::Rc->parse_string(<<__); |
style "normal" { |
font_name ="Verdana 7" |
} |
widget "*" style "normal" |
__ |
|
} |
else{ |
Gtk2::Rc->parse_string(<<__); |
style "normal" { |
font_name ="Verdana 6" |
} |
widget "*" style "normal" |
__ |
|
} |
|
|
|
} |
|
|
628,26 → 650,26
|
} |
|
sub set_state{ |
my ($state,$initial,$timeout)=@_; |
my ($entry,$time_out)=@{$state}; |
$entry->set_text($initial); |
@{$state}[1]=$timeout; |
|
|
|
|
|
sub set_gui_status{ |
my ($object,$status,$timeout)=@_; |
$object->object_add_attribute('gui_status','status',$status); |
$object->object_add_attribute('gui_status','timeout',$timeout); |
} |
|
|
sub get_state{ |
my ($state)=@_; |
my ($entry,$time_out)=@{$state}; |
my $st; |
$st=$entry->get_text(); |
return ($st,$time_out); |
sub get_gui_status{ |
my ($object)=@_; |
my $status= $object->object_get_attribute('gui_status','status'); |
my $timeout=$object->object_get_attribute('gui_status','timeout'); |
return ($status,$timeout); |
} |
|
|
|
|
################## |
# show_info |
################## |
657,8 → 679,17
$buffer->set_text($info); |
} |
|
sub add_info{ |
my ($textview_ref,$info)=@_; |
my $buffer = $$textview_ref->get_buffer(); |
my $textiter = $buffer->get_end_iter(); |
#Insert some text into the buffer |
$buffer->insert($textiter,$info); |
|
} |
|
|
|
#################### |
# read verilog file |
################## |
685,7 → 716,22
return $vdb; |
} |
|
sub add_color_to_gd{ |
foreach (my $i=0;$i<32;$i++ ) { |
my ($red,$green,$blue)=get_color($i); |
|
|
add_colour("my_color$i"=>[$red>>8,$green>>8,$blue>>8]); |
|
|
} |
|
|
|
} |
|
|
|
sub get_color { |
my $num=shift; |
|
693,7 → 739,7
0x6495ED,#Cornflower Blue |
0xFAEBD7,#Antiquewhite |
0xC71585,#Violet Red |
0xC0C0C0, #silver |
0xC0C0C0,#silver |
0xADD8E6,#Lightblue |
0x6A5ACD,#Slate Blue |
0x00CED1,#Dark Turquoise |
720,7 → 766,8
0x800000,#marron |
0x800080,#Purple |
0x4B0082,#Indigo |
0xFFFFFF #white |
0xFFFFFF,#white |
0x000000 #Black |
); |
|
my $color= ($num< scalar (@colors))? $colors[$num]: 0xFFFFFF; |
798,7 → 845,302
}#sub |
|
|
############ |
# get file folder list |
########### |
|
sub get_directory_name { |
my ($object,$title,$entry,$attribute1,$attribute2,$status,$timeout)= @_; |
my $browse= def_image_button("icons/browse.png"); |
|
$browse->signal_connect("clicked"=> sub{ |
my $entry_ref=$_[1]; |
my $file; |
$title ='select directory' if(!defined $title); |
my $dialog = Gtk2::FileChooserDialog->new( |
$title, undef, |
# 'open', |
'select-folder', |
'gtk-cancel' => 'cancel', |
'gtk-ok' => 'ok', |
); |
|
|
if ( "ok" eq $dialog->run ) { |
$file = $dialog->get_filename; |
$$entry_ref->set_text($file); |
$object->object_add_attribute($attribute1,$attribute2,$file); |
set_gui_status($object,$status,$timeout) if(defined $status); |
#check_input_file($file,$socgen,$soc_state,$info); |
#print "file = $file\n"; |
} |
$dialog->destroy; |
|
|
|
} , \$entry); |
|
return $browse; |
|
} |
|
|
sub get_file_name { |
my ($object,$title,$entry,$attribute1,$attribute2,$extension,$lable,$open_in)= @_; |
my $browse= def_image_button("icons/browse.png"); |
|
$browse->signal_connect("clicked"=> sub{ |
my $entry_ref=$_[1]; |
my $file; |
$title ='select directory' if(!defined $title); |
my $dialog = Gtk2::FileChooserDialog->new( |
'Select a File', undef, |
'open', |
'gtk-cancel' => 'cancel', |
'gtk-ok' => 'ok', |
); |
if(defined $extension){ |
my $filter = Gtk2::FileFilter->new(); |
$filter->set_name($extension); |
$filter->add_pattern("*.$extension"); |
$dialog->add_filter ($filter); |
} |
if(defined $open_in){ |
$dialog->set_current_folder ($open_in); |
# print "$open_in\n"; |
|
} |
|
if ( "ok" eq $dialog->run ) { |
$file = $dialog->get_filename; |
$$entry_ref->set_text($file); |
$object->object_add_attribute($attribute1,$attribute2,$file); |
my ($name,$path,$suffix) = fileparse("$file",qr"\..[^.]*$"); |
$lable->set_markup("<span foreground= 'black' ><b>$name$suffix</b></span>"); |
$lable->show; |
|
#check_input_file($file,$socgen,$soc_state,$info); |
#print "file = $file\n"; |
} |
$dialog->destroy; |
|
|
|
} , \$entry); |
|
return $browse; |
|
} |
|
|
################# |
# widget update object |
################# |
|
sub gen_entry_object { |
my ($object,$attribute1,$attribute2,$default,$status,$timeout)=@_; |
my $old=$object->object_get_attribute($attribute1,$attribute2); |
my $widget; |
if(defined $old ){ |
$widget=gen_entry($old); |
} |
else |
{ |
$widget=gen_entry($default); |
$object->object_add_attribute($attribute1,$attribute2,$default); |
} |
$widget-> signal_connect("changed" => sub{ |
my $new_param_value=$widget->get_text(); |
$object->object_add_attribute($attribute1,$attribute2,$new_param_value); |
set_gui_status($object,$status,$timeout) if (defined $status); |
}); |
return $widget; |
} |
|
|
sub gen_combobox_object { |
my ($object,$attribute1,$attribute2,$content,$default,$status,$timeout)=@_; |
my @combo_list=split(",",$content); |
my $value=$object->object_get_attribute($attribute1,$attribute2); |
my $pos; |
$pos=get_pos($value, @combo_list) if (defined $value); |
if(!defined $pos && defined $default){ |
$object->object_add_attribute($attribute1,$attribute2,$default); |
$pos=get_item_pos($default, @combo_list); |
} |
#print " my $pos=get_item_pos($value, @combo_list);\n"; |
my $widget=gen_combo(\@combo_list, $pos); |
$widget-> signal_connect("changed" => sub{ |
my $new_param_value=$widget->get_active_text(); |
$object->object_add_attribute($attribute1,$attribute2,$new_param_value); |
set_gui_status($object,$status,$timeout) if (defined $status); |
}); |
return $widget; |
|
|
} |
|
|
sub gen_comboentry_object { |
my ($object,$attribute1,$attribute2,$content,$default,$status,$timeout)=@_; |
my @combo_list=split(",",$content); |
my $value=$object->object_get_attribute($attribute1,$attribute2); |
my $pos; |
$pos=get_pos($value, @combo_list) if (defined $value); |
if(!defined $pos && defined $default){ |
$object->object_add_attribute($attribute1,$attribute2,$default); |
$pos=get_item_pos($default, @combo_list); |
} |
#print " my $pos=get_item_pos($value, @combo_list);\n"; |
my $widget=gen_combo_entry(\@combo_list, $pos); |
($widget->child)->signal_connect('changed' => sub { |
my ($entry) = @_; |
my $new_param_value=$entry->get_text(); |
$object->object_add_attribute($attribute1,$attribute2,$new_param_value); |
set_gui_status($object,$status,$timeout) if (defined $status); |
}); |
return $widget; |
|
} |
|
|
|
sub gen_spin_object { |
my ($object,$attribute1,$attribute2,$content, $default,$status,$timeout)=@_; |
my $value=$object->object_get_attribute($attribute1,$attribute2); |
my ($min,$max,$step)=split(",",$content); |
if(!defined $value){ |
$value=$default; |
$object->object_add_attribute($attribute1,$attribute2,$value); |
} |
$value=~ s/\D//g; |
$min=~ s/\D//g; |
$max=~ s/\D//g; |
$step=~ s/\D//g; |
my $widget=gen_spin($min,$max,$step); |
$widget->set_value($value); |
$widget-> signal_connect("value_changed" => sub{ |
my $new_param_value=$widget->get_value_as_int(); |
$object->object_add_attribute($attribute1,$attribute2,$new_param_value); |
set_gui_status($object,$status,$timeout) if (defined $status); |
}); |
return $widget; |
} |
|
|
sub gen_check_box_object { |
my ($object,$attribute1,$attribute2,$content,$value,$default,$status,$timeout)=@_; |
my $widget = def_hbox(FALSE,0); |
my @check; |
for (my $i=0;$i<$content;$i++){ |
$check[$i]= Gtk2::CheckButton->new; |
} |
for (my $i=0;$i<$content;$i++){ |
$widget->pack_end( $check[$i], FALSE, FALSE, 0); |
|
my @chars = split("",$value); |
#check if saved value match the size of check box |
if($chars[0] ne $content ) { |
$object->object_add_attribute($attribute1,$attribute2,$default); |
$value=$default; |
@chars = split("",$value); |
} |
#set initial value |
|
#print "\@chars=@chars\n"; |
for (my $i=0;$i<$content;$i++){ |
my $loc= (scalar @chars) -($i+1); |
if( $chars[$loc] eq '1') {$check[$i]->set_active(TRUE);} |
else {$check[$i]->set_active(FALSE);} |
} |
|
|
#get new value |
$check[$i]-> signal_connect("toggled" => sub{ |
my $new_val="$content\'b"; |
|
for (my $i=$content-1; $i >= 0; $i--){ |
if($check[$i]->get_active()) {$new_val="${new_val}1" ;} |
else {$new_val="${new_val}0" ;} |
} |
$object->object_add_attribute($attribute1,$attribute2,$new_val); |
#print "\$new_val=$new_val\n"; |
set_gui_status($object,$status,$timeout) if (defined $status); |
}); |
} |
return $widget; |
|
} |
|
|
|
sub get_dir_in_object { |
my ($object,$attribute1,$attribute2,$content,$status,$timeout)=@_; |
my $widget = def_hbox(FALSE,0); |
my $value=$object->object_get_attribute($attribute1,$attribute2); |
my $entry=gen_entry($value); |
$entry-> signal_connect("changed" => sub{ |
my $new_param_value=$entry->get_text(); |
$object->object_add_attribute($attribute1,$attribute2,$new_param_value); |
set_gui_status($object,$status,$timeout) if (defined $status); |
}); |
my $browse= get_directory_name($object,undef,$entry,$attribute1,$attribute2,$status,$timeout); |
$widget->pack_start( $entry, FALSE, FALSE, 0); |
$widget->pack_start( $browse, FALSE, FALSE, 0); |
return $widget; |
} |
|
|
|
|
sub get_file_name_object { |
my ($object,$attribute1,$attribute2,$extension,$open_in)=@_; |
my $widget = def_hbox(FALSE,0); |
my $value=$object->object_get_attribute($attribute1,$attribute2); |
my $lable; |
if(defined $value){ |
my ($name,$path,$suffix) = fileparse("$value",qr"\..[^.]*$"); |
$lable=gen_label_in_center($name.$suffix); |
|
} else { |
$lable=gen_label_in_center("Selecet a $extension file"); |
$lable->set_markup("<span foreground= 'red' ><b>Selecet a sof file</b></span>"); |
} |
my $entry=gen_entry(); |
my $browse= get_file_name($object,undef,$entry,$attribute1,$attribute2,$extension,$lable,$open_in); |
$widget->pack_start( $lable, FALSE, FALSE, 0); |
$widget->pack_start( $browse, FALSE, FALSE, 0); |
return $widget; |
} |
|
################ |
# ADD info and label to widget |
################ |
|
|
sub labele_widget_info{ |
my ($label_name,$widget,$info)=@_; |
my $box = def_hbox(FALSE,0); |
#label |
if(defined $label_name){ |
my $label= gen_label_in_left($label_name); |
$box->pack_start( $label, FALSE, FALSE, 3); |
} |
$box->pack_start( $widget, FALSE, FALSE, 3); |
#info |
if(defined $info){ |
my $button=def_image_button("icons/help.png"); |
$button->signal_connect("clicked" => sub {message_dialog($info);}); |
$box->pack_start( $button, FALSE, FALSE, 3); |
} |
$box->show_all; |
return $box; |
} |
|
|
|
|
################ |
# general |
################# |
|