1 |
3 |
DFC |
--
|
2 |
|
|
-- crc_fast16_tab.vhd: A 32-bit CRC (IEEE) table for processing fixed 16 bits in parallel
|
3 |
|
|
-- Copyright (C) 2011 CESNET
|
4 |
|
|
-- Author(s): Lukas Kekely <xkekel00@stud.fit.vutbr.cz>
|
5 |
|
|
--
|
6 |
|
|
-- Redistribution and use in source and binary forms, with or without
|
7 |
|
|
-- modification, are permitted provided that the following conditions
|
8 |
|
|
-- are met:
|
9 |
|
|
-- 1. Redistributions of source code must retain the above copyright
|
10 |
|
|
-- notice, this list of conditions and the following disclaimer.
|
11 |
|
|
-- 2. Redistributions in binary form must reproduce the above copyright
|
12 |
|
|
-- notice, this list of conditions and the following disclaimer in
|
13 |
|
|
-- the documentation and/or other materials provided with the
|
14 |
|
|
-- distribution.
|
15 |
|
|
-- 3. Neither the name of the Company nor the names of its contributors
|
16 |
|
|
-- may be used to endorse or promote products derived from this
|
17 |
|
|
-- software without specific prior written permission.
|
18 |
|
|
--
|
19 |
|
|
-- This software is provided ``as is'', and any express or implied
|
20 |
|
|
-- warranties, including, but not limited to, the implied warranties of
|
21 |
|
|
-- merchantability and fitness for a particular purpose are disclaimed.
|
22 |
|
|
-- In no event shall the company or contributors be liable for any
|
23 |
|
|
-- direct, indirect, incidental, special, exemplary, or consequential
|
24 |
|
|
-- damages (including, but not limited to, procurement of substitute
|
25 |
|
|
-- goods or services; loss of use, data, or profits; or business
|
26 |
|
|
-- interruption) however caused and on any theory of liability, whether
|
27 |
|
|
-- in contract, strict liability, or tort (including negligence or
|
28 |
|
|
-- otherwise) arising in any way out of the use of this software, even
|
29 |
|
|
-- if advised of the possibility of such damage.
|
30 |
|
|
--
|
31 |
|
|
-- $Id$
|
32 |
|
|
--
|
33 |
|
|
-- TODO:
|
34 |
|
|
--
|
35 |
|
|
--
|
36 |
|
|
|
37 |
|
|
library IEEE;
|
38 |
|
|
use IEEE.std_logic_1164.all;
|
39 |
|
|
use IEEE.std_logic_arith.all;
|
40 |
|
|
use IEEE.std_logic_unsigned.all;
|
41 |
|
|
use IEEE.numeric_std.all;
|
42 |
|
|
use WORK.math_pack.all;
|
43 |
|
|
-- ----------------------------------------------------------------------------
|
44 |
|
|
-- Entity declaration
|
45 |
|
|
-- ----------------------------------------------------------------------------
|
46 |
|
|
entity crc32_fast16_tab is
|
47 |
|
|
port(
|
48 |
|
|
DI : in std_logic_vector(16-1 downto 0);
|
49 |
|
|
DO : out std_logic_vector(31 downto 0)
|
50 |
|
|
);
|
51 |
|
|
end entity crc32_fast16_tab;
|
52 |
|
|
|
53 |
|
|
-- ----------------------------------------------------------------------------
|
54 |
|
|
-- Architecture declaration
|
55 |
|
|
-- ----------------------------------------------------------------------------
|
56 |
|
|
architecture arch of crc32_fast16_tab is
|
57 |
|
|
begin
|
58 |
|
|
-- 32-bit CRC equations processing 16 bits in parallel (VHDL code)
|
59 |
|
|
-- Generator polynomial: 0x104C11DB7
|
60 |
|
|
DO(0) <= DI(6) XOR DI(7) XOR DI(0) XOR DI(4) XOR DI(10);
|
61 |
|
|
DO(1) <= DI(7) XOR DI(8) XOR DI(1) XOR DI(5) XOR DI(11);
|
62 |
|
|
DO(2) <= DI(8) XOR DI(9) XOR DI(2) XOR DI(6) XOR DI(12);
|
63 |
|
|
DO(3) <= DI(9) XOR DI(10) XOR DI(3) XOR DI(7) XOR DI(13);
|
64 |
|
|
DO(4) <= DI(10) XOR DI(11) XOR DI(4) XOR DI(8) XOR DI(14);
|
65 |
|
|
DO(5) <= DI(11) XOR DI(12) XOR DI(5) XOR DI(9) XOR DI(15);
|
66 |
|
|
DO(6) <= DI(0) XOR DI(12) XOR DI(4) XOR DI(7) XOR DI(13);
|
67 |
|
|
DO(7) <= DI(1) XOR DI(13) XOR DI(5) XOR DI(8) XOR DI(14);
|
68 |
|
|
DO(8) <= DI(0) XOR DI(2) XOR DI(14) XOR DI(6) XOR DI(9) XOR DI(15);
|
69 |
|
|
DO(9) <= DI(1) XOR DI(4) XOR DI(6) XOR DI(3) XOR DI(15);
|
70 |
|
|
DO(10) <= DI(2) XOR DI(5) XOR DI(6) XOR DI(10);
|
71 |
|
|
DO(11) <= DI(3) XOR DI(6) XOR DI(7) XOR DI(11);
|
72 |
|
|
DO(12) <= DI(4) XOR DI(7) XOR DI(8) XOR DI(0) XOR DI(12);
|
73 |
|
|
DO(13) <= DI(5) XOR DI(8) XOR DI(0) XOR DI(9) XOR DI(1) XOR DI(13);
|
74 |
|
|
DO(14) <= DI(6) XOR DI(9) XOR DI(1) XOR DI(10) XOR DI(2) XOR DI(14);
|
75 |
|
|
DO(15) <= DI(7) XOR DI(10) XOR DI(2) XOR DI(11) XOR DI(3) XOR DI(15);
|
76 |
|
|
DO(16) <= DI(7) XOR DI(8) XOR DI(10) XOR DI(11) XOR DI(3) XOR DI(0) XOR DI(6) XOR DI(12);
|
77 |
|
|
DO(17) <= DI(8) XOR DI(9) XOR DI(11) XOR DI(0) XOR DI(12) XOR DI(4) XOR DI(1) XOR DI(7) XOR DI(13);
|
78 |
|
|
DO(18) <= DI(9) XOR DI(10) XOR DI(12) XOR DI(1) XOR DI(13) XOR DI(5) XOR DI(2) XOR DI(8) XOR DI(14);
|
79 |
|
|
DO(19) <= DI(0) XOR DI(10) XOR DI(11) XOR DI(13) XOR DI(2) XOR DI(14) XOR DI(6) XOR DI(3) XOR DI(9) XOR DI(15);
|
80 |
|
|
DO(20) <= DI(1) XOR DI(11) XOR DI(0) XOR DI(12) XOR DI(14) XOR DI(6) XOR DI(3) XOR DI(15);
|
81 |
|
|
DO(21) <= DI(10) XOR DI(2) XOR DI(12) XOR DI(1) XOR DI(13) XOR DI(6) XOR DI(15);
|
82 |
|
|
DO(22) <= DI(6) XOR DI(10) XOR DI(11) XOR DI(3) XOR DI(13) XOR DI(4) XOR DI(2) XOR DI(14);
|
83 |
|
|
DO(23) <= DI(7) XOR DI(11) XOR DI(12) XOR DI(4) XOR DI(14) XOR DI(5) XOR DI(3) XOR DI(15);
|
84 |
|
|
DO(24) <= DI(8) XOR DI(10) XOR DI(0) XOR DI(12) XOR DI(7) XOR DI(13) XOR DI(5) XOR DI(15);
|
85 |
|
|
DO(25) <= DI(9) XOR DI(10) XOR DI(11) XOR DI(1) XOR DI(7) XOR DI(13) XOR DI(4) XOR DI(8) XOR DI(14);
|
86 |
|
|
DO(26) <= DI(10) XOR DI(11) XOR DI(12) XOR DI(2) XOR DI(8) XOR DI(14) XOR DI(5) XOR DI(9) XOR DI(15);
|
87 |
|
|
DO(27) <= DI(11) XOR DI(0) XOR DI(12) XOR DI(4) XOR DI(7) XOR DI(13) XOR DI(3) XOR DI(9) XOR DI(15);
|
88 |
|
|
DO(28) <= DI(0) XOR DI(6) XOR DI(12) XOR DI(1) XOR DI(7) XOR DI(13) XOR DI(5) XOR DI(8) XOR DI(14);
|
89 |
|
|
DO(29) <= DI(1) XOR DI(7) XOR DI(13) XOR DI(2) XOR DI(8) XOR DI(14) XOR DI(6) XOR DI(9) XOR DI(15);
|
90 |
|
|
DO(30) <= DI(4) XOR DI(2) XOR DI(8) XOR DI(14) XOR DI(6) XOR DI(3) XOR DI(9) XOR DI(15);
|
91 |
|
|
DO(31) <= DI(5) XOR DI(6) XOR DI(3) XOR DI(9) XOR DI(15);
|
92 |
|
|
|
93 |
|
|
end architecture;
|