AMC13
Firmwares for the different applications of the AMC13 uTCA board made at Boston University
Main Page
Design Unit List
Files
File List
All
Classes
Variables
src
common
AMC_if
HammingDecode.vhd
1
library
IEEE
;
2
use
IEEE.STD_LOGIC_1164.
ALL
;
3
use
IEEE.STD_LOGIC_ARITH.
ALL
;
4
use
IEEE.STD_LOGIC_UNSIGNED.
ALL
;
5
use
IEEE.std_logic_misc.
all
;
6
entity
HammingDecode
is
7
Port
(
clk
:
in
std_logic
;
8
din_valid
:
in
std_logic
;
9
din
:
in
std_logic_vector
(
23
downto
0
)
;
10
dout_valid
:
out
std_logic
;
11
dout
:
out
std_logic_vector
(
17
downto
0
)
;
12
sgl_err
:
out
std_logic
;
13
dbl_err
:
out
std_logic
14
)
;
15
end
HammingDecode
;
16
17
architecture
my_arch
of
HammingDecode
is
18
signal
c
:
std_logic_vector
(
6
downto
1
)
:=
(
others
=
>
'
0
'
)
;
19
signal
din_q
:
std_logic_vector
(
17
downto
0
)
:=
(
others
=
>
'
0
'
)
;
20
signal
din_valid_q
:
std_logic
:=
'
0
'
;
21
begin
22
process
(clk)
23
begin
24
if
(
clk
'
event
and
clk
=
'
1
'
)
then
25
c
(
1
)
<=
din
(
0
)
xor
din
(
1
)
xor
din
(
3
)
xor
din
(
4
)
xor
din
(
6
)
xor
din
(
8
)
xor
26
din
(
10
)
xor
din
(
11
)
xor
din
(
13
)
xor
din
(
15
)
xor
din
(
17
)
xor
din
(
18
)
;
27
c
(
2
)
<=
din
(
0
)
xor
din
(
2
)
xor
din
(
3
)
xor
din
(
5
)
xor
din
(
6
)
xor
din
(
9
)
xor
28
din
(
10
)
xor
din
(
12
)
xor
din
(
13
)
xor
din
(
16
)
xor
din
(
17
)
xor
din
(
19
)
;
29
c
(
3
)
<=
din
(
1
)
xor
din
(
2
)
xor
din
(
3
)
xor
din
(
7
)
xor
din
(
8
)
xor
din
(
9
)
xor
din
(
10
)
xor
30
din
(
14
)
xor
din
(
15
)
xor
din
(
16
)
xor
din
(
17
)
xor
din
(
20
)
;
31
c
(
4
)
<=
din
(
4
)
xor
din
(
5
)
xor
din
(
6
)
xor
din
(
7
)
xor
din
(
8
)
xor
din
(
9
)
xor
din
(
10
)
xor
din
(
21
)
;
32
c
(
5
)
<=
din
(
11
)
xor
din
(
12
)
xor
din
(
13
)
xor
din
(
14
)
xor
din
(
15
)
xor
din
(
16
)
xor
din
(
17
)
xor
din
(
22
)
;
33
c
(
6
)
<=
not
(
din
(
2
)
xor
din
(
5
)
xor
din
(
7
)
xor
din
(
9
)
xor
din
(
12
)
xor
din
(
14
)
xor
din
(
16
)
xor
din
(
19
)
xor
din
(
20
)
xor
din
(
21
)
xor
din
(
22
)
xor
din
(
23
)
)
;
34
sgl_err
<=
(
c
(
1
)
xor
c
(
6
)
)
and
din_valid_q
;
35
dbl_err
<=
(
c
(
1
)
xnor
c
(
6
)
)
and
or_reduce
(
c
(
5
downto
1
)
)
and
din_valid_q
;
36
din_valid_q
<=
din_valid
;
37
din_q
<=
din
(
17
downto
0
)
;
38
-- dout_valid <= din_valid_q;
39
dout_valid
<=
not
(
(
c
(
1
)
xnor
c
(
6
)
)
and
or_reduce
(
c
(
5
downto
1
)
)
)
and
din_valid_q
;
40
if
(
c
=
"000011"
)
then
41
dout
(
0
)
<=
not
din_q
(
0
)
;
42
else
43
dout
(
0
)
<=
din_q
(
0
)
;
44
end
if
;
45
if
(
c
=
"000101"
)
then
46
dout
(
1
)
<=
not
din_q
(
1
)
;
47
else
48
dout
(
1
)
<=
din_q
(
1
)
;
49
end
if
;
50
if
(
c
=
"000110"
)
then
51
dout
(
2
)
<=
not
din_q
(
2
)
;
52
else
53
dout
(
2
)
<=
din_q
(
2
)
;
54
end
if
;
55
if
(
c
=
"000111"
)
then
56
dout
(
3
)
<=
not
din_q
(
3
)
;
57
else
58
dout
(
3
)
<=
din_q
(
3
)
;
59
end
if
;
60
if
(
c
=
"001001"
)
then
61
dout
(
4
)
<=
not
din_q
(
4
)
;
62
else
63
dout
(
4
)
<=
din_q
(
4
)
;
64
end
if
;
65
if
(
c
=
"001010"
)
then
66
dout
(
5
)
<=
not
din_q
(
5
)
;
67
else
68
dout
(
5
)
<=
din_q
(
5
)
;
69
end
if
;
70
if
(
c
=
"001011"
)
then
71
dout
(
6
)
<=
not
din_q
(
6
)
;
72
else
73
dout
(
6
)
<=
din_q
(
6
)
;
74
end
if
;
75
if
(
c
=
"001100"
)
then
76
dout
(
7
)
<=
not
din_q
(
7
)
;
77
else
78
dout
(
7
)
<=
din_q
(
7
)
;
79
end
if
;
80
if
(
c
=
"001101"
)
then
81
dout
(
8
)
<=
not
din_q
(
8
)
;
82
else
83
dout
(
8
)
<=
din_q
(
8
)
;
84
end
if
;
85
if
(
c
=
"001110"
)
then
86
dout
(
9
)
<=
not
din_q
(
9
)
;
87
else
88
dout
(
9
)
<=
din_q
(
9
)
;
89
end
if
;
90
if
(
c
=
"001111"
)
then
91
dout
(
10
)
<=
not
din_q
(
10
)
;
92
else
93
dout
(
10
)
<=
din_q
(
10
)
;
94
end
if
;
95
if
(
c
=
"010001"
)
then
96
dout
(
11
)
<=
not
din_q
(
11
)
;
97
else
98
dout
(
11
)
<=
din_q
(
11
)
;
99
end
if
;
100
if
(
c
=
"010010"
)
then
101
dout
(
12
)
<=
not
din_q
(
12
)
;
102
else
103
dout
(
12
)
<=
din_q
(
12
)
;
104
end
if
;
105
if
(
c
=
"010011"
)
then
106
dout
(
13
)
<=
not
din_q
(
13
)
;
107
else
108
dout
(
13
)
<=
din_q
(
13
)
;
109
end
if
;
110
if
(
c
=
"010100"
)
then
111
dout
(
14
)
<=
not
din_q
(
14
)
;
112
else
113
dout
(
14
)
<=
din_q
(
14
)
;
114
end
if
;
115
if
(
c
=
"010101"
)
then
116
dout
(
15
)
<=
not
din_q
(
15
)
;
117
else
118
dout
(
15
)
<=
din_q
(
15
)
;
119
end
if
;
120
if
(
c
=
"010110"
)
then
121
dout
(
16
)
<=
not
din_q
(
16
)
;
122
else
123
dout
(
16
)
<=
din_q
(
16
)
;
124
end
if
;
125
if
(
c
=
"010111"
)
then
126
dout
(
17
)
<=
not
din_q
(
17
)
;
127
else
128
dout
(
17
)
<=
din_q
(
17
)
;
129
end
if
;
130
end
if
;
131
end
process
;
132
end
my_arch
;
Generated on Wed Apr 18 2018 10:55:27 for AMC13 by
1.8.1