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

Subversion Repositories opb_usblite

[/] [opb_usblite/] [trunk/] [pcores/] [opb_usblite_v1_00_a/] [hdl/] [verilog/] [usb_phy.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 rehnmaak
/////////////////////////////////////////////////////////////////////
2
////                                                             ////
3
////  USB 1.1 PHY                                                ////
4
////                                                             ////
5
////                                                             ////
6
////  Author: Rudolf Usselmann                                   ////
7
////          rudi@asics.ws                                      ////
8
////                                                             ////
9
////                                                             ////
10
////  Downloaded from: http://www.opencores.org/cores/usb_phy/   ////
11
////                                                             ////
12
/////////////////////////////////////////////////////////////////////
13
////                                                             ////
14
//// Copyright (C) 2000-2002 Rudolf Usselmann                    ////
15
////                         www.asics.ws                        ////
16
////                         rudi@asics.ws                       ////
17
////                                                             ////
18
//// This source file may be used and distributed without        ////
19
//// restriction provided that this copyright statement is not   ////
20
//// removed from the file and that any derivative work contains ////
21
//// the original copyright notice and the associated disclaimer.////
22
////                                                             ////
23
////     THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY     ////
24
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   ////
25
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS   ////
26
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR      ////
27
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,         ////
28
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    ////
29
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE   ////
30
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR        ////
31
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  ////
32
//// LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT  ////
33
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT  ////
34
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE         ////
35
//// POSSIBILITY OF SUCH DAMAGE.                                 ////
36
////                                                             ////
37
/////////////////////////////////////////////////////////////////////
38
 
39
//  CVS Log
40
//
41
//  $Id: usb_phy.v,v 1.4 2003/10/21 05:58:40 rudi Exp $
42
//
43
//  $Date: 2003/10/21 05:58:40 $
44
//  $Revision: 1.4 $
45
//  $Author: rudi $
46
//  $Locker:  $
47
//  $State: Exp $
48
//
49
// Change History:
50
//               $Log: usb_phy.v,v $
51
//               Revision 1.4  2003/10/21 05:58:40  rudi
52
//               usb_rst is no longer or'ed with the incomming reset internally.
53
//               Now usb_rst is simply an output, the application can decide how
54
//               to utilize it.
55
//
56
//               Revision 1.3  2003/10/19 17:40:13  rudi
57
//               - Made core more robust against line noise
58
//               - Added Error Checking and Reporting
59
//               (See README.txt for more info)
60
//
61
//               Revision 1.2  2002/09/16 16:06:37  rudi
62
//               Changed top level name to be consistent ...
63
//
64
//               Revision 1.1.1.1  2002/09/16 14:26:59  rudi
65
//               Created Directory Structure
66
//
67
//
68
//
69
//
70
//
71
//
72
//
73
//
74
 
75
`include "timescale.v"
76
 
77
module usb_phy(clk, rst, phy_tx_mode, usb_rst,
78
 
79
                // Transciever Interface
80
                txdp, txdn, txoe,
81
                rxd, rxdp, rxdn,
82
 
83
                // UTMI Interface
84
                DataOut_i, TxValid_i, TxReady_o, RxValid_o,
85
                RxActive_o, RxError_o, DataIn_o, LineState_o
86
                );
87
 
88
input           clk;
89
input           rst;
90
input           phy_tx_mode;
91
output          usb_rst;
92
output          txdp, txdn, txoe;
93
input           rxd, rxdp, rxdn;
94
input   [7:0]    DataOut_i;
95
input           TxValid_i;
96
output          TxReady_o;
97
output  [7:0]    DataIn_o;
98
output          RxValid_o;
99
output          RxActive_o;
100
output          RxError_o;
101
output  [1:0]    LineState_o;
102
 
103
///////////////////////////////////////////////////////////////////
104
//
105
// Local Wires and Registers
106
//
107
 
108
reg     [4:0]    rst_cnt;
109
reg             usb_rst;
110
wire            fs_ce;
111
wire            rst;
112
 
113
///////////////////////////////////////////////////////////////////
114
//
115
// Misc Logic
116
//
117
 
118
///////////////////////////////////////////////////////////////////
119
//
120
// TX Phy
121
//
122
 
123
usb_tx_phy i_tx_phy(
124
        .clk(           clk             ),
125
        .rst(           rst             ),
126
        .fs_ce(         fs_ce           ),
127
        .phy_mode(      phy_tx_mode     ),
128
 
129
        // Transciever Interface
130
        .txdp(          txdp            ),
131
        .txdn(          txdn            ),
132
        .txoe(          txoe            ),
133
 
134
        // UTMI Interface
135
        .DataOut_i(     DataOut_i       ),
136
        .TxValid_i(     TxValid_i       ),
137
        .TxReady_o(     TxReady_o       )
138
        );
139
 
140
///////////////////////////////////////////////////////////////////
141
//
142
// RX Phy and DPLL
143
//
144
 
145
usb_rx_phy i_rx_phy(
146
        .clk(           clk             ),
147
        .rst(           rst             ),
148
        .fs_ce(         fs_ce           ),
149
 
150
        // Transciever Interface
151
        .rxd(           rxd             ),
152
        .rxdp(          rxdp            ),
153
        .rxdn(          rxdn            ),
154
 
155
        // UTMI Interface
156
        .DataIn_o(      DataIn_o        ),
157
        .RxValid_o(     RxValid_o       ),
158
        .RxActive_o(    RxActive_o      ),
159
        .RxError_o(     RxError_o       ),
160
        .RxEn_i(        txoe            ),
161
        .LineState(     LineState_o     )
162
        );
163
 
164
///////////////////////////////////////////////////////////////////
165
//
166
// Generate an USB Reset is we see SE0 for at least 2.5uS
167
//
168
 
169
`ifdef USB_ASYNC_REST
170
always @(posedge clk or negedge rst)
171
`else
172
always @(posedge clk)
173
`endif
174
        if(!rst)                        rst_cnt <= 5'h0;
175
        else
176
        if(LineState_o != 2'h0)         rst_cnt <= 5'h0;
177
        else
178
        if(!usb_rst && fs_ce)           rst_cnt <= rst_cnt + 5'h1;
179
 
180
always @(posedge clk)
181
        usb_rst <= (rst_cnt == 5'h1f);
182
 
183
endmodule
184
 

powered by: WebSVN 2.1.0

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