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

Subversion Repositories usb_phy

[/] [usb_phy/] [trunk/] [rtl/] [verilog/] [usb_phy.v] - Blame information for rev 4

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 rudi
/////////////////////////////////////////////////////////////////////
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 4 rudi
//  $Id: usb_phy.v,v 1.2 2002-09-16 16:06:37 rudi Exp $
42 2 rudi
//
43 4 rudi
//  $Date: 2002-09-16 16:06:37 $
44
//  $Revision: 1.2 $
45 2 rudi
//  $Author: rudi $
46
//  $Locker:  $
47
//  $State: Exp $
48
//
49
// Change History:
50
//               $Log: not supported by cvs2svn $
51 4 rudi
//               Revision 1.1.1.1  2002/09/16 14:26:59  rudi
52
//               Created Directory Structure
53 2 rudi
//
54
//
55
//
56
//
57
//
58
//
59
//
60 4 rudi
//
61 2 rudi
 
62
`include "timescale.v"
63
 
64 4 rudi
module usb_phy(clk, rst, phy_tx_mode, usb_rst,
65 2 rudi
 
66
                // Transciever Interface
67
                txdp, txdn, txoe,
68
                rxd, rxdp, rxdn,
69
 
70
                // UTMI Interface
71
                DataOut_i, TxValid_i, TxReady_o, RxValid_o,
72
                RxActive_o, RxError_o, DataIn_o, LineState_o
73
                );
74
 
75
input           clk;
76
input           rst;
77
input           phy_tx_mode;
78
output          usb_rst;
79
output          txdp, txdn, txoe;
80
input           rxd, rxdp, rxdn;
81
input   [7:0]    DataOut_i;
82
input           TxValid_i;
83
output          TxReady_o;
84
output  [7:0]    DataIn_o;
85
output          RxValid_o;
86
output          RxActive_o;
87
output          RxError_o;
88
output  [1:0]    LineState_o;
89
 
90
///////////////////////////////////////////////////////////////////
91
//
92
// Local Wires and Registers
93
//
94
 
95
reg     [5:0]    rst_cnt;
96
reg             usb_rst;
97
wire            reset;
98
 
99
///////////////////////////////////////////////////////////////////
100
//
101
// Misc Logic
102
//
103
 
104
assign reset = rst & ~usb_rst;
105
 
106
///////////////////////////////////////////////////////////////////
107
//
108
// TX Phy
109
//
110
 
111
usb_tx_phy i_tx_phy(
112
        .clk(           clk             ),
113
        .rst(           reset           ),
114
        .fs_ce(         fs_ce           ),
115
        .phy_mode(      phy_tx_mode     ),
116
 
117
        // Transciever Interface
118
        .txdp(          txdp            ),
119
        .txdn(          txdn            ),
120
        .txoe(          txoe            ),
121
 
122
        // UTMI Interface
123
        .DataOut_i(     DataOut_i       ),
124
        .TxValid_i(     TxValid_i       ),
125
        .TxReady_o(     TxReady_o       )
126
        );
127
 
128
///////////////////////////////////////////////////////////////////
129
//
130
// RX Phy and DPLL
131
//
132
 
133
usb_rx_phy i_rx_phy(
134
        .clk(           clk             ),
135
        .rst(           reset           ),
136
        .fs_ce(         fs_ce           ),
137
 
138
        // Transciever Interface
139
        .rxd(           rxd             ),
140
        .rxdp(          rxdp            ),
141
        .rxdn(          rxdn            ),
142
 
143
        // UTMI Interface
144
        .DataIn_o(      DataIn_o        ),
145
        .RxValid_o(     RxValid_o       ),
146
        .RxActive_o(    RxActive_o      ),
147
        .RxError_o(     RxError_o       ),
148
        .RxEn_i(        txoe            ),
149
        .LineState(     LineState_o     )
150
        );
151
 
152
///////////////////////////////////////////////////////////////////
153
//
154
// Generate an USB Reset is we see SE0 for at least 2.5uS
155
//
156
 
157
always @(posedge clk)
158
        if(!rst)                        rst_cnt <= #1 5'h0;
159
        else
160
        if(LineState_o != 2'h0)         rst_cnt <= #1 5'h0;
161
        else
162
        if(!usb_rst & fs_ce)            rst_cnt <= #1 rst_cnt + 5'h1;
163
 
164
always @(posedge clk)
165
        usb_rst <= #1 (rst_cnt == 5'd31);
166
 
167
endmodule
168
 

powered by: WebSVN 2.1.0

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