blob: ca8d930798b85df27ac3c6f15afc2fec778b1009 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.math_real.all;
package crc_pkg is
type crcParam_t is record
selLen : integer;
poly : std_ulogic_vector;
iniVect : std_ulogic_vector;
refIn : boolean;
refOut : boolean;
xorOut : std_ulogic_vector;
end record;
pure function getCrc32Param( stdCrc : string
; datLen : integer
) return crcParam_t;
end crc_pkg;
package body crc_pkg is
pure function getCrc32Param( stdCrc : string
; datLen : integer
) return crcParam_t is
variable crcParam_v : crcParam_t( poly ( 31 downto 0)
, iniVect ( 31 downto 0)
, xorOut ( 31 downto 0) );
begin
if ( "CRC-32/CCITT-FALSE" = stdCrc ) then
crcParam_v.selLen := datLen / 8 ;
crcParam_v.poly := X"04C11DB7" ;
crcParam_v.iniVect := X"FFFFFFFF" ;
crcParam_v.refIn := true ;
crcParam_v.refOut := true ;
crcParam_v.xorOut := X"FFFFFFFF" ;
else
crcParam_v.selLen := datLen / 8 ;
crcParam_v.poly := X"000000AF" ;
crcParam_v.iniVect := X"00000000" ;
crcParam_v.refIn := false ;
crcParam_v.refOut := false ;
crcParam_v.xorOut := X"00000000" ;
assert false report
" Standard crc not implemented Yet."
severity failure;
end if;
return crcParam_v;
end function;
end package body crc_pkg;
|