1 |
408 |
julius |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// usbHostSlave.v ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// This file is part of the usbhostslave opencores effort.
|
6 |
|
|
//// <http://www.opencores.org/cores//> ////
|
7 |
|
|
//// ////
|
8 |
|
|
//// Module Description: ////
|
9 |
|
|
//// Top level module
|
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 usbhostslave_simlib( // uncapitalised name -- jb
|
47 |
|
|
clk_i,
|
48 |
|
|
rst_i,
|
49 |
|
|
address_i,
|
50 |
|
|
data_i,
|
51 |
|
|
data_o,
|
52 |
|
|
we_i,
|
53 |
|
|
strobe_i,
|
54 |
|
|
ack_o,
|
55 |
|
|
usbClk,
|
56 |
|
|
hostSOFSentIntOut,
|
57 |
|
|
hostConnEventIntOut,
|
58 |
|
|
hostResumeIntOut,
|
59 |
|
|
hostTransDoneIntOut,
|
60 |
|
|
slaveVBusDetIntOut,
|
61 |
|
|
slaveNAKSentIntOut,
|
62 |
|
|
slaveSOFRxedIntOut,
|
63 |
|
|
slaveResetEventIntOut,
|
64 |
|
|
slaveResumeIntOut,
|
65 |
|
|
slaveTransDoneIntOut,
|
66 |
|
|
USBWireDataIn,
|
67 |
|
|
USBWireDataInTick,
|
68 |
|
|
USBWireDataOut,
|
69 |
|
|
USBWireDataOutTick,
|
70 |
|
|
USBWireCtrlOut,
|
71 |
|
|
USBFullSpeed,
|
72 |
|
|
USBDPlusPullup,
|
73 |
|
|
USBDMinusPullup,
|
74 |
|
|
vBusDetect
|
75 |
|
|
);
|
76 |
|
|
parameter HOST_FIFO_DEPTH = 64; //HOST_FIFO_DEPTH = HOST_ADDR_WIDTH^2
|
77 |
|
|
parameter HOST_FIFO_ADDR_WIDTH = 6;
|
78 |
|
|
parameter EP0_FIFO_DEPTH = 64;
|
79 |
|
|
parameter EP0_FIFO_ADDR_WIDTH = 6;
|
80 |
|
|
parameter EP1_FIFO_DEPTH = 64;
|
81 |
|
|
parameter EP1_FIFO_ADDR_WIDTH = 6;
|
82 |
|
|
parameter EP2_FIFO_DEPTH = 64;
|
83 |
|
|
parameter EP2_FIFO_ADDR_WIDTH = 6;
|
84 |
|
|
parameter EP3_FIFO_DEPTH = 64;
|
85 |
|
|
parameter EP3_FIFO_ADDR_WIDTH = 6;
|
86 |
|
|
|
87 |
|
|
input clk_i; //Wishbone bus clock. Min = usbClk/2 = 24MHz. Max 5*usbClk=240MHz
|
88 |
|
|
input rst_i; //Wishbone bus sync reset. Synchronous to 'clk_i'. Resets all logic
|
89 |
|
|
input [7:0] address_i; //Wishbone bus address in
|
90 |
|
|
input [7:0] data_i; //Wishbone bus data in
|
91 |
|
|
output [7:0] data_o; //Wishbone bus data out
|
92 |
|
|
input we_i; //Wishbone bus write enable in
|
93 |
|
|
input strobe_i; //Wishbone bus strobe in
|
94 |
|
|
output ack_o; //Wishbone bus acknowledge out
|
95 |
|
|
input usbClk; //usb clock. 48Mhz +/-0.25%
|
96 |
|
|
output hostSOFSentIntOut;
|
97 |
|
|
output hostConnEventIntOut;
|
98 |
|
|
output hostResumeIntOut;
|
99 |
|
|
output hostTransDoneIntOut;
|
100 |
|
|
output slaveSOFRxedIntOut;
|
101 |
|
|
output slaveResetEventIntOut;
|
102 |
|
|
output slaveResumeIntOut;
|
103 |
|
|
output slaveTransDoneIntOut;
|
104 |
|
|
output slaveNAKSentIntOut;
|
105 |
|
|
output slaveVBusDetIntOut;
|
106 |
|
|
input [1:0] USBWireDataIn;
|
107 |
|
|
output [1:0] USBWireDataOut;
|
108 |
|
|
output USBWireDataOutTick;
|
109 |
|
|
output USBWireDataInTick;
|
110 |
|
|
output USBWireCtrlOut;
|
111 |
|
|
output USBFullSpeed;
|
112 |
|
|
output USBDPlusPullup;
|
113 |
|
|
output USBDMinusPullup;
|
114 |
|
|
input vBusDetect;
|
115 |
|
|
|
116 |
|
|
wire clk_i;
|
117 |
|
|
wire rst_i;
|
118 |
|
|
wire [7:0] address_i;
|
119 |
|
|
wire [7:0] data_i;
|
120 |
|
|
wire [7:0] data_o;
|
121 |
|
|
wire we_i;
|
122 |
|
|
wire strobe_i;
|
123 |
|
|
wire ack_o;
|
124 |
|
|
wire usbClk;
|
125 |
|
|
wire hostSOFSentIntOut;
|
126 |
|
|
wire hostConnEventIntOut;
|
127 |
|
|
wire hostResumeIntOut;
|
128 |
|
|
wire hostTransDoneIntOut;
|
129 |
|
|
wire slaveSOFRxedIntOut;
|
130 |
|
|
wire slaveResetEventIntOut;
|
131 |
|
|
wire slaveResumeIntOut;
|
132 |
|
|
wire slaveTransDoneIntOut;
|
133 |
|
|
wire slaveNAKSentIntOut;
|
134 |
|
|
wire slaveVBusDetIntOut;
|
135 |
|
|
wire [1:0] USBWireDataIn;
|
136 |
|
|
wire [1:0] USBWireDataOut;
|
137 |
|
|
wire USBWireDataOutTick;
|
138 |
|
|
wire USBWireDataInTick;
|
139 |
|
|
wire USBWireCtrlOut;
|
140 |
|
|
wire USBFullSpeed;
|
141 |
|
|
wire USBDPlusPullup;
|
142 |
|
|
wire USBDMinusPullup;
|
143 |
|
|
wire vBusDetect;
|
144 |
|
|
|
145 |
|
|
//internal wiring
|
146 |
|
|
wire hostControlSel;
|
147 |
|
|
wire slaveControlSel;
|
148 |
|
|
wire hostRxFifoSel;
|
149 |
|
|
wire hostTxFifoSel;
|
150 |
|
|
wire hostSlaveMuxSel;
|
151 |
|
|
wire [7:0] dataFromHostControl;
|
152 |
|
|
wire [7:0] dataFromSlaveControl;
|
153 |
|
|
wire [7:0] dataFromHostRxFifo;
|
154 |
|
|
wire [7:0] dataFromHostTxFifo;
|
155 |
|
|
wire [7:0] dataFromHostSlaveMux;
|
156 |
|
|
wire hostTxFifoRE;
|
157 |
|
|
wire [7:0] hostTxFifoData;
|
158 |
|
|
wire hostTxFifoEmpty;
|
159 |
|
|
wire hostRxFifoWE;
|
160 |
|
|
wire [7:0] hostRxFifoData;
|
161 |
|
|
wire hostRxFifoFull;
|
162 |
|
|
wire [7:0] RxCtrlOut;
|
163 |
|
|
wire [7:0] RxDataFromSIE;
|
164 |
|
|
wire RxDataOutWEn;
|
165 |
|
|
wire fullSpeedBitRateFromHost;
|
166 |
|
|
wire fullSpeedBitRateFromSlave;
|
167 |
|
|
wire fullSpeedPolarityFromHost;
|
168 |
|
|
wire fullSpeedPolarityFromSlave;
|
169 |
|
|
wire SIEPortWEnFromHost;
|
170 |
|
|
wire SIEPortWEnFromSlave;
|
171 |
|
|
wire SIEPortTxRdy;
|
172 |
|
|
wire [7:0] SIEPortDataInFromHost;
|
173 |
|
|
wire [7:0] SIEPortDataInFromSlave;
|
174 |
|
|
wire [7:0] SIEPortCtrlInFromHost;
|
175 |
|
|
wire [7:0] SIEPortCtrlInFromSlave;
|
176 |
|
|
wire [1:0] connectState;
|
177 |
|
|
wire resumeDetected;
|
178 |
|
|
wire [7:0] SIEPortDataInToSIE;
|
179 |
|
|
wire SIEPortWEnToSIE;
|
180 |
|
|
wire [7:0] SIEPortCtrlInToSIE;
|
181 |
|
|
wire fullSpeedPolarityToSIE;
|
182 |
|
|
wire fullSpeedBitRateToSIE;
|
183 |
|
|
wire noActivityTimeOut;
|
184 |
|
|
wire TxFifoEP0REn;
|
185 |
|
|
wire TxFifoEP1REn;
|
186 |
|
|
wire TxFifoEP2REn;
|
187 |
|
|
wire TxFifoEP3REn;
|
188 |
|
|
wire [7:0] TxFifoEP0Data;
|
189 |
|
|
wire [7:0] TxFifoEP1Data;
|
190 |
|
|
wire [7:0] TxFifoEP2Data;
|
191 |
|
|
wire [7:0] TxFifoEP3Data;
|
192 |
|
|
wire TxFifoEP0Empty;
|
193 |
|
|
wire TxFifoEP1Empty;
|
194 |
|
|
wire TxFifoEP2Empty;
|
195 |
|
|
wire TxFifoEP3Empty;
|
196 |
|
|
wire RxFifoEP0WEn;
|
197 |
|
|
wire RxFifoEP1WEn;
|
198 |
|
|
wire RxFifoEP2WEn;
|
199 |
|
|
wire RxFifoEP3WEn;
|
200 |
|
|
wire RxFifoEP0Full;
|
201 |
|
|
wire RxFifoEP1Full;
|
202 |
|
|
wire RxFifoEP2Full;
|
203 |
|
|
wire RxFifoEP3Full;
|
204 |
|
|
wire [7:0] slaveRxFifoData;
|
205 |
|
|
wire [7:0] dataFromEP0RxFifo;
|
206 |
|
|
wire [7:0] dataFromEP1RxFifo;
|
207 |
|
|
wire [7:0] dataFromEP2RxFifo;
|
208 |
|
|
wire [7:0] dataFromEP3RxFifo;
|
209 |
|
|
wire [7:0] dataFromEP0TxFifo;
|
210 |
|
|
wire [7:0] dataFromEP1TxFifo;
|
211 |
|
|
wire [7:0] dataFromEP2TxFifo;
|
212 |
|
|
wire [7:0] dataFromEP3TxFifo;
|
213 |
|
|
wire slaveEP0RxFifoSel;
|
214 |
|
|
wire slaveEP1RxFifoSel;
|
215 |
|
|
wire slaveEP2RxFifoSel;
|
216 |
|
|
wire slaveEP3RxFifoSel;
|
217 |
|
|
wire slaveEP0TxFifoSel;
|
218 |
|
|
wire slaveEP1TxFifoSel;
|
219 |
|
|
wire slaveEP2TxFifoSel;
|
220 |
|
|
wire slaveEP3TxFifoSel;
|
221 |
|
|
wire rstSyncToBusClk;
|
222 |
|
|
wire rstSyncToUsbClk;
|
223 |
|
|
wire noActivityTimeOutEnableToSIE;
|
224 |
|
|
wire noActivityTimeOutEnableFromHost;
|
225 |
|
|
wire noActivityTimeOutEnableFromSlave;
|
226 |
|
|
wire connectSlaveToHost;
|
227 |
|
|
|
228 |
|
|
assign USBFullSpeed = fullSpeedBitRateToSIE;
|
229 |
|
|
assign USBDPlusPullup = (USBFullSpeed & connectSlaveToHost);
|
230 |
|
|
assign USBDMinusPullup = (~USBFullSpeed & connectSlaveToHost);
|
231 |
|
|
|
232 |
|
|
usbHostControl_simlib u_usbHostControl(
|
233 |
|
|
.busClk(clk_i),
|
234 |
|
|
.rstSyncToBusClk(rstSyncToBusClk),
|
235 |
|
|
.usbClk(usbClk),
|
236 |
|
|
.rstSyncToUsbClk(rstSyncToUsbClk),
|
237 |
|
|
.TxFifoRE(hostTxFifoRE),
|
238 |
|
|
.TxFifoData(hostTxFifoData),
|
239 |
|
|
.TxFifoEmpty(hostTxFifoEmpty),
|
240 |
|
|
.RxFifoWE(hostRxFifoWE),
|
241 |
|
|
.RxFifoData(hostRxFifoData),
|
242 |
|
|
.RxFifoFull(hostRxFifoFull),
|
243 |
|
|
.RxByteStatus(RxCtrlOut),
|
244 |
|
|
.RxData(RxDataFromSIE),
|
245 |
|
|
.RxDataValid(RxDataOutWEn),
|
246 |
|
|
.SIERxTimeOut(noActivityTimeOut),
|
247 |
|
|
.SIERxTimeOutEn(noActivityTimeOutEnableFromHost),
|
248 |
|
|
.fullSpeedRate(fullSpeedBitRateFromHost),
|
249 |
|
|
.fullSpeedPol(fullSpeedPolarityFromHost),
|
250 |
|
|
.HCTxPortEn(SIEPortWEnFromHost),
|
251 |
|
|
.HCTxPortRdy(SIEPortTxRdy),
|
252 |
|
|
.HCTxPortData(SIEPortDataInFromHost),
|
253 |
|
|
.HCTxPortCtrl(SIEPortCtrlInFromHost),
|
254 |
|
|
.connectStateIn(connectState),
|
255 |
|
|
.resumeDetectedIn(resumeDetected),
|
256 |
|
|
.busAddress(address_i[3:0]),
|
257 |
|
|
.busDataIn(data_i),
|
258 |
|
|
.busDataOut(dataFromHostControl),
|
259 |
|
|
.busWriteEn(we_i),
|
260 |
|
|
.busStrobe_i(strobe_i),
|
261 |
|
|
.SOFSentIntOut(hostSOFSentIntOut),
|
262 |
|
|
.connEventIntOut(hostConnEventIntOut),
|
263 |
|
|
.resumeIntOut(hostResumeIntOut),
|
264 |
|
|
.transDoneIntOut(hostTransDoneIntOut),
|
265 |
|
|
.hostControlSelect(hostControlSel) );
|
266 |
|
|
|
267 |
|
|
|
268 |
|
|
usbSlaveControl_simlib u_usbSlaveControl(
|
269 |
|
|
.busClk(clk_i),
|
270 |
|
|
.rstSyncToBusClk(rstSyncToBusClk),
|
271 |
|
|
.usbClk(usbClk),
|
272 |
|
|
.rstSyncToUsbClk(rstSyncToUsbClk),
|
273 |
|
|
.RxByteStatus(RxCtrlOut),
|
274 |
|
|
.RxData(RxDataFromSIE),
|
275 |
|
|
.RxDataValid(RxDataOutWEn),
|
276 |
|
|
.SIERxTimeOut(noActivityTimeOut),
|
277 |
|
|
.SIERxTimeOutEn(noActivityTimeOutEnableFromSlave),
|
278 |
|
|
.RxFifoData(slaveRxFifoData),
|
279 |
|
|
.connectSlaveToHost(connectSlaveToHost),
|
280 |
|
|
.fullSpeedRate(fullSpeedBitRateFromSlave),
|
281 |
|
|
.fullSpeedPol(fullSpeedPolarityFromSlave),
|
282 |
|
|
.SCTxPortEn(SIEPortWEnFromSlave),
|
283 |
|
|
.SCTxPortRdy(SIEPortTxRdy),
|
284 |
|
|
.SCTxPortData(SIEPortDataInFromSlave),
|
285 |
|
|
.SCTxPortCtrl(SIEPortCtrlInFromSlave),
|
286 |
|
|
.vBusDetect(vBusDetect),
|
287 |
|
|
.connectStateIn(connectState),
|
288 |
|
|
.resumeDetectedIn(resumeDetected),
|
289 |
|
|
.busAddress(address_i[4:0]),
|
290 |
|
|
.busDataIn(data_i),
|
291 |
|
|
.busDataOut(dataFromSlaveControl),
|
292 |
|
|
.busWriteEn(we_i),
|
293 |
|
|
.busStrobe_i(strobe_i),
|
294 |
|
|
.SOFRxedIntOut(slaveSOFRxedIntOut),
|
295 |
|
|
.resetEventIntOut(slaveResetEventIntOut),
|
296 |
|
|
.resumeIntOut(slaveResumeIntOut),
|
297 |
|
|
.transDoneIntOut(slaveTransDoneIntOut),
|
298 |
|
|
.NAKSentIntOut(slaveNAKSentIntOut),
|
299 |
|
|
.vBusDetIntOut(slaveVBusDetIntOut),
|
300 |
|
|
.slaveControlSelect(slaveControlSel),
|
301 |
|
|
.TxFifoEP0REn(TxFifoEP0REn),
|
302 |
|
|
.TxFifoEP1REn(TxFifoEP1REn),
|
303 |
|
|
.TxFifoEP2REn(TxFifoEP2REn),
|
304 |
|
|
.TxFifoEP3REn(TxFifoEP3REn),
|
305 |
|
|
.TxFifoEP0Data(TxFifoEP0Data),
|
306 |
|
|
.TxFifoEP1Data(TxFifoEP1Data),
|
307 |
|
|
.TxFifoEP2Data(TxFifoEP2Data),
|
308 |
|
|
.TxFifoEP3Data(TxFifoEP3Data),
|
309 |
|
|
.TxFifoEP0Empty(TxFifoEP0Empty),
|
310 |
|
|
.TxFifoEP1Empty(TxFifoEP1Empty),
|
311 |
|
|
.TxFifoEP2Empty(TxFifoEP2Empty),
|
312 |
|
|
.TxFifoEP3Empty(TxFifoEP3Empty),
|
313 |
|
|
.RxFifoEP0WEn(RxFifoEP0WEn),
|
314 |
|
|
.RxFifoEP1WEn(RxFifoEP1WEn),
|
315 |
|
|
.RxFifoEP2WEn(RxFifoEP2WEn),
|
316 |
|
|
.RxFifoEP3WEn(RxFifoEP3WEn),
|
317 |
|
|
.RxFifoEP0Full(RxFifoEP0Full),
|
318 |
|
|
.RxFifoEP1Full(RxFifoEP1Full),
|
319 |
|
|
.RxFifoEP2Full(RxFifoEP2Full),
|
320 |
|
|
.RxFifoEP3Full(RxFifoEP3Full)
|
321 |
|
|
);
|
322 |
|
|
|
323 |
|
|
wishBoneBI_simlib u_wishBoneBI (
|
324 |
|
|
.address(address_i),
|
325 |
|
|
.dataIn(data_i),
|
326 |
|
|
.dataOut(data_o),
|
327 |
|
|
.writeEn(we_i),
|
328 |
|
|
.strobe_i(strobe_i),
|
329 |
|
|
.ack_o(ack_o),
|
330 |
|
|
.clk(clk_i),
|
331 |
|
|
.rst(rstSyncToBusClk),
|
332 |
|
|
.hostControlSel(hostControlSel),
|
333 |
|
|
.hostRxFifoSel(hostRxFifoSel),
|
334 |
|
|
.hostTxFifoSel(hostTxFifoSel),
|
335 |
|
|
.slaveControlSel(slaveControlSel),
|
336 |
|
|
.slaveEP0RxFifoSel(slaveEP0RxFifoSel),
|
337 |
|
|
.slaveEP1RxFifoSel(slaveEP1RxFifoSel),
|
338 |
|
|
.slaveEP2RxFifoSel(slaveEP2RxFifoSel),
|
339 |
|
|
.slaveEP3RxFifoSel(slaveEP3RxFifoSel),
|
340 |
|
|
.slaveEP0TxFifoSel(slaveEP0TxFifoSel),
|
341 |
|
|
.slaveEP1TxFifoSel(slaveEP1TxFifoSel),
|
342 |
|
|
.slaveEP2TxFifoSel(slaveEP2TxFifoSel),
|
343 |
|
|
.slaveEP3TxFifoSel(slaveEP3TxFifoSel),
|
344 |
|
|
.hostSlaveMuxSel(hostSlaveMuxSel),
|
345 |
|
|
.dataFromHostControl(dataFromHostControl),
|
346 |
|
|
.dataFromHostRxFifo(dataFromHostRxFifo),
|
347 |
|
|
.dataFromHostTxFifo(dataFromHostTxFifo),
|
348 |
|
|
.dataFromSlaveControl(dataFromSlaveControl),
|
349 |
|
|
.dataFromEP0RxFifo(dataFromEP0RxFifo),
|
350 |
|
|
.dataFromEP1RxFifo(dataFromEP1RxFifo),
|
351 |
|
|
.dataFromEP2RxFifo(dataFromEP2RxFifo),
|
352 |
|
|
.dataFromEP3RxFifo(dataFromEP3RxFifo),
|
353 |
|
|
.dataFromEP0TxFifo(dataFromEP0TxFifo),
|
354 |
|
|
.dataFromEP1TxFifo(dataFromEP1TxFifo),
|
355 |
|
|
.dataFromEP2TxFifo(dataFromEP2TxFifo),
|
356 |
|
|
.dataFromEP3TxFifo(dataFromEP3TxFifo),
|
357 |
|
|
.dataFromHostSlaveMux(dataFromHostSlaveMux)
|
358 |
|
|
);
|
359 |
|
|
|
360 |
|
|
hostSlaveMux_simlib u_hostSlaveMux(
|
361 |
|
|
.SIEPortCtrlInToSIE(SIEPortCtrlInToSIE),
|
362 |
|
|
.SIEPortCtrlInFromHost(SIEPortCtrlInFromHost),
|
363 |
|
|
.SIEPortCtrlInFromSlave(SIEPortCtrlInFromSlave),
|
364 |
|
|
.SIEPortDataInToSIE(SIEPortDataInToSIE),
|
365 |
|
|
.SIEPortDataInFromHost(SIEPortDataInFromHost),
|
366 |
|
|
.SIEPortDataInFromSlave(SIEPortDataInFromSlave),
|
367 |
|
|
.SIEPortWEnToSIE(SIEPortWEnToSIE),
|
368 |
|
|
.SIEPortWEnFromHost(SIEPortWEnFromHost),
|
369 |
|
|
.SIEPortWEnFromSlave(SIEPortWEnFromSlave),
|
370 |
|
|
.fullSpeedPolarityToSIE(fullSpeedPolarityToSIE),
|
371 |
|
|
.fullSpeedPolarityFromHost(fullSpeedPolarityFromHost),
|
372 |
|
|
.fullSpeedPolarityFromSlave(fullSpeedPolarityFromSlave),
|
373 |
|
|
.fullSpeedBitRateToSIE(fullSpeedBitRateToSIE),
|
374 |
|
|
.fullSpeedBitRateFromHost(fullSpeedBitRateFromHost),
|
375 |
|
|
.fullSpeedBitRateFromSlave(fullSpeedBitRateFromSlave),
|
376 |
|
|
.noActivityTimeOutEnableToSIE(noActivityTimeOutEnableToSIE),
|
377 |
|
|
.noActivityTimeOutEnableFromHost(noActivityTimeOutEnableFromHost),
|
378 |
|
|
.noActivityTimeOutEnableFromSlave(noActivityTimeOutEnableFromSlave),
|
379 |
|
|
.dataIn(data_i),
|
380 |
|
|
.dataOut(dataFromHostSlaveMux),
|
381 |
|
|
.address(address_i[0]),
|
382 |
|
|
.writeEn(we_i),
|
383 |
|
|
.strobe_i(strobe_i),
|
384 |
|
|
.usbClk(usbClk),
|
385 |
|
|
.busClk(clk_i),
|
386 |
|
|
.hostSlaveMuxSel(hostSlaveMuxSel),
|
387 |
|
|
.rstFromWire(rst_i),
|
388 |
|
|
.rstSyncToBusClkOut(rstSyncToBusClk),
|
389 |
|
|
.rstSyncToUsbClkOut(rstSyncToUsbClk)
|
390 |
|
|
);
|
391 |
|
|
|
392 |
|
|
usbSerialInterfaceEngine_simlib u_usbSerialInterfaceEngine(
|
393 |
|
|
.clk(usbClk),
|
394 |
|
|
.rst(rstSyncToUsbClk),
|
395 |
|
|
.USBWireDataIn(USBWireDataIn),
|
396 |
|
|
.USBWireDataOut(USBWireDataOut),
|
397 |
|
|
.USBWireDataInTick(USBWireDataInTick),
|
398 |
|
|
.USBWireDataOutTick(USBWireDataOutTick),
|
399 |
|
|
.USBWireCtrlOut(USBWireCtrlOut),
|
400 |
|
|
.connectState(connectState),
|
401 |
|
|
.resumeDetected(resumeDetected),
|
402 |
|
|
.RxCtrlOut(RxCtrlOut),
|
403 |
|
|
.RxDataOutWEn(RxDataOutWEn),
|
404 |
|
|
.RxDataOut(RxDataFromSIE),
|
405 |
|
|
.SIEPortCtrlIn(SIEPortCtrlInToSIE),
|
406 |
|
|
.SIEPortDataIn(SIEPortDataInToSIE),
|
407 |
|
|
.SIEPortTxRdy(SIEPortTxRdy),
|
408 |
|
|
.SIEPortWEn(SIEPortWEnToSIE),
|
409 |
|
|
.fullSpeedPolarity(fullSpeedPolarityToSIE),
|
410 |
|
|
.fullSpeedBitRate(fullSpeedBitRateToSIE),
|
411 |
|
|
.noActivityTimeOut(noActivityTimeOut),
|
412 |
|
|
.noActivityTimeOutEnable(noActivityTimeOutEnableToSIE)
|
413 |
|
|
);
|
414 |
|
|
|
415 |
|
|
//---Host fifos
|
416 |
|
|
TxFifo_simlib #(HOST_FIFO_DEPTH, HOST_FIFO_ADDR_WIDTH) HostTxFifo (
|
417 |
|
|
.usbClk(usbClk),
|
418 |
|
|
.busClk(clk_i),
|
419 |
|
|
.rstSyncToBusClk(rstSyncToBusClk),
|
420 |
|
|
.rstSyncToUsbClk(rstSyncToUsbClk),
|
421 |
|
|
.fifoREn(hostTxFifoRE),
|
422 |
|
|
.fifoEmpty(hostTxFifoEmpty),
|
423 |
|
|
.busAddress(address_i[2:0]),
|
424 |
|
|
.busWriteEn(we_i),
|
425 |
|
|
.busStrobe_i(strobe_i),
|
426 |
|
|
.busFifoSelect(hostTxFifoSel),
|
427 |
|
|
.busDataIn(data_i),
|
428 |
|
|
.busDataOut(dataFromHostTxFifo),
|
429 |
|
|
.fifoDataOut(hostTxFifoData) );
|
430 |
|
|
|
431 |
|
|
|
432 |
|
|
RxFifo_simlib #(HOST_FIFO_DEPTH, HOST_FIFO_ADDR_WIDTH) HostRxFifo(
|
433 |
|
|
.usbClk(usbClk),
|
434 |
|
|
.busClk(clk_i),
|
435 |
|
|
.rstSyncToBusClk(rstSyncToBusClk),
|
436 |
|
|
.rstSyncToUsbClk(rstSyncToUsbClk),
|
437 |
|
|
.fifoWEn(hostRxFifoWE),
|
438 |
|
|
.fifoFull(hostRxFifoFull),
|
439 |
|
|
.busAddress(address_i[2:0]),
|
440 |
|
|
.busWriteEn(we_i),
|
441 |
|
|
.busStrobe_i(strobe_i),
|
442 |
|
|
.busFifoSelect(hostRxFifoSel),
|
443 |
|
|
.busDataIn(data_i),
|
444 |
|
|
.busDataOut(dataFromHostRxFifo),
|
445 |
|
|
.fifoDataIn(hostRxFifoData) );
|
446 |
|
|
|
447 |
|
|
//---Slave fifos
|
448 |
|
|
|
449 |
|
|
TxFifo_simlib #(EP0_FIFO_DEPTH, EP0_FIFO_ADDR_WIDTH) EP0TxFifo (
|
450 |
|
|
.usbClk(usbClk),
|
451 |
|
|
.busClk(clk_i),
|
452 |
|
|
.rstSyncToBusClk(rstSyncToBusClk),
|
453 |
|
|
.rstSyncToUsbClk(rstSyncToUsbClk),
|
454 |
|
|
.fifoREn(TxFifoEP0REn),
|
455 |
|
|
.fifoEmpty(TxFifoEP0Empty),
|
456 |
|
|
.busAddress(address_i[2:0]),
|
457 |
|
|
.busWriteEn(we_i),
|
458 |
|
|
.busStrobe_i(strobe_i),
|
459 |
|
|
.busFifoSelect(slaveEP0TxFifoSel),
|
460 |
|
|
.busDataIn(data_i),
|
461 |
|
|
.busDataOut(dataFromEP0TxFifo),
|
462 |
|
|
.fifoDataOut(TxFifoEP0Data) );
|
463 |
|
|
|
464 |
|
|
TxFifo_simlib #(EP1_FIFO_DEPTH, EP1_FIFO_ADDR_WIDTH) EP1TxFifo (
|
465 |
|
|
.usbClk(usbClk),
|
466 |
|
|
.busClk(clk_i),
|
467 |
|
|
.rstSyncToBusClk(rstSyncToBusClk),
|
468 |
|
|
.rstSyncToUsbClk(rstSyncToUsbClk),
|
469 |
|
|
.fifoREn(TxFifoEP1REn),
|
470 |
|
|
.fifoEmpty(TxFifoEP1Empty),
|
471 |
|
|
.busAddress(address_i[2:0]),
|
472 |
|
|
.busWriteEn(we_i),
|
473 |
|
|
.busStrobe_i(strobe_i),
|
474 |
|
|
.busFifoSelect(slaveEP1TxFifoSel),
|
475 |
|
|
.busDataIn(data_i),
|
476 |
|
|
.busDataOut(dataFromEP1TxFifo),
|
477 |
|
|
.fifoDataOut(TxFifoEP1Data) );
|
478 |
|
|
|
479 |
|
|
TxFifo_simlib #(EP2_FIFO_DEPTH, EP2_FIFO_ADDR_WIDTH) EP2TxFifo (
|
480 |
|
|
.usbClk(usbClk),
|
481 |
|
|
.busClk(clk_i),
|
482 |
|
|
.rstSyncToBusClk(rstSyncToBusClk),
|
483 |
|
|
.rstSyncToUsbClk(rstSyncToUsbClk),
|
484 |
|
|
.fifoREn(TxFifoEP2REn),
|
485 |
|
|
.fifoEmpty(TxFifoEP2Empty),
|
486 |
|
|
.busAddress(address_i[2:0]),
|
487 |
|
|
.busWriteEn(we_i),
|
488 |
|
|
.busStrobe_i(strobe_i),
|
489 |
|
|
.busFifoSelect(slaveEP2TxFifoSel),
|
490 |
|
|
.busDataIn(data_i),
|
491 |
|
|
.busDataOut(dataFromEP2TxFifo),
|
492 |
|
|
.fifoDataOut(TxFifoEP2Data) );
|
493 |
|
|
|
494 |
|
|
TxFifo_simlib #(EP3_FIFO_DEPTH, EP3_FIFO_ADDR_WIDTH) EP3TxFifo (
|
495 |
|
|
.usbClk(usbClk),
|
496 |
|
|
.busClk(clk_i),
|
497 |
|
|
.rstSyncToBusClk(rstSyncToBusClk),
|
498 |
|
|
.rstSyncToUsbClk(rstSyncToUsbClk),
|
499 |
|
|
.fifoREn(TxFifoEP3REn),
|
500 |
|
|
.fifoEmpty(TxFifoEP3Empty),
|
501 |
|
|
.busAddress(address_i[2:0]),
|
502 |
|
|
.busWriteEn(we_i),
|
503 |
|
|
.busStrobe_i(strobe_i),
|
504 |
|
|
.busFifoSelect(slaveEP3TxFifoSel),
|
505 |
|
|
.busDataIn(data_i),
|
506 |
|
|
.busDataOut(dataFromEP3TxFifo),
|
507 |
|
|
.fifoDataOut(TxFifoEP3Data) );
|
508 |
|
|
|
509 |
|
|
RxFifo_simlib #(EP0_FIFO_DEPTH, EP0_FIFO_ADDR_WIDTH) EP0RxFifo(
|
510 |
|
|
.usbClk(usbClk),
|
511 |
|
|
.busClk(clk_i),
|
512 |
|
|
.rstSyncToBusClk(rstSyncToBusClk),
|
513 |
|
|
.rstSyncToUsbClk(rstSyncToUsbClk),
|
514 |
|
|
.fifoWEn(RxFifoEP0WEn),
|
515 |
|
|
.fifoFull(RxFifoEP0Full),
|
516 |
|
|
.busAddress(address_i[2:0]),
|
517 |
|
|
.busWriteEn(we_i),
|
518 |
|
|
.busStrobe_i(strobe_i),
|
519 |
|
|
.busFifoSelect(slaveEP0RxFifoSel),
|
520 |
|
|
.busDataIn(data_i),
|
521 |
|
|
.busDataOut(dataFromEP0RxFifo),
|
522 |
|
|
.fifoDataIn(slaveRxFifoData) );
|
523 |
|
|
|
524 |
|
|
RxFifo_simlib #(EP1_FIFO_DEPTH, EP1_FIFO_ADDR_WIDTH) EP1RxFifo(
|
525 |
|
|
.usbClk(usbClk),
|
526 |
|
|
.busClk(clk_i),
|
527 |
|
|
.rstSyncToBusClk(rstSyncToBusClk),
|
528 |
|
|
.rstSyncToUsbClk(rstSyncToUsbClk),
|
529 |
|
|
.fifoWEn(RxFifoEP1WEn),
|
530 |
|
|
.fifoFull(RxFifoEP1Full),
|
531 |
|
|
.busAddress(address_i[2:0]),
|
532 |
|
|
.busWriteEn(we_i),
|
533 |
|
|
.busStrobe_i(strobe_i),
|
534 |
|
|
.busFifoSelect(slaveEP1RxFifoSel),
|
535 |
|
|
.busDataIn(data_i),
|
536 |
|
|
.busDataOut(dataFromEP1RxFifo),
|
537 |
|
|
.fifoDataIn(slaveRxFifoData) );
|
538 |
|
|
|
539 |
|
|
RxFifo_simlib #(EP2_FIFO_DEPTH, EP2_FIFO_ADDR_WIDTH) EP2RxFifo(
|
540 |
|
|
.usbClk(usbClk),
|
541 |
|
|
.busClk(clk_i),
|
542 |
|
|
.rstSyncToBusClk(rstSyncToBusClk),
|
543 |
|
|
.rstSyncToUsbClk(rstSyncToUsbClk),
|
544 |
|
|
.fifoWEn(RxFifoEP2WEn),
|
545 |
|
|
.fifoFull(RxFifoEP2Full),
|
546 |
|
|
.busAddress(address_i[2:0]),
|
547 |
|
|
.busWriteEn(we_i),
|
548 |
|
|
.busStrobe_i(strobe_i),
|
549 |
|
|
.busFifoSelect(slaveEP2RxFifoSel),
|
550 |
|
|
.busDataIn(data_i),
|
551 |
|
|
.busDataOut(dataFromEP2RxFifo),
|
552 |
|
|
.fifoDataIn(slaveRxFifoData) );
|
553 |
|
|
|
554 |
|
|
RxFifo_simlib #(EP3_FIFO_DEPTH, EP3_FIFO_ADDR_WIDTH) EP3RxFifo(
|
555 |
|
|
.usbClk(usbClk),
|
556 |
|
|
.busClk(clk_i),
|
557 |
|
|
.rstSyncToBusClk(rstSyncToBusClk),
|
558 |
|
|
.rstSyncToUsbClk(rstSyncToUsbClk),
|
559 |
|
|
.fifoWEn(RxFifoEP3WEn),
|
560 |
|
|
.fifoFull(RxFifoEP3Full),
|
561 |
|
|
.busAddress(address_i[2:0]),
|
562 |
|
|
.busWriteEn(we_i),
|
563 |
|
|
.busStrobe_i(strobe_i),
|
564 |
|
|
.busFifoSelect(slaveEP3RxFifoSel),
|
565 |
|
|
.busDataIn(data_i),
|
566 |
|
|
.busDataOut(dataFromEP3RxFifo),
|
567 |
|
|
.fifoDataIn(slaveRxFifoData) );
|
568 |
|
|
|
569 |
|
|
endmodule
|
570 |
|
|
|
571 |
|
|
|
572 |
|
|
|
573 |
|
|
|
574 |
|
|
|
575 |
|
|
|
576 |
|
|
|