//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// usbHostSlaveWrap.v ////
|
//// usbHostSlaveWrap.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 wrapper. Enable connection to Altera Avalon bus
|
//// Top level module wrapper. Enable connection to Altera Avalon bus
|
//// ////
|
//// ////
|
//// 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 usbHostSlaveWrap(
|
module usbHostSlaveWrap(
|
clk,
|
clk,
|
reset,
|
reset,
|
address,
|
address,
|
writedata,
|
writedata,
|
readdata,
|
readdata,
|
write,
|
write,
|
read,
|
read,
|
waitrequest,
|
waitrequest,
|
chipselect,
|
chipselect,
|
irq,
|
irq,
|
usbClk,
|
usbClk,
|
USBWireVPI,
|
USBWireVPI,
|
USBWireVMI,
|
USBWireVMI,
|
USBWireDataInTick,
|
USBWireDataInTick,
|
USBWireVPO,
|
USBWireVPO,
|
USBWireVMO,
|
USBWireVMO,
|
USBWireDataOutTick,
|
USBWireDataOutTick,
|
USBWireOutEn_n,
|
USBWireOutEn_n,
|
USBFullSpeed
|
USBFullSpeed
|
);
|
);
|
|
|
input clk;
|
input clk;
|
input reset;
|
input reset;
|
input [7:0] address;
|
input [7:0] address;
|
input [7:0] writedata;
|
input [7:0] writedata;
|
output [7:0] readdata;
|
output [7:0] readdata;
|
input write;
|
input write;
|
input read;
|
input read;
|
output waitrequest;
|
output waitrequest;
|
input chipselect;
|
input chipselect;
|
output irq;
|
output irq;
|
input usbClk;
|
input usbClk;
|
input USBWireVPI;
|
input USBWireVPI;
|
input USBWireVMI;
|
input USBWireVMI;
|
output USBWireVPO;
|
output USBWireVPO;
|
output USBWireVMO;
|
output USBWireVMO;
|
output USBWireDataOutTick;
|
output USBWireDataOutTick;
|
output USBWireDataInTick;
|
output USBWireDataInTick;
|
output USBWireOutEn_n;
|
output USBWireOutEn_n;
|
output USBFullSpeed;
|
output USBFullSpeed;
|
|
|
wire clk;
|
wire clk;
|
wire reset;
|
wire reset;
|
wire [7:0] address;
|
wire [7:0] address;
|
wire [7:0] writedata;
|
wire [7:0] writedata;
|
wire [7:0] readdata;
|
wire [7:0] readdata;
|
wire write;
|
wire write;
|
wire read;
|
wire read;
|
wire waitrequest;
|
wire waitrequest;
|
wire chipselect;
|
wire chipselect;
|
wire irq;
|
wire irq;
|
wire usbClk;
|
wire usbClk;
|
wire USBWireVPI;
|
wire USBWireVPI;
|
wire USBWireVMI;
|
wire USBWireVMI;
|
wire USBWireVPO;
|
wire USBWireVPO;
|
wire USBWireVMO;
|
wire USBWireVMO;
|
wire USBWireDataOutTick;
|
wire USBWireDataOutTick;
|
wire USBWireDataInTick;
|
wire USBWireDataInTick;
|
wire USBWireOutEn_n;
|
wire USBWireOutEn_n;
|
wire USBFullSpeed;
|
wire USBFullSpeed;
|
|
|
//internal wiring
|
//internal wiring
|
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 USBWireCtrlOut;
|
wire USBWireCtrlOut;
|
wire [1:0] USBWireDataIn;
|
wire [1:0] USBWireDataIn;
|
wire [1:0] USBWireDataOut;
|
wire [1:0] USBWireDataOut;
|
|
|
|
|
assign irq = hostSOFSentIntOut | hostConnEventIntOut |
|
assign irq = hostSOFSentIntOut | hostConnEventIntOut |
|
hostResumeIntOut | hostTransDoneIntOut |
|
hostResumeIntOut | hostTransDoneIntOut |
|
slaveSOFRxedIntOut | slaveResetEventIntOut |
|
slaveSOFRxedIntOut | slaveResetEventIntOut |
|
slaveResumeIntOut | slaveTransDoneIntOut |
|
slaveResumeIntOut | slaveTransDoneIntOut |
|
slaveNAKSentIntOut;
|
slaveNAKSentIntOut;
|
|
|
assign strobe_i = chipselect & ( read | write);
|
assign strobe_i = chipselect & ( read | write);
|
assign waitrequest = ~ack_o;
|
assign waitrequest = ~ack_o;
|
|
|
assign USBWireOutEn_n = ~USBWireCtrlOut;
|
assign USBWireOutEn_n = ~USBWireCtrlOut;
|
|
|
assign USBWireDataIn = {USBWireVPI, USBWireVMI};
|
assign USBWireDataIn = {USBWireVPI, USBWireVMI};
|
assign {USBWireVPO, USBWireVMO} = USBWireDataOut;
|
assign {USBWireVPO, USBWireVMO} = USBWireDataOut;
|
|
|
//Parameters declaration:
|
//Parameters declaration:
|
defparam usbHostSlaveInst.HOST_FIFO_DEPTH = 64;
|
defparam usbHostSlaveInst.HOST_FIFO_DEPTH = 64;
|
parameter HOST_FIFO_DEPTH = 64;
|
parameter HOST_FIFO_DEPTH = 64;
|
defparam usbHostSlaveInst.HOST_FIFO_ADDR_WIDTH = 6;
|
defparam usbHostSlaveInst.HOST_FIFO_ADDR_WIDTH = 6;
|
parameter HOST_FIFO_ADDR_WIDTH = 6;
|
parameter HOST_FIFO_ADDR_WIDTH = 6;
|
defparam usbHostSlaveInst.EP0_FIFO_DEPTH = 64;
|
defparam usbHostSlaveInst.EP0_FIFO_DEPTH = 64;
|
parameter EP0_FIFO_DEPTH = 64;
|
parameter EP0_FIFO_DEPTH = 64;
|
defparam usbHostSlaveInst.EP0_FIFO_ADDR_WIDTH = 6;
|
defparam usbHostSlaveInst.EP0_FIFO_ADDR_WIDTH = 6;
|
parameter EP0_FIFO_ADDR_WIDTH = 6;
|
parameter EP0_FIFO_ADDR_WIDTH = 6;
|
defparam usbHostSlaveInst.EP1_FIFO_DEPTH = 64;
|
defparam usbHostSlaveInst.EP1_FIFO_DEPTH = 64;
|
parameter EP1_FIFO_DEPTH = 64;
|
parameter EP1_FIFO_DEPTH = 64;
|
defparam usbHostSlaveInst.EP1_FIFO_ADDR_WIDTH = 6;
|
defparam usbHostSlaveInst.EP1_FIFO_ADDR_WIDTH = 6;
|
parameter EP1_FIFO_ADDR_WIDTH = 6;
|
parameter EP1_FIFO_ADDR_WIDTH = 6;
|
defparam usbHostSlaveInst.EP2_FIFO_DEPTH = 64;
|
defparam usbHostSlaveInst.EP2_FIFO_DEPTH = 64;
|
parameter EP2_FIFO_DEPTH = 64;
|
parameter EP2_FIFO_DEPTH = 64;
|
defparam usbHostSlaveInst.EP2_FIFO_ADDR_WIDTH = 6;
|
defparam usbHostSlaveInst.EP2_FIFO_ADDR_WIDTH = 6;
|
parameter EP2_FIFO_ADDR_WIDTH = 6;
|
parameter EP2_FIFO_ADDR_WIDTH = 6;
|
defparam usbHostSlaveInst.EP3_FIFO_DEPTH = 64;
|
defparam usbHostSlaveInst.EP3_FIFO_DEPTH = 64;
|
parameter EP3_FIFO_DEPTH = 64;
|
parameter EP3_FIFO_DEPTH = 64;
|
defparam usbHostSlaveInst.EP3_FIFO_ADDR_WIDTH = 6;
|
defparam usbHostSlaveInst.EP3_FIFO_ADDR_WIDTH = 6;
|
parameter EP3_FIFO_ADDR_WIDTH = 6;
|
parameter EP3_FIFO_ADDR_WIDTH = 6;
|
usbHostSlave usbHostSlaveInst (
|
usbHostSlave usbHostSlaveInst (
|
.clk_i(clk),
|
.clk_i(clk),
|
.rst_i(reset),
|
.rst_i(reset),
|
.address_i(address),
|
.address_i(address),
|
.data_i(writedata),
|
.data_i(writedata),
|
.data_o(readdata),
|
.data_o(readdata),
|
.we_i(write),
|
.we_i(write),
|
.strobe_i(strobe_i),
|
.strobe_i(strobe_i),
|
.ack_o(ack_o),
|
.ack_o(ack_o),
|
.usbClk(usbClk),
|
.usbClk(usbClk),
|
.hostSOFSentIntOut(hostSOFSentIntOut),
|
.hostSOFSentIntOut(hostSOFSentIntOut),
|
.hostConnEventIntOut(hostConnEventIntOut),
|
.hostConnEventIntOut(hostConnEventIntOut),
|
.hostResumeIntOut(hostResumeIntOut),
|
.hostResumeIntOut(hostResumeIntOut),
|
.hostTransDoneIntOut(hostTransDoneIntOut),
|
.hostTransDoneIntOut(hostTransDoneIntOut),
|
.slaveSOFRxedIntOut(slaveSOFRxedIntOut),
|
.slaveSOFRxedIntOut(slaveSOFRxedIntOut),
|
.slaveResetEventIntOut(slaveResetEventIntOut),
|
.slaveResetEventIntOut(slaveResetEventIntOut),
|
.slaveResumeIntOut(slaveResumeIntOut),
|
.slaveResumeIntOut(slaveResumeIntOut),
|
.slaveTransDoneIntOut(slaveTransDoneIntOut),
|
.slaveTransDoneIntOut(slaveTransDoneIntOut),
|
.slaveNAKSentIntOut(slaveNAKSentIntOut),
|
.slaveNAKSentIntOut(slaveNAKSentIntOut),
|
.USBWireDataIn(USBWireDataIn),
|
.USBWireDataIn(USBWireDataIn),
|
.USBWireDataInTick(USBWireDataInTick),
|
.USBWireDataInTick(USBWireDataInTick),
|
.USBWireDataOut(USBWireDataOut),
|
.USBWireDataOut(USBWireDataOut),
|
.USBWireDataOutTick(USBWireDataOutTick),
|
.USBWireDataOutTick(USBWireDataOutTick),
|
.USBWireCtrlOut(USBWireCtrlOut),
|
.USBWireCtrlOut(USBWireCtrlOut),
|
.USBFullSpeed(USBFullSpeed));
|
.USBFullSpeed(USBFullSpeed));
|
|
|
|
|
endmodule
|
endmodule
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|