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 17

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
use Glib qw/TRUE FALSE/;
4
 
5
 
6
use Gtk2;
7
use strict;
8
use warnings;
9
#use Image::Base::Gtk2::Gdk::Pixbuf;
10
 
11
use lib 'lib/perl';
12
require "widget.pl";
13
require "interface_gen.pl";
14
require "ip_gen.pl";
15
require "soc_gen.pl";
16
require "mpsoc_gen.pl";
17
require "noc_sim.pl";
18
 
19 17 alirezamon
#use PDF::API2;
20 16 alirezamon
 
21
 
22
 
23
sub set_deafualt_font{
24
        my($width,$hight)=@_;
25
        #print "($width,$hight)\n";
26
        my $font_size;
27
        if($width>1600){
28
            $font_size=10;
29
                Gtk2::Rc->parse_string(<<__);
30
                        style "normal" {
31
                                font_name ="Verdana 10"
32
                        }
33
                        widget "*" style "normal"
34
__
35
 
36
        }
37
        elsif ($width>1400){
38
                $font_size=9;
39
                Gtk2::Rc->parse_string(<<__);
40
                style "normal" {
41
                                font_name ="Verdana 9"
42
                        }
43
                        widget "*" style "normal"
44
__
45
 
46
        }
47
        elsif ($width>1200){
48
                $font_size=8;
49
                Gtk2::Rc->parse_string(<<__);
50
                style "normal" {
51
                                font_name ="Verdana 8"
52
                        }
53
                        widget "*" style "normal"
54
__
55
 
56
        }
57
        elsif ($width>1000){
58
            $font_size=7;
59
                Gtk2::Rc->parse_string(<<__);
60
                style "normal" {
61
                                font_name ="Verdana 7"
62
                        }
63
                        widget "*" style "normal"
64
__
65
 
66
        }
67
        else{
68
            $font_size=6;
69
                Gtk2::Rc->parse_string(<<__);
70
                style "normal" {
71
                                font_name ="Verdana 6"
72
                        }
73
                        widget "*" style "normal"
74
__
75
 
76
        }
77
        #print "            \$font_size=            $font_size\n";
78
        return      $font_size;
79
 
80
 
81
}
82
 
83
sub get_mpsoc{
84
        my ($ipgen,$soc_state,$info)=@_;
85
        my $description = "Will be available soon!";
86
        my $table = Gtk2::Table->new (15, 15, TRUE);
87
        #my $window=def_popwin_size(500,500,"Add description");
88
        my ($scrwin,$text_view)=create_text();
89
        #my $buffer = $textbox->get_buffer();
90
        my $ok=def_image_button("icons/select.png",' Ok ');
91
 
92
        $table->attach_defaults($scrwin,0,15,0,14);
93
        $table->attach_defaults($ok,6,9,14,15);
94
        my $text_buffer = $text_view->get_buffer;
95
        if(defined $text_buffer) {$text_buffer->set_text($description)};
96
 
97
        $ok->signal_connect("clicked"=> sub {
98
 
99
                my $text = $text_buffer->get_text($text_buffer->get_bounds, TRUE);
100
                # $ipgen->ipgen_set_description($text); 
101
                print "$text\n";
102
 
103
        });
104
 
105
        #$window->add($table);
106
        #$window->show_all();
107
        return $table;
108
 
109
}
110
 
111
 
112
 
113
 
