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

Subversion Repositories usbhostslave

[/] [usbhostslave/] [tags/] [rel_00_04_alpha/] [RTL/] [slaveController/] [usbSlaveControl.v] - Blame information for rev 40

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 5 sfielding
// $Id: usbSlaveControl.v,v 1.2 2004-12-18 14:36:21 sfielding Exp $
45 2 sfielding
//
46
// CVS Revision History
47
//
48
// $Log: not supported by cvs2svn $
49 5 sfielding
// Revision 1.1.1.1  2004/10/11 04:01:10  sfielding
50
// Created
51 2 sfielding
//
52 5 sfielding
//
53 2 sfielding
 
54
module usbSlaveControl(
55 5 sfielding
  clk, rst,
56
  //getPacket
57
  RxByteStatus, RxData, RxDataValid,
58
  SIERxTimeOut, RxFifoData,
59
  //speedCtrlMux
60
  fullSpeedRate, fullSpeedPol,
61
  //SCTxPortArbiter
62
  SCTxPortEn, SCTxPortRdy,
63
  SCTxPortData, SCTxPortCtrl,
64
  //rxStatusMonitor
65
  connectStateIn,
66
  resumeDetectedIn,
67 2 sfielding
  //USBHostControlBI 
68
  busAddress,
69
  busDataIn,
70
  busDataOut,
71
  busWriteEn,
72
  busStrobe_i,
73 5 sfielding
  SOFRxedIntOut,
74 2 sfielding
  resetEventIntOut,
75
  resumeIntOut,
76
  transDoneIntOut,
77
  NAKSentIntOut,
78
  slaveControlSelect,
79
  //fifoMux
80
  TxFifoEP0REn,
81
  TxFifoEP1REn,
82
  TxFifoEP2REn,
83
  TxFifoEP3REn,
84
  TxFifoEP0Data,
85
  TxFifoEP1Data,
86
  TxFifoEP2Data,
87
  TxFifoEP3Data,
88
  TxFifoEP0Empty,
89
  TxFifoEP1Empty,
90
  TxFifoEP2Empty,
91
  TxFifoEP3Empty,
92
  RxFifoEP0WEn,
93
  RxFifoEP1WEn,
94
  RxFifoEP2WEn,
95
  RxFifoEP3WEn,
96
  RxFifoEP0Full,
97
  RxFifoEP1Full,
98
  RxFifoEP2Full,
99
  RxFifoEP3Full
100 5 sfielding
    );
101 2 sfielding
 
102
input clk, rst;
103
//getPacket
104
input [7:0] RxByteStatus;
105
input [7:0] RxData;
106
input RxDataValid;
107
input SIERxTimeOut;
108
output [7:0] RxFifoData;
109
//speedCtrlMux
110
output fullSpeedRate;
111
output fullSpeedPol;
112
//HCTxPortArbiter
113
output SCTxPortEn;
114
input SCTxPortRdy;
115
output [7:0] SCTxPortData;
116
output [7:0] SCTxPortCtrl;
117
//rxStatusMonitor
118
input [1:0] connectStateIn;
119
input resumeDetectedIn;
120
//USBHostControlBI 
121
input [4:0] busAddress;
122
input [7:0] busDataIn;
123
output [7:0] busDataOut;
124
input busWriteEn;
125
input busStrobe_i;
126
output SOFRxedIntOut;
127
output resetEventIntOut;
128
output resumeIntOut;
129
output transDoneIntOut;
130
output NAKSentIntOut;
131
input slaveControlSelect;
132
//fifoMux
133
output TxFifoEP0REn;
134
output TxFifoEP1REn;
135
output TxFifoEP2REn;
136
output TxFifoEP3REn;
137
input [7:0] TxFifoEP0Data;
138
input [7:0] TxFifoEP1Data;
139
input [7:0] TxFifoEP2Data;
140
input [7:0] TxFifoEP3Data;
141
input TxFifoEP0Empty;
142
input TxFifoEP1Empty;
143
input TxFifoEP2Empty;
144
input TxFifoEP3Empty;
145
output RxFifoEP0WEn;
146
output RxFifoEP1WEn;
147
output RxFifoEP2WEn;
148
output RxFifoEP3WEn;
149
input RxFifoEP0Full;
150
input RxFifoEP1Full;
151
input RxFifoEP2Full;
152
input RxFifoEP3Full;
153
 
