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

Subversion Repositories usbhostslave

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

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

Line No. Rev Author Line
1 22 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
`include "timescale.v"
45
 
46
module usbSlaveControl(
47
  busClk,
48
  rstSyncToBusClk,
49
  usbClk,
50
  rstSyncToUsbClk,
51
  //getPacket
52
  RxByteStatus, RxData, RxDataValid,
53
  SIERxTimeOut, RxFifoData, SIERxTimeOutEn,
54
  //speedCtrlMux
55
  fullSpeedRate, fullSpeedPol,
56
  //SCTxPortArbiter
57
  SCTxPortEn, SCTxPortRdy,
58
  SCTxPortData, SCTxPortCtrl,
59
  //rxStatusMonitor
60
  connectStateIn,
61
  resumeDetectedIn,
62
  //USBHostControlBI 
63
  busAddress,
64
  busDataIn,
65
  busDataOut,
66
  busWriteEn,
67
  busStrobe_i,
68
  SOFRxedIntOut,
69
  resetEventIntOut,
70
  resumeIntOut,
71
  transDoneIntOut,
72
  NAKSentIntOut,
73
  slaveControlSelect,
74
  //fifoMux
75
  TxFifoEP0REn,
76
  TxFifoEP1REn,
77
  TxFifoEP2REn,
78
  TxFifoEP3REn,
79
  TxFifoEP0Data,
80
  TxFifoEP1Data,
81
  TxFifoEP2Data,
82
  TxFifoEP3Data,
83
  TxFifoEP0Empty,
84
  TxFifoEP1Empty,
85
  TxFifoEP2Empty,
86
  TxFifoEP3Empty,
87
  RxFifoEP0WEn,
88
  RxFifoEP1WEn,
89
  RxFifoEP2WEn,
90
  RxFifoEP3WEn,
91
  RxFifoEP0Full,
92
  RxFifoEP1Full,
93
  RxFifoEP2Full,
94
  RxFifoEP3Full
95
    );
96
 
97
input busClk;
98
input rstSyncToBusClk;
99
input usbClk;
100
input rstSyncToUsbClk;
101
//getPacket
102
input [7:0] RxByteStatus;
103
input [7:0] RxData;
104
input RxDataValid;
105
input SIERxTimeOut;
106
output SIERxTimeOutEn;
107
output [7:0] RxFifoData;
108
//speedCtrlMux
109
output fullSpeedRate;
110
output fullSpeedPol;
111
//HCTxPortArbiter
112
output SCTxPortEn;
113
input SCTxPortRdy;
114
output [7:0] SCTxPortData;
115
output [7:0] SCTxPortCtrl;
116
//rxStatusMonitor
117
input [1:0] connectStateIn;
118
input resumeDetectedIn;
119
//USBHostControlBI 
120
input [4:0] busAddress;
121
input [7:0] busDataIn;
122
output [7:0] busDataOut;
123
input busWriteEn;
124
input busStrobe_i;
125
output SOFRxedIntOut;
126
output resetEventIntOut;
127
output resumeIntOut;
128
output transDoneIntOut;
129
output NAKSentIntOut;
130
input slaveControlSelect;
131
//fifoMux
132
output TxFifoEP0REn;
133
output TxFifoEP1REn;
134
output TxFifoEP2REn;
135
output TxFifoEP3REn;
136
input [7:0] TxFifoEP0Data;
137
input [7:0] TxFifoEP1Data;
138
input [7:0] TxFifoEP2Data;
139
input [7:0] TxFifoEP3Data;
140
input TxFifoEP0Empty;
141
input TxFifoEP1Empty;
142
input TxFifoEP2Empty;
143
input TxFifoEP3Empty;
144
output RxFifoEP0WEn;
145
output RxFifoEP1WEn;
146
output RxFifoEP2WEn;
147
output RxFifoEP3WEn;
148
input RxFifoEP0Full;
149
input RxFifoEP1Full;
150
input RxFifoEP2Full;
151
input RxFifoEP3Full;
152
 
153
wire busClk;
154
wire rstSyncToBusClk;
155
wire usbClk;
156
wire rstSyncToUsbClk;
157
wire [7:0] RxByteStatus;
158
wire [7:0] RxData;
159
wire RxDataValid;
160
wire SIERxTimeOut;
161
wire SIERxTimeOutEn;
162
wire [7:0] RxFifoData;
163
wire fullSpeedRate;
164
wire fullSpeedPol;
165
wire [7:0] SCTxPortData;
166
wire [7:0] SCTxPortCtrl;
167
wire [1:0] connectStateIn;
168
wire resumeDetectedIn;
169
wire [4:0] busAddress;
170
wire [7:0] busDataIn;
171
wire [7:0] busDataOut;
172
wire busWriteEn;
173
wire busStrobe_i;
174
wire SOFRxedIntOut;
175
wire resetEventIntOut;
176
wire resumeIntOut;
177
wire transDoneIntOut;
178
wire NAKSentIntOut;
179
wire slaveControlSelect;
180
wire TxFifoEP0REn;
181
wire TxFifoEP1REn;
182
wire TxFifoEP2REn;
183
wire TxFifoEP3REn;
184
wire [7:0] TxFifoEP0Data;
185
wire [7:0] TxFifoEP1Data;
186
wire [7:0] TxFifoEP2Data;
187
wire [7:0] TxFifoEP3Data;
188
wire TxFifoEP0Empty;
189
wire TxFifoEP1Empty;
190
wire TxFifoEP2Empty;
191
wire TxFifoEP3Empty;
192
wire RxFifoEP0WEn;
193
wire RxFifoEP1WEn;
194
wire RxFifoEP2WEn;
195
wire RxFifoEP3WEn;
196
wire RxFifoEP0Full;
197
wire RxFifoEP1Full;
198
wire RxFifoEP2Full;
199
wire RxFifoEP3Full;
200
 
201
//internal wiring
202
wire [7:0] directCntlCntl;
203
wire [7:0] directCntlData;
204
wire directCntlGnt;
205
wire directCntlReq;
206
wire directCntlWEn;
207
wire [7:0] sendPacketCntl;
208
wire [7:0] sendPacketData;
209
wire sendPacketGnt;
210
wire sendPacketReq;
211
wire sendPacketWEn;
212
wire SCTxPortArbRdyOut;
213
wire transDone;
214
wire [1:0] directLineState;
215
wire directLineCtrlEn;
216
wire [3:0] RxPID;
217
wire [1:0] connectStateOut;
218
wire resumeIntFromRxStatusMon;
219
wire [1:0] endP0TransTypeReg;
220
wire [1:0] endP1TransTypeReg;
221
wire [1:0] endP2TransTypeReg;
222
wire [1:0] endP3TransTypeReg;
223
wire [1:0] endP0NAKTransTypeReg;
224
wire [1:0] endP1NAKTransTypeReg;
225
wire [1:0] endP2NAKTransTypeReg;
226
wire [1:0] endP3NAKTransTypeReg;
227
wire [4:0] endP0ControlReg;
228
wire [4:0] endP1ControlReg;
229
wire [4:0] endP2ControlReg;
230
wire [4:0] endP3ControlReg;
231
wire [7:0] endP0StatusReg;
232
wire [7:0] endP1StatusReg;
233
wire [7:0] endP2StatusReg;
234
wire [7:0] endP3StatusReg;
235
wire [6:0] USBTgtAddress;
236
wire [10:0] frameNum;
237
wire clrEP0Rdy;
238
wire clrEP1Rdy;
239
wire clrEP2Rdy;
240
wire clrEP3Rdy;
241
wire SCGlobalEn;
242
wire ACKRxed;
243
wire CRCError;
244
wire RXOverflow;
245
wire RXTimeOut;
246
wire bitStuffError;
247
wire dataSequence;
248
wire stallSent;
249
wire NAKSent;
250
wire SOFRxed;
251
wire [4:0] endPControlReg;
252
wire [1:0] transTypeNAK;
253
wire [1:0] transType;
254
wire [3:0] currEndP;
255
wire getPacketREn;
256
wire getPacketRdy;
257
wire [3:0] slaveControllerPIDOut;
258
wire slaveControllerReadyIn;
259
wire slaveControllerWEnOut;
260
wire TxFifoRE;
261
wire [7:0] TxFifoData;
262
wire TxFifoEmpty;
263
wire RxFifoWE;
264
wire RxFifoFull;
265
wire resetEventFromRxStatusMon;
266
wire clrEPRdy;
267
wire endPMuxErrorsWEn;
268
wire endPointReadyFromSlaveCtrlrToGetPkt;
269
 
270
USBSlaveControlBI u_USBSlaveControlBI
271
  (.address(busAddress),
272
  .dataIn(busDataIn),
273
  .dataOut(busDataOut),
274
  .writeEn(busWriteEn),
275
  .strobe_i(busStrobe_i),
276
  .busClk(busClk),
277
  .rstSyncToBusClk(rstSyncToBusClk),
278
  .usbClk(usbClk),
279
  .rstSyncToUsbClk(rstSyncToUsbClk),
280
  .SOFRxedIntOut(SOFRxedIntOut),
281
  .resetEventIntOut(resetEventIntOut),
282
  .resumeIntOut(resumeIntOut),
283
  .transDoneIntOut(transDoneIntOut),
284
  .NAKSentIntOut(NAKSentIntOut),
285
  .endP0TransTypeReg(endP0TransTypeReg),
286
  .endP0NAKTransTypeReg(endP0NAKTransTypeReg),
287
  .endP1TransTypeReg(endP1TransTypeReg),
288
  .endP1NAKTransTypeReg(endP1NAKTransTypeReg),
289
  .endP2TransTypeReg(endP2TransTypeReg),
290
  .endP2NAKTransTypeReg(endP2NAKTransTypeReg),
291
  .endP3TransTypeReg(endP3TransTypeReg),
292
  .endP3NAKTransTypeReg(endP3NAKTransTypeReg),
293
  .endP0ControlReg(endP0ControlReg),
294
  .endP1ControlReg(endP1ControlReg),
295
  .endP2ControlReg(endP2ControlReg),
296
  .endP3ControlReg(endP3ControlReg),
297
  .EP0StatusReg(endP0StatusReg),
298
  .EP1StatusReg(endP1StatusReg),
299
  .EP2StatusReg(endP2StatusReg),
300
  .EP3StatusReg(endP3StatusReg),
301
  .SCAddrReg(USBTgtAddress),
302
  .frameNum(frameNum),
303
  .connectStateIn(connectStateOut),
304
  .SOFRxedIn(SOFRxed),
305
  .resetEventIn(resetEventFromRxStatusMon),
306
  .resumeIntIn(resumeIntFromRxStatusMon),
307
  .transDoneIn(transDone),
308
  .NAKSentIn(NAKSent),
309
  .slaveControlSelect(slaveControlSelect),
310
  .clrEP0Ready(clrEP0Rdy),
311
  .clrEP1Ready(clrEP1Rdy),
312
  .clrEP2Ready(clrEP2Rdy),
313
  .clrEP3Ready(clrEP3Rdy),
314
  .TxLineState(directLineState),
315
  .LineDirectControlEn(directLineCtrlEn),
316
  .fullSpeedPol(fullSpeedPol),
317
  .fullSpeedRate(fullSpeedRate),
318
  .SCGlobalEn(SCGlobalEn)
319
  );
320
 
321
slavecontroller u_slavecontroller
322
  (.CRCError(CRCError),
323
  .NAKSent(NAKSent),
324
  .RxByte(RxData),
325
  .RxDataWEn(RxDataValid),
326
  .RxOverflow(RXOverflow),
327
  .RxStatus(RxByteStatus),
328
  .RxTimeOut(RXTimeOut),
329
  .SCGlobalEn(SCGlobalEn),
330
  .SOFRxed(SOFRxed),
331
  .USBEndPControlReg(endPControlReg),
332
  .USBEndPNakTransTypeReg(transTypeNAK),
333
  .USBEndPTransTypeReg(transType),
334
  .USBEndP(currEndP),
335
  .USBTgtAddress(USBTgtAddress),
336
  .bitStuffError(bitStuffError),
337
  .clk(usbClk),
338
  .clrEPRdy(clrEPRdy),
339
  .endPMuxErrorsWEn(endPMuxErrorsWEn),
340
  .frameNum(frameNum),
341
  .getPacketREn(getPacketREn),
342
  .getPacketRdy(getPacketRdy),
343
  .rst(rstSyncToUsbClk),
344
  .sendPacketPID(slaveControllerPIDOut),
345
  .sendPacketRdy(slaveControllerReadyIn),
346
  .sendPacketWEn(slaveControllerWEnOut),
347
  .stallSent(stallSent),
348
  .transDone(transDone),
349
  .endPointReadyToGetPkt(endPointReadyFromSlaveCtrlrToGetPkt)
350
    );
351
 
352
 
353
endpMux u_endpMux (
354
  .clk(usbClk),
355
  .rst(rstSyncToUsbClk),
356
  .currEndP(currEndP),
357
  .NAKSent(NAKSent),
358
  .stallSent(stallSent),
359
  .CRCError(CRCError),
360
  .bitStuffError(bitStuffError),
361
  .RxOverflow(RXOverflow),
362
  .RxTimeOut(RXTimeOut),
363
  .dataSequence(dataSequence),
364
  .ACKRxed(ACKRxed),
365
  .transType(transType),
366
  .transTypeNAK(transTypeNAK),
367
  .endPControlReg(endPControlReg),
368
  .clrEPRdy(clrEPRdy),
369
  .endPMuxErrorsWEn(endPMuxErrorsWEn),
370
  .endP0ControlReg(endP0ControlReg),
371
  .endP1ControlReg(endP1ControlReg),
372
  .endP2ControlReg(endP2ControlReg),
373
  .endP3ControlReg(endP3ControlReg),
374
  .endP0StatusReg(endP0StatusReg),
375
  .endP1StatusReg(endP1StatusReg),
376
  .endP2StatusReg(endP2StatusReg),
377
  .endP3StatusReg(endP3StatusReg),
378
  .endP0TransTypeReg(endP0TransTypeReg),
379
  .endP1TransTypeReg(endP1TransTypeReg),
380
  .endP2TransTypeReg(endP2TransTypeReg),
381
  .endP3TransTypeReg(endP3TransTypeReg),
382
  .endP0NAKTransTypeReg(endP0NAKTransTypeReg),
383
  .endP1NAKTransTypeReg(endP1NAKTransTypeReg),
384
  .endP2NAKTransTypeReg(endP2NAKTransTypeReg),
385
  .endP3NAKTransTypeReg(endP3NAKTransTypeReg),
386
  .clrEP0Rdy(clrEP0Rdy),
387
  .clrEP1Rdy(clrEP1Rdy),
388
  .clrEP2Rdy(clrEP2Rdy),
389
  .clrEP3Rdy(clrEP3Rdy)
390
    );
391
 
392
slaveSendPacket u_slaveSendPacket
393
  (.PID(slaveControllerPIDOut),
394
  .SCTxPortCntl(sendPacketCntl),
395
  .SCTxPortData(sendPacketData),
396
  .SCTxPortGnt(sendPacketGnt),
397
  .SCTxPortRdy(SCTxPortArbRdyOut),
398
  .SCTxPortReq(sendPacketReq),
399
  .SCTxPortWEn(sendPacketWEn),
400
  .clk(usbClk),
401
  .fifoData(TxFifoData),
402
  .fifoEmpty(TxFifoEmpty),
403
  .fifoReadEn(TxFifoRE),
404
  .rst(rstSyncToUsbClk),
405
  .sendPacketRdy(slaveControllerReadyIn),
406
  .sendPacketWEn(slaveControllerWEnOut) );
407
 
408
slaveDirectControl u_slaveDirectControl
409
  (.SCTxPortCntl(directCntlCntl),
410
  .SCTxPortData(directCntlData),
411
  .SCTxPortGnt(directCntlGnt),
412
  .SCTxPortRdy(SCTxPortArbRdyOut),
413
  .SCTxPortReq(directCntlReq),
414
  .SCTxPortWEn(directCntlWEn),
415
  .clk(usbClk),
416
  .directControlEn(directLineCtrlEn),
417
  .directControlLineState(directLineState),
418
  .rst(rstSyncToUsbClk) );
419
 
420
SCTxPortArbiter u_SCTxPortArbiter
421
  (.SCTxPortCntl(SCTxPortCtrl),
422
  .SCTxPortData(SCTxPortData),
423
  .SCTxPortRdyIn(SCTxPortRdy),
424
  .SCTxPortRdyOut(SCTxPortArbRdyOut),
425
  .SCTxPortWEnable(SCTxPortEn),
426
  .clk(usbClk),
427
  .directCntlCntl(directCntlCntl),
428
  .directCntlData(directCntlData),
429
  .directCntlGnt(directCntlGnt),
430
  .directCntlReq(directCntlReq),
431
  .directCntlWEn(directCntlWEn),
432
  .rst(rstSyncToUsbClk),
433
  .sendPacketCntl(sendPacketCntl),
434
  .sendPacketData(sendPacketData),
435
  .sendPacketGnt(sendPacketGnt),
436
  .sendPacketReq(sendPacketReq),
437
  .sendPacketWEn(sendPacketWEn) );
438
 
439
 
440
slaveGetPacket u_slaveGetPacket
441
  (.ACKRxed(ACKRxed),
442
  .CRCError(CRCError),
443
  .RXDataIn(RxData),
444
  .RXDataValid(RxDataValid),
445
  .RXFifoData(RxFifoData),
446
  .RXFifoFull(RxFifoFull),
447
  .RXFifoWEn(RxFifoWE),
448
  .RXPacketRdy(getPacketRdy),
449
  .RXStreamStatusIn(RxByteStatus),
450
  .RxPID(RxPID),
451
  .SIERxTimeOut(SIERxTimeOut),
452
  .SIERxTimeOutEn(SIERxTimeOutEn),
453
  .clk(usbClk),
454
  .RXOverflow(RXOverflow),
455
  .RXTimeOut(RXTimeOut),
456
  .bitStuffError(bitStuffError),
457
  .dataSequence(dataSequence),
458
  .getPacketEn(getPacketREn),
459
  .rst(rstSyncToUsbClk),
460
  .endPointReady(endPointReadyFromSlaveCtrlrToGetPkt)
461
  );
462
 
463
slaveRxStatusMonitor  u_slaveRxStatusMonitor
464
  (.connectStateIn(connectStateIn),
465
  .connectStateOut(connectStateOut),
466
  .resumeDetectedIn(resumeDetectedIn),
467
  .resetEventOut(resetEventFromRxStatusMon),
468
  .resumeIntOut(resumeIntFromRxStatusMon),
469
  .clk(usbClk),
470
  .rst(rstSyncToUsbClk)  );
471
 
472
fifoMux u_fifoMux (
473
  .currEndP(currEndP),
474
  //TxFifo
475
  .TxFifoREn(TxFifoRE),
476
  .TxFifoEP0REn(TxFifoEP0REn),
477
  .TxFifoEP1REn(TxFifoEP1REn),
478
  .TxFifoEP2REn(TxFifoEP2REn),
479
  .TxFifoEP3REn(TxFifoEP3REn),
480
  .TxFifoData(TxFifoData),
481
  .TxFifoEP0Data(TxFifoEP0Data),
482
  .TxFifoEP1Data(TxFifoEP1Data),
483
  .TxFifoEP2Data(TxFifoEP2Data),
484
  .TxFifoEP3Data(TxFifoEP3Data),
485
  .TxFifoEmpty(TxFifoEmpty),
486
  .TxFifoEP0Empty(TxFifoEP0Empty),
487
  .TxFifoEP1Empty(TxFifoEP1Empty),
488
  .TxFifoEP2Empty(TxFifoEP2Empty),
489
  .TxFifoEP3Empty(TxFifoEP3Empty),
490
  //RxFifo
491
  .RxFifoWEn(RxFifoWE),
492
  .RxFifoEP0WEn(RxFifoEP0WEn),
493
  .RxFifoEP1WEn(RxFifoEP1WEn),
494
  .RxFifoEP2WEn(RxFifoEP2WEn),
495
  .RxFifoEP3WEn(RxFifoEP3WEn),
496
  .RxFifoFull(RxFifoFull),
497
  .RxFifoEP0Full(RxFifoEP0Full),
498
  .RxFifoEP1Full(RxFifoEP1Full),
499
  .RxFifoEP2Full(RxFifoEP2Full),
500
  .RxFifoEP3Full(RxFifoEP3Full)
501
    );
502
 
503
endmodule
504
 
505
 
506
 
507
 
508
 
509
 
510
 

powered by: WebSVN 2.1.0

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