OpenCores
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

[/] [an-fpga-implementation-of-low-latency-noc-based-mpsoc/] [trunk/] [mpsoc/] [perl_gui/] [lib/] [perl/] [mpsoc_gen.pl] - Diff between revs 42 and 43

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 42 Rev 43
Line 1... Line 1...
#! /usr/bin/perl -w
#! /usr/bin/perl -w
use Glib qw/TRUE FALSE/;
use Glib qw/TRUE FALSE/;
use strict;
use strict;
use warnings;
use warnings;
 
use FindBin;
 
use lib $FindBin::Bin;
 
 
use mpsoc;
use mpsoc;
use soc;
use soc;
use ip;
use ip;
use interface;
use interface;
 
 
use POSIX 'strtol';
use POSIX 'strtol';
 
 
use File::Path;
use File::Path;
use File::Copy;
use File::Copy;
 
 
use Cwd 'abs_path';
use Cwd 'abs_path';
 
 
 
 
use Gtk2;
use Gtk2;
use Gtk2::Pango;
use Gtk2::Pango;
 
 
 
 
 
 
 
 
require "widget.pl";
require "widget.pl";
require "mpsoc_verilog_gen.pl";
require "mpsoc_verilog_gen.pl";
require "hdr_file_gen.pl";
require "hdr_file_gen.pl";
require "readme_gen.pl";
require "readme_gen.pl";
require "soc_gen.pl";
require "soc_gen.pl";
 
require "diagram.pl";
 
 
sub get_pos{
sub get_pos{
                my ($item,@list)=@_;
                my ($item,@list)=@_;
                my $pos=0;
                my $pos=0;
                foreach my $p (@list){
                foreach my $p (@list){
                                #print "$p eq $item\n";
                                #print "$p eq $item\n";
                                if ($p eq $item){return $pos;}
                                if ($p eq $item){return $pos;}
                                $pos++;
                                $pos++;
                }
                }
                return undef;
                return undef;
 
 
}
 
 
 
 
 
sub noc_param_widget{
 
         my ($mpsoc,$name,$param, $default,$type,$content,$info, $table,$row,$show,$attribut1,$ref_delay,$new_status)=@_;
 
         my $label =gen_label_in_left(" $name");
 
         my $widget;
 
         my $value=$mpsoc->object_get_attribute($attribut1,$param);
 
         if(! defined $value) {
 
                        $mpsoc->object_add_attribute($attribut1,$param,$default);
 
                        $mpsoc->object_add_attribute_order($attribut1,$param);
 
                        $value=$default;
 
         }
 
         if(! defined $new_status){
 
                $new_status='ref';
 
         }
 
         if ($type eq "Entry"){
 
                $widget=gen_entry($value);
 
                $widget-> signal_connect("changed" => sub{
 
                        my $new_param_value=$widget->get_text();
 
                        $mpsoc->object_add_attribute($attribut1,$param,$new_param_value);
 
                        set_gui_status($mpsoc,$new_status,$ref_delay) if(defined $ref_delay);
 
 
 
 
 
                });
 
 
 
 
 
         }
 
         elsif ($type eq "Combo-box"){
 
                 my @combo_list=split(",",$content);
 
                 my $pos=get_pos($value, @combo_list) if(defined $value);
 
                 if(!defined $pos){
 
                        $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";
 
                 $widget=gen_combo(\@combo_list, $pos);
 
                 $widget-> signal_connect("changed" => sub{
 
                 my $new_param_value=$widget->get_active_text();
 
                 $mpsoc->object_add_attribute($attribut1,$param,$new_param_value);
 
                 set_gui_status($mpsoc,$new_status,$ref_delay) if(defined $ref_delay);
 
 
 
 
 
                 });
 
 
 
         }
 
         elsif  ($type eq "Spin-button"){
 
                  my ($min,$max,$step)=split(",",$content);
 
                  $value=~ s/\D//g;
 
                  $min=~ s/\D//g;
 
                  $max=~ s/\D//g;
 
                  $step=~ s/\D//g;
 
                  $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();
 
                  $mpsoc->object_add_attribute($attribut1,$param,$new_param_value);
 
                  set_gui_status($mpsoc,$new_status,$ref_delay) if(defined $ref_delay);
 
 
 
                  });
 
 
 
                 # $box=def_label_spin_help_box ($param,$info, $value,$min,$max,$step, 2);
 
         }
 
 
 
        elsif ( $type eq "Check-box"){
 
                $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 ) {
 
                                $mpsoc->object_add_attribute($attribut1,$param,$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" ;}
 
                                }
 
                                $mpsoc->object_add_attribute($attribut1,$param,$new_val);
 
                                #print "\$new_val=$new_val\n";
 
                                set_gui_status($mpsoc,$new_status,$ref_delay) if(defined $ref_delay);
 
                        });
 
                }
                }
 
 
 
 
 
 
 
 
        }
 
        elsif ( $type eq "DIR_path"){
 
                        $widget =get_dir_in_object ($mpsoc,$attribut1,$param,$value,'ref',10);
 
                        set_gui_status($mpsoc,$new_status,$ref_delay) if(defined $ref_delay);
 
        }
 
 
 
 
 
 
 
        else {
 
                 $widget =gen_label_in_left("unsuported widget type!");
 
        }
 
 
 
        my $inf_bt= gen_button_message ($info,"icons/help.png");
 
        if($show==1){
 
                attach_widget_to_table ($table,$row,$label,$inf_bt,$widget);
 
                $row++;
 
        }
 
    return $row;
 
}
 
 
 
 
 
 
 
 
 
sub initial_default_param{
sub initial_default_param{
        my $mpsoc=shift;
        my $mpsoc=shift;
        my @socs=$mpsoc->mpsoc_get_soc_list();
        my @socs=$mpsoc->mpsoc_get_soc_list();
        foreach my $soc_name (@socs){
        foreach my $soc_name (@socs){
                my %param_value;
                my %param_value;
Line 202... Line 72...
 
 
        $path =~ s/ /\\ /g;
        $path =~ s/ /\\ /g;
        my @socs;
        my @socs;
        my @files = glob "$path/*.SOC";
        my @files = glob "$path/*.SOC";
        for my $p (@files){
        for my $p (@files){
 
       my ($soc,$r,$err) = regen_object($p);
                # Read
                # Read
                my  $soc = eval { do $p };
         if ($r){
                 if ($@ || !defined $soc){
            add_info(\$info,"**Error reading  $p file: $err\n");
                        add_info(\$info,"**Error reading  $p file: $@\n");
 
                         next;
                         next;
                }
                }
                my $top=$soc->soc_get_top();
                my $top=$soc->soc_get_top();
                if (defined $top){
                if (defined $top){
                        my @instance_list=$top->top_get_all_instances();
                        my @instance_list=$top->top_get_all_instances();
Line 224... Line 93...
                                        #print" $name\n";
                                        #print" $name\n";
                                }
                                }
                        }
                        }
 
 
                }
                }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
        }#files
        }#files
 
 
        # initial  default soc parameter
        # initial  default soc parameter
        initial_default_param($mpsoc);
        initial_default_param($mpsoc);
 
 
 
 
 
 
        return $mpsoc->mpsoc_get_soc_list;
        return $mpsoc->mpsoc_get_soc_list;
 
 
 
 
 
 
}
}
 
 
 
 
sub get_NI_instance_list {
sub get_NI_instance_list {
        my $top=shift;
        my $top=shift;
Line 357... Line 212...
 
 
                }else{message_dialog ("invalid range: [$p]" ); return; }
                }else{message_dialog ("invalid range: [$p]" ); return; }
 
 
        }
        }
        #check if range does not exceed the tile numbers
        #check if range does not exceed the tile numbers
        my $nx= $mpsoc->object_get_attribute('noc_param',"NX");
    my ($max_tile_num)=get_topology_info($mpsoc);
        my $ny= $mpsoc->object_get_attribute('noc_param',"NY");
 
 
 
        my $max_tile_num=$nx*$ny;
 
        my @f=sort { $a <=> $b }  @all_num;
        my @f=sort { $a <=> $b }  @all_num;
        my @l;
        my @l;
        foreach my $num (@f){
        foreach my $num (@f){
                push(@l,$num) if($num<$max_tile_num);
                push(@l,$num) if($num<$max_tile_num);
 
 
Line 395... Line 248...
                #save the entered ips
                #save the entered ips
                if( scalar @all_num>0){ $mpsoc->mpsoc_add_soc_tiles_num($name,\@all_num);}
                if( scalar @all_num>0){ $mpsoc->mpsoc_add_soc_tiles_num($name,\@all_num);}
                else {$mpsoc->mpsoc_add_soc_tiles_num($name,undef);}
                else {$mpsoc->mpsoc_add_soc_tiles_num($name,undef);}
                set_gui_status($mpsoc,"ref",1);
                set_gui_status($mpsoc,"ref",1);
        }
        }
 
 
 
 
 
 
}
}
 
 
 
 
 
 
 
 
#################
#################
# get_soc_parameter_setting
# get_soc_parameter_setting
################
################
 
 
sub get_soc_parameter_setting{
sub get_soc_parameter_setting{
Line 470... Line 318...
                                message_dialog($info);
                                message_dialog($info);
 
 
                        });
                        });
 
 
                }
                }
 
 
                        $row++;
                        $row++;
 
 
 
 
                }
                }
        }
        }
