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

Subversion Repositories usb1_funct

[/] [usb1_funct/] [trunk/] [rtl/] [verilog/] [usb1_core.v] - Blame information for rev 10

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 rudi
/////////////////////////////////////////////////////////////////////
2
////                                                             ////
3
////  USB 1.1 function IP core                                   ////
4
////                                                             ////
5
////                                                             ////
6
////  Author: Rudolf Usselmann                                   ////
7
////          rudi@asics.ws                                      ////
8
////                                                             ////
9
////                                                             ////
10
////  Downloaded from: http://www.opencores.org/cores/usb1_funct/////
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 8 rudi
//  $Id: usb1_core.v,v 1.2 2002-10-11 05:48:20 rudi Exp $
42 5 rudi
//
43 8 rudi
//  $Date: 2002-10-11 05:48:20 $
44
//  $Revision: 1.2 $
45 5 rudi
//  $Author: rudi $
46
//  $Locker:  $
47
//  $State: Exp $
48
//
49
// Change History:
50
//               $Log: not supported by cvs2svn $
51 8 rudi
//               Revision 1.1  2002/09/25 06:06:49  rudi
52
//               - Added New Top Level
53
//               - Remove old top level and associated files
54
//               - Moved FIFOs to "Generic FIFOs" project
55 5 rudi
//
56
//
57
//
58
//
59
//
60
//
61 8 rudi
//
62 5 rudi
 
63
`include "usb1_defines.v"
64
 
65
/*
66
 
67
                // USB PHY Interface
68
                tx_dp, tx_dn, tx_oe,
69
                rx_d, rx_dp, rx_dn,
70
These pins are a semi-standard interface to USB 1.1 transceivers.
71
Just match up the signal names with the IOs of the transceiver.
72
 
73
                // USB Misc
74
                phy_tx_mode, usb_rst,
75
The PHY supports single ended and differential output to the
76
transceiver Depending on which device you are using, you have
77
to tie the phy_tx_mode high or low.
78
usb_rst is asserted whenever the host signals reset on the USB
79
bus. The USB core will internally reset itself automatically.
80
This output is provided for external logic that needs to be
81
reset when the USB bus is reset.
82
 
83
                // Interrupts
84
                dropped_frame, misaligned_frame,
85
                crc16_err,
86
dropped_frame, misaligned_frame are interrupt to indicate error
87
conditions in Block Frame mode.
88
crc16_err, indicates when a crc 16 error was detected on the
89
payload of a USB packet.
90
 
91
                // Vendor Features
92
                v_set_int, v_set_feature, wValue,
93
                wIndex, vendor_data,
94
This signals allow to control vendor specific registers and logic
95
that can be manipulated and monitored via the control endpoint
96
through vendor defined commands.
97
 
98
                // USB Status
99
                usb_busy, ep_sel,
100
usb_busy is asserted when the USB core is busy transferring
101
data ep_sel indicated the endpoint that is currently busy.
102
This information might be useful if one desires to reset/clear
103
the attached FIFOs and want to do this when the endpoint is idle.
104
 
105
                // Endpoint Interface
106
This implementation supports 8 endpoints. Endpoint 0 is the
107
control endpoint and used internally. Endpoints 1-7 are available
108
to the user. replace 'N' with the endpoint number.
109
 
110
                epN_cfg,
111
This is a constant input used to configure the endpoint by ORing
112
these defines together and adding the max packet size for this
113
endpoint:
114
`IN and `OUT select the transfer direction for this endpoint
115
`ISO, `BULK and `INT determine the endpoint type
116
 
117
Example: "`BULK | `IN  | 14'd064" defines a BULK IN endpoint with
118
max packet size of 64 bytes
119
 
120
                epN_din,  epN_we, epN_full,
121
This is the OUT FIFO interface. If this is a IN endpoint, ground
122
all unused inputs and leave outputs unconnected.
123
 
124
                epN_dout, epN_re, epN_empty,
125
this is the IN FIFO interface. If this is a OUT endpoint ground
126
all unused inputs and leave outputs unconnected.
127
 
128
                epN_bf_en, epN_bf_size,
129
These two constant configure the Block Frame feature.
130
 
131
*/
132
 
133
 
