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/] [ProNoC.pl] - Blame information for rev 38

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 16 alirezamon
#!/usr/bin/perl -w
2
 
3 25 alirezamon
package ProNOC;
4
 
5
 
6
 
7 16 alirezamon
use Glib qw/TRUE FALSE/;
8
 
9
 
10
use Gtk2;
11
use strict;
12
use warnings;
13
 
14 25 alirezamon
 
15
 
16 16 alirezamon
use lib 'lib/perl';
17
require "widget.pl";
18
require "interface_gen.pl";
19
require "ip_gen.pl";
20
require "soc_gen.pl";
21
require "mpsoc_gen.pl";
22 25 alirezamon
require "emulator.pl";
23 32 alirezamon
require "simulator.pl";
24 38 alirezamon
require "trace_gen.pl";
25 16 alirezamon
 
26 38 alirezamon
use File::Basename;
27 16 alirezamon
 
28
 
29 38 alirezamon
our $VERSION = '1.8.0';
30 16 alirezamon
 
31 25 alirezamon
sub main{
32 16 alirezamon
 
33
 
34
 
35
 
36 25 alirezamon
my($width,$hight)=max_win_size();
37
set_defualt_font_size();
38 16 alirezamon
 
39 25 alirezamon
 
40
# check if envirement variables are defined
41
if ( !defined $ENV{PRONOC_WORK} || !defined $ENV{QUARTUS_BIN}) {
42 28 alirezamon
        my $message;
43
        if ( !defined $ENV{PRONOC_WORK}) {
44
                my $dir = Cwd::getcwd();
45
                my $project_dir   = abs_path("$dir/../../mpsoc_work");
46
                $ENV{'PRONOC_WORK'}= $project_dir;
47
                $message= "\n\nWarning: PRONOC_WORK envirement varibale has not been set. The PRONOC_WORK is autumatically set to $ENV{'PRONOC_WORK'}.\n";
48
 
49
        }
50
 
51
 
52
 
53
        $message= $message."Warning: QUARTUS_BIN environment variable has not been set. It is required only for working with NoC emulator." if(!defined $ENV{QUARTUS_BIN});
54
 
55 25 alirezamon
        $message= $message."\n\nPlease add aformentioned variables to ~\.bashrc file e.g: export PRONOC_WORK=[path_to]/mpsoc_work.";
56
        message_dialog("$message");
57
 
58 16 alirezamon
}
59 38 alirezamon
my $table = Gtk2::Table->new (1, 3, FALSE);
60 16 alirezamon
 
61
 
62 38 alirezamon
        #________
63
        #radio btn "Generator"  
64
        my $rbtn_generator = Gtk2::RadioToolButton->new (undef);
65 16 alirezamon
 
66 38 alirezamon
        my ($notebook,$noteref) = generate_main_notebook('Generator');
67
        my $window = def_win_size($width-100,$hight-100,"ProNoC");
68
        my $navIco = Gtk2::Gdk::Pixbuf->new_from_file("./icons/ProNoC.png");         # advance1.png");  
69
        $window->set_default_icon($navIco);
70 16 alirezamon
 
71
 
72 38 alirezamon
 my @menu_items = (
73 25 alirezamon
  [ "/_File",            undef,        undef,          0, "<Branch>" ],
74
  [ "/File/_Quit",       "<control>Q", sub { Gtk2->main_quit },  0, "<StockItem>", 'gtk-quit' ],
75
  [ "/_View",                  undef, undef,         0, "<Branch>" ],
76 38 alirezamon
  [ "/_View/_ProNoC System Generator",  undef,  sub{ open_page($notebook,$noteref,$table,'Generator'); } ,      0,       undef ],
77
  [ "/_View/_ProNoC Simulator",  undef,         sub{ open_page($notebook,$noteref,$table,'Simulator'); } ,      0,       undef ],
78
 
79 25 alirezamon
 
80
 
81 38 alirezamon
  [ "/_Help",           undef,          undef,          0,       "<Branch>" ],
82
  [ "/_Help/_About",    "F1",           \&about ,       0,       undef ],
83
  [ "/_Help/_ProNoC System Overview",   "F2",           \&overview ,    0,       undef ],
84
  [ "/_Help/_ProNoC User Manual",  "F3",                \&user_help,    0,       undef ],
85 25 alirezamon
 
86 17 alirezamon
);
87
 
88
 
89
 
90
 
91
 
92 25 alirezamon
 
93 38 alirezamon
 
94
    my $accel_group = Gtk2::AccelGroup->new;
95
    $window->add_accel_group ($accel_group);
96 25 alirezamon
 
97 38 alirezamon
    my $item_factory = Gtk2::ItemFactory->new ("Gtk2::MenuBar", "<main>",$accel_group);
98 25 alirezamon
 
99 38 alirezamon
    # Set up item factory to go away with the window
100
    $window->{'<main>'} = $item_factory;
101 25 alirezamon
 
102 38 alirezamon
    # create menu items
103
    $item_factory->create_items ($window, @menu_items);
104 25 alirezamon
 
105 38 alirezamon
 
106 25 alirezamon
 
107 38 alirezamon
        $table->attach ($item_factory->get_widget ("<main>"),0, 1, 0,1,,'fill','fill',0,0); #,'expand','shrink',2,2);
108
 
109
    my $tt = Gtk2::Tooltips->new();
110 25 alirezamon
 
111
 
112 38 alirezamon
        #====================================
113
        #The handle box helps in creating a detachable toolbar 
114
        my $hb = Gtk2::HandleBox->new;
115
        #create a toolbar, and do some initial settings
116
        my $toolbar = Gtk2::Toolbar->new;
117
        $toolbar->set_icon_size ('small-toolbar');
118 25 alirezamon
 
119 38 alirezamon
        $toolbar->set_show_arrow (FALSE);
120
 
121
 
122
 
123
 
124
 
125
        $rbtn_generator->set_label ('Generator');
126
        $rbtn_generator->set_icon_widget (def_icon('icons/hardware.png'));
127
        set_tip($rbtn_generator, "ProNoC System Generator");
128
        $toolbar->insert($rbtn_generator,-1);
129
 
130
 
131
 
132
        #________
133
        #radio btn "Simulator"
134
        my $rbtn_simulator = Gtk2::RadioToolButton->new_from_widget($rbtn_generator);
135
        $rbtn_simulator->set_label ('Simulator');
136
        $rbtn_simulator->set_icon_widget (def_icon('icons/simulator.png')) ;
137
 
138
        set_tip($rbtn_simulator, "ProNoC Simulator");
139
        $toolbar->insert($rbtn_simulator,-1);
140
 
141
 
142
 
143
 
144
 
145
        $hb->add($toolbar);
146
        #====================================
147
 
148
        $rbtn_generator->signal_connect('toggled', sub{
149
                open_page($notebook,$noteref,$table,'Generator');
150
 
151
 
152
 
153
        });
154
 
155
        $rbtn_simulator->signal_connect('toggled', sub{
156
                open_page($notebook,$noteref,$table,'Simulator');
157
 
158
 
159
        });
160
 
161
   $table->attach ($hb,0, 1, 0,1,'fill','fill',0,0);
162
   $table->attach_defaults( $notebook, 0, 2, 1,2);
163 25 alirezamon
 
164 38 alirezamon
#$window->add($vbox);
165
$window->add($table);
166 25 alirezamon
 
167
 
168
 
169 17 alirezamon
 
170 16 alirezamon
                $window->set_resizable (1);
171
                $window->show_all();
172
 
173 38 alirezamon
}
174 16 alirezamon
 
