//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// usbHostSlave.v ////
|
//// usbHostSlave.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: ////
|
//// Top level module
|
//// Top level module
|
//// ////
|
//// ////
|
//// 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> ////
|
//// ////
|
//// ////
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//
|
//
|
// $Id: usbHostSlave.v,v 1.2 2004-12-18 14:36:23 sfielding Exp $
|
`timescale 1ns / 1ps
|
//
|
|
// CVS Revision History
|
|
//
|
|
// $Log: not supported by cvs2svn $
|
|
// Revision 1.1.1.1 2004/10/11 04:01:11 sfielding
|
|
// Created
|
|
//
|
|
//
|
|
|
|
module usbHostSlave(
|
module usbHostSlave(
|
clk,
|
clk,
|
rst,
|
rst,
|
address_i,
|
address_i,
|
data_i,
|
data_i,
|
data_o,
|
data_o,
|
writeEn,
|
writeEn,
|
strobe_i,
|
strobe_i,
|
ack_o,
|
ack_o,
|
hostSOFSentIntOut,
|
hostSOFSentIntOut,
|
hostConnEventIntOut,
|
hostConnEventIntOut,
|
hostResumeIntOut,
|
hostResumeIntOut,
|
hostTransDoneIntOut,
|
hostTransDoneIntOut,
|
slaveNAKSentIntOut,
|
slaveNAKSentIntOut,
|
slaveSOFRxedIntOut,
|
slaveSOFRxedIntOut,
|
slaveResetEventIntOut,
|
slaveResetEventIntOut,
|
slaveResumeIntOut,
|
slaveResumeIntOut,
|
slaveTransDoneIntOut,
|
slaveTransDoneIntOut,
|
USBWireDataIn,
|
USBWireDataIn,
|
USBWireDataInTick,
|
USBWireDataInTick,
|
USBWireDataOut,
|
USBWireDataOut,
|
USBWireDataOutTick,
|
USBWireDataOutTick,
|
USBWireCtrlOut
|
USBWireCtrlOut,
|
|
USBFullSpeed
|
);
|
);
|
parameter HOST_FIFO_DEPTH = 64; //HOST_FIFO_DEPTH = HOST_ADDR_WIDTH^2
|
parameter HOST_FIFO_DEPTH = 64; //HOST_FIFO_DEPTH = HOST_ADDR_WIDTH^2
|
parameter HOST_FIFO_ADDR_WIDTH = 6;
|
parameter HOST_FIFO_ADDR_WIDTH = 6;
|
parameter EP0_FIFO_DEPTH = 64;
|
parameter EP0_FIFO_DEPTH = 64;
|
parameter EP0_FIFO_ADDR_WIDTH = 6;
|
parameter EP0_FIFO_ADDR_WIDTH = 6;
|
parameter EP1_FIFO_DEPTH = 64;
|
parameter EP1_FIFO_DEPTH = 64;
|
parameter EP1_FIFO_ADDR_WIDTH = 6;
|
parameter EP1_FIFO_ADDR_WIDTH = 6;
|
parameter EP2_FIFO_DEPTH = 64;
|
parameter EP2_FIFO_DEPTH = 64;
|
parameter EP2_FIFO_ADDR_WIDTH = 6;
|
parameter EP2_FIFO_ADDR_WIDTH = 6;
|
parameter EP3_FIFO_DEPTH = 64;
|
parameter EP3_FIFO_DEPTH = 64;
|
parameter EP3_FIFO_ADDR_WIDTH = 6;
|
parameter EP3_FIFO_ADDR_WIDTH = 6;
|
|
|
input clk;
|
input clk;
|
input rst;
|
input rst;
|
input [7:0] address_i;
|
input [7:0] address_i;
|
input [7:0] data_i;
|
input [7:0] data_i;
|
output [7:0] data_o;
|
output [7:0] data_o;
|
input writeEn;
|
input writeEn;
|
input strobe_i;
|
input strobe_i;
|
output ack_o;
|
output ack_o;
|
output hostSOFSentIntOut;
|
output hostSOFSentIntOut;
|
output hostConnEventIntOut;
|
output hostConnEventIntOut;
|
output hostResumeIntOut;
|
output hostResumeIntOut;
|
output hostTransDoneIntOut;
|
output hostTransDoneIntOut;
|
output slaveSOFRxedIntOut;
|
output slaveSOFRxedIntOut;
|
output slaveResetEventIntOut;
|
output slaveResetEventIntOut;
|
output slaveResumeIntOut;
|
output slaveResumeIntOut;
|
output slaveTransDoneIntOut;
|
output slaveTransDoneIntOut;
|
output slaveNAKSentIntOut;
|
output slaveNAKSentIntOut;
|
input [1:0] USBWireDataIn;
|
input [1:0] USBWireDataIn;
|
output [1:0] USBWireDataOut;
|
output [1:0] USBWireDataOut;
|
output USBWireDataOutTick;
|
output USBWireDataOutTick;
|
output USBWireDataInTick;
|
output USBWireDataInTick;
|
output USBWireCtrlOut;
|
output USBWireCtrlOut;
|
|
output USBFullSpeed;
|
|
|
wire clk;
|
wire clk;
|
wire rst;
|
wire rst;
|
wire [7:0] address_i;
|
wire [7:0] address_i;
|
wire [7:0] data_i;
|
wire [7:0] data_i;
|
wire [7:0] data_o;
|
wire [7:0] data_o;
|
wire writeEn;
|
wire writeEn;
|
wire strobe_i;
|
wire strobe_i;
|
wire ack_o;
|
wire ack_o;
|
wire hostSOFSentIntOut;
|
wire hostSOFSentIntOut;
|
wire hostConnEventIntOut;
|
wire hostConnEventIntOut;
|
wire hostResumeIntOut;
|
wire hostResumeIntOut;
|
wire hostTransDoneIntOut;
|
wire hostTransDoneIntOut;
|
wire slaveSOFRxedIntOut;
|
wire slaveSOFRxedIntOut;
|
wire slaveResetEventIntOut;
|
wire slaveResetEventIntOut;
|
wire slaveResumeIntOut;
|
wire slaveResumeIntOut;
|
wire slaveTransDoneIntOut;
|
wire slaveTransDoneIntOut;
|
wire slaveNAKSentIntOut;
|
wire slaveNAKSentIntOut;
|
wire [1:0] USBWireDataIn;
|
wire [1:0] USBWireDataIn;
|
wire [1:0] USBWireDataOut;
|
wire [1:0] USBWireDataOut;
|
wire USBWireDataOutTick;
|
wire USBWireDataOutTick;
|
wire USBWireDataInTick;
|
wire USBWireDataInTick;
|
wire USBWireCtrlOut;
|
wire USBWireCtrlOut;
|
|
wire USBFullSpeed;
|
|
|
//internal wiring
|
//internal wiring
|
wire hostControlSel;
|
wire hostControlSel;
|
wire slaveControlSel;
|
wire slaveControlSel;
|
wire hostRxFifoSel;
|
wire hostRxFifoSel;
|
wire hostTxFifoSel;
|
wire hostTxFifoSel;
|
wire hostSlaveMuxSel;
|
wire hostSlaveMuxSel;
|
wire [7:0] dataFromHostControl;
|
wire [7:0] dataFromHostControl;
|
wire [7:0] dataFromSlaveControl;
|
wire [7:0] dataFromSlaveControl;
|
wire [7:0] dataFromHostRxFifo;
|
wire [7:0] dataFromHostRxFifo;
|
wire [7:0] dataFromHostTxFifo;
|
wire [7:0] dataFromHostTxFifo;
|
wire [7:0] dataFromHostSlaveMux;
|
wire [7:0] dataFromHostSlaveMux;
|
wire hostTxFifoRE;
|
wire hostTxFifoRE;
|
wire [7:0] hostTxFifoData;
|
wire [7:0] hostTxFifoData;
|
wire hostTxFifoEmpty;
|
wire hostTxFifoEmpty;
|
wire hostRxFifoWE;
|
wire hostRxFifoWE;
|
wire [7:0] hostRxFifoData;
|
wire [7:0] hostRxFifoData;
|
wire hostRxFifoFull;
|
wire hostRxFifoFull;
|
wire [7:0] RxCtrlOut;
|
wire [7:0] RxCtrlOut;
|
wire [7:0] RxDataFromSIE;
|
wire [7:0] RxDataFromSIE;
|
wire RxDataOutWEn;
|
wire RxDataOutWEn;
|
wire fullSpeedBitRateFromHost;
|
wire fullSpeedBitRateFromHost;
|
wire fullSpeedBitRateFromSlave;
|
wire fullSpeedBitRateFromSlave;
|
wire fullSpeedPolarityFromHost;
|
wire fullSpeedPolarityFromHost;
|
wire fullSpeedPolarityFromSlave;
|
wire fullSpeedPolarityFromSlave;
|
wire SIEPortWEnFromHost;
|
wire SIEPortWEnFromHost;
|
wire SIEPortWEnFromSlave;
|
wire SIEPortWEnFromSlave;
|
wire SIEPortTxRdy;
|
wire SIEPortTxRdy;
|
wire [7:0] SIEPortDataInFromHost;
|
wire [7:0] SIEPortDataInFromHost;
|
wire [7:0] SIEPortDataInFromSlave;
|
wire [7:0] SIEPortDataInFromSlave;
|
wire [7:0] SIEPortCtrlInFromHost;
|
wire [7:0] SIEPortCtrlInFromHost;
|
wire [7:0] SIEPortCtrlInFromSlave;
|
wire [7:0] SIEPortCtrlInFromSlave;
|
wire [1:0] connectState;
|
wire [1:0] connectState;
|
wire resumeDetected;
|
wire resumeDetected;
|
wire [7:0] SIEPortDataInToSIE;
|
wire [7:0] SIEPortDataInToSIE;
|
wire SIEPortWEnToSIE;
|
wire SIEPortWEnToSIE;
|
wire [7:0] SIEPortCtrlInToSIE;
|
wire [7:0] SIEPortCtrlInToSIE;
|
wire fullSpeedPolarityToSIE;
|
wire fullSpeedPolarityToSIE;
|
wire fullSpeedBitRateToSIE;
|
wire fullSpeedBitRateToSIE;
|
wire noActivityTimeOut;
|
wire noActivityTimeOut;
|
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;
|
wire [7:0] slaveRxFifoData;
|
wire [7:0] slaveRxFifoData;
|
wire [7:0] dataFromEP0RxFifo;
|
wire [7:0] dataFromEP0RxFifo;
|
wire [7:0] dataFromEP1RxFifo;
|
wire [7:0] dataFromEP1RxFifo;
|
wire [7:0] dataFromEP2RxFifo;
|
wire [7:0] dataFromEP2RxFifo;
|
wire [7:0] dataFromEP3RxFifo;
|
wire [7:0] dataFromEP3RxFifo;
|
wire [7:0] dataFromEP0TxFifo;
|
wire [7:0] dataFromEP0TxFifo;
|
wire [7:0] dataFromEP1TxFifo;
|
wire [7:0] dataFromEP1TxFifo;
|
wire [7:0] dataFromEP2TxFifo;
|
wire [7:0] dataFromEP2TxFifo;
|
wire [7:0] dataFromEP3TxFifo;
|
wire [7:0] dataFromEP3TxFifo;
|
wire slaveEP0RxFifoSel;
|
wire slaveEP0RxFifoSel;
|
wire slaveEP1RxFifoSel;
|
wire slaveEP1RxFifoSel;
|
wire slaveEP2RxFifoSel;
|
wire slaveEP2RxFifoSel;
|
wire slaveEP3RxFifoSel;
|
wire slaveEP3RxFifoSel;
|
wire slaveEP0TxFifoSel;
|
wire slaveEP0TxFifoSel;
|
wire slaveEP1TxFifoSel;
|
wire slaveEP1TxFifoSel;
|
wire slaveEP2TxFifoSel;
|
wire slaveEP2TxFifoSel;
|
wire slaveEP3TxFifoSel;
|
wire slaveEP3TxFifoSel;
|
|
|
|
assign USBFullSpeed = fullSpeedBitRateToSIE;
|
|
|
usbHostControl u_usbHostControl(
|
usbHostControl u_usbHostControl(
|
.clk(clk),
|
.clk(clk),
|
.rst(rst),
|
.rst(rst),
|
.TxFifoRE(hostTxFifoRE),
|
.TxFifoRE(hostTxFifoRE),
|
.TxFifoData(hostTxFifoData),
|
.TxFifoData(hostTxFifoData),
|
.TxFifoEmpty(hostTxFifoEmpty),
|
.TxFifoEmpty(hostTxFifoEmpty),
|
.RxFifoWE(hostRxFifoWE),
|
.RxFifoWE(hostRxFifoWE),
|
.RxFifoData(hostRxFifoData),
|
.RxFifoData(hostRxFifoData),
|
.RxFifoFull(hostRxFifoFull),
|
.RxFifoFull(hostRxFifoFull),
|
.RxByteStatus(RxCtrlOut),
|
.RxByteStatus(RxCtrlOut),
|
.RxData(RxDataFromSIE),
|
.RxData(RxDataFromSIE),
|
.RxDataValid(RxDataOutWEn),
|
.RxDataValid(RxDataOutWEn),
|
.SIERxTimeOut(noActivityTimeOut),
|
.SIERxTimeOut(noActivityTimeOut),
|
.fullSpeedRate(fullSpeedBitRateFromHost),
|
.fullSpeedRate(fullSpeedBitRateFromHost),
|
.fullSpeedPol(fullSpeedPolarityFromHost),
|
.fullSpeedPol(fullSpeedPolarityFromHost),
|
.HCTxPortEn(SIEPortWEnFromHost),
|
.HCTxPortEn(SIEPortWEnFromHost),
|
.HCTxPortRdy(SIEPortTxRdy),
|
.HCTxPortRdy(SIEPortTxRdy),
|
.HCTxPortData(SIEPortDataInFromHost),
|
.HCTxPortData(SIEPortDataInFromHost),
|
.HCTxPortCtrl(SIEPortCtrlInFromHost),
|
.HCTxPortCtrl(SIEPortCtrlInFromHost),
|
.connectStateIn(connectState),
|
.connectStateIn(connectState),
|
.resumeDetectedIn(resumeDetected),
|
.resumeDetectedIn(resumeDetected),
|
.busAddress(address_i[3:0]),
|
.busAddress(address_i[3:0]),
|
.busDataIn(data_i),
|
.busDataIn(data_i),
|
.busDataOut(dataFromHostControl),
|
.busDataOut(dataFromHostControl),
|
.busWriteEn(writeEn),
|
.busWriteEn(writeEn),
|
.busStrobe_i(strobe_i),
|
.busStrobe_i(strobe_i),
|
.SOFSentIntOut(hostSOFSentIntOut),
|
.SOFSentIntOut(hostSOFSentIntOut),
|
.connEventIntOut(hostConnEventIntOut),
|
.connEventIntOut(hostConnEventIntOut),
|
.resumeIntOut(hostResumeIntOut),
|
.resumeIntOut(hostResumeIntOut),
|
.transDoneIntOut(hostTransDoneIntOut),
|
.transDoneIntOut(hostTransDoneIntOut),
|
.hostControlSelect(hostControlSel) );
|
.hostControlSelect(hostControlSel) );
|
|
|
|
|
usbSlaveControl u_usbSlaveControl(
|
usbSlaveControl u_usbSlaveControl(
|
.clk(clk),
|
.clk(clk),
|
.rst(rst),
|
.rst(rst),
|
.RxByteStatus(RxCtrlOut),
|
.RxByteStatus(RxCtrlOut),
|
.RxData(RxDataFromSIE),
|
.RxData(RxDataFromSIE),
|
.RxDataValid(RxDataOutWEn),
|
.RxDataValid(RxDataOutWEn),
|
.SIERxTimeOut(noActivityTimeOut),
|
.SIERxTimeOut(noActivityTimeOut),
|
.RxFifoData(slaveRxFifoData),
|
.RxFifoData(slaveRxFifoData),
|
.fullSpeedRate(fullSpeedBitRateFromSlave),
|
.fullSpeedRate(fullSpeedBitRateFromSlave),
|
.fullSpeedPol(fullSpeedPolarityFromSlave),
|
.fullSpeedPol(fullSpeedPolarityFromSlave),
|
.SCTxPortEn(SIEPortWEnFromSlave),
|
.SCTxPortEn(SIEPortWEnFromSlave),
|
.SCTxPortRdy(SIEPortTxRdy),
|
.SCTxPortRdy(SIEPortTxRdy),
|
.SCTxPortData(SIEPortDataInFromSlave),
|
.SCTxPortData(SIEPortDataInFromSlave),
|
.SCTxPortCtrl(SIEPortCtrlInFromSlave),
|
.SCTxPortCtrl(SIEPortCtrlInFromSlave),
|
.connectStateIn(connectState),
|
.connectStateIn(connectState),
|
.resumeDetectedIn(resumeDetected),
|
.resumeDetectedIn(resumeDetected),
|
.busAddress(address_i[4:0]),
|
.busAddress(address_i[4:0]),
|
.busDataIn(data_i),
|
.busDataIn(data_i),
|
.busDataOut(dataFromSlaveControl),
|
.busDataOut(dataFromSlaveControl),
|
.busWriteEn(writeEn),
|
.busWriteEn(writeEn),
|
.busStrobe_i(strobe_i),
|
.busStrobe_i(strobe_i),
|
.SOFRxedIntOut(slaveSOFRxedIntOut),
|
.SOFRxedIntOut(slaveSOFRxedIntOut),
|
.resetEventIntOut(slaveResetEventIntOut),
|
.resetEventIntOut(slaveResetEventIntOut),
|
.resumeIntOut(slaveResumeIntOut),
|
.resumeIntOut(slaveResumeIntOut),
|
.transDoneIntOut(slaveTransDoneIntOut),
|
.transDoneIntOut(slaveTransDoneIntOut),
|
.NAKSentIntOut(slaveNAKSentIntOut),
|
.NAKSentIntOut(slaveNAKSentIntOut),
|
.slaveControlSelect(slaveControlSel),
|
.slaveControlSelect(slaveControlSel),
|
.TxFifoEP0REn(TxFifoEP0REn),
|
.TxFifoEP0REn(TxFifoEP0REn),
|
.TxFifoEP1REn(TxFifoEP1REn),
|
.TxFifoEP1REn(TxFifoEP1REn),
|
.TxFifoEP2REn(TxFifoEP2REn),
|
.TxFifoEP2REn(TxFifoEP2REn),
|
.TxFifoEP3REn(TxFifoEP3REn),
|
.TxFifoEP3REn(TxFifoEP3REn),
|
.TxFifoEP0Data(TxFifoEP0Data),
|
.TxFifoEP0Data(TxFifoEP0Data),
|
.TxFifoEP1Data(TxFifoEP1Data),
|
.TxFifoEP1Data(TxFifoEP1Data),
|
.TxFifoEP2Data(TxFifoEP2Data),
|
.TxFifoEP2Data(TxFifoEP2Data),
|
.TxFifoEP3Data(TxFifoEP3Data),
|
.TxFifoEP3Data(TxFifoEP3Data),
|
.TxFifoEP0Empty(TxFifoEP0Empty),
|
.TxFifoEP0Empty(TxFifoEP0Empty),
|
.TxFifoEP1Empty(TxFifoEP1Empty),
|
.TxFifoEP1Empty(TxFifoEP1Empty),
|
.TxFifoEP2Empty(TxFifoEP2Empty),
|
.TxFifoEP2Empty(TxFifoEP2Empty),
|
.TxFifoEP3Empty(TxFifoEP3Empty),
|
.TxFifoEP3Empty(TxFifoEP3Empty),
|
.RxFifoEP0WEn(RxFifoEP0WEn),
|
.RxFifoEP0WEn(RxFifoEP0WEn),
|
.RxFifoEP1WEn(RxFifoEP1WEn),
|
.RxFifoEP1WEn(RxFifoEP1WEn),
|
.RxFifoEP2WEn(RxFifoEP2WEn),
|
.RxFifoEP2WEn(RxFifoEP2WEn),
|
.RxFifoEP3WEn(RxFifoEP3WEn),
|
.RxFifoEP3WEn(RxFifoEP3WEn),
|
.RxFifoEP0Full(RxFifoEP0Full),
|
.RxFifoEP0Full(RxFifoEP0Full),
|
.RxFifoEP1Full(RxFifoEP1Full),
|
.RxFifoEP1Full(RxFifoEP1Full),
|
.RxFifoEP2Full(RxFifoEP2Full),
|
.RxFifoEP2Full(RxFifoEP2Full),
|
.RxFifoEP3Full(RxFifoEP3Full)
|
.RxFifoEP3Full(RxFifoEP3Full)
|
);
|
);
|
|
|
wishBoneBI u_wishBoneBI (
|
wishBoneBI u_wishBoneBI (
|
.address(address_i),
|
.address(address_i),
|
.dataIn(data_i),
|
.dataIn(data_i),
|
.dataOut(data_o),
|
.dataOut(data_o),
|
.writeEn(writeEn),
|
.writeEn(writeEn),
|
.strobe_i(strobe_i),
|
.strobe_i(strobe_i),
|
.ack_o(ack_o),
|
.ack_o(ack_o),
|
.clk(clk),
|
.clk(clk),
|
.rst(rst),
|
.rst(rst),
|
.hostControlSel(hostControlSel),
|
.hostControlSel(hostControlSel),
|
.hostRxFifoSel(hostRxFifoSel),
|
.hostRxFifoSel(hostRxFifoSel),
|
.hostTxFifoSel(hostTxFifoSel),
|
.hostTxFifoSel(hostTxFifoSel),
|
.slaveControlSel(slaveControlSel),
|
.slaveControlSel(slaveControlSel),
|
.slaveEP0RxFifoSel(slaveEP0RxFifoSel),
|
.slaveEP0RxFifoSel(slaveEP0RxFifoSel),
|
.slaveEP1RxFifoSel(slaveEP1RxFifoSel),
|
.slaveEP1RxFifoSel(slaveEP1RxFifoSel),
|
.slaveEP2RxFifoSel(slaveEP2RxFifoSel),
|
.slaveEP2RxFifoSel(slaveEP2RxFifoSel),
|
.slaveEP3RxFifoSel(slaveEP3RxFifoSel),
|
.slaveEP3RxFifoSel(slaveEP3RxFifoSel),
|
.slaveEP0TxFifoSel(slaveEP0TxFifoSel),
|
.slaveEP0TxFifoSel(slaveEP0TxFifoSel),
|
.slaveEP1TxFifoSel(slaveEP1TxFifoSel),
|
.slaveEP1TxFifoSel(slaveEP1TxFifoSel),
|
.slaveEP2TxFifoSel(slaveEP2TxFifoSel),
|
.slaveEP2TxFifoSel(slaveEP2TxFifoSel),
|
.slaveEP3TxFifoSel(slaveEP3TxFifoSel),
|
.slaveEP3TxFifoSel(slaveEP3TxFifoSel),
|
.hostSlaveMuxSel(hostSlaveMuxSel),
|
.hostSlaveMuxSel(hostSlaveMuxSel),
|
.dataFromHostControl(dataFromHostControl),
|
.dataFromHostControl(dataFromHostControl),
|
.dataFromHostRxFifo(dataFromHostRxFifo),
|
.dataFromHostRxFifo(dataFromHostRxFifo),
|
.dataFromHostTxFifo(dataFromHostTxFifo),
|
.dataFromHostTxFifo(dataFromHostTxFifo),
|
.dataFromSlaveControl(dataFromSlaveControl),
|
.dataFromSlaveControl(dataFromSlaveControl),
|
.dataFromEP0RxFifo(dataFromEP0RxFifo),
|
.dataFromEP0RxFifo(dataFromEP0RxFifo),
|
.dataFromEP1RxFifo(dataFromEP1RxFifo),
|
.dataFromEP1RxFifo(dataFromEP1RxFifo),
|
.dataFromEP2RxFifo(dataFromEP2RxFifo),
|
.dataFromEP2RxFifo(dataFromEP2RxFifo),
|
.dataFromEP3RxFifo(dataFromEP3RxFifo),
|
.dataFromEP3RxFifo(dataFromEP3RxFifo),
|
.dataFromEP0TxFifo(dataFromEP0TxFifo),
|
.dataFromEP0TxFifo(dataFromEP0TxFifo),
|
.dataFromEP1TxFifo(dataFromEP1TxFifo),
|
.dataFromEP1TxFifo(dataFromEP1TxFifo),
|
.dataFromEP2TxFifo(dataFromEP2TxFifo),
|
.dataFromEP2TxFifo(dataFromEP2TxFifo),
|
.dataFromEP3TxFifo(dataFromEP3TxFifo),
|
.dataFromEP3TxFifo(dataFromEP3TxFifo),
|
.dataFromHostSlaveMux(dataFromHostSlaveMux)
|
.dataFromHostSlaveMux(dataFromHostSlaveMux)
|
);
|
);
|
|
|
hostSlaveMux u_hostSlaveMux(
|
hostSlaveMux u_hostSlaveMux(
|
.SIEPortCtrlInToSIE(SIEPortCtrlInToSIE),
|
.SIEPortCtrlInToSIE(SIEPortCtrlInToSIE),
|
.SIEPortCtrlInFromHost(SIEPortCtrlInFromHost),
|
.SIEPortCtrlInFromHost(SIEPortCtrlInFromHost),
|
.SIEPortCtrlInFromSlave(SIEPortCtrlInFromSlave),
|
.SIEPortCtrlInFromSlave(SIEPortCtrlInFromSlave),
|
.SIEPortDataInToSIE(SIEPortDataInToSIE),
|
.SIEPortDataInToSIE(SIEPortDataInToSIE),
|
.SIEPortDataInFromHost(SIEPortDataInFromHost),
|
.SIEPortDataInFromHost(SIEPortDataInFromHost),
|
.SIEPortDataInFromSlave(SIEPortDataInFromSlave),
|
.SIEPortDataInFromSlave(SIEPortDataInFromSlave),
|
.SIEPortWEnToSIE(SIEPortWEnToSIE),
|
.SIEPortWEnToSIE(SIEPortWEnToSIE),
|
.SIEPortWEnFromHost(SIEPortWEnFromHost),
|
.SIEPortWEnFromHost(SIEPortWEnFromHost),
|
.SIEPortWEnFromSlave(SIEPortWEnFromSlave),
|
.SIEPortWEnFromSlave(SIEPortWEnFromSlave),
|
.fullSpeedPolarityToSIE(fullSpeedPolarityToSIE),
|
.fullSpeedPolarityToSIE(fullSpeedPolarityToSIE),
|
.fullSpeedPolarityFromHost(fullSpeedPolarityFromHost),
|
.fullSpeedPolarityFromHost(fullSpeedPolarityFromHost),
|
.fullSpeedPolarityFromSlave(fullSpeedPolarityFromSlave),
|
.fullSpeedPolarityFromSlave(fullSpeedPolarityFromSlave),
|
.fullSpeedBitRateToSIE(fullSpeedBitRateToSIE),
|
.fullSpeedBitRateToSIE(fullSpeedBitRateToSIE),
|
.fullSpeedBitRateFromHost(fullSpeedBitRateFromHost),
|
.fullSpeedBitRateFromHost(fullSpeedBitRateFromHost),
|
.fullSpeedBitRateFromSlave(fullSpeedBitRateFromSlave),
|
.fullSpeedBitRateFromSlave(fullSpeedBitRateFromSlave),
|
.dataIn(data_i),
|
.dataIn(data_i),
|
.dataOut(dataFromHostSlaveMux),
|
.dataOut(dataFromHostSlaveMux),
|
|
.address(address_i[0]),
|
.writeEn(writeEn),
|
.writeEn(writeEn),
|
.strobe_i(strobe_i),
|
.strobe_i(strobe_i),
|
.clk(clk),
|
.clk(clk),
|
.rst(rst),
|
.rst(rst),
|
.hostSlaveMuxSel(hostSlaveMuxSel) );
|
.hostSlaveMuxSel(hostSlaveMuxSel) );
|
|
|
usbSerialInterfaceEngine u_usbSerialInterfaceEngine(
|
usbSerialInterfaceEngine u_usbSerialInterfaceEngine(
|
.clk(clk),
|
.clk(clk),
|
.rst(rst),
|
.rst(rst),
|
.USBWireDataIn(USBWireDataIn),
|
.USBWireDataIn(USBWireDataIn),
|
.USBWireDataOut(USBWireDataOut),
|
.USBWireDataOut(USBWireDataOut),
|
.USBWireDataInTick(USBWireDataInTick),
|
.USBWireDataInTick(USBWireDataInTick),
|
.USBWireDataOutTick(USBWireDataOutTick),
|
.USBWireDataOutTick(USBWireDataOutTick),
|
.USBWireCtrlOut(USBWireCtrlOut),
|
.USBWireCtrlOut(USBWireCtrlOut),
|
.connectState(connectState),
|
.connectState(connectState),
|
.resumeDetected(resumeDetected),
|
.resumeDetected(resumeDetected),
|
.RxCtrlOut(RxCtrlOut),
|
.RxCtrlOut(RxCtrlOut),
|
.RxDataOutWEn(RxDataOutWEn),
|
.RxDataOutWEn(RxDataOutWEn),
|
.RxDataOut(RxDataFromSIE),
|
.RxDataOut(RxDataFromSIE),
|
.SIEPortCtrlIn(SIEPortCtrlInToSIE),
|
.SIEPortCtrlIn(SIEPortCtrlInToSIE),
|
.SIEPortDataIn(SIEPortDataInToSIE),
|
.SIEPortDataIn(SIEPortDataInToSIE),
|
.SIEPortTxRdy(SIEPortTxRdy),
|
.SIEPortTxRdy(SIEPortTxRdy),
|
.SIEPortWEn(SIEPortWEnToSIE),
|
.SIEPortWEn(SIEPortWEnToSIE),
|
.fullSpeedPolarity(fullSpeedPolarityToSIE),
|
.fullSpeedPolarity(fullSpeedPolarityToSIE),
|
.fullSpeedBitRate(fullSpeedBitRateToSIE),
|
.fullSpeedBitRate(fullSpeedBitRateToSIE),
|
.noActivityTimeOut(noActivityTimeOut)
|
.noActivityTimeOut(noActivityTimeOut)
|
);
|
);
|
|
|
//---Host fifos
|
//---Host fifos
|
TxFifo #(HOST_FIFO_DEPTH, HOST_FIFO_ADDR_WIDTH) HostTxFifo (
|
TxFifo #(HOST_FIFO_DEPTH, HOST_FIFO_ADDR_WIDTH) HostTxFifo (
|
.clk(clk),
|
.clk(clk),
|
.rst(rst),
|
.rst(rst),
|
.fifoREn(hostTxFifoRE),
|
.fifoREn(hostTxFifoRE),
|
.fifoEmpty(hostTxFifoEmpty),
|
.fifoEmpty(hostTxFifoEmpty),
|
.busAddress(address_i[2:0]),
|
.busAddress(address_i[2:0]),
|
.busWriteEn(writeEn),
|
.busWriteEn(writeEn),
|
.busStrobe_i(strobe_i),
|
.busStrobe_i(strobe_i),
|
.busFifoSelect(hostTxFifoSel),
|
.busFifoSelect(hostTxFifoSel),
|
.busDataIn(data_i),
|
.busDataIn(data_i),
|
.busDataOut(dataFromHostTxFifo),
|
.busDataOut(dataFromHostTxFifo),
|
.fifoDataOut(hostTxFifoData) );
|
.fifoDataOut(hostTxFifoData) );
|
|
|
|
|
RxFifo #(HOST_FIFO_DEPTH, HOST_FIFO_ADDR_WIDTH) HostRxFifo(
|
RxFifo #(HOST_FIFO_DEPTH, HOST_FIFO_ADDR_WIDTH) HostRxFifo(
|
.clk(clk),
|
.clk(clk),
|
.rst(rst),
|
.rst(rst),
|
.fifoWEn(hostRxFifoWE),
|
.fifoWEn(hostRxFifoWE),
|
.fifoFull(hostRxFifoFull),
|
.fifoFull(hostRxFifoFull),
|
.busAddress(address_i[2:0]),
|
.busAddress(address_i[2:0]),
|
.busWriteEn(writeEn),
|
.busWriteEn(writeEn),
|
.busStrobe_i(strobe_i),
|
.busStrobe_i(strobe_i),
|
.busFifoSelect(hostRxFifoSel),
|
.busFifoSelect(hostRxFifoSel),
|
.busDataIn(data_i),
|
.busDataIn(data_i),
|
.busDataOut(dataFromHostRxFifo),
|
.busDataOut(dataFromHostRxFifo),
|
.fifoDataIn(hostRxFifoData) );
|
.fifoDataIn(hostRxFifoData) );
|
|
|
//---Slave fifos
|
//---Slave fifos
|
|
|
TxFifo #(EP0_FIFO_DEPTH, EP0_FIFO_ADDR_WIDTH) EP0TxFifo (
|
TxFifo #(EP0_FIFO_DEPTH, EP0_FIFO_ADDR_WIDTH) EP0TxFifo (
|
.clk(clk),
|
.clk(clk),
|
.rst(rst),
|
.rst(rst),
|
.fifoREn(TxFifoEP0REn),
|
.fifoREn(TxFifoEP0REn),
|
.fifoEmpty(TxFifoEP0Empty),
|
.fifoEmpty(TxFifoEP0Empty),
|
.busAddress(address_i[2:0]),
|
.busAddress(address_i[2:0]),
|
.busWriteEn(writeEn),
|
.busWriteEn(writeEn),
|
.busStrobe_i(strobe_i),
|
.busStrobe_i(strobe_i),
|
.busFifoSelect(slaveEP0TxFifoSel),
|
.busFifoSelect(slaveEP0TxFifoSel),
|
.busDataIn(data_i),
|
.busDataIn(data_i),
|
.busDataOut(dataFromEP0TxFifo),
|
.busDataOut(dataFromEP0TxFifo),
|
.fifoDataOut(TxFifoEP0Data) );
|
.fifoDataOut(TxFifoEP0Data) );
|
|
|
TxFifo #(EP1_FIFO_DEPTH, EP1_FIFO_ADDR_WIDTH) EP1TxFifo (
|
TxFifo #(EP1_FIFO_DEPTH, EP1_FIFO_ADDR_WIDTH) EP1TxFifo (
|
.clk(clk),
|
.clk(clk),
|
.rst(rst),
|
.rst(rst),
|
.fifoREn(TxFifoEP1REn),
|
.fifoREn(TxFifoEP1REn),
|
.fifoEmpty(TxFifoEP1Empty),
|
.fifoEmpty(TxFifoEP1Empty),
|
.busAddress(address_i[2:0]),
|
.busAddress(address_i[2:0]),
|
.busWriteEn(writeEn),
|
.busWriteEn(writeEn),
|
.busStrobe_i(strobe_i),
|
.busStrobe_i(strobe_i),
|
.busFifoSelect(slaveEP1TxFifoSel),
|
.busFifoSelect(slaveEP1TxFifoSel),
|
.busDataIn(data_i),
|
.busDataIn(data_i),
|
.busDataOut(dataFromEP1TxFifo),
|
.busDataOut(dataFromEP1TxFifo),
|
.fifoDataOut(TxFifoEP1Data) );
|
.fifoDataOut(TxFifoEP1Data) );
|
|
|
TxFifo #(EP2_FIFO_DEPTH, EP2_FIFO_ADDR_WIDTH) EP2TxFifo (
|
TxFifo #(EP2_FIFO_DEPTH, EP2_FIFO_ADDR_WIDTH) EP2TxFifo (
|
.clk(clk),
|
.clk(clk),
|
.rst(rst),
|
.rst(rst),
|
.fifoREn(TxFifoEP2REn),
|
.fifoREn(TxFifoEP2REn),
|
.fifoEmpty(TxFifoEP2Empty),
|
.fifoEmpty(TxFifoEP2Empty),
|
.busAddress(address_i[2:0]),
|
.busAddress(address_i[2:0]),
|
.busWriteEn(writeEn),
|
.busWriteEn(writeEn),
|
.busStrobe_i(strobe_i),
|
.busStrobe_i(strobe_i),
|
.busFifoSelect(slaveEP2TxFifoSel),
|
.busFifoSelect(slaveEP2TxFifoSel),
|
.busDataIn(data_i),
|
.busDataIn(data_i),
|
.busDataOut(dataFromEP2TxFifo),
|
.busDataOut(dataFromEP2TxFifo),
|
.fifoDataOut(TxFifoEP2Data) );
|
.fifoDataOut(TxFifoEP2Data) );
|
|
|
TxFifo #(EP3_FIFO_DEPTH, EP3_FIFO_ADDR_WIDTH) EP3TxFifo (
|
TxFifo #(EP3_FIFO_DEPTH, EP3_FIFO_ADDR_WIDTH) EP3TxFifo (
|
.clk(clk),
|
.clk(clk),
|
.rst(rst),
|
.rst(rst),
|
.fifoREn(TxFifoEP3REn),
|
.fifoREn(TxFifoEP3REn),
|
.fifoEmpty(TxFifoEP3Empty),
|
.fifoEmpty(TxFifoEP3Empty),
|
.busAddress(address_i[2:0]),
|
.busAddress(address_i[2:0]),
|
.busWriteEn(writeEn),
|
.busWriteEn(writeEn),
|
.busStrobe_i(strobe_i),
|
.busStrobe_i(strobe_i),
|
.busFifoSelect(slaveEP3TxFifoSel),
|
.busFifoSelect(slaveEP3TxFifoSel),
|
.busDataIn(data_i),
|
.busDataIn(data_i),
|
.busDataOut(dataFromEP3TxFifo),
|
.busDataOut(dataFromEP3TxFifo),
|
.fifoDataOut(TxFifoEP3Data) );
|
.fifoDataOut(TxFifoEP3Data) );
|
|
|
RxFifo #(EP0_FIFO_DEPTH, EP0_FIFO_ADDR_WIDTH) EP0RxFifo(
|
RxFifo #(EP0_FIFO_DEPTH, EP0_FIFO_ADDR_WIDTH) EP0RxFifo(
|
.clk(clk),
|
.clk(clk),
|
.rst(rst),
|
.rst(rst),
|
.fifoWEn(RxFifoEP0WEn),
|
.fifoWEn(RxFifoEP0WEn),
|
.fifoFull(RxFifoEP0Full),
|
.fifoFull(RxFifoEP0Full),
|
.busAddress(address_i[2:0]),
|
.busAddress(address_i[2:0]),
|
.busWriteEn(writeEn),
|
.busWriteEn(writeEn),
|
.busStrobe_i(strobe_i),
|
.busStrobe_i(strobe_i),
|
.busFifoSelect(slaveEP0RxFifoSel),
|
.busFifoSelect(slaveEP0RxFifoSel),
|
.busDataIn(data_i),
|
.busDataIn(data_i),
|
.busDataOut(dataFromEP0RxFifo),
|
.busDataOut(dataFromEP0RxFifo),
|
.fifoDataIn(slaveRxFifoData) );
|
.fifoDataIn(slaveRxFifoData) );
|
|
|
RxFifo #(EP1_FIFO_DEPTH, EP1_FIFO_ADDR_WIDTH) EP1RxFifo(
|
RxFifo #(EP1_FIFO_DEPTH, EP1_FIFO_ADDR_WIDTH) EP1RxFifo(
|
.clk(clk),
|
.clk(clk),
|
.rst(rst),
|
.rst(rst),
|
.fifoWEn(RxFifoEP1WEn),
|
.fifoWEn(RxFifoEP1WEn),
|
.fifoFull(RxFifoEP1Full),
|
.fifoFull(RxFifoEP1Full),
|
.busAddress(address_i[2:0]),
|
.busAddress(address_i[2:0]),
|
.busWriteEn(writeEn),
|
.busWriteEn(writeEn),
|
.busStrobe_i(strobe_i),
|
.busStrobe_i(strobe_i),
|
.busFifoSelect(slaveEP1RxFifoSel),
|
.busFifoSelect(slaveEP1RxFifoSel),
|
.busDataIn(data_i),
|
.busDataIn(data_i),
|
.busDataOut(dataFromEP1RxFifo),
|
.busDataOut(dataFromEP1RxFifo),
|
.fifoDataIn(slaveRxFifoData) );
|
.fifoDataIn(slaveRxFifoData) );
|
|
|
RxFifo #(EP2_FIFO_DEPTH, EP2_FIFO_ADDR_WIDTH) EP2RxFifo(
|
RxFifo #(EP2_FIFO_DEPTH, EP2_FIFO_ADDR_WIDTH) EP2RxFifo(
|
.clk(clk),
|
.clk(clk),
|
.rst(rst),
|
.rst(rst),
|
.fifoWEn(RxFifoEP2WEn),
|
.fifoWEn(RxFifoEP2WEn),
|
.fifoFull(RxFifoEP2Full),
|
.fifoFull(RxFifoEP2Full),
|
.busAddress(address_i[2:0]),
|
.busAddress(address_i[2:0]),
|
.busWriteEn(writeEn),
|
.busWriteEn(writeEn),
|
.busStrobe_i(strobe_i),
|
.busStrobe_i(strobe_i),
|
.busFifoSelect(slaveEP2RxFifoSel),
|
.busFifoSelect(slaveEP2RxFifoSel),
|
.busDataIn(data_i),
|
.busDataIn(data_i),
|
.busDataOut(dataFromEP2RxFifo),
|
.busDataOut(dataFromEP2RxFifo),
|
.fifoDataIn(slaveRxFifoData) );
|
.fifoDataIn(slaveRxFifoData) );
|
|
|
RxFifo #(EP3_FIFO_DEPTH, EP3_FIFO_ADDR_WIDTH) EP3RxFifo(
|
RxFifo #(EP3_FIFO_DEPTH, EP3_FIFO_ADDR_WIDTH) EP3RxFifo(
|
.clk(clk),
|
.clk(clk),
|
.rst(rst),
|
.rst(rst),
|
.fifoWEn(RxFifoEP3WEn),
|
.fifoWEn(RxFifoEP3WEn),
|
.fifoFull(RxFifoEP3Full),
|
.fifoFull(RxFifoEP3Full),
|
.busAddress(address_i[2:0]),
|
.busAddress(address_i[2:0]),
|
.busWriteEn(writeEn),
|
.busWriteEn(writeEn),
|
.busStrobe_i(strobe_i),
|
.busStrobe_i(strobe_i),
|
.busFifoSelect(slaveEP3RxFifoSel),
|
.busFifoSelect(slaveEP3RxFifoSel),
|
.busDataIn(data_i),
|
.busDataIn(data_i),
|
.busDataOut(dataFromEP3RxFifo),
|
.busDataOut(dataFromEP3RxFifo),
|
.fifoDataIn(slaveRxFifoData) );
|
.fifoDataIn(slaveRxFifoData) );
|
|
|
endmodule
|
endmodule
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|