154
wire clk;
155
wire rst;
156
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
wire [3:0] endP0ControlReg;
226
wire [3:0] endP1ControlReg;
227
wire [3:0] endP2ControlReg;
228
wire [3:0] endP3ControlReg;
229
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
wire [3:0] endPControlReg;
250
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
 
267
USBSlaveControlBI u_USBSlaveControlBI
268
  (.address(busAddress),
269
  .dataIn(busDataIn),
270
  .dataOut(busDataOut),
271
  .writeEn(busWriteEn),
272
  .strobe_i(busStrobe_i),
273
  .clk(clk),
274
  .rst(rst),
275 5 sfielding
  .SOFRxedIntOut(SOFRxedIntOut),
276 2 sfielding
  .resetEventIntOut(resetEventIntOut),
277
  .resumeIntOut(resumeIntOut),
278
  .transDoneIntOut(transDoneIntOut),
279 5 sfielding
  .NAKSentIntOut(NAKSentIntOut),
280 2 sfielding
  .endP0TransTypeReg(endP0TransTypeReg),
281
  .endP0NAKTransTypeReg(endP0NAKTransTypeReg),
282
  .endP1TransTypeReg(endP1TransTypeReg),
283
  .endP1NAKTransTypeReg(endP1NAKTransTypeReg),
284
  .endP2TransTypeReg(endP2TransTypeReg),
285
  .endP2NAKTransTypeReg(endP2NAKTransTypeReg),
286
  .endP3TransTypeReg(endP3TransTypeReg),
287
  .endP3NAKTransTypeReg(endP3NAKTransTypeReg),
288
  .endP0ControlReg(endP0ControlReg),
289
  .endP1ControlReg(endP1ControlReg),
290
  .endP2ControlReg(endP2ControlReg),
291
  .endP3ControlReg(endP3ControlReg),
292
  .EP0StatusReg(endP0StatusReg),
293
  .EP1StatusReg(endP1StatusReg),
294
  .EP2StatusReg(endP2StatusReg),
295
  .EP3StatusReg(endP3StatusReg),
296
  .SCAddrReg(USBTgtAddress),
297
  .frameNum(frameNum),
298
  .connectStateIn(connectStateOut),
299 5 sfielding
  .SOFRxedIn(SOFRxed),
300 2 sfielding
  .resetEventIn(resetEventFromRxStatusMon),
301
  .resumeIntIn(resumeIntFromRxStatusMon),
302
  .transDoneIn(transDone),
303
  .NAKSentIn(NAKSent),
304
  .slaveControlSelect(slaveControlSelect),
305
  .clrEP0Ready(clrEP0Rdy),
306
  .clrEP1Ready(clrEP1Rdy),
307
  .clrEP2Ready(clrEP2Rdy),
308
  .clrEP3Ready(clrEP3Rdy),
309
  .TxLineState(directLineState),
310
  .LineDirectControlEn(directLineCtrlEn),
311
  .fullSpeedPol(fullSpeedPol),
312
  .fullSpeedRate(fullSpeedRate),
313
  .SCGlobalEn(SCGlobalEn)
314
  );
315
 
316
slavecontroller u_slavecontroller
317
  (.CRCError(CRCError),
318
  .NAKSent(NAKSent),
319
  .RxByte(RxData),
320
  .RxDataWEn(RxDataValid),
321
  .RxOverflow(RXOverflow),
322
  .RxStatus(RxByteStatus),
323
  .RxTimeOut(RXTimeOut),
324
  .SCGlobalEn(SCGlobalEn),
325
  .SOFRxed(SOFRxed),
326
  .USBEndPControlReg(endPControlReg),
327
  .USBEndPNakTransTypeReg(transTypeNAK),
328
  .USBEndPTransTypeReg(transType),
329
  .USBEndP(currEndP),
330
  .USBTgtAddress(USBTgtAddress),
331
  .bitStuffError(bitStuffError),
332
  .clk(clk),
333
  .clrEPRdy(clrEPRdy),
334
  .endPMuxErrorsWEn(endPMuxErrorsWEn),
335
  .frameNum(frameNum),
336
  .getPacketREn(getPacketREn),
337
  .getPacketRdy(getPacketRdy),
338
  .rst(rst),
339
  .sendPacketPID(slaveControllerPIDOut),
340
  .sendPacketRdy(slaveControllerReadyIn),
341
  .sendPacketWEn(slaveControllerWEnOut),
342
  .stallSent(stallSent),
343
  .transDone(transDone)
344
    );
