//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// usbSlaveControl.v ////
|
//// usbSlaveControl.v ////
|
//// ////
|
//// ////
|
//// This file is part of the usbhostslave opencores effort.
|
//// This file is part of the usbhostslave opencores effort.
|
//// <http://www.opencores.org/cores//> ////
|
//// <http://www.opencores.org/cores//> ////
|
//// ////
|
//// ////
|
//// Module Description: ////
|
//// Module Description: ////
|
////
|
////
|
//// ////
|
//// ////
|
//// To Do: ////
|
//// To Do: ////
|
////
|
////
|
//// ////
|
//// ////
|
//// Author(s): ////
|
//// Author(s): ////
|
//// - Steve Fielding, sfielding@base2designs.com ////
|
//// - Steve Fielding, sfielding@base2designs.com ////
|
//// ////
|
//// ////
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// Copyright (C) 2004 Steve Fielding and OPENCORES.ORG ////
|
//// Copyright (C) 2004 Steve Fielding and OPENCORES.ORG ////
|
//// ////
|
//// ////
|
//// This source file may be used and distributed without ////
|
//// This source file may be used and distributed without ////
|
//// restriction provided that this copyright statement is not ////
|
//// restriction provided that this copyright statement is not ////
|
//// removed from the file and that any derivative work contains ////
|
//// removed from the file and that any derivative work contains ////
|
//// the original copyright notice and the associated disclaimer. ////
|
//// the original copyright notice and the associated disclaimer. ////
|
//// ////
|
//// ////
|
//// This source file is free software; you can redistribute it ////
|
//// This source file is free software; you can redistribute it ////
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
//// Public License as published by the Free Software Foundation; ////
|
//// Public License as published by the Free Software Foundation; ////
|
//// either version 2.1 of the License, or (at your option) any ////
|
//// either version 2.1 of the License, or (at your option) any ////
|
//// later version. ////
|
//// later version. ////
|
//// ////
|
//// ////
|
//// This source is distributed in the hope that it will be ////
|
//// This source is distributed in the hope that it will be ////
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
//// details. ////
|
//// details. ////
|
//// ////
|
//// ////
|
//// You should have received a copy of the GNU Lesser General ////
|
//// You should have received a copy of the GNU Lesser General ////
|
//// Public License along with this source; if not, download it ////
|
//// Public License along with this source; if not, download it ////
|
//// from <http://www.opencores.org/lgpl.shtml> ////
|
//// from <http://www.opencores.org/lgpl.shtml> ////
|
//// ////
|
//// ////
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//
|
//
|
`timescale 1ns / 1ps
|
`timescale 1ns / 1ps
|
|
|
module usbSlaveControl(
|
module usbSlaveControl(
|
clk, rst,
|
busClk,
|
|
rstSyncToBusClk,
|
|
usbClk,
|
|
rstSyncToUsbClk,
|
//getPacket
|
//getPacket
|
RxByteStatus, RxData, RxDataValid,
|
RxByteStatus, RxData, RxDataValid,
|
SIERxTimeOut, RxFifoData,
|
SIERxTimeOut, RxFifoData,
|
//speedCtrlMux
|
//speedCtrlMux
|
fullSpeedRate, fullSpeedPol,
|
fullSpeedRate, fullSpeedPol,
|
//SCTxPortArbiter
|
//SCTxPortArbiter
|
SCTxPortEn, SCTxPortRdy,
|
SCTxPortEn, SCTxPortRdy,
|
SCTxPortData, SCTxPortCtrl,
|
SCTxPortData, SCTxPortCtrl,
|
//rxStatusMonitor
|
//rxStatusMonitor
|
connectStateIn,
|
connectStateIn,
|
resumeDetectedIn,
|
resumeDetectedIn,
|
//USBHostControlBI
|
//USBHostControlBI
|
busAddress,
|
busAddress,
|
busDataIn,
|
busDataIn,
|
busDataOut,
|
busDataOut,
|
busWriteEn,
|
busWriteEn,
|
busStrobe_i,
|
busStrobe_i,
|
SOFRxedIntOut,
|
SOFRxedIntOut,
|
resetEventIntOut,
|
resetEventIntOut,
|
resumeIntOut,
|
resumeIntOut,
|
transDoneIntOut,
|
transDoneIntOut,
|
NAKSentIntOut,
|
NAKSentIntOut,
|
slaveControlSelect,
|
slaveControlSelect,
|
//fifoMux
|
//fifoMux
|
TxFifoEP0REn,
|
TxFifoEP0REn,
|
TxFifoEP1REn,
|
TxFifoEP1REn,
|
TxFifoEP2REn,
|
TxFifoEP2REn,
|
TxFifoEP3REn,
|
TxFifoEP3REn,
|
TxFifoEP0Data,
|
TxFifoEP0Data,
|
TxFifoEP1Data,
|
TxFifoEP1Data,
|
TxFifoEP2Data,
|
TxFifoEP2Data,
|
TxFifoEP3Data,
|
TxFifoEP3Data,
|
TxFifoEP0Empty,
|
TxFifoEP0Empty,
|
TxFifoEP1Empty,
|
TxFifoEP1Empty,
|
TxFifoEP2Empty,
|
TxFifoEP2Empty,
|
TxFifoEP3Empty,
|
TxFifoEP3Empty,
|
RxFifoEP0WEn,
|
RxFifoEP0WEn,
|
RxFifoEP1WEn,
|
RxFifoEP1WEn,
|
RxFifoEP2WEn,
|
RxFifoEP2WEn,
|
RxFifoEP3WEn,
|
RxFifoEP3WEn,
|
RxFifoEP0Full,
|
RxFifoEP0Full,
|
RxFifoEP1Full,
|
RxFifoEP1Full,
|
RxFifoEP2Full,
|
RxFifoEP2Full,
|
RxFifoEP3Full
|
RxFifoEP3Full
|
);
|
);
|
|
|
input clk, rst;
|
input busClk;
|
|
input rstSyncToBusClk;
|
|
input usbClk;
|
|
input rstSyncToUsbClk;
|
//getPacket
|
//getPacket
|
input [7:0] RxByteStatus;
|
input [7:0] RxByteStatus;
|
input [7:0] RxData;
|
input [7:0] RxData;
|
input RxDataValid;
|
input RxDataValid;
|
input SIERxTimeOut;
|
input SIERxTimeOut;
|
output [7:0] RxFifoData;
|
output [7:0] RxFifoData;
|
//speedCtrlMux
|
//speedCtrlMux
|
output fullSpeedRate;
|
output fullSpeedRate;
|
output fullSpeedPol;
|
output fullSpeedPol;
|
//HCTxPortArbiter
|
//HCTxPortArbiter
|
output SCTxPortEn;
|
output SCTxPortEn;
|
input SCTxPortRdy;
|
input SCTxPortRdy;
|
output [7:0] SCTxPortData;
|
output [7:0] SCTxPortData;
|
output [7:0] SCTxPortCtrl;
|
output [7:0] SCTxPortCtrl;
|
//rxStatusMonitor
|
//rxStatusMonitor
|
input [1:0] connectStateIn;
|
input [1:0] connectStateIn;
|
input resumeDetectedIn;
|
input resumeDetectedIn;
|
//USBHostControlBI
|
//USBHostControlBI
|
input [4:0] busAddress;
|
input [4:0] busAddress;
|
input [7:0] busDataIn;
|
input [7:0] busDataIn;
|
output [7:0] busDataOut;
|
output [7:0] busDataOut;
|
input busWriteEn;
|
input busWriteEn;
|
input busStrobe_i;
|
input busStrobe_i;
|
output SOFRxedIntOut;
|
output SOFRxedIntOut;
|
output resetEventIntOut;
|
output resetEventIntOut;
|
output resumeIntOut;
|
output resumeIntOut;
|
output transDoneIntOut;
|
output transDoneIntOut;
|
output NAKSentIntOut;
|
output NAKSentIntOut;
|
input slaveControlSelect;
|
input slaveControlSelect;
|
//fifoMux
|
//fifoMux
|
output TxFifoEP0REn;
|
output TxFifoEP0REn;
|
output TxFifoEP1REn;
|
output TxFifoEP1REn;
|
output TxFifoEP2REn;
|
output TxFifoEP2REn;
|
output TxFifoEP3REn;
|
output TxFifoEP3REn;
|
input [7:0] TxFifoEP0Data;
|
input [7:0] TxFifoEP0Data;
|
input [7:0] TxFifoEP1Data;
|
input [7:0] TxFifoEP1Data;
|
input [7:0] TxFifoEP2Data;
|
input [7:0] TxFifoEP2Data;
|
input [7:0] TxFifoEP3Data;
|
input [7:0] TxFifoEP3Data;
|
input TxFifoEP0Empty;
|
input TxFifoEP0Empty;
|
input TxFifoEP1Empty;
|
input TxFifoEP1Empty;
|
input TxFifoEP2Empty;
|
input TxFifoEP2Empty;
|
input TxFifoEP3Empty;
|
input TxFifoEP3Empty;
|
output RxFifoEP0WEn;
|
output RxFifoEP0WEn;
|
output RxFifoEP1WEn;
|
output RxFifoEP1WEn;
|
output RxFifoEP2WEn;
|
output RxFifoEP2WEn;
|
output RxFifoEP3WEn;
|
output RxFifoEP3WEn;
|
input RxFifoEP0Full;
|
input RxFifoEP0Full;
|
input RxFifoEP1Full;
|
input RxFifoEP1Full;
|
input RxFifoEP2Full;
|
input RxFifoEP2Full;
|
input RxFifoEP3Full;
|
input RxFifoEP3Full;
|
|
|
wire clk;
|
wire busClk;
|
wire rst;
|
wire rstSyncToBusClk;
|
|
wire usbClk;
|
|
wire rstSyncToUsbClk;
|
wire [7:0] RxByteStatus;
|
wire [7:0] RxByteStatus;
|
wire [7:0] RxData;
|
wire [7:0] RxData;
|
wire RxDataValid;
|
wire RxDataValid;
|
wire SIERxTimeOut;
|
wire SIERxTimeOut;
|
wire [7:0] RxFifoData;
|
wire [7:0] RxFifoData;
|
wire fullSpeedRate;
|
wire fullSpeedRate;
|
wire fullSpeedPol;
|
wire fullSpeedPol;
|
wire [7:0] SCTxPortData;
|
wire [7:0] SCTxPortData;
|
wire [7:0] SCTxPortCtrl;
|
wire [7:0] SCTxPortCtrl;
|
wire [1:0] connectStateIn;
|
wire [1:0] connectStateIn;
|
wire resumeDetectedIn;
|
wire resumeDetectedIn;
|
wire [4:0] busAddress;
|
wire [4:0] busAddress;
|
wire [7:0] busDataIn;
|
wire [7:0] busDataIn;
|
wire [7:0] busDataOut;
|
wire [7:0] busDataOut;
|
wire busWriteEn;
|
wire busWriteEn;
|
wire busStrobe_i;
|
wire busStrobe_i;
|
wire SOFRxedIntOut;
|
wire SOFRxedIntOut;
|
wire resetEventIntOut;
|
wire resetEventIntOut;
|
wire resumeIntOut;
|
wire resumeIntOut;
|
wire transDoneIntOut;
|
wire transDoneIntOut;
|
wire NAKSentIntOut;
|
wire NAKSentIntOut;
|
wire slaveControlSelect;
|
wire slaveControlSelect;
|
wire TxFifoEP0REn;
|
wire TxFifoEP0REn;
|
wire TxFifoEP1REn;
|
wire TxFifoEP1REn;
|
wire TxFifoEP2REn;
|
wire TxFifoEP2REn;
|
wire TxFifoEP3REn;
|
wire TxFifoEP3REn;
|
wire [7:0] TxFifoEP0Data;
|
wire [7:0] TxFifoEP0Data;
|
wire [7:0] TxFifoEP1Data;
|
wire [7:0] TxFifoEP1Data;
|
wire [7:0] TxFifoEP2Data;
|
wire [7:0] TxFifoEP2Data;
|
wire [7:0] TxFifoEP3Data;
|
wire [7:0] TxFifoEP3Data;
|
wire TxFifoEP0Empty;
|
wire TxFifoEP0Empty;
|
wire TxFifoEP1Empty;
|
wire TxFifoEP1Empty;
|
wire TxFifoEP2Empty;
|
wire TxFifoEP2Empty;
|
wire TxFifoEP3Empty;
|
wire TxFifoEP3Empty;
|
wire RxFifoEP0WEn;
|
wire RxFifoEP0WEn;
|
wire RxFifoEP1WEn;
|
wire RxFifoEP1WEn;
|
wire RxFifoEP2WEn;
|
wire RxFifoEP2WEn;
|
wire RxFifoEP3WEn;
|
wire RxFifoEP3WEn;
|
wire RxFifoEP0Full;
|
wire RxFifoEP0Full;
|
wire RxFifoEP1Full;
|
wire RxFifoEP1Full;
|
wire RxFifoEP2Full;
|
wire RxFifoEP2Full;
|
wire RxFifoEP3Full;
|
wire RxFifoEP3Full;
|
|
|
//internal wiring
|
//internal wiring
|
wire [7:0] directCntlCntl;
|
wire [7:0] directCntlCntl;
|
wire [7:0] directCntlData;
|
wire [7:0] directCntlData;
|
wire directCntlGnt;
|
wire directCntlGnt;
|
wire directCntlReq;
|
wire directCntlReq;
|
wire directCntlWEn;
|
wire directCntlWEn;
|
wire [7:0] sendPacketCntl;
|
wire [7:0] sendPacketCntl;
|
wire [7:0] sendPacketData;
|
wire [7:0] sendPacketData;
|
wire sendPacketGnt;
|
wire sendPacketGnt;
|
wire sendPacketReq;
|
wire sendPacketReq;
|
wire sendPacketWEn;
|
wire sendPacketWEn;
|
wire SCTxPortArbRdyOut;
|
wire SCTxPortArbRdyOut;
|
wire transDone;
|
wire transDone;
|
wire [1:0] directLineState;
|
wire [1:0] directLineState;
|
wire directLineCtrlEn;
|
wire directLineCtrlEn;
|
wire [3:0] RxPID;
|
wire [3:0] RxPID;
|
wire [1:0] connectStateOut;
|
wire [1:0] connectStateOut;
|
wire resumeIntFromRxStatusMon;
|
wire resumeIntFromRxStatusMon;
|
wire [1:0] endP0TransTypeReg;
|
wire [1:0] endP0TransTypeReg;
|
wire [1:0] endP1TransTypeReg;
|
wire [1:0] endP1TransTypeReg;
|
wire [1:0] endP2TransTypeReg;
|
wire [1:0] endP2TransTypeReg;
|
wire [1:0] endP3TransTypeReg;
|
wire [1:0] endP3TransTypeReg;
|
wire [1:0] endP0NAKTransTypeReg;
|
wire [1:0] endP0NAKTransTypeReg;
|
wire [1:0] endP1NAKTransTypeReg;
|
wire [1:0] endP1NAKTransTypeReg;
|
wire [1:0] endP2NAKTransTypeReg;
|
wire [1:0] endP2NAKTransTypeReg;
|
wire [1:0] endP3NAKTransTypeReg;
|
wire [1:0] endP3NAKTransTypeReg;
|
wire [4:0] endP0ControlReg;
|
wire [4:0] endP0ControlReg;
|
wire [4:0] endP1ControlReg;
|
wire [4:0] endP1ControlReg;
|
wire [4:0] endP2ControlReg;
|
wire [4:0] endP2ControlReg;
|
wire [4:0] endP3ControlReg;
|
wire [4:0] endP3ControlReg;
|
wire [7:0] endP0StatusReg;
|
wire [7:0] endP0StatusReg;
|
wire [7:0] endP1StatusReg;
|
wire [7:0] endP1StatusReg;
|
wire [7:0] endP2StatusReg;
|
wire [7:0] endP2StatusReg;
|
wire [7:0] endP3StatusReg;
|
wire [7:0] endP3StatusReg;
|
wire [6:0] USBTgtAddress;
|
wire [6:0] USBTgtAddress;
|
wire [10:0] frameNum;
|
wire [10:0] frameNum;
|
wire clrEP0Rdy;
|
wire clrEP0Rdy;
|
wire clrEP1Rdy;
|
wire clrEP1Rdy;
|
wire clrEP2Rdy;
|
wire clrEP2Rdy;
|
wire clrEP3Rdy;
|
wire clrEP3Rdy;
|
wire SCGlobalEn;
|
wire SCGlobalEn;
|
wire ACKRxed;
|
wire ACKRxed;
|
wire CRCError;
|
wire CRCError;
|
wire RXOverflow;
|
wire RXOverflow;
|
wire RXTimeOut;
|
wire RXTimeOut;
|
wire bitStuffError;
|
wire bitStuffError;
|
wire dataSequence;
|
wire dataSequence;
|
wire stallSent;
|
wire stallSent;
|
wire NAKSent;
|
wire NAKSent;
|
wire SOFRxed;
|
wire SOFRxed;
|
wire [4:0] endPControlReg;
|
wire [4:0] endPControlReg;
|
wire [1:0] transTypeNAK;
|
wire [1:0] transTypeNAK;
|
wire [1:0] transType;
|
wire [1:0] transType;
|
wire [3:0] currEndP;
|
wire [3:0] currEndP;
|
wire getPacketREn;
|
wire getPacketREn;
|
wire getPacketRdy;
|
wire getPacketRdy;
|
wire [3:0] slaveControllerPIDOut;
|
wire [3:0] slaveControllerPIDOut;
|
wire slaveControllerReadyIn;
|
wire slaveControllerReadyIn;
|
wire slaveControllerWEnOut;
|
wire slaveControllerWEnOut;
|
wire TxFifoRE;
|
wire TxFifoRE;
|
wire [7:0] TxFifoData;
|
wire [7:0] TxFifoData;
|
wire TxFifoEmpty;
|
wire TxFifoEmpty;
|
wire RxFifoWE;
|
wire RxFifoWE;
|
wire RxFifoFull;
|
wire RxFifoFull;
|
wire resetEventFromRxStatusMon;
|
wire resetEventFromRxStatusMon;
|
wire clrEPRdy;
|
wire clrEPRdy;
|
wire endPMuxErrorsWEn;
|
wire endPMuxErrorsWEn;
|
|
wire endPointReadyFromSlaveCtrlrToGetPkt;
|
|
|
USBSlaveControlBI u_USBSlaveControlBI
|
USBSlaveControlBI u_USBSlaveControlBI
|
(.address(busAddress),
|
(.address(busAddress),
|
.dataIn(busDataIn),
|
.dataIn(busDataIn),
|
.dataOut(busDataOut),
|
.dataOut(busDataOut),
|
.writeEn(busWriteEn),
|
.writeEn(busWriteEn),
|
.strobe_i(busStrobe_i),
|
.strobe_i(busStrobe_i),
|
.clk(clk),
|
.busClk(busClk),
|
.rst(rst),
|
.rstSyncToBusClk(rstSyncToBusClk),
|
|
.usbClk(usbClk),
|
|
.rstSyncToUsbClk(rstSyncToUsbClk),
|
.SOFRxedIntOut(SOFRxedIntOut),
|
.SOFRxedIntOut(SOFRxedIntOut),
|
.resetEventIntOut(resetEventIntOut),
|
.resetEventIntOut(resetEventIntOut),
|
.resumeIntOut(resumeIntOut),
|
.resumeIntOut(resumeIntOut),
|
.transDoneIntOut(transDoneIntOut),
|
.transDoneIntOut(transDoneIntOut),
|
.NAKSentIntOut(NAKSentIntOut),
|
.NAKSentIntOut(NAKSentIntOut),
|
.endP0TransTypeReg(endP0TransTypeReg),
|
.endP0TransTypeReg(endP0TransTypeReg),
|
.endP0NAKTransTypeReg(endP0NAKTransTypeReg),
|
.endP0NAKTransTypeReg(endP0NAKTransTypeReg),
|
.endP1TransTypeReg(endP1TransTypeReg),
|
.endP1TransTypeReg(endP1TransTypeReg),
|
.endP1NAKTransTypeReg(endP1NAKTransTypeReg),
|
.endP1NAKTransTypeReg(endP1NAKTransTypeReg),
|
.endP2TransTypeReg(endP2TransTypeReg),
|
.endP2TransTypeReg(endP2TransTypeReg),
|
.endP2NAKTransTypeReg(endP2NAKTransTypeReg),
|
.endP2NAKTransTypeReg(endP2NAKTransTypeReg),
|
.endP3TransTypeReg(endP3TransTypeReg),
|
.endP3TransTypeReg(endP3TransTypeReg),
|
.endP3NAKTransTypeReg(endP3NAKTransTypeReg),
|
.endP3NAKTransTypeReg(endP3NAKTransTypeReg),
|
.endP0ControlReg(endP0ControlReg),
|
.endP0ControlReg(endP0ControlReg),
|
.endP1ControlReg(endP1ControlReg),
|
.endP1ControlReg(endP1ControlReg),
|
.endP2ControlReg(endP2ControlReg),
|
.endP2ControlReg(endP2ControlReg),
|
.endP3ControlReg(endP3ControlReg),
|
.endP3ControlReg(endP3ControlReg),
|
.EP0StatusReg(endP0StatusReg),
|
.EP0StatusReg(endP0StatusReg),
|
.EP1StatusReg(endP1StatusReg),
|
.EP1StatusReg(endP1StatusReg),
|
.EP2StatusReg(endP2StatusReg),
|
.EP2StatusReg(endP2StatusReg),
|
.EP3StatusReg(endP3StatusReg),
|
.EP3StatusReg(endP3StatusReg),
|
.SCAddrReg(USBTgtAddress),
|
.SCAddrReg(USBTgtAddress),
|
.frameNum(frameNum),
|
.frameNum(frameNum),
|
.connectStateIn(connectStateOut),
|
.connectStateIn(connectStateOut),
|
.SOFRxedIn(SOFRxed),
|
.SOFRxedIn(SOFRxed),
|
.resetEventIn(resetEventFromRxStatusMon),
|
.resetEventIn(resetEventFromRxStatusMon),
|
.resumeIntIn(resumeIntFromRxStatusMon),
|
.resumeIntIn(resumeIntFromRxStatusMon),
|
.transDoneIn(transDone),
|
.transDoneIn(transDone),
|
.NAKSentIn(NAKSent),
|
.NAKSentIn(NAKSent),
|
.slaveControlSelect(slaveControlSelect),
|
.slaveControlSelect(slaveControlSelect),
|
.clrEP0Ready(clrEP0Rdy),
|
.clrEP0Ready(clrEP0Rdy),
|
.clrEP1Ready(clrEP1Rdy),
|
.clrEP1Ready(clrEP1Rdy),
|
.clrEP2Ready(clrEP2Rdy),
|
.clrEP2Ready(clrEP2Rdy),
|
.clrEP3Ready(clrEP3Rdy),
|
.clrEP3Ready(clrEP3Rdy),
|
.TxLineState(directLineState),
|
.TxLineState(directLineState),
|
.LineDirectControlEn(directLineCtrlEn),
|
.LineDirectControlEn(directLineCtrlEn),
|
.fullSpeedPol(fullSpeedPol),
|
.fullSpeedPol(fullSpeedPol),
|
.fullSpeedRate(fullSpeedRate),
|
.fullSpeedRate(fullSpeedRate),
|
.SCGlobalEn(SCGlobalEn)
|
.SCGlobalEn(SCGlobalEn)
|
);
|
);
|
|
|
slavecontroller u_slavecontroller
|
slavecontroller u_slavecontroller
|
(.CRCError(CRCError),
|
(.CRCError(CRCError),
|
.NAKSent(NAKSent),
|
.NAKSent(NAKSent),
|
.RxByte(RxData),
|
.RxByte(RxData),
|
.RxDataWEn(RxDataValid),
|
.RxDataWEn(RxDataValid),
|
.RxOverflow(RXOverflow),
|
.RxOverflow(RXOverflow),
|
.RxStatus(RxByteStatus),
|
.RxStatus(RxByteStatus),
|
.RxTimeOut(RXTimeOut),
|
.RxTimeOut(RXTimeOut),
|
.SCGlobalEn(SCGlobalEn),
|
.SCGlobalEn(SCGlobalEn),
|
.SOFRxed(SOFRxed),
|
.SOFRxed(SOFRxed),
|
.USBEndPControlReg(endPControlReg),
|
.USBEndPControlReg(endPControlReg),
|
.USBEndPNakTransTypeReg(transTypeNAK),
|
.USBEndPNakTransTypeReg(transTypeNAK),
|
.USBEndPTransTypeReg(transType),
|
.USBEndPTransTypeReg(transType),
|
.USBEndP(currEndP),
|
.USBEndP(currEndP),
|
.USBTgtAddress(USBTgtAddress),
|
.USBTgtAddress(USBTgtAddress),
|
.bitStuffError(bitStuffError),
|
.bitStuffError(bitStuffError),
|
.clk(clk),
|
.clk(usbClk),
|
.clrEPRdy(clrEPRdy),
|
.clrEPRdy(clrEPRdy),
|
.endPMuxErrorsWEn(endPMuxErrorsWEn),
|
.endPMuxErrorsWEn(endPMuxErrorsWEn),
|
.frameNum(frameNum),
|
.frameNum(frameNum),
|
.getPacketREn(getPacketREn),
|
.getPacketREn(getPacketREn),
|
.getPacketRdy(getPacketRdy),
|
.getPacketRdy(getPacketRdy),
|
.rst(rst),
|
.rst(rstSyncToUsbClk),
|
.sendPacketPID(slaveControllerPIDOut),
|
.sendPacketPID(slaveControllerPIDOut),
|
.sendPacketRdy(slaveControllerReadyIn),
|
.sendPacketRdy(slaveControllerReadyIn),
|
.sendPacketWEn(slaveControllerWEnOut),
|
.sendPacketWEn(slaveControllerWEnOut),
|
.stallSent(stallSent),
|
.stallSent(stallSent),
|
.transDone(transDone)
|
.transDone(transDone),
|
|
.endPointReadyToGetPkt(endPointReadyFromSlaveCtrlrToGetPkt)
|
);
|
);
|
|
|
|
|
endpMux u_endpMux (
|
endpMux u_endpMux (
|
.clk(clk),
|
.clk(usbClk),
|
.rst(rst),
|
.rst(rstSyncToUsbClk),
|
.currEndP(currEndP),
|
.currEndP(currEndP),
|
.NAKSent(NAKSent),
|
.NAKSent(NAKSent),
|
.stallSent(stallSent),
|
.stallSent(stallSent),
|
.CRCError(CRCError),
|
.CRCError(CRCError),
|
.bitStuffError(bitStuffError),
|
.bitStuffError(bitStuffError),
|
.RxOverflow(RXOverflow),
|
.RxOverflow(RXOverflow),
|
.RxTimeOut(RXTimeOut),
|
.RxTimeOut(RXTimeOut),
|
.dataSequence(dataSequence),
|
.dataSequence(dataSequence),
|
.ACKRxed(ACKRxed),
|
.ACKRxed(ACKRxed),
|
.transType(transType),
|
.transType(transType),
|
.transTypeNAK(transTypeNAK),
|
.transTypeNAK(transTypeNAK),
|
.endPControlReg(endPControlReg),
|
.endPControlReg(endPControlReg),
|
.clrEPRdy(clrEPRdy),
|
.clrEPRdy(clrEPRdy),
|
.endPMuxErrorsWEn(endPMuxErrorsWEn),
|
.endPMuxErrorsWEn(endPMuxErrorsWEn),
|
.endP0ControlReg(endP0ControlReg),
|
.endP0ControlReg(endP0ControlReg),
|
.endP1ControlReg(endP1ControlReg),
|
.endP1ControlReg(endP1ControlReg),
|
.endP2ControlReg(endP2ControlReg),
|
.endP2ControlReg(endP2ControlReg),
|
.endP3ControlReg(endP3ControlReg),
|
.endP3ControlReg(endP3ControlReg),
|
.endP0StatusReg(endP0StatusReg),
|
.endP0StatusReg(endP0StatusReg),
|
.endP1StatusReg(endP1StatusReg),
|
.endP1StatusReg(endP1StatusReg),
|
.endP2StatusReg(endP2StatusReg),
|
.endP2StatusReg(endP2StatusReg),
|
.endP3StatusReg(endP3StatusReg),
|
.endP3StatusReg(endP3StatusReg),
|
.endP0TransTypeReg(endP0TransTypeReg),
|
.endP0TransTypeReg(endP0TransTypeReg),
|
.endP1TransTypeReg(endP1TransTypeReg),
|
.endP1TransTypeReg(endP1TransTypeReg),
|
.endP2TransTypeReg(endP2TransTypeReg),
|
.endP2TransTypeReg(endP2TransTypeReg),
|
.endP3TransTypeReg(endP3TransTypeReg),
|
.endP3TransTypeReg(endP3TransTypeReg),
|
.endP0NAKTransTypeReg(endP0NAKTransTypeReg),
|
.endP0NAKTransTypeReg(endP0NAKTransTypeReg),
|
.endP1NAKTransTypeReg(endP1NAKTransTypeReg),
|
.endP1NAKTransTypeReg(endP1NAKTransTypeReg),
|
.endP2NAKTransTypeReg(endP2NAKTransTypeReg),
|
.endP2NAKTransTypeReg(endP2NAKTransTypeReg),
|
.endP3NAKTransTypeReg(endP3NAKTransTypeReg),
|
.endP3NAKTransTypeReg(endP3NAKTransTypeReg),
|
.clrEP0Rdy(clrEP0Rdy),
|
.clrEP0Rdy(clrEP0Rdy),
|
.clrEP1Rdy(clrEP1Rdy),
|
.clrEP1Rdy(clrEP1Rdy),
|
.clrEP2Rdy(clrEP2Rdy),
|
.clrEP2Rdy(clrEP2Rdy),
|
.clrEP3Rdy(clrEP3Rdy)
|
.clrEP3Rdy(clrEP3Rdy)
|
);
|
);
|
|
|
slaveSendPacket u_slaveSendPacket
|
slaveSendPacket u_slaveSendPacket
|
(.PID(slaveControllerPIDOut),
|
(.PID(slaveControllerPIDOut),
|
.SCTxPortCntl(sendPacketCntl),
|
.SCTxPortCntl(sendPacketCntl),
|
.SCTxPortData(sendPacketData),
|
.SCTxPortData(sendPacketData),
|
.SCTxPortGnt(sendPacketGnt),
|
.SCTxPortGnt(sendPacketGnt),
|
.SCTxPortRdy(SCTxPortArbRdyOut),
|
.SCTxPortRdy(SCTxPortArbRdyOut),
|
.SCTxPortReq(sendPacketReq),
|
.SCTxPortReq(sendPacketReq),
|
.SCTxPortWEn(sendPacketWEn),
|
.SCTxPortWEn(sendPacketWEn),
|
.clk(clk),
|
.clk(usbClk),
|
.fifoData(TxFifoData),
|
.fifoData(TxFifoData),
|
.fifoEmpty(TxFifoEmpty),
|
.fifoEmpty(TxFifoEmpty),
|
.fifoReadEn(TxFifoRE),
|
.fifoReadEn(TxFifoRE),
|
.rst(rst),
|
.rst(rstSyncToUsbClk),
|
.sendPacketRdy(slaveControllerReadyIn),
|
.sendPacketRdy(slaveControllerReadyIn),
|
.sendPacketWEn(slaveControllerWEnOut) );
|
.sendPacketWEn(slaveControllerWEnOut) );
|
|
|
slaveDirectControl u_slaveDirectControl
|
slaveDirectControl u_slaveDirectControl
|
(.SCTxPortCntl(directCntlCntl),
|
(.SCTxPortCntl(directCntlCntl),
|
.SCTxPortData(directCntlData),
|
.SCTxPortData(directCntlData),
|
.SCTxPortGnt(directCntlGnt),
|
.SCTxPortGnt(directCntlGnt),
|
.SCTxPortRdy(SCTxPortArbRdyOut),
|
.SCTxPortRdy(SCTxPortArbRdyOut),
|
.SCTxPortReq(directCntlReq),
|
.SCTxPortReq(directCntlReq),
|
.SCTxPortWEn(directCntlWEn),
|
.SCTxPortWEn(directCntlWEn),
|
.clk(clk),
|
.clk(usbClk),
|
.directControlEn(directLineCtrlEn),
|
.directControlEn(directLineCtrlEn),
|
.directControlLineState(directLineState),
|
.directControlLineState(directLineState),
|
.rst(rst) );
|
.rst(rstSyncToUsbClk) );
|
|
|
SCTxPortArbiter u_SCTxPortArbiter
|
SCTxPortArbiter u_SCTxPortArbiter
|
(.SCTxPortCntl(SCTxPortCtrl),
|
(.SCTxPortCntl(SCTxPortCtrl),
|
.SCTxPortData(SCTxPortData),
|
.SCTxPortData(SCTxPortData),
|
.SCTxPortRdyIn(SCTxPortRdy),
|
.SCTxPortRdyIn(SCTxPortRdy),
|
.SCTxPortRdyOut(SCTxPortArbRdyOut),
|
.SCTxPortRdyOut(SCTxPortArbRdyOut),
|
.SCTxPortWEnable(SCTxPortEn),
|
.SCTxPortWEnable(SCTxPortEn),
|
.clk(clk),
|
.clk(usbClk),
|
.directCntlCntl(directCntlCntl),
|
.directCntlCntl(directCntlCntl),
|
.directCntlData(directCntlData),
|
.directCntlData(directCntlData),
|
.directCntlGnt(directCntlGnt),
|
.directCntlGnt(directCntlGnt),
|
.directCntlReq(directCntlReq),
|
.directCntlReq(directCntlReq),
|
.directCntlWEn(directCntlWEn),
|
.directCntlWEn(directCntlWEn),
|
.rst(rst),
|
.rst(rstSyncToUsbClk),
|
.sendPacketCntl(sendPacketCntl),
|
.sendPacketCntl(sendPacketCntl),
|
.sendPacketData(sendPacketData),
|
.sendPacketData(sendPacketData),
|
.sendPacketGnt(sendPacketGnt),
|
.sendPacketGnt(sendPacketGnt),
|
.sendPacketReq(sendPacketReq),
|
.sendPacketReq(sendPacketReq),
|
.sendPacketWEn(sendPacketWEn) );
|
.sendPacketWEn(sendPacketWEn) );
|
|
|
|
|
slaveGetPacket u_slaveGetPacket
|
slaveGetPacket u_slaveGetPacket
|
(.ACKRxed(ACKRxed),
|
(.ACKRxed(ACKRxed),
|
.CRCError(CRCError),
|
.CRCError(CRCError),
|
.RXDataIn(RxData),
|
.RXDataIn(RxData),
|
.RXDataValid(RxDataValid),
|
.RXDataValid(RxDataValid),
|
.RXFifoData(RxFifoData),
|
.RXFifoData(RxFifoData),
|
.RXFifoFull(RxFifoFull),
|
.RXFifoFull(RxFifoFull),
|
.RXFifoWEn(RxFifoWE),
|
.RXFifoWEn(RxFifoWE),
|
.RXPacketRdy(getPacketRdy),
|
.RXPacketRdy(getPacketRdy),
|
.RXStreamStatusIn(RxByteStatus),
|
.RXStreamStatusIn(RxByteStatus),
|
.RxPID(RxPID),
|
.RxPID(RxPID),
|
.SIERxTimeOut(SIERxTimeOut),
|
.SIERxTimeOut(SIERxTimeOut),
|
.clk(clk),
|
.clk(usbClk),
|
.RXOverflow(RXOverflow),
|
.RXOverflow(RXOverflow),
|
.RXTimeOut(RXTimeOut),
|
.RXTimeOut(RXTimeOut),
|
.bitStuffError(bitStuffError),
|
.bitStuffError(bitStuffError),
|
.dataSequence(dataSequence),
|
.dataSequence(dataSequence),
|
.getPacketEn(getPacketREn),
|
.getPacketEn(getPacketREn),
|
.rst(rst) );
|
.rst(rstSyncToUsbClk),
|
|
.endPointReady(endPointReadyFromSlaveCtrlrToGetPkt)
|
|
);
|
|
|
slaveRxStatusMonitor u_slaveRxStatusMonitor
|
slaveRxStatusMonitor u_slaveRxStatusMonitor
|
(.connectStateIn(connectStateIn),
|
(.connectStateIn(connectStateIn),
|
.connectStateOut(connectStateOut),
|
.connectStateOut(connectStateOut),
|
.resumeDetectedIn(resumeDetectedIn),
|
.resumeDetectedIn(resumeDetectedIn),
|
.resetEventOut(resetEventFromRxStatusMon),
|
.resetEventOut(resetEventFromRxStatusMon),
|
.resumeIntOut(resumeIntFromRxStatusMon),
|
.resumeIntOut(resumeIntFromRxStatusMon),
|
.clk(clk),
|
.clk(usbClk),
|
.rst(rst) );
|
.rst(rstSyncToUsbClk) );
|
|
|
fifoMux u_fifoMux (
|
fifoMux u_fifoMux (
|
.currEndP(currEndP),
|
.currEndP(currEndP),
|
//TxFifo
|
//TxFifo
|
.TxFifoREn(TxFifoRE),
|
.TxFifoREn(TxFifoRE),
|
.TxFifoEP0REn(TxFifoEP0REn),
|
.TxFifoEP0REn(TxFifoEP0REn),
|
.TxFifoEP1REn(TxFifoEP1REn),
|
.TxFifoEP1REn(TxFifoEP1REn),
|
.TxFifoEP2REn(TxFifoEP2REn),
|
.TxFifoEP2REn(TxFifoEP2REn),
|
.TxFifoEP3REn(TxFifoEP3REn),
|
.TxFifoEP3REn(TxFifoEP3REn),
|
.TxFifoData(TxFifoData),
|
.TxFifoData(TxFifoData),
|
.TxFifoEP0Data(TxFifoEP0Data),
|
.TxFifoEP0Data(TxFifoEP0Data),
|
.TxFifoEP1Data(TxFifoEP1Data),
|
.TxFifoEP1Data(TxFifoEP1Data),
|
.TxFifoEP2Data(TxFifoEP2Data),
|
.TxFifoEP2Data(TxFifoEP2Data),
|
.TxFifoEP3Data(TxFifoEP3Data),
|
.TxFifoEP3Data(TxFifoEP3Data),
|
.TxFifoEmpty(TxFifoEmpty),
|
.TxFifoEmpty(TxFifoEmpty),
|
.TxFifoEP0Empty(TxFifoEP0Empty),
|
.TxFifoEP0Empty(TxFifoEP0Empty),
|
.TxFifoEP1Empty(TxFifoEP1Empty),
|
.TxFifoEP1Empty(TxFifoEP1Empty),
|
.TxFifoEP2Empty(TxFifoEP2Empty),
|
.TxFifoEP2Empty(TxFifoEP2Empty),
|
.TxFifoEP3Empty(TxFifoEP3Empty),
|
.TxFifoEP3Empty(TxFifoEP3Empty),
|
//RxFifo
|
//RxFifo
|
.RxFifoWEn(RxFifoWE),
|
.RxFifoWEn(RxFifoWE),
|
.RxFifoEP0WEn(RxFifoEP0WEn),
|
.RxFifoEP0WEn(RxFifoEP0WEn),
|
.RxFifoEP1WEn(RxFifoEP1WEn),
|
.RxFifoEP1WEn(RxFifoEP1WEn),
|
.RxFifoEP2WEn(RxFifoEP2WEn),
|
.RxFifoEP2WEn(RxFifoEP2WEn),
|
.RxFifoEP3WEn(RxFifoEP3WEn),
|
.RxFifoEP3WEn(RxFifoEP3WEn),
|
.RxFifoFull(RxFifoFull),
|
.RxFifoFull(RxFifoFull),
|
.RxFifoEP0Full(RxFifoEP0Full),
|
.RxFifoEP0Full(RxFifoEP0Full),
|
.RxFifoEP1Full(RxFifoEP1Full),
|
.RxFifoEP1Full(RxFifoEP1Full),
|
.RxFifoEP2Full(RxFifoEP2Full),
|
.RxFifoEP2Full(RxFifoEP2Full),
|
.RxFifoEP3Full(RxFifoEP3Full)
|
.RxFifoEP3Full(RxFifoEP3Full)
|
);
|
);
|
|
|
endmodule
|
endmodule
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|