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
TCPIP_if
checksum.vhd
1
----------------------------------------------------------------------------------
2
-- Company:
3
-- Engineer:
4
--
5
-- Create Date:
11
:
02
:
26
08/04/2010
6
-- Design Name:
7
-- Module Name: checksum - Behavioral
8
-- Project Name:
9
-- Target Devices:
10
-- Tool versions:
11
-- Description:
12
--
13
-- Dependencies:
14
--
15
-- Revision:
16
-- Revision
0
.
01
-
File
Created
17
-- Additional Comments:
18
-- This module calculates 16-bit checksum
in
1's compliment,
19
-- checksum output has two clock cycle latency.
20
-- bad_checksum output has two clock cycle latency.
21
----------------------------------------------------------------------------------
22
library
IEEE
;
23
use
IEEE.STD_LOGIC_1164.
ALL
;
24
use
IEEE.STD_LOGIC_ARITH.
ALL
;
25
use
IEEE.STD_LOGIC_UNSIGNED.
ALL
;
26
use
IEEE.std_logic_misc.
all
;
27
28
-- Uncomment the following
library
declaration
if
using
29
-- arithmetic functions
with
Signed
or
Unsigned
values
30
--use IEEE.NUMERIC_STD.
ALL
;
31
32
-- Uncomment the following
library
declaration
if
instantiating
33
-- any Xilinx primitives
in
this code.
34
--library UNISIM;
35
--use UNISIM.VComponents.
all
;
36
37
entity
checksum
is
38
Port
(
c
:
in
STD_LOGIC
;
39
r
:
in
STD_LOGIC
;
40
r_value
:
in
STD_LOGIC_VECTOR
(
15
downto
0
)
;
41
ce
:
in
STD_LOGIC
;
42
d
:
in
STD_LOGIC_VECTOR
(
16
downto
0
)
;
43
bad_chksum
:
out
STD_LOGIC
;
44
s
:
out
STD_LOGIC_VECTOR
(
15
downto
0
)
)
;
45
end
checksum
;
46
47
architecture
Behavioral
of
checksum
is
48
signal
acc
:
std_logic_vector
(
16
downto
0
)
:=
(
others
=
>
'
0
'
)
;
49
signal
s_i
:
std_logic_vector
(
15
downto
0
)
:=
(
others
=
>
'
0
'
)
;
50
begin
51
s
<=
s_i
;
52
process
(c)
53
begin
54
if
(
c
'
event
and
c
=
'
1
'
)
then
55
if
(
r
=
'
1
'
)
then
56
acc
(
16
)
<=
'
0
'
;
57
acc
(
15
downto
0
)
<=
r_value
;
58
elsif
(
ce
=
'
1
'
)
then
59
acc
<=
(
'
0
'
&
acc
(
15
downto
0
)
)
+
(
'
0
'
&
d
(
15
downto
0
)
)
+
d
(
16
)
+
acc
(
16
)
;
60
end
if
;
61
if
(
and_reduce
(
acc
(
15
downto
1
)
)
=
'
1
'
and
(
acc
(
0
)
=
'
1
'
or
acc
(
16
)
=
'
1
'
)
)
then
62
s_i
<=
(
others
=
>
'
1
'
)
;
63
else
64
s_i
<=
not
(
acc
(
15
downto
0
)
+
acc
(
16
)
)
;
65
end
if
;
66
if
(
and_reduce
(
acc
(
15
downto
1
)
)
=
'
1
'
and
(
acc
(
0
)
=
'
1
'
or
acc
(
16
)
=
'
1
'
)
)
then
67
bad_chksum
<=
'
0
'
;
68
else
69
bad_chksum
<=
'
1
'
;
70
end
if
;
71
end
if
;
72
end
process
;
73
end
Behavioral
;
74
Generated on Wed Apr 18 2018 10:55:28 for AMC13 by
1.8.1