345
 
346
 
347
endpMux u_endpMux (
348
  .clk(clk),
349
  .rst(rst),
350
  .currEndP(currEndP),
351
  .NAKSent(NAKSent),
352
  .stallSent(stallSent),
353
  .CRCError(CRCError),
354
  .bitStuffError(bitStuffError),
355
  .RxOverflow(RXOverflow),
356
  .RxTimeOut(RXTimeOut),
357
  .dataSequence(dataSequence),
358
  .ACKRxed(ACKRxed),
359
  .transType(transType),
360
  .transTypeNAK(transTypeNAK),
361
  .endPControlReg(endPControlReg),
362
  .clrEPRdy(clrEPRdy),
363
  .endPMuxErrorsWEn(endPMuxErrorsWEn),
364
  .endP0ControlReg(endP0ControlReg),
365
  .endP1ControlReg(endP1ControlReg),
366
  .endP2ControlReg(endP2ControlReg),
367
  .endP3ControlReg(endP3ControlReg),
368
  .endP0StatusReg(endP0StatusReg),
369
  .endP1StatusReg(endP1StatusReg),
370
  .endP2StatusReg(endP2StatusReg),
371
  .endP3StatusReg(endP3StatusReg),
372
  .endP0TransTypeReg(endP0TransTypeReg),
373
  .endP1TransTypeReg(endP1TransTypeReg),
374
  .endP2TransTypeReg(endP2TransTypeReg),
375
  .endP3TransTypeReg(endP3TransTypeReg),
376
  .endP0NAKTransTypeReg(endP0NAKTransTypeReg),
377
  .endP1NAKTransTypeReg(endP1NAKTransTypeReg),
378
  .endP2NAKTransTypeReg(endP2NAKTransTypeReg),
379
  .endP3NAKTransTypeReg(endP3NAKTransTypeReg),
380
  .clrEP0Rdy(clrEP0Rdy),
381
  .clrEP1Rdy(clrEP1Rdy),
382
  .clrEP2Rdy(clrEP2Rdy),
383
  .clrEP3Rdy(clrEP3Rdy)
384
    );
385
 
386
slaveSendPacket u_slaveSendPacket
387
  (.PID(slaveControllerPIDOut),
388 5 sfielding
  .SCTxPortCntl(sendPacketCntl),
389
  .SCTxPortData(sendPacketData),
390
  .SCTxPortGnt(sendPacketGnt),
391
  .SCTxPortRdy(SCTxPortArbRdyOut),
392
  .SCTxPortReq(sendPacketReq),
393
  .SCTxPortWEn(sendPacketWEn),
394
  .clk(clk),
395
  .fifoData(TxFifoData),
396
  .fifoEmpty(TxFifoEmpty),
397
  .fifoReadEn(TxFifoRE),
398
  .rst(rst),
399
  .sendPacketRdy(slaveControllerReadyIn),
400
  .sendPacketWEn(slaveControllerWEnOut) );
401 2 sfielding
 
402
slaveDirectControl u_slaveDirectControl
403 5 sfielding
  (.SCTxPortCntl(directCntlCntl),
404
  .SCTxPortData(directCntlData),
405
  .SCTxPortGnt(directCntlGnt),
406
  .SCTxPortRdy(SCTxPortArbRdyOut),
407
  .SCTxPortReq(directCntlReq),
408
  .SCTxPortWEn(directCntlWEn),
409
  .clk(clk),
410
  .directControlEn(directLineCtrlEn),
411
  .directControlLineState(directLineState),
412
  .rst(rst) );
413 2 sfielding
 
