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

Subversion Repositories usbhostslave

[/] [usbhostslave/] [trunk/] [RTL/] [slaveController/] [usbSlaveControl.v] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 sfielding
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
//// usbSlaveControl.v                                            ////
4
////                                                              ////
5
//// This file is part of the usbhostslave opencores effort.
6
//// <http://www.opencores.org/cores//>                           ////
7
////                                                              ////
8
//// Module Description:                                          ////
9
//// 
10
////                                                              ////
11
//// To Do:                                                       ////
12
//// 
13
////                                                              ////
14
//// Author(s):                                                   ////
15
//// - Steve Fielding, sfielding@base2designs.com                 ////
16
////                                                              ////
17
//////////////////////////////////////////////////////////////////////
18
////                                                              ////
19
//// Copyright (C) 2004 Steve Fielding and OPENCORES.ORG          ////
20
////                                                              ////
21
//// This source file may be used and distributed without         ////
22
//// restriction provided that this copyright statement is not    ////
23
//// removed from the file and that any derivative work contains  ////
24
//// the original copyright notice and the associated disclaimer. ////
25
////                                                              ////
26
//// This source file is free software; you can redistribute it   ////
27
//// and/or modify it under the terms of the GNU Lesser General   ////
28
//// Public License as published by the Free Software Foundation; ////
29
//// either version 2.1 of the License, or (at your option) any   ////
30
//// later version.                                               ////
31
////                                                              ////
32
//// This source is distributed in the hope that it will be       ////
33
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
34
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
35
//// PURPOSE. See the GNU Lesser General Public License for more  ////
36
//// details.                                                     ////
37
////                                                              ////
38
//// You should have received a copy of the GNU Lesser General    ////
39
//// Public License along with this source; if not, download it   ////
40
//// from <http://www.opencores.org/lgpl.shtml>                   ////
41
////                                                              ////
42
//////////////////////////////////////////////////////////////////////
43
//
44
// $Id: usbSlaveControl.v,v 1.1.1.1 2004-10-11 04:01:10 sfielding Exp $
45
//
46
// CVS Revision History
47
//
48
// $Log: not supported by cvs2svn $
49
//
50
 
51
module usbSlaveControl(
52
        clk, rst,
53
        //getPacket
54
        RxByteStatus, RxData, RxDataValid,
55
        SIERxTimeOut, RxFifoData,
56
        //speedCtrlMux
57
        fullSpeedRate, fullSpeedPol,
58
        //SCTxPortArbiter
59
        SCTxPortEn, SCTxPortRdy,
60
        SCTxPortData, SCTxPortCtrl,
61
        //rxStatusMonitor
62
        connectStateIn,
63
        resumeDetectedIn,
64
  //USBHostControlBI 
65
  busAddress,
66
  busDataIn,
67
  busDataOut,
68
  busWriteEn,
69
  busStrobe_i,
70
        SOFRxedIntOut,
71
  resetEventIntOut,
72
  resumeIntOut,
73
  transDoneIntOut,
74
  NAKSentIntOut,
75
  slaveControlSelect,
76
  //fifoMux
77
  TxFifoEP0REn,
78
  TxFifoEP1REn,
79
  TxFifoEP2REn,
80
  TxFifoEP3REn,
81
  TxFifoEP0Data,
82
  TxFifoEP1Data,
83
  TxFifoEP2Data,
84
  TxFifoEP3Data,
85
  TxFifoEP0Empty,
86
  TxFifoEP1Empty,
87
  TxFifoEP2Empty,
88
  TxFifoEP3Empty,
89
  RxFifoEP0WEn,
90
  RxFifoEP1WEn,
91
  RxFifoEP2WEn,
92
  RxFifoEP3WEn,
93
  RxFifoEP0Full,
94
  RxFifoEP1Full,
95
  RxFifoEP2Full,
96
  RxFifoEP3Full
97
         );
98
 
