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

FIJI Settings Viewer saves relative paths

parent e7c32869
......@@ -106,9 +106,9 @@ BEGIN {
},
OUTPUT_DIR => {
description => "Output directory",
help => "Output directory for FIJI Instrument",
help => "Output directory for FIJI Instrument (relative to location of FIJI settings file)",
ini_name => "OUTPUT_DIR",
default => getcwd(),
default => ".",
type => 'dir',
group => 'general_control',
phases_opt => [qw(setup)],
......@@ -116,7 +116,7 @@ BEGIN {
},
INSTRUMENTATION_LOG => {
description => "Instrumentation log file",
help => "Log file for FIJI Instrumentation tool",
help => "Log file for FIJI Instrumentation tool (relative to location of FIJI settings file)",
ini_name => "INSTRUMENTATION_LOG",
default => "fiji_instrument.log",
type => 'file',
......
......@@ -36,6 +36,7 @@ use Config::Simple;
use Data::Dumper;
use POSIX qw(ceil);
use List::Util qw(max);
use File::Spec;
use FIJI qw(:all);
......@@ -81,10 +82,12 @@ sub new ($;$$) {
if (!ref($fiji_settings_ref)) {
return $fiji_settings_ref; # actually an error message
}
$fiji_settings_ref->{'filename'} = $fiji_ini_file;
} else {
$fiji_settings_ref->{'design'} = {};
_set_defaults(DESIGNMAP, $fiji_settings_ref->{'design'}, $phase);
$fiji_settings_ref->{'fius'} = [];
$fiji_settings_ref->{'filename'} = File::Spec->curdir();
}
@base_resources = _est_resources(DESIGNMAP->{'FREQUENCY'}->{'default'}, DESIGNMAP->{'BAUDRATE'}->{'default'}, DESIGNMAP->{'TIMER_WIDTH'}->{'default'}, DESIGNMAP->{'RESET_DUT_IN_DURATION'}->{'default'}, DESIGNMAP->{'LFSR_WIDTH'}->{'default'}, 0, "logarithmic");
......@@ -156,8 +159,11 @@ sub save ($) {
next;
}
}
} elsif ($key eq "filename") {
next;
}
my $err = "Unknown element found in FIJI Settings: \"$val\"";
my $err = "Unknown element found in FIJI Settings: key: \"$key\" val: \"$val\"";
$logger->error($err);
return $err;
}
......@@ -184,6 +190,7 @@ sub save ($) {
$logger->error($err);
return $err;
}
$self->{'filename'} = $fiji_ini_file;
return undef;
}
......
......@@ -32,9 +32,8 @@ use Log::Log4perl qw(get_logger);
use Scalar::Util 'blessed';
use Tk;
use Tk::widgets qw(LabFrame Balloon Label Entry Pane Button Dialog DialogBox Checkbutton CompleteEntry NoteBook StatusBar FIJISettingsCanvas);
use Tk::DynaMouseWheelBind;
use File::Spec qw (file_name_is_absolute abs2rel splitpath catpath);
use base qw(Tk::Frame);
use FIJI qw(:all);
......@@ -571,7 +570,10 @@ sub _populate_widget {
-title => "Select " . lc(DESIGNMAP->{$k}->{'description'}),
)->Show;
if (defined $val) {
$self->{'settings'}->{'design'}->{$k} = $val;
my ($basevolume, $basedirs, $file) = File::Spec->splitpath($self->{'settings'}->{'filename'});
my $nv = File::Spec->abs2rel($val,File::Spec->catpath($basevolume,$basedirs));
$logger->info("Setting $k to relative path $nv") if (File::Spec->file_name_is_absolute($val));
$self->{'settings'}->{'design'}->{$k} = $nv;
$self->update;
}
}
......
; Config::Simple 4.58
; Tue Sep 22 09:03:07 2015
[FIU0]
LFSR_MASK=0x0
DRIVER_PATH=i2c_master_bit_ctrl|al_RNIHURE|combout
FAULT_MODEL=RUNTIME
DRIVER_TYPE=PIN
NET_NAME=i2c_master_top|i2c_master_byte_ctrl|i2c_master_bit_ctrl|N_152_tz
; Wed Sep 23 10:33:03 2015
[CONSTS]
TRIGGER_EXT_ACTIVE=1
LFSR_WIDTH=32
FAULT_DETECT_2_NAME=i2c_master_top|i2c_master_byte_ctrl|N_70
FAULT_DETECT_1_INVERT=0
CFGS_PER_MSG=2
CLOCK_NET=i2c_master_top|wb_clk_i_c
INSTRUMENTATION_LOG=fiji_instrument.log
RESET_DUT_OUT_EN=1
TRIGGER_EXT_EN=0
TRIGGER_DUT_NAME=i2c_master_top|cnt_RNIOCS1_combout
LFSR_WIDTH=32
TX_OUT_NAME=s_fiji_tx_o
LFSR_SEED=0xcafe
RX_IN_NAME=s_fiji_rx_i
BAUDRATE=115200
TRIGGER_EXT_EN=0
RESET_DUT_IN_ACTIVE=1
RESET_DUT_IN_EN=0
CFGS_PER_MSG=2
FAULT_DETECT_1_INVERT=0
RESET_DUT_OUT_NAME=i2c_master_top|i2c_master_byte_ctrl|c_state_ns_0_0_0_5__g1
RESET_DUT_OUT_EN=1
FAULT_DETECT_2_EN=1
FAULT_DETECT_2_INVERT=1
LFSR_POLY=0x2d
TRIGGER_DUT_EN=0
OUTPUT_DIR=.
TRIGGER_EXT_IN_NAME=s_fiji_trigger_ext
CLOCK_NET=i2c_master_top|wb_clk_i_c
RESET_EXT_ACTIVE=0
FAULT_DETECT_1_EN=1
FAULT_DETECT_2_EN=1
TRIGGER_DUT_NAME=i2c_master_top|cnt_RNIOCS1_combout
FIU_CFG_BITS=3
RESET_DUT_IN_EN=0
RESET_DUT_OUT_ACTIVE=0
TIMER_WIDTH=4
ID=0xaa4
RESET_EXT_EN=1
TX_OUT_NAME=s_fiji_tx_o
OUTPUT_DIR=.
TRIGGER_DUT_ACTIVE=1
FREQUENCY=50000000
RESET_EXT_ACTIVE=0
FIU_CFG_BITS=3
LFSR_POLY=0x2d
TRIGGER_EXT_ACTIVE=1
FAULT_DETECT_1_NAME=i2c_master_top|i2c_master_byte_ctrl|N_11_i
TRIGGER_DUT_EN=0
RESET_DUT_IN_DURATION=4
RESET_EXT_IN_NAME=s_fiji_reset
FIU_NUM=3
BAUDRATE=115200
ID=0xaa4
TRIGGER_DUT_ACTIVE=1
RESET_DUT_IN_NAME=wb_rst_i
RESET_DUT_IN_DURATION=4
RX_IN_NAME=s_fiji_rx_i
TIMER_WIDTH=4
FAULT_DETECT_1_EN=1
FREQUENCY=50000000
FIU_NUM=3
[FIU1]
LFSR_MASK=0x0
NET_NAME=i2c_master_top|i2c_master_byte_ctrl|i2c_master_bit_ctrl|c_state_ns_0_0__g0_0_0
FAULT_MODEL=RUNTIME
DRIVER_TYPE=PIN
NET_NAME=i2c_master_top|i2c_master_byte_ctrl|i2c_master_bit_ctrl|c_state_ns_0_0__g0_0_0
LFSR_MASK=0x0
DRIVER_PATH=i2c_master_bit_ctrl|c_state_RNO_0_|combout
[FIU2]
DRIVER_TYPE=PIN
FAULT_MODEL=RUNTIME
NET_NAME=i2c_master_top|cnt_RNIOCS1_combout
LFSR_MASK=0x0
DRIVER_PATH=i2c_master_top|byte_controller|cnt_RNIOCS1_combout_0
[FIU0]
LFSR_MASK=0x0
DRIVER_PATH=i2c_master_bit_ctrl|al_RNIHURE|combout
FAULT_MODEL=RUNTIME
NET_NAME=i2c_master_top|i2c_master_byte_ctrl|i2c_master_bit_ctrl|N_152_tz
DRIVER_TYPE=PIN
NET_NAME=i2c_master_top|cnt_RNIOCS1_combout
......@@ -38,7 +38,7 @@ use FIJI::VHDL;
use FIJI::Constraints;
use File::Spec;
use File::Path qw(make_path);
use File::Path;
use Data::Dumper;
use Getopt::Long;
......@@ -67,13 +67,14 @@ sub main {
# Set/Create output directory
# Default is to use FIJI::Settings value,
$output_dir = $self->{'settings'}->{'design'}->{'OUTPUT_DIR'};
my ($basevolume, $basedirs, $file) = File::Spec->splitpath($self->{'settings'}->{'filename'});
$output_dir = File::Spec->rel2abs($self->{'settings'}->{'design'}->{'OUTPUT_DIR'},File::Spec->catpath($basevolume,$basedirs));
# However, parameter has higher precedence
$output_dir = $options->{'output_dir'} if (defined $options->{'output_dir'});
if (!(-d $output_dir)) {
make_path($output_dir, {error => \my $err});
File::Path->make_path($output_dir, {error => \my $err});
if (@$err) {
my $msg = "Could not create output directory: $!";
......@@ -87,7 +88,7 @@ sub main {
"Log::Log4perl::Appender::File",
name => "custom_file_log",
Threshold => "TRACE",
filename => File::Spec->canonpath($self->{'settings'}->{'design'}->{'INSTRUMENTATION_LOG'})
filename => File::Spec->rel2abs($self->{'settings'}->{'design'}->{'INSTRUMENTATION_LOG'},File::Spec->catpath($basevolume,$basedirs)),
);
my $layout = $file_appender->{'layout'};
$custom_file_appender->layout(clone($layout));
......
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