134
module usb1_core(clk_i, rst_i,
135
 
136
                // USB PHY Interface
137
                tx_dp, tx_dn, tx_oe,
138
                rx_d, rx_dp, rx_dn,
139
 
140
                // USB Misc
141
                phy_tx_mode, usb_rst,
142
 
143
                // Interrupts
144
                dropped_frame, misaligned_frame,
145
                crc16_err,
146
 
147
                // Vendor Features
148
                v_set_int, v_set_feature, wValue,
149
                wIndex, vendor_data,
150
 
151
                // USB Status
152
                usb_busy, ep_sel,
153
 
154
                // Endpoint Interface
155
                ep1_cfg,
156
                ep1_din,  ep1_we, ep1_full,
157
                ep1_dout, ep1_re, ep1_empty,
158
                ep1_bf_en, ep1_bf_size,
159
 
160
                ep2_cfg,
161
                ep2_din,  ep2_we, ep2_full,
162
                ep2_dout, ep2_re, ep2_empty,
163
                ep2_bf_en, ep2_bf_size,
164
 
165
                ep3_cfg,
166
                ep3_din,  ep3_we, ep3_full,
167
                ep3_dout, ep3_re, ep3_empty,
168
                ep3_bf_en, ep3_bf_size,
169
 
170
                ep4_cfg,
171
                ep4_din,  ep4_we, ep4_full,
172
                ep4_dout, ep4_re, ep4_empty,
173
                ep4_bf_en, ep4_bf_size,
174
 
175
                ep5_cfg,
176
                ep5_din,  ep5_we, ep5_full,
177
                ep5_dout, ep5_re, ep5_empty,
178
                ep5_bf_en, ep5_bf_size,
179
 
180
                ep6_cfg,
181
                ep6_din,  ep6_we, ep6_full,
182
                ep6_dout, ep6_re, ep6_empty,
183
                ep6_bf_en, ep6_bf_size,
184
 
185
                ep7_cfg,
186
                ep7_din,  ep7_we, ep7_full,
187
                ep7_dout, ep7_re, ep7_empty,
188
                ep7_bf_en, ep7_bf_size
189
 
190
                );
191
 
192
input           clk_i;
193
input           rst_i;
194
 
195
output          tx_dp, tx_dn, tx_oe;
196
input           rx_d, rx_dp, rx_dn;
197
 
198
input           phy_tx_mode;
199
output          usb_rst;
200
output          dropped_frame, misaligned_frame;
201
output          crc16_err;
202
 
203
output          v_set_int;
204
output          v_set_feature;
205
output  [15:0]   wValue;
206
output  [15:0]   wIndex;
207
input   [15:0]   vendor_data;
208
 
209
output          usb_busy;
210
output  [3:0]    ep_sel;
211
 
212
// Endpoint Interfaces
213
input   [13:0]   ep1_cfg;
214
input   [7:0]    ep1_din;
215
output  [7:0]    ep1_dout;
216
output          ep1_we, ep1_re;
217
input           ep1_empty, ep1_full;
218
input           ep1_bf_en;
219
input   [6:0]    ep1_bf_size;
220
 
221
input   [13:0]   ep2_cfg;
222
input   [7:0]    ep2_din;
223
output  [7:0]    ep2_dout;
224
output          ep2_we, ep2_re;
225
input           ep2_empty, ep2_full;
226
input           ep2_bf_en;
227
input   [6:0]    ep2_bf_size;
228
 
229
input   [13:0]   ep3_cfg;
230
input   [7:0]    ep3_din;
231
output  [7:0]    ep3_dout;
232
output          ep3_we, ep3_re;
233
input           ep3_empty, ep3_full;
234
input           ep3_bf_en;
235
input   [6:0]    ep3_bf_size;
236
 
237
input   [13:0]   ep4_cfg;
238
input   [7:0]    ep4_din;
239
output  [7:0]    ep4_dout;
240
output          ep4_we, ep4_re;
241
input           ep4_empty, ep4_full;
242
input           ep4_bf_en;
243
input   [6:0]    ep4_bf_size;
244
 
245
input   [13:0]   ep5_cfg;
246
input   [7:0]    ep5_din;
247
output  [7:0]    ep5_dout;
248
output          ep5_we, ep5_re;
249
input           ep5_empty, ep5_full;
250
input           ep5_bf_en;
251
input   [6:0]    ep5_bf_size;
252
 