Line 607... Line 454...
 
 
        $browse->signal_connect("clicked"=> sub{
        $browse->signal_connect("clicked"=> sub{
                my $entry_ref=$_[1];
                my $entry_ref=$_[1];
                my $file;
                my $file;
 
 
 
 
 
 
 
 
 
 
        my $dialog = Gtk2::FileChooserDialog->new(
        my $dialog = Gtk2::FileChooserDialog->new(
                'Select tile directory', undef,
                'Select tile directory', undef,
                #               'open',
                #               'open',
                'select-folder',
                'select-folder',
                'gtk-cancel' => 'cancel',
                'gtk-cancel' => 'cancel',
Line 732... Line 575...
                $table->attach  ( $label , 2, 3, $row,$row+1 ,'fill','shrink',2,2);
                $table->attach  ( $label , 2, 3, $row,$row+1 ,'fill','shrink',2,2);
                $table->attach  ( $b1 , 0, 2, $row,$row+1,'fill','shrink',2,2);
                $table->attach  ( $b1 , 0, 2, $row,$row+1,'fill','shrink',2,2);
                $row++;
                $row++;
        }
        }
 
 
 
    my $coltmp=0;
 
 
        #Router type
        #Router type
        $label='Router Type';
        $label='Router Type';
        $param='ROUTER_TYPE';
        $param='ROUTER_TYPE';
        $default='"VC_BASED"';
        $default='"VC_BASED"';
        $content='"INPUT_QUEUED","VC_BASED"';
        $content='"INPUT_QUEUED","VC_BASED"';
        $type='Combo-box';
        $type='Combo-box';
    $info="    Input-queued: simple router with low performance and does not support fully adaptive routing.
    $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.";
    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, $table,$row,$show_noc,'noc_type',1);
    ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$show_noc,'noc_type',1);
        my $router_type=$mpsoc->object_get_attribute('noc_type',"ROUTER_TYPE");
        my $router_type=$mpsoc->object_get_attribute('noc_type',"ROUTER_TYPE");
 
 
        #topology
        #topology
        $label='Topology';
        $label='Topology';
        $param='TOPOLOGY';
        $param='TOPOLOGY';
        $default='"MESH"';
        $default='"MESH"';
        $content='"MESH","TORUS","RING","LINE"';
    $content='"MESH","TORUS","RING","LINE","FATTREE","TREE"';
        $type='Combo-box';
        $type='Combo-box';
    $info="NoC topology";
    $info="NoC topology";
        $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$show_noc,'noc_param',1);
    ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$show_noc,'noc_param',1);
 
 
        my $topology=$mpsoc->object_get_attribute('noc_param','TOPOLOGY');
        my $topology=$mpsoc->object_get_attribute('noc_param','TOPOLOGY');
 
 
        #Routers per row
    #topology T1 parameter
        $label= 'Routers per row';
    $label= ($topology eq '"FATTREE"' || $topology eq '"TREE"')? 'K' : 'Routers per row';
        $param= 'NX';
    $param= 'T1';
    $default=' 2';
    $default=' 2';
        $content=($topology eq '"MESH"' || $topology eq '"TORUS"') ? '2,16,1':'2,64,1';
    $content=($topology eq '"MESH"' || $topology eq '"TORUS"') ? '2,16,1':
    $info= 'Number of NoC routers in row (X dimention)';
        ($topology eq '"FATTREE"' || $topology eq '"TREE"' )? '2,6,1':'2,64,1';
 
    $info= ($topology eq '"FATTREE"' || $topology eq '"TREE"' )? 'number of last level individual router`s endpoints.' :'Number of NoC routers in row (X dimention)';
    $type= 'Spin-button';
    $type= 'Spin-button';
        $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$show_noc,'noc_param',1);
    ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$show_noc,'noc_param',1);
 
 
 
 
 
 
        #Routers per column
    #Topology T2 parameter
        if($topology eq '"MESH"' || $topology eq '"TORUS"') {
    if($topology eq '"MESH"' || $topology eq '"TORUS"' || $topology eq '"FATTREE"' || $topology eq '"TREE"' ) {
                $label= 'Routers per column';
        $label= ($topology eq '"FATTREE"' || $topology eq '"TREE"')?  'L' :'Routers per column';
                $param= 'NY';
        $param= 'T2';
            $default=' 2';
            $default=' 2';
                $content='2,16,1';
                $content='2,16,1';
            $info= 'Number of NoC routers in column (Y dimention)';
        $info= ($topology eq '"FATTREE"' || $topology eq '"TREE"')? 'Fattree layer number (The height of FT)':'Number of NoC routers in column (Y dimention)';
            $type= 'Spin-button';
            $type= 'Spin-button';
                $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$show_noc,'noc_param',1);
        ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$show_noc,'noc_param',1);
        } else {
        } else {
                $mpsoc->object_add_attribute('noc_param','NY',1);
        $mpsoc->object_add_attribute('noc_param','T2',1);
 
    }
 
 
 
    #Topology T3 parameter
 
    if($topology eq '"MESH"' || $topology eq '"TORUS"' || $topology eq '"RING"' || $topology eq '"LINE"') {
 
        $label="Router's endpoint number";
 
                $param= 'T3';
 
        $default='1';
 
        $content='1,4,1';
 
        $info= "In $topology topology, each router can have up to 4 endpoint processing tile.";
 
        $type= 'Spin-button';
 
        ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$show_noc,'noc_param',1);
        }
        }
 
 
        #VC number per port
        #VC number per port
        if($router_type eq '"VC_BASED"'){
        if($router_type eq '"VC_BASED"'){
                my $v=$mpsoc->object_get_attribute('noc_param','V');
                my $v=$mpsoc->object_get_attribute('noc_param','V');
Line 789... Line 645...
                $param='V';
                $param='V';
                $default='2';
                $default='2';
                $type='Spin-button';
                $type='Spin-button';
                $content='2,16,1';
                $content='2,16,1';
                $info='Number of Virtual Channel per each router port';
                $info='Number of Virtual Channel per each router port';
                $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$show_noc,'noc_param',1);
        ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$show_noc,'noc_param',1);
        } else {
        } else {
                $mpsoc->object_add_attribute('noc_param','V',1);
                $mpsoc->object_add_attribute('noc_param','V',1);
                $mpsoc->object_add_attribute('noc_param','C',0);
                $mpsoc->object_add_attribute('noc_param','C',0);
        }
        }
 
 