99
input clk, rst;
100
//getPacket
101
input [7:0] RxByteStatus;
102
input [7:0] RxData;
103
input RxDataValid;
104
input SIERxTimeOut;
105
output [7:0] RxFifoData;
106
//speedCtrlMux
107
output fullSpeedRate;
108
output fullSpeedPol;
109
//HCTxPortArbiter
110
output SCTxPortEn;
111
input SCTxPortRdy;
112
output [7:0] SCTxPortData;
113
output [7:0] SCTxPortCtrl;
114
//rxStatusMonitor
115
input [1:0] connectStateIn;
116
input resumeDetectedIn;
117
//USBHostControlBI 
118
input [4:0] busAddress;
119
input [7:0] busDataIn;
120
output [7:0] busDataOut;
121
input busWriteEn;
122
input busStrobe_i;
123
output SOFRxedIntOut;
124
output resetEventIntOut;
125
output resumeIntOut;
126
output transDoneIntOut;
127
output NAKSentIntOut;
128
input slaveControlSelect;
129
//fifoMux
130
output TxFifoEP0REn;
131
output TxFifoEP1REn;
132
output TxFifoEP2REn;
133
output TxFifoEP3REn;
134
input [7:0] TxFifoEP0Data;
135
input [7:0] TxFifoEP1Data;
136
input [7:0] TxFifoEP2Data;
137
input [7:0] TxFifoEP3Data;
138
input TxFifoEP0Empty;
139
input TxFifoEP1Empty;
140
input TxFifoEP2Empty;
141
input TxFifoEP3Empty;
142
output RxFifoEP0WEn;
143
output RxFifoEP1WEn;
144
output RxFifoEP2WEn;
145
output RxFifoEP3WEn;
146
input RxFifoEP0Full;
147
input RxFifoEP1Full;
148
input RxFifoEP2Full;
149
input RxFifoEP3Full;
150
 
151
wire clk;
152
wire rst;
153
wire [7:0] RxByteStatus;
154
wire [7:0] RxData;
155
wire RxDataValid;
156
wire SIERxTimeOut;
157
wire [7:0] RxFifoData;
158
wire fullSpeedRate;
159
wire fullSpeedPol;
160
wire [7:0] SCTxPortData;
161
wire [7:0] SCTxPortCtrl;
162
wire [1:0] connectStateIn;
163
wire resumeDetectedIn;
164
wire [4:0] busAddress;
165
wire [7:0] busDataIn;
166
wire [7:0] busDataOut;
167
wire busWriteEn;
168
wire busStrobe_i;
169
wire SOFRxedIntOut;
170
wire resetEventIntOut;
171
wire resumeIntOut;
172
wire transDoneIntOut;
173
wire NAKSentIntOut;
174
wire slaveControlSelect;
175
wire TxFifoEP0REn;
176
wire TxFifoEP1REn;
177
wire TxFifoEP2REn;
178
wire TxFifoEP3REn;
179
wire [7:0] TxFifoEP0Data;
180
wire [7:0] TxFifoEP1Data;
181
wire [7:0] TxFifoEP2Data;
182
wire [7:0] TxFifoEP3Data;
183
wire TxFifoEP0Empty;
184
wire TxFifoEP1Empty;
185
wire TxFifoEP2Empty;
186
wire TxFifoEP3Empty;
187
wire RxFifoEP0WEn;
188
wire RxFifoEP1WEn;
189
wire RxFifoEP2WEn;
190
wire RxFifoEP3WEn;
191
wire RxFifoEP0Full;
192
wire RxFifoEP1Full;
193
wire RxFifoEP2Full;
194
wire RxFifoEP3Full;
195
 
