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/] [traffic_pattern.pl] - Diff between revs 43 and 48

Show entire file | Details | Blame | View Log

Rev 43 Rev 48
Line 1... Line 1...
#!/usr/bin/perl -w
#!/usr/bin/perl -w
use Glib qw/TRUE FALSE/;
use constant::boolean;
use strict;
use strict;
use warnings;
use warnings;
 
 
use FindBin;
use FindBin;
use lib $FindBin::Bin;
use lib $FindBin::Bin;
Line 27... Line 27...
        while($b<0) {$b=$b+$W; }
        while($b<0) {$b=$b+$W; }
        $b=$b % $W;
        $b=$b % $W;
        return ($num >> $b) & 1;
        return ($num >> $b) & 1;
}
}
 
 
# number; b:bit location;  W: number width log2(num); v: 1 assert the bit, 0 deassert the bit; 
# number; b:bit location;  W: number width log2(num); v: 1 assert the bit, 0 de-assert the bit; 
sub setBit{
sub setBit{
        my ($num ,$b,$W,$v)=@_;
        my ($num ,$b,$W,$v)=@_;
        while($b<0) {$b=$b+$W;}
        while($b<0) {$b=$b+$W;}
        $b=$b % $W;
        $b=$b % $W;
 
 
    my $mask = 1 << $b;
    my $mask = 1 << $b;
    if ($v == 0) {$$num  = $$num & ~$mask;} # assert bit
    if ($v == 0) {$$num  = $$num & ~$mask;} # assert bit
    else {$$num = $$num | $mask;} #deassert bit      
    else {$$num = $$num | $mask;} #de-assert bit      
}
}
 
 
sub pck_dst_gen_2D {
sub pck_dst_gen_2D {
        my ($self,$sample,$traffic,$core_num,$line_num,$rnd)=@_;
        my ($self,$sample,$traffic,$core_num,$line_num,$rnd)=@_;
        my ($topology, $T1, $T2, $T3, $V, $Fpay) = get_sample_emulation_param($self,$sample);
        my ($topology, $T1, $T2, $T3, $V, $Fpay) = get_sample_emulation_param($self,$sample);
Line 123... Line 123...
                 $dest_x = ($current_x + 1) % $T1;
                 $dest_x = ($current_x + 1) % $T1;
                 $dest_y = ($current_y + 1) % $T2;
                 $dest_y = ($current_y + 1) % $T2;
                 $dest_l = $current_l;
                 $dest_l = $current_l;
                 return mesh_tori_addr_join($dest_x,$dest_y,$dest_l,$T1, $T2,$T3);
                 return mesh_tori_addr_join($dest_x,$dest_y,$dest_l,$T1, $T2,$T3);
     }
     }
 
     if($traffic eq "custom"){
 
        my $num=$self->object_get_attribute($sample,"CUSTOM_SRC_NUM");
 
        for (my $i=0;$i<$num;$i++){
 
                                my $src = $self->object_get_attribute($sample,"SRC_$i");
 
                                my $dst = $self->object_get_attribute($sample,"DST_$i");
 
                                return endp_addr_encoder($self,$dst) if($src == $core_num);
 
        }
 
        return endp_addr_encoder($self,$core_num);#off     
 
     }
 
 
                 print ("$traffic is an unsupported traffic pattern\n");
                 print ("ERROR: $traffic is an unsupported traffic pattern\n");
                 $dest_x = $current_x;
                 $dest_x = $current_x;
                 $dest_y = $current_y;
                 $dest_y = $current_y;
                 $dest_l = $current_l;
                 $dest_l = $current_l;
                 return mesh_tori_addr_join($dest_x,$dest_y,$dest_l,$T1, $T2,$T3);
                 return mesh_tori_addr_join($dest_x,$dest_y,$dest_l,$T1, $T2,$T3);
}
}
Line 190... Line 199...
     if($traffic eq "neighbor"){
     if($traffic eq "neighbor"){
                #dx = sx + 1 mod k
                #dx = sx + 1 mod k
                 return endp_addr_encoder($self,($core_num + 1) % $NE);
                 return endp_addr_encoder($self,($core_num + 1) % $NE);
         }
         }
 
 
         printf ("$traffic is an unsupported traffic pattern\n");
         if($traffic eq "custom"){
 
        my $num=$self->object_get_attribute($sample,"CUSTOM_SRC_NUM");
 
        for (my $i=0;$i<$num;$i++){
 
                                my $src = $self->object_get_attribute($sample,"SRC_$i");
 
                                my $dst = $self->object_get_attribute($sample,"DST_$i");
 
                                return endp_addr_encoder($self,$dst) if($src == $core_num);
 
        }
 
        return endp_addr_encoder($self,$core_num);#off     
 
     }
 
 
 
         printf ("ERROR: $traffic is an unsupported traffic pattern\n");
         return  endp_addr_encoder($self,$core_num);
         return  endp_addr_encoder($self,$core_num);
}
}
 
 
 
 
sub pck_dst_gen{
sub pck_dst_gen{
Line 204... Line 223...
        return  pck_dst_gen_1D ($self,$sample,$traffic,$core_num,$line_num,$rnd);
        return  pck_dst_gen_1D ($self,$sample,$traffic,$core_num,$line_num,$rnd);
}
}
 
 
 1;
 1;
 
 
 No newline at end of file
 No newline at end of file
 
 
 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.