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 26 and 28

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

Rev 26 Rev 28
Line 9... Line 9...
use interface;
use interface;
 
 
use POSIX 'strtol';
use POSIX 'strtol';
 
 
use File::Path;
use File::Path;
use File::Find;
 
use File::Copy;
use File::Copy;
 
 
use Cwd 'abs_path';
use Cwd 'abs_path';
 
 
 
 
Line 25... Line 24...
 
 
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";
 
 
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){
Line 49... Line 49...
         if(! defined $value) {
         if(! defined $value) {
                        $mpsoc->object_add_attribute($attribut1,$param,$default);
                        $mpsoc->object_add_attribute($attribut1,$param,$default);
                        $mpsoc->object_add_attribute_order($attribut1,$param);
                        $mpsoc->object_add_attribute_order($attribut1,$param);
                        $value=$default;
                        $value=$default;
         }
         }
         if( ! defined $ref_delay){
 
                $ref_delay=($type eq "Entry") ? 10 : 1;
 
 
 
         }
 
         if ($type eq "Entry"){
         if ($type eq "Entry"){
                $widget=gen_entry($value);
                $widget=gen_entry($value);
                $widget-> signal_connect("changed" => sub{
                $widget-> signal_connect("changed" => sub{
                        my $new_param_value=$widget->get_text();
                        my $new_param_value=$widget->get_text();
                        $mpsoc->object_add_attribute($attribut1,$param,$new_param_value);
                        $mpsoc->object_add_attribute($attribut1,$param,$new_param_value);
                        set_gui_status($mpsoc,"ref",$ref_delay);
                        set_gui_status($mpsoc,"ref",$ref_delay) if(defined $ref_delay);
 
 
 
 
                });
                });
 
 
 
 
Line 78... Line 75...
                #print " my $pos=get_item_pos($value, @combo_list);\n";
                #print " my $pos=get_item_pos($value, @combo_list);\n";
                 $widget=gen_combo(\@combo_list, $pos);
                 $widget=gen_combo(\@combo_list, $pos);
                 $widget-> signal_connect("changed" => sub{
                 $widget-> signal_connect("changed" => sub{
                 my $new_param_value=$widget->get_active_text();
                 my $new_param_value=$widget->get_active_text();
                 $mpsoc->object_add_attribute($attribut1,$param,$new_param_value);
                 $mpsoc->object_add_attribute($attribut1,$param,$new_param_value);
                 set_gui_status($mpsoc,"ref",$ref_delay);
                 set_gui_status($mpsoc,"ref",$ref_delay) if(defined $ref_delay);
 
 
 
 
                 });
                 });
 
 
         }
         }
Line 95... Line 92...
                  $widget=gen_spin($min,$max,$step);
                  $widget=gen_spin($min,$max,$step);
                  $widget->set_value($value);
                  $widget->set_value($value);
                  $widget-> signal_connect("value_changed" => sub{
                  $widget-> signal_connect("value_changed" => sub{
                  my $new_param_value=$widget->get_value_as_int();
                  my $new_param_value=$widget->get_value_as_int();
                  $mpsoc->object_add_attribute($attribut1,$param,$new_param_value);
                  $mpsoc->object_add_attribute($attribut1,$param,$new_param_value);
                  set_gui_status($mpsoc,"ref",$ref_delay);
                  set_gui_status($mpsoc,"ref",$ref_delay) if(defined $ref_delay);
 
 
                  });
                  });
 
 
                 # $box=def_label_spin_help_box ($param,$info, $value,$min,$max,$step, 2);
                 # $box=def_label_spin_help_box ($param,$info, $value,$min,$max,$step, 2);
         }
         }
