#!/usr/bin/perl -w
|
#!/usr/bin/perl -w
|
use strict;
|
use strict;
|
use warnings;
|
use warnings;
|
|
|
use constant::boolean;
|
use constant::boolean;
|
|
|
use FindBin;
|
use FindBin;
|
use lib $FindBin::Bin;
|
use lib $FindBin::Bin;
|
|
|
use Data::Dumper;
|
use Data::Dumper;
|
use File::Which;
|
use File::Which;
|
use File::Basename;
|
use File::Basename;
|
|
|
use IPC::Run qw( harness start pump finish timeout );
|
use IPC::Run qw( harness start pump finish timeout );
|
|
|
use Consts;
|
use Consts;
|
BEGIN {
|
BEGIN {
|
my $module = (Consts::GTK_VERSION==2) ? 'Gtk2' : 'Gtk3';
|
my $module = (Consts::GTK_VERSION==2) ? 'Gtk2' : 'Gtk3';
|
my $file = $module;
|
my $file = $module;
|
$file =~ s[::][/]g;
|
$file =~ s[::][/]g;
|
$file .= '.pm';
|
$file .= '.pm';
|
require $file;
|
require $file;
|
$module->import;
|
$module->import;
|
}
|
}
|
|
|
|
|
|
|
require "widget.pl";
|
require "widget.pl";
|
require "uart.pl";
|
require "uart.pl";
|
require "compile.pl";
|
require "compile.pl";
|
|
|
|
|
use String::Scanf; # imports sscanf()
|
use String::Scanf; # imports sscanf()
|
|
|
|
|
use constant JTAG_UPDATE_WB_ADDR => 7;
|
use constant JTAG_UPDATE_WB_ADDR => 7;
|
use constant JTAG_UPDATE_WB_WR_DATA=> 6;
|
use constant JTAG_UPDATE_WB_WR_DATA=> 6;
|
use constant JTAG_UPDATE_WB_RD_DATA => 5;
|
use constant JTAG_UPDATE_WB_RD_DATA => 5;
|
|
|
|
|
use base 'Class::Accessor::Fast';
|
use base 'Class::Accessor::Fast';
|
__PACKAGE__->mk_accessors(qw{
|
__PACKAGE__->mk_accessors(qw{
|
window
|
window
|
sourceview
|
sourceview
|
});
|
});
|
|
|
my $NAME = 'Soure Probe';
|
my $NAME = 'Soure Probe';
|
my $path = "";
|
my $path = "";
|
our $FONT_SIZE='default';
|
|
our $ICON_SIZE='default';
|
|
|
|
my %memory;
|
my %memory;
|
my %status;
|
my %status;
|
|
|
|
|
sub source_probe_stand_alone(){
|
sub source_probe_stand_alone(){
|
$path = "../../";
|
$path = "../../";
|
set_path_env();
|
set_path_env();
|
my $project_dir = get_project_dir(); #mpsoc dir addr
|
my $project_dir = get_project_dir(); #mpsoc dir addr
|
my $paths_file= "$project_dir/mpsoc/perl_gui/lib/Paths";
|
my $paths_file= "$project_dir/mpsoc/perl_gui/lib/Paths";
|
if (-f $paths_file){#} && defined $ENV{PRONOC_WORK} ) {
|
if (-f $paths_file){#} && defined $ENV{PRONOC_WORK} ) {
|
my $paths= do $paths_file;
|
my $paths= do $paths_file;
|
my %p=%{$paths};
|
set_gui_setting($paths);
|
$FONT_SIZE= $p{'GUI_SETTING'}{'FONT_SIZE'} if (defined $p{'GUI_SETTING'}{'FONT_SIZE'});
|
|
$ICON_SIZE= $p{'GUI_SETTING'}{'ICON_SIZE'} if (defined $p{'GUI_SETTING'}{'ICON_SIZE'});
|
|
}
|
}
|
|
|
set_defualt_font_size();
|
set_defualt_font_size();
|
my $window=source_probe_main();
|
my $window=source_probe_main();
|
$window->signal_connect (destroy => sub { gui_quite();});
|
$window->signal_connect (destroy => sub { gui_quite();});
|
}
|
}
|
|
|
exit gtk_gui_run(\&source_probe_stand_alone) unless caller;
|
exit gtk_gui_run(\&source_probe_stand_alone) unless caller;
|
|
|
|
|
sub get_jtag_intfc_rst_cmd {
|
sub get_jtag_intfc_rst_cmd {
|
my $self=shift;
|
my $self=shift;
|
|
|
my $vendor = $self->object_get_attribute('CTRL','VENDOR');
|
my $vendor = $self->object_get_attribute('CTRL','VENDOR');
|
my $board = $self->object_get_attribute('CTRL','Board_Name');
|
my $board = $self->object_get_attribute('CTRL','Board_Name');
|
my $chain = $self->object_get_attribute('CTRL','RESET_CHAIN');
|
my $chain = $self->object_get_attribute('CTRL','RESET_CHAIN');
|
my $index = 127;
|
my $index = 127;
|
my $pronoc = get_project_dir();
|
my $pronoc = get_project_dir();
|
my $intfc = "$pronoc/mpsoc/boards/$vendor/$board/jtag_intfc.sh";
|
my $intfc = "$pronoc/mpsoc/boards/$vendor/$board/jtag_intfc.sh";
|
#my $script = "$ENV{'PRONOC_WORK'}/tmp/script.bash";
|
#my $script = "$ENV{'PRONOC_WORK'}/tmp/script.bash";
|
|
|
my $t = ($vendor eq 'Xilinx') ? "-t $chain " : "";
|
my $t = ($vendor eq 'Xilinx') ? "-t $chain " : "";
|
|
|
my $cmd = "bash -c \"source $intfc; \\\$JTAG_INTFC $t -n $index";
|
my $cmd = "bash -c \"source $intfc; \\\$JTAG_INTFC $t -n $index";
|
return $cmd;
|
return $cmd;
|
|
|
}
|
}
|
|
|
|
|
sub jtag_enable_cpus_func{
|
sub jtag_enable_cpus_func{
|
my ($self,$new,$tview)=@_;
|
my ($self,$new,$tview)=@_;
|
my $intfc = get_jtag_intfc_rst_cmd($self);
|
my $intfc = get_jtag_intfc_rst_cmd($self);
|
my $e = ($new eq 'Enabled')? 0 : 2;
|
my $e = ($new eq 'Enabled')? 0 : 2;
|
my $cmd = "$intfc -d I:1,D:2:$e,I:0\"";
|
my $cmd = "$intfc -d I:1,D:2:$e,I:0\"";
|
add_info($tview,"$cmd\n");
|
add_info($tview,"$cmd\n");
|
my $results =run_cmd_textview_errors($cmd,$tview);
|
my $results =run_cmd_textview_errors($cmd,$tview);
|
return 1 if(!defined $results);
|
return 1 if(!defined $results);
|
|
|
}
|
}
|
|
|
sub jtag_reset_cpus_func {
|
sub jtag_reset_cpus_func {
|
my ($self,$tview)=@_;
|
my ($self,$tview)=@_;
|
my $intfc = get_jtag_intfc_rst_cmd($self);
|
my $intfc = get_jtag_intfc_rst_cmd($self);
|
|
|
my $cmd = "$intfc -d I:1,D:2:1,D:2:0,I:0\"";
|
my $cmd = "$intfc -d I:1,D:2:1,D:2:0,I:0\"";
|
add_info($tview,"$cmd\n");
|
add_info($tview,"$cmd\n");
|
my $results =run_cmd_textview_errors($cmd,$tview);
|
my $results =run_cmd_textview_errors($cmd,$tview);
|
return 1 if(!defined $results);
|
return 1 if(!defined $results);
|
|
|
};
|
};
|
|
|
|
|
|
|
|
|
|
|
sub source_probe_ctrl {
|
sub source_probe_ctrl {
|
my ($self,$tview)=@_;
|
my ($self,$tview)=@_;
|
my $table= def_table(2,10,FALSE);
|
my $table= def_table(2,10,FALSE);
|
|
|
my $vendor= $self->object_get_attribute('CTRL','VENDOR');
|
my $vendor= $self->object_get_attribute('CTRL','VENDOR');
|
$vendor= 'Xilinx' if(!defined $vendor);
|
$vendor= 'Xilinx' if(!defined $vendor);
|
|
|
|
|
#get the list of boards located in "boards/*" folder
|
#get the list of boards located in "boards/*" folder
|
my $pronoc = get_project_dir();
|
my $pronoc = get_project_dir();
|
|
|
my @dirs = grep {-d} glob("$pronoc/mpsoc/boards/$vendor/*");
|
my @dirs = grep {-d} glob("$pronoc/mpsoc/boards/$vendor/*");
|
my ($fpgas,$init);
|
my ($fpgas,$init);
|
|
|
|
|
foreach my $dir (@dirs) {
|
foreach my $dir (@dirs) {
|
my ($name,$path,$suffix) = fileparse("$dir",qr"\..[^.]*$");
|
my ($name,$path,$suffix) = fileparse("$dir",qr"\..[^.]*$");
|
$fpgas= (defined $fpgas)? "$fpgas,$name" : "$name";
|
$fpgas= (defined $fpgas)? "$fpgas,$name" : "$name";
|
$init="$name";
|
$init="$name";
|
}
|
}
|
|
|
|
|
my @info = (
|
my @info = (
|
{ label=>" FPGA Vendor name: ", param_name=>'VENDOR', type=>"Combo-box", default_val=>'Xilinx', content=>"Xilinx,Altera", info=>undef, param_parent=>'CTRL', ref_delay=> 1, new_status=>'ref_ctrl', loc=>'vertical'},
|
{ label=>" FPGA Vendor name: ", param_name=>'VENDOR', type=>"Combo-box", default_val=>'Xilinx', content=>"Xilinx,Altera", info=>undef, param_parent=>'CTRL', ref_delay=> 1, new_status=>'ref_ctrl', loc=>'vertical'},
|
{ label=>" Board Name ", param_name=>'Board_Name', type=>"Combo-box", default_val=>$init, content=>$fpgas, info=>undef, param_parent=>'CTRL', ref_delay=> undef, new_status=>undef, loc=>'vertical'},
|
{ label=>" Board Name ", param_name=>'Board_Name', type=>"Combo-box", default_val=>$init, content=>$fpgas, info=>undef, param_parent=>'CTRL', ref_delay=> undef, new_status=>undef, loc=>'vertical'},
|
{ label=>" JTAG Index: ", param_name=>'JTAG_INDEX', type=>"Spin-button", default_val=>0, content=>"0,128,1", info=>undef, param_parent=>'CTRL', ref_delay=> undef, new_status=> undef, loc=>'vertical'}
|
{ label=>" JTAG Index: ", param_name=>'JTAG_INDEX', type=>"Spin-button", default_val=>0, content=>"0,128,1", info=>undef, param_parent=>'CTRL', ref_delay=> undef, new_status=> undef, loc=>'vertical'}
|
);
|
);
|
|
|
|
|
|
|
if ($vendor eq "Xilinx" ) {
|
if ($vendor eq "Xilinx" ) {
|
push (@info,{ label=>" JTAG CHAIN ", param_name=>'JTAG_CHAIN', type=>"Combo-box", default_val=>4, content=>"1,2,3,4", info=>undef, param_parent=>'CTRL', ref_delay=> 0, new_status=>'ref_ctrl', loc=>'vertical'}) ;
|
push (@info,{ label=>" JTAG CHAIN ", param_name=>'JTAG_CHAIN', type=>"Combo-box", default_val=>4, content=>"1,2,3,4", info=>undef, param_parent=>'CTRL', ref_delay=> 0, new_status=>'ref_ctrl', loc=>'vertical'}) ;
|
|
|
}
|
}
|
|
|
|
|
my ($row,$col)=(0,6);
|
my ($row,$col)=(0,6);
|
|
|
foreach my $d (@info) {
|
foreach my $d (@info) {
|
my $wiget;
|
my $wiget;
|
($row,$col,$wiget)=add_param_widget ($self, $d->{label}, $d->{param_name}, $d->{default_val}, $d->{type}, $d->{content}, $d->{info}, $table,$row,$col,1, $d->{param_parent}, $d->{ref_delay}, $d->{new_status}, $d->{loc});
|
($row,$col,$wiget)=add_param_widget ($self, $d->{label}, $d->{param_name}, $d->{default_val}, $d->{type}, $d->{content}, $d->{info}, $table,$row,$col,1, $d->{param_parent}, $d->{ref_delay}, $d->{new_status}, $d->{loc});
|
my $sc=$col;
|
my $sc=$col;
|
if($d->{param_name} eq 'Board_Name'){
|
if($d->{param_name} eq 'Board_Name'){
|
my $add=def_image_button("icons/plus.png");
|
my $add=def_image_button("icons/plus.png");
|
$table->attach ($add, $sc+4, $sc+5,$row-1,$row,'shrink','shrink',2,2);
|
$table->attach ($add, $sc+4, $sc+5,$row-1,$row,'shrink','shrink',2,2);
|
set_tip($add, "Add new FPGA Board");
|
set_tip($add, "Add new FPGA Board");
|
$add-> signal_connect("clicked" => sub{
|
$add-> signal_connect("clicked" => sub{
|
add_new_fpga_board($self,undef,undef,undef,undef,$vendor);
|
add_new_fpga_board($self,undef,undef,undef,undef,$vendor);
|
});
|
});
|
|
|
}
|
}
|
|
|
|
|
}
|
}
|
|
|
|
|
$table->attach ( gen_Vsep(), 5, 6 , 0, $row+1,'fill','fill',2,2);
|
$table->attach ( gen_Vsep(), 5, 6 , 0, $row+1,'fill','fill',2,2);
|
|
|
#Column 2
|
#Column 2
|
$row=0;$col=0;
|
$row=0;$col=0;
|
my $d={ label=>" Number of Sources/Probes:", param_name=>'SP_NUM', type=>"Spin-button", default_val=>1, content=>"1,128,1", info=>undef, param_parent=>'CTRL', ref_delay=> 1, new_status=>'ref_all', loc=>'vertical'};
|
my $d={ label=>" Number of Sources/Probes:", param_name=>'SP_NUM', type=>"Spin-button", default_val=>1, content=>"1,128,1", info=>undef, param_parent=>'CTRL', ref_delay=> 1, new_status=>'ref_all', loc=>'vertical'};
|
($row,$col)=add_param_widget ($self, $d->{label}, $d->{param_name}, $d->{default_val}, $d->{type}, $d->{content}, $d->{info}, $table,$row,$col,1, $d->{param_parent}, $d->{ref_delay}, $d->{new_status}, $d->{loc});
|
($row,$col)=add_param_widget ($self, $d->{label}, $d->{param_name}, $d->{default_val}, $d->{type}, $d->{content}, $d->{info}, $table,$row,$col,1, $d->{param_parent}, $d->{ref_delay}, $d->{new_status}, $d->{loc});
|
$d={ label=>" Address format: ", param_name=>'R_ADDR_FORMAT', type=>"Combo-box", default_val=>'Decimal', content=>"Decimal,Hexadecimal", info=>undef, param_parent=>'FILE_VIEW', ref_delay=> 1, new_status=>'ref_file_view', loc=>'vertical'},
|
$d={ label=>" Address format: ", param_name=>'R_ADDR_FORMAT', type=>"Combo-box", default_val=>'Decimal', content=>"Decimal,Hexadecimal", info=>undef, param_parent=>'FILE_VIEW', ref_delay=> 1, new_status=>'ref_file_view', loc=>'vertical'},
|
($row,$col)=add_param_widget ($self, $d->{label}, $d->{param_name}, $d->{default_val}, $d->{type}, $d->{content}, $d->{info}, $table,$row,$col,1, $d->{param_parent}, $d->{ref_delay}, $d->{new_status}, $d->{loc});
|
($row,$col)=add_param_widget ($self, $d->{label}, $d->{param_name}, $d->{default_val}, $d->{type}, $d->{content}, $d->{info}, $table,$row,$col,1, $d->{param_parent}, $d->{ref_delay}, $d->{new_status}, $d->{loc});
|
|
|
|
|
#enable
|
#enable
|
my $en_state=$self->object_get_attribute("CTRL","enable");
|
my $en_state=$self->object_get_attribute("CTRL","enable");
|
if (!defined $en_state){
|
if (!defined $en_state){
|
$en_state='Enabled' ;
|
$en_state='Enabled' ;
|
$self->object_add_attribute("CTRL","enable",$en_state);
|
$self->object_add_attribute("CTRL","enable",$en_state);
|
}
|
}
|
my $enable= ($en_state eq 'Enabled')? def_colored_button('Enabled',17): def_colored_button('Disabled',4);
|
my $enable= ($en_state eq 'Enabled')? def_colored_button('Enabled',17): def_colored_button('Disabled',4);
|
|
|
my $reset= def_button('Reset');
|
my $reset= def_button('Reset');
|
|
|
if ($vendor eq "Xilinx" ) {
|
if ($vendor eq "Xilinx" ) {
|
|
|
my $w=gen_combobox_object ($self,'CTRL','RESET_CHAIN',"4,3,2,1","4",undef,undef);
|
my $w=gen_combobox_object ($self,'CTRL','RESET_CHAIN',"4,3,2,1","4",undef,undef);
|
my $h=gen_button_message ("The JTAG remote reset/enable is connected to the Jtag tab chain with the largest chain number in each tile. ","icons/help.png");
|
my $h=gen_button_message ("The JTAG remote reset/enable is connected to the Jtag tab chain with the largest chain number in each tile. ","icons/help.png");
|
my $b= def_pack_hbox(FALSE,0,(gen_label_in_center ("CPU(s) Chain:"),$w,$h));
|
my $b= def_pack_hbox(FALSE,0,(gen_label_in_center ("CPU(s) Chain:"),$w,$h));
|
$table->attach ($b , $col, $col+1,$row,$row+1,'shrink','shrink',2,2); $col+=1;
|
$table->attach ($b , $col, $col+1,$row,$row+1,'shrink','shrink',2,2); $col+=1;
|
|
|
}else{
|
}else{
|
$table->attach (gen_label_in_center ("CPU(s)") , $col, $col+1,$row,$row+1,'shrink','shrink',2,2); $col+=1;
|
$table->attach (gen_label_in_center ("CPU(s)") , $col, $col+1,$row,$row+1,'shrink','shrink',2,2); $col+=1;
|
}
|
}
|
|
|
$table->attach ($reset , $col, $col+1,$row,$row+1,'shrink','shrink',2,2); $col+=1;
|
$table->attach ($reset , $col, $col+1,$row,$row+1,'shrink','shrink',2,2); $col+=1;
|
$table->attach ($enable , $col, $col+1,$row,$row+1,'shrink','shrink',2,2); $row++;
|
$table->attach ($enable , $col, $col+1,$row,$row+1,'shrink','shrink',2,2); $row++;
|
|
|
$enable -> signal_connect("clicked" => sub{
|
$enable -> signal_connect("clicked" => sub{
|
my $en_state=$self->object_get_attribute("CTRL","enable");
|
my $en_state=$self->object_get_attribute("CTRL","enable");
|
my $new = ($en_state eq 'Enabled')? 'Disabled' : 'Enabled';
|
my $new = ($en_state eq 'Enabled')? 'Disabled' : 'Enabled';
|
jtag_enable_cpus_func($self,$new,$tview);
|
jtag_enable_cpus_func($self,$new,$tview);
|
$self->object_add_attribute("CTRL","enable",$new);
|
$self->object_add_attribute("CTRL","enable",$new);
|
set_gui_status($self,"ref",1);
|
set_gui_status($self,"ref",1);
|
});
|
});
|
|
|
$reset -> signal_connect("clicked" => sub{
|
$reset -> signal_connect("clicked" => sub{
|
jtag_reset_cpus_func($self,$tview);
|
jtag_reset_cpus_func($self,$tview);
|
});
|
});
|
|
|
|
|
my $scrolled_win=gen_scr_win_with_adjst ($self,"receive_box");
|
my $scrolled_win=gen_scr_win_with_adjst ($self,"receive_box");
|
add_widget_to_scrolled_win($table,$scrolled_win);
|
add_widget_to_scrolled_win($table,$scrolled_win);
|
return $scrolled_win;
|
return $scrolled_win;
|
}
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub soure_probe_widgets_old {
|
sub soure_probe_widgets_old {
|
my $self=shift;
|
my $self=shift;
|
my $table= def_table(2,10,FALSE);
|
my $table= def_table(2,10,FALSE);
|
my $scrolled_win=gen_scr_win_with_adjst ($self,"receive_box");
|
my $scrolled_win=gen_scr_win_with_adjst ($self,"receive_box");
|
add_widget_to_scrolled_win($table,$scrolled_win);
|
add_widget_to_scrolled_win($table,$scrolled_win);
|
my $num = $self->object_get_attribute('CTRL','SP_NUM');
|
my $num = $self->object_get_attribute('CTRL','SP_NUM');
|
|
|
my $y= 0;
|
my $y= 0;
|
my $x= 0;
|
my $x= 0;
|
|
|
$table->attach (gen_label_in_center(" Source "), 0, 3 , $y, $y+1,'shrink','shrink',2,2);
|
$table->attach (gen_label_in_center(" Source "), 0, 3 , $y, $y+1,'shrink','shrink',2,2);
|
$table->attach (gen_label_in_center(" Probe "), 4, 7 , $y, $y+1,'shrink','shrink',2,2);
|
$table->attach (gen_label_in_center(" Probe "), 4, 7 , $y, $y+1,'shrink','shrink',2,2);
|
$y++;
|
$y++;
|
$table->attach ( gen_Hsep(), 0, 7 , $y, $y+1, 'fill','shrink',2,2);
|
$table->attach ( gen_Hsep(), 0, 7 , $y, $y+1, 'fill','shrink',2,2);
|
|
|
$y++;
|
$y++;
|
my @sources;
|
my @sources;
|
for (my $i=0; $i<$num; $i+=1){
|
for (my $i=0; $i<$num; $i+=1){
|
my $n=$i+1;
|
my $n=$i+1;
|
$table->attach (gen_label_in_left(" $n- "), $x, $x+1 , $y, $y+1,'shrink','shrink',2,2); $x++;
|
$table->attach (gen_label_in_left(" $n- "), $x, $x+1 , $y, $y+1,'shrink','shrink',2,2); $x++;
|
my $entry=gen_entry( );
|
my $entry=gen_entry( );
|
$table->attach ($entry, $x, $x+1 , $y, $y+1,'shrink','shrink',2,2); $x++;
|
$table->attach ($entry, $x, $x+1 , $y, $y+1,'shrink','shrink',2,2); $x++;
|
|
|
my $enter=def_image_button("icons/write.png","Write");
|
my $enter=def_image_button("icons/write.png","Write");
|
|
|
$table->attach ($enter, $x, $x+1 , $y, $y+1,'shrink','shrink',2,2); $x++;
|
$table->attach ($enter, $x, $x+1 , $y, $y+1,'shrink','shrink',2,2); $x++;
|
|
|
$x++; #sep
|
$x++; #sep
|
|
|
#probe
|
#probe
|
#$table->attach (gen_label_in_left(" Probe: " ) , $x, $x+1 , $y, $y+1,'shrink','shrink',2,2); $x++;
|
#$table->attach (gen_label_in_left(" Probe: " ) , $x, $x+1 , $y, $y+1,'shrink','shrink',2,2); $x++;
|
my $probe_val = $self-> object_get_attribute('SP','PROBE_$n');
|
my $probe_val = $self-> object_get_attribute('SP','PROBE_$n');
|
|
|
my $probe_label= gen_label_in_left(" ");
|
my $probe_label= gen_label_in_left(" ");
|
|
|
${probe_val}=25 if ($n ==1);
|
${probe_val}=25 if ($n ==1);
|
|
|
$probe_label->set_markup("<span foreground= 'red' ><b>XXXX</b></span>") if(!defined $probe_val );
|
$probe_label->set_markup("<span foreground= 'red' ><b>XXXX</b></span>") if(!defined $probe_val );
|
$probe_label->set_markup("<span foreground= 'blue' ><b></b> ${probe_val} </span>") unless(!defined $probe_val );
|
$probe_label->set_markup("<span foreground= 'blue' ><b></b> ${probe_val} </span>") unless(!defined $probe_val );
|
|
|
my $frame = gen_frame();
|
my $frame = gen_frame();
|
$frame->set_shadow_type ('in');
|
$frame->set_shadow_type ('in');
|
# Animation
|
# Animation
|
$frame->add ($probe_label);
|
$frame->add ($probe_label);
|
|
|
|
|
$table->attach ($frame, $x, $x+1 , $y, $y+1,'shrink','shrink',2,2); $x++;
|
$table->attach ($frame, $x, $x+1 , $y, $y+1,'shrink','shrink',2,2); $x++;
|
my $read=def_image_button("icons/simulator.png","Read");
|
my $read=def_image_button("icons/simulator.png","Read");
|
$table->attach ($read, $x, $x+1 , $y, $y+1,'shrink','shrink',2,2); $x++;
|
$table->attach ($read, $x, $x+1 , $y, $y+1,'shrink','shrink',2,2); $x++;
|
|
|
$y++; $x=0;
|
$y++; $x=0;
|
$table->attach (gen_Hsep(), 0, 7 , $y, $y+1, 'fill','shrink',2,2);
|
$table->attach (gen_Hsep(), 0, 7 , $y, $y+1, 'fill','shrink',2,2);
|
$y++;
|
$y++;
|
|
|
}
|
}
|
|
|
$table->attach ( gen_Vsep(), 3, 4 , 0, $y+1,'fill','fill',2,2);
|
$table->attach ( gen_Vsep(), 3, 4 , 0, $y+1,'fill','fill',2,2);
|
$table->attach ( gen_Vsep(), 6, 7 , 0, $y+1,'fill','fill',2,2);
|
$table->attach ( gen_Vsep(), 6, 7 , 0, $y+1,'fill','fill',2,2);
|
|
|
return ($scrolled_win,\@sources);
|
return ($scrolled_win,\@sources);
|
}
|
}
|
|
|
sub read_mem_specefic_addr{
|
sub read_mem_specefic_addr{
|
my ($self,$addr,$tview)=@_;
|
my ($self,$addr,$tview)=@_;
|
add_info($tview,"Read addr: $addr\n");
|
add_info($tview,"Read addr: $addr\n");
|
my $intfc = get_jtag_intfc_cmd($self);
|
my $intfc = get_jtag_intfc_cmd($self);
|
$addr=($addr>>2);
|
$addr=($addr>>2);
|
$addr=sprintf("%x",$addr);
|
$addr=sprintf("%x",$addr);
|
my $cmd = "$intfc -d I:${\JTAG_UPDATE_WB_RD_DATA},R:32:$addr,I:0\"";
|
my $cmd = "$intfc -d I:${\JTAG_UPDATE_WB_RD_DATA},R:32:$addr,I:0\"";
|
add_info($tview,"$cmd\n");
|
add_info($tview,"$cmd\n");
|
my $results =run_cmd_textview_errors($cmd,$tview);
|
my $results =run_cmd_textview_errors($cmd,$tview);
|
return 1 if(!defined $results);
|
return 1 if(!defined $results);
|
my ($hex)= sscanf("###read data#0x%s###read data#", $results);
|
my ($hex)= sscanf("###read data#0x%s###read data#", $results);
|
###read data#0x18000000###read data#
|
###read data#0x18000000###read data#
|
#add_info($tview," $results \n");
|
#add_info($tview," $results \n");
|
#add_info($tview," $hex \n");
|
#add_info($tview," $hex \n");
|
return $hex;
|
return $hex;
|
}
|
}
|
|
|
|
|
sub write_mem_specefic_addr {
|
sub write_mem_specefic_addr {
|
my ($self,$addr,$value,$tview)=@_;
|
my ($self,$addr,$value,$tview)=@_;
|
my $intfc = get_jtag_intfc_cmd($self);
|
my $intfc = get_jtag_intfc_cmd($self);
|
$addr=($addr>>2);
|
$addr=($addr>>2);
|
$addr=sprintf("%x",$addr);
|
$addr=sprintf("%x",$addr);
|
my $cmd = "$intfc -d I:${\JTAG_UPDATE_WB_ADDR},D:32:$addr,I:${\JTAG_UPDATE_WB_WR_DATA},D:32:$value,I:0\"";
|
my $cmd = "$intfc -d I:${\JTAG_UPDATE_WB_ADDR},D:32:$addr,I:${\JTAG_UPDATE_WB_WR_DATA},D:32:$value,I:0\"";
|
add_info($tview,"$cmd\n");
|
add_info($tview,"$cmd\n");
|
my $results =run_cmd_textview_errors($cmd,$tview);
|
my $results =run_cmd_textview_errors($cmd,$tview);
|
return 1 if(!defined $results);
|
return 1 if(!defined $results);
|
}
|
}
|
|
|
sub soure_probe_widgets {
|
sub soure_probe_widgets {
|
my ($self,$tview)=@_;
|
my ($self,$tview)=@_;
|
my $table= def_table(2,10,FALSE);
|
my $table= def_table(2,10,FALSE);
|
my $scrolled_win=gen_scr_win_with_adjst ($self,"receive_box");
|
my $scrolled_win=gen_scr_win_with_adjst ($self,"receive_box");
|
add_widget_to_scrolled_win($table,$scrolled_win);
|
add_widget_to_scrolled_win($table,$scrolled_win);
|
my $num = $self->object_get_attribute('CTRL','SP_NUM');
|
my $num = $self->object_get_attribute('CTRL','SP_NUM');
|
$num = 1 if (!defined $num);
|
$num = 1 if (!defined $num);
|
my $y= 0;
|
my $y= 0;
|
my $x= 0;
|
my $x= 0;
|
|
|
|
|
|
|
|
|
|
|
$table->attach (gen_label_in_center(" Address (in byte)"), 0, 1 , $y, $y+1,'shrink','shrink',2,2);
|
$table->attach (gen_label_in_center(" Address (in byte)"), 0, 1 , $y, $y+1,'shrink','shrink',2,2);
|
$table->attach (gen_label_in_center(" Memory Content "), 2, 3 , $y, $y+1,'shrink','shrink',2,2);
|
$table->attach (gen_label_in_center(" Memory Content "), 2, 3 , $y, $y+1,'shrink','shrink',2,2);
|
$table->attach (gen_label_in_center(" Action "), 4, 6 , $y, $y+1,'shrink','shrink',2,2);
|
$table->attach (gen_label_in_center(" Action "), 4, 6 , $y, $y+1,'shrink','shrink',2,2);
|
$y++;
|
$y++;
|
|
|
$table->attach ( gen_Hsep(), 0, 6 , $y, $y+1, 'fill','shrink',2,2);
|
$table->attach ( gen_Hsep(), 0, 6 , $y, $y+1, 'fill','shrink',2,2);
|
|
|
$y++;
|
$y++;
|
$x= 0;
|
$x= 0;
|
|
|
for (my $i=0; $i<$num; $i+=1){
|
for (my $i=0; $i<$num; $i+=1){
|
my $n=$i+1;
|
my $n=$i+1;
|
my $status=0;
|
my $status=0;
|
#$table->attach (gen_label_in_left(" $n-address "), $x, $x+1 , $y, $y+1,'shrink','shrink',2,2); $x++;
|
#$table->attach (gen_label_in_left(" $n-address "), $x, $x+1 , $y, $y+1,'shrink','shrink',2,2); $x++;
|
# ($y,$x,$addr)=add_param_widget ($self,"$n-", "$n-address", 0, "Spin-button", "0,99999999,1", undef, $table,$y,$x,1, "JTAG_WB", undef, undef, 'horizontal');
|
# ($y,$x,$addr)=add_param_widget ($self,"$n-", "$n-address", 0, "Spin-button", "0,99999999,1", undef, $table,$y,$x,1, "JTAG_WB", undef, undef, 'horizontal');
|
# ($y,$x,$entry)=add_param_widget ($self,undef, "$n-value", 0, "Entry", undef, undef, $table,$y,$x,1, "JTAG_WB", undef, undef, 'horizontal');
|
# ($y,$x,$entry)=add_param_widget ($self,undef, "$n-value", 0, "Entry", undef, undef, $table,$y,$x,1, "JTAG_WB", undef, undef, 'horizontal');
|
|
|
my $addr = gen_entry(0);
|
my $addr = gen_entry(0);
|
my $entry =gen_entry('xxxxxxxx');
|
my $entry =gen_entry('xxxxxxxx');
|
my $read=def_image_button($path."icons/simulator.png","Read");
|
my $read=def_image_button($path."icons/simulator.png","Read");
|
my $write=def_image_button($path."icons/write.png","Write");
|
my $write=def_image_button($path."icons/write.png","Write");
|
|
|
|
|
$entry->set_max_length (8);
|
$entry->set_max_length (8);
|
$entry->set_width_chars(8);
|
$entry->set_width_chars(8);
|
|
|
$table->attach ($addr, $x, $x+1 , $y, $y+1,'shrink','shrink',2,2); $x+=2;
|
$table->attach ($addr, $x, $x+1 , $y, $y+1,'shrink','shrink',2,2); $x+=2;
|
$table->attach ($entry, $x, $x+1 , $y, $y+1,'shrink','shrink',2,2); $x+=2;
|
$table->attach ($entry, $x, $x+1 , $y, $y+1,'shrink','shrink',2,2); $x+=2;
|
$table->attach ($read, $x, $x+1 , $y, $y+1,'shrink','shrink',2,2); $x++;
|
$table->attach ($read, $x, $x+1 , $y, $y+1,'shrink','shrink',2,2); $x++;
|
$table->attach ($write, $x, $x+1 , $y, $y+1,'shrink','shrink',2,2); $x++;
|
$table->attach ($write, $x, $x+1 , $y, $y+1,'shrink','shrink',2,2); $x++;
|
my $sy= $y;
|
my $sy= $y;
|
my $sx=7;
|
my $sx=7;
|
|
|
$y++; $x=0;
|
$y++; $x=0;
|
$table->attach ( gen_Hsep(), 0, $sx , $y, $y+1, 'fill','shrink',2,2);
|
$table->attach ( gen_Hsep(), 0, $sx , $y, $y+1, 'fill','shrink',2,2);
|
$y++;
|
$y++;
|
|
|
|
|
|
|
$read-> signal_connect("clicked" => sub{
|
$read-> signal_connect("clicked" => sub{
|
my $address=$addr->get_text();
|
my $address=$addr->get_text();
|
my $format =$self-> object_get_attribute('FILE_VIEW','R_ADDR_FORMAT');
|
my $format =$self-> object_get_attribute('FILE_VIEW','R_ADDR_FORMAT');
|
$format= 'Decimal' if (!defined $format);
|
$format= 'Decimal' if (!defined $format);
|
$address = hex($address) unless($format eq 'Decimal');
|
$address = hex($address) unless($format eq 'Decimal');
|
my $load= show_gif("icons/load.gif");
|
my $load= show_gif("icons/load.gif");
|
$table->attach ($load,$sx, $sx+1 , $sy, $sy+1,'shrink','shrink',0,0);
|
$table->attach ($load,$sx, $sx+1 , $sy, $sy+1,'shrink','shrink',0,0);
|
$table->show_all();
|
$table->show_all();
|
my $val =read_mem_specefic_addr($self,$address,$tview);
|
my $val =read_mem_specefic_addr($self,$address,$tview);
|
$entry->set_text($val) if (defined $val);
|
$entry->set_text($val) if (defined $val);
|
$status =1;
|
$status =1;
|
entry_set_text_color($entry,-1);
|
entry_set_text_color($entry,-1);
|
$load->destroy;
|
$load->destroy;
|
});
|
});
|
|
|
$write-> signal_connect("clicked" => sub{
|
$write-> signal_connect("clicked" => sub{
|
my $value = $entry->get_text();
|
my $value = $entry->get_text();
|
my $address=$addr->get_text();
|
my $address=$addr->get_text();
|
my $format =$self-> object_get_attribute('FILE_VIEW','R_ADDR_FORMAT');
|
my $format =$self-> object_get_attribute('FILE_VIEW','R_ADDR_FORMAT');
|
$format= 'Decimal' if (!defined $format);
|
$format= 'Decimal' if (!defined $format);
|
$address = hex($address) unless($format eq 'Decimal');
|
$address = hex($address) unless($format eq 'Decimal');
|
my $load= show_gif("icons/load.gif");
|
my $load= show_gif("icons/load.gif");
|
$table->attach ($load,$sx, $sx+1 , $sy, $sy+1,'shrink','shrink',0,0);
|
$table->attach ($load,$sx, $sx+1 , $sy, $sy+1,'shrink','shrink',0,0);
|
$table->show_all();
|
$table->show_all();
|
write_mem_specefic_addr($self,$address,$value,$tview);
|
write_mem_specefic_addr($self,$address,$value,$tview);
|
$status =1;
|
$status =1;
|
entry_set_text_color($entry,-1);
|
entry_set_text_color($entry,-1);
|
$load->destroy;
|
$load->destroy;
|
|
|
});
|
});
|
|
|
$entry->signal_connect("changed" => sub{
|
$entry->signal_connect("changed" => sub{
|
if($status==0 || $status==1 ){
|
if($status==0 || $status==1 ){
|
$status =2;#modified
|
$status =2;#modified
|
#change color to red
|
#change color to red
|
entry_set_text_color($entry,11);
|
entry_set_text_color($entry,11);
|
|
|
}
|
}
|
my $in = $entry->get_text();
|
my $in = $entry->get_text();
|
$entry->set_text(remove_not_hex($in));
|
$entry->set_text(remove_not_hex($in));
|
|
|
});
|
});
|
|
|
|
|
$addr->signal_connect("changed" => sub{
|
$addr->signal_connect("changed" => sub{
|
my $format =$self-> object_get_attribute('FILE_VIEW','R_ADDR_FORMAT');
|
my $format =$self-> object_get_attribute('FILE_VIEW','R_ADDR_FORMAT');
|
$format= 'Decimal' if (!defined $format);
|
$format= 'Decimal' if (!defined $format);
|
my $in = $addr->get_text();
|
my $in = $addr->get_text();
|
$addr->set_text(remove_not_hex($in)) if ($format ne 'Decimal' );
|
$addr->set_text(remove_not_hex($in)) if ($format ne 'Decimal' );
|
$addr->set_text(remove_not_number($in)) if ($format eq 'Decimal' );
|
$addr->set_text(remove_not_number($in)) if ($format eq 'Decimal' );
|
});
|
});
|
|
|
}
|
}
|
|
|
$table->attach ( gen_Vsep(), 1, 2 , 0, $y+1,'fill','fill',2,2);
|
$table->attach ( gen_Vsep(), 1, 2 , 0, $y+1,'fill','fill',2,2);
|
$table->attach ( gen_Vsep(), 3, 4 , 0, $y+1,'fill','fill',2,2);
|
$table->attach ( gen_Vsep(), 3, 4 , 0, $y+1,'fill','fill',2,2);
|
$table->attach ( gen_Vsep(), 6, 7 , 0, $y+1,'fill','fill',2,2);
|
$table->attach ( gen_Vsep(), 6, 7 , 0, $y+1,'fill','fill',2,2);
|
|
|
return $scrolled_win;
|
return $scrolled_win;
|
}
|
}
|
|
|
sub get_file_b_setting{
|
sub get_file_b_setting{
|
my($self)=@_;
|
my($self)=@_;
|
my $window = def_popwin_size (30,30,'Source Probe','percent');
|
my $window = def_popwin_size (30,30,'Source Probe','percent');
|
my $table= def_table(2,10,FALSE);
|
my $table= def_table(2,10,FALSE);
|
my @info = (
|
my @info = (
|
#{ label=>" Address format: ", param_name=>'R_ADDR_FORMAT', type=>"Combo-box", default_val=>'Decimal', content=>"Decimal,Hexadecimal", info=>undef, param_parent=>'FILE_VIEW', ref_delay=> 1, new_status=>'ref_file_view', loc=>'vertical'},
|
#{ label=>" Address format: ", param_name=>'R_ADDR_FORMAT', type=>"Combo-box", default_val=>'Decimal', content=>"Decimal,Hexadecimal", info=>undef, param_parent=>'FILE_VIEW', ref_delay=> 1, new_status=>'ref_file_view', loc=>'vertical'},
|
{ label=>" Page row number: ", param_name=>'PAGE_MAX_X', type=>"Spin-button", default_val=>10, content=>"0,128,1", info=>undef, param_parent=>'FILE_VIEW', ref_delay=> 1, new_status=>'ref_file_view', loc=>'vertical'},
|
{ label=>" Page row number: ", param_name=>'PAGE_MAX_X', type=>"Spin-button", default_val=>10, content=>"0,128,1", info=>undef, param_parent=>'FILE_VIEW', ref_delay=> 1, new_status=>'ref_file_view', loc=>'vertical'},
|
{ label=>" Page column number:", param_name=>'PAGE_MAX_Y', type=>"Spin-button", default_val=>10, content=>"1,128,1", info=>undef, param_parent=>'FILE_VIEW', ref_delay=> 1, new_status=>'ref_file_view', loc=>'vertical'}
|
{ label=>" Page column number:", param_name=>'PAGE_MAX_Y', type=>"Spin-button", default_val=>10, content=>"1,128,1", info=>undef, param_parent=>'FILE_VIEW', ref_delay=> 1, new_status=>'ref_file_view', loc=>'vertical'}
|
);
|
);
|
my $row=0;
|
my $row=0;
|
my $col=0;
|
my $col=0;
|
foreach my $d (@info) {
|
foreach my $d (@info) {
|
($row,$col)=add_param_widget ($self, $d->{label}, $d->{param_name}, $d->{default_val}, $d->{type}, $d->{content}, $d->{info}, $table,$row,$col,1, $d->{param_parent}, $d->{ref_delay}, $d->{new_status}, $d->{loc});
|
($row,$col)=add_param_widget ($self, $d->{label}, $d->{param_name}, $d->{default_val}, $d->{type}, $d->{content}, $d->{info}, $table,$row,$col,1, $d->{param_parent}, $d->{ref_delay}, $d->{new_status}, $d->{loc});
|
}
|
}
|
$table->attach (gen_label_in_center(' '), 2, 3,$row,$row+1,'shrink','shrink',2,2); $row++;
|
$table->attach (gen_label_in_center(' '), 2, 3,$row,$row+1,'shrink','shrink',2,2); $row++;
|
$table->attach (gen_label_in_center(' '), 2, 3,$row,$row+1,'shrink','shrink',2,2); $row++;
|
$table->attach (gen_label_in_center(' '), 2, 3,$row,$row+1,'shrink','shrink',2,2); $row++;
|
$table->attach (gen_label_in_center(' '), 2, 3,$row,$row+1,'shrink','shrink',2,2); $row++;
|
$table->attach (gen_label_in_center(' '), 2, 3,$row,$row+1,'shrink','shrink',2,2); $row++;
|
|
|
|
|
my $ok=def_image_button($path."icons/select.png",'OK');
|
my $ok=def_image_button($path."icons/select.png",'OK');
|
$table->attach ($ok, 2, 3,$row,$row+1,'shrink','shrink',2,2);
|
$table->attach ($ok, 2, 3,$row,$row+1,'shrink','shrink',2,2);
|
$ok-> signal_connect("clicked" => sub{
|
$ok-> signal_connect("clicked" => sub{
|
$window->destroy();
|
$window->destroy();
|
});
|
});
|
|
|
$window->add(add_widget_to_scrolled_win($table));
|
$window->add(add_widget_to_scrolled_win($table));
|
$window->show_all;
|
$window->show_all;
|
|
|
}
|
}
|
|
|
sub fill_memory_array_from_file{
|
sub fill_memory_array_from_file{
|
my ($self,$fname,$tview)=@_;
|
my ($self,$fname,$tview)=@_;
|
|
|
my $offset = $self->object_get_attribute('FILE_VIEW','IN_FILE_OFFSET');
|
my $offset = $self->object_get_attribute('FILE_VIEW','IN_FILE_OFFSET');
|
my $BLOCK_SIZE =4;
|
my $BLOCK_SIZE =4;
|
|
|
open(F,"<$fname") or die("Unable to open file $fname, $!");
|
open(F,"<$fname") or die("Unable to open file $fname, $!");
|
binmode(F);
|
binmode(F);
|
my $buf;
|
my $buf;
|
my $ct=($offset>>2);
|
my $ct=($offset>>2);
|
|
|
my $start = ($offset>>2);
|
my $start = ($offset>>2);
|
my $r=read(F,$buf,$BLOCK_SIZE);
|
my $r=read(F,$buf,$BLOCK_SIZE);
|
while($r){
|
while($r){
|
my $v='';
|
my $v='';
|
foreach(split(//, $buf)){
|
foreach(split(//, $buf)){
|
$v.=sprintf("%02x",ord($_));
|
$v.=sprintf("%02x",ord($_));
|
}
|
}
|
if($r!=4){
|
if($r!=4){
|
$v.='0'x(( 4 - $r)*2);
|
$v.='0'x(( 4 - $r)*2);
|
}
|
}
|
$memory{$ct}= $v;
|
$memory{$ct}= $v;
|
$status{$ct}=2;
|
$status{$ct}=2;
|
$ct++;
|
$ct++;
|
$r=read(F,$buf,$BLOCK_SIZE);
|
$r=read(F,$buf,$BLOCK_SIZE);
|
}
|
}
|
close(F);
|
close(F);
|
|
|
add_info($tview,"Load $fname\n");
|
add_info($tview,"Load $fname\n");
|
$ct=($ct << 2);
|
$ct=($ct << 2);
|
add_info($tview,"address $offset to $ct\n");
|
add_info($tview,"address $offset to $ct\n");
|
}
|
}
|
|
|
sub get_file_in_name{
|
sub get_file_in_name{
|
my ($self,$tview)=@_;
|
my ($self,$tview)=@_;
|
|
|
my $file;
|
my $file;
|
my $title ='select bin file';
|
my $title ='select bin file';
|
my $dialog = gen_file_dialog ($title);
|
my $dialog = gen_file_dialog ($title);
|
|
|
if ( "ok" eq $dialog->run ) {
|
if ( "ok" eq $dialog->run ) {
|
$file = $dialog->get_filename;
|
$file = $dialog->get_filename;
|
$dialog->destroy;
|
$dialog->destroy;
|
$self->object_add_attribute('FILE_VIEW','IN_FILE',$file);
|
$self->object_add_attribute('FILE_VIEW','IN_FILE',$file);
|
|
|
#get offset address;
|
#get offset address;
|
my $window = def_popwin_size (30,20,'Get Offset Address','percent');
|
my $window = def_popwin_size (30,20,'Get Offset Address','percent');
|
my $table= def_table(2,10,FALSE);
|
my $table= def_table(2,10,FALSE);
|
my $d=
|
my $d=
|
{ label=>" Offset address (in byte): ", param_name=>'IN_FILE_OFFSET', type=>"Spin-button", default_val=>0, content=>'0,9999999999,1', info=>'The Wishbone bus offset address where the beginning of the memory bin file is written there (It can be the base address of the peripheral device where the memory file is intended to be written to.) ', param_parent=>'FILE_VIEW', ref_delay=> undef, new_status=>undef, loc=>'vertical'};
|
{ label=>" Offset address (in byte): ", param_name=>'IN_FILE_OFFSET', type=>"Spin-button", default_val=>0, content=>'0,9999999999,1', info=>'The Wishbone bus offset address where the beginning of the memory bin file is written there (It can be the base address of the peripheral device where the memory file is intended to be written to.) ', param_parent=>'FILE_VIEW', ref_delay=> undef, new_status=>undef, loc=>'vertical'};
|
my $row=0;
|
my $row=0;
|
my $col=0;
|
my $col=0;
|
($row,$col)=add_param_widget ($self, $d->{label}, $d->{param_name}, $d->{default_val}, $d->{type}, $d->{content}, $d->{info}, $table,$row,$col,1, $d->{param_parent}, $d->{ref_delay}, $d->{new_status}, $d->{loc});
|
($row,$col)=add_param_widget ($self, $d->{label}, $d->{param_name}, $d->{default_val}, $d->{type}, $d->{content}, $d->{info}, $table,$row,$col,1, $d->{param_parent}, $d->{ref_delay}, $d->{new_status}, $d->{loc});
|
my $ok=def_image_button($path."icons/select.png",'OK');
|
my $ok=def_image_button($path."icons/select.png",'OK');
|
$table->attach ($ok, 2, 3,$row,$row+1,'shrink','shrink',2,2);
|
$table->attach ($ok, 2, 3,$row,$row+1,'shrink','shrink',2,2);
|
$ok-> signal_connect("clicked" => sub{
|
$ok-> signal_connect("clicked" => sub{
|
fill_memory_array_from_file ($self,$file,$tview);
|
fill_memory_array_from_file ($self,$file,$tview);
|
set_gui_status($self,'ref_file_view',1);
|
set_gui_status($self,'ref_file_view',1);
|
$window->destroy();
|
$window->destroy();
|
});
|
});
|
$window->add(add_widget_to_scrolled_win($table));
|
$window->add(add_widget_to_scrolled_win($table));
|
$window->show_all;
|
$window->show_all;
|
|
|
|
|
}
|
}
|
|
|
|
|
|
|
}
|
}
|
|
|
|
|
|
|
|
|
sub get_jtag_intfc_cmd {
|
sub get_jtag_intfc_cmd {
|
my $self=shift;
|
my $self=shift;
|
|
|
my $vendor = $self->object_get_attribute('CTRL','VENDOR');
|
my $vendor = $self->object_get_attribute('CTRL','VENDOR');
|
my $board = $self->object_get_attribute('CTRL','Board_Name');
|
my $board = $self->object_get_attribute('CTRL','Board_Name');
|
my $chain = $self->object_get_attribute('CTRL','JTAG_CHAIN');
|
my $chain = $self->object_get_attribute('CTRL','JTAG_CHAIN');
|
my $index = $self->object_get_attribute('CTRL','JTAG_INDEX');
|
my $index = $self->object_get_attribute('CTRL','JTAG_INDEX');
|
my $pronoc = get_project_dir();
|
my $pronoc = get_project_dir();
|
my $intfc = "$pronoc/mpsoc/boards/$vendor/$board/jtag_intfc.sh";
|
my $intfc = "$pronoc/mpsoc/boards/$vendor/$board/jtag_intfc.sh";
|
#my $script = "$ENV{'PRONOC_WORK'}/tmp/script.bash";
|
#my $script = "$ENV{'PRONOC_WORK'}/tmp/script.bash";
|
|
|
my $t = ($vendor eq 'Xilinx') ? "-t $chain " : "";
|
my $t = ($vendor eq 'Xilinx') ? "-t $chain " : "";
|
|
|
my $cmd = "bash -c \"source $intfc; \\\$JTAG_INTFC $t -n $index";
|
my $cmd = "bash -c \"source $intfc; \\\$JTAG_INTFC $t -n $index";
|
return $cmd;
|
return $cmd;
|
|
|
}
|
}
|
|
|
|
|
sub read_memory_array_from_device {
|
sub read_memory_array_from_device {
|
my ($self,$tview)=@_;
|
my ($self,$tview)=@_;
|
my $lower = $self->object_get_attribute('FILE_VIEW','READ_LBA');
|
my $lower = $self->object_get_attribute('FILE_VIEW','READ_LBA');
|
my $upper = $self->object_get_attribute('FILE_VIEW','READ_UBA');
|
my $upper = $self->object_get_attribute('FILE_VIEW','READ_UBA');
|
|
|
$lower= sprintf("0x%x",$lower);
|
$lower= sprintf("0x%x",$lower);
|
$upper= sprintf("0x%x",$upper);
|
$upper= sprintf("0x%x",$upper);
|
|
|
my $intfc = get_jtag_intfc_cmd($self);
|
my $intfc = get_jtag_intfc_cmd($self);
|
#my $comand = "#!/bin/bash\n source $intfc\n \$JTAG_INTFC $t -n $index -s \"$lower\" -e \"$upper\" -r";
|
#my $comand = "#!/bin/bash\n source $intfc\n \$JTAG_INTFC $t -n $index -s \"$lower\" -e \"$upper\" -r";
|
my $cmd = "$intfc -s $lower -e $upper -r\"";
|
my $cmd = "$intfc -s $lower -e $upper -r\"";
|
|
|
#save_file ($script,$comand);
|
#save_file ($script,$comand);
|
#chmod 0755, $script;
|
#chmod 0755, $script;
|
|
|
#my $cmd = "bash -c \" $script \"";
|
#my $cmd = "bash -c \" $script \"";
|
add_info($tview,"$cmd\n");
|
add_info($tview,"$cmd\n");
|
my $results =run_cmd_textview_errors($cmd,$tview);
|
my $results =run_cmd_textview_errors($cmd,$tview);
|
return 1 if(!defined $results);
|
return 1 if(!defined $results);
|
|
|
|
|
|
|
my @nn = split (/###read data#\n/,$results);
|
my @nn = split (/###read data#\n/,$results);
|
if(!defined $nn[1]){
|
if(!defined $nn[1]){
|
add_colored_info($tview,"Got an Error:$results!\n",'red');
|
add_colored_info($tview,"Got an Error:$results!\n",'red');
|
return 1;
|
return 1;
|
}
|
}
|
my @nums=split (/\n/,$nn[1]);
|
my @nums=split (/\n/,$nn[1]);
|
|
|
$lower = $self->object_get_attribute('FILE_VIEW','READ_LBA');
|
$lower = $self->object_get_attribute('FILE_VIEW','READ_LBA');
|
$lower>>=2; #change to word
|
$lower>>=2; #change to word
|
foreach my $n ( @nums) {
|
foreach my $n ( @nums) {
|
$n='0'x( 8 - length $n).$n;
|
$n='0'x( 8 - length $n).$n;
|
$memory{$lower }= $n;
|
$memory{$lower }= $n;
|
$status{$lower}=1; #valid
|
$status{$lower}=1; #valid
|
$lower++;
|
$lower++;
|
|
|
}
|
}
|
}
|
}
|
|
|
|
|
sub print_32_bit_val {
|
sub print_32_bit_val {
|
my ($file,$v)=@_;
|
my ($file,$v)=@_;
|
for (my $i= 24; $i >=0 ; $i-=8) {
|
for (my $i= 24; $i >=0 ; $i-=8) {
|
my $byte= ($v >> $i ) & 0xFF;
|
my $byte= ($v >> $i ) & 0xFF;
|
print $file pack('C*',$byte);
|
print $file pack('C*',$byte);
|
#printf ("%02x\t",$byte);
|
#printf ("%02x\t",$byte);
|
}
|
}
|
}
|
}
|
|
|
|
|
sub write_memory_array_from_device {
|
sub write_memory_array_from_device {
|
my ($self,$tview)=@_;
|
my ($self,$tview)=@_;
|
my $lower = $self->object_get_attribute('FILE_VIEW','READ_LBA');
|
my $lower = $self->object_get_attribute('FILE_VIEW','READ_LBA');
|
my $upper = $self->object_get_attribute('FILE_VIEW','READ_UBA');
|
my $upper = $self->object_get_attribute('FILE_VIEW','READ_UBA');
|
|
|
my $tmp_bin= "$ENV{'PRONOC_WORK'}/tmp/tmp.bin";
|
my $tmp_bin= "$ENV{'PRONOC_WORK'}/tmp/tmp.bin";
|
|
|
|
|
#create binfile
|
#create binfile
|
unlink $tmp_bin;
|
unlink $tmp_bin;
|
open(my $F,">$tmp_bin") or die("Unable to open file $tmp_bin, $!");
|
open(my $F,">$tmp_bin") or die("Unable to open file $tmp_bin, $!");
|
#binmode($F);
|
#binmode($F);
|
my $warning;
|
my $warning;
|
my $n;
|
my $n;
|
for (my $i=($lower>>2); $i< ($upper>>2); $i++){
|
for (my $i=($lower>>2); $i< ($upper>>2); $i++){
|
my $s =(defined $status{$i}) ? $status{$i} : 0;
|
my $s =(defined $status{$i}) ? $status{$i} : 0;
|
if( $s==0) {
|
if( $s==0) {
|
$n= 0;
|
$n= 0;
|
$warning=$i;
|
$warning=$i;
|
}
|
}
|
else{
|
else{
|
$n= $memory{$i};
|
$n= $memory{$i};
|
$status{$i}=1;
|
$status{$i}=1;
|
}
|
}
|
print_32_bit_val ($F, hex($n));
|
print_32_bit_val ($F, hex($n));
|
}
|
}
|
close ($F);
|
close ($F);
|
|
|
|
|
|
|
|
|
$lower= sprintf("0x%x",$lower);
|
$lower= sprintf("0x%x",$lower);
|
$upper= sprintf("0x%x",$upper);
|
$upper= sprintf("0x%x",$upper);
|
|
|
|
|
#my $comand = "#!/bin/bash\n source $intfc\n \$JTAG_INTFC $t -n $index -s \"$lower\" -e \"$upper\" -i $tmp_bin -c";
|
#my $comand = "#!/bin/bash\n source $intfc\n \$JTAG_INTFC $t -n $index -s \"$lower\" -e \"$upper\" -i $tmp_bin -c";
|
|
|
#save_file ($script,$comand);
|
#save_file ($script,$comand);
|
#chmod 0755, $script;
|
#chmod 0755, $script;
|
|
|
#my $cmd = "bash -c \" $script \"";
|
#my $cmd = "bash -c \" $script \"";
|
my $intfc = get_jtag_intfc_cmd($self);
|
my $intfc = get_jtag_intfc_cmd($self);
|
my $cmd = "$intfc -s $lower -e $upper -i $tmp_bin -c\"";
|
my $cmd = "$intfc -s $lower -e $upper -i $tmp_bin -c\"";
|
|
|
add_info($tview,"$cmd\n");
|
add_info($tview,"$cmd\n");
|
my $results =run_cmd_textview_errors($cmd,$tview);
|
my $results =run_cmd_textview_errors($cmd,$tview);
|
return 1 if(!defined $results);
|
return 1 if(!defined $results);
|
|
|
my @lines = split (/\n/, $results);
|
my @lines = split (/\n/, $results);
|
foreach my $line (@lines) {
|
foreach my $line (@lines) {
|
add_colored_info($tview,"$line\n",'red') if ($line =~ /Error/);
|
add_colored_info($tview,"$line\n",'red') if ($line =~ /Error/);
|
}
|
}
|
}
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub read_write_widget {
|
sub read_write_widget {
|
my ($self,$tview,$rw)=@_;
|
my ($self,$tview,$rw)=@_;
|
#get start & end addresses;
|
#get start & end addresses;
|
my $window = def_popwin_size (30,20,'Select Memory Boundary Addresses','percent');
|
my $window = def_popwin_size (30,20,'Select Memory Boundary Addresses','percent');
|
my $table= def_table(2,10,FALSE);
|
my $table= def_table(2,10,FALSE);
|
my $l ={ label=>" Lower-bound address (in byte): ", param_name=>'READ_LBA', type=>"Spin-button", default_val=>0, content=>'0,9999999999,1', info=>'The Wishbone bus offset address where the beginning of the memory bin file is written there (It can be the base address of the peripheral device where the memory file is intended to be written to.) ', param_parent=>'FILE_VIEW', ref_delay=> undef, new_status=>undef, loc=>'vertical'};
|
my $l ={ label=>" Lower-bound address (in byte): ", param_name=>'READ_LBA', type=>"Spin-button", default_val=>0, content=>'0,9999999999,1', info=>'The Wishbone bus offset address where the beginning of the memory bin file is written there (It can be the base address of the peripheral device where the memory file is intended to be written to.) ', param_parent=>'FILE_VIEW', ref_delay=> undef, new_status=>undef, loc=>'vertical'};
|
my $u ={ label=>" Upper-bound address (in byte): ", param_name=>'READ_UBA', type=>"Spin-button", default_val=>0, content=>'0,9999999999,1', info=>'The Wishbone bus offset address where the end of the memory bin file is written there (It can be the base address of the peripheral device where the memory file is intended to be written to plus bin file size in byte.) ', param_parent=>'FILE_VIEW', ref_delay=> undef, new_status=>undef, loc=>'vertical'};
|
my $u ={ label=>" Upper-bound address (in byte): ", param_name=>'READ_UBA', type=>"Spin-button", default_val=>0, content=>'0,9999999999,1', info=>'The Wishbone bus offset address where the end of the memory bin file is written there (It can be the base address of the peripheral device where the memory file is intended to be written to plus bin file size in byte.) ', param_parent=>'FILE_VIEW', ref_delay=> undef, new_status=>undef, loc=>'vertical'};
|
my ($l_spin,$u_spin);
|
my ($l_spin,$u_spin);
|
my $row=0;
|
my $row=0;
|
my $col=0;
|
my $col=0;
|
($row,$col,$l_spin)=add_param_widget ($self, $l->{label}, $l->{param_name}, $l->{default_val}, $l->{type}, $l->{content}, $l->{info}, $table,$row,$col,1, $l->{param_parent}, $l->{ref_delay}, $l->{new_status}, $l->{loc});
|
($row,$col,$l_spin)=add_param_widget ($self, $l->{label}, $l->{param_name}, $l->{default_val}, $l->{type}, $l->{content}, $l->{info}, $table,$row,$col,1, $l->{param_parent}, $l->{ref_delay}, $l->{new_status}, $l->{loc});
|
($row,$col,$u_spin)=add_param_widget ($self, $u->{label}, $u->{param_name}, $u->{default_val}, $u->{type}, $u->{content}, $u->{info}, $table,$row,$col,1, $u->{param_parent}, $u->{ref_delay}, $l->{new_status}, $u->{loc});
|
($row,$col,$u_spin)=add_param_widget ($self, $u->{label}, $u->{param_name}, $u->{default_val}, $u->{type}, $u->{content}, $u->{info}, $table,$row,$col,1, $u->{param_parent}, $u->{ref_delay}, $l->{new_status}, $u->{loc});
|
|
|
$l_spin-> signal_connect("value_changed" => sub{
|
$l_spin-> signal_connect("value_changed" => sub{
|
my $lower=$l_spin->get_value();
|
my $lower=$l_spin->get_value();
|
$u_spin->set_range ($lower, 9999999999);
|
$u_spin->set_range ($lower, 9999999999);
|
|
|
});
|
});
|
|
|
$u_spin-> signal_connect("value_changed" => sub{
|
$u_spin-> signal_connect("value_changed" => sub{
|
my $upper=$u_spin->get_value();
|
my $upper=$u_spin->get_value();
|
$l_spin->set_range (0,$upper);
|
$l_spin->set_range (0,$upper);
|
|
|
});
|
});
|
|
|
|
|
|
|
|
|
my $ok=def_image_button($path."icons/select.png",'OK');
|
my $ok=def_image_button($path."icons/select.png",'OK');
|
$table->attach ($ok, 2, 3,$row,$row+1,'shrink','shrink',2,2);
|
$table->attach ($ok, 2, 3,$row,$row+1,'shrink','shrink',2,2);
|
$ok-> signal_connect("clicked" => sub{
|
$ok-> signal_connect("clicked" => sub{
|
my $vendor= $self->object_get_attribute('CTRL','VENDOR');
|
my $vendor= $self->object_get_attribute('CTRL','VENDOR');
|
my $load= show_gif("icons/load.gif");
|
my $load= show_gif("icons/load.gif");
|
$table->attach ($load,1, 2, $row,$row+ 1,'shrink','shrink',0,0);
|
$table->attach ($load,1, 2, $row,$row+ 1,'shrink','shrink',0,0);
|
$table->show_all();
|
$table->show_all();
|
read_memory_array_from_device ($self,$tview) if ($rw eq 'READ');
|
read_memory_array_from_device ($self,$tview) if ($rw eq 'READ');
|
write_memory_array_from_device ($self,$tview) if ($rw eq 'WRITE');
|
write_memory_array_from_device ($self,$tview) if ($rw eq 'WRITE');
|
set_gui_status($self,'ref_file_view',1);
|
set_gui_status($self,'ref_file_view',1);
|
$window->destroy();
|
$window->destroy();
|
});
|
});
|
$window->add(add_widget_to_scrolled_win($table));
|
$window->add(add_widget_to_scrolled_win($table));
|
$window->show_all;
|
$window->show_all;
|
}
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub read_write_bin_file {
|
sub read_write_bin_file {
|
my ($self,$tview)=@_;
|
my ($self,$tview)=@_;
|
my $table= def_table(2,10,FALSE);
|
my $table= def_table(2,10,FALSE);
|
my $scrolled_win=gen_scr_win_with_adjst ($self,"receive_box");
|
my $scrolled_win=gen_scr_win_with_adjst ($self,"receive_box");
|
add_widget_to_scrolled_win($table,$scrolled_win);
|
add_widget_to_scrolled_win($table,$scrolled_win);
|
my @data;
|
my @data;
|
|
|
|
|
my $MAX_X=$self-> object_get_attribute('FILE_VIEW','PAGE_MAX_X');
|
my $MAX_X=$self-> object_get_attribute('FILE_VIEW','PAGE_MAX_X');
|
$MAX_X=10 if (!defined $MAX_X);
|
$MAX_X=10 if (!defined $MAX_X);
|
my $MAX_Y=$self-> object_get_attribute('FILE_VIEW','PAGE_MAX_Y');
|
my $MAX_Y=$self-> object_get_attribute('FILE_VIEW','PAGE_MAX_Y');
|
$MAX_Y=10 if (!defined $MAX_Y);
|
$MAX_Y=10 if (!defined $MAX_Y);
|
my $format =$self-> object_get_attribute('FILE_VIEW','R_ADDR_FORMAT');
|
my $format =$self-> object_get_attribute('FILE_VIEW','R_ADDR_FORMAT');
|
$format= 'Decimal' if (!defined $format);
|
$format= 'Decimal' if (!defined $format);
|
|
|
|
|
my $OFFSET=0;
|
my $OFFSET=0;
|
|
|
my $table1= def_table(2,10,FALSE);
|
my $table1= def_table(2,10,FALSE);
|
|
|
#$page_num= 0 if(!defined $page_num);
|
#$page_num= 0 if(!defined $page_num);
|
|
|
|
|
|
|
|
|
my $setting=def_image_button("icons/setting.png","setting");
|
my $setting=def_image_button("icons/setting.png","setting");
|
my $load=def_image_button("icons/download.png","Load File");
|
my $load=def_image_button("icons/download.png","Load File");
|
my $read=def_image_button($path."icons/simulator.png","Read Memory");
|
my $read=def_image_button($path."icons/simulator.png","Read Memory");
|
my $write=def_image_button($path."icons/write.png","Write Memory");
|
my $write=def_image_button($path."icons/write.png","Write Memory");
|
my $clear=def_image_button($path."icons/clear.png");
|
my $clear=def_image_button($path."icons/clear.png");
|
my $x=0;
|
my $x=0;
|
|
|
|
|
$table->attach ($setting, $x, $x+1, 0, 1,'fill','fill',2,2);$x++;
|
$table->attach ($setting, $x, $x+1, 0, 1,'fill','fill',2,2);$x++;
|
$table->attach ($load, $x, $x+1 , 0, 1,'fill','fill',2,2);$x++;
|
$table->attach ($load, $x, $x+1 , 0, 1,'fill','fill',2,2);$x++;
|
$table->attach ($read, $x, $x+1 , 0, 1,'shrink','shrink',2,2); $x++;
|
$table->attach ($read, $x, $x+1 , 0, 1,'shrink','shrink',2,2); $x++;
|
$table->attach ($write, $x, $x+1 , 0, 1,'shrink','shrink',2,2); $x++;
|
$table->attach ($write, $x, $x+1 , 0, 1,'shrink','shrink',2,2); $x++;
|
$table->attach ($clear, $x, $x+1 , 0, 1,'shrink','shrink',2,2); $x++;
|
$table->attach ($clear, $x, $x+1 , 0, 1,'shrink','shrink',2,2); $x++;
|
|
|
add_param_widget ($self,"Page_num", 'FILE_VIEW', 0, "Spin-button", "0,999999,1", undef, $table,0, $x, 1, "R_PAGE_NUM",1,'ref_file_view');
|
add_param_widget ($self,"Page_num", 'FILE_VIEW', 0, "Spin-button", "0,999999,1", undef, $table,0, $x, 1, "R_PAGE_NUM",1,'ref_file_view');
|
|
|
my $page_num =$self->object_get_attribute("R_PAGE_NUM",'FILE_VIEW');
|
my $page_num =$self->object_get_attribute("R_PAGE_NUM",'FILE_VIEW');
|
|
|
|
|
|
|
|
|
$setting-> signal_connect("clicked" => sub{
|
$setting-> signal_connect("clicked" => sub{
|
get_file_b_setting($self);
|
get_file_b_setting($self);
|
});
|
});
|
|
|
$load-> signal_connect("clicked" => sub{
|
$load-> signal_connect("clicked" => sub{
|
get_file_in_name($self,$tview);
|
get_file_in_name($self,$tview);
|
});
|
});
|
|
|
$clear-> signal_connect("clicked" => sub{
|
$clear-> signal_connect("clicked" => sub{
|
undef %memory;
|
undef %memory;
|
undef %status;
|
undef %status;
|
set_gui_status($self,'ref_file_view',1);
|
set_gui_status($self,'ref_file_view',1);
|
});
|
});
|
|
|
$read-> signal_connect("clicked" => sub{
|
$read-> signal_connect("clicked" => sub{
|
read_write_widget($self,$tview,'READ');
|
read_write_widget($self,$tview,'READ');
|
});
|
});
|
|
|
$write->signal_connect("clicked" => sub{
|
$write->signal_connect("clicked" => sub{
|
read_write_widget($self,$tview,'WRITE');
|
read_write_widget($self,$tview,'WRITE');
|
});
|
});
|
|
|
my $base_addr=$page_num*$MAX_X*$MAX_Y+$OFFSET;
|
my $base_addr=$page_num*$MAX_X*$MAX_Y+$OFFSET;
|
|
|
|
|
#column address labels
|
#column address labels
|
for (my $y=1; $y<=$MAX_Y; $y++){
|
for (my $y=1; $y<=$MAX_Y; $y++){
|
my $addr=(($y-1) << 2);
|
my $addr=(($y-1) << 2);
|
$addr =($format eq 'Hexadecimal')? sprintf("%x", $addr) : $addr;
|
$addr =($format eq 'Hexadecimal')? sprintf("%x", $addr) : $addr;
|
|
|
my $l=gen_label_in_center (" $addr ");
|
my $l=gen_label_in_center (" $addr ");
|
$table1->attach ( $l, $y, $y+1 , 0, 1,'fill','fill',2,2);
|
$table1->attach ( $l, $y, $y+1 , 0, 1,'fill','fill',2,2);
|
}
|
}
|
|
|
|
|
#row address labels
|
#row address labels
|
for (my $x=1; $x<=$MAX_X; $x++){
|
for (my $x=1; $x<=$MAX_X; $x++){
|
my $addr=$base_addr+($x-1) * $MAX_Y;
|
my $addr=$base_addr+($x-1) * $MAX_Y;
|
|
|
$addr = ($format eq 'Hexadecimal')? sprintf("%x",($addr << 2)) : ($addr << 2);
|
$addr = ($format eq 'Hexadecimal')? sprintf("%x",($addr << 2)) : ($addr << 2);
|
|
|
|
|
my $l=gen_label_in_left (" $addr ");
|
my $l=gen_label_in_left (" $addr ");
|
$table1->attach ( $l, 0, 1 , $x, $x+1,'fill','fill',2,2);
|
$table1->attach ( $l, 0, 1 , $x, $x+1,'fill','fill',2,2);
|
}
|
}
|
|
|
#entries
|
#entries
|
for (my $x=1; $x<=$MAX_X; $x++){
|
for (my $x=1; $x<=$MAX_X; $x++){
|
for (my $y=1; $y<=$MAX_Y; $y++){
|
for (my $y=1; $y<=$MAX_Y; $y++){
|
|
|
|
|
my $state=0;# not modified
|
my $state=0;# not modified
|
|
|
my $addr =$base_addr+ (($x-1) * $MAX_Y ) + $y-1;
|
my $addr =$base_addr+ (($x-1) * $MAX_Y ) + $y-1;
|
my $addr_tip=($format eq 'Hexadecimal')? sprintf("0x%x",($addr << 2)) : ($addr << 2);
|
my $addr_tip=($format eq 'Hexadecimal')? sprintf("0x%x",($addr << 2)) : ($addr << 2);
|
|
|
my $v= $memory{$addr};
|
my $v= $memory{$addr};
|
my $s = $status{$addr};
|
my $s = $status{$addr};
|
|
|
$v= "xxxxxxxx" if (!defined $v);
|
$v= "xxxxxxxx" if (!defined $v);
|
$s = 0 if (!defined $s); #0 dontcare
|
$s = 0 if (!defined $s); #0 dontcare
|
|
|
|
|
my $entry =gen_entry($v );
|
my $entry =gen_entry($v );
|
|
|
$entry->set_max_length (8);
|
$entry->set_max_length (8);
|
$entry->set_width_chars(8);
|
$entry->set_width_chars(8);
|
set_tip($entry,"$addr_tip");
|
set_tip($entry,"$addr_tip");
|
$table1->attach ( $entry, $y, $y+1 , $x, $x+1,'fill','fill',2,2);
|
$table1->attach ( $entry, $y, $y+1 , $x, $x+1,'fill','fill',2,2);
|
|
|
if($s==2 ){
|
if($s==2 ){
|
#change color to red
|
#change color to red
|
entry_set_text_color($entry,11);
|
entry_set_text_color($entry,11);
|
}
|
}
|
|
|
$entry->signal_connect("changed" => sub{
|
$entry->signal_connect("changed" => sub{
|
if($s==0 || $s==1 ){
|
if($s==0 || $s==1 ){
|
$status{$addr} =2;#modified
|
$status{$addr} =2;#modified
|
#change color to red
|
#change color to red
|
entry_set_text_color($entry,11);
|
entry_set_text_color($entry,11);
|
|
|
}
|
}
|
my $in = $entry->get_text();
|
my $in = $entry->get_text();
|
$memory{$addr}=$in;
|
$memory{$addr}=$in;
|
$entry->set_text(remove_not_hex($in));
|
$entry->set_text(remove_not_hex($in));
|
|
|
});
|
});
|
|
|
}
|
}
|
}
|
}
|
|
|
|
|
|
|
|
|
$table->attach ( $table1, 0, 20 , 1, 10,'fill','fill',2,2);
|
$table->attach ( $table1, 0, 20 , 1, 10,'fill','fill',2,2);
|
|
|
$scrolled_win->show_all;
|
$scrolled_win->show_all;
|
return $scrolled_win;
|
return $scrolled_win;
|
|
|
}
|
}
|
|
|
|
|
|
|
############
|
############
|
# main
|
# main
|
############
|
############
|
|
|
|
|
|
|
sub source_probe_main {
|
sub source_probe_main {
|
my $self = __PACKAGE__->new();
|
my $self = __PACKAGE__->new();
|
|
|
|
|
|
|
set_gui_status($self,"ideal",0);
|
set_gui_status($self,"ideal",0);
|
my $window = def_popwin_size (85,85,'Run time JTAG debug','percent');
|
my $window = def_popwin_size (85,85,'Run time JTAG debug','percent');
|
my ($sw,$tview) =create_txview();# a textveiw for showing the info, erro messages etc
|
my ($sw,$tview) =create_txview();# a textveiw for showing the info, erro messages etc
|
my $ctrl = source_probe_ctrl($self,$tview);
|
my $ctrl = source_probe_ctrl($self,$tview);
|
my $sp= soure_probe_widgets ($self,$tview);
|
my $sp= soure_probe_widgets ($self,$tview);
|
my $bin_f = read_write_bin_file($self,$tview);
|
my $bin_f = read_write_bin_file($self,$tview);
|
#my $bin_ctrl = file_bin_ctrl($self,$tview);
|
#my $bin_ctrl = file_bin_ctrl($self,$tview);
|
|
|
|
|
my $h1 = gen_hpaned ($sp,0.35,$ctrl);
|
my $h1 = gen_hpaned ($sp,0.35,$ctrl);
|
#my $h2 = gen_hpaned ($bin_f,0.55,$bin_ctrl);
|
#my $h2 = gen_hpaned ($bin_f,0.55,$bin_ctrl);
|
my $v1 = gen_vpaned ($h1,0.2,$bin_f);
|
my $v1 = gen_vpaned ($h1,0.2,$bin_f);
|
my $v2 = gen_vpaned ($v1,0.65,$sw);
|
my $v2 = gen_vpaned ($v1,0.65,$sw);
|
|
|
|
|
|
|
|
|
|
|
#check soc status every ? second. referesh device table if there is any changes
|
#check soc status every ? second. referesh device table if there is any changes
|
Glib::Timeout->add (100, sub{
|
Glib::Timeout->add (100, sub{
|
my ($state,$timeout)= get_gui_status($self);
|
my ($state,$timeout)= get_gui_status($self);
|
|
|
if ($timeout>0){
|
if ($timeout>0){
|
$timeout--;
|
$timeout--;
|
set_gui_status($self,$state,$timeout);
|
set_gui_status($self,$state,$timeout);
|
}
|
}
|
elsif( $state ne "ideal" ){
|
elsif( $state ne "ideal" ){
|
if($state eq 'ref_all') {
|
if($state eq 'ref_all') {
|
$sp->destroy();
|
$sp->destroy();
|
$sp= soure_probe_widgets ($self,$tview);
|
$sp= soure_probe_widgets ($self,$tview);
|
$bin_f->destroy();
|
$bin_f->destroy();
|
$bin_f = read_write_bin_file($self,$tview);
|
$bin_f = read_write_bin_file($self,$tview);
|
$h1-> pack1($sp, TRUE, TRUE);
|
$h1-> pack1($sp, TRUE, TRUE);
|
$v1-> pack2($bin_f, TRUE, TRUE);
|
$v1-> pack2($bin_f, TRUE, TRUE);
|
$v2-> show_all();
|
$v2-> show_all();
|
}
|
}
|
elsif ($state eq 'ref_file_view'){
|
elsif ($state eq 'ref_file_view'){
|
$bin_f->destroy();
|
$bin_f->destroy();
|
$bin_f = read_write_bin_file($self,$tview);
|
$bin_f = read_write_bin_file($self,$tview);
|
$v1-> pack2($bin_f, TRUE, TRUE);
|
$v1-> pack2($bin_f, TRUE, TRUE);
|
$v2-> show_all();
|
$v2-> show_all();
|
|
|
|
|
}
|
}
|
|
|
$ctrl->destroy();
|
$ctrl->destroy();
|
$ctrl = source_probe_ctrl($self,$tview);
|
$ctrl = source_probe_ctrl($self,$tview);
|
$h1-> pack2($ctrl, TRUE, TRUE);
|
$h1-> pack2($ctrl, TRUE, TRUE);
|
$v2-> show_all();
|
$v2-> show_all();
|
set_gui_status($self,"ideal",0);
|
set_gui_status($self,"ideal",0);
|
|
|
|
|
}
|
}
|
|
|
return TRUE;
|
return TRUE;
|
|
|
} );
|
} );
|
|
|
|
|
|
|
$window->add($v2);
|
$window->add($v2);
|
$window->show_all();
|
$window->show_all();
|
return $window;
|
return $window;
|
}
|
}
|
|
|
|
|
|
|
|
|