Commit cc03fd41 authored by Christian Fibich's avatar Christian Fibich Committed by Stefan Tauner
Browse files

Added functionality to save a failed random/auto test run

Added functionality to export constraints files from fiji_instrument
parent 571f292e
#-------------------------------------------------------------------------------
# University of Applied Sciences Technikum Wien
#
# Department of Embedded Systems
# http://embsys.technikum-wien.at
#
# Josef Ressel Center for Verification of Embedded Computing Systems
# http://vecs.technikum-wien.at
#
#-------------------------------------------------------------------------------
# File: Constraints.pm
# Created on: 09.09.2015
# $LastChangedBy$
# $LastChangedDate$
#
# Description:
# Contains functions to generate Constraints for Synthesis/P&R Tools
#
#-------------------------------------------------------------------------------
package FIJI::Constraints;
use strict;
use warnings;
use Data::Dumper;
sub _quartus_direct_partitions_logiclock {
my $cfg = shift;
my $DUT_TO = $cfg->{'dut_module'}.":".$cfg->{'dut_inst'};
my $FIJI_TO = $cfg->{'fiji_module'}.":".$cfg->{'fiji_inst'};
my $DUT_PART_NAME = "PARTITION_".$cfg->{'dut_module'};
my $FIJI_PART_NAME = "PARTITION_".$cfg->{'fiji_module'};
my $DUT_COLOR = (sprintf("%d", 0xFF0000));
my $FIJI_COLOR = (sprintf("%d", 0x00FF00));
my $time = localtime;
my $txt = <<"END_HDR";
# ------------------------------------------------------------------------------
# FIJI Physical Placement Constraints File for Quartus II
# Generated: $time
# ------------------------------------------------------------------------------
END_HDR
my $fin = "# EOF";
my $partitioning =<<"END_PARTITION";
set_global_assignment -name PARTITION_NETLIST_TYPE POST_SYNTH -section_id $DUT_PART_NAME
set_global_assignment -name PARTITION_COLOR $DUT_COLOR -section_id $DUT_PART_NAME
set_global_assignment -name PARTITION_NETLIST_TYPE POST_SYNTH -section_id $FIJI_PART_NAME
set_global_assignment -name PARTITION_COLOR $FIJI_COLOR -section_id $FIJI_PART_NAME
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
set_instance_assignment -name PARTITION_HIERARCHY db/dut1 -to $DUT_TO -section_id $DUT_PART_NAME
set_instance_assignment -name PARTITION_HIERARCHY db/fiji1 -to $FIJI_TO -section_id $FIJI_PART_NAME
END_PARTITION
my $area =<<"END_LOCK";
set_global_assignment -name LL_ENABLED ON -section_id $DUT_PART_NAME
set_global_assignment -name LL_AUTO_SIZE ON -section_id $DUT_PART_NAME
set_global_assignment -name LL_STATE FLOATING -section_id $DUT_PART_NAME
set_global_assignment -name LL_WIDTH 1 -section_id $DUT_PART_NAME
set_global_assignment -name LL_HEIGHT 1 -section_id $DUT_PART_NAME
set_global_assignment -name LL_ORIGIN X1_Y1 -section_id $DUT_PART_NAME
set_instance_assignment -name LL_MEMBER_OF $DUT_PART_NAME -to $DUT_TO -section_id $DUT_PART_NAME
set_global_assignment -name LL_ENABLED ON -section_id $FIJI_PART_NAME
set_global_assignment -name LL_AUTO_SIZE ON -section_id $FIJI_PART_NAME
set_global_assignment -name LL_STATE FLOATING -section_id $FIJI_PART_NAME
set_global_assignment -name LL_WIDTH 1 -section_id $FIJI_PART_NAME
set_global_assignment -name LL_HEIGHT 1 -section_id $FIJI_PART_NAME
set_global_assignment -name LL_ORIGIN X1_Y1 -section_id $FIJI_PART_NAME
set_instance_assignment -name LL_MEMBER_OF $FIJI_PART_NAME -to $FIJI_TO -section_id $FIJI_PART_NAME
END_LOCK
if ($cfg->{'mode'} eq "NO_OPTIMIZATION") {
$txt .= $partitioning;
} elsif ($cfg->{'mode'} eq "FIX_PLACEMENT") {
$txt .= $partitioning.$area;
}
return $txt.$fin;
}
sub _synplify_quartus_partitions_logiclock {
my $cfg = shift;
my $DUT_NAME = $cfg->{'dut_module'};
my $FIJI_NAME = $cfg->{'fiji_module'};
my $time = localtime;
my $txt = <<"END_HDR";
# ------------------------------------------------------------------------------
# FIJI Constraints File for Synplify
# Generated: $time
# ------------------------------------------------------------------------------
END_HDR
my $fin = "# EOF";
my $partitioning = <<"END_PART";
define_compile_point {v:$DUT_NAME} -type {locked,partition} -comment "Logic under test"
define_compile_point {v:$FIJI_NAME} -type {locked,partition} -comment "Fault injection logic"
END_PART
my $area = <<"END_LOCK";
define_attribute {v:$DUT_NAME} altera_logiclock_location {floating}
define_attribute {v:$FIJI_NAME} altera_logiclock_location {floating}
END_LOCK
if ($cfg->{'mode'} eq "NO_OPTIMIZATION") {
$txt .= $partitioning;
} elsif ($cfg->{'mode'} eq "FIX_PLACEMENT") {
$txt .= $partitioning.$area;
}
return $txt.$fin;
}
sub _synplify_xise_partitions_placement {
my $cfg = shift;
my $DUT_NAME = $cfg->{'dut_module'};
my $FIJI_NAME = $cfg->{'fiji_module'};
my $time = localtime;
my $area_dut = "";
my $area_fiji = "";
if ($cfg->{'family'} =~ /^[Ss]partan/) {
# AREA specified in CLBs
$area_dut = "CLB_R1C1:CLB_R1C1";
$area_fiji = "CLB_R2C2:CLB_R2C2";
} elsif ($cfg->{'family'} =~ /^[Vv]irtex/ || $cfg->{'family'} =~ /^[Zz]ync/) {
# AREA specified in LUTs
$area_dut = "LUT_X1Y1:LUT_X1Y1";
$area_fiji = "LUT_X2Y2:LUT_X2Y2";
}
my $txt = <<"END_HDR";
# ------------------------------------------------------------------------------
# FIJI Constraints File for Synplify
# Generated: $time
# ------------------------------------------------------------------------------
END_HDR
my $fin = "# EOF";
my $partitioning = <<"END_PART";
define_compile_point {v:$DUT_NAME} -type {locked,partition} -comment "Logic under test"
define_compile_point {v:$FIJI_NAME} -type {locked,partition} -comment "Fault injection logic"
END_PART
my $area = <<"END_LOCK";
define_attribute {v:$DUT_NAME} xc_area_group {$area_dut}
define_attribute {v:$FIJI_NAME} xc_area_group {$area_fiji}
END_LOCK
if ($cfg->{'mode'} eq "NO_OPTIMIZATION") {
$txt .= $partitioning;
} elsif ($cfg->{'mode'} eq "FIX_PLACEMENT") {
$txt .= $partitioning.$area;
}
return $txt.$fin;
}
my $toolhash = {
synplify_pro => {
quartus => \&_synplify_quartus_partitions_logiclock,
xise => \&_synplify_xise_partitions_placement,
},
synplify => {
quartus => \&_quartus_direct_partitions_logiclock,
}
};
sub placement_partition_constraints {
my ($class, $synthesis_tool, $pr_tool, $cfg, $out_file) = @_;
my $synhash = $toolhash->{$synthesis_tool};
if(!defined $synhash) {
return "No entries for synthesis tool found";
}
my $sub = $synhash->{$pr_tool};
if(!defined $sub) {
print Dumper($toolhash);
return "No entries for P&R tool found";
}
my $txt = &{$sub}($cfg);
open(my $file, ">", $out_file) or return "Cannot open file $out_file: $!";
print $file $txt;
close($file) or return "Cannot close file $out_file: $!";
return undef;
}
1;
...@@ -29,6 +29,8 @@ use FIJI::Connection; ...@@ -29,6 +29,8 @@ use FIJI::Connection;
use FIJI qw(:all); use FIJI qw(:all);
use Data::Dumper; use Data::Dumper;
use Clone 'clone'; use Clone 'clone';
use threads;
use threads::shared;
sub new(;$$) { sub new(;$$) {
...@@ -140,11 +142,13 @@ sub _test_fi_uart { ...@@ -140,11 +142,13 @@ sub _test_fi_uart {
sub download_auto ($) { sub download_auto ($) {
my $msg; my $msg;
my $logger = get_logger(); my $logger = get_logger();
my ($self,$portname,$intermediate_cb) = @_; my ($self,$testref,$portname,$intermediate_cb) = @_;
my $fiji_tests = $self->{'fiji_tests'}; my $fiji_tests = $self->{'fiji_tests'};
my $fiji_design_consts = $self->{'fiji_settings'}->{'design'}; my $fiji_design_consts = $self->{'fiji_settings'}->{'design'};
my @tests;
if (!defined $intermediate_cb) { if (!defined $intermediate_cb) {
$intermediate_cb = sub {return 1;}; $intermediate_cb = sub {return 1;};
} }
...@@ -161,30 +165,32 @@ sub download_auto ($) { ...@@ -161,30 +165,32 @@ sub download_auto ($) {
$logger->info("Downloading in auto mode."); $logger->info("Downloading in auto mode.");
my $recv_msg;
my $ti;
# download tests until halted # download tests until halted
while(1) { while(1) {
for (my $ti = $toff; $ti < @{$fiji_tests->{'tests'} }; $ti++) { for ($ti = $toff; $ti < @{$fiji_tests->{'tests'} }; $ti++) {
$logger->info("Downloading test $ti."); $logger->info("Downloading test $ti.");
my $recv_msg = $self->_download_test(@{ $fiji_tests->{'tests'} }[$ti],$port); $recv_msg = $self->_download_test(@{ $fiji_tests->{'tests'} }[$ti],$port);
if(ref($recv_msg) ne "HASH") { if(ref($recv_msg) ne "HASH") {
$msg = "UART transaction failed."; $msg = "UART transaction failed.";
return $msg; return $msg;
} }
push @tests,@{ $fiji_tests->{'tests'} }[$ti];
if ( $self->_check_halt($recv_msg) == 1 ) { if ( $self->_check_halt($recv_msg) == 1 ) {
my $rv = $fiji_tests->export_as_sim_script("sim.script",$ti,$ri,$self->{'fiji_settings'});
$logger->error("Halt because of HALT_ON_xxx. Failed test: $ti, repetition $ri."); $logger->error("Halt because of HALT_ON_xxx. Failed test: $ti, repetition $ri.");
$logger->error($rv) if defined ($rv); goto END;
return $recv_msg;
} }
if(&$intermediate_cb($recv_msg) == 0) { if(&$intermediate_cb($recv_msg) == 0) {
my $rv = $fiji_tests->export_as_sim_script("sim.script",$ti,$ri,$self->{'fiji_settings'});
$logger->info("Fulfilling halt request after test: $ti, repetition $ri."); $logger->info("Fulfilling halt request after test: $ti, repetition $ri.");
return $recv_msg; goto END;
} }
} }
...@@ -198,6 +204,19 @@ sub download_auto ($) { ...@@ -198,6 +204,19 @@ sub download_auto ($) {
$ri++; $ri++;
} }
} }
END:
$$testref = clone($self->{'fiji_tests'});
$$testref->{'design'}->{'NUM_TESTS'} = $ti;
$$testref->{'design'}->{'REPEAT'} = 0;
$$testref->{'design'}->{'REPEAT_OFFSET'} = 0;
if(is_shared($$testref)) {
$$testref->{'tests'} = shared_clone(\@tests);
} else {
$$testref->{'tests'} = \@tests;
}
return $recv_msg;
} }
## Download randomly generated tests ## Download randomly generated tests
...@@ -218,10 +237,8 @@ sub download_random ($$$;$) { ...@@ -218,10 +237,8 @@ sub download_random ($$$;$) {
my $logger = get_logger(); my $logger = get_logger();
my ($self,$testref,$portname, $intermediate_cb) = @_; my ($self,$testref,$portname, $intermediate_cb) = @_;
my $fiji_design_consts = $self->{'fiji_settings'}->{'design'}; my $fiji_design_consts = $self->{'fiji_settings'}->{'design'};
$testref = clone($self->{'fiji_tests'});
$portname = $testref->{'design'}->{'UART'} if (!defined $portname);
$portname = $$testref->{'design'}->{'UART'} if (!defined $portname);
if (!defined $intermediate_cb) { if (!defined $intermediate_cb) {
$intermediate_cb = sub {return 1;}; $intermediate_cb = sub {return 1;};
...@@ -240,7 +257,7 @@ sub download_random ($$$;$) { ...@@ -240,7 +257,7 @@ sub download_random ($$$;$) {
my $cont; my $cont;
do { do {
my $temp_test = $testref->make_random_test($self->{'fiji_settings'}); my $temp_test = $self->{'fiji_tests'}->make_random_test($self->{'fiji_settings'});
return $temp_test if(!ref($temp_test)); return $temp_test if(!ref($temp_test));
@tests[$ti] = $temp_test; @tests[$ti] = $temp_test;
$logger->info("=== Test $ti ==="); $logger->info("=== Test $ti ===");
...@@ -253,13 +270,15 @@ sub download_random ($$$;$) { ...@@ -253,13 +270,15 @@ sub download_random ($$$;$) {
$logger->error("Halt because of HALT_ON_xxx. Failed test: ".($ti-1)) if $check == 1; $logger->error("Halt because of HALT_ON_xxx. Failed test: ".($ti-1)) if $check == 1;
$logger->info("Fulfilling halt request after test: ".($ti-1)) if $cont == 0; $logger->info("Fulfilling halt request after test: ".($ti-1)) if $cont == 0;
# FIXME does not work with threads... $$testref = clone($self->{'fiji_tests'});
# $testref->{'design'}->{'NUM_TESTS'} = $ti; $$testref->{'design'}->{'NUM_TESTS'} = $ti;
# $testref->{'design'}->{'REPEAT'} = 0; $$testref->{'design'}->{'REPEAT'} = 0;
# $testref->{'design'}->{'REPEAT_OFFSET'} = 0; $$testref->{'design'}->{'REPEAT_OFFSET'} = 0;
# $testref->{'tests'} = \@tests; if(is_shared($$testref)) {
# $testref->export_as_sim_script("sim.script",$ti-1,0,$self->{'fiji_settings'}); $$testref->{'tests'} = shared_clone(\@tests);
# $testref->save("fiji_tests_random.cfg"); } else {
$$testref->{'tests'} = \@tests;
}
return $recv_msg; return $recv_msg;
} }
......
...@@ -873,14 +873,22 @@ sub choose_random_fault { ...@@ -873,14 +873,22 @@ sub choose_random_fault {
my ($self) = @_; my ($self) = @_;
my ($mark,$fault) = (0,undef); my ($mark,$fault) = (0,undef);
my @prob_keys = grep ($_ =~ /^PROB/, keys(%{$self->{'design'}})); my $sum;
my @faults = grep ($_ =~ /^PROB/, keys(%{$self->{'design'}}));
my @freq = map {$sum += $self->{'design'}->{$_}; $self->{'design'}->{$_}} @faults;
push @faults, "NONE";
push @freq, 1.0 - $sum;
for (my $idx = 0; $idx < @prob_keys; $idx++) { for (my $idx = 0; $idx < @faults; $idx++) {
$mark += $self->{'design'}->{$prob_keys[ $idx ]}; $mark += $freq[ $idx ];
$fault = $idx if rand($mark) < $self->{'design'}->{$prob_keys[ $idx ]}; $fault = $idx if rand($mark) < $freq[ $idx ];
} }
return (defined $fault) ? REVERSE_FIU_ENUM($fault) : "NONE"; my $f = $faults[ $fault ];
$f =~ s/^PROB\_//;
return $f;
} }
1; 1;
...@@ -49,26 +49,32 @@ use enum qw(FIJI_USERDATA_PORTTYPE FIJI_USERDATA_FIU_INDEX FIJI_USERDATA_FD_INDE ...@@ -49,26 +49,32 @@ use enum qw(FIJI_USERDATA_PORTTYPE FIJI_USERDATA_FIU_INDEX FIJI_USERDATA_FD_INDE
use enum qw(FIJI_PORTTYPE_CLOCK FIJI_PORTTYPE_MODIFIED FIJI_PORTTYPE_ORIGINAL FIJI_PORTTYPE_FAULT_DETECTION FIJI_PORTTYPE_TRIGGER_FROM_DUT FIJI_PORTTYPE_RESET_FROM_DUT FIJI_PORTTYPE_RESET_TO_DUT); use enum qw(FIJI_PORTTYPE_CLOCK FIJI_PORTTYPE_MODIFIED FIJI_PORTTYPE_ORIGINAL FIJI_PORTTYPE_FAULT_DETECTION FIJI_PORTTYPE_TRIGGER_FROM_DUT FIJI_PORTTYPE_RESET_FROM_DUT FIJI_PORTTYPE_RESET_TO_DUT);
# Default values hash for signal and instantiation names, and the trigger and reset values # Default values hash for signal and instantiation names, and the trigger and reset values
my %FIJI_DEFAULTS; my %FIJI_DEFAULTS = (
TX_OUT_NAME => "s_fiji_tx_o",
$FIJI_DEFAULTS{'TX_OUT_NAME'} = "s_fiji_tx_o"; RX_IN_NAME => "s_fiji_rx_i",
$FIJI_DEFAULTS{'RX_IN_NAME'} = "s_fiji_rx_i"; DUT_INST_NAME => "i_DUT",
$FIJI_DEFAULTS{'DUT_INST_NAME'} = "i_DUT"; FIJI_INST_NAME => "i_FIJI",
$FIJI_DEFAULTS{'FIJI_INST_NAME'} = "i_FIJI"; FIJI_WRAPPER_NAME => "fiji_top",
$FIJI_DEFAULTS{'FIJI_WRAPPER_NAME'} = "fiji_top";
FIJI_WRAPPER_CLOCK_SIGNAL_NAME => "s_fiji_clk",
$FIJI_DEFAULTS{'FIJI_WRAPPER_CLOCK_SIGNAL_NAME'} = "s_fiji_clk"; FIJI_WRAPPER_ORIGINAL_SIGNAL_NAME => "s_fiji_original",
$FIJI_DEFAULTS{'FIJI_WRAPPER_ORIGINAL_SIGNAL_NAME'} = "s_fiji_original"; FIJI_WRAPPER_MODIFIED_SIGNAL_NAME => "s_fiji_modified",
$FIJI_DEFAULTS{'FIJI_WRAPPER_MODIFIED_SIGNAL_NAME'} = "s_fiji_modified"; FIJI_WRAPPER_FAULT_SIGNAL_NAME => "s_fiji_fault_detect",
$FIJI_DEFAULTS{'FIJI_WRAPPER_FAULT_SIGNAL_NAME'} = "s_fiji_fault_detect"; FIJI_WRAPPER_TRIGGER_DUT_SIGNAL_NAME => "s_fiji_trigger_from_dut",
$FIJI_DEFAULTS{'FIJI_WRAPPER_TRIGGER_DUT_SIGNAL_NAME'} = "s_fiji_trigger_from_dut"; FIJI_WRAPPER_TRIGGER_EXT_SIGNAL_NAME => "s_fiji_trigger_ext",
$FIJI_DEFAULTS{'FIJI_WRAPPER_TRIGGER_EXT_SIGNAL_NAME'} = "s_fiji_trigger_ext"; FIJI_WRAPPER_RESET_FROM_DUT_SIGNAL_NAME => "s_fiji_reset_from_dut",
$FIJI_DEFAULTS{'FIJI_WRAPPER_RESET_FROM_DUT_SIGNAL_NAME'} = "s_fiji_reset_from_dut"; FIJI_WRAPPER_RESET_TO_DUT_SIGNAL_NAME => "s_fiji_reset_to_dut",
$FIJI_DEFAULTS{'FIJI_WRAPPER_RESET_TO_DUT_SIGNAL_NAME'} = "s_fiji_reset_to_dut"; FIJI_WRAPPER_RESET_EXT_SIGNAL_NAME => "s_fiji_reset_ext",
$FIJI_DEFAULTS{'FIJI_WRAPPER_RESET_EXT_SIGNAL_NAME'} = "s_fiji_reset_ext"; RESET_EXT_IN_NAME => "s_fiji_reset",
$FIJI_DEFAULTS{'FIJI_TRIGGER_EXT_ASSIGNMENT'} = "not(c_trigger_ext_active)";
$FIJI_DEFAULTS{'FIJI_RESET_EXT_ASSIGNMENT'} = "not(c_reset_ext_active)"; FIJI_TRIGGER_EXT_ASSIGNMENT => "not(c_trigger_ext_active)",
$FIJI_DEFAULTS{'RESET_EXT_IN_NAME'} = "s_fiji_reset"; FIJI_RESET_EXT_ASSIGNMENT => "not(c_reset_ext_active)",
FIJI_FAULT_INJECTION_GEN_LABEL => "gen_fault_injection",
FIJI_NO_FAULT_INJECTION_GEN_LABEL => "gen_no_fault_injection",
);
use constant FIJI_DEFAULTS => \%FIJI_DEFAULTS;
## @function generate_config_package ($fiji_settings_filename, $vhdl_filename) ## @function generate_config_package ($fiji_settings_filename, $vhdl_filename)
# @brief Generate a public_config_pkg VHDL package file for FIJI # @brief Generate a public_config_pkg VHDL package file for FIJI
...@@ -284,6 +290,10 @@ sub generate_wrapper_module ($) { ...@@ -284,6 +290,10 @@ sub generate_wrapper_module ($) {
my $fiji_reset_from_dut_signal_name = $FIJI_DEFAULTS{'FIJI_WRAPPER_RESET_FROM_DUT_SIGNAL_NAME'}; my $fiji_reset_from_dut_signal_name = $FIJI_DEFAULTS{'FIJI_WRAPPER_RESET_FROM_DUT_SIGNAL_NAME'};
my $fiji_reset_to_dut_signal_name = $FIJI_DEFAULTS{'FIJI_WRAPPER_RESET_TO_DUT_SIGNAL_NAME'}; my $fiji_reset_to_dut_signal_name = $FIJI_DEFAULTS{'FIJI_WRAPPER_RESET_TO_DUT_SIGNAL_NAME'};
my $fiji_reset_ext_signal_name = $FIJI_DEFAULTS{'FIJI_WRAPPER_RESET_EXT_SIGNAL_NAME'}; my $fiji_reset_ext_signal_name = $FIJI_DEFAULTS{'FIJI_WRAPPER_RESET_EXT_SIGNAL_NAME'};
my $gen_fault_injection_label = $FIJI_DEFAULTS{'FIJI_FAULT_INJECTION_GEN_LABEL'};
my $gen_no_fault_injection_label = $FIJI_DEFAULTS{'FIJI_NO_FAULT_INJECTION_GEN_LABEL'};
my $trigger_ext_assignment = "not(c_trigger_ext_active)"; my $trigger_ext_assignment = "not(c_trigger_ext_active)";
my $reset_ext_assignment = "not(c_reset_ext_active)"; my $reset_ext_assignment = "not(c_reset_ext_active)";
...@@ -369,6 +379,7 @@ sub generate_wrapper_module ($) { ...@@ -369,6 +379,7 @@ sub generate_wrapper_module ($) {
my $gentime = localtime; my $gentime = localtime;
# generate VHDL wrapper text # generate VHDL wrapper text
my $vhdl = <<"END_VHDL"; my $vhdl = <<"END_VHDL";
--------------------------------------------------------------------------------- ---------------------------------------------------------------------------------
...@@ -409,12 +420,16 @@ end entity $wrapper_name; ...@@ -409,12 +420,16 @@ end entity $wrapper_name;
architecture wrap of $wrapper_name is architecture wrap of $wrapper_name is
attribute syn_preserve : boolean;
component $dut_toplevel is component $dut_toplevel is
port ( port (
$dut_comp_ports_vhdl $dut_comp_ports_vhdl
); );
end component $dut_toplevel; end component $dut_toplevel;
attribute syn_preserve of $dut_toplevel : component is true;
signal $fiji_trigger_ext_signal_name : std_logic; signal $fiji_trigger_ext_signal_name : std_logic;
signal $fiji_reset_ext_signal_name : std_logic; signal $fiji_reset_ext_signal_name : std_logic;
signal $fiji_clock_signal_name : std_logic; signal $fiji_clock_signal_name : std_logic;
...@@ -432,7 +447,7 @@ begin ...@@ -432,7 +447,7 @@ begin
$dut_port_maps_vhdl $dut_port_maps_vhdl
); );
gen_fault_injection : if g_implement_fault_injection = true generate $gen_fault_injection_label : if g_implement_fault_injection = true generate
$fiji_trigger_ext_signal_name <= $trigger_ext_assignment; $fiji_trigger_ext_signal_name <= $trigger_ext_assignment;
$fiji_reset_ext_signal_name <= $reset_ext_assignment; $fiji_reset_ext_signal_name <= $reset_ext_assignment;
...@@ -453,7 +468,7 @@ begin ...@@ -453,7 +468,7 @@ begin
); );
end generate; end generate;
gen_no_fault_injection : if g_implement_fault_injection = false generate $gen_no_fault_injection_label : if g_implement_fault_injection = false generate
$fiji_modified_signal_name <= $fiji_original_signal_name; $fiji_modified_signal_name <= $fiji_original_signal_name;
end generate; end generate;
......
...@@ -49,6 +49,11 @@ use Data::Dumper; ...@@ -49,6 +49,11 @@ use Data::Dumper;
Construct Tk::Widget 'FIJITestsViewer'; Construct Tk::Widget 'FIJITestsViewer';
use constant FILE_TYPES_CFG => [
['FIJI Tests', ['.cfg', '*.ini']],
['All files' , '*' ],
];
my $fr_general; my $fr_general;
my $fr_download; my $fr_download;
my $fr_buttons; my $fr_buttons;
...@@ -192,7 +197,7 @@ sub _download { ...@@ -192,7 +197,7 @@ sub _download {
# return message processing # return message processing
my $msg; my $msg;
do { do {
while(!defined ($msg = $self->{'queue_from_worker'}->dequeue_timed(0.1))) { while(!defined ($msg = $self->{'queue_from_worker'}->dequeue_timed(0.01))) {
$self->toplevel->update(); $self->toplevel->update();
} }
if(defined $msg->{'rmsg'} && ref $msg->{'rmsg'} eq "HASH") { if(defined $msg->{'rmsg'} && ref $msg->{'rmsg'} eq "HASH") {
...@@ -200,11 +205,18 @@ sub _download { ...@@ -200,11 +205,18 @@ sub _download {
} else { } else {
$self->{'msg_type'}->configure(-text=>$msg->{'rmsg'},-bg=>"red"); $self->{'msg_type'}->configure(-text=>$msg->{'rmsg'},-bg=>"red");
} }
$self->toplevel->update();
} while ($msg->{'state'} ne "finished"); } while ($msg->{'state'} ne "finished");
$self->afterCancel($timer); $self->afterCancel($timer);
$self->_update_timer("Run duration"); $self->_update_timer("Run duration");
if(defined $msg->{'rmsg'} && ref $msg->{'rmsg'} eq "HASH" &&
defined $msg->{'testref'} && ref($msg->{'testref'}) eq "FIJI::Tests") {
my $new_name = $self->FBox(-type=>"save",-filetypes=>FILE_TYPES_CFG)->Show;
$msg->{'testref'}->save($new_name) if defined $new_name;
}
$bu->configure(-state=>"normal"); $bu->configure(-state=>"normal");
$bs->configure(-state=>"disabled",-text=>"Stop"); $bs->configure(-state=>"disabled",-text=>"Stop");
$bg->configure(-state=>"normal"); $bg->configure(-state=>"normal");
......
...@@ -94,15 +94,16 @@ sub main { ...@@ -94,15 +94,16 @@ sub main {
return 1; return 1;
} }
my $new_tests = {};
# Check mode and execute tests accordingly # Check mode and execute tests accordingly
if ( $cfg->{'mode'} eq "auto" ) { if ( $cfg->{'mode'} eq "auto" ) {
$rv = $fiji_downloader->download_auto($cfg->{'portname'}); $rv = $fiji_downloader->download_auto(