Commit d7d5684f authored by Stefan Tauner's avatar Stefan Tauner
Browse files

Improve some comments and various cleanups

parent a1a90299
...@@ -1136,7 +1136,6 @@ use constant FIUENUM => \%fiuenum; ...@@ -1136,7 +1136,6 @@ use constant FIUENUM => \%fiuenum;
# makes use of \ref fiuenum # makes use of \ref fiuenum
# #
# @param val the textual ID of the Fault # @param val the textual ID of the Fault
sub REVERSE_FIU_ENUM { sub REVERSE_FIU_ENUM {
my ($val) = @_; my ($val) = @_;
for my $k (keys(%fiuenum)) { for my $k (keys(%fiuenum)) {
......
...@@ -32,7 +32,6 @@ use warnings; ...@@ -32,7 +32,6 @@ use warnings;
use Log::Log4perl qw(get_logger); use Log::Log4perl qw(get_logger);
use Digest::CRC "crc"; use Digest::CRC "crc";
use Time::HiRes "usleep"; use Time::HiRes "usleep";
use Data::Dumper;
use FIJI::AnySerialPort; use FIJI::AnySerialPort;
## @method public init ($portname, $baudrate) ## @method public init ($portname, $baudrate)
...@@ -438,7 +437,6 @@ sub sanitize_config { ...@@ -438,7 +437,6 @@ sub sanitize_config {
$prev_t1 = $t1_duration; $prev_t1 = $t1_duration;
$prev_t2 = $t2_duration; $prev_t2 = $t2_duration;
# $logger->error(sprintf("setting t2 duration (%d) as prev_timeout.", $t2_duration));
return {'msg_type' => $msg_type, 'fault_detect' => \%fd, 'error' => \%err, 'underrun_occurred' => ($underrun_occurred != 0)}; return {'msg_type' => $msg_type, 'fault_detect' => \%fd, 'error' => \%err, 'underrun_occurred' => ($underrun_occurred != 0)};
} }
} # "static" block } # "static" block
......
...@@ -25,7 +25,6 @@ use strict; ...@@ -25,7 +25,6 @@ use strict;
use warnings; use warnings;
use Log::Log4perl qw(get_logger); use Log::Log4perl qw(get_logger);
use Data::Dumper;
sub _quartus_partitions_logiclock { sub _quartus_partitions_logiclock {
my $logger = get_logger(""); my $logger = get_logger("");
......
...@@ -28,7 +28,6 @@ use FIJI::Tests; ...@@ -28,7 +28,6 @@ use FIJI::Tests;
use FIJI::Settings; use FIJI::Settings;
use FIJI::Connection; use FIJI::Connection;
use FIJI qw(:all); use FIJI qw(:all);
use Data::Dumper;
use Clone 'clone'; use Clone 'clone';
use threads; use threads;
use threads::shared; use threads::shared;
...@@ -107,7 +106,7 @@ sub existing_settings { ...@@ -107,7 +106,7 @@ sub existing_settings {
} }
} }
## @method public tests_from_file ($mode, $set_ref, $cfgname) ## @method public tests_from_file ($mode, %$set_ref, $cfgname)
# @brief read tests from a given file # @brief read tests from a given file
# #
# @param mode currently active FIJI settings # @param mode currently active FIJI settings
...@@ -219,6 +218,9 @@ sub download_auto ($) { ...@@ -219,6 +218,9 @@ sub download_auto ($) {
$$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;
# We make sure that the returned tests reference is pointing to
# shareable objects only if the reference itself is already shared.
# This makes things easier for multithreaded applications like the EE GUI.
if (is_shared($$testref)) { if (is_shared($$testref)) {
$$testref->{'tests'} = shared_clone(\@tests); $$testref->{'tests'} = shared_clone(\@tests);
} else { } else {
......
...@@ -33,7 +33,6 @@ use File::Basename qw(basename); ...@@ -33,7 +33,6 @@ use File::Basename qw(basename);
use Verilog::Netlist 99.415; use Verilog::Netlist 99.415;
use Verilog::Language 99.415; use Verilog::Language 99.415;
use Data::Dumper;
use FIJI::VHDL; use FIJI::VHDL;
use FIJI qw(:fiji_logo); use FIJI qw(:fiji_logo);
......
...@@ -27,7 +27,6 @@ use warnings; ...@@ -27,7 +27,6 @@ use warnings;
use Scalar::Util 'blessed'; use Scalar::Util 'blessed';
use Log::Log4perl qw(get_logger); use Log::Log4perl qw(get_logger);
use Scalar::Util "looks_like_number"; use Scalar::Util "looks_like_number";
use Data::Dumper;
use POSIX qw(ceil); use POSIX qw(ceil);
use List::Util qw(max); use List::Util qw(max);
use File::Spec; use File::Spec;
...@@ -748,7 +747,7 @@ sub _est_resources { ...@@ -748,7 +747,7 @@ sub _est_resources {
return ($registers, $lut6, $out_of_range); return ($registers, $lut6, $out_of_range);
} }
## @function public estimate_resources ($settings_ref) ## @method public estimate_resources (%$settings_ref)
# @brief estimates the resources needed to implement the given settings # @brief estimates the resources needed to implement the given settings
# #
# @returns a hash with the members 'regs' and 'lut_calc' # @returns a hash with the members 'regs' and 'lut_calc'
......
...@@ -27,7 +27,6 @@ use warnings; ...@@ -27,7 +27,6 @@ use warnings;
use Scalar::Util 'blessed'; use Scalar::Util 'blessed';
use Log::Log4perl qw(get_logger); use Log::Log4perl qw(get_logger);
use Scalar::Util "looks_like_number"; use Scalar::Util "looks_like_number";
use Data::Dumper;
use Clone qw(clone); use Clone qw(clone);
use File::Spec; use File::Spec;
...@@ -39,7 +38,7 @@ use FIJI qw(:all); ...@@ -39,7 +38,7 @@ use FIJI qw(:all);
# @FIXME this was almost a 1:1 copy of Settings.pm. refactoring or cleanup is required # @FIXME this was almost a 1:1 copy of Settings.pm. refactoring or cleanup is required
## @function public new ($phase, $global_settings_ref, $fiji_ini_file, $existing_settings) ## @function public new ($phase, %$global_settings_ref, $fiji_ini_file, %$existing_settings)
# Create a new settings instance. # Create a new settings instance.
# #
# \param phase Tool flow phase the settings need to be compatible with. # \param phase Tool flow phase the settings need to be compatible with.
...@@ -230,7 +229,7 @@ sub save { ...@@ -230,7 +229,7 @@ sub save {
return undef; return undef;
} }
## @function public read_settingsfile ($phase, $fiji_ini_file) ## @method public read_settingsfile ($phase, $fiji_ini_file)
# @brief Load the FIJI Settings file containing design and TEST constants. # @brief Load the FIJI Settings file containing design and TEST constants.
# #
# \param phase Tool flow phase the settings stored in the given file # \param phase Tool flow phase the settings stored in the given file
...@@ -398,7 +397,7 @@ sub set_test_defaults { ...@@ -398,7 +397,7 @@ sub set_test_defaults {
return $self->_set_defaults($self->{'TESTPATMAP'}, $consts_ref); return $self->_set_defaults($self->{'TESTPATMAP'}, $consts_ref);
} }
## @function public _set_defaults (%$map_ref, %$consts_ref) ## @method public _set_defaults (%$map_ref, %$consts_ref)
# @brief Set defaults according to FIJI.pm. # @brief Set defaults according to FIJI.pm.
sub _set_defaults { sub _set_defaults {
my $logger = get_logger(""); my $logger = get_logger("");
...@@ -999,8 +998,12 @@ sub make_random_test { ...@@ -999,8 +998,12 @@ sub make_random_test {
} }
} }
} else { } else {
# Select a single configuration within a message
my $fpi = int(rand($global_settings_ref->{'design'}->{'CFGS_PER_MSG'})); my $fpi = int(rand($global_settings_ref->{'design'}->{'CFGS_PER_MSG'}));
# Select a single FIU
my $ffi = int(rand($global_settings_ref->{'design'}->{'FIU_NUM'})); my $ffi = int(rand($global_settings_ref->{'design'}->{'FIU_NUM'}));
# Find the respective variable and set it randomly.
# FIXME: why do we need the loop if we know the two values above?
for (my $pi = 1 ; $pi <= $global_settings_ref->{'design'}->{'CFGS_PER_MSG'} ; $pi++) { for (my $pi = 1 ; $pi <= $global_settings_ref->{'design'}->{'CFGS_PER_MSG'} ; $pi++) {
for (my $fi = 0 ; $fi < $global_settings_ref->{'design'}->{'FIU_NUM'} ; $fi++) { for (my $fi = 0 ; $fi < $global_settings_ref->{'design'}->{'FIU_NUM'} ; $fi++) {
if ($fpi == $pi && $ffi == $fi) { if ($fpi == $pi && $ffi == $fi) {
......
package FIJI::Tests::SystemVerilog; package FIJI::Tests::SystemVerilog;
use Data::Dumper;
use FIJI qw(:all); use FIJI qw(:all);
use POSIX (); use POSIX ();
......
package FIJI::Tests::VHDL; package FIJI::Tests::VHDL;
#use Data::Dumper;
use FIJI qw(:all); use FIJI qw(:all);
use POSIX (ceil); use POSIX (ceil);
......
package FIJI::Utils; package FIJI::Utils;
use strict;
use warnings;
use Log::Log4perl qw(get_logger); use Log::Log4perl qw(get_logger);
use Log::Log4perl::Level; use Log::Log4perl::Level;
use Cwd 'realpath'; use Cwd 'realpath';
......
...@@ -27,7 +27,6 @@ package FIJI::VHDL; ...@@ -27,7 +27,6 @@ package FIJI::VHDL;
use strict; use strict;
use warnings; use warnings;
use Data::Dumper;
use Log::Log4perl qw(get_logger); use Log::Log4perl qw(get_logger);
use POSIX qw(ceil); use POSIX qw(ceil);
use FIJI::Settings; use FIJI::Settings;
......
...@@ -40,8 +40,6 @@ use Tk::FIJIUtils; ...@@ -40,8 +40,6 @@ use Tk::FIJIUtils;
use Tk::FIJIModalDialog; use Tk::FIJIModalDialog;
use base qw(Tk::Frame); use base qw(Tk::Frame);
use Data::Dumper;
Construct Tk::Widget 'FIJINetSelection'; Construct Tk::Widget 'FIJINetSelection';
sub ClassInit { sub ClassInit {
......
...@@ -26,7 +26,6 @@ use Log::Log4perl qw(get_logger); ...@@ -26,7 +26,6 @@ use Log::Log4perl qw(get_logger);
use Scalar::Util 'blessed'; use Scalar::Util 'blessed';
use Tk; use Tk;
use Tk::Balloon; use Tk::Balloon;
use Data::Dumper;
use Tie::Watch; use Tie::Watch;
use Tk::widgets qw(Canvas); use Tk::widgets qw(Canvas);
......
...@@ -53,8 +53,6 @@ use base qw(Tk::Frame); ...@@ -53,8 +53,6 @@ use base qw(Tk::Frame);
use FIJI qw(:all); use FIJI qw(:all);
use FIJI::Netlist; use FIJI::Netlist;
use Data::Dumper;
Construct Tk::Widget 'FIJISettingsViewer'; Construct Tk::Widget 'FIJISettingsViewer';
......
...@@ -33,7 +33,6 @@ use base qw(Tk::Frame); ...@@ -33,7 +33,6 @@ use base qw(Tk::Frame);
use FIJI qw(:all); use FIJI qw(:all);
use FIJI::Tests; use FIJI::Tests;
use Data::Dumper;
Construct Tk::Widget 'FIJITestFrame'; Construct Tk::Widget 'FIJITestFrame';
......
...@@ -48,7 +48,6 @@ use Tk::FIJIModalDialog; ...@@ -48,7 +48,6 @@ use Tk::FIJIModalDialog;
use Tk::FIJIUtils; use Tk::FIJIUtils;
use base qw(Tk::Frame); use base qw(Tk::Frame);
use Data::Dumper;
# Test::Deep::NoTest exports Test::Deep which exports # Test::Deep::NoTest exports Test::Deep which exports
# an undocumented blessed() which clashes with Scalar::Util's blessed(). # an undocumented blessed() which clashes with Scalar::Util's blessed().
...@@ -551,7 +550,7 @@ sub _populate_widget { ...@@ -551,7 +550,7 @@ sub _populate_widget {
$self->repeat(100, [\&_update_logging_box, $self]); $self->repeat(100, [\&_update_logging_box, $self]);
# also log to the log_queue # also log to the log_queue
append_logger($self->{'log_queue'},$self->{'loglevel'}); append_logger($self->{'log_queue'}, $self->{'loglevel'});
$logger->info("Live capturing of log output has started"); $logger->info("Live capturing of log output has started");
#--- #---
...@@ -1245,8 +1244,8 @@ sub _check_change { ...@@ -1245,8 +1244,8 @@ sub _check_change {
sub append_logger { sub append_logger {
my $logger = get_logger(""); my $logger = get_logger("");
my ($queue, $log4plevel) = @_; my ($queue, $log4p_level) = @_;
my $threshold = $Log::Log4perl::Level::L4P_TO_LD{Log::Log4perl::Level::to_level($log4plevel)}; my $threshold = $Log::Log4perl::Level::L4P_TO_LD{Log::Log4perl::Level::to_level($log4p_level)};
my $custom_appender = Log::Log4perl::Appender->new( my $custom_appender = Log::Log4perl::Appender->new(
"Log::Dispatch::QueueAppender", "Log::Dispatch::QueueAppender",
...@@ -1269,7 +1268,7 @@ sub append_logger { ...@@ -1269,7 +1268,7 @@ sub append_logger {
} }
my $layout = Log::Log4perl::Layout::PatternLayout->new($layout_pattern_short); my $layout = Log::Log4perl::Layout::PatternLayout->new($layout_pattern_short);
$custom_appender->layout($layout); $custom_appender->layout($layout);
$custom_appender->threshold($log4plevel); $custom_appender->threshold($log4p_level);
$logger->add_appender($custom_appender); $logger->add_appender($custom_appender);
} }
......
...@@ -222,7 +222,6 @@ sub _getstate_all_widgets_rec { ...@@ -222,7 +222,6 @@ sub _getstate_all_widgets_rec {
if (grep { '-state' eq $_->[0] } $widget->configure()) { if (grep { '-state' eq $_->[0] } $widget->configure()) {
my $old_state = $widget->cget('-state'); my $old_state = $widget->cget('-state');
$logger->trace("State of $widget is $old_state");
$state_ref->{$widget} = $old_state; $state_ref->{$widget} = $old_state;
} elsif ($widget->isa("Tk::NoteBook")) { } elsif ($widget->isa("Tk::NoteBook")) {
# NoteBook is special (of course there is no generic solution in Perl Tk)... # NoteBook is special (of course there is no generic solution in Perl Tk)...
...@@ -278,7 +277,7 @@ sub reenable_all_widgets { ...@@ -278,7 +277,7 @@ sub reenable_all_widgets {
if (grep { '-state' eq $_->[0] } $widget->configure()) { if (grep { '-state' eq $_->[0] } $widget->configure()) {
my $prev_state = $prev_state_ref->{$widget}; my $prev_state = $prev_state_ref->{$widget};
if (!defined($prev_state)) { if (!defined($prev_state)) {
$logger->trace("Could not find previous state of $widget!"); $logger->debug("Could not find previous state of $widget!");
} else { } else {
$widget->configure('-state', $prev_state); $widget->configure('-state', $prev_state);
} }
......
...@@ -30,7 +30,6 @@ use Log::Log4perl qw(get_logger); ...@@ -30,7 +30,6 @@ use Log::Log4perl qw(get_logger);
use FIJI::Downloader; use FIJI::Downloader;
use FIJI::Utils; use FIJI::Utils;
use File::Basename; use File::Basename;
use Data::Dumper;
use Getopt::Long qw(:config no_ignore_case); use Getopt::Long qw(:config no_ignore_case);
use POSIX qw(strftime); use POSIX qw(strftime);
...@@ -103,9 +102,6 @@ USAGE ...@@ -103,9 +102,6 @@ USAGE
sub main { sub main {
my $logger = get_logger(""); my $logger = get_logger("");
my ($cfg,$prob,$dur) = @_; my ($cfg,$prob,$dur) = @_;
my $name = $0;
$name =~ s/\.p[lm]//;
my $rv;
if (defined $cfg->{'help'}) { if (defined $cfg->{'help'}) {
return usage(); return usage();
...@@ -120,7 +116,7 @@ sub main { ...@@ -120,7 +116,7 @@ sub main {
return usage(1); return usage(1);
} }
if($cfg->{'mode'} ne 'auto' && if ($cfg->{'mode'} ne 'auto' &&
$cfg->{'mode'} ne 'manual' && $cfg->{'mode'} ne 'manual' &&
$cfg->{'mode'} ne 'random') { $cfg->{'mode'} ne 'random') {
print "$0: Invalid mode \"" . $cfg->{'mode'} . "\"\n\n"; print "$0: Invalid mode \"" . $cfg->{'mode'} . "\"\n\n";
...@@ -197,7 +193,7 @@ GetOptions( ...@@ -197,7 +193,7 @@ GetOptions(
"d|prob-dly=f" => \($prob->{'PROB_DELAY'}), "d|prob-dly=f" => \($prob->{'PROB_DELAY'}),
"f|prob-seu=f" => \($prob->{'PROB_SEU'}), "f|prob-seu=f" => \($prob->{'PROB_SEU'}),
"o|prob-so=f" => \($prob->{'PROB_STUCK_OPEN'}), "o|prob-so=f" => \($prob->{'PROB_STUCK_OPEN'}),
"v|verbose+" => \($cfg->{'verbose'}), "v|verbose+" => \($cfg->{'verbose'}),
"h|help" => \($cfg->{'help'}), "h|help" => \($cfg->{'help'}),
) )
or exit(usage(1)); or exit(usage(1));
......
...@@ -38,7 +38,6 @@ use FIJI qw(UART TESTCONSTMAP); ...@@ -38,7 +38,6 @@ use FIJI qw(UART TESTCONSTMAP);
use threads; use threads;
use threads::shared; use threads::shared;
use Thread::Queue; use Thread::Queue;
use Data::Dumper;
use Socket; use Socket;
use IO::Handle; use IO::Handle;
use Getopt::Long; use Getopt::Long;
...@@ -134,7 +133,7 @@ sub download_worker { ...@@ -134,7 +133,7 @@ sub download_worker {
# the GUI does it after this thread is created and hence the # the GUI does it after this thread is created and hence the
# logger object of this thread does not get updated. # logger object of this thread does not get updated.
# Perl threads don't share variables... # Perl threads don't share variables...
Tk::FIJITestsViewer::append_logger($log_queue,$loglevel); Tk::FIJITestsViewer::append_logger($log_queue, $loglevel);
# forever, get new workload # forever, get new workload
while (defined(my $item = $queue_to_worker->dequeue())) { while (defined(my $item = $queue_to_worker->dequeue())) {
......
...@@ -46,7 +46,6 @@ use FIJI::Utils; ...@@ -46,7 +46,6 @@ use FIJI::Utils;
use File::Spec; use File::Spec;
use File::Path qw(make_path); use File::Path qw(make_path);
use Data::Dumper;
use Getopt::Long; use Getopt::Long;
use constant NETLIST_SUFFIX => { use constant NETLIST_SUFFIX => {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment