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

Subversion Repositories usb11

[/] [usb11/] [trunk/] [rtl/] [systemc/] [usb_top.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 1.1 Top Module                                         ////
4
////  Function Interface                                         ////
5
////                                                             ////
6
////  SystemC Version: usb_top.h                                 ////
7
////  Author: Alfredo Luiz Foltran Fialho                        ////
8
////          alfoltran@ig.com.br                                ////
9
////                                                             ////
10
////                                                             ////
11
/////////////////////////////////////////////////////////////////////
12
////                                                             ////
13
//// Verilog Version: usb_8051_if.v                              ////
14
//// Copyright (C) 2003      Alfredo Luiz Foltran Fialho         ////
15
////                         alfoltran@ig.com.br                 ////
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_TOP_H
39
#define USB_TOP_H
40
 
41
#include "usb.h"
42
 
43
SC_MODULE(usb_top) {
44
 
45
  private:
46
 
47
        sc_signal<bool> vcc;
48
 
49
  public:
50
 
51
        sc_in<bool>                     clk_i;
52
        sc_in<bool>                     rst_i;
53
 
54
        // PHY Interface
55
        sc_out<bool>            tx_dp, tx_dn, tx_oe;
56
        sc_in<bool>                     rx_dp, rx_dn, rx_d;
57
 
58
        // Misc
59
        sc_out<bool>            usb_rst;
60
 
61
        // Interrupts
62
        sc_out<bool>            crc16_err;
63
 
64
        // Vendor Features
65
        sc_out<bool>            v_set_int;
66
        sc_out<bool>            v_set_feature;
67
 
68
        // USB Status
69
        sc_out<bool>            usb_busy;
70
        sc_out<sc_uint<4> >     ep_sel;
71
 
72
        // Function Interface
73
        sc_in<sc_uint<8> >      adr;
74
        sc_in<sc_uint<8> >      din;
75
        sc_out_rv<8>            dout;
76
        sc_in<bool>                     cs;
77
        sc_in<bool>                     re, we;
78
        sc_out<bool>            empty, full;
79
 
80
        // Local Signals
81
 
82
        // Vendor Signals
83
        sc_signal<sc_uint<16> > wValue;
84
        sc_signal<sc_uint<16> > wIndex;
85
        sc_signal<sc_uint<16> > vendor_data;
86
 
87
        // Endpoint Interface
88
        // EP1
89
        sc_signal<sc_uint<8> >  ep1_f_din;
90
        sc_signal<bool>                 ep1_f_we;
91
        sc_signal<bool>                 ep1_f_full;
92
 
93
        // EP2
94
        sc_signal<sc_uint<8> >  ep2_f_dout;
95
        sc_signal<bool>                 ep2_f_re;
96
        sc_signal<bool>                 ep2_f_empty;
97
 
98
        // EP3
99
        sc_signal<sc_uint<8> >  ep3_f_din;
100
        sc_signal<bool>                 ep3_f_we;
101
        sc_signal<bool>                 ep3_f_full;
102
 
103
        // EP4
104
        sc_signal<sc_uint<8> >  ep4_f_dout;
105
        sc_signal<bool>                 ep4_f_re;
106
        sc_signal<bool>                 ep4_f_empty;
107
 
108
        // EP5
109
        sc_signal<sc_uint<8> >  ep5_f_din;
110
        sc_signal<bool>                 ep5_f_we;
111
        sc_signal<bool>                 ep5_f_full;
112
 
113
        // EP6
114
        sc_signal<sc_uint<8> >  ep6_f_dout;
115
        sc_signal<bool>                 ep6_f_re;
116
        sc_signal<bool>                 ep6_f_empty;
117
 
118
        usb                                             *i_usb;                 // USB
119
 
120
        // Mux Function
121
        void mux(void);
122
 
123
        // Destructor
124
//      ~usb_top(void);
125
 
126
        SC_CTOR(usb_top) {
127
                vcc.write(true);
128
 
129
                SC_METHOD(mux);
130
                sensitive << adr << cs << din << re << we;
131
                sensitive << ep1_f_full << ep2_f_dout << ep2_f_empty;
132
                sensitive << ep3_f_full << ep4_f_dout << ep4_f_empty;
133
                sensitive << ep5_f_full << ep6_f_dout << ep6_f_empty;
134
                sensitive << wValue << wIndex;
135
 
136
                // USB Instantiation and Binding
137
                i_usb = new usb("USB");
138
                i_usb->clk_i(clk_i);
139
                i_usb->rst_i(rst_i);
140
                i_usb->tx_dp(tx_dp);
141
                i_usb->tx_dn(tx_dn);
142
                i_usb->tx_oe(tx_oe);
143
                i_usb->rx_dp(rx_dp);
144
                i_usb->rx_dn(rx_dn);
145
                i_usb->rx_d(rx_d);
146
                i_usb->phy_tx_mode(vcc);
147
                i_usb->usb_rst(usb_rst);
148
                i_usb->crc16_err(crc16_err);
149
                i_usb->v_set_int(v_set_int);
150
                i_usb->v_set_feature(v_set_feature);
151
                i_usb->wValue(wValue);
152
                i_usb->wIndex(wIndex);
153
                i_usb->vendor_data(vendor_data);
154
                i_usb->usb_busy(usb_busy);
155
                i_usb->ep_sel(ep_sel);
156
                i_usb->ep1_f_din(ep1_f_din);
157
                i_usb->ep1_f_we(ep1_f_we);
158
                i_usb->ep1_f_full(ep1_f_full);
159
                i_usb->ep2_f_dout(ep2_f_dout);
160
                i_usb->ep2_f_re(ep2_f_re);
161
                i_usb->ep2_f_empty(ep2_f_empty);
162
                i_usb->ep3_f_din(ep3_f_din);
163
                i_usb->ep3_f_we(ep3_f_we);
164
                i_usb->ep3_f_full(ep3_f_full);
165
                i_usb->ep4_f_dout(ep4_f_dout);
166
                i_usb->ep4_f_re(ep4_f_re);
167
                i_usb->ep4_f_empty(ep4_f_empty);
168
                i_usb->ep5_f_din(ep5_f_din);
169
                i_usb->ep5_f_we(ep5_f_we);
170
                i_usb->ep5_f_full(ep5_f_full);
171
                i_usb->ep6_f_dout(ep6_f_dout);
172
                i_usb->ep6_f_re(ep6_f_re);
173
                i_usb->ep6_f_empty(ep6_f_empty);
174
        }
175
 
176
};
177
 
178
#endif
179
 

powered by: WebSVN 2.1.0

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