175
 
176 38 alirezamon
sub open_page{
177
        my ( $notebook,$noteref,$table,$page_name)=@_;
178
        $notebook->destroy;
179
        ($notebook,$noteref) = generate_main_notebook($page_name);
180
        $table->attach_defaults( $notebook, 0, 2, 1,2);
181
        $table->show_all;
182 16 alirezamon
 
183 38 alirezamon
}
184 16 alirezamon
 
185
 
186 17 alirezamon
sub about {
187
    my $about = Gtk2::AboutDialog->new;
188
    $about->set_authors("Alireza Monemi\n Email: alirezamonemi\@opencores.org");
189 25 alirezamon
    $about->set_version( $VERSION );
190 17 alirezamon
    $about->set_website('http://opencores.org/project,an-fpga-implementation-of-low-latency-noc-based-mpsoc');
191
    $about->set_comments('NoC based MPSoC generator.');
192 25 alirezamon
    $about->set_program_name('ProNoC');
193
 
194 17 alirezamon
    $about->set_license(
195
                 "This program is free software; you can redistribute it\n"
196
                . "and/or modify it under the terms of the GNU General \n"
197
                . "Public License as published by the Free Software \n"
198
                . "Foundation; either version 1, or (at your option)\n"
199
                . "any later version.\n\n"
200
 
201
        );
202 25 alirezamon
        # Add the Hide action to the 'Close' button in the AboutDialog():
203
    $about->signal_connect('response' => sub { $about->hide; });
204
 
205
 
206 17 alirezamon
    $about->run;
207
    $about->destroy;
208
    return;
209
}
210 16 alirezamon
 
