Line 1... |
Line 1... |
#!/usr/bin/perl -w
|
#!/usr/bin/perl -w
|
|
|
|
package ProNOC;
|
|
|
|
|
|
|
use Glib qw/TRUE FALSE/;
|
use Glib qw/TRUE FALSE/;
|
|
|
|
|
use Gtk2;
|
use Gtk2;
|
use strict;
|
use strict;
|
use warnings;
|
use warnings;
|
#use Image::Base::Gtk2::Gdk::Pixbuf;
|
|
|
|
|
|
use lib 'lib/perl';
|
use lib 'lib/perl';
|
require "widget.pl";
|
require "widget.pl";
|
require "interface_gen.pl";
|
require "interface_gen.pl";
|
require "ip_gen.pl";
|
require "ip_gen.pl";
|
require "soc_gen.pl";
|
require "soc_gen.pl";
|
require "mpsoc_gen.pl";
|
require "mpsoc_gen.pl";
|
require "noc_sim.pl";
|
require "emulator.pl";
|
|
|
#use PDF::API2;
|
|
|
|
|
|
|
|
sub set_deafualt_font{
|
our $VERSION = '1.5.0';
|
my($width,$hight)=@_;
|
|
#print "($width,$hight)\n";
|
|
my $font_size;
|
|
if($width>1600){
|
|
$font_size=10;
|
|
Gtk2::Rc->parse_string(<<__);
|
|
style "normal" {
|
|
font_name ="Verdana 10"
|
|
}
|
|
widget "*" style "normal"
|
|
__
|
|
|
|
}
|
sub main{
|
elsif ($width>1400){
|
|
$font_size=9;
|
|
Gtk2::Rc->parse_string(<<__);
|
|
style "normal" {
|
|
font_name ="Verdana 9"
|
|
}
|
|
widget "*" style "normal"
|
|
__
|
|
|
|
}
|
|
elsif ($width>1200){
|
|
$font_size=8;
|
|
Gtk2::Rc->parse_string(<<__);
|
|
style "normal" {
|
|
font_name ="Verdana 8"
|
|
}
|
|
widget "*" style "normal"
|
|
__
|
|
|
|
}
|
|
elsif ($width>1000){
|
|
$font_size=7;
|
|
Gtk2::Rc->parse_string(<<__);
|
|
style "normal" {
|
|
font_name ="Verdana 7"
|
|
}
|
|
widget "*" style "normal"
|
|
__
|
|
|
|
}
|
|
else{
|
|
$font_size=6;
|
|
Gtk2::Rc->parse_string(<<__);
|
|
style "normal" {
|
|
font_name ="Verdana 6"
|
|
}
|
|
widget "*" style "normal"
|
|
__
|
|
|
|
}
|
|
#print " \$font_size= $font_size\n";
|
|
return $font_size;
|
|
|
|
|
my($width,$hight)=max_win_size();
|
|
set_defualt_font_size();
|
|
|
}
|
|
|
|
sub get_mpsoc{
|
# check if envirement variables are defined
|
my ($ipgen,$soc_state,$info)=@_;
|
if ( !defined $ENV{PRONOC_WORK} || !defined $ENV{QUARTUS_BIN}) {
|
my $description = "Will be available soon!";
|
my $message;
|
my $table = Gtk2::Table->new (15, 15, TRUE);
|
$message= "Warning: QUARTUS_BIN environment variable has not been set. It is required only for working with NoC emulator." if(!defined $ENV{QUARTUS_BIN});
|
#my $window=def_popwin_size(500,500,"Add description");
|
$message= $message."\n\nWarning: PRONOC_WORK envirement varibale has not been set." if(!defined $ENV{PRONOC_WORK});
|
my ($scrwin,$text_view)=create_text();
|
$message= $message."\n\nPlease add aformentioned variables to ~\.bashrc file e.g: export PRONOC_WORK=[path_to]/mpsoc_work.";
|
#my $buffer = $textbox->get_buffer();
|
message_dialog("$message");
|
my $ok=def_image_button("icons/select.png",' Ok ');
|
|
|
|
$table->attach_defaults($scrwin,0,15,0,14);
|
|
$table->attach_defaults($ok,6,9,14,15);
|
|
my $text_buffer = $text_view->get_buffer;
|
|
if(defined $text_buffer) {$text_buffer->set_text($description)};
|
|
|
|
$ok->signal_connect("clicked"=> sub {
|
|
|
|
my $text = $text_buffer->get_text($text_buffer->get_bounds, TRUE);
|
|
# $ipgen->ipgen_set_description($text);
|
|
print "$text\n";
|
|
|
|
});
|
|
|
|
#$window->add($table);
|
|
#$window->show_all();
|
|
return $table;
|
|
|
|
}
|
}
|
|
|
|
|
|
|
|
|
sub main{
|
|
|
|
|
|
|
|
my $notebook = Gtk2::Notebook->new;
|
my $notebook = Gtk2::Notebook->new;
|
#$hbox->pack_start ($notebook, TRUE, TRUE, 0);
|
|
|
|
my($width,$hight)=max_win_size();
|
|
set_deafualt_font_size();
|
|
|
|
|
|
|
|
my $intfc_gen= intfc_main();
|
my $intfc_gen= intfc_main();
|
$notebook->append_page ($intfc_gen,Gtk2::Label->new_with_mnemonic ("_Interface generator"));
|
$notebook->append_page ($intfc_gen,Gtk2::Label->new_with_mnemonic ("_Interface generator"));
|
|
|
my $ipgen=ipgen_main();
|
my $ipgen=ipgen_main();
|
Line 133... |
Line 58... |
$notebook->append_page ($socgen,Gtk2::Label->new_with_mnemonic ("_Processing tile generator"));
|
$notebook->append_page ($socgen,Gtk2::Label->new_with_mnemonic ("_Processing tile generator"));
|
|
|
my $mpsocgen =mpsocgen_main();
|
my $mpsocgen =mpsocgen_main();
|
$notebook->append_page ($mpsocgen,Gtk2::Label->new_with_mnemonic ("_NoC based MPSoC generator"));
|
$notebook->append_page ($mpsocgen,Gtk2::Label->new_with_mnemonic ("_NoC based MPSoC generator"));
|
|
|
|
my $emulator =emulator_main();
|
|
$notebook->append_page ($emulator,Gtk2::Label->new_with_mnemonic (" _NoC emulator "));
|
|
|
|
|
|
|
my $scrolled_win = new Gtk2::ScrolledWindow (undef, undef);
|
my $scrolled_win = new Gtk2::ScrolledWindow (undef, undef);
|
$scrolled_win->set_policy( "automatic", "automatic" );
|
$scrolled_win->set_policy( "automatic", "automatic" );
|
Line 155... |
Line 81... |
|
|
|
|
|
|
|
|
|
|
my @entries = (
|
my @menu_items = (
|
### Everything falls under the following 3 rows ###
|
|
[ 'FileMenu', undef, '_File' ],
|
|
[ 'ViewMenu', undef, '_View' ],
|
[ "/_File", undef, undef, 0, "<Branch>" ],
|
[ 'HelpMenu', undef, '_Help' ],
|
# [ "/File/_New", "<control>N", \&menuitem_cb, 0, "<StockItem>", 'gtk-new' ],
|
|
# [ "/File/_Open", "<control>O", \&menuitem_cb, 0, "<StockItem>", 'gtk-open' ],
|
# Quit
|
# [ "/File/_Save", "<control>S", \&menuitem_cb, 0, "<StockItem>", 'gtk-save' ],
|
[ 'Exit', 'gtk-quit',
|
# [ "/File/Save _As...", undef, \&menuitem_cb, 0, "<StockItem>", 'gtk-save' ],
|
'E_xit', '<control>X',
|
# [ "/File/sep1", undef, \&menuitem_cb, 0, "<Separator>" ],
|
undef, sub { Gtk2->main_quit },
|
[ "/File/_Quit", "<control>Q", sub { Gtk2->main_quit }, 0, "<StockItem>", 'gtk-quit' ],
|
FALSE
|
|
],
|
[ "/_View", undef, undef, 0, "<Branch>" ],
|
# About
|
|
[ 'About', 'gtk-about',
|
|
'_About', '<control>A',
|
["/_Help", undef, undef, 0, "<Branch>" ],
|
undef, \&about,
|
["/_Help/_About", "F1", \&about , 0, undef ],
|
FALSE
|
["/_Help/_intf_gen", "F2", \&intfc_help, 0, undef ],
|
],
|
["/_Help/_ip_gen", "F3", \&ip_help , 0, undef ],
|
|
["/_Help/_pt_gen", "F4", \>_help , 0, undef ],
|
# intf_gen help
|
["/_Help/_Tutorial_1", undef, \&Tutorial_1 , 0, undef ],
|
[ 'interface generator', 'gtk-about',
|
["/_Help/_Tutorial_2", undef, \&Tutorial_2 , 0, undef ],
|
'_Interface generator', 'F1',
|
|
undef, \&intfc_help,
|
|
FALSE
|
|
],
|
|
# ip_gen help
|
#["/_View/_Font12", undef, sub{ setfont(12,,$window)} , 0, "<RadioItem>" ],
|
[ 'ip generator', 'gtk-about',
|
|
'_IP generator', 'F2',
|
|
undef, \&ip_help,
|
#[ "/_Preferences", undef, undef, 0, "<Branch>" ],
|
FALSE
|
#[ "/_Preferences/_Color", undef, undef, 0, "<Branch>" ],
|
],
|
#[ "/_Preferences/Color/_Red", undef, \&menuitem_cb, 0, "<RadioItem>" ],
|
# pt_gen help
|
#[ "/_Preferences/Color/_Green", undef, \&menuitem_cb, 0, "/Preferences/Color/Red" ],
|
[ 'pt generator', 'gtk-about',
|
#[ "/_Preferences/Color/_Blue", undef, \&menuitem_cb, 0, "/Preferences/Color/Red" ],
|
'_Processing tile generator', 'F3',
|
#[ "/_Preferences/_Shape", undef, undef, 0, "<Branch>" ],
|
undef, \&pt_help,
|
#[ "/_Preferences/Shape/_Square", undef, \&menuitem_cb, 0, "<RadioItem>" ],
|
FALSE
|
#[ "/_Preferences/Shape/_Rectangle", undef, \&menuitem_cb, 0, "/Preferences/Shape/Square" ],
|
],
|
#[ "/_Preferences/Shape/_Oval", undef, \&menuitem_cb, 0, "/Preferences/Shape/Rectangle" ],
|
|
|
);
|
);
|
|
|
my $ui_info = "<ui>
|
|
<menubar name='MenuBar'>
|
|
<menu action='FileMenu'>
|
|
<separator/>
|
|
<menuitem action='Exit'/>
|
|
</menu>
|
|
<menu action='ViewMenu'>
|
|
</menu>
|
|
<menu action='HelpMenu'>
|
|
<menuitem action='About'/>
|
|
<menuitem action='interface generator'/>
|
|
<menuitem action='ip generator'/>
|
|
<menuitem action='pt generator'/>
|
|
|
|
</menu>
|
|
</menubar>
|
|
</ui>";
|
|
|
|
my $actions = Gtk2::ActionGroup->new('Actions');
|
|
$actions->add_actions( \@entries, undef );
|
|
|
|
my $ui = Gtk2::UIManager->new;
|
|
$ui->insert_action_group( $actions, 0 );
|
|
|
|
$window->add_accel_group( $ui->get_accel_group );
|
|
$ui->add_ui_from_string($ui_info);
|
|
|
#my $table = Gtk2::Table->new (1, 4, FALSE);
|
my $vbox = Gtk2::VBox->new( FALSE, 0 );
|
my $vbox = Gtk2::VBox->new( FALSE, 0 );
|
$vbox->pack_start( $ui->get_widget('/MenuBar'), FALSE, FALSE, 0 );
|
|
|
my $accel_group = Gtk2::AccelGroup->new;
|
|
$window->add_accel_group ($accel_group);
|
|
|
|
my $item_factory = Gtk2::ItemFactory->new ("Gtk2::MenuBar", "<main>",
|
|
$accel_group);
|
|
|
|
# Set up item factory to go away with the window
|
|
$window->{'<main>'} = $item_factory;
|
|
|
|
# create menu items
|
|
$item_factory->create_items ($window, @menu_items);
|
|
|
|
|
|
|
|
|
|
$vbox->pack_start( $item_factory->get_widget ("<main>"), FALSE, FALSE, 0 );
|
|
|
|
|
|
|
|
|
|
# my $ui = Gtk2::UIManager->new;
|
|
# $ui->insert_action_group( $actions, 0 );
|
|
# Add the actiongroup to the uimanager
|
|
# $ui->insert_action_group($radio_actions,0);
|
|
|
|
# $window->add_accel_group( $ui->get_accel_group );
|
|
# $ui->add_ui_from_string($ui_info);
|
|
|
|
#my $actions_media = Gtk2::ActionGroup->new ("media_dvd");
|
|
|
|
|
|
|
|
# $vbox->pack_start( $ui->get_widget('/MenuBar'), FALSE, FALSE, 0 );
|
$vbox->pack_end( $scrolled_win, TRUE, TRUE,10 );
|
$vbox->pack_end( $scrolled_win, TRUE, TRUE,10 );
|
|
|
$window->add($vbox);
|
$window->add($vbox);
|
|
|
|
|
Line 247... |
Line 187... |
|
|
|
|
sub about {
|
sub about {
|
my $about = Gtk2::AboutDialog->new;
|
my $about = Gtk2::AboutDialog->new;
|
$about->set_authors("Alireza Monemi\n Email: alirezamonemi\@opencores.org");
|
$about->set_authors("Alireza Monemi\n Email: alirezamonemi\@opencores.org");
|
$about->set_version( '1.0' );
|
$about->set_version( $VERSION );
|
$about->set_website('http://opencores.org/project,an-fpga-implementation-of-low-latency-noc-based-mpsoc');
|
$about->set_website('http://opencores.org/project,an-fpga-implementation-of-low-latency-noc-based-mpsoc');
|
$about->set_comments('NoC based MPSoC generator.');
|
$about->set_comments('NoC based MPSoC generator.');
|
|
$about->set_program_name('ProNoC');
|
|
|
$about->set_license(
|
$about->set_license(
|
"This program is free software; you can redistribute it\n"
|
"This program is free software; you can redistribute it\n"
|
. "and/or modify it under the terms of the GNU General \n"
|
. "and/or modify it under the terms of the GNU General \n"
|
. "Public License as published by the Free Software \n"
|
. "Public License as published by the Free Software \n"
|
. "Foundation; either version 1, or (at your option)\n"
|
. "Foundation; either version 1, or (at your option)\n"
|
. "any later version.\n\n"
|
. "any later version.\n\n"
|
|
|
);
|
);
|
|
# Add the Hide action to the 'Close' button in the AboutDialog():
|
|
$about->signal_connect('response' => sub { $about->hide; });
|
|
|
|
|
$about->run;
|
$about->run;
|
$about->destroy;
|
$about->destroy;
|
return;
|
return;
|
}
|
}
|
|
|
sub intfc_help{
|
sub intfc_help{
|
my $dir = Cwd::getcwd();
|
my $dir = Cwd::getcwd();
|
my $help="$dir/doc/interface_gen.pdf";
|
my $help="$dir/doc/ProNoC_intfc_gen.pdf";
|
system qq (xdg-open $help);
|
system qq (xdg-open $help);
|
return;
|
return;
|
|
|
}
|
}
|
|
|
sub ip_help{
|
sub ip_help{
|
my $dir = Cwd::getcwd();
|
my $dir = Cwd::getcwd();
|
my $help="$dir/doc/ip_gen.pdf";
|
my $help="$dir/doc/ProNoC_ip_gen.pdf";
|
system qq (xdg-open $help);
|
system qq (xdg-open $help);
|
return;
|
return;
|
}
|
}
|
|
|
|
|
|
|
sub pt_help{
|
sub pt_help{
|
my $dir = Cwd::getcwd();
|
my $dir = Cwd::getcwd();
|
my $help="$dir/doc/pt-gen.pdf";
|
my $help="$dir/doc/ProNoC_pt_gen.pdf";
|
|
system qq (xdg-open $help);
|
|
return;
|
|
}
|
|
|
|
sub Tutorial_1{
|
|
my $dir = Cwd::getcwd();
|
|
my $help="$dir/doc/ProNoC_Tutorial1.pdf";
|
system qq (xdg-open $help);
|
system qq (xdg-open $help);
|
return;
|
return;
|
|
|
}
|
}
|
|
|
|
sub Tutorial_2{
|
|
my $dir = Cwd::getcwd();
|
|
my $help="$dir/doc/ProNoC_Tutorial2.pdf";
|
|
system qq (xdg-open $help);
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
Gtk2->init;
|
Gtk2->init;
|
main;
|
main;
|