1 |
2 |
antanguay |
///////////////////////////////////////////////////////////////////////
|
2 |
|
|
// File: CRC32_D8.v
|
3 |
|
|
// Date: Fri Feb 8 19:26:59 2008
|
4 |
|
|
//
|
5 |
|
|
// Copyright (C) 1999-2003 Easics NV.
|
6 |
|
|
// This source file may be used and distributed without restriction
|
7 |
|
|
// provided that this copyright statement is not removed from the file
|
8 |
|
|
// and that any derivative work contains the original copyright notice
|
9 |
|
|
// and the associated disclaimer.
|
10 |
|
|
//
|
11 |
|
|
// THIS SOURCE FILE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS
|
12 |
|
|
// OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
13 |
|
|
// WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
14 |
|
|
//
|
15 |
|
|
// Purpose: Verilog module containing a synthesizable CRC function
|
16 |
|
|
// * polynomial: (0 1 2 4 5 7 8 10 11 12 16 22 23 26 32)
|
17 |
|
|
// * data width: 8
|
18 |
|
|
//
|
19 |
|
|
// Info: tools@easics.be
|
20 |
|
|
// http://www.easics.com
|
21 |
|
|
///////////////////////////////////////////////////////////////////////
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
//module CRC32_D8;
|
25 |
|
|
|
26 |
|
|
// polynomial: (0 1 2 4 5 7 8 10 11 12 16 22 23 26 32)
|
27 |
|
|
// data width: 8
|
28 |
|
|
// convention: the first serial data bit is D[7]
|
29 |
|
|
function [31:0] nextCRC32_D8;
|
30 |
|
|
|
31 |
|
|
input [7:0] Data;
|
32 |
|
|
input [31:0] CRC;
|
33 |
|
|
|
34 |
|
|
reg [7:0] D;
|
35 |
|
|
reg [31:0] C;
|
36 |
|
|
reg [31:0] NewCRC;
|
37 |
|
|
|
38 |
|
|
begin
|
39 |
|
|
|
40 |
|
|
D = Data;
|
41 |
|
|
C = CRC;
|
42 |
|
|
|
43 |
|
|
NewCRC[0] = D[6] ^ D[0] ^ C[24] ^ C[30];
|
44 |
|
|
NewCRC[1] = D[7] ^ D[6] ^ D[1] ^ D[0] ^ C[24] ^ C[25] ^ C[30] ^
|
45 |
|
|
C[31];
|
46 |
|
|
NewCRC[2] = D[7] ^ D[6] ^ D[2] ^ D[1] ^ D[0] ^ C[24] ^ C[25] ^
|
47 |
|
|
C[26] ^ C[30] ^ C[31];
|
48 |
|
|
NewCRC[3] = D[7] ^ D[3] ^ D[2] ^ D[1] ^ C[25] ^ C[26] ^ C[27] ^
|
49 |
|
|
C[31];
|
50 |
|
|
NewCRC[4] = D[6] ^ D[4] ^ D[3] ^ D[2] ^ D[0] ^ C[24] ^ C[26] ^
|
51 |
|
|
C[27] ^ C[28] ^ C[30];
|
52 |
|
|
NewCRC[5] = D[7] ^ D[6] ^ D[5] ^ D[4] ^ D[3] ^ D[1] ^ D[0] ^ C[24] ^
|
53 |
|
|
C[25] ^ C[27] ^ C[28] ^ C[29] ^ C[30] ^ C[31];
|
54 |
|
|
NewCRC[6] = D[7] ^ D[6] ^ D[5] ^ D[4] ^ D[2] ^ D[1] ^ C[25] ^ C[26] ^
|
55 |
|
|
C[28] ^ C[29] ^ C[30] ^ C[31];
|
56 |
|
|
NewCRC[7] = D[7] ^ D[5] ^ D[3] ^ D[2] ^ D[0] ^ C[24] ^ C[26] ^
|
57 |
|
|
C[27] ^ C[29] ^ C[31];
|
58 |
|
|
NewCRC[8] = D[4] ^ D[3] ^ D[1] ^ D[0] ^ C[0] ^ C[24] ^ C[25] ^
|
59 |
|
|
C[27] ^ C[28];
|
60 |
|
|
NewCRC[9] = D[5] ^ D[4] ^ D[2] ^ D[1] ^ C[1] ^ C[25] ^ C[26] ^
|
61 |
|
|
C[28] ^ C[29];
|
62 |
|
|
NewCRC[10] = D[5] ^ D[3] ^ D[2] ^ D[0] ^ C[2] ^ C[24] ^ C[26] ^
|
63 |
|
|
C[27] ^ C[29];
|
64 |
|
|
NewCRC[11] = D[4] ^ D[3] ^ D[1] ^ D[0] ^ C[3] ^ C[24] ^ C[25] ^
|
65 |
|
|
C[27] ^ C[28];
|
66 |
|
|
NewCRC[12] = D[6] ^ D[5] ^ D[4] ^ D[2] ^ D[1] ^ D[0] ^ C[4] ^ C[24] ^
|
67 |
|
|
C[25] ^ C[26] ^ C[28] ^ C[29] ^ C[30];
|
68 |
|
|
NewCRC[13] = D[7] ^ D[6] ^ D[5] ^ D[3] ^ D[2] ^ D[1] ^ C[5] ^ C[25] ^
|
69 |
|
|
C[26] ^ C[27] ^ C[29] ^ C[30] ^ C[31];
|
70 |
|
|
NewCRC[14] = D[7] ^ D[6] ^ D[4] ^ D[3] ^ D[2] ^ C[6] ^ C[26] ^ C[27] ^
|
71 |
|
|
C[28] ^ C[30] ^ C[31];
|
72 |
|
|
NewCRC[15] = D[7] ^ D[5] ^ D[4] ^ D[3] ^ C[7] ^ C[27] ^ C[28] ^
|
73 |
|
|
C[29] ^ C[31];
|
74 |
|
|
NewCRC[16] = D[5] ^ D[4] ^ D[0] ^ C[8] ^ C[24] ^ C[28] ^ C[29];
|
75 |
|
|
NewCRC[17] = D[6] ^ D[5] ^ D[1] ^ C[9] ^ C[25] ^ C[29] ^ C[30];
|
76 |
|
|
NewCRC[18] = D[7] ^ D[6] ^ D[2] ^ C[10] ^ C[26] ^ C[30] ^ C[31];
|
77 |
|
|
NewCRC[19] = D[7] ^ D[3] ^ C[11] ^ C[27] ^ C[31];
|
78 |
|
|
NewCRC[20] = D[4] ^ C[12] ^ C[28];
|
79 |
|
|
NewCRC[21] = D[5] ^ C[13] ^ C[29];
|
80 |
|
|
NewCRC[22] = D[0] ^ C[14] ^ C[24];
|
81 |
|
|
NewCRC[23] = D[6] ^ D[1] ^ D[0] ^ C[15] ^ C[24] ^ C[25] ^ C[30];
|
82 |
|
|
NewCRC[24] = D[7] ^ D[2] ^ D[1] ^ C[16] ^ C[25] ^ C[26] ^ C[31];
|
83 |
|
|
NewCRC[25] = D[3] ^ D[2] ^ C[17] ^ C[26] ^ C[27];
|
84 |
|
|
NewCRC[26] = D[6] ^ D[4] ^ D[3] ^ D[0] ^ C[18] ^ C[24] ^ C[27] ^
|
85 |
|
|
C[28] ^ C[30];
|
86 |
|
|
NewCRC[27] = D[7] ^ D[5] ^ D[4] ^ D[1] ^ C[19] ^ C[25] ^ C[28] ^
|
87 |
|
|
C[29] ^ C[31];
|
88 |
|
|
NewCRC[28] = D[6] ^ D[5] ^ D[2] ^ C[20] ^ C[26] ^ C[29] ^ C[30];
|
89 |
|
|
NewCRC[29] = D[7] ^ D[6] ^ D[3] ^ C[21] ^ C[27] ^ C[30] ^ C[31];
|
90 |
|
|
NewCRC[30] = D[7] ^ D[4] ^ C[22] ^ C[28] ^ C[31];
|
91 |
|
|
NewCRC[31] = D[5] ^ C[23] ^ C[29];
|
92 |
|
|
|
93 |
|
|
nextCRC32_D8 = NewCRC;
|
94 |
|
|
|
95 |
|
|
end
|
96 |
|
|
|
97 |
|
|
endfunction
|
98 |
|
|
|
99 |
|
|
//endmodule
|
100 |
|
|
|