Line 802... Line 658...
        $param='B';
        $param='B';
    $default='4';
    $default='4';
    $content='2,256,1';
    $content='2,256,1';
    $type='Spin-button';
    $type='Spin-button';
        $info=($router_type eq '"VC_BASED"')?  'Buffer queue size per VC in flits' : 'Buffer queue size in flits';
        $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, $table,$row,$show_noc,'noc_param',undef);
    ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$show_noc,'noc_param',undef);
 
 
        #packet payload width
        #packet payload width
        $label='Payload width';
        $label='Payload width';
        $param='Fpay';
        $param='Fpay';
        $default='32';
        $default='32';
        $content='32,256,32';
        $content='32,256,32';
        $type='Spin-button';
        $type='Spin-button';
    $info="The packet payload width in bits";
    $info="The packet payload width in bits";
        $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info,$table,$row,$show_noc,'noc_param',undef);
    ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info,$table,$row,undef,$show_noc,'noc_param',undef);
 
 
 
 
        #routing algorithm
        #routing algorithm
        $label='Routing Algorithm';
        $label='Routing Algorithm';
        $param="ROUTE_NAME";
        $param="ROUTE_NAME";
        $type="Combo-box";
        $type="Combo-box";
        if($router_type eq '"VC_BASED"'){
        if($router_type eq '"VC_BASED"'){
                $content=($topology eq '"MESH"')?  '"XY","WEST_FIRST","NORTH_LAST","NEGETIVE_FIRST","ODD_EVEN","DUATO"' :
                $content=($topology eq '"MESH"')?  '"XY","WEST_FIRST","NORTH_LAST","NEGETIVE_FIRST","ODD_EVEN","DUATO"' :
                                 ($topology eq '"TORUS"')? '"TRANC_XY","TRANC_WEST_FIRST","TRANC_NORTH_LAST","TRANC_NEGETIVE_FIRST","TRANC_DUATO"':
                                 ($topology eq '"TORUS"')? '"TRANC_XY","TRANC_WEST_FIRST","TRANC_NORTH_LAST","TRANC_NEGETIVE_FIRST","TRANC_DUATO"':
                                 ($topology eq '"RING"')? '"TRANC_XY"' : '"XY"';
                 ($topology eq '"RING"')? '"TRANC_XY"' :
 
                 ($topology eq '"LINE"')?  '"XY"':
 
                 ($topology eq '"FATTREE"')? '"NCA_RND_UP","NCA_STRAIGHT_UP","NCA_DST_UP"':
 
                 ($topology eq '"TREE"')? '"NCA"' : '"UNKNOWN"';
        }else{
        }else{
                $content=($topology eq '"MESH"')?  '"XY","WEST_FIRST","NORTH_LAST","NEGETIVE_FIRST","ODD_EVEN"' :
                $content=($topology eq '"MESH"')?  '"XY","WEST_FIRST","NORTH_LAST","NEGETIVE_FIRST","ODD_EVEN"' :
                                 ($topology eq '"TORUS"')? '"TRANC_XY","TRANC_WEST_FIRST","TRANC_NORTH_LAST","TRANC_NEGETIVE_FIRST"':
                                 ($topology eq '"TORUS"')? '"TRANC_XY","TRANC_WEST_FIRST","TRANC_NORTH_LAST","TRANC_NEGETIVE_FIRST"':
                                 ($topology eq '"RING"')? '"TRANC_XY"' : '"XY"';
                 ($topology eq '"RING"')? '"TRANC_XY"' :
 
                                 ($topology eq '"LINE"')?  '"XY"':
 
                 ($topology eq '"FATTREE"')? '"NCA_RND_UP","NCA_STRAIGHT_UP","NCA_DST_UP"' :
 
                                 ($topology eq '"TREE"')? '"NCA"' : '"UNKNOWN"';
 
 
        }
        }
        $default=($topology eq '"MESH"' || $topology eq '"LINE"' )?  '"XY"':'"TRANC_XY"';
    $default=($topology eq '"MESH"' || $topology eq '"LINE"' )? '"XY"':
        $info="Select the routing algorithm: XY(DoR) , partially adaptive (Turn models). Fully adaptive (Duato) ";
                 ($topology eq '"TORUS"'|| $topology eq '"RING"')?  '"TRANC_XY"' :
        $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$show_noc,'noc_param',1);
                 ($topology eq '"FATTREE"')? '"NCA_STRAIGHT_UP"' :
 
                 ($topology eq '"TREE"')? '"NCA"' : '"UNKNOWN"';
 
 
 
    my $info_mesh="Select the routing algorithm: XY(DoR) , partially adaptive (Turn models). Fully adaptive (Duato) ";
 
    my $info_fat="Nearest common ancestor (NCA) where the up port is selected randomly (RND), based on destination endpoint address (DST) or it is the top port that is located in front of the the port which has received the packet (STRAIGHT) ";
 
 
 
    $info=($topology eq '"FATTREE"')? $info_fat :
 
          ($topology eq '"TREE"') ? "Nearest common ancestor": $info_mesh;
 
 
 
    ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$show_noc,'noc_param',1);
 
 
 
 
 
        #MIN_PCK_SIZE 
 
        # 2 //minimum packet size in flits. The minimum value is 1. 
 
        $label='Minimum packet size';
 
    $param='MIN_PCK_SIZE';
 
    $default='2';
 
    $content='1,65535,1';
 
    $type='Spin-button';
 
    $info="The minimum packet size in flits. In atomic VC re-allocation, it is just important to define if the single-flit sized packets are allowed to be injected to the NoC by defining this parameter value as one.  Setting any larger value than one results in the same architecture and the NoC works correctly even if it receives smaller packets size as while as they are not single flit -sized packets.  However, for non-atomic VC reallocation NoCs, you have to define the exact value as it defines the NoC control registers' internal buffers. The NoC may crash once it receives  packets having smaler size than the defined  minimum packet size.";
 
    ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$show_noc,'noc_param',undef);
 
 
 
 
        #SSA
        #SSA
        $label='SSA Ebable';
        $label='SSA Ebable';
        $param='SSA_EN';
        $param='SSA_EN';
        $default='"NO"';
        $default='"NO"';
        $content='"YES","NO"';
        $content='"YES","NO"';
        $type='Combo-box';
        $type='Combo-box';
        $info="Enable single cycle latency on packets traversing in the same direction using static straight allocator (SSA)";
        $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',undef);
    ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$show_noc,'noc_param',undef);
 
 
 
 
 
 
 
 
        if($show_noc == 1){
        if($show_noc == 1){
Line 879... Line 758...
        $type="Spin-button";
        $type="Spin-button";
        $content="0,12,1";
        $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";
        $info="Congestion index determines how congestion information is collected from neighboring routers. Please refer to the usere manual for more information";
        $default=3;
        $default=3;
        if($route ne '"XY"' and $route ne '"TRANC_XY"' ){
        if($route ne '"XY"' and $route ne '"TRANC_XY"' ){
                $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'noc_param',undef);
           ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$adv_set,'noc_param',undef);
        } else {
        } else {
                $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,0,'noc_param',undef);
        ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,0,'noc_param',undef);
        }
        }
 
 
        #Fully adaptive routing setting
        #Fully adaptive routing setting
        my $v=$mpsoc->object_get_attribute('noc_param',"V");
        my $v=$mpsoc->object_get_attribute('noc_param',"V");
        $label="Select Escap VC";
        $label="Select Escap VC";
