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/] [Integration_test/] [synthetic_sim/] [src/] [src.pl] - Diff between revs 54 and 56

Show entire file | Details | Blame | View Log

Rev 54 Rev 56
Line 1... Line 1...
#!/usr/bin/perl -w
#!/usr/bin/perl -w
 
 
 
use lib "../perl_lib";
 
 
 
use List::MoreUtils qw(uniq);
use Proc::Background;
use Proc::Background;
use File::Path qw( rmtree );
use File::Path qw( rmtree );
 
use Cwd 'abs_path';
 
 
my $script_path = dirname(__FILE__);
my $script_path = dirname(__FILE__);
my $dirname = "$script_path/..";
my $dirname = "$script_path/..";
my $root = "$dirname/../..";
my $root = "$dirname/../..";
 
 
Line 12... Line 16...
my $src_verilator = "$root/src_verilator";
my $src_verilator = "$root/src_verilator";
my $src_c = "$root/src_c";
my $src_c = "$root/src_c";
my $src = "$script_path";
my $src = "$script_path";
my $report = "$dirname/report";
my $report = "$dirname/report";
 
 
require "$root/perl_gui/lib/perl/common.pl";
#require "$root/perl_gui/lib/perl/common.pl";
require "$root/perl_gui/lib/perl/topology.pl";
require "$root/perl_gui/lib/perl/topology.pl";
 
 
use strict;
use strict;
use warnings;
use warnings;
 
 
Line 316... Line 320...
        }
        }
        return @m;
        return @m;
}
}
 
 
 
 
 
