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

Sorted Config Files

parent 419508e3
package FIJI::ConfigSorted;
# Set version information
use vars qw($VERSION);
$VERSION = '0.1';
use base (Config::Simple);
# generates a writable string
sub as_string {
my $self = shift;
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' ) {
$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' ) {
$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 );
}
$STRING .= "\n";
}
}
$STRING .= "\n";
return $STRING;
}
1;
......@@ -32,12 +32,12 @@ use warnings;
use Scalar::Util 'blessed';
use Log::Log4perl qw(get_logger);
use Scalar::Util "looks_like_number";
use Config::Simple;
use Data::Dumper;
use POSIX qw(ceil);
use List::Util qw(max);
use File::Spec;
use FIJI::ConfigSorted;
use FIJI qw(:all);
## @var @base_resources stores the resource count for default config
......@@ -124,7 +124,7 @@ sub save ($) {
my ($self, $fiji_ini_file) = @_;
return "No file name given" if !defined($fiji_ini_file);
my $fiji_ini = new Config::Simple(syntax => 'ini');
my $fiji_ini = new FIJI::ConfigSorted(syntax => 'ini');
my $design_ref;
my $fiu_cnt = 0;
foreach my $key (keys %{$self}) {
......@@ -186,7 +186,7 @@ sub save ($) {
$fiji_ini->set_block("CONSTS", $ini_design);
if (!defined($fiji_ini->write($fiji_ini_file))) {
my $err = Config::Simple->error();
my $err = FIJI::ConfigSorted->error();
$logger->error($err);
return $err;
}
......@@ -211,9 +211,9 @@ sub read_settingsfile ($$$) {
my $logger = get_logger("");
my ($phase, $fiji_ini_file, $existing_settings) = @_;
my $fiji_ini;
eval { $fiji_ini = new Config::Simple($fiji_ini_file) }; # pesky library tries to die on syntax errors
eval { $fiji_ini = new FIJI::ConfigSorted($fiji_ini_file) }; # pesky library tries to die on syntax errors
if (!defined($fiji_ini)) {
my $submsg = defined($@) ? $@ : Config::Simple->error();
my $submsg = defined($@) ? $@ : FIJI::ConfigSorted->error();
if (length($submsg) == 0) {
$submsg = "Empty file?";
}
......
......@@ -32,12 +32,14 @@ use warnings;
use Scalar::Util 'blessed';
use Log::Log4perl qw(get_logger);
use Scalar::Util "looks_like_number";
use Config::Simple;
use Data::Dumper;
use Clone qw(clone);
use File::Spec;
use FIJI::ConfigSorted;
use FIJI::Settings;
use FIJI qw(:all);
use File::Spec;
# @FIXME rather similar to Settings.pm
# Can we generalize this?
......@@ -147,7 +149,7 @@ sub save {
my ($self, $fiji_ini_file) = @_;
return "No file name given" if !defined($fiji_ini_file);
my $fiji_ini = new Config::Simple(syntax => 'ini');
my $fiji_ini = new FIJI::ConfigSorted(syntax => 'ini');
my $design_ref;
my $test_cnt = 0;
......@@ -213,7 +215,7 @@ sub save {
$fiji_ini->set_block("CONSTS", $ini_design);
if (!defined($fiji_ini->write($fiji_ini_file))) {
my $err = Config::Simple->error();
my $err = FIJI::ConfigSorted->error();
$logger->error($err);
return $err;
}
......@@ -241,9 +243,9 @@ sub read_settingsfile {
my $fiji_ini;
my $global_settings_filename;
eval { $fiji_ini = new Config::Simple($fiji_ini_file) }; # pesky library tries to die on syntax errors
eval { $fiji_ini = new FIJI::ConfigSorted($fiji_ini_file) }; # pesky library tries to die on syntax errors
if (!defined($fiji_ini)) {
my $submsg = defined($@) ? $@ : Config::Simple->error();
my $submsg = defined($@) ? $@ : FIJI::ConfigSorted->error();
if (length($submsg) == 0) {
$submsg = "Empty file?";
}
......
; Config::Simple 4.58
; Mon Nov 2 10:20:31 2015
; FIJI::ConfigSorted 0.1
; Tue Dec 1 10:11:57 2015
[FIU1]
DRIVER_PATH=i2c_master_bit_ctrl|c_state_RNO_0_|combout
DRIVER_TYPE=PIN
LFSR_MASK=0x1231
NET_NAME=i2c_master_top|i2c_master_byte_ctrl|i2c_master_bit_ctrl|c_state_ns_0_0__g0_0_0
FAULT_MODEL=STUCK_OPEN
[CONSTS]
BAUDRATE=115200
CFGS_PER_MSG=2
CLOCK_NET=i2c_master_top|wb_clk_i_c
FAULT_DETECT_1_EN=1
FAULT_DETECT_1_INVERT=0
FAULT_DETECT_1_NAME=i2c_master_top|i2c_master_byte_ctrl|N_11_i
FAULT_DETECT_2_EN=1
FAULT_DETECT_2_INVERT=1
FAULT_DETECT_2_NAME=i2c_master_top|i2c_master_byte_ctrl|N_70
FIU_CFG_BITS=3
FIU_NUM=3
FREQUENCY=50000000
ID=0xaa4
IMPLEMENTATION_TOOL=ALTERA_QUARTUS
INSTRUMENTATION_LOG=fiji_instrument.log
LFSR_POLY=0x2d
LFSR_SEED=0xcafe
LFSR_WIDTH=32
OPTIMIZATIONS=OPTIMIZATION_OFF
OUTPUT_DIR=.
RESET_DUT_IN_ACTIVE=1
RESET_DUT_IN_DURATION=4
RESET_DUT_IN_EN=0
RESET_DUT_IN_NAME=wb_rst_i
RESET_DUT_OUT_ACTIVE=0
RESET_DUT_OUT_EN=1
RESET_DUT_OUT_NAME=i2c_master_top|i2c_master_byte_ctrl|c_state_ns_0_0_0_5__g1
RESET_EXT_ACTIVE=0
RESET_EXT_EN=1
RESET_EXT_IN_NAME=s_fiji_reset_n_i
RX_IN_NAME=s_fiji_rx_i
SYNTHESIS_TOOL=SYNPLIFY_PRO
TIMER_WIDTH=4
TRIGGER_DUT_ACTIVE=1
TRIGGER_DUT_EN=0
TRIGGER_DUT_NAME=i2c_master_top|cnt_RNIOCS1_combout
TRIGGER_EXT_ACTIVE=1
TRIGGER_EXT_EN=1
TRIGGER_EXT_IN_NAME=s_fiji_trigger_ext_i
TX_OUT_NAME=s_fiji_tx_o
[FIU0]
DRIVER_PATH=i2c_master_bit_ctrl|al_RNIHURE|combout
DRIVER_TYPE=PIN
FAULT_MODEL=STUCK_AT_1
LFSR_MASK=0x2a
NET_NAME=i2c_master_top|i2c_master_byte_ctrl|i2c_master_bit_ctrl|N_152_tz
[FIU1]
DRIVER_PATH=i2c_master_bit_ctrl|c_state_RNO_0_|combout
DRIVER_TYPE=PIN
LFSR_MASK=0x2a
DRIVER_PATH=i2c_master_bit_ctrl|al_RNIHURE|combout
FAULT_MODEL=STUCK_OPEN
LFSR_MASK=0x1231
NET_NAME=i2c_master_top|i2c_master_byte_ctrl|i2c_master_bit_ctrl|c_state_ns_0_0__g0_0_0
[FIU2]
NET_NAME=i2c_master_top|cnt_RNIOCS1_combout
DRIVER_PATH=i2c_master_top|byte_controller|cnt_RNIOCS1_combout_0
DRIVER_TYPE=PIN
LFSR_MASK=0x19
FAULT_MODEL=RUNTIME
[CONSTS]
RESET_DUT_OUT_NAME=i2c_master_top|i2c_master_byte_ctrl|c_state_ns_0_0_0_5__g1
TRIGGER_EXT_ACTIVE=1
LFSR_SEED=0xcafe
OUTPUT_DIR=.
RESET_DUT_IN_DURATION=4
RESET_EXT_ACTIVE=0
TIMER_WIDTH=4
RX_IN_NAME=s_fiji_rx_i
FAULT_DETECT_1_EN=1
INSTRUMENTATION_LOG=fiji_instrument.log
RESET_DUT_OUT_EN=1
IMPLEMENTATION_TOOL=ALTERA_QUARTUS
RESET_DUT_OUT_ACTIVE=0
RESET_EXT_IN_NAME=s_fiji_reset_n_i
FIU_NUM=3
BAUDRATE=115200
RESET_EXT_EN=1
OPTIMIZATIONS=OPTIMIZATION_OFF
RESET_DUT_IN_NAME=wb_rst_i
FAULT_DETECT_1_NAME=i2c_master_top|i2c_master_byte_ctrl|N_11_i
FREQUENCY=50000000
TRIGGER_EXT_IN_NAME=s_fiji_trigger_ext_i
FAULT_DETECT_2_EN=1
TRIGGER_DUT_ACTIVE=1
CFGS_PER_MSG=2
TRIGGER_EXT_EN=1
TRIGGER_DUT_NAME=i2c_master_top|cnt_RNIOCS1_combout
LFSR_POLY=0x2d
TX_OUT_NAME=s_fiji_tx_o
RESET_DUT_IN_EN=0
CLOCK_NET=i2c_master_top|wb_clk_i_c
LFSR_WIDTH=32
ID=0xaa4
FAULT_DETECT_2_NAME=i2c_master_top|i2c_master_byte_ctrl|N_70
SYNTHESIS_TOOL=SYNPLIFY_PRO
RESET_DUT_IN_ACTIVE=1
TRIGGER_DUT_EN=0
FAULT_DETECT_1_INVERT=0
FIU_CFG_BITS=3
FAULT_DETECT_2_INVERT=1
LFSR_MASK=0x19
NET_NAME=i2c_master_top|cnt_RNIOCS1_combout
; Config::Simple 4.58
; Wed Nov 4 15:45:52 2015
; FIJI::ConfigSorted 0.1
; Tue Dec 1 10:12:22 2015
[TEST1]
FIU_3_FAULT_1=NONE
FIU_0_FAULT_1=NONE
FIU_2_FAULT_2=DELAY
FIU_1_FAULT_1=NONE
FIU_2_FAULT_1=NONE
TIMER_VALUE_1=32
FIU_3_FAULT_2=NONE
FIU_0_FAULT_2=DELAY
FIU_1_FAULT_2=DELAY
TIMER_VALUE_2=1000000
RESET_DUT_AFTER_CONFIG=0
TRIGGER=NONE
[CONSTS]
COMPLETION_SCRIPT=
FIJI_CFG=fiji.cfg
HALT_ON_CRC_ERROR=1
HALT_ON_FAULT_DETECT=1
HALT_ON_ID_ERROR=1
HALT_ON_UART_ERROR=1
HALT_ON_UNDERRUN=0
INITIAL_RESET=0
INITIAL_TRIGGER=NONE
MAX_DURATION_T1=1000000
MAX_DURATION_T2=1000000
MIN_DURATION_T1=1000000
MIN_DURATION_T2=1000000
MULTIFAULT=1
NUM_TESTS=3
PROB_DELAY=0
PROB_SEU=0
PROB_STUCK_AT_0=0
PROB_STUCK_AT_1=0
PROB_STUCK_OPEN=0
REPEAT=0
REPEAT_OFFSET=0
UART=/dev/ttyUSB0
[TEST0]
TIMER_VALUE_1=1000000
FIU_3_FAULT_2=NONE
FIU_0_FAULT_1=NONE
FIU_0_FAULT_2=NONE
FIU_1_FAULT_1=NONE
FIU_1_FAULT_2=NONE
TRIGGER=NONE
FIU_2_FAULT_1=NONE
FIU_2_FAULT_2=STUCK_AT_1
RESET_DUT_AFTER_CONFIG=1
TIMER_VALUE_1=1000000
TIMER_VALUE_2=1000000
FIU_3_FAULT_1=NONE
TRIGGER=NONE
[TEST1]
FIU_0_FAULT_1=NONE
FIU_2_FAULT_2=STUCK_AT_1
FIU_0_FAULT_2=DELAY
FIU_1_FAULT_1=NONE
FIU_1_FAULT_2=DELAY
FIU_2_FAULT_1=NONE
[CONSTS]
MIN_DURATION_T2=1000000
MULTIFAULT=1
REPEAT_OFFSET=0
MIN_DURATION_T1=1000000
HALT_ON_UART_ERROR=1
PROB_STUCK_AT_0=0
NUM_TESTS=3
INITIAL_RESET=0
HALT_ON_ID_ERROR=1
HALT_ON_CRC_ERROR=1
PROB_SEU=0
MAX_DURATION_T1=1000000
MAX_DURATION_T2=1000000
REPEAT=0
HALT_ON_FAULT_DETECT=1
INITIAL_TRIGGER=NONE
UART=/dev/ttyUSB0
HALT_ON_UNDERRUN=0
PROB_STUCK_AT_1=0
FIJI_CFG=fiji.cfg
PROB_STUCK_OPEN=0
PROB_DELAY=0
FIU_2_FAULT_2=DELAY
RESET_DUT_AFTER_CONFIG=0
TIMER_VALUE_1=32
TIMER_VALUE_2=1000000
TRIGGER=NONE
[TEST2]
FIU_0_FAULT_1=SEU
FIU_0_FAULT_2=NONE
FIU_1_FAULT_1=SEU
FIU_1_FAULT_2=NONE
FIU_2_FAULT_1=SEU
FIU_2_FAULT_2=NONE
RESET_DUT_AFTER_CONFIG=0
TIMER_VALUE_1=1000000
TIMER_VALUE_2=1337
TRIGGER=NONE
FIU_1_FAULT_2=NONE
TIMER_VALUE_1=1000000
FIU_3_FAULT_2=NONE
FIU_2_FAULT_2=NONE
FIU_1_FAULT_1=SEU
FIU_2_FAULT_1=SEU
FIU_3_FAULT_1=NONE
FIU_0_FAULT_1=SEU
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