Line 895... Line 774...
        $default="$v\'b";
        $default="$v\'b";
        for (my $i=1; $i<=$v-1; $i++){$default=  "${default}0";}
        for (my $i=1; $i<=$v-1; $i++){$default=  "${default}0";}
        $default=  "${default}1";
        $default=  "${default}1";
        $info="Select the escap VC for fully adaptive routing.";
        $info="Select the escap VC for fully adaptive routing.";
        if( $route eq '"TRANC_DUATO"' or $route eq '"DUATO"'  ){
        if( $route eq '"TRANC_DUATO"' or $route eq '"DUATO"'  ){
                 $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set, 'noc_param',undef);
           ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$adv_set, 'noc_param',undef);
         }
         }
        else{
        else{
                 $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,0, 'noc_param',undef);
         ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,0, 'noc_param',undef);
        }
        }
 
 
        # VC reallocation type
        # VC reallocation type
        $label=($router_type eq '"VC_BASED"')? 'VC reallocation type': 'Queue reallocation type';
        $label=($router_type eq '"VC_BASED"')? 'VC reallocation type': 'Queue reallocation type';
        $param='VC_REALLOCATION_TYPE';
        $param='VC_REALLOCATION_TYPE';
    $info="VC reallocation type: If set as atomic only empty VCs can be allocated for new packets. Whereas, in non-atomic a non-empty VC which has received the last packet tail flit can accept a new  packet";
    $info="VC reallocation type: If set as atomic only empty VCs can be allocated for new packets. Whereas, in non-atomic a non-empty VC which has received the last packet tail flit can accept a new  packet";
    $default='"NONATOMIC"';
    $default='"NONATOMIC"';
    $content='"ATOMIC","NONATOMIC"';
    $content='"ATOMIC","NONATOMIC"';
    $type='Combo-box';
    $type='Combo-box';
    $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'noc_param',undef);
    ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$adv_set,'noc_param',undef);
 
 
 
 
        #vc/sw allocator type
        #vc/sw allocator type
        $label = 'VC/SW combination type';
        $label = 'VC/SW combination type';
        $param='COMBINATION_TYPE';
        $param='COMBINATION_TYPE';
    $default='"COMB_NONSPEC"';
    $default='"COMB_NONSPEC"';
    $content='"BASELINE","COMB_SPEC1","COMB_SPEC2","COMB_NONSPEC"';
    $content='"BASELINE","COMB_SPEC1","COMB_SPEC2","COMB_NONSPEC"';
    $type='Combo-box';
    $type='Combo-box';
    $info="The joint VC/ switch allocator type. using canonical combination is not recommanded";
    $info="The joint VC/ switch allocator type. using canonical combination is not recommanded";
        if ($router_type eq '"VC_BASED"'){
        if ($router_type eq '"VC_BASED"'){
            $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'noc_param',undef);
        ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$adv_set,'noc_param',undef);
        } else{
        } else{
                 $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,0,'noc_param',undef);
         ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,0,'noc_param',undef);
        }
        }
 
 
        # Crossbar mux type 
        # Crossbar mux type 
        $label='Crossbar mux type';
        $label='Crossbar mux type';
        $param='MUX_TYPE';
        $param='MUX_TYPE';
        $default='"BINARY"';
        $default='"BINARY"';
        $content='"ONE_HOT","BINARY"';
        $content='"ONE_HOT","BINARY"';
        $type='Combo-box';
        $type='Combo-box';
        $info="Crossbar multiplexer type";
        $info="Crossbar multiplexer type";
    $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'noc_param',undef);
    ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$adv_set,'noc_param',undef);
 
 
    #class   
    #class   
        if($router_type eq '"VC_BASED"'){
        if($router_type eq '"VC_BASED"'){
                $label='class number';
                $label='class number';
                $param='C';
                $param='C';
                $default= 0;
                $default= 0;
                $info='Number of message classes. Each specific class can use different set of VC';
                $info='Number of message classes. Each specific class can use different set of VC';
                $content='0,16,1';
                $content='0,16,1';
            $type='Spin-button';
            $type='Spin-button';
            $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'noc_param',5);
        ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$adv_set,'noc_param',5);
 
 
 
 
                my $class=$mpsoc->object_get_attribute('noc_param',"C");
                my $class=$mpsoc->object_get_attribute('noc_param',"C");
                my $v=$mpsoc->object_get_attribute('noc_param',"V");
                my $v=$mpsoc->object_get_attribute('noc_param',"V");
                $default= "$v\'b";
                $default= "$v\'b";
Line 958... Line 837...
                         $label="Class $i Permitted VCs";
                         $label="Class $i Permitted VCs";
                         $param="Cn_$i";
                         $param="Cn_$i";
                         $type="Check-box";
                         $type="Check-box";
                         $content=$v;
                         $content=$v;
                         $info="Select the permitted VCs which the message class $i can be sent via them.";
                         $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, $table,$row,$adv_set,'class_param',undef);
               ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$adv_set,'class_param',undef);
                }
                }
 
 
        }#($router_type eq '"VC_BASED"')
        }#($router_type eq '"VC_BASED"')
 
 
 
 
Line 972... Line 851...
        $param='DEBUG_EN';
        $param='DEBUG_EN';
    $info= "Add extra verilog code for debuging NoC for simulation";
    $info= "Add extra verilog code for debuging NoC for simulation";
        $default='0';
        $default='0';
        $content='0,1';
        $content='0,1';
        $type='Combo-box';
        $type='Combo-box';
        $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'noc_param');
    ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$adv_set,'noc_param');
 
 
 
 
        #pipeline reg   
        #pipeline reg   
        $label="Add pipeline reg after crossbar";
        $label="Add pipeline reg after crossbar";
        $param="ADD_PIPREG_AFTER_CROSSBAR";
        $param="ADD_PIPREG_AFTER_CROSSBAR";
        $type="Check-box";
        $type="Check-box";
        $content=1;
        $content=1;
        $default="1\'b0";
        $default="1\'b0";
        $info="If enabeled it adds a pipline register at the output port of the router.";
        $info="If enabeled it adds a pipline register at the output port of the router.";
        $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'noc_param');
    ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$adv_set,'noc_param');
 
 
 
 
        #MAX_SBP_NUM = 4 // 
        #MAX_SBP_NUM = 4 // 
        $label="Number of multiple router bypassing ";
        $label="Number of multiple router bypassing ";
        $param="MAX_SBP_NUM ";
        $param="MAX_SBP_NUM ";
        $type='Spin-button';
        $type='Spin-button';
        $content='0,1,1';
        $content='0,1,1';
        $default=0;
        $default=0;
        $info="maximum number of routers which a packet can by pass during one clock cycle. Define it as zero will disable bypassing.";
        $info="maximum number of routers which a packet can by pass during one clock cycle. Define it as zero will disable bypassing.";
        #$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'noc_param');
    #($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'noc_param');
 
 
 
 
        #FIRST_ARBITER_EXT_P_EN
        #FIRST_ARBITER_EXT_P_EN
        $label='Swich allocator first level
        $label='Swich allocator first level
