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

Show entire file | Details | Blame | View Log

Rev 48 Rev 54
Line 1... Line 1...
 
#!/usr/bin/perl -w
 
 
use strict;
use strict;
use warnings;
use warnings;
 
 
use String::Similarity;
use String::Similarity;
use Proc::Background;
use Proc::Background;
Line 10... Line 12...
 
 
use Cwd 'abs_path';
use Cwd 'abs_path';
use Term::ANSIColor qw(:constants);
use Term::ANSIColor qw(:constants);
use IPC::Run qw(start pump finish timeout pumpable);
use IPC::Run qw(start pump finish timeout pumpable);
 
 
 
use FindBin;
 
use lib $FindBin::Bin;
 
use constant::boolean;
 
use IO::CaptureOutput qw(capture qxx qxy);
 
 
 
 
 
our %glob_setting;
 
$glob_setting{'FONT_SIZE'}='default';
 
$glob_setting{'ICON_SIZE'}='default';
 
$glob_setting{'DSPLY_X'}  ='default';
 
$glob_setting{'DSPLY_Y'}  ='default';
 
 
 
 
 
 
 
 
sub log2{
sub log2{
        my $num=shift;
        my $num=shift;
        my $log=($num <=1) ? 1: 0;
        my $log=($num <=1) ? 1: 0;
        while( (1<< $log)  < $num) {
        while( (1<< $log)  < $num) {
Line 174... Line 190...
                $l = $top;
                $l = $top;
                $all_lib=$all_lib." lib$lib_num";
                $all_lib=$all_lib." lib$lib_num";
                $lib_num++;
                $lib_num++;
        }
        }
 
 
 
 
        my $make= "
        my $make= "
 
 
default: sim
default: sim
 
 
 
 
Line 197... Line 212...
ifeq (\$(CFG_WITH_CCWARN),yes)  # Local... Else don't burden users
ifeq (\$(CFG_WITH_CCWARN),yes)  # Local... Else don't burden users
CPPFLAGS += -DVL_THREADED=1
CPPFLAGS += -DVL_THREADED=1
CPPFLAGS += -W -Werror -Wall
CPPFLAGS += -W -Werror -Wall
endif
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
# Linking final exe -- presumes have a sim_main.cpp
 
 
 
 
sim:    testbench.o \$(VK_GLOBAL_OBJS) $p
sim:    testbench.o \$(VK_GLOBAL_OBJS) $p \$(SLIB)
        \$(LINK) \$(LDFLAGS) -g \$^ \$(LOADLIBES) \$(LDLIBS) -o testbench \$(LIBS) -Wall -O3 -lpthread 2>&1 | c++filt
        \$(LINK) \$(LDFLAGS) -g \$^ \$(LOADLIBES) \$(LDLIBS) -o testbench \$(LIBS) -Wall -O3 -lpthread 2>&1 | c++filt
 
 
testbench.o: testbench.cpp $h
testbench.o: testbench.cpp $h  \$(HLIB)
 
 
clean:
clean:
        rm *.o *.a testbench
        rm *.o *.a testbench
";
";
 
 
Line 809... Line 831...
        0x9932CC,#Dark Orchid
        0x9932CC,#Dark Orchid
        0x800000,#marron
        0x800000,#marron
        0x800080,#Purple
        0x800080,#Purple
        0x4B0082,#Indigo
        0x4B0082,#Indigo
        0xFFFFFF,#white 
        0xFFFFFF,#white 
        0x000000 #Black         
        0x000000, #Black                
 
                #heatmap
 
        0xbdff00, #     (189,255,0)
 
        0xe3f018, #     (227,240,24)
 
        0xffce00, #     (255,206,0)
 
        0xff6612, #     (255,102,18)
 
        0xc12424, #     (193,36,36)
                );
                );
 
 
        my $color=      ($num< scalar (@colors))? $colors[$num]: 0xFFFFFF;
        my $color=      ($num< scalar (@colors))? $colors[$num]: 0xFFFFFF;
        my $red=        ($color & 0xFF0000) >> 8;
        my $red=        ($color & 0xFF0000) >> 8;
        my $green=      ($color & 0x00FF00);
        my $green=      ($color & 0x00FF00);
Line 857... Line 885...
        "9932CC",#Dark Orchid
        "9932CC",#Dark Orchid
        "800000",#marron
        "800000",#marron
        "800080",#Purple
        "800080",#Purple
        "4B0082",#Indigo
        "4B0082",#Indigo
        "FFFFFF",#white 
        "FFFFFF",#white 
        "000000" #Black         
        "000000", #Black        
 
                #heatmap
 
        "bdff00", #     (189,255,0)
 
        "e3f018", #     (227,240,24)
 
        "ffce00", #     (255,206,0)
 
        "ff6612", #     (255,102,18)
 
        "c12424", #     (193,36,36)
 
 
 
 
                );
                );
 
 
        my $color=      ($num< scalar (@colors))? $colors[$num]: "FFFFFF";
        my $color=      ($num< scalar (@colors))? $colors[$num]: "FFFFFF";
        return $color;
        return $color;
 
 
