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

Subversion Repositories usb11

[/] [usb11/] [trunk/] [rtl/] [systemc/] [usb_tx_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 TX PHY                                                 ////
4
////                                                             ////
5
////  SystemC Version: usb_tx_phy.h                              ////
6
////  Author: Alfredo Luiz Foltran Fialho                        ////
7
////          alfoltran@ig.com.br                                ////
8
////                                                             ////
9
////                                                             ////
10
/////////////////////////////////////////////////////////////////////
11
////                                                             ////
12
//// Verilog Version: usb_tx_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_TX_PHY_H
39
#define USB_TX_PHY_H
40
 
41
enum TX_STATE {TX_IDLE, TX_SOP, TX_DATA, TX_EOP1, TX_EOP2, TX_WAIT};
42
 
43
SC_MODULE(usb_tx_phy) {
44
 
45
  public:
46
 
47
        sc_in<bool>                     clk;
48
        sc_in<bool>                     rst;
49
        sc_in<bool>                     fs_ce;
50
        sc_in<bool>                     phy_mode;
51
        sc_out<bool>            txdp, txdn, txoe;
52
        sc_in<sc_uint<8> >      DataOut_i;
53
        sc_in<bool>                     TxValid_i;
54
        sc_out<bool>            TxReady_o;
55
 
56
        sc_signal<sc_uint<3> >  state, next_state;
57
        sc_signal<bool>                 tx_ready, tx_ready_d;
58
        sc_signal<bool>                 ld_sop_d, ld_data, ld_data_d, ld_eop_d;
59
        sc_signal<bool>                 tx_ip, tx_ip_sync;
60
        sc_signal<sc_uint<3> >  bit_cnt;
61
        sc_signal<sc_uint<8> >  hold_reg;
62
        sc_signal<bool>                 sd_raw_o;
63
        sc_signal<bool>                 hold;
64
        sc_signal<bool>                 data_done, sft_done, sft_done_r, sft_done_e, eop_done;
65
        sc_signal<sc_uint<3> >  one_cnt;
66
        sc_signal<bool>                 stuff;
67
        sc_signal<bool>                 sd_bs_o, sd_nrzi_o;
68
        sc_signal<bool>                 append_eop, append_eop_sync1, append_eop_sync2, append_eop_sync3;
69
        sc_signal<bool>                 txoe_r1, txoe_r2;
70
 
71
        void misc_logic_up1(void);
72
        void misc_logic_up2(void);
73
        void tpi_up1(void);                     // Transmit in Progress Indicator
74
        void tpi_up2(void);
75
        void tpi_up3(void);
76
        void sr_up1(void);                      // Shift Register
77
        void sr_up2(void);
78
        void sr_up3(void);
79
        void sr_up4(void);
80
        void sr_up5(void);
81
        void sr_hold_up(void);
82
        void sr_sft_done_e_up(void);
83
        void bs_up1(void);                      // Bit Stuffer
84
        void bs_up2(void);
85
        void bs_stuff_up(void);
86
        void nrzi_up(void);                     // NRZI Encoder
87
        void eop_up1(void);                     // EOP Append Logic
88
        void eop_up2(void);
89
        void eop_up3(void);
90
        void eop_up4(void);
91
        void eop_done_up(void);
92
        void oel_up1(void);                     // Output Enable Logic
93
        void oel_up2(void);
94
        void oel_up3(void);
95
        void or_up(void);                       // Output Registers
96
        void tx_statemachine(void);
97
        void tx_state_up(void);
98
 
99
        SC_CTOR(usb_tx_phy) {
100
                SC_METHOD(misc_logic_up1);
101
                sensitive << clk.pos();
102
                SC_METHOD(misc_logic_up2);
103
                sensitive << clk.pos();
104
                #ifdef USB_ASYNC_RESET
105
                        sensitive << rst.neg();
106
                #endif
107
                SC_METHOD(tpi_up1);
108
                sensitive << clk.pos();
109
                #ifdef USB_ASYNC_RESET
110
                        sensitive << rst.neg();
111
                #endif
112
                SC_METHOD(tpi_up2);
113
                sensitive << clk.pos();
114
                #ifdef USB_ASYNC_RESET
115
                        sensitive << rst.neg();
116
                #endif
117
                SC_METHOD(tpi_up3);
118
                sensitive << clk.pos();
119
                #ifdef USB_ASYNC_RESET
120
                        sensitive << rst.neg();
121
                #endif
122
                SC_METHOD(sr_up1);
123
                sensitive << clk.pos();
124
                #ifdef USB_ASYNC_RESET
125
                        sensitive << rst.neg();
126
                #endif
127
                SC_METHOD(sr_up2);
128
                sensitive << clk.pos();
129
                SC_METHOD(sr_up3);
130
                sensitive << clk.pos();
131
                SC_METHOD(sr_up4);
132
                sensitive << clk.pos();
133
                SC_METHOD(sr_up5);
134
                sensitive << clk.pos();
135
                SC_METHOD(sr_hold_up);
136
                sensitive << stuff;
137
                SC_METHOD(sr_sft_done_e_up);
138
                sensitive << sft_done << sft_done_r;
139
                SC_METHOD(bs_up1);
140
                sensitive << clk.pos();
141
                #ifdef USB_ASYNC_RESET
142
                        sensitive << rst.neg();
143
                #endif
144
                SC_METHOD(bs_up2);
145
                sensitive << clk.pos();
146
                #ifdef USB_ASYNC_RESET
147
                        sensitive << rst.neg();
148
                #endif
149
                SC_METHOD(bs_stuff_up);
150
                sensitive << one_cnt;
151
                SC_METHOD(nrzi_up);
152
                sensitive << clk.pos();
153
                #ifdef USB_ASYNC_RESET
154
                        sensitive << rst.neg();
155
                #endif
156
                SC_METHOD(eop_up1);
157
                sensitive << clk.pos();
158
                #ifdef USB_ASYNC_RESET
159
                        sensitive << rst.neg();
160
                #endif
161
                SC_METHOD(eop_up2);
162
                sensitive << clk.pos();
163
                #ifdef USB_ASYNC_RESET
164
                        sensitive << rst.neg();
165
                #endif
166
                SC_METHOD(eop_up3);
167
                sensitive << clk.pos();
168
                #ifdef USB_ASYNC_RESET
169
                        sensitive << rst.neg();
170
                #endif
171
                SC_METHOD(eop_up4);
172
                sensitive << clk.pos();
173
                #ifdef USB_ASYNC_RESET
174
                        sensitive << rst.neg();
175
                #endif
176
                SC_METHOD(eop_done_up);
177
                sensitive << append_eop_sync3;
178
                SC_METHOD(oel_up1);
179
                sensitive << clk.pos();
180
                #ifdef USB_ASYNC_RESET
181
                        sensitive << rst.neg();
182
                #endif
183
                SC_METHOD(oel_up2);
184
                sensitive << clk.pos();
185
                #ifdef USB_ASYNC_RESET
186
                        sensitive << rst.neg();
187
                #endif
188
                SC_METHOD(oel_up3);
189
                sensitive << clk.pos();
190
                #ifdef USB_ASYNC_RESET
191
                        sensitive << rst.neg();
192
                #endif
193
                SC_METHOD(or_up);
194
                sensitive << clk.pos();
195
                #ifdef USB_ASYNC_RESET
196
                        sensitive << rst.neg();
197
                #endif
198
                SC_METHOD(tx_statemachine);
199
                sensitive << state << TxValid_i << data_done << sft_done_e << eop_done << fs_ce;
200
                SC_METHOD(tx_state_up);
201
                sensitive << clk.pos();
202
                #ifdef USB_ASYNC_RESET
203
                        sensitive << rst.neg();
204
                #endif
205
        }
206
 
207
};
208
 
209
#endif

powered by: WebSVN 2.1.0

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