arbiters external priority enable';
arbiters external priority enable';
        $param='FIRST_ARBITER_EXT_P_EN';
        $param='FIRST_ARBITER_EXT_P_EN';
        $default= 1;
        $default= 1;
        $info='If set as 1 then the switch allocator\'s input (first) arbiters\' priority registers are enabled only when a request get both input and output arbiters\' grants';
        $info='If set as 1 then the switch allocator\'s input (first) arbiters\' priority registers are enabled only when a request get both input and output arbiters\' grants';
        $content='0,1';
        $content='0,1';
        $type="Combo-box";
        $type="Combo-box";
        $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info,$table,$row,$adv_set,'noc_param');
    ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info,$table,$row,undef,$adv_set,'noc_param');
 
 
 
 
        #Arbiter type
        #Arbiter type
        $label='SW allocator arbitration type';
        $label='SW allocator arbitration type';
        $param='SWA_ARBITER_TYPE';
        $param='SWA_ARBITER_TYPE';
Line 1016... Line 895...
        $type='Combo-box';
        $type='Combo-box';
    $info="Switch allocator arbitertion type:
    $info="Switch allocator arbitertion type:
    RRA: Round robin arbiter. Only local fairness in a router.
    RRA: Round robin arbiter. Only local fairness in a router.
    WRRA: Weighted round robin arbiter. Results in global fairness in the NoC.
    WRRA: Weighted round robin arbiter. Results in global fairness in the NoC.
          Switch allocation requests are grated acording to their weight which increases due to contention";
          Switch allocation requests are grated acording to their weight which increases due to contention";
        $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'noc_param',1);
    ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$adv_set,'noc_param',1);
 
 
 
 
 
 
    my $arbiter=$mpsoc->object_get_attribute('noc_param',"SWA_ARBITER_TYPE");
    my $arbiter=$mpsoc->object_get_attribute('noc_param',"SWA_ARBITER_TYPE");
    my $wrra_show = ($arbiter ne  '"RRA"' && $adv_set == 1 )? 1 : 0;
    my $wrra_show = ($arbiter ne  '"RRA"' && $adv_set == 1 )? 1 : 0;
Line 1029... Line 908...
        $param='WEIGHTw';
        $param='WEIGHTw';
        $default='4';
        $default='4';
        $content='2,7,1';
        $content='2,7,1';
        $info= 'Maximum weight width';
        $info= 'Maximum weight width';
        $type= 'Spin-button';
        $type= 'Spin-button';
        $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$wrra_show,'noc_param',undef);
    ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,$wrra_show,'noc_param',undef);
 
 
        #WRRA_CONFIG_INDEX
        #WRRA_CONFIG_INDEX
        $label='Weight configuration index';
        $label='Weight configuration index';
        $param='WRRA_CONFIG_INDEX';
        $param='WRRA_CONFIG_INDEX';
        $default='0';
        $default='0';
        $content='0,7,1';
        $content='0,7,1';
        $info= 'WRRA_CONFIG_INDEX:
        $info= 'WRRA_CONFIG_INDEX:
 
 