196
//internal wiring
197
wire [7:0] directCntlCntl;
198
wire [7:0] directCntlData;
199
wire directCntlGnt;
200
wire directCntlReq;
201
wire directCntlWEn;
202
wire [7:0] sendPacketCntl;
203
wire [7:0] sendPacketData;
204
wire sendPacketGnt;
205
wire sendPacketReq;
206
wire sendPacketWEn;
207
wire SCTxPortArbRdyOut;
208
wire transDone;
209
wire [1:0] directLineState;
210
wire directLineCtrlEn;
211
wire [3:0] RxPID;
212
wire [1:0] connectStateOut;
213
wire resumeIntFromRxStatusMon;
214
wire [1:0] endP0TransTypeReg;
215
wire [1:0] endP1TransTypeReg;
216
wire [1:0] endP2TransTypeReg;
217
wire [1:0] endP3TransTypeReg;
218
wire [1:0] endP0NAKTransTypeReg;
219
wire [1:0] endP1NAKTransTypeReg;
220
wire [1:0] endP2NAKTransTypeReg;
221
wire [1:0] endP3NAKTransTypeReg;
222
wire [3:0] endP0ControlReg;
223
wire [3:0] endP1ControlReg;
224
wire [3:0] endP2ControlReg;
225
wire [3:0] endP3ControlReg;
226
wire [7:0] endP0StatusReg;
227
wire [7:0] endP1StatusReg;
228
wire [7:0] endP2StatusReg;
229
wire [7:0] endP3StatusReg;
230
wire [6:0] USBTgtAddress;
231
wire [10:0] frameNum;
232
wire clrEP0Rdy;
233
wire clrEP1Rdy;
234
wire clrEP2Rdy;
235
wire clrEP3Rdy;
236
wire SCGlobalEn;
237
wire ACKRxed;
238
wire CRCError;
239
wire RXOverflow;
240
wire RXTimeOut;
241
wire bitStuffError;
242
wire dataSequence;
243
wire stallSent;
244
wire NAKSent;
245
wire SOFRxed;
246
wire [3:0] endPControlReg;
247
wire [1:0] transTypeNAK;
248
wire [1:0] transType;
249
wire [3:0] currEndP;
250
wire getPacketREn;
251
wire getPacketRdy;
252
wire [3:0] slaveControllerPIDOut;
253
wire slaveControllerReadyIn;
254
wire slaveControllerWEnOut;
255
wire TxFifoRE;
256
wire [7:0] TxFifoData;
257
wire TxFifoEmpty;
258
wire RxFifoWE;
259
wire RxFifoFull;
260
wire resetEventFromRxStatusMon;
261
wire clrEPRdy;
262
wire endPMuxErrorsWEn;
263
 
264
USBSlaveControlBI u_USBSlaveControlBI
265
  (.address(busAddress),
266
  .dataIn(busDataIn),
267
  .dataOut(busDataOut),
268
  .writeEn(busWriteEn),
269
  .strobe_i(busStrobe_i),
270
  .clk(clk),
271
  .rst(rst),
272
        .SOFRxedIntOut(SOFRxedIntOut),
273
  .resetEventIntOut(resetEventIntOut),
274
  .resumeIntOut(resumeIntOut),
275
  .transDoneIntOut(transDoneIntOut),
276
        .NAKSentIntOut(NAKSentIntOut),
277
  .endP0TransTypeReg(endP0TransTypeReg),
278
  .endP0NAKTransTypeReg(endP0NAKTransTypeReg),
279
  .endP1TransTypeReg(endP1TransTypeReg),
280
  .endP1NAKTransTypeReg(endP1NAKTransTypeReg),
281
  .endP2TransTypeReg(endP2TransTypeReg),
282
  .endP2NAKTransTypeReg(endP2NAKTransTypeReg),
283
  .endP3TransTypeReg(endP3TransTypeReg),
284
  .endP3NAKTransTypeReg(endP3NAKTransTypeReg),
285
  .endP0ControlReg(endP0ControlReg),
286
  .endP1ControlReg(endP1ControlReg),
287
  .endP2ControlReg(endP2ControlReg),
288
  .endP3ControlReg(endP3ControlReg),
289
  .EP0StatusReg(endP0StatusReg),
290
  .EP1StatusReg(endP1StatusReg),
291
  .EP2StatusReg(endP2StatusReg),
292
  .EP3StatusReg(endP3StatusReg),
293
  .SCAddrReg(USBTgtAddress),
294
  .frameNum(frameNum),
295
  .connectStateIn(connectStateOut),
296
        .SOFRxedIn(SOFRxed),
297
  .resetEventIn(resetEventFromRxStatusMon),
298
  .resumeIntIn(resumeIntFromRxStatusMon),
299
  .transDoneIn(transDone),
300
  .NAKSentIn(NAKSent),
301
  .slaveControlSelect(slaveControlSelect),
302
  .clrEP0Ready(clrEP0Rdy),
303
  .clrEP1Ready(clrEP1Rdy),
304
  .clrEP2Ready(clrEP2Rdy),
305
  .clrEP3Ready(clrEP3Rdy),
306
  .TxLineState(directLineState),
307
  .LineDirectControlEn(directLineCtrlEn),
308
  .fullSpeedPol(fullSpeedPol),
309
  .fullSpeedRate(fullSpeedRate),
310
  .SCGlobalEn(SCGlobalEn)
311
  );
312
 