253
input   [13:0]   ep6_cfg;
254
input   [7:0]    ep6_din;
255
output  [7:0]    ep6_dout;
256
output          ep6_we, ep6_re;
257
input           ep6_empty, ep6_full;
258
input           ep6_bf_en;
259
input   [6:0]    ep6_bf_size;
260
 
261
input   [13:0]   ep7_cfg;
262
input   [7:0]    ep7_din;
263
output  [7:0]    ep7_dout;
264
output          ep7_we, ep7_re;
265
input           ep7_empty, ep7_full;
266
input           ep7_bf_en;
267
input   [6:0]    ep7_bf_size;
268
 
269
///////////////////////////////////////////////////////////////////
270
//
271
// Local Wires and Registers
272
//
273
 
274
// UTMI Interface
275
wire    [7:0]    DataOut;
276
wire            TxValid;
277
wire            TxReady;
278
wire    [7:0]    DataIn;
279
wire            RxValid;
280
wire            RxActive;
281
wire            RxError;
282
wire    [1:0]    LineState;
283
 
284
wire    [7:0]    rx_data;
285
wire            rx_valid, rx_active, rx_err;
286
wire    [7:0]    tx_data;
287
wire            tx_valid;
288
wire            tx_ready;
289
wire            tx_first;
290
wire            tx_valid_last;
291
 
292
// Internal Register File Interface
293
wire    [6:0]    funct_adr;      // This functions address (set by controller)
294
wire    [3:0]    ep_sel;         // Endpoint Number Input
295
wire            crc16_err;      // Set CRC16 error interrupt
296
wire            int_to_set;     // Set time out interrupt
297
wire            int_seqerr_set; // Set PID sequence error interrupt
298
wire    [31:0]   frm_nat;        // Frame Number and Time Register
299
wire            nse_err;        // No Such Endpoint Error
300
wire            pid_cs_err;     // PID CS error
301
wire            crc5_err;       // CRC5 Error
302
 
303
reg     [7:0]    tx_data_st;
304
wire    [7:0]    rx_data_st;
305
reg     [13:0]   cfg;
306
reg             ep_empty;
307
reg             ep_full;
308
wire    [7:0]    rx_size;
309
wire            rx_done;
310
 
311
wire    [7:0]    ep0_din;
312
wire    [7:0]    ep0_dout;
313
wire            ep0_re, ep0_we;
314
wire    [13:0]   ep0_cfg;
315
wire    [7:0]    ep0_size;
316
wire    [7:0]    ep0_ctrl_dout, ep0_ctrl_din;
317
wire            ep0_ctrl_re, ep0_ctrl_we;
318
wire    [3:0]    ep0_ctrl_stat;
319
 
320
wire            ctrl_setup, ctrl_in, ctrl_out;
321
wire            send_stall;
322
wire            token_valid;
323
reg             rst_local;              // internal reset
324
wire            dropped_frame;
325
wire            misaligned_frame;
326
wire            v_set_int;
327
wire            v_set_feature;
328
wire    [15:0]   wValue;
329
wire    [15:0]   wIndex;
330
 
331
reg             ep_bf_en;
332
reg     [6:0]    ep_bf_size;
333
wire    [6:0]    rom_adr;
334
wire    [7:0]    rom_data;
335
 
336
///////////////////////////////////////////////////////////////////
337
//
338
// Misc Logic
339
//
340
 