';
';
        $type= 'Spin-button';
        $type= 'Spin-button';
        #$row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$wrra_show,'noc_param',undef);  
    #($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$wrra_show,'noc_param',undef);  
 
 
 
 
 
 
        if($adv_set == 1){
        if($adv_set == 1){
                $advc= def_image_button("icons/up.png","Advance Parameters");
                $advc= def_image_button("icons/up.png","Advance Parameters");
Line 1059... Line 938...
 
 
 
 
        #other fixed parameters       
        #other fixed parameters       
 
 
 
 
 
 
 
 
 
 
 
 
 
 
        # AVC_ATOMIC_EN
        # AVC_ATOMIC_EN
        $label='AVC_ATOMIC_EN';
        $label='AVC_ATOMIC_EN';
        $param='AVC_ATOMIC_EN';
        $param='AVC_ATOMIC_EN';
        $default= 0;
        $default= 0;
        $info='AVC_ATOMIC_EN';
        $info='AVC_ATOMIC_EN';
        $content='0,1';
        $content='0,1';
        $type="Combo-box";
        $type="Combo-box";
        $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,0,'noc_param');
    ($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,0,'noc_param');
 
 
 
 
        #ROUTE_SUBFUNC
        #ROUTE_SUBFUNC
        $label='ROUTE_SUBFUNC';
    #$label='ROUTE_SUBFUNC';
        $param='ROUTE_SUBFUNC';
    #$param='ROUTE_SUBFUNC';
        $default= '"XY"';
    #$default= '"XY"';
        $info='ROUTE_SUBFUNC';
    #$info='ROUTE_SUBFUNC'; 
        $content='"XY"';
    #$content='"XY"';
        $type="Combo-box";
    #$type="Combo-box";
        $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,0,'noc_param');
    #($row,$coltmp)=add_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,undef,0,'noc_param');
 
 
        return $row;
        return $row;
}
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
#######################
#######################
#   get_config
#   get_config
######################
######################
 
 
sub get_config{
sub get_config{
Line 1120... Line 976...
 
 
        #noc_setting
        #noc_setting
        my $row=noc_config ($mpsoc,$table);
        my $row=noc_config ($mpsoc,$table);
 
 
 
 
        #tile setting 
    #tiles setting 
        my $tile_set;
        my $tile_set;
        my $show=$mpsoc->object_get_attribute('setting','show_tile_setting');
        my $show=$mpsoc->object_get_attribute('setting','show_tile_setting');
 
 
        if($show == 0){
        if($show == 0){
                $tile_set= def_image_button("icons/down.png","Tiles setting");
                $tile_set= def_image_button("icons/down.png","Tiles setting");
                $table->attach ( $tile_set , 0, 2, $row,$row+1,'fill','shrink',2,2);
                $table->attach ( $tile_set , 0, 2, $row,$row+1,'fill','shrink',2,2);
                $row++;
                $row++;
 
 
        }
        }
 
 
 
 
 
 
 
 
 
 
        $row=defualt_tilles_setting($mpsoc,$table,$show,$row,$info);
        $row=defualt_tilles_setting($mpsoc,$table,$show,$row,$info);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
        #end tile setting
        #end tile setting
        if($show == 1){
        if($show == 1){
                $tile_set= def_image_button("icons/up.png","Tiles setting");
                $tile_set= def_image_button("icons/up.png","Tiles setting");
                $table->attach ( $tile_set , 0, 2, $row,$row+1,'fill','shrink',2,2);
                $table->attach ( $tile_set , 0, 2, $row,$row+1,'fill','shrink',2,2);
                $row++;
                $row++;
Line 1166... Line 1012...
        #for(my $i=$row; $i<25; $i++){
        #for(my $i=$row; $i<25; $i++){
                #my $empty_col=gen_label_in_left(' ');
                #my $empty_col=gen_label_in_left(' ');
                #$table->attach_defaults ($empty_col , 0, 1, $i,$i+1);
                #$table->attach_defaults ($empty_col , 0, 1, $i,$i+1);
 
 
        #}
        #}
 
 
 
 
 
 
 
 
 
 
 
 
return  $table;
return  $table;
 
 
}
}
 
 
 
 
#############
#############
#
#  gen_all_tiles
###########
###########
 
 
 
 
 
 
 
 
sub gen_all_tiles{
sub gen_all_tiles{
        my ($mpsoc,$info, $hw_dir,$sw_dir)=@_;
        my ($mpsoc,$info, $hw_dir,$sw_dir)=@_;
        my $nx= $mpsoc->object_get_attribute('noc_param',"NX");
    my ($NE, $NR, $RAw, $EAw, $Fw)=get_topology_info($mpsoc);
        my $ny= $mpsoc->object_get_attribute('noc_param',"NY");
 
        my $mpsoc_name=$mpsoc->object_get_attribute('mpsoc_name');
        my $mpsoc_name=$mpsoc->object_get_attribute('mpsoc_name');
        my $target_dir  = "$ENV{'PRONOC_WORK'}/MPSOC/$mpsoc_name";
        my $target_dir  = "$ENV{'PRONOC_WORK'}/MPSOC/$mpsoc_name";
 
 
 
 
 
 
        #remove old rtl files that were copied by ProNoC
 
        my $old_file_ref= eval { do "$hw_dir/file_list" };
 
        if (defined $old_file_ref){
 
                remove_file_and_folders($old_file_ref,$target_dir);
 
        }
 
        my @generated_tiles;
        my @generated_tiles;
        unlink "$hw_dir/file_list";
    for (my $tile_num=0;$tile_num<$NE;$tile_num++){
 
 
        #print "nx=$nx,ny=$ny\n";
 
        for (my $y=0;$y<$ny;$y++){for (my $x=0; $x<$nx;$x++){
 
 
 
                my $tile_num= $y*$nx+$x;
 
                #print "$tile_num\n";
                #print "$tile_num\n";
                my ($soc_name,$num)= $mpsoc->mpsoc_get_tile_soc_name($tile_num);
                my ($soc_name,$num)= $mpsoc->mpsoc_get_tile_soc_name($tile_num);
                next if(!defined $soc_name);
                next if(!defined $soc_name);
 
 
 
 
                my $path=$mpsoc->object_get_attribute('setting','soc_path');
                my $path=$mpsoc->object_get_attribute('setting','soc_path');
                $path=~ s/ /\\ /g;
                $path=~ s/ /\\ /g;
                my $p = "$path/$soc_name.SOC";
                my $p = "$path/$soc_name.SOC";
                my  $soc = eval { do $p };
            my ($soc,$r,$err) = regen_object($p);
                if ($@ || !defined $soc){
        if ($r){
                        show_info(\$info,"**Error reading  $p file: $@\n");
            show_info(\$info,"**Error reading  $p file: $err\n");
                       next;
                       next;
                }
                }
 
 
                #update core id
                #update core id
                $soc->object_add_attribute('global_param','CORE_ID',$tile_num);
                $soc->object_add_attribute('global_param','CORE_ID',$tile_num);
Line 1237... Line 1062...
                my $sw_path     = "$sw_dir/tile$tile_num";
                my $sw_path     = "$sw_dir/tile$tile_num";
                #print "$sw_path\n";
                #print "$sw_path\n";
                if( grep (/^$soc_name$/,@generated_tiles)){ # This soc is generated before only create the software file
                if( grep (/^$soc_name$/,@generated_tiles)){ # This soc is generated before only create the software file
                        generate_soc($soc,$info,$target_dir,$hw_dir,$sw_path,0,0);
                        generate_soc($soc,$info,$target_dir,$hw_dir,$sw_path,0,0);
                }else{
                }else{
                        generate_soc($soc,$info,$target_dir,$hw_dir,$sw_path,0,1);
            generate_soc($soc,$info,$target_dir,$hw_dir,$sw_path,0,1,"merge");
                        move ("$hw_dir/$soc_name.v","$hw_dir/tiles/");
                        move ("$hw_dir/$soc_name.v","$hw_dir/tiles/");
                        my @tmp= ("$hw_dir/tiles/$soc_name.v");
                        my @tmp= ("$hw_dir/tiles/$soc_name.v");
                        add_to_project_file_list(\@tmp,"$hw_dir/tiles",$hw_dir);
                        add_to_project_file_list(\@tmp,"$hw_dir/tiles",$hw_dir);
 
 
                }
                }
 
    }#$tile_num
 
 
        }}
 
 
 
 
 
}
}
 
 
 
 
Line 1363... Line 1186...
        get_soc_list($mpsoc,$info);
        get_soc_list($mpsoc,$info);
 
 
}
}
 
 
 
 
 
 
 
 
################
################
#       generate_mpsoc
#       generate_mpsoc
#################
#################
 
 
sub generate_mpsoc{
sub generate_mpsoc{
        my ($mpsoc,$info,$show_sucess_msg)=@_;
        my ($mpsoc,$info,$show_sucess_msg)=@_;
        my $name=$mpsoc->object_get_attribute('mpsoc_name');
        my $name=$mpsoc->object_get_attribute('mpsoc_name');
        my $error = check_verilog_identifier_syntax($name);
        my $error = check_verilog_identifier_syntax($name);
        if ( defined $error ){
        if ( defined $error ){
                message_dialog("The \"$name\" is given with an unacceptable formatting. The mpsoc name will be used as top level verilog module name so it must follow Verilog identifier declaration formatting:\n $error");
        #message_dialog("The \"$name\" is given with an unacceptable formatting. The mpsoc name will be used as top level verilog module name so it must follow Verilog identifier declaration formatting:\n $error");
 
        my $message = "The \"$name\" is given with an unacceptable formatting. The mpsoc name will be used as top level verilog module name so it must follow Verilog identifier declaration formatting:\n $error";
 
        add_colored_info(\$info, $message,'red' );
                return 0;
                return 0;
        }
        }
        my $size= (defined $name)? length($name) :0;
        my $size= (defined $name)? length($name) :0;
        if ($size ==0) {
        if ($size ==0) {
                message_dialog("Please define the MPSoC name!");
                message_dialog("Please define the MPSoC name!");
Line 1387... Line 1214...
        my $dir = Cwd::getcwd();
        my $dir = Cwd::getcwd();
        my $target_dir  = "$ENV{'PRONOC_WORK'}/MPSOC/$name";
        my $target_dir  = "$ENV{'PRONOC_WORK'}/MPSOC/$name";
        my $hw_dir      = "$target_dir/src_verilog";
        my $hw_dir      = "$target_dir/src_verilog";
        my $sw_dir      = "$target_dir/sw";
        my $sw_dir      = "$target_dir/sw";
 
 
 
    # rmtree ($hw_dir);
 
        mkpath("$hw_dir",1,01777);
        mkpath("$hw_dir/lib/",1,0755);
        mkpath("$hw_dir/lib/",1,0755);
        mkpath("$hw_dir/tiles",1,0755);
        mkpath("$hw_dir/tiles",1,0755);
        mkpath("$sw_dir",1,0755);
        mkpath("$sw_dir",1,0755);
 
 
 
 
 
    #remove old rtl files that were copied by ProNoC
 
    my ($old_file_ref,$r,$err) = regen_object("$hw_dir/file_list");
 
    if (defined $old_file_ref){
 
        remove_file_and_folders($old_file_ref,$target_dir);
 
    }
 
 
 
    unlink "$hw_dir/file_list";
 
 
 
 
 
 
        #generate/copy all tiles HDL/SW codes
        #generate/copy all tiles HDL/SW codes
        gen_all_tiles($mpsoc,$info, $hw_dir,$sw_dir );
        gen_all_tiles($mpsoc,$info, $hw_dir,$sw_dir );
 
 
        #copy all NoC HDL files
    #generate header file containig the tiles physical addresses
 
    gen_tiles_physical_addrsses_header_file($mpsoc,"$sw_dir/phy_addr.h");
 
 
 
    #copy all NoC HDL files    
        my @files = glob( "$dir/../src_noc/*.v" );
        my @files = glob( "$dir/../src_noc/*.v" );
        copy_file_and_folders(\@files,$dir,"$hw_dir/lib/");
        copy_file_and_folders(\@files,$dir,"$hw_dir/lib/");
 
    add_to_project_file_list(\@files,"$hw_dir/lib/",$hw_dir);
 
 
 
 
        my ($file_v,$top_v)=mpsoc_generate_verilog($mpsoc,$sw_dir);
        my ($file_v,$top_v)=mpsoc_generate_verilog($mpsoc,$sw_dir);
 
 
 
 
 
 
        # Write object file
        # Write object file
Line 1420... Line 1259...
        open(FILE,  ">lib/verilog/${name}_top.v") || die "Can not open: $!";
        open(FILE,  ">lib/verilog/${name}_top.v") || die "Can not open: $!";
        print FILE "$l\n$top_v";
        print FILE "$l\n$top_v";
        close(FILE) || die "Error closing file: $!";
        close(FILE) || die "Error closing file: $!";
 
 
 
 
 
 
 
 
    #gen_socs($mpsoc,$info);
    #gen_socs($mpsoc,$info);
    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/${name}_top.v","$target_dir/src_verilog/");
 
 
 
 
    #generate makefile
    #generate makefile
    open(FILE,  ">$sw_dir/Makefile") || die "Can not open: $!";
    open(FILE,  ">$sw_dir/Makefile") || die "Can not open: $!";
        print FILE mpsoc_sw_make();
        print FILE mpsoc_sw_make();
        close(FILE) || die "Error closing file: $!";
        close(FILE) || die "Error closing file: $!";
 
 
        #generate prog_mem
        #generate prog_mem
    open(FILE,  ">$sw_dir/program.sh") || die "Can not open: $!";
    open(FILE,  ">$sw_dir/program.sh") || die "Can not open: $!";
        print FILE mpsoc_mem_prog();
        print FILE mpsoc_mem_prog();
        close(FILE) || die "Error closing file: $!";
        close(FILE) || die "Error closing file: $!";
 
 
 
    my @ff= ("$target_dir/src_verilog/$name.v","$target_dir/src_verilog/${name}_top.v");
 
    add_to_project_file_list(\@ff,"$hw_dir/lib/",$hw_dir);
 
 
    message_dialog("MPSoC \"$name\" has been created successfully at $target_dir/ " ) if($show_sucess_msg);
    message_dialog("MPSoC \"$name\" has been created successfully at $target_dir/ " ) if($show_sucess_msg);
 
 
 
 
 
 
return 1;
return 1;
}
}
 
 
sub mpsoc_sw_make {
sub mpsoc_sw_make {
         my $make='
     my $make="SUBDIRS := \$(wildcard */.)
 SUBDIRS := $(wildcard */.)
all: \$(SUBDIRS)
 all: $(SUBDIRS)
\$(SUBDIRS):
 $(SUBDIRS):
\t\$(MAKE) -C \$@
        $(MAKE) -C $@
 
 
 
 .PHONY: all $(SUBDIRS)
.PHONY: all \$(SUBDIRS)
 
 
 clean:
 clean:
        $(MAKE) -C $(CODE_DIR) clean
\t\$(MAKE) -C \$(CODE_DIR) clean
';
";
return $make;
return $make;
 
 
}
}
 
 
 
 
Line 1546... Line 1383...
 
 
}
}
 
 
 
 
 
 
 
 
##########
 
