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: 5-bit CRC used by USB tokens
|
36 |
|
|
//-----------------------------------------------------------------
|
37 |
|
|
module usbh_crc5
|
38 |
|
|
(
|
39 |
|
|
input [4:0] crc_i,
|
40 |
|
|
input [10:0] data_i,
|
41 |
|
|
output [4:0] crc_o
|
42 |
|
|
);
|
43 |
|
|
|
44 |
|
|
//-----------------------------------------------------------------
|
45 |
|
|
// Implementation
|
46 |
|
|
//-----------------------------------------------------------------
|
47 |
|
|
assign crc_o[0] = data_i[10] ^ data_i[9] ^ data_i[6] ^ data_i[5] ^ data_i[3] ^ data_i[0] ^
|
48 |
|
|
crc_i[0] ^ crc_i[3] ^ crc_i[4];
|
49 |
|
|
|
50 |
|
|
assign crc_o[1] = data_i[10] ^ data_i[7] ^ data_i[6] ^ data_i[4] ^ data_i[1] ^
|
51 |
|
|
crc_i[0] ^ crc_i[1] ^ crc_i[4];
|
52 |
|
|
|
53 |
|
|
assign crc_o[2] = data_i[10] ^ data_i[9] ^ data_i[8] ^ data_i[7] ^ data_i[6] ^ data_i[3] ^ data_i[2] ^ data_i[0] ^
|
54 |
|
|
crc_i[0] ^ crc_i[1] ^ crc_i[2] ^ crc_i[3] ^ crc_i[4];
|
55 |
|
|
|
56 |
|
|
assign crc_o[3] = data_i[10] ^ data_i[9] ^ data_i[8] ^ data_i[7] ^ data_i[4] ^ data_i[3] ^ data_i[1] ^
|
57 |
|
|
crc_i[1] ^ crc_i[2] ^ crc_i[3] ^ crc_i[4];
|
58 |
|
|
|
59 |
|
|
assign crc_o[4] = data_i[10] ^ data_i[9] ^ data_i[8] ^ data_i[5] ^ data_i[4] ^ data_i[2] ^
|
60 |
|
|
crc_i[2] ^ crc_i[3] ^ crc_i[4];
|
61 |
|
|
|
62 |
|
|
endmodule
|