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

Subversion Repositories usb11

[/] [usb11/] [trunk/] [rtl/] [systemc/] [usb_phy.h] - Blame information for rev 15

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

Line No. Rev Author Line
1 2 alfoltran
/////////////////////////////////////////////////////////////////////
2
////                                                             ////
3
////  USB PHY                                                    ////
4
////                                                             ////
5
////  SystemC Version: usb_phy.h                                 ////
6
////  Author: Alfredo Luiz Foltran Fialho                        ////
7
////          alfoltran@ig.com.br                                ////
8
////                                                             ////
9
////                                                             ////
10
/////////////////////////////////////////////////////////////////////
11
////                                                             ////
12
//// Verilog Version: usb_phy.v                                  ////
13
//// Copyright (C) 2000-2002 Rudolf Usselmann                    ////
14
////                         www.asics.ws                        ////
15
////                         rudi@asics.ws                       ////
16
////                                                             ////
17
//// This source file may be used and distributed without        ////
18
//// restriction provided that this copyright statement is not   ////
19
//// removed from the file and that any derivative work contains ////
20
//// the original copyright notice and the associated disclaimer.////
21
////                                                             ////
22
////     THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY     ////
23
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   ////
24
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS   ////
25
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR      ////
26
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,         ////
27
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    ////
28
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE   ////
29
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR        ////
30
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  ////
31
//// LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT  ////
32
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT  ////
33
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE         ////
34
//// POSSIBILITY OF SUCH DAMAGE.                                 ////
35
////                                                             ////
36
/////////////////////////////////////////////////////////////////////
37
 
38
#ifndef USB_PHY_H
39
#define USB_PHY_H
40
 
41
#include "usb_tx_phy.h"
42
#include "usb_rx_phy.h"
43
 
44
//#define USB_ASYNC_RESET
45
 
46
SC_MODULE(usb_phy) {
47
 
48
  public:
49
 
50
        sc_in<bool>                     clk;
51
        sc_in<bool>                     rst;
52
        sc_in<bool>                     phy_tx_mode;
53
        sc_out<bool>            usb_rst;
54
        sc_out<bool>            txdp, txdn, txoe;
55
        sc_in<bool>                     rxd, rxdp, rxdn;
56
        sc_in<sc_uint<8> >      DataOut_i;
57
        sc_in<bool>                     TxValid_i;
58
        sc_out<bool>            TxReady_o;
59
        sc_out<sc_uint<8> >     DataIn_o;
60
        sc_out<bool>            RxValid_o;
61
        sc_out<bool>            RxActive_o;
62
        sc_out<bool>            RxError_o;
63
        sc_out<sc_uint<2> >     LineState_o;
64
 
65
        sc_signal<sc_uint<6> >  rst_cnt;
66
        sc_signal<bool>                 reset, fs_ce;
67
 
68
        usb_tx_phy              *i_tx_phy;
69
        usb_rx_phy              *i_rx_phy;
70
 
71
        void reset_up(void);
72
        void rst_cnt_up(void);
73
        void usb_rst_up(void);
74
//      ~usb_phy(void);
75
 
76
        SC_CTOR(usb_phy) {
77
                SC_METHOD(reset_up);
78
                sensitive << rst << usb_rst;
79
                SC_METHOD(rst_cnt_up);
80
                sensitive << clk.pos();
81
                SC_METHOD(usb_rst_up);
82
                sensitive << clk.pos();
83
 
84
                i_tx_phy = new usb_tx_phy("TX_PHY");
85
                i_tx_phy->clk(clk);
86
                i_tx_phy->rst(reset);
87
                i_tx_phy->fs_ce(fs_ce);
88
                i_tx_phy->phy_mode(phy_tx_mode);
89
                i_tx_phy->txdp(txdp);
90
                i_tx_phy->txdn(txdn);
91
                i_tx_phy->txoe(txoe);
92
                i_tx_phy->DataOut_i(DataOut_i);
93
                i_tx_phy->TxValid_i(TxValid_i);
94
                i_tx_phy->TxReady_o(TxReady_o);
95
 
96
                i_rx_phy = new usb_rx_phy("RX_PHY");
97
                i_rx_phy->clk(clk);
98
                i_rx_phy->rst(reset);
99
                i_rx_phy->fs_ce(fs_ce);
100
                i_rx_phy->rxd(rxd);
101
                i_rx_phy->rxdp(rxdp);
102
                i_rx_phy->rxdn(rxdn);
103
                i_rx_phy->DataIn_o(DataIn_o);
104
                i_rx_phy->RxValid_o(RxValid_o);
105
                i_rx_phy->RxActive_o(RxActive_o);
106
                i_rx_phy->RxError_o(RxError_o);
107
                i_rx_phy->RxEn_i(txoe);
108
                i_rx_phy->LineState(LineState_o);
109
        }
110
 
111
};
112
 
113
#endif
114
 

powered by: WebSVN 2.1.0

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