211 38 alirezamon
 
212
 
213
sub user_help{
214 17 alirezamon
    my $dir = Cwd::getcwd();
215 38 alirezamon
    my $help="$dir/../../doc/ProNoC_User_manual.pdf";
216 17 alirezamon
    system qq (xdg-open $help);
217
    return;
218
}
219
 
220 38 alirezamon
sub overview{
221 17 alirezamon
    my $dir = Cwd::getcwd();
222 38 alirezamon
    my $help="$dir/../../doc/ProNoC_System_Overview.pdf";
223 17 alirezamon
    system qq (xdg-open $help);
224
    return;
225
 
226
 
227
 
228
}
229
 
230 32 alirezamon
 
231
 
232 38 alirezamon
sub generate_main_notebook {
233
        my $mode =shift;
234
 
235
        my $notebook = Gtk2::Notebook->new;
236
        $notebook->show_all;
237
        if($mode eq 'Generator'){
238
                my $intfc_gen=  intfc_main();
239
                my $lable1=def_image_label("icons/intfc.png"," Interface generator ");
240
                $notebook->append_page ($intfc_gen,$lable1);#Gtk2::Label->new_with_mnemonic ("  _Interface generator  "));
241
                $lable1->show_all;
242 32 alirezamon
 
243 38 alirezamon
                my $ipgen=ipgen_main();
244
                my $lable2=def_image_label("icons/ip.png"," IP generator ");
245
                $notebook->append_page ($ipgen,$lable2);#Gtk2::Label->new_with_mnemonic ("  _IP generator  "));
246
                $lable2->show_all;
247 17 alirezamon
 
248 38 alirezamon
                my $socgen=socgen_main();
249
                my $lable3=def_image_label("icons/tile.png"," Processing tile generator ");
250
                $notebook->append_page ($socgen,$lable3 );#,Gtk2::Label->new_with_mnemonic ("  _Processing tile generator  "));
251
                $lable3->show_all;
252 17 alirezamon
 
253 38 alirezamon
                my $mpsocgen =mpsocgen_main();
254
                my $lable4=def_image_label("icons/noc.png"," NoC based MPSoC generator ");
255
                $notebook->append_page ($mpsocgen,$lable4);#Gtk2::Label->new_with_mnemonic ("  _NoC based MPSoC generator  ")); 
256
                $lable4->show_all;
257
 
258
 
259
        } else{
260
 
261
 
262
                my $trace_gen= trace_gen_main();
263
                my $lable1=def_image_label("icons/trace.png"," Trace generator ");
264
                #my $lb=Gtk2::Label->new_with_mnemonic (" _Trace generator   ");
265
                set_tip($lable1, "Generate trace file from application task graph");
266
 
267
                $notebook->append_page ($trace_gen,$lable1);
268
                $lable1->show_all;
269
                $trace_gen->show_all;
270
 
271
                my $simulator =simulator_main();
272
                my $lable2=def_image_label("icons/sim.png"," NoC simulator ");
273
 
274
                $notebook->append_page ($simulator,$lable2);#Gtk2::Label->new_with_mnemonic (" _NoC simulator   "));            
275
                $lable2->show_all;
276
                $simulator->show_all;
277 17 alirezamon
 
278 38 alirezamon
                my $emulator =emulator_main();
279
                my $lable3=def_image_label("icons/emul.png"," NoC emulator ");
280
                $notebook->append_page ($emulator,$lable3);#Gtk2::Label->new_with_mnemonic (" _NoC emulator"));                         
281
                $lable3->show_all;
282
                $emulator->show_all;
283
 
284
 
285
 
286
        }
287
 
288
                my $scrolled_win = new Gtk2::ScrolledWindow (undef, undef);
289
                $scrolled_win->set_policy( "automatic", "automatic" );
290
                $scrolled_win->add_with_viewport($notebook);
291
                $scrolled_win->show_all;
292
 
293
 
294
                return ($scrolled_win,$notebook);
295
 
296 25 alirezamon
}
297
 
298
 
299
 
300 38 alirezamon
 
301
 
302
 
303
 
304
 
305
 
306
 
307
 
308 16 alirezamon
Gtk2->init;
309
main;
310
Gtk2->main();

powered by: WebSVN 2.1.0

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