OpenCores
URL https://opencores.org/ocsvn/usb_host_core/usb_host_core/trunk

Subversion Repositories usb_host_core

[/] [usb_host_core/] [trunk/] [src_v/] [usbh_crc16.v] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 ultra_embe
//-----------------------------------------------------------------
2
//                     USB Full Speed Host
3
//                           V0.5
4
//                     Ultra-Embedded.com
5
//                     Copyright 2015-2019
6
//
7
//                 Email: admin@ultra-embedded.com
8
//
9
//                         License: GPL
10
// If you would like a version with a more permissive license for
11
// use in closed source commercial applications please contact me
12
// for details.
13
//-----------------------------------------------------------------
14
//
15
// This file is open source HDL; you can redistribute it and/or 
16
// modify it under the terms of the GNU General Public License as 
17
// published by the Free Software Foundation; either version 2 of 
18
// the License, or (at your option) any later version.
19
//
20
// This file is distributed in the hope that it will be useful,
21
// but WITHOUT ANY WARRANTY; without even the implied warranty of
22
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
// GNU General Public License for more details.
24
//
25
// You should have received a copy of the GNU General Public 
26
// License along with this file; if not, write to the Free Software
27
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
28
// USA
29
//-----------------------------------------------------------------
30
 
31
//-----------------------------------------------------------------
32
//                          Generated File
33
//-----------------------------------------------------------------
34
//-----------------------------------------------------------------
35
// Module: 16-bit CRC used by USB data packets
36
//-----------------------------------------------------------------
37
module usbh_crc16
38
(
39
    input [15:0]    crc_i,
40
    input [7:0]     data_i,
41
    output [15:0]   crc_o
42
);
43
 
44
//-----------------------------------------------------------------
45
// Implementation
46
//-----------------------------------------------------------------
47
assign crc_o[15] =    data_i[0] ^ data_i[1] ^ data_i[2] ^ data_i[3] ^ data_i[4] ^
48
                        data_i[5] ^ data_i[6] ^ data_i[7] ^ crc_i[7] ^ crc_i[6] ^
49
                        crc_i[5] ^ crc_i[4] ^ crc_i[3] ^ crc_i[2] ^
50
                        crc_i[1] ^ crc_i[0];
51
assign crc_o[14] =    data_i[0] ^ data_i[1] ^ data_i[2] ^ data_i[3] ^ data_i[4] ^ data_i[5] ^
52
                        data_i[6] ^ crc_i[6] ^ crc_i[5] ^ crc_i[4] ^
53
                        crc_i[3] ^ crc_i[2] ^ crc_i[1] ^ crc_i[0];
54
assign crc_o[13] =    data_i[6] ^ data_i[7] ^ crc_i[7] ^ crc_i[6];
55
assign crc_o[12] =    data_i[5] ^ data_i[6] ^ crc_i[6] ^ crc_i[5];
56
assign crc_o[11] =    data_i[4] ^ data_i[5] ^ crc_i[5] ^ crc_i[4];
57
assign crc_o[10] =    data_i[3] ^ data_i[4] ^ crc_i[4] ^ crc_i[3];
58
assign crc_o[9] =     data_i[2] ^ data_i[3] ^ crc_i[3] ^ crc_i[2];
59
assign crc_o[8] =     data_i[1] ^ data_i[2] ^ crc_i[2] ^ crc_i[1];
60
assign crc_o[7] =     data_i[0] ^ data_i[1] ^ crc_i[15] ^ crc_i[1] ^ crc_i[0];
61
assign crc_o[6] =     data_i[0] ^ crc_i[14] ^ crc_i[0];
62
assign crc_o[5] =     crc_i[13];
63
assign crc_o[4] =     crc_i[12];
64
assign crc_o[3] =     crc_i[11];
65
assign crc_o[2] =     crc_i[10];
66
assign crc_o[1] =     crc_i[9];
67
assign crc_o[0] =     data_i[0] ^ data_i[1] ^ data_i[2] ^ data_i[3] ^ data_i[4] ^ data_i[5] ^
68
                        data_i[6] ^ data_i[7] ^ crc_i[8] ^ crc_i[7] ^ crc_i[6] ^
69
                        crc_i[5] ^ crc_i[4] ^ crc_i[3] ^ crc_i[2] ^
70
                        crc_i[1] ^ crc_i[0];
71
 
72
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.