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

Subversion Repositories crcahb

[/] [crcahb/] [trunk/] [rtl/] [crc_unit.v] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 redbear
//////////////////////////////////////////////////////////////////
2
////
3
////
4
////    CRCAHB CORE BLOCK
5
////
6
////
7
////
8
//// This file is part of the APB to I2C project
9
////
10
//// http://www.opencores.org/cores/apbi2c/
11
////
12
////
13
////
14
//// Description
15
////
16
//// Implementation of APB IP core according to
17
////
18
//// crcahb IP core specification document.
19
////
20
////
21
////
22
//// To Do: Things are right here but always all block can suffer changes
23
////
24
////
25
////
26
////
27
////
28
//// Author(s): -  Julio Cesar 
29
////
30
///////////////////////////////////////////////////////////////// 
31
////
32
////
33
//// Copyright (C) 2009 Authors and OPENCORES.ORG
34
////
35
////
36
////
37
//// This source file may be used and distributed without
38
////
39
//// restriction provided that this copyright statement is not
40
////
41
//// removed from the file and that any derivative work contains
42
//// the original copyright notice and the associated disclaimer.
43
////
44
////
45
//// This source file is free software; you can redistribute it
46
////
47
//// and/or modify it under the terms of the GNU Lesser General
48
////
49
//// Public License as published by the Free Software Foundation;
50
//// either version 2.1 of the License, or (at your option) any
51
////
52
//// later version.
53
////
54
////
55
////
56
//// This source is distributed in the hope that it will be
57
////
58
//// useful, but WITHOUT ANY WARRANTY; without even the implied
59
////
60
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
61
////
62
//// PURPOSE. See the GNU Lesser General Public License for more
63
//// details.
64
////
65
////
66
////
67
//// You should have received a copy of the GNU Lesser General
68
////
69
//// Public License along with this source; if not, download it
70
////
71
//// from http://www.opencores.org/lgpl.shtml
72
////
73
////
74
///////////////////////////////////////////////////////////////////
75 2 julioameri
module crc_unit
76
(
77
 //OUTPUTS
78
 output [31:0] crc_poly_out,
79
 output [31:0] crc_out,
80
 output [31:0] crc_init_out,
81
 output [7:0] crc_idr_out,
82
 output buffer_full,
83
 output read_wait,
84
 output reset_pending,
85
 //INPUTS
86
 input [31:0] bus_wr,
87
 input [ 1:0] crc_poly_size,
88
 input [ 1:0] bus_size,
89
 input [ 1:0] rev_in_type,
90
 input rev_out_type,
91
 input crc_init_en,
92
 input crc_idr_en,
93
 input crc_poly_en,
94
 input buffer_write_en,
95
 input reset_chain,
96
 input clk,
97
 input rst_n
98
);
99
 
100
//Interconection signals
101
wire [ 1:0] size_in;
102
wire [ 1:0] byte_sel;
103
wire clear_crc_init;
104
wire set_crc_init;
105
wire bypass_byte0;
106
wire bypass_size;
107
wire crc_out_en;
108
wire byte_en;
109
wire buffer_en;
110
 
111
//The write in the buffer only occur if there is free space
112
assign buffer_en = buffer_write_en && !buffer_full;
113
 
114
//Instance of the Datapath
115
crc_datapath DATAPATH
116
(
117
 .crc_out            ( crc_out        ),
118
 .size_out           ( size_in        ),
119
 .crc_idr_out        ( crc_idr_out    ),
120
 .crc_poly_out       ( crc_poly_out   ),
121
 .crc_init_out       ( crc_init_out   ),
122
 .bus_wr             ( bus_wr         ),
123
 .rev_in_type        ( rev_in_type    ),
124
 .rev_out_type       ( rev_out_type   ),
125
 .buffer_en          ( buffer_en      ),
126
 .byte_en            ( byte_en        ),
127
 .crc_init_en        ( crc_init_en    ),
128
 .crc_out_en         ( crc_out_en     ),
129
 .crc_idr_en         ( crc_idr_en     ),
130
 .crc_poly_en        ( crc_poly_en    ),
131
 .buffer_rst         ( clear_crc_init ),
132
 .bypass_byte0       ( bypass_byte0   ),
133
 .bypass_size        ( bypass_size    ),
134
 .byte_sel           ( byte_sel       ),
135
 .size_in            ( bus_size       ),
136
 .clear_crc_init_sel ( clear_crc_init ),
137
 .set_crc_init_sel   ( set_crc_init   ),
138
 .crc_poly_size      ( crc_poly_size  ),
139
 .clk                ( clk            ),
140
 .rst_n              ( rst_n          )
141
);
142
 
143
//Instance of the Control unit
144
crc_control_unit CONTROL_UNIT
145
(
146
 .byte_en            ( byte_en          ),
147
 .crc_out_en         ( crc_out_en       ),
148
 .byte_sel           ( byte_sel         ),
149
 .bypass_byte0       ( bypass_byte0     ),
150
 .buffer_full        ( buffer_full      ),
151
 .read_wait          ( read_wait        ),
152
 .bypass_size        ( bypass_size      ),
153
 .set_crc_init_sel   ( set_crc_init     ),
154
 .clear_crc_init_sel ( clear_crc_init   ),
155
 .size_in            ( size_in          ),
156
 .write              ( buffer_write_en  ),
157
 .reset_chain        ( reset_chain      ),
158
 .reset_pending      ( reset_pending    ),
159
 .clk                ( clk              ),
160
 .rst_n              ( rst_n            )
161
);
162
endmodule

powered by: WebSVN 2.1.0

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