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;
# makes use of \ref fiuenum
#
# @param val the textual ID of the Fault
sub REVERSE_FIU_ENUM {
my ($val) = @_;
for my $k (keys(%fiuenum)) {
......
......@@ -32,7 +32,6 @@ use warnings;
use Log::Log4perl qw(get_logger);
use Digest::CRC "crc";
use Time::HiRes "usleep";
use Data::Dumper;
use FIJI::AnySerialPort;
## @method public init ($portname, $baudrate)
......@@ -438,7 +437,6 @@ sub sanitize_config {
$prev_t1 = $t1_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)};
}
} # "static" block
......
......@@ -25,7 +25,6 @@ use strict;
use warnings;
use Log::Log4perl qw(get_logger);
use Data::Dumper;
sub _quartus_partitions_logiclock {
my $logger = get_logger("");
......
......@@ -28,7 +28,6 @@ use FIJI::Tests;
use FIJI::Settings;
use FIJI::Connection;
use FIJI qw(:all);
use Data::Dumper;
use Clone 'clone';
use threads;
use threads::shared;
......@@ -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
#
# @param mode currently active FIJI settings
......@@ -219,6 +218,9 @@ sub download_auto ($) {
$$testref->{'design'}->{'NUM_TESTS'} = $ti;
$$testref->{'design'}->{'REPEAT'} = 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)) {
$$testref->{'tests'} = shared_clone(\@tests);
} else {
......
......@@ -33,7 +33,6 @@ use File::Basename qw(basename);
use Verilog::Netlist 99.415;
use Verilog::Language 99.415;
use Data::Dumper;
use FIJI::VHDL;
use FIJI qw(:fiji_logo);
......
......@@ -27,7 +27,6 @@ use warnings;
use Scalar::Util 'blessed';
use Log::Log4perl qw(get_logger);
use Scalar::Util "looks_like_number";
use Data::Dumper;
use POSIX qw(ceil);
use List::Util qw(max);
use File::Spec;
......@@ -748,7 +747,7 @@ sub _est_resources {
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
#
# @returns a hash with the members 'regs' and 'lut_calc'
......
......@@ -27,7 +27,6 @@ use warnings;
use Scalar::Util 'blessed';
use Log::Log4perl qw(get_logger);
use Scalar::Util "looks_like_number";
use Data::Dumper;
use Clone qw(clone);
use File::Spec;
......@@ -39,7 +38,7 @@ use FIJI qw(:all);
# @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.
#
# \param phase Tool flow phase the settings need to be compatible with.
......@@ -230,7 +229,7 @@ sub save {
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.
#
# \param phase Tool flow phase the settings stored in the given file
......@@ -398,7 +397,7 @@ sub set_test_defaults {
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.
sub _set_defaults {
my $logger = get_logger("");
......@@ -999,8 +998,12 @@ sub make_random_test {
}
}
} else {
# Select a single configuration within a message
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'}));
# 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 $fi = 0 ; $fi < $global_settings_ref->{'design'}->{'FIU_NUM'} ; $fi++) {
if ($fpi == $pi && $ffi == $fi) {
......
package FIJI::Tests::SystemVerilog;
use Data::Dumper;
use FIJI qw(:all);
use POSIX ();
......
package FIJI::Tests::VHDL;
#use Data::Dumper;
use FIJI qw(:all);
use POSIX (ceil);
......
package FIJI::Utils;
use strict;
use warnings;
use Log::Log4perl qw(get_logger);
use Log::Log4perl::Level;
use Cwd 'realpath';
......
......@@ -27,7 +27,6 @@ package FIJI::VHDL;
use strict;
use warnings;
use Data::Dumper;
use Log::Log4perl qw(get_logger);
use POSIX qw(ceil);
use FIJI::Settings;
......
......@@ -40,8 +40,6 @@ use Tk::FIJIUtils;
use Tk::FIJIModalDialog;
use base qw(Tk::Frame);
use Data::Dumper;
Construct Tk::Widget 'FIJINetSelection';
sub ClassInit {
......
......@@ -26,7 +26,6 @@ use Log::Log4perl qw(get_logger);
use Scalar::Util 'blessed';
use Tk;
use Tk::Balloon;
use Data::Dumper;
use Tie::Watch;
use Tk::widgets qw(Canvas);
......
......@@ -53,8 +53,6 @@ use base qw(Tk::Frame);
use FIJI qw(:all);
use FIJI::Netlist;
use Data::Dumper;
Construct Tk::Widget 'FIJISettingsViewer';
......
......@@ -33,7 +33,6 @@ use base qw(Tk::Frame);
use FIJI qw(:all);
use FIJI::Tests;
use Data::Dumper;
Construct Tk::Widget 'FIJITestFrame';
......
......@@ -48,7 +48,6 @@ use Tk::FIJIModalDialog;
use Tk::FIJIUtils;
use base qw(Tk::Frame);
use Data::Dumper;
# Test::Deep::NoTest exports Test::Deep which exports
# an undocumented blessed() which clashes with Scalar::Util's blessed().
......@@ -551,7 +550,7 @@ sub _populate_widget {
$self->repeat(100, [\&_update_logging_box, $self]);
# 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");
#---
......@@ -1245,8 +1244,8 @@ sub _check_change {
sub append_logger {
my $logger = get_logger("");
my ($queue, $log4plevel) = @_;
my $threshold = $Log::Log4perl::Level::L4P_TO_LD{Log::Log4perl::Level::to_level($log4plevel)};
my ($queue, $log4p_level) = @_;
my $threshold = $Log::Log4perl::Level::L4P_TO_LD{Log::Log4perl::Level::to_level($log4p_level)};
my $custom_appender = Log::Log4perl::Appender->new(
"Log::Dispatch::QueueAppender",
......@@ -1269,7 +1268,7 @@ sub append_logger {
}
my $layout = Log::Log4perl::Layout::PatternLayout->new($layout_pattern_short);
$custom_appender->layout($layout);
$custom_appender->threshold($log4plevel);
$custom_appender->threshold($log4p_level);
$logger->add_appender($custom_appender);
}
......
......@@ -222,7 +222,6 @@ sub _getstate_all_widgets_rec {
if (grep { '-state' eq $_->[0] } $widget->configure()) {
my $old_state = $widget->cget('-state');
$logger->trace("State of $widget is $old_state");
$state_ref->{$widget} = $old_state;
} elsif ($widget->isa("Tk::NoteBook")) {
# NoteBook is special (of course there is no generic solution in Perl Tk)...
......@@ -278,7 +277,7 @@ sub reenable_all_widgets {
if (grep { '-state' eq $_->[0] } $widget->configure()) {
my $prev_state = $prev_state_ref->{$widget};
if (!defined($prev_state)) {
$logger->trace("Could not find previous state of $widget!");
$logger->debug("Could not find previous state of $widget!");
} else {
$widget->configure('-state', $prev_state);
}
......
......@@ -30,7 +30,6 @@ use Log::Log4perl qw(get_logger);
use FIJI::Downloader;
use FIJI::Utils;
use File::Basename;
use Data::Dumper;
use Getopt::Long qw(:config no_ignore_case);
use POSIX qw(strftime);
......@@ -103,9 +102,6 @@ USAGE
sub main {
my $logger = get_logger("");
my ($cfg,$prob,$dur) = @_;
my $name = $0;
$name =~ s/\.p[lm]//;
my $rv;
if (defined $cfg->{'help'}) {
return usage();
......@@ -120,7 +116,7 @@ sub main {
return usage(1);
}
if($cfg->{'mode'} ne 'auto' &&
if ($cfg->{'mode'} ne 'auto' &&
$cfg->{'mode'} ne 'manual' &&
$cfg->{'mode'} ne 'random') {
print "$0: Invalid mode \"" . $cfg->{'mode'} . "\"\n\n";
......@@ -197,7 +193,7 @@ GetOptions(
"d|prob-dly=f" => \($prob->{'PROB_DELAY'}),
"f|prob-seu=f" => \($prob->{'PROB_SEU'}),
"o|prob-so=f" => \($prob->{'PROB_STUCK_OPEN'}),
"v|verbose+" => \($cfg->{'verbose'}),
"v|verbose+" => \($cfg->{'verbose'}),
"h|help" => \($cfg->{'help'}),
)
or exit(usage(1));
......
......@@ -38,7 +38,6 @@ use FIJI qw(UART TESTCONSTMAP);
use threads;
use threads::shared;
use Thread::Queue;
use Data::Dumper;
use Socket;
use IO::Handle;
use Getopt::Long;
......@@ -134,7 +133,7 @@ sub download_worker {
# the GUI does it after this thread is created and hence the
# logger object of this thread does not get updated.
# Perl threads don't share variables...
Tk::FIJITestsViewer::append_logger($log_queue,$loglevel);
Tk::FIJITestsViewer::append_logger($log_queue, $loglevel);
# forever, get new workload
while (defined(my $item = $queue_to_worker->dequeue())) {
......
......@@ -46,7 +46,6 @@ use FIJI::Utils;
use File::Spec;
use File::Path qw(make_path);
use Data::Dumper;
use Getopt::Long;
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