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

Subversion Repositories usbhostslave

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

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

powered by: WebSVN 2.1.0

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