Skip to content
GitLab
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
854a3c39
Commit
854a3c39
authored
Jan 04, 2018
by
Stefan Tauner
Browse files
Validate that FIUs' LFSR masks only use bits within the LFSR's width
parent
832667ac
Changes
2
Hide whitespace changes
Inline
Side-by-side
bin/FIJI.pm
View file @
854a3c39
...
...
@@ -835,6 +835,17 @@ BEGIN {
my
$mask_width
=
defined
(
$design_ref
)
&&
defined
(
$design_ref
->
{'
LFSR_WIDTH
'})
?
$design_ref
->
{'
LFSR_WIDTH
'}
:
1
;
return
1
<<
(
$i
%
$mask_width
);
},
values
=>
sub
{
my
(
$val
,
$old
,
$map_ref
,
$consts_ref
,
$lfsr_width
)
=
@_
;
return
0
if
$val
<=
0
;
# If the width is bogus, we cannot do much but ignore them here
# FIXME: we should not ever get hex numbers in lfsr_width, however we do
# because they don't get stored as numbers in the settings
return
1
if
(
!
defined
(
$lfsr_width
)
||
$lfsr_width
!~
/^[1-9][0-9]*$/
);
my
$mask_width
=
log
(
$val
+
1
)
/
log
(
2
);
return
$lfsr_width
>=
$mask_width
;
},
depends_on
=>
'
LFSR_WIDTH
',
type
=>
'
hexadecimal
',
help
=>
"
Selects the bits of the LFSR that are ANDed together to determine the value of a floating net.
",
phases_opt
=>
[
qw(setup)
],
...
...
bin/Tk/FIJISettingsViewer.pm
View file @
854a3c39
...
...
@@ -186,6 +186,12 @@ sub update {
my
$self
=
shift
;
my
$logger
=
get_logger
("");
# Before anything else the list of widgets depending on LFSR_WIDTH needs to be cleaned up.
# All references to existing FIU widgets will become invalid because the widgets are replaced.
# Thus the code below filters them out by their key field and leaves only constants from DESIGNMAP (e.g., LFSR_POLY).
my
@all_but_lfsr_masks
=
grep
{
$_
->
{'
key
'}
!~
"
FIU([0-9]+)_LFSR_MASK
"
}
@
{
$self
->
{'
depends
'}
->
{'
LFSR_WIDTH
'}};
$self
->
{'
depends
'}
->
{'
LFSR_WIDTH
'}
=
\
@all_but_lfsr_masks
;
#################
# design panels #
#################
...
...
@@ -1088,6 +1094,11 @@ sub _add_fiu_widgets {
$mask_entry
->
{'
key
'}
=
"
FIU
${i}
_LFSR_MASK
";
Tk::FIJIUtils::
entry_rebind
(
$mask_entry
);
# Register dependency for LFSR_MASK(s) (of FIUMAP) on LFSR_WIDTH (of DESIGN_MAP)
if
(
defined
(
FIUMAP
->
{'
FIU_LFSR_MASK
'}
->
{'
depends_on
'}))
{
# Should be always true
push
(
@
{
$self
->
{'
depends
'}
->
{
FIUMAP
->
{'
FIU_LFSR_MASK
'}
->
{'
depends_on
'}}},
$mask_entry
);
}
$self
->
{'
balloon
'}
->
attach
(
$mask_entry
,
-
balloonposition
=>
'
mouse
',
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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