Line 138... Line 135...
                                        if($check[$i]->get_active()) {$new_val="${new_val}1" ;}
                                        if($check[$i]->get_active()) {$new_val="${new_val}1" ;}
                                        else {$new_val="${new_val}0" ;}
                                        else {$new_val="${new_val}0" ;}
                                }
                                }
                                $mpsoc->object_add_attribute($attribut1,$param,$new_val);
                                $mpsoc->object_add_attribute($attribut1,$param,$new_val);
                                #print "\$new_val=$new_val\n";
                                #print "\$new_val=$new_val\n";
                                set_gui_status($mpsoc,"ref",$ref_delay);
                                set_gui_status($mpsoc,"ref",$ref_delay) if(defined $ref_delay);
                        });
                        });
                }
                }
 
 
 
 
 
 
 
 
        }
        }
        elsif ( $type eq "DIR_path"){
        elsif ( $type eq "DIR_path"){
                        $widget =get_dir_in_object ($mpsoc,$attribut1,$param,$value,'ref',10);
                        $widget =get_dir_in_object ($mpsoc,$attribut1,$param,$value,'ref',10);
 
                        set_gui_status($mpsoc,"ref",$ref_delay) if(defined $ref_delay);
        }
        }
 
 
 
 
 
 
        else {
        else {
                 $widget =gen_label_in_left("unsuported widget type!");
                 $widget =gen_label_in_left("unsuported widget type!");
        }
        }
 
 
        my $inf_bt= gen_button_message ($info,"icons/help.png");
        my $inf_bt= gen_button_message ($info,"icons/help.png");
        if($show==1){
        if($show==1){
                my $tmp=gen_label_in_left(" ");
                attach_widget_to_table ($table,$row,$label,$inf_bt,$widget);
                $table->attach_defaults ($label , 0, 4,  $row,$row+1);
 
                $table->attach_defaults ($inf_bt , 4, 5, $row,$row+1);
 
                $table->attach_defaults ($widget , 5, 9, $row,$row+1);
 
                $table->attach_defaults ($tmp , 9, 10, $row,$row+1);
 
                $row++;
                $row++;
        }
        }
    return $row;
    return $row;
}
}
 
 
 
sub attach_widget_to_table {
 
        my ($table,$row,$label,$inf_bt,$widget)=@_;
 
        my $tmp=gen_label_in_left(" ");
 
        $table->attach  ($label , 0, 4,  $row,$row+1,'fill','shrink',2,2);
 
        $table->attach  ($inf_bt , 4, 5, $row,$row+1,'fill','shrink',2,2);
 
        $table->attach  ($widget , 5, 9, $row,$row+1,'fill','shrink',2,2);
 
        $table->attach  ($tmp , 9, 10, $row,$row+1,'fill','shrink',2,2);
 
}
 
 
 
 
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){
Line 747... Line 750...
        $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');
        $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$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");
 
 
 
 
 
 
        #Routers per row
        #Routers per row
Line 759... Line 762...
        $param= 'NX';
        $param= 'NX';
    $default=' 2';
    $default=' 2';
        $content='2,16,1';
        $content='2,16,1';
    $info= 'Number of NoC routers in row (X dimention)';
    $info= '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');
        $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$show_noc,'noc_param',1);
 
 
 
 
 
 
        #Routers per column
        #Routers per column
        $label= 'Routers per column';
        $label= 'Routers per column';
        $param= 'NY';
        $param= 'NY';
    $default=' 2';
    $default=' 2';
        $content='2,16,1';
        $content='2,16,1';
    $info= 'Number of NoC routers in column (Y dimention)';
    $info= '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');
        $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$show_noc,'noc_param',1);
 
 
        if($router_type eq '"VC_BASED"'){
        if($router_type eq '"VC_BASED"'){
                #VC number per port
                #VC number per port
                my $v=$mpsoc->object_get_attribute('noc_param','V');
                my $v=$mpsoc->object_get_attribute('noc_param','V');
                if(defined $v){ $mpsoc->object_add_attribute('noc_param','V',2) if($v eq 1);}
                if(defined $v){ $mpsoc->object_add_attribute('noc_param','V',2) if($v eq 1);}
Line 782... Line 785...
                $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');
                $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$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 797... Line 800...
        $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');
    $row= noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$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');
        $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info,$table,$row,$show_noc,'noc_param',undef);
 
 
        #topology
        #topology
        $label='Topology';
        $label='Topology';
        $param='TOPOLOGY';
        $param='TOPOLOGY';
        $default='"MESH"';
        $default='"MESH"';
        $content='"MESH","TORUS"';
        $content='"MESH","TORUS"';
        $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');
        $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$show_noc,'noc_param',1);
 
 
        #routing algorithm
        #routing algorithm
        my $topology=$mpsoc->object_get_attribute('noc_param','TOPOLOGY');
        my $topology=$mpsoc->object_get_attribute('noc_param','TOPOLOGY');
        $label='Routing Algorithm';
        $label='Routing Algorithm';
        $param="ROUTE_NAME";
        $param="ROUTE_NAME";
Line 834... Line 837...
 
 
 
 
        }
        }
        $default=($topology eq '"MESH"')?  '"XY"':'"TRANC_XY"';
        $default=($topology eq '"MESH"')?  '"XY"':'"TRANC_XY"';
        $info="Select the routing algorithm: XY(DoR) , partially adaptive (Turn models). Fully adaptive (Duato) ";
        $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, $table,$row,$show_noc,'noc_param');
        $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$show_noc,'noc_param',1);
 
 
 
 
        #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');
        $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$show_noc,'noc_param',undef);
 
 
 
 
 
 
 
 
 
 
Line 881... Line 884...
                        $param="CONGESTION_INDEX";
                        $param="CONGESTION_INDEX";
                        $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;
                        $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'noc_param');
                        $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'noc_param',undef);
 
 
                }
                }
                #Fully adaptive routing setting
                #Fully adaptive routing setting
                if( $route eq '"TRANC_DUATO"' or $route eq '"DUATO"'  ){
                if( $route eq '"TRANC_DUATO"' or $route eq '"DUATO"'  ){
                         my $v=$mpsoc->object_get_attribute('noc_param',"V");
                         my $v=$mpsoc->object_get_attribute('noc_param',"V");
Line 897... Line 900...
                         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.";
                         $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,$adv_set,'noc_param');
                         $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set, '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');
                $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'noc_param',undef);
 
 
 
 
 
 
 
 
        if ($router_type eq '"VC_BASED"'){
        if ($router_type eq '"VC_BASED"'){
Line 921... Line 924...
                $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";
                $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'noc_param');
                $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'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');
        $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'noc_param',undef);
 
 
        if($router_type eq '"VC_BASED"'){
        if($router_type eq '"VC_BASED"'){
        #class
        #class
                $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');
            $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$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 959... Line 962...
                         $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,'noc_param');
                         $row=noc_param_widget ($mpsoc,$label,$param, $default,$type,$content,$info, $table,$row,$adv_set,'noc_param',undef);
 
 
 
 
                }
                }
 
 
 
 