#
 
#########
 
 
 
sub gen_tiles_LIST{
 
        my ($mpsoc)=@_;
 
 
 
        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)=@_;
 
        my $scrolled_win = new Gtk2::ScrolledWindow (undef, undef);
 
        $scrolled_win->set_policy( "automatic", "automatic" );
 
        $scrolled_win->add_with_viewport($table);
 
 
 
 
 
    my @titles=("IP_num(x,y)","Instance name","IP module name","setting");
 
        my $col=0;
 
    my $row=0;
 
        foreach my$p(@titles){
 
                my $label=gen_label_in_left($p);
 
            $table->attach_defaults ($label, $col, $col+1 , $row, $row+1);$col++;
 
                my $sepv = Gtk2::VSeparator->new;
 
                $table->attach_defaults ($sepv, $col , $col+1 ,0 , 2*($nx*$ny)+2 );$col++;
 
 
 
        }$row+=2;
 
 
 
 
 
        $col=0;
 
        for (my $y=0;$y<$ny;$y++){
 
 
 
 
 
 
 
                for (my $x=0; $x<$nx;$x++){
 
                        my $soc_num= $y*$nx+$x;
 
                        my $seph = Gtk2::HSeparator->new;
 
                        $table->attach_defaults ($seph, 0, 8 , $row, $row+1);$row++;
 
                        get_tile($mpsoc,$x,$y,$soc_num,$row,$table);$row++;
 
 
 
 
 
 
 
 
 
        }}
 
        my $seph = Gtk2::HSeparator->new;
 
        $table->attach_defaults ($seph, 0, 8 , $row, $row+1);$row++;
 
 
 
   while( $row<30){
 
                my $label=gen_label_in_left(' ');
 
            $table->attach_defaults ($label, $col, $col+1 , $row, $row+1);$row++;
 
 
 
 
 
 
 
        }
 
 
 
 
 
        return $scrolled_win;
 
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
sub get_tile{
sub get_tile{
        my ($mpsoc,$tile,$x,$y)=@_;
    my ($mpsoc,$tile)=@_;
 
 
 
 
        my ($soc_name,$num)= $mpsoc->mpsoc_get_tile_soc_name($tile);
        my ($soc_name,$num)= $mpsoc->mpsoc_get_tile_soc_name($tile);
 
 
        my $button;
        my $button;
        my $topology=$mpsoc->object_get_attribute('noc_param','TOPOLOGY');
        my $topology=$mpsoc->object_get_attribute('noc_param','TOPOLOGY');
        my $cordibate =  ($topology eq '"RING"' || $topology eq '"LINE"' ) ? "" : "($x,$y)";
 
        if( defined $soc_name){
        if( defined $soc_name){
                my $setting=$mpsoc->mpsoc_get_tile_param_setting($tile);
                my $setting=$mpsoc->mpsoc_get_tile_param_setting($tile);
                $button=($setting eq 'Custom')? def_colored_button("Tile $tile ${cordibate}*\n$soc_name",$num) :        def_colored_button("Tile $tile ${cordibate}\n$soc_name",$num) ;
        $button=($setting eq 'Custom')? def_colored_button("Tile $tile*\n$soc_name",$num) :    def_colored_button("Tile $tile\n$soc_name",$num) ;
        }else {
        }else {
                $button =def_colored_button("Tile $tile ${cordibate}\n",50) if(! defined $soc_name);
        $button =def_colored_button("Tile $tile\n",50) if(! defined $soc_name);
        }
        }
 
 
        $button->signal_connect("clicked" => sub{
        $button->signal_connect("clicked" => sub{
                my $window = def_popwin_size(40,40,"Parameter setting for Tile $tile ",'percent');
                my $window = def_popwin_size(40,40,"Parameter setting for Tile $tile ",'percent');
                my $table = def_table(6, 2, TRUE);
                my $table = def_table(6, 2, TRUE);
Line 1692... Line 1461...
                });
                });
 
 
 
 
 
 
 
 
 
 
 
 
                my $mtable = def_table(10, 1, TRUE);
                my $mtable = def_table(10, 1, TRUE);
 
 
                $mtable->attach_defaults($scrolled_win,0,1,0,9);
                $mtable->attach_defaults($scrolled_win,0,1,0,9);
                $mtable->attach_defaults($okbox,0,1,9,10);
                $mtable->attach_defaults($okbox,0,1,9,10);
 
 
Line 1720... Line 1487...
 
 
                        });
                        });
 
 
        });
        });
 
 
 
 
        #$button->show_all;
        #$button->show_all;
        return $button;
        return $button;
 
 
 
 
}
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
##########
##########
#
# gen_tiles
#########
#########
 
 
sub gen_tiles{
sub gen_tiles{
        my ($mpsoc)=@_;
        my ($mpsoc)=@_;
 
 
        my $nx= $mpsoc->object_get_attribute('noc_param',"NX");
        my ($NE, $NR, $RAw, $EAw, $Fw)=get_topology_info($mpsoc);
        my $ny= $mpsoc->object_get_attribute('noc_param',"NY");
    my $topology=$mpsoc->object_get_attribute('noc_param','TOPOLOGY');
 
    my $table;
        #print "($nx,$ny);\n";
 
        my $table=def_table($nx,$ny,FALSE);#    my ($row,$col,$homogeneous)=@_;
 
 
 
 
 
 
 
 
 
 
    my $dim_y = floor(sqrt($NE));
 
 
 
 
 
 
        for (my $y=0;$y<$ny;$y++){
        $table=def_table($NE%8,$NE/8,FALSE);#    my ($row,$col,$homogeneous)=@_;
                for (my $x=0; $x<$nx;$x++){
        for (my $i=0; $i<$NE;$i++){
                        my $tile_num=($nx*$y)+ $x;
                my $tile=get_tile($mpsoc,$i);
                        my $tile=get_tile($mpsoc,$tile_num,$x,$y);
                my $y= int($i/$dim_y);
                #print "($x,$y);\n";
                my $x= $i % $dim_y;
                $table->attach_defaults ($tile, $x, $x+1 , $y, $y+1);
                $table->attach_defaults ($tile, $x, $x+1 , $y, $y+1);
 
        }
 
 
 
 
        }}
 
        return $table;
        return $table;
}
}
 
 
 
 
 
 
Line 1788... Line 1546...
 
 
        my $make = def_image_button('icons/gen.png','Compile');
        my $make = def_image_button('icons/gen.png','Compile');
        my $prog= def_image_button('icons/write.png','Program the memories');
        my $prog= def_image_button('icons/write.png','Program the memories');
 
 
 
 
 
 
        $table->attach ($make,5, 6, 1,2,'shrink','shrink',0,0);
        $table->attach ($make,5, 6, 1,2,'shrink','shrink',0,0);
        $table->attach ($prog,9, 10, 1,2,'shrink','shrink',0,0);
        $table->attach ($prog,9, 10, 1,2,'shrink','shrink',0,0);
 
 
 
 
        $make -> signal_connect("clicked" => sub{
        $make -> signal_connect("clicked" => sub{
 
        my $load= show_gif("icons/load.gif");
 
        $table->attach ($load,7, 8, 1,2,'shrink','shrink',0,0);
 
        $load->show_all;
                $app->do_save();
                $app->do_save();
                append_to_textview($tview,' ');
                append_to_textview($tview,' ');
                run_make_file($sw,$tview);
                run_make_file($sw,$tview);
 
        $load->destroy;
 
 
        });
        });
 
 
        #Programe the board 
        #Programe the board 
        $prog-> signal_connect("clicked" => sub{
        $prog-> signal_connect("clicked" => sub{
Line 1869... Line 1630...
        add_info(\$info,'');
        add_info(\$info,'');
        if ( "ok" eq $dialog->run ) {
        if ( "ok" eq $dialog->run ) {
                $file = $dialog->get_filename;
                $file = $dialog->get_filename;
                my ($name,$path,$suffix) = fileparse("$file",qr"\..[^.]*$");
                my ($name,$path,$suffix) = fileparse("$file",qr"\..[^.]*$");
                if($suffix eq '.MPSOC'){
                if($suffix eq '.MPSOC'){
                        my $pp= eval { do $file };
            my ($pp,$r,$err) = regen_object($file );
                        if ($@ || !defined $pp){
            if ($r){
                                add_info(\$info,"**Error: cannot open $file file: $@\n");
                add_info(\$info,"**Error: cannot open $file file: $err\n");
                                 $dialog->destroy;
                                 $dialog->destroy;
                                return;
                                return;
                        }
                        }
 
 
 
 
Line 1943... Line 1704...
        my $open = def_image_button('icons/browse.png','Load MPSoC');
        my $open = def_image_button('icons/browse.png','Load MPSoC');
        my $compile  = def_image_button('icons/gate.png','Compile RTL');
        my $compile  = def_image_button('icons/gate.png','Compile RTL');
        my $software = def_image_button('icons/binary.png','Software');
        my $software = def_image_button('icons/binary.png','Software');
        my $entry=gen_entry_object($mpsoc,'mpsoc_name',undef,undef,undef,undef);
        my $entry=gen_entry_object($mpsoc,'mpsoc_name',undef,undef,undef,undef);
        my $entrybox=labele_widget_info(" MPSoC name:",$entry);
        my $entrybox=labele_widget_info(" MPSoC name:",$entry);
 
    my $diagram  = def_image_button('icons/diagram.png','Diagram');
 
 
        my $h1=gen_hpaned($scr_conf,.3,$scr_tile);
        my $h1=gen_hpaned($scr_conf,.3,$scr_tile);
        my $v2=gen_vpaned($h1,.55,$infobox);
        my $v2=gen_vpaned($h1,.55,$infobox);
 
 
        $main_table->attach_defaults ($v2  , 0, 12, 0,24);
        $main_table->attach_defaults ($v2  , 0, 12, 0,24);
        $main_table->attach ($open,0, 3, 24,25,'expand','shrink',2,2);
        $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 ($entrybox,3, 6, 24,25);
 
    $main_table->attach ($diagram, 6, 7, 24,25,'expand','shrink',2,2);
        $main_table->attach ($generate, 8, 9, 24,25,'expand','shrink',2,2);
        $main_table->attach ($generate, 8, 9, 24,25,'expand','shrink',2,2);
        $main_table->attach ($software, 9, 10, 24,25,'expand','shrink',2,2);
        $main_table->attach ($software, 9, 10, 24,25,'expand','shrink',2,2);
        $main_table->attach ($compile, 10, 12, 24,25,'expand','shrink',2,2);
        $main_table->attach ($compile, 10, 12, 24,25,'expand','shrink',2,2);
 
 
 
 
Line 2034... Line 1797...
        $software -> signal_connect("clicked" => sub{
        $software -> signal_connect("clicked" => sub{
                software_edit_mpsoc($mpsoc);
                software_edit_mpsoc($mpsoc);
 
 
        });
        });
 
 
 
    $diagram-> signal_connect("clicked" => sub{
 
        show_topology_diagram ($mpsoc);
 
    });
        my $sc_win = new Gtk2::ScrolledWindow (undef, undef);
        my $sc_win = new Gtk2::ScrolledWindow (undef, undef);
                $sc_win->set_policy( "automatic", "automatic" );
                $sc_win->set_policy( "automatic", "automatic" );
                $sc_win->add_with_viewport($main_table);
                $sc_win->add_with_viewport($main_table);
 
 
        return $sc_win;
        return $sc_win;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.