sub check_models_are_exsited {
 
        my ($mref, $inref) = @_;
 
        my @models = get_model_names(@_);
 
        foreach my $m (@models){
 
                unless (-f $m ){
 
                        die "Error: no such file $m";
 
                }
 
        }
 
}
 
 
 
 
sub gen_models {
sub gen_models {
        my ($mref, $inref) = @_;
        my ($mref, $inref) = @_;
        my @models = get_model_names(@_);
        my @models = get_model_names(@_);
 
 
 
 
    mkdir("$work", 0700);
    mkdir("$work", 0700);
        foreach my $m (@models){
        foreach my $m (@models){
                print "$m\n";
                print "$m\n";
 
                unless (-f $m ){
 
                        die "Error: no such file $m";
 
                }
                #make noc localparam
                #make noc localparam
                my $o;
                my $o;
                $o= do $m;
                $o= do $m;
        die "Error reading: $@" if $@;
        die "Error reading: $@" if $@;
                my $param = $o->{'noc_param'};
                my $param = $o->{'noc_param'};
Line 604... Line 622...
        append_text_to_file($report,"\t Passed:   zero load ($z,$zl) saturation ($s,$sl)\n");
        append_text_to_file($report,"\t Passed:   zero load ($z,$zl) saturation ($s,$sl)\n");
    $self->{'name'}{"$name"}{'traffic'}{$traffic}{'overal_result'}="passed";
    $self->{'name'}{"$name"}{'traffic'}{$traffic}{'overal_result'}="passed";
}
}
 
 
 
 
 No newline at end of file
 No newline at end of file
 
sub object_get_attribute_order{
 
        my ($self,$attribute)=@_;
 
        return unless(defined $self->{parameters_order}{$attribute});
 
        my @order=@{$self->{parameters_order}{$attribute}};
 
        return uniq(@order)
 
}
 
 
 
sub save_file {
 
        my  ($file_path,$text)=@_;
 
        open my $fd, ">$file_path" or die "could not open $file_path: $!";
 
        print $fd $text;
 
        close $fd;
 
}
 
 
 
sub object_add_attribute_order{
 
        my ($self,$attribute,@param)=@_;
 
        my $r = $self->{'parameters_order'}{$attribute};
 
        my @a;
 
        @a = @{$r} if(defined $r);
 
        push (@a,@param);
 
        @a=uniq(@a);
 
        $self->{'parameters_order'}{$attribute} =\@a;
 
}
 
 
 
sub append_text_to_file {
 
        my  ($file_path,$text)=@_;
 
        open(my $fd, ">>$file_path") or die "could not open $file_path: $!";
 
        print $fd $text;
 
        close $fd;
 
}
 
 
 
sub object_add_attribute{
 
        my ($self,$attribute1,$attribute2,$value)=@_;
 
        if(!defined $attribute2){$self->{$attribute1}=$value;}
 
        else {$self->{$attribute1}{$attribute2}=$value;}
 
 
 
}
 
 
 
 
 
 
 
sub object_get_attribute{
 
        my ($self,$attribute1,$attribute2)=@_;
 
        if(!defined $attribute2) {return $self->{$attribute1};}
 
        return $self->{$attribute1}{$attribute2};
 
}
 
 
 
sub powi{ # x^y
 
        my ($x,$y)=@_; # compute x to the y
 
        my $r=1;
 
        for (my $i = 0; $i < $y; ++$i ) {
 
        $r *= $x;
 
        }
 
  return $r;
 
}
 
 
 
sub sum_powi{ # x^(y-1) + x^(y-2) + ...+ 1;
 
        my ($x,$y)=@_; # compute x to the y
 
        my $r = 0;
 
    for (my $i = 0; $i < $y; $i++){
 
        $r += powi( $x, $i );
 
    }
 
        return $r;
 
}
 
 
 
sub log2{
 
        my $num=shift;
 
        my $log=($num <=1) ? 1: 0;
 
        while( (1<< $log)  < $num) {
 
                                $log++;
 
        }
 
        return  $log;
 
}
 
 
 
 
 
sub remove_not_hex {
 
        my $s=shift;
 
        $s =~ s/[^0-9a-fA-F]//g;
 
        return $s;
 
}
 
 
 
sub remove_not_number {
 
        my $s=shift;
 
        $s =~ s/[^0-9]//g;
 
        return $s;
 
 
 
}
 
 
 
sub check_file_has_string {
 
    my ($file,$string)=@_;
 
    my $r;
 
    open(FILE,$file);
 
    if (grep{/$string/} <FILE>){
 
       $r= 1; #print "word  found\n";
 
    }else{
 
       $r= 0; #print "word not found\n";
 
    }
 
    close FILE;
 
    return $r;
 
}
 
 
 
 
 
sub gen_verilator_makefile{
 
        my ($top_ref,$target_dir) =@_;
 
        my %tops = %{$top_ref};
 
        my $p='';
 
        my $q='';
 
        my $h='';
 
        my $l;
 
        my $lib_num=0;
 
        my $all_lib="";
 
        foreach my $top (sort keys %tops) {
 
                $p = "$p ${top}__ALL.a ";
 
                $q = $q."lib$lib_num:\n\t\$(MAKE) -f ${top}.mk\n";
 
                $h = "$h ${top}.h ";
 
                $l = $top;
 
                $all_lib=$all_lib." lib$lib_num";
 
                $lib_num++;
 
        }
 
 
 
        my $make= "
 
 
 
default: sim
 
 
 
 
 
 
 
include $l.mk
 
 
 
lib: $all_lib
 
 
 
$q
 
 
 
 
 
#######################################################################
 
# Compile flags
 
 
 
CPPFLAGS += -DVL_DEBUG=1
 
ifeq (\$(CFG_WITH_CCWARN),yes)  # Local... Else don't burden users
 
CPPFLAGS += -DVL_THREADED=1
 
CPPFLAGS += -W -Werror -Wall
 
endif
 
 
 
SLIB =
 
HLIB =
 
ifneq (\$(wildcard synful/synful.a),)
 
SLIB += synful/synful.a
 
HLIB += synful/synful.h
 
endif
 
 
 
#######################################################################
 
# Linking final exe -- presumes have a sim_main.cpp
 
 
 
 
 
sim:    testbench.o \$(VK_GLOBAL_OBJS) $p \$(SLIB)
 
        \$(LINK) \$(LDFLAGS) -g \$^ \$(LOADLIBES) \$(LDLIBS) -o testbench \$(LIBS) -Wall -O3 -lpthread 2>&1 | c++filt
 
 
 
testbench.o: testbench.cpp $h  \$(HLIB)
 
 
 
clean:
 
        rm *.o *.a testbench
 
";
 
 
 
save_file ($target_dir,$make);
 
 
 
}
 
 
 
 
 
sub get_project_dir{ #mpsoc directory address
 
        my $dir = Cwd::getcwd();
 
        my @p=  split('/perl_gui',$dir);
 
        @p=     split('/Integration_test',$p[0]);
 
    my $d         = abs_path("$p[0]/../");
 
 
 
        return $d;
 
}
 
 
 
#return lines containig pattern in a givn file
 
sub unix_grep {
 
        my ($file,$pattern)=@_;
 
    open(FILE,$file);
 
    my @arr = <FILE>;
 
    my @lines = grep /$pattern/, @arr;
 
        return @lines;
 
}
 
 
 
 
 
sub regen_object {
 
        my $path=shift;
 
        $path = get_full_path_addr($path);
 
        my $pp= eval { do $path };
 
        my $r= ($@ || !defined $pp);
 
        return ($pp,$r,$@);
 
}
 
 
 
sub get_full_path_addr{
 
        my $file=shift;
 
        my $dir = Cwd::getcwd();
 
        my $full_path = "$dir/$file";
 
        return $full_path  if -f ($full_path );
 
        return $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.