313
slavecontroller u_slavecontroller
314
  (.CRCError(CRCError),
315
  .NAKSent(NAKSent),
316
  .RxByte(RxData),
317
  .RxDataWEn(RxDataValid),
318
  .RxOverflow(RXOverflow),
319
  .RxStatus(RxByteStatus),
320
  .RxTimeOut(RXTimeOut),
321
  .SCGlobalEn(SCGlobalEn),
322
  .SOFRxed(SOFRxed),
323
  .USBEndPControlReg(endPControlReg),
324
  .USBEndPNakTransTypeReg(transTypeNAK),
325
  .USBEndPTransTypeReg(transType),
326
  .USBEndP(currEndP),
327
  .USBTgtAddress(USBTgtAddress),
328
  .bitStuffError(bitStuffError),
329
  .clk(clk),
330
  .clrEPRdy(clrEPRdy),
331
  .endPMuxErrorsWEn(endPMuxErrorsWEn),
332
  .frameNum(frameNum),
333
  .getPacketREn(getPacketREn),
334
  .getPacketRdy(getPacketRdy),
335
  .rst(rst),
336
  .sendPacketPID(slaveControllerPIDOut),
337
  .sendPacketRdy(slaveControllerReadyIn),
338
  .sendPacketWEn(slaveControllerWEnOut),
339
  .stallSent(stallSent),
340
  .transDone(transDone)
341
    );
342
 
343
 
344
endpMux u_endpMux (
345
  .clk(clk),
346
  .rst(rst),
347
  .currEndP(currEndP),
348
  .NAKSent(NAKSent),
349
  .stallSent(stallSent),
350
  .CRCError(CRCError),
351
  .bitStuffError(bitStuffError),
352
  .RxOverflow(RXOverflow),
353
  .RxTimeOut(RXTimeOut),
354
  .dataSequence(dataSequence),
355
  .ACKRxed(ACKRxed),
356
  .transType(transType),
357
  .transTypeNAK(transTypeNAK),
358
  .endPControlReg(endPControlReg),
359
  .clrEPRdy(clrEPRdy),
360
  .endPMuxErrorsWEn(endPMuxErrorsWEn),
361
  .endP0ControlReg(endP0ControlReg),
362
  .endP1ControlReg(endP1ControlReg),
363
  .endP2ControlReg(endP2ControlReg),
364
  .endP3ControlReg(endP3ControlReg),
365
  .endP0StatusReg(endP0StatusReg),
366
  .endP1StatusReg(endP1StatusReg),
367
  .endP2StatusReg(endP2StatusReg),
368
  .endP3StatusReg(endP3StatusReg),
369
  .endP0TransTypeReg(endP0TransTypeReg),
370
  .endP1TransTypeReg(endP1TransTypeReg),
371
  .endP2TransTypeReg(endP2TransTypeReg),
372
  .endP3TransTypeReg(endP3TransTypeReg),
373
  .endP0NAKTransTypeReg(endP0NAKTransTypeReg),
374
  .endP1NAKTransTypeReg(endP1NAKTransTypeReg),
375
  .endP2NAKTransTypeReg(endP2NAKTransTypeReg),
376
  .endP3NAKTransTypeReg(endP3NAKTransTypeReg),
377
  .clrEP0Rdy(clrEP0Rdy),
378
  .clrEP1Rdy(clrEP1Rdy),
379
  .clrEP2Rdy(clrEP2Rdy),
380
  .clrEP3Rdy(clrEP3Rdy)
381
    );
382
 
383
slaveSendPacket u_slaveSendPacket
384
  (.PID(slaveControllerPIDOut),
385
        .SCTxPortCntl(sendPacketCntl),
386
        .SCTxPortData(sendPacketData),
387
        .SCTxPortGnt(sendPacketGnt),
388
        .SCTxPortRdy(SCTxPortArbRdyOut),
389
        .SCTxPortReq(sendPacketReq),
390
        .SCTxPortWEn(sendPacketWEn),
391
        .clk(clk),
392
        .fifoData(TxFifoData),
393
        .fifoEmpty(TxFifoEmpty),
394
        .fifoReadEn(TxFifoRE),
395
        .rst(rst),
396
        .sendPacketRdy(slaveControllerReadyIn),
397
        .sendPacketWEn(slaveControllerWEnOut) );
398
 
399
slaveDirectControl u_slaveDirectControl
400
        (.SCTxPortCntl(directCntlCntl),
401
        .SCTxPortData(directCntlData),
402
        .SCTxPortGnt(directCntlGnt),
403
        .SCTxPortRdy(SCTxPortArbRdyOut),
404
        .SCTxPortReq(directCntlReq),
405
        .SCTxPortWEn(directCntlWEn),
406
        .clk(clk),
407
        .directControlEn(directLineCtrlEn),
408
        .directControlLineState(directLineState),
409
        .rst(rst) );