414
SCTxPortArbiter u_SCTxPortArbiter
415 5 sfielding
  (.SCTxPortCntl(SCTxPortCtrl),
416
  .SCTxPortData(SCTxPortData),
417
  .SCTxPortRdyIn(SCTxPortRdy),
418
  .SCTxPortRdyOut(SCTxPortArbRdyOut),
419
  .SCTxPortWEnable(SCTxPortEn),
420
  .clk(clk),
421
  .directCntlCntl(directCntlCntl),
422
  .directCntlData(directCntlData),
423
  .directCntlGnt(directCntlGnt),
424
  .directCntlReq(directCntlReq),
425
  .directCntlWEn(directCntlWEn),
426
  .rst(rst),
427
  .sendPacketCntl(sendPacketCntl),
428
  .sendPacketData(sendPacketData),
429
  .sendPacketGnt(sendPacketGnt),
430
  .sendPacketReq(sendPacketReq),
431
  .sendPacketWEn(sendPacketWEn) );
432 2 sfielding
 
433
 
434
slaveGetPacket u_slaveGetPacket
435
  (.ACKRxed(ACKRxed),
436
  .CRCError(CRCError),
437 5 sfielding
  .RXDataIn(RxData),
438
  .RXDataValid(RxDataValid),
439
  .RXFifoData(RxFifoData),
440
  .RXFifoFull(RxFifoFull),
441
  .RXFifoWEn(RxFifoWE),
442
  .RXPacketRdy(getPacketRdy),
443
  .RXStreamStatusIn(RxByteStatus),
444
  .RxPID(RxPID),
445
  .SIERxTimeOut(SIERxTimeOut),
446
  .clk(clk),
447 2 sfielding
  .RXOverflow(RXOverflow),
448
  .RXTimeOut(RXTimeOut),
449
  .bitStuffError(bitStuffError),
450
  .dataSequence(dataSequence),
451 5 sfielding
  .getPacketEn(getPacketREn),
452
  .rst(rst) );
453 2 sfielding
 
454 5 sfielding
slaveRxStatusMonitor  u_slaveRxStatusMonitor
455
  (.connectStateIn(connectStateIn),
456
  .connectStateOut(connectStateOut),
457
  .resumeDetectedIn(resumeDetectedIn),
458
  .resetEventOut(resetEventFromRxStatusMon),
459
  .resumeIntOut(resumeIntFromRxStatusMon),
460
  .clk(clk),
461
  .rst(rst)  );
462 2 sfielding
 
463
fifoMux u_fifoMux (
464
  .currEndP(currEndP),
465
  //TxFifo
466
  .TxFifoREn(TxFifoRE),
467
  .TxFifoEP0REn(TxFifoEP0REn),
468
  .TxFifoEP1REn(TxFifoEP1REn),
469
  .TxFifoEP2REn(TxFifoEP2REn),
470
  .TxFifoEP3REn(TxFifoEP3REn),
471
  .TxFifoData(TxFifoData),
472
  .TxFifoEP0Data(TxFifoEP0Data),
473
  .TxFifoEP1Data(TxFifoEP1Data),
474
  .TxFifoEP2Data(TxFifoEP2Data),
475
  .TxFifoEP3Data(TxFifoEP3Data),
476
  .TxFifoEmpty(TxFifoEmpty),
477
  .TxFifoEP0Empty(TxFifoEP0Empty),
478
  .TxFifoEP1Empty(TxFifoEP1Empty),
479
  .TxFifoEP2Empty(TxFifoEP2Empty),
480
  .TxFifoEP3Empty(TxFifoEP3Empty),
481
  //RxFifo
482
  .RxFifoWEn(RxFifoWE),
483
  .RxFifoEP0WEn(RxFifoEP0WEn),
484
  .RxFifoEP1WEn(RxFifoEP1WEn),
485
  .RxFifoEP2WEn(RxFifoEP2WEn),
486
  .RxFifoEP3WEn(RxFifoEP3WEn),
487
  .RxFifoFull(RxFifoFull),
488
  .RxFifoEP0Full(RxFifoEP0Full),
489
  .RxFifoEP1Full(RxFifoEP1Full),
490
  .RxFifoEP2Full(RxFifoEP2Full),
491
  .RxFifoEP3Full(RxFifoEP3Full)
492
    );
493
 
494
endmodule
495
 
496 5 sfielding
 
497
 
498 2 sfielding
 
499
 
500
 
501
 

powered by: WebSVN 2.1.0

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