341
// Endpoint type and Max transfer size
342
assign ep0_cfg = `CTRL | ep0_size;
343
 
344
always @(posedge clk_i)
345
        rst_local <= #1 rst_i & ~usb_rst;
346
 
347
///////////////////////////////////////////////////////////////////
348
//
349
// Module Instantiations
350
//
351
 
352
usb_phy phy(
353
                .clk(                   clk_i                   ),
354
                .rst(                   rst_i                   ),      // ONLY external reset
355
                .phy_tx_mode(           phy_tx_mode             ),
356
                .usb_rst(               usb_rst                 ),
357
 
358
                // Transceiver Interface
359
                .rxd(                   rx_d                    ),
360
                .rxdp(                  rx_dp                   ),
361
                .rxdn(                  rx_dn                   ),
362
                .txdp(                  tx_dp                   ),
363
                .txdn(                  tx_dn                   ),
364
                .txoe(                  tx_oe                   ),
365
 
366
                // UTMI Interface
367
                .DataIn_o(              DataIn                  ),
368
                .RxValid_o(             RxValid                 ),
369
                .RxActive_o(            RxActive                ),
370
                .RxError_o(             RxError                 ),
371
                .DataOut_i(             DataOut                 ),
372
                .TxValid_i(             TxValid                 ),
373
                .TxReady_o(             TxReady                 ),
374
                .LineState_o(           LineState               )
375
                );
376
 
377
// UTMI Interface
378
usb1_utmi_if    u0(
379
                .phy_clk(               clk_i                   ),
380
                .rst(                   rst_local               ),
381
                .DataOut(               DataOut                 ),
382
                .TxValid(               TxValid                 ),
383
                .TxReady(               TxReady                 ),
384
                .RxValid(               RxValid                 ),
385
                .RxActive(              RxActive                ),
386
                .RxError(               RxError                 ),
387
                .DataIn(                DataIn                  ),
388
                .rx_data(               rx_data                 ),
389
                .rx_valid(              rx_valid                ),
390
                .rx_active(             rx_active               ),
391
                .rx_err(                rx_err                  ),
392
                .tx_data(               tx_data                 ),
393
                .tx_valid(              tx_valid                ),
394
                .tx_valid_last(         tx_valid_last           ),
395
                .tx_ready(              tx_ready                ),
396
                .tx_first(              tx_first                )
397
                );
398
 
399
// Protocol Layer
400
usb1_pl  u1(    .clk(                   clk_i                   ),
401
                .rst(                   rst_local               ),
402
                .rx_data(               rx_data                 ),
403
                .rx_valid(              rx_valid                ),
404
                .rx_active(             rx_active               ),
405
                .rx_err(                rx_err                  ),
406
                .tx_data(               tx_data                 ),
407
                .tx_valid(              tx_valid                ),
408
                .tx_valid_last(         tx_valid_last           ),
409
                .tx_ready(              tx_ready                ),
410
                .tx_first(              tx_first                ),
411
                .tx_valid_out(          TxValid                 ),
412
                .token_valid(           token_valid             ),
413
                .fa(                    funct_adr               ),
414
                .ep_sel(                ep_sel                  ),
415
                .x_busy(                usb_busy                ),
416
                .int_crc16_set(         crc16_err               ),
417
                .int_to_set(            int_to_set              ),
418
                .int_seqerr_set(        int_seqerr_set          ),
419
                .frm_nat(               frm_nat                 ),
420
                .pid_cs_err(            pid_cs_err              ),
421
                .nse_err(               nse_err                 ),
422
                .crc5_err(              crc5_err                ),
423
                .rx_size(               rx_size                 ),
424
                .rx_done(               rx_done                 ),
425
                .ctrl_setup(            ctrl_setup              ),
426
                .ctrl_in(               ctrl_in                 ),
427
                .ctrl_out(              ctrl_out                ),
428
                .ep_bf_en(              ep_bf_en                ),
429
                .ep_bf_size(            ep_bf_size              ),
430
                .dropped_frame(         dropped_frame           ),
431
                .misaligned_frame(      misaligned_frame        ),
432
                .csr(                   cfg                     ),
433
                .tx_data_st(            tx_data_st              ),
434
                .rx_data_st(            rx_data_st              ),
435
                .idma_re(               idma_re                 ),
436
                .idma_we(               idma_we                 ),
437
                .ep_empty(              ep_empty                ),
438
                .ep_full(               ep_full                 ),
439
                .send_stall(            send_stall              )
440
                );
441
 
442
usb1_ctrl  u4(  .clk(                   clk_i                   ),
443
                .rst(                   rst_local               ),
444
 
445
                .rom_adr(               rom_adr                 ),
446
                .rom_data(              rom_data                ),
447
 
448
                .ctrl_setup(            ctrl_setup              ),
449
                .ctrl_in(               ctrl_in                 ),
450
                .ctrl_out(              ctrl_out                ),
451
 
452
                .ep0_din(               ep0_ctrl_dout           ),
453
                .ep0_dout(              ep0_ctrl_din            ),
454
                .ep0_re(                ep0_ctrl_re             ),
455
                .ep0_we(                ep0_ctrl_we             ),
456
                .ep0_stat(              ep0_ctrl_stat           ),
457
                .ep0_size(              ep0_size                ),
458
 
459
                .send_stall(            send_stall              ),
460
                .frame_no(              frm_nat[26:16]          ),
461
                .funct_adr(             funct_adr               ),
462
                .configured(                                    ),
463
                .halt(                                          ),
464
 
465
                .v_set_int(             v_set_int               ),
466
                .v_set_feature(         v_set_feature           ),
467
                .wValue(                wValue                  ),
468
                .wIndex(                wIndex                  ),
469
                .vendor_data(           vendor_data             )
470
                );
471
 
472
 
473
usb1_rom1 rom1( .clk(           clk_i           ),
474
                .adr(           rom_adr         ),
475
                .dout(          rom_data        )
476
                );
477
 
478
// CTRL Endpoint FIFO
479
generic_fifo_sc_a #(8,6,0) u10(
480
                .clk(                   clk_i                   ),
481
                .rst(                   rst_i                   ),
482
                .clr(                   usb_rst                 ),
483
                .din(                   rx_data_st              ),
484
                .we(                    ep0_we                  ),
485
                .dout(                  ep0_ctrl_dout           ),
486
                .re(                    ep0_ctrl_re             ),
487
                .full_r(                                        ),
488
                .empty_r(                                       ),
489
                .full(                  ep0_full                ),
490
                .empty(                 ep0_ctrl_stat[1]        ),
491
                .full_n(                                        ),
492
                .empty_n(                                       ),
493
                .full_n_r(                                      ),
494
                .empty_n_r(                                     ),
495
                .level(                                         )
496
                );
497
 
498
generic_fifo_sc_a #(8,6,0) u11(
499
                .clk(                   clk_i                   ),
500
                .rst(                   rst_i                   ),
501
                .clr(                   usb_rst                 ),
502
                .din(                   ep0_ctrl_din            ),
503
                .we(                    ep0_ctrl_we             ),
504
                .dout(                  ep0_dout                ),
505
                .re(                    ep0_re                  ),
506
                .full_r(                                        ),
507
                .empty_r(                                       ),
508
                .full(                  ep0_ctrl_stat[2]        ),
509
                .empty(                 ep0_empty               ),
510
                .full_n(                                        ),
511
                .empty_n(                                       ),
512
                .full_n_r(                                      ),
513
                .empty_n_r(                                     ),
514
                .level(                                         )
515
                );
516
 
517
///////////////////////////////////////////////////////////////////
518
//
519
// Endpoint FIFO Interfaces
520
//
521
 
522
always @(ep_sel or ep0_cfg or ep1_cfg or ep2_cfg or ep3_cfg or
523
                ep4_cfg or ep5_cfg or ep6_cfg or ep7_cfg)
524
        case(ep_sel)    // synopsys full_case parallel_case
525
           4'h0:        cfg = ep0_cfg;
526
           4'h1:        cfg = ep1_cfg;
527
           4'h2:        cfg = ep2_cfg;
528
           4'h3:        cfg = ep3_cfg;
529
           4'h4:        cfg = ep4_cfg;
530
           4'h5:        cfg = ep5_cfg;
531
           4'h6:        cfg = ep6_cfg;
532
           4'h7:        cfg = ep7_cfg;
533
        endcase
534
 
535
// In endpoints only
536
always @(posedge clk_i)
537
        case(ep_sel)    // synopsys full_case parallel_case
538
           4'h0:        tx_data_st <= #1 ep0_dout;
539
           4'h1:        tx_data_st <= #1 ep1_din;
540
           4'h2:        tx_data_st <= #1 ep2_din;
541
           4'h3:        tx_data_st <= #1 ep3_din;
542 8 rudi
           4'h4:        tx_data_st <= #1 ep4_din;
543 5 rudi
           4'h5:        tx_data_st <= #1 ep5_din;
544
           4'h6:        tx_data_st <= #1 ep6_din;
545
           4'h7:        tx_data_st <= #1 ep7_din;
546
        endcase
547
 
548
// In endpoints only
549
always @(posedge clk_i)
550
        case(ep_sel)    // synopsys full_case parallel_case
551
           4'h0:        ep_empty <= #1 ep0_empty;
552
           4'h1:        ep_empty <= #1 ep1_empty;
553
           4'h2:        ep_empty <= #1 ep2_empty;
554
           4'h3:        ep_empty <= #1 ep3_empty;
555
           4'h4:        ep_empty <= #1 ep4_empty;
556
           4'h5:        ep_empty <= #1 ep5_empty;
557
           4'h6:        ep_empty <= #1 ep6_empty;
558
           4'h7:        ep_empty <= #1 ep7_empty;
559
        endcase
560
 
561
// OUT endpoints only
562
always @(ep_sel or ep0_full or ep1_full or ep2_full or ep3_full or
563
                ep4_full or ep5_full or ep6_full or ep7_full)
564
        case(ep_sel)    // synopsys full_case parallel_case
565
           4'h0:        ep_full = ep0_full;
566
           4'h1:        ep_full = ep1_full;
567
           4'h2:        ep_full = ep2_full;
568
           4'h3:        ep_full = ep3_full;
569
           4'h4:        ep_full = ep4_full;
570
           4'h5:        ep_full = ep5_full;
571
           4'h6:        ep_full = ep6_full;
572
           4'h7:        ep_full = ep7_full;
573
        endcase
574
 
575
always @(posedge clk_i)
576
        case(ep_sel)    // synopsys full_case parallel_case
577
           4'h0:        ep_bf_en = 1'b0;
578
           4'h1:        ep_bf_en = ep1_bf_en;
579
           4'h2:        ep_bf_en = ep2_bf_en;
580
           4'h3:        ep_bf_en = ep3_bf_en;
581
           4'h4:        ep_bf_en = ep4_bf_en;
582
           4'h5:        ep_bf_en = ep5_bf_en;
583
           4'h6:        ep_bf_en = ep6_bf_en;
584
           4'h7:        ep_bf_en = ep7_bf_en;
585
        endcase
586
 
587
always @(posedge clk_i)
588
        case(ep_sel)    // synopsys full_case parallel_case
589
           4'h1:        ep_bf_size = ep1_bf_size;
590
           4'h2:        ep_bf_size = ep2_bf_size;
591
           4'h3:        ep_bf_size = ep3_bf_size;
592
           4'h4:        ep_bf_size = ep4_bf_size;
593
           4'h5:        ep_bf_size = ep5_bf_size;
594
           4'h6:        ep_bf_size = ep6_bf_size;
595
           4'h7:        ep_bf_size = ep7_bf_size;
596
        endcase
597
 
598
assign ep1_dout = rx_data_st;
599
assign ep2_dout = rx_data_st;
600
assign ep3_dout = rx_data_st;
601
assign ep4_dout = rx_data_st;
602
assign ep5_dout = rx_data_st;
603
assign ep6_dout = rx_data_st;
604
assign ep7_dout = rx_data_st;
605
 
606
assign ep0_re = idma_re & (ep_sel == 4'h00);
607
assign ep1_re = idma_re & (ep_sel == 4'h01) & !ep1_empty;
608
assign ep2_re = idma_re & (ep_sel == 4'h02) & !ep2_empty;
609
assign ep3_re = idma_re & (ep_sel == 4'h03) & !ep3_empty;
610
assign ep4_re = idma_re & (ep_sel == 4'h04) & !ep4_empty;
611
assign ep5_re = idma_re & (ep_sel == 4'h05) & !ep5_empty;
612
assign ep6_re = idma_re & (ep_sel == 4'h06) & !ep6_empty;
613
assign ep7_re = idma_re & (ep_sel == 4'h07) & !ep7_empty;
614
 
615
assign ep0_we = idma_we & (ep_sel == 4'h00);
616
assign ep1_we = idma_we & (ep_sel == 4'h01) & !ep1_full;
617
assign ep2_we = idma_we & (ep_sel == 4'h02) & !ep2_full;
618
assign ep3_we = idma_we & (ep_sel == 4'h03) & !ep3_full;
619
assign ep4_we = idma_we & (ep_sel == 4'h04) & !ep4_full;
620
assign ep5_we = idma_we & (ep_sel == 4'h05) & !ep5_full;
621
assign ep6_we = idma_we & (ep_sel == 4'h06) & !ep6_full;
622
assign ep7_we = idma_we & (ep_sel == 4'h07) & !ep7_full;
623
 
624
endmodule
625
 

powered by: WebSVN 2.1.0

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