410
 
411
SCTxPortArbiter u_SCTxPortArbiter
412
        (.SCTxPortCntl(SCTxPortCtrl),
413
        .SCTxPortData(SCTxPortData),
414
        .SCTxPortRdyIn(SCTxPortRdy),
415
        .SCTxPortRdyOut(SCTxPortArbRdyOut),
416
        .SCTxPortWEnable(SCTxPortEn),
417
        .clk(clk),
418
        .directCntlCntl(directCntlCntl),
419
        .directCntlData(directCntlData),
420
        .directCntlGnt(directCntlGnt),
421
        .directCntlReq(directCntlReq),
422
        .directCntlWEn(directCntlWEn),
423
        .rst(rst),
424
        .sendPacketCntl(sendPacketCntl),
425
        .sendPacketData(sendPacketData),
426
        .sendPacketGnt(sendPacketGnt),
427
        .sendPacketReq(sendPacketReq),
428
        .sendPacketWEn(sendPacketWEn) );
429
 
430
 
431
slaveGetPacket u_slaveGetPacket
432
  (.ACKRxed(ACKRxed),
433
  .CRCError(CRCError),
434
        .RXDataIn(RxData),
435
        .RXDataValid(RxDataValid),
436
        .RXFifoData(RxFifoData),
437
        .RXFifoFull(RxFifoFull),
438
        .RXFifoWEn(RxFifoWE),
439
        .RXPacketRdy(getPacketRdy),
440
        .RXStreamStatusIn(RxByteStatus),
441
        .RxPID(RxPID),
442
        .SIERxTimeOut(SIERxTimeOut),
443
        .clk(clk),
444
  .RXOverflow(RXOverflow),
445
  .RXTimeOut(RXTimeOut),
446
  .bitStuffError(bitStuffError),
447
  .dataSequence(dataSequence),
448
        .getPacketEn(getPacketREn),
449
        .rst(rst) );
450
 
451
slaveRxStatusMonitor    u_slaveRxStatusMonitor
452
        (.connectStateIn(connectStateIn),
453
        .connectStateOut(connectStateOut),
454
        .resumeDetectedIn(resumeDetectedIn),
455
        .resetEventOut(resetEventFromRxStatusMon),
456
        .resumeIntOut(resumeIntFromRxStatusMon),
457
        .clk(clk),
458
        .rst(rst)  );
459
 
460
fifoMux u_fifoMux (
461
  .currEndP(currEndP),
462
  //TxFifo
463
  .TxFifoREn(TxFifoRE),
464
  .TxFifoEP0REn(TxFifoEP0REn),
465
  .TxFifoEP1REn(TxFifoEP1REn),
466
  .TxFifoEP2REn(TxFifoEP2REn),
467
  .TxFifoEP3REn(TxFifoEP3REn),
468
  .TxFifoData(TxFifoData),
469
  .TxFifoEP0Data(TxFifoEP0Data),
470
  .TxFifoEP1Data(TxFifoEP1Data),
471
  .TxFifoEP2Data(TxFifoEP2Data),
472
  .TxFifoEP3Data(TxFifoEP3Data),
473
  .TxFifoEmpty(TxFifoEmpty),
474
  .TxFifoEP0Empty(TxFifoEP0Empty),
475
  .TxFifoEP1Empty(TxFifoEP1Empty),
476
  .TxFifoEP2Empty(TxFifoEP2Empty),
477
  .TxFifoEP3Empty(TxFifoEP3Empty),
478
  //RxFifo
479
  .RxFifoWEn(RxFifoWE),
480
  .RxFifoEP0WEn(RxFifoEP0WEn),
481
  .RxFifoEP1WEn(RxFifoEP1WEn),
482
  .RxFifoEP2WEn(RxFifoEP2WEn),
483
  .RxFifoEP3WEn(RxFifoEP3WEn),
484
  .RxFifoFull(RxFifoFull),
485
  .RxFifoEP0Full(RxFifoEP0Full),
486
  .RxFifoEP1Full(RxFifoEP1Full),
487
  .RxFifoEP2Full(RxFifoEP2Full),
488
  .RxFifoEP3Full(RxFifoEP3Full)
489
    );
490
 
491
endmodule
492
 
493
 
494
 
495
 
496
 
497
 
498
 

powered by: WebSVN 2.1.0

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