Line 1136... Line 1139...
 
 
#############
#############
#
#
###########
###########
 
 
sub gen_socs {
 
        my ($mpsoc,$info)=@_;
 
 
 
 
sub gen_all_tiles{
 
        my ($mpsoc,$info, $hw_dir,$sw_dir)=@_;
 
        my $nx= $mpsoc->object_get_attribute('noc_param',"NX");
 
        my $ny= $mpsoc->object_get_attribute('noc_param',"NY");
 
        my $mpsoc_name=$mpsoc->object_get_attribute('mpsoc_name');
 
        my $target_dir  = "$ENV{'PRONOC_WORK'}/MPSOC/$mpsoc_name";
 
 
 
 
 
 
 
 
 
 
 
        my @generated_tiles;
 
 
 
        #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";
 
                my ($soc_name,$num)= $mpsoc->mpsoc_get_tile_soc_name($tile_num);
        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 @socs;
                my $p = "$path/$soc_name.SOC";
        my @files = glob "$path/*.SOC";
 
        my @soc_list=$mpsoc-> mpsoc_get_soc_list();
 
        my @used_socs;
 
        foreach my $soc_name (@soc_list){
 
                my @n=$mpsoc->mpsoc_get_soc_tiles_num($soc_name);
 
                if(scalar @n){
 
                        #generate the verilog files of it
 
                        push(@used_socs,$soc_name);
 
                }
 
        }
 
 
 
        for my $p (@files){
 
                # Read
 
                my  $soc = eval { do $p };
                my  $soc = eval { do $p };
                if ($@ || !defined $soc){
                if ($@ || !defined $soc){
                        show_info(\$info,"**Error reading  $p file: $@\n");
                        show_info(\$info,"**Error reading  $p file: $@\n");
                       next;
                       next;
                }
                }
                my  $name=$soc->object_get_attribute('soc_name');
 
                if( grep (/^$name$/,@used_socs)){
 
                #generate the soc
 
                generate_soc_files($mpsoc,$soc,$info);
 
 
 
 
 
 
                #update core id
 
                $soc->object_add_attribute('global_param','CORE_ID',$tile_num);
 
 
 
                my $sw_path     = "$sw_dir/tile$tile_num";
 
                #print "$sw_path\n";
 
                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);
 
                }else{
 
                        generate_soc($soc,$info,$target_dir,$hw_dir,$sw_path,0,1);
 
                        move ("$hw_dir/$soc_name.v","$hw_dir/tiles/");
 
 
                };
                }
 
 
 
 
        }
        }}
 
 
 
 
}
}
 
 
 
 
################
################
#       generate_soc
#       generate_soc
#################
#################
 
 
sub generate_soc_files{
sub generate_soc_files{
Line 1188... Line 1203...
        my ($file_v,$tmp)=soc_generate_verilog($soc);
        my ($file_v,$tmp)=soc_generate_verilog($soc);
 
 
        # Write object file
        # Write object file
        open(FILE,  ">lib/soc/$soc_name.SOC") || die "Can not open: $!";
        open(FILE,  ">lib/soc/$soc_name.SOC") || die "Can not open: $!";
        print FILE perl_file_header("$soc_name.SOC");
        print FILE perl_file_header("$soc_name.SOC");
        print FILE Data::Dumper->Dump([\%$soc],[$soc_name]);
        print FILE Data::Dumper->Dump([\%$soc],['mpsoc']);
        close(FILE) || die "Error closing file: $!";
        close(FILE) || die "Error closing file: $!";
 
 
        # Write verilog file
        # Write verilog file
        open(FILE,  ">lib/verilog/$soc_name.v") || die "Can not open: $!";
        open(FILE,  ">lib/verilog/$soc_name.v") || die "Can not open: $!";
        print FILE $file_v;
        print FILE $file_v;
Line 1201... Line 1216...
 
 
 
 
 
 
        # copy all files in project work directory
        # copy all files in project work directory
        my $dir = Cwd::getcwd();
        my $dir = Cwd::getcwd();
        #make target dir
 
        my $project_dir   = abs_path("$dir/../../");
        my $project_dir   = abs_path("$dir/../../");
        my $target_dir  = "$project_dir/mpsoc_work/MPSOC/$mpsoc_name";
        #make target dir
 
        my $target_dir  = "$ENV{'PRONOC_WORK'}/MPSOC/$mpsoc_name";
        mkpath("$target_dir/src_verilog/lib/",1,0755);
        mkpath("$target_dir/src_verilog/lib/",1,0755);
        mkpath("$target_dir/src_verilog/tiles/",1,0755);
        mkpath("$target_dir/src_verilog/tiles/",1,0755);
        mkpath("$target_dir/sw",1,0755);
        mkpath("$target_dir/sw",1,0755);
 
 
    #copy hdl codes in src_verilog
    #copy hdl codes in src_verilog
Line 1269... Line 1284...
#################
#################
 
 
sub generate_mpsoc{
sub generate_mpsoc{
        my ($mpsoc,$info)=@_;
        my ($mpsoc,$info)=@_;
        my $name=$mpsoc->object_get_attribute('mpsoc_name');
        my $name=$mpsoc->object_get_attribute('mpsoc_name');
 
        if ( $name =~ /\W+/ ){
 
                message_dialog('The mpsoc name must not contain any non-word character:("./\()\':,.;<>~!@#$%^&*|+=[]{}`~?-")!")');
 
                return 0;
 
        }
                my $size= (defined $name)? length($name) :0;
                my $size= (defined $name)? length($name) :0;
                if ($size >0){
        if ($size ==0) {
                        gen_socs($mpsoc,$info);
                message_dialog("Please define the MPSoC name!");
                        my ($file_v,$tmp)=mpsoc_generate_verilog($mpsoc);
                return 0;
 
        }
 
 
 
        # make target dir
 
        my $dir = Cwd::getcwd();
 
        my $target_dir  = "$ENV{'PRONOC_WORK'}/MPSOC/$name";
 
        my $hw_dir      = "$target_dir/src_verilog";
 
        my $sw_dir      = "$target_dir/sw";
 
 
 
        mkpath("$hw_dir/lib/",1,0755);
 
        mkpath("$hw_dir/tiles",1,0755);
 
        mkpath("$sw_dir",1,0755);
 
 
 
 
 
        #generate/copy all tiles HDL/SW codes
 
        gen_all_tiles($mpsoc,$info, $hw_dir,$sw_dir );
 
 
 
        #copy all NoC HDL files
 
 
 
        my @files = glob( "$dir/../src_noc/*.v" );
 
        copy_file_and_folders(\@files,$dir,"$hw_dir/lib/");
 
 
 
 
 
 
 
        my ($file_v,$top_v)=mpsoc_generate_verilog($mpsoc);
 
 
 
 
 
 
                        # Write object file
                        # Write object file
                        open(FILE,  ">lib/mpsoc/$name.MPSOC") || die "Can not open: $!";
                        open(FILE,  ">lib/mpsoc/$name.MPSOC") || die "Can not open: $!";
                        print FILE perl_file_header("$name.MPSOC");
                        print FILE perl_file_header("$name.MPSOC");
                        print FILE Data::Dumper->Dump([\%$mpsoc],[$name]);
                        print FILE Data::Dumper->Dump([\%$mpsoc],[$name]);
Line 1285... Line 1330...
                        # Write verilog file
                        # Write verilog file
                        open(FILE,  ">lib/verilog/$name.v") || die "Can not open: $!";
                        open(FILE,  ">lib/verilog/$name.v") || die "Can not open: $!";
                        print FILE $file_v;
                        print FILE $file_v;
                        close(FILE) || die "Error closing file: $!";
                        close(FILE) || die "Error closing 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: $!";
 
 
 
 
 
 
                        # 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/MPSOC/$name";
 
                        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/");
                move ("$dir/lib/verilog/$name.v","$target_dir/src_verilog/");
 
    move ("$dir/lib/verilog/${name}_top.v","$target_dir/src_verilog/");
 
 
 
    #generate makefile
 
    open(FILE,  ">$sw_dir/Makefile") || die "Can not open: $!";
 
        print FILE mpsoc_sw_make();
 
        close(FILE) || die "Error closing file: $!";
 
 
 
        #generate prog_mem
 
    open(FILE,  ">$sw_dir/program.sh") || die "Can not open: $!";
 
        print FILE mpsoc_mem_prog();
 
        close(FILE) || die "Error closing file: $!";
 
 
 
 
 
 
 
 
                        message_dialog("SoC \"$name\" has been created successfully at $target_dir/ " );
                        message_dialog("SoC \"$name\" has been created successfully at $target_dir/ " );
 
 
                }else {
 
                        message_dialog("Please define the MPSoC name!");
 
 
 
                }
 
 
 
return 1;
return 1;
}
}
 
 
 
sub mpsoc_sw_make {
 
         my $make='
 
 SUBDIRS := $(wildcard */.)
 
 all: $(SUBDIRS)
 
 $(SUBDIRS):
 
        $(MAKE) -C $@
 
 
 
 .PHONY: all $(SUBDIRS)
 
 
 
 clean:
 
        $(MAKE) -C $(CODE_DIR) clean
 
';
 
return $make;
 
 
 
}
 
 
 
 
 
sub mpsoc_mem_prog {
 
         my $string='
 
#!/bin/sh
 
 
 
 
 
JTAG_MAIN="$PRONOC_WORK/toolchain/bin/jtag_main"
 
 
 
#reset and disable cpus, then release the reset but keep the cpus disabled
 
 
 
$JTAG_MAIN -n 127  -d  "I:1,D:2:3,D:2:2,I:0"
 
 
 
# jtag instruction
 
#       0: bypass
 
#       1: getting data
 
# jtag data :
 
#       bit 0 is reset
 
#       bit 1 is disable
 
# I:1  set jtag_enable  in active mode
 
# D:2:3 load jtag_enable data register with 0x3 reset=1 disable=1
 
# D:2:2 load jtag_enable data register with 0x2 reset=0 disable=1
 
# I:0  set jtag_enable  in bypass mode
 
 
 
 
 
 
 
#programe the memory
 
for i in $(ls -d */); do
 
        sh ${i%%/}/write_memory.sh
 
done
 
 
 
#Enable the cpu
 
$JTAG_MAIN -n 127  -d  "I:1,D:2:0,I:0"
 
# I:1  set jtag_enable  in active mode
 
# D:2:0 load jtag_enable data register with 0x0 reset=0 disable=0
 
# I:0  set jtag_enable  in bypass mode
 
';
 
return $string;
 
 
 
}
 
 
 
 
sub get_tile_LIST{
sub get_tile_LIST{
        my ($mpsoc,$x,$y,$soc_num,$row,$table)=@_;
        my ($mpsoc,$x,$y,$soc_num,$row,$table)=@_;
        my $instance_name=$mpsoc->mpsoc_get_instance_info($soc_num);
        my $instance_name=$mpsoc->mpsoc_get_instance_info($soc_num);
Line 1769... Line 1868...
 
 
 
 
 
 
}
}
 
 
##########
 
 
 
##########
 
sub copy_noc_files{
 
        my ($project_dir,$dest)=@_;
 
 
 
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',
 
        '/mpsoc/src_noc/combined_vc_sw_alloc.v',
 
        '/mpsoc/src_noc/comb_nonspec.v',
 
        '/mpsoc/src_noc/comb_spec2.v',
 
        '/mpsoc/src_noc/comb-spec1.v',
 
        '/mpsoc/src_noc/congestion_analyzer.v',
 
        '/mpsoc/src_noc/credit_count.v',
 
        '/mpsoc/src_noc/crossbar.v',
 
        '/mpsoc/src_noc/flit_buffer.v',
 
        '/mpsoc/src_noc/inout_ports.v',
 
        '/mpsoc/src_noc/inout_ports.v.classic',
 
        '/mpsoc/src_noc/input_ports.v',
 
        '/mpsoc/src_noc/main_comp.v',
 
        '/mpsoc/src_noc/noc.v',
 
        '/mpsoc/src_noc/route_mesh.v',
 
        '/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/ss_allocator.v');
 
        foreach my $f (@noc_files){
 
                copy ("$project_dir$f",$dest);
 
 
 
        }
 
 
 
 
 
}
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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