Line 1050... Line 1086...
 
 
        my $scale=$self->object_get_attribute($graph_name,"scale");
        my $scale=$self->object_get_attribute($graph_name,"scale");
        $scale= 1 if (!defined $scale);
        $scale= 1 if (!defined $scale);
        my $diagram;
        my $diagram;
 
 
        my $cmd = "echo \'$dotfile\' | dot -Tpng";
        my $cmd = "echo \'$dotfile\' | dot -Tpng -q";
        my ($stdout,$exit,$stderr)= run_cmd_in_back_ground_get_stdout ($cmd);
        my ($stdout,$exit,$stderr)= run_cmd_in_back_ground_get_stdout ($cmd);
        if ( length( $stderr || '' ) !=0)  {
        if ( length( $stderr || '' ) !=0)  {
                message_dialog("$stderr\nHave you installed graphviz? If not run \n \t \"sudo apt-get install graphviz\" \n in terminal",'error');
                message_dialog("$stderr\nHave you installed graphviz? If not run \n \t \"sudo apt-get install graphviz\" \n in terminal",'error');
        }
        }
        $diagram =open_inline_image( $stdout,70*$scale,70*$scale,'percent');
        $diagram =open_inline_image( $stdout,70*$scale,70*$scale,'percent');
Line 1297... Line 1333...
        }
        }
    return ($row,$column,$widget);
    return ($row,$column,$widget);
}
}
 
 
 
 
 
#get the list of files matching the given extention
 
sub get_file_list_by_extention {
 
        my ($open_in, $ext)=@_;
 
        my @files = glob "$open_in/*";
 
        my $file_list="";
 
        foreach my $file (@files){
 
                my ($name,$path,$suffix) = fileparse("$file",qr"\..[^.]*$");
 
                if($suffix eq $ext || $suffix eq ".$ext" ){
 
                        $file_list.=",$name";
 
                }
 
        }
 
        return  ($file_list,\@files);
 
}
 
 
 
 
 
 
 
 
 
sub set_gui_setting{
 
        my $paths=shift;
 
        my %p=%{$paths};
 
        $glob_setting{'FONT_SIZE'}= $p{'GUI_SETTING'}{'FONT_SIZE'} if (defined $p{'GUI_SETTING'}{'FONT_SIZE'});
 
        $glob_setting{'ICON_SIZE'}= $p{'GUI_SETTING'}{'ICON_SIZE'} if (defined $p{'GUI_SETTING'}{'ICON_SIZE'});
 
        $glob_setting{'DSPLY_X'}  = $p{'GUI_SETTING'}{'DSPLY_X'}   if (defined $p{'GUI_SETTING'}{'DSPLY_X'});
 
        $glob_setting{'DSPLY_Y'}  = $p{'GUI_SETTING'}{'DSPLY_Y'}   if (defined $p{'GUI_SETTING'}{'DSPLY_Y'});
 
}
 
 
 
my ($screen_x,$screen_y);
 
 
 
sub get_default_screen_size{
 
        return  ($screen_x,$screen_y) if (defined $screen_x && defined $screen_y);
 
 
 
        my $fh= 'xrandr --current | awk \'$2~/\*/{print $1}\'' ;
 
        my ($stdout, $stderr, $success) = qxx( ($fh) );
 
        my @a = split ("\n",$stdout);
 
        ($screen_x,$screen_y) = split ("x",$a[0]);
 
        $screen_x = 600 if(!defined $screen_x);
 
        $screen_y = 800 if(!defined $screen_y);
 
        return  ($screen_x,$screen_y);
 
}
 
 
 
 
 
sub get_current_monitor_working_area{
 
    my $screen = get_default_screen();
 
        my $hight = $screen->get_height();
 
        my $active = $screen->get_active_window();
 
        my $monitor =   $screen->get_monitor_at_window($active);
 
        my $warea = $screen->get_monitor_workarea($monitor);#get_width(); 
 
        #print  Data::Dumper->Dump ([$warea],['ttt']);  
 
        return ($warea->{'width'},$warea->{'height'});
 
}
 
 
 
 
 
 
 
 
 
sub max_win_size {
 
        my ($x,$y);
 
        $x= int($glob_setting{'DSPLY_X'}) if ($glob_setting{'DSPLY_X'} ne 'default');
 
        $y= int($glob_setting{'DSPLY_Y'}) if ($glob_setting{'DSPLY_Y'} ne 'default');
 
        if (!defined $x || !defined $y){
 
                my ($X,$Y)=get_current_monitor_working_area();
 
                $x=$X if (!defined $x);
 
                $y=$Y if (!defined $y);
 
        }
 
 
 
        return ($x,$y);
 
 
 
 
 
}
 
 
 
 
1
1
 
 
 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.