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/] [interface_gen.pl] - Diff between revs 25 and 34

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 25 Rev 34
Line 15... Line 15...
sub read_file_modules{
sub read_file_modules{
        my ($file,$intfc_gen,$info)=@_;
        my ($file,$intfc_gen,$info)=@_;
 
 
        if (!defined $file) {return; }
        if (!defined $file) {return; }
        if (-e $file) {
        if (-e $file) {
                my $vdb =  read_file($file);
                my $vdb =  read_verilog_file($file);
                my @modules=sort $vdb->get_modules($file);
                my @modules=sort $vdb->get_modules($file);
                #foreach my $p(@module_list) {print "$p\n"}
                #foreach my $p(@module_list) {print "$p\n"}
                $intfc_gen->intfc_set_interface_file($file);
                $intfc_gen->intfc_set_interface_file($file);
                $intfc_gen->intfc_set_module_name($modules[0]);
                $intfc_gen->intfc_set_module_name($modules[0]);
                $intfc_gen->intfc_add_module_list(@modules);
                $intfc_gen->intfc_add_module_list(@modules);
Line 175... Line 175...
 
 
 
 
 
 
sub get_interface_ports {
sub get_interface_ports {
        my ($intfc_gen,$info)=@_;
        my ($intfc_gen,$info)=@_;
        my $window=def_popwin_size(800,600,"Import Ports");
        my $window=def_popwin_size(60,60,"Import Ports",'percent');
 
 
        my $file=$intfc_gen->intfc_get_interface_file();
        my $file=$intfc_gen->intfc_get_interface_file();
        if (!defined $file){show_info(\$info,"File name has not been defined yet!");  return;}
        if (!defined $file){show_info(\$info,"File name has not been defined yet!");  return;}
        my $module=$intfc_gen->intfc_get_module_name();
        my $module=$intfc_gen->intfc_get_module_name();
        if (!defined $module){  show_info(\$info,"Module name has not been selected yet!");  return;}
        if (!defined $module){  show_info(\$info,"Module name has not been selected yet!");  return;}
        my $vdb=read_file($file);
        my $vdb=read_verilog_file($file);
        my %port_type=get_ports_type($vdb,$module);
        my %port_type=get_ports_type($vdb,$module);
        my %port_range=get_ports_rang($vdb,$module);
        my %port_range=get_ports_rang($vdb,$module);
 
 
        my $table=def_table(8,8,TRUE);
        my $table=def_table(8,8,TRUE);
        my $scrolled_win = new Gtk2::ScrolledWindow (undef, undef);
        my $scrolled_win = new Gtk2::ScrolledWindow (undef, undef);
Line 329... Line 329...
        my $entrybox=labele_widget_info(" Interface name:",$entry);
        my $entrybox=labele_widget_info(" Interface name:",$entry);
 
 
        my $combo=gen_combobox_object($intfc_gen,'connection_num',undef,"single connection,multi connection","single connection",'refresh',1);
        my $combo=gen_combobox_object($intfc_gen,'connection_num',undef,"single connection,multi connection","single connection",'refresh',1);
        my $combo_box=labele_widget_info(" Select soket type:",$combo,'Define the soket as multi connection if only all interfaces ports all output and they can feed more than one plug connection');
        my $combo_box=labele_widget_info(" Select soket type:",$combo,'Define the soket as multi connection if only all interfaces ports all output and they can feed more than one plug connection');
 
 
        $table->attach_defaults ($entrybox, 0, 2 , $row, $row+1);
        $table->attach ($entrybox, 0, 2 , $row, $row+1,'expand','shrink',2,2);
        $table->attach_defaults ($combo_box, 3, 5 , $row, $row+1);
        $table->attach ($combo_box, 3, 6 , $row, $row+1,'expand','shrink',2,2);
 
 
}
}
 
 
 
 
 
 
Line 347... Line 347...
        $intfc_gen->intfc_get_ports(\%types,\%ranges,\%names,\%connect_types,\%connect_ranges,\%connect_names,\%outport_types,\%default_outs);
        $intfc_gen->intfc_get_ports(\%types,\%ranges,\%names,\%connect_types,\%connect_ranges,\%connect_names,\%outport_types,\%default_outs);
 
 
        my $size = keys %types;
        my $size = keys %types;
        if($size >0){
        if($size >0){
                my $sep = Gtk2::HSeparator->new;
                my $sep = Gtk2::HSeparator->new;
                $table->attach_defaults ($sep, 0, 10 , $row, $row+1);    $row++;
                $table->attach ($sep, 0, 10 , $row, $row+1,'fill','fill',2,2);   $row++;
 
 
 
 
                my $swap= def_image_button("icons/swap.png","swap");
                my $swap= def_image_button("icons/swap.png","swap");
 
 
                $swap->signal_connect('clicked'=>sub{
                $swap->signal_connect('clicked'=>sub{
Line 386... Line 386...
                }
                }
 
 
                my $sep2 = Gtk2::HSeparator->new;
                my $sep2 = Gtk2::HSeparator->new;
 
 
 
 
                $table->attach ($lab1, 1, 2 , $row, $row+1,'shrink','shrink',2,2);
                $table->attach ($lab1, 1, 2 , $row, $row+1,'expand','shrink',2,2);
                $table->attach ($swap, 3, 4 , $row, $row+1,'shrink','shrink',2,2);
                $table->attach ($swap, 3, 4 , $row, $row+1,'expand','shrink',2,2);
                $table->attach ($lab2, 5, 6 , $row, $row+1,'shrink','shrink',2,2);      $row++;
                $table->attach ($lab2, 5, 6 , $row, $row+1,'expand','shrink',2,2);      $row++;
                $table->attach_defaults ($sep2, 0, 9 , $row, $row+1);    $row++;
                $table->attach ($sep2, 0, 9 , $row, $row+1,'fill','fill',2,2);   $row++;
 
 
 
 
                my $lab3= gen_label_in_center("Type");
                my $lab3= gen_label_in_center("Type");
                my $lab4= gen_label_in_center("Range");
                my $lab4= gen_label_in_center("Range");
                my $lab5= gen_label_in_center("Name");
                my $lab5= gen_label_in_center("Name");
                $table->attach_defaults ($lab3, 0, 1 , $row, $row+1);
                $table->attach ($lab3, 0, 1 , $row, $row+1,'expand','shrink',2,2);
                $table->attach_defaults ($lab4, 1, 2 , $row, $row+1);
                $table->attach ($lab4, 1, 2 , $row, $row+1,'expand','shrink',2,2);
                $table->attach_defaults ($lab5, 2, 3 , $row, $row+1);
                $table->attach ($lab5, 2, 3 , $row, $row+1,'expand','shrink',2,2);
                my $lab6= gen_label_in_center("Type");
                my $lab6= gen_label_in_center("Type");
                my $lab7= gen_label_in_center("Range");
                my $lab7= gen_label_in_center("Range");
                my $lab8= gen_label_in_center("Name");
                my $lab8= gen_label_in_center("Name");
                $table->attach_defaults ($lab6, 4, 5 , $row, $row+1);
                $table->attach ($lab6, 4, 5 , $row, $row+1,'expand','shrink',2,2);
                $table->attach_defaults ($lab7, 5, 6 , $row, $row+1);
                $table->attach ($lab7, 5, 6 , $row, $row+1,'expand','shrink',2,2);
                $table->attach_defaults ($lab8, 6, 7 , $row, $row+1);
                $table->attach ($lab8, 6, 7 , $row, $row+1,'expand','shrink',2,2);
                my $lab9= gen_label_help ("When an IP core does not have any of interface output port, the default value will be send to the IP core's input port which is supposed to be connected to that port","Output port Default ");
                my $lab9= gen_label_help ("When an IP core does not have any of interface output port, the default value will be send to the IP core's input port which is supposed to be connected to that port","Output port Default ");
                $table->attach_defaults ($lab9, 8, 9 , $row, $row+1);
                $table->attach ($lab9, 8, 9 , $row, $row+1,'expand','shrink',2,2);
                $row++;
                $row++;
 
 
                foreach my $id (sort keys %ranges){
                foreach my $id (sort keys %ranges){
                        my $type=$types{$id};
                        my $type=$types{$id};
                        my $range=$ranges{$id};
                        my $range=$ranges{$id};
Line 454... Line 454...
 
 
 
 
                        #$box->pack_start($entry3,TRUE,FALSE,3);
                        #$box->pack_start($entry3,TRUE,FALSE,3);
                        #$box->pack_start($separator,TRUE,FALSE,3);
                        #$box->pack_start($separator,TRUE,FALSE,3);
 
 
                        $table->attach_defaults ($combo1, 0, 1 , $row, $row+1);
                        $table->attach ($combo1, 0, 1 , $row, $row+1,'expand','shrink',2,2);
                        $table->attach_defaults ($entry2, 1, 2 , $row, $row+1);
                        $table->attach ($entry2, 1, 2 , $row, $row+1,'expand','shrink',2,2);
                        $table->attach_defaults ($entry3, 2, 3 , $row, $row+1);
                        $table->attach ($entry3, 2, 3 , $row, $row+1,'expand','shrink',2,2);
 
 
 
 
                        $table->attach_defaults ($connect_type_lable, 4, 5 , $row, $row+1);
                        $table->attach ($connect_type_lable, 4, 5 , $row, $row+1,'expand','shrink',2,2);
                        $table->attach_defaults ($entry4, 5, 6 , $row, $row+1);
                        $table->attach ($entry4, 5, 6 , $row, $row+1,'expand','shrink',2,2);
                        $table->attach_defaults ($entry5, 6, 7 , $row, $row+1);
                        $table->attach ($entry5, 6, 7 , $row, $row+1,'expand','shrink',2,2);
                        $table->attach_defaults ($combentry, 8, 9 , $row, $row+1);
                        $table->attach ($combentry, 8, 9 , $row, $row+1,'expand','shrink',2,2);
 
 
                        $combo1->signal_connect("changed"=>sub{
                        $combo1->signal_connect("changed"=>sub{
                                my $new_type=$combo1->get_active_text();
                                my $new_type=$combo1->get_active_text();
                                my $new_connect_type=($new_type eq "input")? "output" : ($new_type eq "output")? "input" : $new_type;
                                my $new_connect_type=($new_type eq "input")? "output" : ($new_type eq "output")? "input" : $new_type;
                                $intfc_gen->intfc_add_port($id,$new_type,$range,$name,$new_connect_type,$connect_range,$connect_name,$outport_type,$default_out);
                                $intfc_gen->intfc_add_port($id,$new_type,$range,$name,$new_connect_type,$connect_range,$connect_name,$outport_type,$default_out);
Line 544... Line 544...
 
 
        interface_type_select($intfc_gen,$info,$table,0);
        interface_type_select($intfc_gen,$info,$table,0);
        my $row=port_select($intfc_gen,$info,$table,1);
        my $row=port_select($intfc_gen,$info,$table,1);
        for (my $i=$row; $i<20; $i++){
        for (my $i=$row; $i<20; $i++){
                my $temp=gen_label_in_center(" ");
                my $temp=gen_label_in_center(" ");
                $table->attach_defaults ($temp, 0, 1 , $i, $i+1);
                #$table->attach_defaults ($temp, 0, 1 , $i, $i+1);
        }
        }
        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" );
        $scrolled_win->add_with_viewport($table);
        $scrolled_win->add_with_viewport($table);
 
 
Line 593... Line 593...
                open(FILE,  ">lib/interface/$name.ITC") || die "Can not open: $!";
                open(FILE,  ">lib/interface/$name.ITC") || die "Can not open: $!";
                print FILE perl_file_header("$name.ITC");
                print FILE perl_file_header("$name.ITC");
                print FILE Data::Dumper->Dump([\%$intfc_gen],["HashRef"]);
                print FILE Data::Dumper->Dump([\%$intfc_gen],["HashRef"]);
                close(FILE) || die "Error closing file: $!";
                close(FILE) || die "Error closing file: $!";
                #store \%$intfc_gen, "lib/$name.ITC";
                #store \%$intfc_gen, "lib/$name.ITC";
                my $message="Interface $name has been generated successfully" ;
 
                message_dialog($message);
                my $message="Interface $name has been generated successfully. In order to see this interface in IP generator you need to reset the ProNoC. Do you want to reset the ProNoC now?" ;
 
 
 
                my $dialog = Gtk2::MessageDialog->new (my $window,
 
                        'destroy-with-parent',
 
                        'question', # message type
 
                        'yes-no', # which set of buttons?
 
                        "$message");
 
                my $response = $dialog->run;
 
                if ($response eq 'yes') {
                exec($^X, $0, @ARGV);# reset ProNoC to apply changes
                exec($^X, $0, @ARGV);# reset ProNoC to apply changes
                #$hashref = retrieve('file');
                }
 
                $dialog->destroy;
 
 
 
 
        }else{
        }else{
                my $message="Category must be defined!";
                my $message="Category must be defined!";
                message_dialog($message);
                message_dialog($message);
 
 
        }
        }
Line 617... Line 628...
 
 
sub get_intfc_description{
sub get_intfc_description{
        my ($intfc_gen,$info)=@_;
        my ($intfc_gen,$info)=@_;
        my $description = $intfc_gen->intfc_get_description();
        my $description = $intfc_gen->intfc_get_description();
        my $table = Gtk2::Table->new (15, 15, TRUE);
        my $table = Gtk2::Table->new (15, 15, TRUE);
        my $window=def_popwin_size(500,500,"Add description");
        my $window=def_popwin_size(50,50,"Add description",'percent');
        my ($scrwin,$text_view)=create_text();
        my ($scrwin,$text_view)=create_text();
        #my $buffer = $textbox->get_buffer();
        #my $buffer = $textbox->get_buffer();
        my $ok=def_image_button("icons/select.png",' Ok ');
        my $ok=def_image_button("icons/select.png",' Ok ');
 
 
        $table->attach_defaults($scrwin,0,15,0,14);
        $table->attach_defaults($scrwin,0,15,0,14);
Line 702... Line 713...
        my $sbox=module_select($intfc_gen,$info);
        my $sbox=module_select($intfc_gen,$info);
 
 
 
 
        my $devbox=dev_box_show($intfc_gen,$info);
        my $devbox=dev_box_show($intfc_gen,$info);
 
 
        $main_table->attach_defaults ($fbox , 0, 12, 0,1);
        #$main_table->attach_defaults ($fbox , 0, 12, 0,1);
        $main_table->attach_defaults ($sbox , 0, 12, 1,2);
        #$main_table->attach_defaults ($sbox , 0, 12, 1,2);
        $main_table->attach_defaults ($devbox , 0, 12, 2,12);
        #$main_table->attach_defaults ($devbox , 0, 12, 2,12);
        $main_table->attach_defaults ($infobox  , 0, 12, 12,14);
        #$main_table->attach_defaults ($infobox  , 0, 12, 12,14);
 
 
 
        my $v1=def_pack_vbox(TRUE,0,$fbox,$sbox);
 
        my $v2=gen_vpaned($v1,.1,$devbox);
 
        my $v3=gen_vpaned($v2,.6,$infobox);
 
        $main_table->attach_defaults ($v3  , 0, 12, 0,14);
 
 
 
 
        $main_table->attach ($generate  , 6, 8, 14,15,'shrink','shrink',2,2);
        $main_table->attach ($generate  , 6, 8, 14,15,'shrink','shrink',2,2);
 
 
 
 
        my $open = def_image_button('icons/browse.png','Load Interface');
        my $open = def_image_button('icons/browse.png','Load Interface');
        my $openbox=def_hbox(TRUE,0);
        my $openbox=def_hbox(TRUE,0);
Line 719... Line 737...
        #referesh the mpsoc generator 
        #referesh the mpsoc generator 
        $refresh-> signal_connect("clicked" => sub{
        $refresh-> signal_connect("clicked" => sub{
                $devbox->destroy();
                $devbox->destroy();
                $fbox->destroy();
                $fbox->destroy();
                $sbox->destroy();
                $sbox->destroy();
 
                $v1->destroy();
                select(undef, undef, undef, 0.1); #wait 10 ms
                select(undef, undef, undef, 0.1); #wait 10 ms
                $devbox=dev_box_show($intfc_gen,$info);
                $devbox=dev_box_show($intfc_gen,$info);
                $fbox=file_box($intfc_gen,$info);
                $fbox=file_box($intfc_gen,$info);
                $sbox=module_select($intfc_gen,$info);
                $sbox=module_select($intfc_gen,$info);
                $main_table->attach_defaults ($fbox , 0, 12, 0,1);
                $v1=def_pack_vbox(TRUE,0,$fbox,$sbox);
                $main_table->attach_defaults ($sbox , 0, 12, 1,2);
                $v2->pack1($v1,TRUE, TRUE);
                $main_table->attach_defaults ($devbox , 0, 12, 3,12);
                $v2->pack2($devbox,TRUE, TRUE);
 
                $v3-> pack1($v2, TRUE, TRUE);
                $devbox->show_all();
                #$main_table->attach_defaults ($v3  , 0, 12, 0,14);
                $sbox->show_all();
 
                $fbox->show_all();
                $v3->show_all();
 
 
        });
        });
 
 
 
 
 
 
 
 

powered by: WebSVN 2.1.0

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