114
sub main{
115
 
116
 
117
 
118
my $notebook = Gtk2::Notebook->new;
119
#$hbox->pack_start ($notebook, TRUE, TRUE, 0);
120
 
121
my($width,$hight)=max_win_size();
122
set_deafualt_font_size();
123
 
124
 
125
 
126
my $intfc_gen=  intfc_main();
127
$notebook->append_page ($intfc_gen,Gtk2::Label->new_with_mnemonic ("_Interface generator"));
128
 
129
my $ipgen=ipgen_main();
130
$notebook->append_page ($ipgen,Gtk2::Label->new_with_mnemonic ("_IP generator"));
131
 
132
my $socgen=socgen_main();
133
$notebook->append_page ($socgen,Gtk2::Label->new_with_mnemonic ("_Processing tile generator"));
134
 
135
my $mpsocgen =mpsocgen_main();
136
$notebook->append_page ($mpsocgen,Gtk2::Label->new_with_mnemonic ("_NoC based MPSoC generator"));
137
 
138
 
139
 
140
 
141
 
142
                my $scrolled_win = new Gtk2::ScrolledWindow (undef, undef);
143
                $scrolled_win->set_policy( "automatic", "automatic" );
144
                $scrolled_win->add_with_viewport($notebook);
145
 
146
                my $window = def_win_size($width-100,$hight-100,"ProNoC");
147 17 alirezamon
                #$window->add($scrolled_win);
148 16 alirezamon
 
149
 
150
                my $navIco = Gtk2::Gdk::Pixbuf->new_from_file("./icons/ProNoC.png");         # advance1.png");  
151
                $window->set_default_icon($navIco);
152
 
153
 
154 17 alirezamon
 
155
 
156
 
157
 
158
 
159
 
160
                my @entries = (
161
        ### Everything falls under the following 3 rows ###
162
        [ 'FileMenu',       undef, '_File' ],
163
        [ 'ViewMenu',       undef, '_View' ],
164
        [ 'HelpMenu',       undef, '_Help' ],
165
 
166
        # Quit
167
        [   'Exit',           'gtk-quit',
168
            'E_xit', '<control>X',
169
            undef,      sub { Gtk2->main_quit },
170
            FALSE
171
        ],
172
        # About
173
        [   'About',                          'gtk-about',
174
            '_About',                           '<control>A',
175
            undef,      \&about,
176
            FALSE
177
        ],
178
 
179
         # intf_gen help
180
        [   'interface generator',                          'gtk-about',
181
            '_Interface generator',                           'F1',
182
            undef,      \&intfc_help,
183
            FALSE
184
        ],
185
         # ip_gen help
186
        [   'ip generator',                          'gtk-about',
187
            '_IP generator',                           'F2',
188
            undef,      \&ip_help,
189
            FALSE
190
        ],
191
         # pt_gen help
192
        [   'pt generator',                          'gtk-about',
193
            '_Processing tile generator',                           'F3',
194
            undef,      \&pt_help,
195
            FALSE
196
        ],
197
);
198
 
199
    my $ui_info = "<ui>
200
        <menubar name='MenuBar'>
201
         <menu action='FileMenu'>
202
          <separator/>
203
          <menuitem action='Exit'/>
204
         </menu>
205
          <menu action='ViewMenu'>
206
         </menu>
207
         <menu action='HelpMenu'>
208
          <menuitem action='About'/>
209
          <menuitem action='interface generator'/>
210
          <menuitem action='ip generator'/>
211
          <menuitem action='pt generator'/>
212
 
213
         </menu>
214
        </menubar>
215
</ui>";
216
 
217
    my $actions = Gtk2::ActionGroup->new('Actions');
218
    $actions->add_actions( \@entries, undef );
219
 
220
    my $ui = Gtk2::UIManager->new;
221
    $ui->insert_action_group( $actions, 0 );
222
 
223
    $window->add_accel_group( $ui->get_accel_group );
224
    $ui->add_ui_from_string($ui_info);
225
   my $vbox = Gtk2::VBox->new( FALSE, 0 );
226
    $vbox->pack_start( $ui->get_widget('/MenuBar'), FALSE, FALSE, 0 );
227
    $vbox->pack_end( $scrolled_win, TRUE, TRUE,10 );
228
 
229
$window->add($vbox);
230
 
231
 
232
 
233
 
234 16 alirezamon
                $window->set_resizable (1);
235
                $window->show_all();
236
 
237
 
238
 
239
 
240
 
241
 
242
 
243
 
244
 
245
}
246
 
247
 
248
 
249 17 alirezamon
sub about {
250
    my $about = Gtk2::AboutDialog->new;
251
    $about->set_authors("Alireza Monemi\n Email: alirezamonemi\@opencores.org");
252
    $about->set_version( '1.0' );
253
    $about->set_website('http://opencores.org/project,an-fpga-implementation-of-low-latency-noc-based-mpsoc');
254
    $about->set_comments('NoC based MPSoC generator.');
255
    $about->set_license(
256
                 "This program is free software; you can redistribute it\n"
257
                . "and/or modify it under the terms of the GNU General \n"
258
                . "Public License as published by the Free Software \n"
259
                . "Foundation; either version 1, or (at your option)\n"
260
                . "any later version.\n\n"
261
 
262
        );
263
    $about->run;
264
    $about->destroy;
265
    return;
266
}
267 16 alirezamon
 
268 17 alirezamon
sub intfc_help{
269
    my $dir = Cwd::getcwd();
270
    my $help="$dir/doc/interface_gen.pdf";
271
    system qq (xdg-open $help);
272
    return;
273
 
274
}
275
 
276
sub ip_help{
277
    my $dir = Cwd::getcwd();
278
    my $help="$dir/doc/ip_gen.pdf";
279
    system qq (xdg-open $help);
280
    return;
281
}
282
 
283
 
284
 
285
sub pt_help{
286
    my $dir = Cwd::getcwd();
287
    my $help="$dir/doc/pt-gen.pdf";
288
    system qq (xdg-open $help);
289
    return;
290
}
291
 
292
 
293
 
294
 
295 16 alirezamon
Gtk2->init;
296
main;
297
Gtk2->main();

powered by: WebSVN 2.1.0

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