Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
Platform-independent core collection
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
18
Issues
18
List
Board
Labels
Milestones
Merge Requests
5
Merge Requests
5
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Platform-independent core collection
Commits
aae6f6df
Commit
aae6f6df
authored
Dec 08, 2021
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
radtol: improve secded_32b_pkg
parent
6df8f915
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
21 deletions
+17
-21
secded_32b_pkg.vhd
modules/radtol/secded_32b_pkg.vhd
+17
-21
No files found.
modules/radtol/secded_32b_pkg.vhd
View file @
aae6f6df
...
...
@@ -38,10 +38,12 @@ package secded_32b_pkg is
-- Return '1' if there is a difference (so if SYNDROME is not 0)
function
f_ecc_errors
(
syndrome
:
ecc_word_t
)
return
std_logic
;
-- Return '1' if
only one bit of SYNDROME is 1, ie if there is only one error
.
-- (
in that case it could be fixed).
-- Return '1' if
the number of SYNDOME bits set to 1 is odd
.
-- (
a one bit error results in 1 or 3 bits set in the syndrome)
function
f_ecc_one_error
(
syndrome
:
ecc_word_t
)
return
std_logic
;
-- Fix the error (if any).
-- Returns new ecc + new data.
function
f_fix_error
(
syndrome
:
ecc_word_t
;
ecc
:
ecc_word_t
;
data
:
data_word_t
)
return
std_logic_vector
;
...
...
@@ -57,15 +59,6 @@ package body secded_32b_pkg is
return
result
;
end
f_xor
;
function
f_or
(
x
:
std_logic_vector
)
return
std_logic
is
variable
result
:
std_logic
:
=
'0'
;
begin
for
i
in
x
'range
loop
result
:
=
result
or
x
(
i
);
end
loop
;
return
result
;
end
f_or
;
type
syndrome_mask_array
is
array
(
0
to
6
)
of
data_word_t
;
constant
syndrome_masks
:
syndrome_mask_array
:
=
(
0
=>
"11000001010010000100000011111111"
,
...
...
@@ -87,21 +80,24 @@ package body secded_32b_pkg is
return
result
;
end
f_calc_ecc
;
function
f_ecc_errors
(
syndrome
:
ecc_word_t
)
return
std_logic
is
function
f_ecc_errors
(
syndrome
:
ecc_word_t
)
return
std_logic
is
variable
result
:
std_logic
:
=
'0'
;
begin
if
Is_x
(
syndrome
(
0
))
then
-- report "memory wrong" severity error;
re
turn
'X'
;
end
if
;
return
f_or
(
syndrome
)
;
-- There is at least one error if the syndrome is not 0.
for
i
in
syndrome
'range
loop
re
sult
:
=
result
or
syndrome
(
i
)
;
end
loop
;
return
result
;
end
f_ecc_errors
;
function
f_ecc_one_error
(
syndrome
:
ecc_word_t
)
return
std_logic
is
begin
if
Is_x
(
syndrome
(
0
))
then
return
'0'
;
end
if
;
return
f_ecc_errors
(
syndrome
)
and
f_xor
(
syndrome
);
-- If there is no error, syndrome is 0 so it will return 0.
-- If there is one error, 1 or 3 bits are set in the syndrome, so returns 1.
-- If there are 2 errors, 2, 4 or 6 bits are set in the syncrome, so returns 0.
-- If there are more than 2 errors, all bets are off (it's a secded).
return
f_xor
(
syndrome
);
end
f_ecc_one_error
;
function
f_fix_error
(
syndrome
:
ecc_word_t
;
...
...
Write
Preview
Markdown
is supported
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