Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
vecs
FIJI Public
Commits
b8b3aca3
Commit
b8b3aca3
authored
Aug 04, 2015
by
Christian Fibich
Committed by
Stefan Tauner
Aug 29, 2016
Browse files
integrated ecc test into demo as test_2
parent
a1e1cc07
Changes
2
Hide whitespace changes
Inline
Side-by-side
FIJI/Downloader.pm
View file @
b8b3aca3
...
...
@@ -47,6 +47,7 @@ sub new($) {
# Generates a configuration hash from discrete parameters
#
sub
_test_fi_uart
{
my
$logger
=
get_logger
();
my
(
$port
,
$payload_ref
,
$t1_duration
,
$t2_duration
,
$trigger_en
,
$trigger_ext
,
$reset
,
$fiji_consts
...
...
@@ -62,9 +63,17 @@ sub _test_fi_uart {
reset
=>
$reset
,
consts
=>
$fiji_consts
,
);
# FIXME timeout must correspond to t1_duration*fclk and t2_duration*fclk and
# trigger settings
return
$port
->
send_config
(
\
%config
,
1000
,
0
,
1
);
# FIXME not sure if this is correct:
# total timeout = 1sec + sum of durations in sec
my
$timeout
=
(((
$t1_duration
+
$t2_duration
)
/
$fiji_consts
->
{'
FREQUENCY
'})
*
1000
)
+
1000
;
if
(
$trigger_en
==
1
)
{
$logger
->
debug
("
Trigger specified, no timeout set.
");
}
return
$port
->
send_config
(
\
%config
,
$timeout
,
0
,
1
);
}
...
...
FIJI/Tests.pm
View file @
b8b3aca3
...
...
@@ -37,6 +37,7 @@ use Clone qw(clone);
use
FIJI::
Settings
;
use
FIJI
qw(:all)
;
use
File::
Spec
;
use
Excel::Writer::
XLSX
;
# FIXME rather similar to Settings.pm
# Can we generalize this?
...
...
@@ -116,6 +117,7 @@ sub new ($;$$) {
}
sub
_export_value
{
my
$logger
=
get_logger
();
my
(
$map_ref
,
$k
,
$v_ref
)
=
@_
;
...
...
@@ -219,6 +221,136 @@ sub save ($) {
return
undef
;
}
sub
new_from_xlsx
{
}
# Exports the content of a FIJI::Test Object to an XLSX file.
# For each test, a new sheet is created. This function also adds validation
# parameters where applicable
# params:
# xlsxname the name of the XLSX file
sub
mkxlsx
($)
{
my
$logger
=
get_logger
();
my
(
$self
,
$xlsxname
)
=
@_
;
my
$xlsx
=
Excel::Writer::
XLSX
->
new
(
$xlsxname
);
if
(
!
defined
$xlsx
)
{
print
"
Could not create workbook with name
$xlsxname
";
return
1
;
}
my
$gensheet
=
$xlsx
->
add_worksheet
("
General Settings
");
my
$test_cnt
=
0
;
my
$rowidx
;
my
$design_ref
;
foreach
my
$key
(
keys
%
{
$self
})
{
my
$val
=
$self
->
{
$key
};
if
(
ref
(
\
$val
)
eq
"
REF
")
{
if
(
ref
(
$val
)
eq
"
HASH
")
{
if
(
$key
eq
"
design
")
{
$design_ref
=
$val
;
next
;
}
elsif
(
$key
eq
"
ext
")
{
next
;
}
}
elsif
(
ref
(
$val
)
eq
"
ARRAY
")
{
if
(
$key
eq
"
tests
")
{
foreach
my
$test
(
@
{
$val
})
{
my
$testsheet
=
$xlsx
->
add_worksheet
("
Test
$test_cnt
");
$rowidx
=
0
;
foreach
my
$k
(
keys
(
%
{
$test
}))
{
my
$ini_name
=
$self
->
{'
ext
'}
->
{'
TESTPATMAP
'}
->
{
$k
}
->
{'
ini_name
'};
if
(
!
defined
(
$test
->
{
$k
}))
{
$logger
->
debug
("
Skip saving undefined value of TEST constant with key
$ini_name
.
");
next
;
}
# Copy value to new hash with external naming.
$testsheet
->
set_column
(
0
,
0
,
25
);
$testsheet
->
set_column
(
1
,
1
,
25
);
$testsheet
->
write
(
$rowidx
,
0
,
$ini_name
);
$testsheet
->
write
(
$rowidx
,
1
,
$test
->
{
$k
});
_xlsxvalidate
(
$testsheet
,[
$rowidx
,
1
],
$self
->
{'
ext
'}
->
{'
TESTPATMAP
'}
->
{
$k
});
$rowidx
++
;
# Convert value to external representation
# _export_value($self->{'ext'}->{'TESTPATMAP'}, $k, \$ini_test->{$ini_name});
$logger
->
trace
(
sprintf
("
Exporting TEST%d setting %s -> %s.
",
$test_cnt
,
$k
,
$ini_name
),
);
}
$test_cnt
++
;
}
next
;
}
}
}
my
$err
=
"
Unknown element found in FIJI Settings:
\"
$val
\"
";
$logger
->
error
(
$err
);
#return $err;
}
$design_ref
->
{'
NUM_TESTS
'}
=
$test_cnt
;
my
$ini_design
;
$rowidx
=
0
;
foreach
my
$k
(
keys
(
%
{
$design_ref
}))
{
my
$ini_name
=
TESTCONSTMAP
->
{
$k
}
->
{'
ini_name
'};
if
(
!
defined
(
$design_ref
->
{
$k
}))
{
$logger
->
debug
("
Skip saving undefined value of design constant with key
$ini_name
.
");
next
;
}
# Copy value to new hash with external naming.
$gensheet
->
set_column
(
0
,
0
,
25
,
undef
);
$gensheet
->
set_column
(
1
,
1
,
25
,
undef
);
$gensheet
->
write
(
$rowidx
,
0
,
$ini_name
);
$gensheet
->
write
(
$rowidx
,
1
,
$design_ref
->
{
$k
});
_xlsxvalidate
(
$gensheet
,[
$rowidx
,
1
],
TESTCONSTMAP
->
{
$k
});
$rowidx
++
;
# Convert value to external representation
$logger
->
trace
(
sprintf
("
Exporting Design setting %s -> %s
",
$k
,
$ini_name
),
);
}
$xlsx
->
close
();
}
sub
_xlsxvalidate
($$$)
{
my
$logger
=
get_logger
();
my
(
$sheet
,
$cell
,
$patmapentry
)
=
@_
;
my
$val
=
0
;
if
(
defined
$patmapentry
->
{'
values
'})
{
$val
=
$sheet
->
data_validation
(
$$cell
[
0
],
$$cell
[
1
],
{
validate
=>
'
list
',
value
=>
$patmapentry
->
{'
values
'}});
}
elsif
(
defined
$patmapentry
->
{'
type
'}
&&
$patmapentry
->
{'
type
'}
eq
"
boolean
")
{
$val
=
$sheet
->
data_validation
(
$$cell
[
0
],
$$cell
[
1
],
{
validate
=>
'
list
',
value
=>
[
qw(0 1)
]});
}
elsif
(
defined
$patmapentry
->
{'
type
'}
&&
$patmapentry
->
{'
type
'}
eq
"
bit
")
{
$val
=
$sheet
->
data_validation
(
$$cell
[
0
],
$$cell
[
1
],
{
validate
=>
'
list
',
value
=>
[
qw(0 1)
]});
}
elsif
(
defined
$patmapentry
->
{'
type
'}
&&
$patmapentry
->
{'
type
'}
eq
"
natural
")
{
$val
=
$sheet
->
data_validation
(
$$cell
[
0
],
$$cell
[
1
],
{
validate
=>
'
integer
',
criteria
=>
'
>=
',
value
=>
0
});
}
$logger
->
error
("
Error while setting validation for $
$cell
[0],$
$cell
[1]:
$val
")
if
(
$val
<
0
);
}
## @function read_settingsfile ($phase, $fiji_ini_file)
# @brief Load the FIJI Settings file containing design and TEST constants.
...
...
@@ -853,6 +985,8 @@ sub make_random_test {
return
$test
;
}
# Randomly choose a fault model represented as string
# depending on probability constraints
# cfg[FIJI::FIUENUM->{'NONE'}] Probability of fault-free case
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment