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

Beautifier run

parent e0159848
......@@ -36,12 +36,17 @@ use Log::Log4perl qw(:easy);
use if $^O eq "MSWin32", "Win32::TieRegistry";
use constant FIJI_DIR => realpath(File::Spec->rel2abs("..", $FindBin::Bin));
use constant FIJI_DOCUMENTATION_PATH =>
realpath(File::Spec->rel2abs(File::Spec->catfile("..",
"docs",
"userguide",
"fiji_user_guide.pdf"),
$FindBin::Bin));
use constant FIJI_DOCUMENTATION_PATH => realpath(
File::Spec->rel2abs(
File::Spec->catfile(
"..",
"docs",
"userguide",
"fiji_user_guide.pdf"
),
$FindBin::Bin
)
);
my @optimization_settings = qw(ALLOW OPTIMIZATION_OFF FIX_PLACEMENT);
use constant OPTIMIZATION_SETTINGS => \@optimization_settings;
......@@ -117,7 +122,6 @@ use constant LFSR_POLY_CHOICES => {
64 => ["0x1B"],
};
#** @var public %designmap Hash containing all FIJI::Settings
#
# Architecture from http://www.perlmonks.org/?node_id=1072731
......@@ -229,7 +233,7 @@ BEGIN {
} else {
return 1;
}
}
}
},
ID => {
description => "Design ID",
......@@ -777,35 +781,34 @@ BEGIN {
type => "autocomplete",
gui_modes => [qw (manual auto random)],
values => sub {
my $logger = get_logger("");
my $choices = [];
my @s;
if ($^O eq "MSWin32") {
my $reg = new Win32::TieRegistry("LMachine\\Hardware\\DEVICEMAP\\SERIALCOMM\\");
foreach my $port ($reg->ValueNames) {
push(@s, $reg->GetValue($port));
}
} elsif ($^O eq "linux") {
@s = glob("/dev/serial/by-id/*");
my $logger = get_logger("");
my $choices = [];
my @s;
if ($^O eq "MSWin32") {
my $reg = new Win32::TieRegistry("LMachine\\Hardware\\DEVICEMAP\\SERIALCOMM\\");
foreach my $port ($reg->ValueNames) {
push(@s, $reg->GetValue($port));
}
$choices = \@s;
return $choices;
} elsif ($^O eq "linux") {
@s = glob("/dev/serial/by-id/*");
}
$choices = \@s;
return $choices;
},
order => 1,
order => 1,
},
HALT_ON_FAULT_DETECT => {
description => "Halt on detected fault?",
ini_name => "HALT_ON_FAULT_DETECT",
default => 1,
type => 'boolean',
phases_opt => [qw(manual)],
gui_modes => [qw (auto random)],
order => 10,
description => "Halt on detected fault?",
ini_name => "HALT_ON_FAULT_DETECT",
default => 1,
type => 'boolean',
phases_opt => [qw(manual)],
gui_modes => [qw (auto random)],
order => 10,
activated_by_settings => sub {
my $settings = shift;
return ($settings->{'design'}->{'FAULT_DETECT_1_EN'} == 1 ||
$settings->{'design'}->{'FAULT_DETECT_2_EN'} == 1);
}
my $settings = shift;
return ($settings->{'design'}->{'FAULT_DETECT_1_EN'} == 1 || $settings->{'design'}->{'FAULT_DETECT_2_EN'} == 1);
}
},
NUM_TESTS => {
ini_name => "NUM_TESTS",
......@@ -892,7 +895,7 @@ BEGIN {
MAX_DURATION_T1 => {
description => "Maximum Duration T1",
ini_name => "MAX_DURATION_T1",
default => (10*DEFAULT_TIMER_VALUE),
default => (10 * DEFAULT_TIMER_VALUE),
phases_opt => [qw(manual auto)],
gui_modes => [qw (random)],
type => "max_duration",
......@@ -903,7 +906,7 @@ BEGIN {
MAX_DURATION_T2 => {
description => "Maximum Duration T2",
ini_name => "MAX_DURATION_T2",
default => (10*DEFAULT_TIMER_VALUE),
default => (10 * DEFAULT_TIMER_VALUE),
phases_opt => [qw(manual auto)],
gui_modes => [qw (random)],
type => "max_duration",
......@@ -961,37 +964,37 @@ BEGIN {
fault => "STUCK_OPEN",
order => 110,
},
INITIAL_RESET => {
description => "Initial test: Apply FIJI-to-DUT reset?",
ini_name => "INITIAL_RESET",
default => 0,
type => 'boolean',
phases_opt => [qw(manual auto)],
gui_modes => [qw (random)],
order => 15,
INITIAL_RESET => {
description => "Initial test: Apply FIJI-to-DUT reset?",
ini_name => "INITIAL_RESET",
default => 0,
type => 'boolean',
phases_opt => [qw(manual auto)],
gui_modes => [qw (random)],
order => 15,
activated_by_settings => sub {
my $settings = shift;
return ($settings->{'design'}->{'RESET_DUT_IN_EN'} == 1);
}
my $settings = shift;
return ($settings->{'design'}->{'RESET_DUT_IN_EN'} == 1);
}
},
INITIAL_TRIGGER => {
description => "Initial test: Wait for trigger?",
ini_name => "INITIAL_TRIGGER",
default => 'NONE',
values => [qw(INT EXT NONE)],
type => 'dropdown',
phases_opt => [qw(manual auto)],
gui_modes => [qw (random)],
order => 16,
description => "Initial test: Wait for trigger?",
ini_name => "INITIAL_TRIGGER",
default => 'NONE',
values => [qw(INT EXT NONE)],
type => 'dropdown',
phases_opt => [qw(manual auto)],
gui_modes => [qw (random)],
order => 16,
activated_by_settings => sub {
my $settings = shift;
my $opt = ();
push @{$opt}, "NONE";
push @{$opt}, "INT" if ($settings->{'design'}->{'TRIGGER_DUT_EN'} == 1);
push @{$opt}, "EXT" if ($settings->{'design'}->{'TRIGGER_DUT_EN'} == 1);
return $opt;
}
my $settings = shift;
my $opt = ();
push @{$opt}, "NONE";
push @{$opt}, "INT" if ($settings->{'design'}->{'TRIGGER_DUT_EN'} == 1);
push @{$opt}, "EXT" if ($settings->{'design'}->{'TRIGGER_DUT_EN'} == 1);
return $opt;
}
},
COMPLETION_SCRIPT => {
description => "Script to run when the test is complete",
......@@ -999,12 +1002,12 @@ BEGIN {
default => "",
type => "file",
filetypes => [
['Perl scripts', ['.pl']],
['All files', '*'],
],
phases_opt => [qw(manual auto random)],
gui_modes => [qw (auto random)],
order => 15
['Perl scripts', ['.pl']],
['All files', '*'],
],
phases_opt => [qw(manual auto random)],
gui_modes => [qw (auto random)],
order => 15
}
);
}
......@@ -1135,9 +1138,10 @@ our @EXPORT_OK = ('FIJI_DOCUMENTATION_PATH', 'FIJI_DIR', keys(%designmap), 'DESI
our %EXPORT_TAGS = (
all => \@EXPORT_OK,
default => \@EXPORT,
%EXPORT_TAGS = (fiji_dir => ['FIJI_DIR'], fiji_documentation_path => ['FIJI_DOCUMENTATION_PATH'])
%EXPORT_TAGS =
(fiji_dir => ['FIJI_DIR'], fiji_documentation_path => ['FIJI_DOCUMENTATION_PATH'])
# log => [ grep /^LOG_/, @EXPORT_OK ], # all constants beginning with "LOG_"
# log => [ grep /^LOG_/, @EXPORT_OK ], # all constants beginning with "LOG_"
);
1;
......@@ -12,20 +12,20 @@ sub as_string {
my $syntax = $self->{_SYNTAX} or die "'_SYNTAX' is not defined";
my $sub_syntax = $self->{_SUB_SYNTAX} || '';
my $currtime = localtime;
my $STRING = undef;
if ( $syntax eq 'ini' ) {
my $currtime = localtime;
my $STRING = undef;
if ($syntax eq 'ini') {
$STRING .= "; FIJI::ConfigSorted $VERSION\n";
$STRING .= "; $currtime\n\n";
for my $block_name (sort keys %{$self->{_DATA}}) {
my $key_values = $self->{_DATA}->{$block_name};
unless ( $sub_syntax eq 'simple-ini' ) {
unless ($sub_syntax eq 'simple-ini') {
$STRING .= sprintf("[%s]\n", $block_name);
}
for my $key (sort keys %{$key_values}) {
my $value = $key_values->{$key};
my $values = join (WRITE_DELIM, map { $self->SUPER::quote_values($_) } @$value);
$STRING .= sprintf("%s=%s\n", $key, $values );
my $values = join(WRITE_DELIM, map { $self->SUPER::quote_values($_) } @$value);
$STRING .= sprintf("%s=%s\n", $key, $values);
}
$STRING .= "\n";
}
......
This diff is collapsed.
......@@ -34,7 +34,7 @@ use Data::Dumper;
sub _quartus_direct_partitions_logiclock {
my $logger = get_logger("");
my $cfg = shift;
my $cfg = shift;
my $DUT_TO = $cfg->{'dut_module'} . ":" . $cfg->{'dut_inst'};
my $FIJI_TO = $cfg->{'fiji_module'} . ":" . $cfg->{'fiji_inst'};
......@@ -88,7 +88,7 @@ END_LOCK
} elsif ($cfg->{'mode'} eq "FIX_PLACEMENT") {
$txt .= $partitioning . $area;
} elsif ($cfg->{'mode'} ne "ALLOW") {
$logger->error("Unknown SYNTHESIS_MODE ".$cfg->{'mode'});
$logger->error("Unknown SYNTHESIS_MODE " . $cfg->{'mode'});
return undef;
}
return $txt . $fin;
......@@ -96,7 +96,7 @@ END_LOCK
sub _synplify_quartus_optimization_physical {
my $logger = get_logger("");
my $cfg = shift;
my $cfg = shift;
my $DUT_NAME = $cfg->{'dut_module'};
my $FIJI_NAME = $cfg->{'fiji_module'};
......@@ -111,7 +111,7 @@ sub _synplify_quartus_optimization_physical {
END_HDR
my $fin = "# EOF";
my $no_optimization =<<"END_OPTIMIZATION";
my $no_optimization = <<"END_OPTIMIZATION";
###==== BEGIN Attributes
define_attribute {v:$DUT_NAME} syn_hier {fixed}
define_attribute {v:$FIJI_NAME} syn_hier {fixed}
......@@ -133,7 +133,7 @@ END_LOCK
} elsif ($cfg->{'mode'} eq "FIX_PLACEMENT") {
$txt .= $no_optimization . $area;
} elsif ($cfg->{'mode'} ne "ALLOW") {
$logger->error("Unknown SYNTHESIS_MODE ".$cfg->{'mode'});
$logger->error("Unknown SYNTHESIS_MODE " . $cfg->{'mode'});
return undef;
}
return $txt . $fin;
......@@ -141,7 +141,7 @@ END_LOCK
sub _synplify_xise_optimization_physical {
my $logger = get_logger("");
my $cfg = shift;
my $cfg = shift;
my $DUT_NAME = $cfg->{'dut_module'};
my $FIJI_NAME = $cfg->{'fiji_module'};
......@@ -170,7 +170,7 @@ sub _synplify_xise_optimization_physical {
END_HDR
my $fin = "# EOF";
my $no_optimization =<<"END_OPTIMIZATION";
my $no_optimization = <<"END_OPTIMIZATION";
###==== BEGIN Attributes
define_attribute {v:$DUT_NAME} syn_hier {fixed}
define_attribute {v:$FIJI_NAME} syn_hier {fixed}
......@@ -192,7 +192,7 @@ END_LOCK
} elsif ($cfg->{'mode'} eq "FIX_PLACEMENT") {
$txt .= $no_optimization . $area;
} elsif ($cfg->{'mode'} ne "ALLOW") {
$logger->error("Unknown SYNTHESIS_MODE ".$cfg->{'mode'});
$logger->error("Unknown SYNTHESIS_MODE " . $cfg->{'mode'});
return undef;
}
return $txt . $fin;
......
......@@ -208,7 +208,7 @@ sub download_auto ($) {
my $check = $self->_check_halt($recv_msg);
if (@{$check}) {
$logger->error("Halt because of ".join("and",@{$check}).". Failed test: $ti, repetition $ri.");
$logger->error("Halt because of " . join("and", @{$check}) . ". Failed test: $ti, repetition $ri.");
goto END;
}
......@@ -274,7 +274,7 @@ sub download_random ($$$;$) {
my $cont;
do {
my $temp_test = $self->{'fiji_tests'}->make_random_test($self->{'fiji_settings'},($ti == 0));
my $temp_test = $self->{'fiji_tests'}->make_random_test($self->{'fiji_settings'}, ($ti == 0));
return $temp_test if (!ref($temp_test));
$tests[$ti] = $temp_test;
$logger->info("=== Test $ti ===");
......@@ -284,8 +284,8 @@ sub download_random ($$$;$) {
$cont = &$intermediate_cb($recv_msg);
} while (@{$check} == 0 && $cont != 0);
$logger->error("Halt because of ".join(" and ",@{$check}).". Failed test: " . ($ti - 1)) if @{$check};
$logger->info("Fulfilling halt request after test: " . ($ti - 1)) if $cont == 0;
$logger->error("Halt because of " . join(" and ", @{$check}) . ". Failed test: " . ($ti - 1)) if @{$check};
$logger->info("Fulfilling halt request after test: " . ($ti - 1)) if $cont == 0;
$$testref = clone($self->{'fiji_tests'});
$$testref->{'design'}->{'NUM_TESTS'} = $ti;
......@@ -336,7 +336,7 @@ sub download_manual ($;$) {
}
if (@{$self->_check_halt($recv_msg)}) {
$msg = "Halt because of ".join(' and ', @{$self->_check_halt($recv_msg)});
$msg = "Halt because of " . join(' and ', @{$self->_check_halt($recv_msg)});
return $msg;
}
......@@ -434,7 +434,6 @@ sub _get_test_from_stdin {
return $test;
}
sub get_fic_status ($$) {
my $logger = get_logger("");
my ($self, $portname) = @_;
......@@ -547,7 +546,7 @@ sub _download_test {
sub _check_halt ($) {
my $logger = get_logger("");
my ($self, $recv_msg) = @_;
my $reasons = [];
my $reasons = [];
my $fiji_tests = $self->{'fiji_tests'};
# @FIXME HALT_on_xxx information is defined in tests config file. OK?
......
......@@ -125,9 +125,10 @@ sub get_toplevel_port_names {
my $ports_ref = [];
foreach my $mod ($self->{'nl'}->top_modules_sorted) {
foreach my $port ($mod->ports_sorted) {
if (!defined($dir) ||
($dir eq "o" && $port->direction eq "out") ||
($dir eq "i" && $port->direction eq "in")) {
if ( !defined($dir)
|| ($dir eq "o" && $port->direction eq "out")
|| ($dir eq "i" && $port->direction eq "in"))
{
push @{$ports_ref}, $port->name;
}
}
......@@ -141,11 +142,11 @@ sub get_toplevel_port_names {
# @returns a Verilog::Module reference
sub get_toplevel_module {
my ($self) = @_;
my @m = $self->{'nl'}->top_modules_sorted;
my $n = @m;
return $m[0] if($n == 1);
return "More than one toplevel module present in netlist." if($n > 1);
return "No toplevel module found."
my @m = $self->{'nl'}->top_modules_sorted;
my $n = @m;
return $m[0] if ($n == 1);
return "More than one toplevel module present in netlist." if ($n > 1);
return "No toplevel module found.";
}
## @method public get_nets ()
......@@ -184,9 +185,9 @@ sub _get_subnets {
$thishier .= $mod->name;
foreach my $n ($mod->nets) {
if(defined $n->msb && $n->lsb) {
for(my $sub = $n->lsb; $sub < $n->msb; $sub++) {
my $thisnet_ref = {name => $n->name."[$sub]", path => $thishier, net => $n, index => $sub};
if (defined $n->msb && $n->lsb) {
for (my $sub = $n->lsb ; $sub < $n->msb ; $sub++) {
my $thisnet_ref = {name => $n->name . "[$sub]", path => $thishier, net => $n, index => $sub};
push(@{$nets_ref}, $thisnet_ref);
}
} else {
......
......@@ -392,7 +392,7 @@ sub validate_value {
# @TODO: check syntax? there is nothing more to do in here unless we supply allowed nets...
# which is actually possible because the input netlist is stored in the settings as well
} elsif ($map_ref->{$k}->{'type'} eq 'hexadecimal' || $map_ref->{$k}->{'type'} eq 'lfsrpoly' ) {
} elsif ($map_ref->{$k}->{'type'} eq 'hexadecimal' || $map_ref->{$k}->{'type'} eq 'lfsrpoly') {
if ($orig !~ /^(0|(0[xX][[:xdigit:]]+))$/) {
$log_func->($logger, "$k: $orig does not look like a natural hexadecimal number.");
return 0;
......@@ -690,42 +690,42 @@ sub _est_resources {
$logger->debug("FREQUENCY $FREQUENCY out of range for correct resource estimation (1000000 - 500000000)");
push @{$out_of_range}, "FREQUENCY";
}
if ($BAUD < 9600 || $BAUD > 3000000) {
if ($BAUD < 9600 || $BAUD > 3000000) {
$logger->debug("BAUD $BAUD out of range for correct resource estimation (9600 - 3000000)");
push @{$out_of_range}, "BAUD";
}
if ($TIMER_WIDTH < 1 || $TIMER_WIDTH > 8) {
if ($TIMER_WIDTH < 1 || $TIMER_WIDTH > 8) {
$logger->debug("TIMER_WIDTH $TIMER_WIDTH out of range for correct resource estimation (1 - 8)");
push @{$out_of_range}, "TIMER_WIDTH";
}
if ($RESET_CYCLES < 1 || $RESET_CYCLES > 16) {
if ($RESET_CYCLES < 1 || $RESET_CYCLES > 16) {
$logger->debug("RESET_CYCLES $RESET_CYCLES out of range for correct resource estimation (1 - 16)");
push @{$out_of_range}, "RESET_CYCLES";
}
if ($LFSR_WIDTH < 16 || $LFSR_WIDTH > 64) {
if ($LFSR_WIDTH < 16 || $LFSR_WIDTH > 64) {
$logger->debug("LFSR_WIDTH $LFSR_WIDTH out of range for correct resource estimation (16 - 64)");
push @{$out_of_range}, "RESET_CYCLES";
}
if ($FIU_NUM < 1 || $FIU_NUM > 64) {
if ($FIU_NUM < 1 || $FIU_NUM > 64) {
$logger->debug("FIU_NUM $FIU_NUM out of range for correct resource estimation (1 - 64)");
push @{$out_of_range}, "FIU_NUM";
}
$registers = 8769408455.04;
$registers += (3.16525787254e-08)*($FREQUENCY) + (-8063276676.79)*(2**(-1.60957863771e-17 * $FREQUENCY));
$registers += (0.000329011902135)*($BAUD) + (-705457194.107)*(2**(7.38032560255e-13 * $BAUD));
$registers += (86.8258719199)*($TIMER_WIDTH) + (-424084.540754)*(2**(0.000218517717305 * $TIMER_WIDTH));
$registers += (5.02154556118)*($RESET_CYCLES) + (51167.4447102)*(2**(-0.000135580209031 * $RESET_CYCLES));
$registers += (-5.30893252274)*($LFSR_WIDTH) + (-301970.077109)*(2**(-2.99010866996e-05 * $LFSR_WIDTH));
$registers += (13.746880792)*($FIU_NUM) + (437.305954808)*(2**(-0.00583539664462 * $FIU_NUM));
$registers += (3.16525787254e-08) * ($FREQUENCY) + (-8063276676.79) * (2**(-1.60957863771e-17 * $FREQUENCY));
$registers += (0.000329011902135) * ($BAUD) + (-705457194.107) * (2**(7.38032560255e-13 * $BAUD));
$registers += (86.8258719199) * ($TIMER_WIDTH) + (-424084.540754) * (2**(0.000218517717305 * $TIMER_WIDTH));
$registers += (5.02154556118) * ($RESET_CYCLES) + (51167.4447102) * (2**(-0.000135580209031 * $RESET_CYCLES));
$registers += (-5.30893252274) * ($LFSR_WIDTH) + (-301970.077109) * (2**(-2.99010866996e-05 * $LFSR_WIDTH));
$registers += (13.746880792) * ($FIU_NUM) + (437.305954808) * (2**(-0.00583539664462 * $FIU_NUM));
$lut6 = -1591399138.51;
$lut6 += (5.65349933334e-06)*($FREQUENCY) + (-245548261.879)*(2**(3.26830064347e-14 * $FREQUENCY));
$lut6 += (-0.0602788840594)*($BAUD) + (1868596655.23)*(2**(4.65257746085e-11 * $BAUD));
$lut6 += (9.04974779295)*($TIMER_WIDTH) + (-123738.805411)*(2**(7.77721022021e-07 * $TIMER_WIDTH));
$lut6 += (0.156780025973)*($RESET_CYCLES) + (-176988.018256)*(2**(1e-08 * $RESET_CYCLES));
$lut6 += (-1.88257966999)*($LFSR_WIDTH) + (-31351130.663)*(2**(-8.63995764468e-08 * $LFSR_WIDTH));
$lut6 += (3.95693187928)*($FIU_NUM) + (2718.76465806)*(2**(-0.000895867386597 * $FIU_NUM));
$lut6 += (5.65349933334e-06) * ($FREQUENCY) + (-245548261.879) * (2**(3.26830064347e-14 * $FREQUENCY));
$lut6 += (-0.0602788840594) * ($BAUD) + (1868596655.23) * (2**(4.65257746085e-11 * $BAUD));
$lut6 += (9.04974779295) * ($TIMER_WIDTH) + (-123738.805411) * (2**(7.77721022021e-07 * $TIMER_WIDTH));
$lut6 += (0.156780025973) * ($RESET_CYCLES) + (-176988.018256) * (2**(1e-08 * $RESET_CYCLES));
$lut6 += (-1.88257966999) * ($LFSR_WIDTH) + (-31351130.663) * (2**(-8.63995764468e-08 * $LFSR_WIDTH));
$lut6 += (3.95693187928) * ($FIU_NUM) + (2718.76465806) * (2**(-0.000895867386597 * $FIU_NUM));
return ($registers, $lut6, $out_of_range);
}
......@@ -745,8 +745,8 @@ sub estimate_resources {
my @calcrv = _est_resources($consts_ref->{'FREQUENCY'}, $consts_ref->{'BAUDRATE'}, $consts_ref->{'TIMER_WIDTH'}, $consts_ref->{'RESET_DUT_IN_DURATION'}, $consts_ref->{'LFSR_WIDTH'}, $fiu_num, "logarithmic");
my $rv = {
regs => sprintf("%.2f", $calcrv[0] / $base_resources[0]),
lut_calc => sprintf("%.2f", $calcrv[1] / $base_resources[1]),
regs => sprintf("%.2f", $calcrv[0] / $base_resources[0]),
lut_calc => sprintf("%.2f", $calcrv[1] / $base_resources[1]),
out_of_range => $calcrv[2],
};
......
......@@ -40,7 +40,6 @@ use FIJI::ConfigSorted;
use FIJI::Settings;
use FIJI qw(:all);
# @FIXME rather similar to Settings.pm
# Can we generalize this?
......@@ -709,9 +708,9 @@ sub export_as_vhd_pkg {
my ($self, $vhd_file_name, $global_settings_ref) = @_;
my $durations = "";
my $faults = "";
my $fius = "";
my $fius = "";
my $msg;
my $tests = "";
my $tests = "";
open(my $vfd, ">", $vhd_file_name);
......@@ -729,30 +728,30 @@ sub export_as_vhd_pkg {
my $absolute_test_index = 0;
for (my $ti = 0; $ti < $self->{'design'}->{'NUM_TESTS'}; $ti++) {
for (my $ti = 0 ; $ti < $self->{'design'}->{'NUM_TESTS'} ; $ti++) {
my $durations = "";
my $fius = "";
my $fius = "";
#my $tests = "";
my $faults = "";
my $faults = "";
my $test = @{$self->{'tests'}}[$ti];
my $rst = ($test->{"RESET_DUT_AFTER_CONFIG"}) ? "true" : "false";
for (my $ci = 1 ; $ci <= $global_settings_ref->{'design'}->{'CFGS_PER_MSG'} ; $ci++) {
$faults .= " $ci => (\n";
for (my $fi = 0; $fi < $global_settings_ref->{'design'}->{'FIU_NUM'}; $fi++) {
$faults .= " $fi => ".$test->{"FIU_${fi}_FAULT_${ci}"};
$faults .= "," if $fi != $global_settings_ref->{'design'}->{'FIU_NUM'} - 1;
$faults .= "\n";
$faults .= " $ci => (\n";
for (my $fi = 0 ; $fi < $global_settings_ref->{'design'}->{'FIU_NUM'} ; $fi++) {
$faults .= " $fi => " . $test->{"FIU_${fi}_FAULT_${ci}"};
$faults .= "," if $fi != $global_settings_ref->{'design'}->{'FIU_NUM'} - 1;
$faults .= "\n";
}
$faults .= " )";
$durations .= " $ci => ".$test->{"TIMER_VALUE_$ci"};
$faults .= " )";
$durations .= " $ci => " . $test->{"TIMER_VALUE_$ci"};
if ($ci != $global_settings_ref->{'design'}->{'CFGS_PER_MSG'}) {
$durations .= ",\n";
$faults .= ",\n";
}
}
$tests .=<<"END_TEST";
$tests .= <<"END_TEST";
$ti => (
durations => (
$durations
......@@ -764,12 +763,12 @@ $faults
trigger => $test->{"TRIGGER"}
)
END_TEST
if ($ti != $self->{'design'}->{'NUM_TESTS'}-1) {
if ($ti != $self->{'design'}->{'NUM_TESTS'} - 1) {
$tests .= " ,\n";
}
}
my $vhd_text =<<"END_VHDL";
my $vhd_text = <<"END_VHDL";
-- VHDL test package generated $time
library ieee;
......@@ -843,7 +842,7 @@ sub export_as_sim_script {
# @FIXME translate in actual Questasim tcl syntax
if ($global_settings_ref->{'design'}->{'RESET_DUT_OUT_EN'} == 1) {
$script_text .=<<"END_RST";
$script_text .= <<"END_RST";
set testbench_name \$1;
set start 0;
set test 0;
......@@ -887,7 +886,7 @@ when -label lfsr {\"\$testbench_name|$global_settings_ref->{'design'}->{'CLOCK_N
}
END_RST
} else {
$script_text .= "set start 1";
$script_text .= "set start 1";
}
my $absolute_test_index = 0;
......@@ -899,24 +898,24 @@ END_RST
for (my $ti = $start ; $ti <= $end ; $ti++) {
$script_text .= "\n#\n# Test $ri:$ti\n#\n";
$script_text .= "when -label test_$absolute_test_index \"\$test = $absolute_test_index".(($absolute_test_index == 0) ? " && \$start = 1" : "")."\" {\n";
$script_text .= "when -label test_$absolute_test_index \"\$test = $absolute_test_index" . (($absolute_test_index == 0) ? " && \$start = 1" : "") . "\" {\n";
if ($absolute_test_index > 0) {
$script_text .= $indent."eval {nowhen test_".($absolute_test_index-1)."}\n";
$script_text .= $indent."eval {nowhen dutrst_".($absolute_test_index-1)."}\n";
$script_text .= $indent."eval {nowhen trigger_".($absolute_test_index-1)."}\n";
$script_text .= $indent."eval {nowhen action_".($absolute_test_index-1)."_1}\n";
$script_text .= $indent."eval {nowhen action_".($absolute_test_index-1)."_2}\n";
$script_text .= $indent."eval {nowhen clk}\n";
$script_text .= $indent . "eval {nowhen test_" . ($absolute_test_index - 1) . "}\n";