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

Tooltip for resources statusbar. "< Constant" displayed if resources smaller than predefined

constant (RESOURCES_REGS_LOWER, RESOURCES_LUTS_LOWER). FIJI::Settings can
now report to caller if variables for resource calculation were out of verified range.
Adresses issue #23, issue #34, issue #38
parent 66d43fef
......@@ -684,13 +684,32 @@ sub _est_resources {
my $registers;
my $lut6;
my $out_of_range = [];
$logger->debug("FREQUENCY $FREQUENCY out of range for correct resource estimation (1000000 - 500000000)") if ($FREQUENCY < 1000000 || $FREQUENCY > 500000000);
$logger->debug("BAUD $BAUD out of range for correct resource estimation (9600 - 3000000)") if ($BAUD < 9600 || $BAUD > 3000000);
$logger->debug("TIMER_WIDTH $TIMER_WIDTH out of range for correct resource estimation (1 - 8)") if ($TIMER_WIDTH < 1 || $TIMER_WIDTH > 8);
$logger->debug("RESET_CYCLES $RESET_CYCLES out of range for correct resource estimation (1 - 16)") if ($RESET_CYCLES < 1 || $RESET_CYCLES > 16);
$logger->debug("LFSR_WIDTH $LFSR_WIDTH out of range for correct resource estimation (16 - 64)") if ($LFSR_WIDTH < 16 || $LFSR_WIDTH > 64);
$logger->debug("FIU_NUM $FIU_NUM out of range for correct resource estimation (1 - 64)") if ($FIU_NUM < 1 || $FIU_NUM > 64);
if ($FREQUENCY < 1000000 || $FREQUENCY > 500000000) {
$logger->debug("FREQUENCY $FREQUENCY out of range for correct resource estimation (1000000 - 500000000)");
push @{$out_of_range}, "FREQUENCY";
}
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) {
$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) {
$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) {
$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) {
$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));
......@@ -708,7 +727,7 @@ sub _est_resources {
$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);
return ($registers, $lut6, $out_of_range);
}
## @function public estimate_resources ($settings_ref)
......@@ -728,6 +747,7 @@ sub estimate_resources {
my $rv = {
regs => sprintf("%.2f", $calcrv[0] / $base_resources[0]),
lut_calc => sprintf("%.2f", $calcrv[1] / $base_resources[1]),
out_of_range => $calcrv[2],
};
$logger->debug("ESTIMATE: current config will need Base*$rv->{'regs'} registers and Base*$rv->{'lut_calc'} combinational resources");
......
......@@ -35,6 +35,11 @@ use Tk;
use Tk::widgets qw(LabFrame Balloon Label Entry Pane Button Dialog DialogBox Checkbutton CompleteEntry NoteBook StatusBar FIJISettingsCanvas);
use Tk::DynaMouseWheelBind;
use constant RESOURCES_REGS_LOWER => 0.1;
use constant RESOURCES_LUTS_LOWER => 0.1;
use constant RESOURCES_TEXT => "Resource factors are relative to the FIJI default configuration.\n".
"The default configuration can be obtained by starting FIJI Setup is without a .cfg file";
# Test::Deep::NoTest exports Test::Deep which exports
# an undocumented blessed() which clashes with Scalar::Util's blessed().
# see http://stackoverflow.com/a/2837016
......@@ -366,6 +371,8 @@ sub update {
sub _update_resources {
my $self = shift;
my $rh = FIJI::Settings::estimate_resources($self->{'settings'});
$rh->{'regs'} = "< ".RESOURCES_REGS_LOWER if ($rh->{'regs'} < RESOURCES_REGS_LOWER);
$rh->{'lut_calc'} = "< ".RESOURCES_LUTS_LOWER if ($rh->{'lut_calc'} < RESOURCES_LUTS_LOWER);
$self->{'resources'} = "Virtual resource factors: " . $rh->{'regs'} . " Registers, " . $rh->{'lut_calc'} . " Combinational Resources";
}
......@@ -408,8 +415,12 @@ sub _populate_widget {
-command => [\&_switchtab, undef, $self->{'nb'}, -1],
);
# Add and resources field to bottom frame
# create Tk::Balloon instance for tooltips
my $balloon = $fr->Balloon();
# Add resources field to bottom frame
my $rl = $bf->Label(-textvariable => \$self->{'resources'});
$balloon->attach($rl, -balloonposition => 'mouse', -msg => RESOURCES_TEXT);
$bn->pack(-side => "right");
$bb->pack(-side => "right");
......@@ -444,9 +455,6 @@ sub _populate_widget {
$self->{'pages_design'} = [];
# create Tk::Balloon instance for tooltips
my $balloon = $fr->Balloon();
my $dm_ref = DESIGNMAP; # Work around Perl limitation: use constant <hash> and dereferencing does not play well together
my $dg_ref = DISPLAYGROUPS;
my $net_choices = defined($self->{'nets'}) ? $self->{'nets'} : [];
......
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