|
Message
From: Mark Bourne<dkglyp802@s...>
Date: Tue Jan 3 23:59:20 CET 2006
Subject: [usb] USB 1.1 function core
Apologies for a long email - I've tried to give as much information as I can to avoid people keep having to ask for it. Apologies if it's not all relevant.
I am trying to build a USB 1.1 device with 2 endpoints - 1 interrupt IN and 1 interrupt OUT. To start with, I am trying a simple loopback device - any data sent to the device on the OUT endpoint should be returned on the IN endpoint. However, I can't even get the device to be recognised, let alone do anything useful. I think I have connected the core correctly, and changed usb1_rom1.v, but have not had any success. I've attached these files: - testusb.vhd - VHDL file instantiating the core - testusb.scd - constraints file - usb1_rom1.v - modified ROM All other files are as they come from the opencores projects (usb1_funct, usb_phy, generic_fifos, common/generic_memories)
I am using an Altera Cyclone EP1C12Q240C8 FPGA on the UP3 development board, which incorporates a USB1T11A PHY chip and relevant clocks. Software is Synplicity Synplify Pro 8.2.1 and Altera Quartus II 5.1.
When I compile the code in Synplify, I get 276 warnings, mostly one of: - Case statement has both a full_case directive and a default clause. The full_case directive is ignored. - Unrecognized synthesis directive enum - Unrecognized synthesis directive state - Various warnings about unconnected signals and things being optimised out I don't think these are a problem. Several which may be a problem (I'm not sure) are like: - ...\usb1_funct\rtl\verilog\usb1_pe.v":337:4:337:17|Case tag overlaps with a previous tag (case branches 1 and 2) - ...\usb1_funct\rtl\verilog\usb1_pe.v":339:4:339:17|Case tag overlaps with a previous tag (case branches 1 and 3) - ...\usb1_funct\rtl\verilog\usb1_pe.v":340:4:340:17|Case tag overlaps with a previous tag (case branches 1 and 4) - ...\usb1_funct\rtl\verilog\usb1_pe.v":341:4:341:17|Case tag overlaps with a previous tag (case branches 1 and 5) There are a lot of these.
Quartus gives the following warnings: - Port "data_b" on the entity instantiation of "I_1_Z" is connected to a signal of width 1. The formal width of the signal in the module is 8. Extra bits will be driven by GND. (I don't know what's causing this) - Port "data_b" on the entity instantiation of "I_1_Z" is connected to a signal of width 1. The formal width of the signal in the module is 8. Extra bits will be driven by GND. (I don't know what's causing this) - Port "data_b" on the entity instantiation of "I_1_Z" is connected to a signal of width 1. The formal width of the signal in the module is 8. Extra bits will be driven by GND. (I don't know what's causing this) - Port "data_b" on the entity instantiation of "I_1_Z" is connected to a signal of width 1. The formal width of the signal in the module is 8. Extra bits will be driven by GND. (I don't know what's causing this) - Output pins are stuck at VCC or GND (This I know and is deliberate) - Pin "n_clk_cpu_stop" stuck at VCC (This I know and is deliberate) - Following 1 pins have nothing, GND, or VCC driving datain port -- changes to this connectivity may change fitting results (This I know and is deliberate) - Can't achieve timing requirement Clock Setup: 'clk_usb' along 210 path(s). See Report window for details. ( I don't know what to do about this) - Can't achieve timing requirement Clock Setup: 'clk_cpu' along 107 path(s). See Report window for details. ( I don't know what to do about this)
When I program this onto the FPGA, and connect a USB cable, windows detects a "USB Device", but can not install a driver for it (understandable, since I haven't yet created one). Using the "inf-wizard" from libusb-win32 (
-------------- next part --------------
/////////////////////////////////////////////////////////////////////
//// ////
//// Descriptor ROM ////
//// ////
//// ////
//// Author: Rudolf Usselmann ////
////
-------------- next part --------------
/////////////////////////////////////////////////////////////////////
//// ////
//// Descriptor ROM ////
//// ////
//// ////
//// Author: Rudolf Usselmann ////
////
-------------- next part --------------
/////////////////////////////////////////////////////////////////////
//// ////
//// Descriptor ROM ////
//// ////
//// ////
//// Author: Rudolf Usselmann ////
////
-------------- next part --------------
/////////////////////////////////////////////////////////////////////
//// ////
//// Descriptor ROM ////
//// ////
//// ////
//// Author: Rudolf Usselmann ////
////
-------------- next part --------------
/////////////////////////////////////////////////////////////////////
//// ////
//// Descriptor ROM ////
//// ////
//// ////
//// Author: Rudolf Usselmann ////
////
-------------- next part --------------
/////////////////////////////////////////////////////////////////////
//// ////
//// Descriptor ROM ////
//// ////
//// ////
//// Author: Rudolf Usselmann ////
////
-------------- next part --------------
/////////////////////////////////////////////////////////////////////
//// ////
//// Descriptor ROM ////
//// ////
//// ////
//// Author: Rudolf Usselmann ////
////
-------------- next part --------------
/////////////////////////////////////////////////////////////////////
//// ////
//// Descriptor ROM ////
//// ////
//// ////
//// Author: Rudolf Usselmann ////
////
-------------- next part --------------
/////////////////////////////////////////////////////////////////////
//// ////
//// Descriptor ROM ////
//// ////
//// ////
//// Author: Rudolf Usselmann ////
////
-------------- next part --------------
/////////////////////////////////////////////////////////////////////
//// ////
//// Descriptor ROM ////
//// ////
//// ////
//// Author: Rudolf Usselmann ////
//// rudi@a... ////
//// ////
//// ////
//// Downloaded from: http://www.opencores.org/cores/usb1_funct/////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2000-2002 Rudolf Usselmann ////
//// www.asics.ws ////
//// usb ////
//// ////
//// ////
//// Downloaded from: http://www.opencores.org/cores/usb1_funct/////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2000-2002 Rudolf Usselmann ////
//// www.asics.ws ////
//// usb ////
//// ////
//// ////
//// Downloaded from: http://www.opencores.org/cores/usb1_funct/////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2000-2002 Rudolf Usselmann ////
//// www.asics.ws ////
//// usb ////
//// ////
//// ////
//// Downloaded from: http://www.opencores.org/cores/usb1_funct/////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2000-2002 Rudolf Usselmann ////
//// www.asics.ws ////
//// usb ////
//// ////
//// ////
//// Downloaded from: http://www.opencores.org/cores/usb1_funct/////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2000-2002 Rudolf Usselmann ////
//// www.asics.ws ////
//// usb ////
//// ////
//// ////
//// Downloaded from: http://www.opencores.org/cores/usb1_funct/////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2000-2002 Rudolf Usselmann ////
//// www.asics.ws ////
//// usb ////
//// ////
//// ////
//// Downloaded from: http://www.opencores.org/cores/usb1_funct/////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2000-2002 Rudolf Usselmann ////
//// www.asics.ws ////
//// usb ////
//// ////
//// ////
//// Downloaded from: http://www.opencores.org/cores/usb1_funct/////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2000-2002 Rudolf Usselmann ////
//// www.asics.ws ////
//// usb ////
//// ////
//// ////
//// Downloaded from: http://www.opencores.org/cores/usb1_funct/////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2000-2002 Rudolf Usselmann ////
//// www.asics.ws ////
//// usb ////
//// ////
//// ////
//// Downloaded from: http://www.opencores.org/cores/usb1_funct/////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2000-2002 Rudolf Usselmann ////
//// www.asics.ws ////
//// usb ////
//// ////
//// ////
//// Downloaded from: http://www.opencores.org/cores/usb1_funct/////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2000-2002 Rudolf Usselmann ////
//// www.asics.ws ////
//// usb ////
//// ////
//// ////
//// Downloaded from: http://www.opencores.org/cores/usb1_funct/////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2000-2002 Rudolf Usselmann ////
//// www.asics.ws ////
//// usb ////
//// ////
//// ////
//// Downloaded from: http://www.opencores.org/cores/usb1_funct/////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2000-2002 Rudolf Usselmann ////
//// www.asics.ws ////
//// usb ////
//// ////
//// ////
//// Downloaded from: http://www.opencores.org/cores/usb1_funct/////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2000-2002 Rudolf Usselmann ////
//// www.asics.ws ////
//// usb ////
//// ////
//// ////
//// Downloaded from: http://www.opencores.org/cores/usb1_funct/////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2000-2002 Rudolf Usselmann ////
//// www.asics.ws ////
//// usb ////
//// ////
//// ////
//// Downloaded from: http://www.opencores.org/cores/usb1_funct/////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2000-2002 Rudolf Usselmann ////
//// www.asics.ws ////
//// usb ////
//// ////
//// ////
//// Downloaded from: http://www.opencores.org/cores/usb1_funct/////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2000-2002 Rudolf Usselmann ////
//// www.asics.ws ////
//// usb ////
//// ////
//// ////
//// Downloaded from: http://www.opencores.org/cores/usb1_funct/////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2000-2002 Rudolf Usselmann ////
//// www.asics.ws ////
//// usb ////
//// ////
//// ////
//// Downloaded from: http://www.opencores.org/cores/usb1_funct/////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2000-2002 Rudolf Usselmann ////
//// www.asics.ws ////
//// usb ////
//// ////
//// ////
//// Downloaded from: http://www.opencores.org/cores/usb1_funct/////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2000-2002 Rudolf Usselmann ////
//// www.asics.ws ////
//// usb) reveals a device with vendor ID and product ID both 0x0000. This may be good, except that this much happens even if the FPGA has not been programmed! The vendor ID should be 0x1234, and the device ID 0x5678.
I have tried altering several things, but have failed to get any better than this. Any help/advice to get a working device would be very much appreciated. If I've missed any information you need in order to help, just ask.
Many thanks, Mark.
-------------- next part -------------- library ieee; use ieee.std_logic_1164.all;
entity testusb is port (clk_usb, clk_cpu, n_rst, phy_rx_dp, phy_rx_dn, phy_rx_d: in std_logic; n_clk_cpu_stop, phy_tx_dp, phy_tx_dn, phy_tx_oe: out std_logic); -- dout: out std_logic_vector(3 downto 0)); end entity testusb;
--INPUTS REQUIRED:- --- clk_usb (48MHz) --- clk_cpu (100MHz) --- n_rst --- phy_rx_dp --- phy_rx_dn --- phy_rx_d
--OUTPUTS REQUIRED:-
--- phy_tx_dp
--- phy_tx_dn
--- phy_tx_oe
--SIGNALS REQUIRED:-
--- usb_rst
--- ep_busy
--- ep_sel
--- infifo_din
--- infifo_we
--- infifo_dout
--- infifo_re
--- infifo_full
--- infifo_empty
--- outfifo_din
--- outfifo_we
--- outfifo_dout
--- outfifo_re
--- outfifo_full
--- outfifo_empty
architecture rtl of testusb is
type states is (Idle, Transfer1, Transfer2, Transfer3);
signal pstate, nstate: states;
signal usb_rst, ep_busy: std_logic;
signal infifo_we, infifo_re, infifo_full, infifo_empty: std_logic;
signal outfifo_we, outfifo_re, outfifo_full, outfifo_empty: std_logic;
signal ep_sel: std_logic_vector(3 downto 0);
signal infifo_din, infifo_dout, outfifo_din, outfifo_dout: std_logic_vector(7 downto 0);
-- signal n_cpu_clk: std_logic;
-- signal ffclk: std_logic;
-- Endpoint Configuration Constants
constant epIN: std_logic_vector(13 downto 0) := "00001000000000";
constant epOUT: std_logic_vector(13 downto 0) := "00010000000000";
constant CTRL: std_logic_vector(13 downto 0) := "10100000000000";
constant ISO: std_logic_vector(13 downto 0) := "01000000000000";
constant BULK: std_logic_vector(13 downto 0) := "10000000000000";
constant INT: std_logic_vector(13 downto 0) := "00000000000000";
component usb1_core is
port (clk_i, rst_i: in std_logic;
-- USB PHY Interface
tx_dp, tx_dn, tx_oe: out std_logic;
rx_d, rx_dp, rx_dn: in std_logic;
-- USB Misc
phy_tx_mode: in std_logic; usb_rst: out std_logic;
-- Interrupts
dropped_frame, misaligned_frame: out std_logic;
crc16_err: out std_logic;
-- Vendor Features
v_set_int, v_set_feature: out std_logic; wValue: out std_logic_vector(15 downto 0);
wIndex: out std_logic_vector(15 downto 0); vendor_data: in std_logic_vector(15 downto 0);
-- USB Status
usb_busy: out std_logic; ep_sel: out std_logic_vector(3 downto 0);
-- Endpoint Interface
ep1_cfg: in std_logic_vector(13 downto 0);
ep1_din: in std_logic_vector(7 downto 0); ep1_we: out std_logic; ep1_full: in std_logic;
ep1_dout: out std_logic_vector(7 downto 0); ep1_re: out std_logic; ep1_empty: in std_logic;
ep1_bf_en: in std_logic; ep1_bf_size: in std_logic_vector(6 downto 0);
ep2_cfg: in std_logic_vector(13 downto 0);
ep2_din: in std_logic_vector(7 downto 0); ep2_we: out std_logic; ep2_full: in std_logic;
ep2_dout: out std_logic_vector(7 downto 0); ep2_re: out std_logic; ep2_empty: in std_logic;
ep2_bf_en: in std_logic; ep2_bf_size: in std_logic_vector(6 downto 0);
ep3_cfg: in std_logic_vector(13 downto 0);
ep3_din: in std_logic_vector(7 downto 0); ep3_we: out std_logic; ep3_full: in std_logic;
ep3_dout: out std_logic_vector(7 downto 0); ep3_re: out std_logic; ep3_empty: in std_logic;
ep3_bf_en: in std_logic; ep3_bf_size: in std_logic_vector(6 downto 0);
ep4_cfg: in std_logic_vector(13 downto 0);
ep4_din: in std_logic_vector(7 downto 0); ep4_we: out std_logic; ep4_full: in std_logic;
ep4_dout: out std_logic_vector(7 downto 0); ep4_re: out std_logic; ep4_empty: in std_logic;
ep4_bf_en: in std_logic; ep4_bf_size: in std_logic_vector(6 downto 0);
ep5_cfg: in std_logic_vector(13 downto 0);
ep5_din: in std_logic_vector(7 downto 0); ep5_we: out std_logic; ep5_full: in std_logic;
ep5_dout: out std_logic_vector(7 downto 0); ep5_re: out std_logic; ep5_empty: in std_logic;
ep5_bf_en: in std_logic; ep5_bf_size: in std_logic_vector(6 downto 0);
ep6_cfg: in std_logic_vector(13 downto 0);
ep6_din: in std_logic_vector(7 downto 0); ep6_we: out std_logic; ep6_full: in std_logic;
ep6_dout: out std_logic_vector(7 downto 0); ep6_re: out std_logic; ep6_empty: in std_logic;
ep6_bf_en: in std_logic; ep6_bf_size: in std_logic_vector(6 downto 0);
ep7_cfg: in std_logic_vector(13 downto 0);
ep7_din: in std_logic_vector(7 downto 0); ep7_we: out std_logic; ep7_full: in std_logic;
ep7_dout: out std_logic_vector(7 downto 0); ep7_re: out std_logic; ep7_empty: in std_logic;
ep7_bf_en: in std_logic; ep7_bf_size: in std_logic_vector(6 downto 0)
);
end component usb1_core ;
component generic_fifo_dc is
generic (dw: integer := 8; aw: integer := 8; n: integer := 32);
port (rd_clk: in std_logic; wr_clk: in std_logic; rst: in std_logic; clr: in std_logic;
din: in std_logic_vector(dw-1 downto 0); we: in std_logic; dout:out std_logic_vector(dw-1 downto 0); re: in std_logic;
full:out std_logic; empty:out std_logic; full_n:out std_logic; empty_n:out std_logic; level: out std_logic_vector(1 downto 0) );
end component generic_fifo_dc;
begin
usbcore: usb1_core port map (
clk_i=>clk_usb, rst_i=>n_rst,
-- USB PHY Interface
tx_dp=>phy_tx_dp, tx_dn=>phy_tx_dn, tx_oe=>phy_tx_oe,
rx_d=>phy_rx_d, rx_dp=>phy_rx_dp, rx_dn=>phy_rx_dn,
-- USB Misc
phy_tx_mode=>'1', usb_rst=>usb_rst,
-- Interrupts
dropped_frame=>open, misaligned_frame=>open,
crc16_err=>open,
-- Vendor Features
v_set_int=>open, v_set_feature=>open, wValue=>open,
wIndex=>open, vendor_data=>(others=>'0'),
-- USB Status
usb_busy=>ep_busy, ep_sel=>ep_sel,
-- Endpoint Interface
ep1_cfg=>INT or epIN or "00000001000000", --Interrupt In endpoint, max packet size 64 (0x40)
ep1_dout=>open, ep1_we=>open, ep1_full=>'0',
ep1_din=>infifo_dout, ep1_re=>infifo_re, ep1_empty=>infifo_empty,
ep1_bf_en=>'0', ep1_bf_size=>(others=>'0'),
--
ep2_cfg=>INT or epOUT or "00000001000000", --Interrupt Out endpoint, max packet size 64 (0x40)
ep2_dout=>outfifo_din, ep2_we=>outfifo_we, ep2_full=>outfifo_full,
ep2_din=>(others=>'0'), ep2_re=>open, ep2_empty=>'0',
ep2_bf_en=>'0', ep2_bf_size=>(others=>'0'),
--
ep3_cfg=>(others=>'0'),
ep3_din=>(others=>'0'), ep3_we=>open, ep3_full=>'0',
ep3_dout=>open, ep3_re=>open, ep3_empty=>'0',
ep3_bf_en=>'0', ep3_bf_size=>(others=>'0'),
--
ep4_cfg=>(others=>'0'),
ep4_din=>(others=>'0'), ep4_we=>open, ep4_full=>'0',
ep4_dout=>open, ep4_re=>open, ep4_empty=>'0',
ep4_bf_en=>'0', ep4_bf_size=>(others=>'0'),
--
ep5_cfg=>(others=>'0'),
ep5_din=>(others=>'0'), ep5_we=>open, ep5_full=>'0',
ep5_dout=>open, ep5_re=>open, ep5_empty=>'0',
ep5_bf_en=>'0', ep5_bf_size=>(others=>'0'),
--
ep6_cfg=>(others=>'0'),
ep6_din=>(others=>'0'), ep6_we=>open, ep6_full=>'0',
ep6_dout=>open, ep6_re=>open, ep6_empty=>'0',
ep6_bf_en=>'0', ep6_bf_size=>(others=>'0'),
--
ep7_cfg=>(others=>'0'),
ep7_din=>(others=>'0'), ep7_we=>open, ep7_full=>'0',
ep7_dout=>open, ep7_re=>open, ep7_empty=>'0',
ep7_bf_en=>'0', ep7_bf_size=>(others=>'0')
);
infifo: generic_fifo_dc generic map (dw=>8, aw=>6, n=>0)
port map (rd_clk=>clk_usb, wr_clk=>(not clk_cpu), rst=>'1', clr=>not(n_rst),
din=>infifo_din, we=>infifo_we, dout=>infifo_dout, re=>infifo_re,
full=>infifo_full, empty=>infifo_empty, full_n=>open, empty_n=>open, level=>open );
outfifo: generic_fifo_dc generic map (dw=>8, aw=>6, n=>0)
port map (rd_clk=>(not clk_cpu), wr_clk=>clk_usb, rst=>'1', clr=>not(n_rst),
din=>outfifo_din, we=>outfifo_we, dout=>outfifo_dout, re=>outfifo_re,
full=>outfifo_full, empty=>outfifo_empty, full_n=>open, empty_n=>open, level=>open );
-- flipflop: entity WORK.flipflop port map(clk=>ffclk, din=>outfifo_dout(3 downto 0), dout=>dout);
infifo_din <= outfifo_dout;
n_clk_cpu_stop <= '1';
seq: process(clk_cpu, n_rst) is
begin
if n_rst = '0' then
pstate <= Idle;
elsif rising_edge(clk_cpu) then
pstate <= nstate;
end if;
end process seq;
p0: process(pstate, outfifo_empty, infifo_full) is
begin
case pstate is
when Idle =>
outfifo_re <= '0';
infifo_we <= '0';
-- ffclk <= '0';
if(outfifo_empty='0' and infifo_full='0') then
nstate <= Transfer1;
else
nstate <= Idle;
end if;
when Transfer1 =>
outfifo_re <= '1';
infifo_we <= '1';
-- ffclk <= '0';
nstate <= Transfer2;
when Transfer2 =>
outfifo_re <= '0';
infifo_we <= '0';
-- ffclk <= '1';
nstate <= Idle;
when Transfer3 =>
outfifo_re <= '0';
infifo_we <= '0';
-- ffclk <= '0';
nstate <= Idle;
end case;
end process p0;
end architecture rtl;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testusb.sdc
Type: application/vnd.stardivision.calc
Size: 8593 bytes
Desc: not available
Url : http://www.opencores.org/forums.cgi/usb/attachments/20060103/c9912c29/testusb-0001.sdc
-------------- next part --------------
/////////////////////////////////////////////////////////////////////
//// ////
//// Descriptor ROM ////
//// ////
//// ////
//// Author: Rudolf Usselmann ////
//// rudi@a... ////
//// ////
//// ////
//// Downloaded from: http://www.opencores.org/cores/usb1_funct/////
//// ////
/////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2000-2002 Rudolf Usselmann ////
//// www.asics.ws ////
//// rudi@a... ////
//// ////
//// This source file may be used and distributed without ////
//// restriction provided that this copyright statement is not ////
//// removed from the file and that any derivative work contains ////
//// the original copyright notice and the associated disclaimer.////
//// ////
//// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
//// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
//// POSSIBILITY OF SUCH DAMAGE. ////
//// ////
/////////////////////////////////////////////////////////////////////
// CVS Log
//
// $Id: usb1_rom1.v,v 1.1.1.1 2002/09/19 12:07:29 rudi Exp $
//
// $Date: 2002/09/19 12:07:29 $
// $Revision: 1.1.1.1 $
// $Author: rudi $
// $Locker: $
// $State: Exp $
//
// Change History:
// $Log: usb1_rom1.v,v $
// Revision 1.1.1.1 2002/09/19 12:07:29 rudi
// Initial Checkin
//
//
//
//
//
//
`include "usb1_defines.v"
module usb1_rom1(clk, adr, dout);
input clk;
input [6:0] adr;
output [7:0] dout;
reg [7:0] dout;
always @(posedge clk)
case(adr) // synopsys full_case parallel_case
// ====================================
// ===== DEVICE Descriptor =====
// ====================================
7'h00: dout <= #1 8'd18; // this descriptor length
7'h01: dout <= #1 8'h01; // descriptor type
7'h02: dout <= #1 8'h00; // USB version low byte
7'h03: dout <= #1 8'h01; // USB version high byte
7'h04: dout <= #1 8'hff; // device class
7'h05: dout <= #1 8'h00; // device sub class
7'h06: dout <= #1 8'hff; // device protocol
7'h07: dout <= #1 8'd64; // max packet size
7'h08: dout <= #1 8'h34; // vendor ID low byte
7'h09: dout <= #1 8'h12; // vendor ID high byte
7'h0a: dout <= #1 8'h78; // product ID low byte
7'h0b: dout <= #1 8'h56; // product ID high byte
7'h0c: dout <= #1 8'h10; // device rel. number low byte
7'h0d: dout <= #1 8'h00; // device rel. number high byte
7'h0e: dout <= #1 8'h00; // Manufacturer String Index
7'h0f: dout <= #1 8'h00; // Product Descr. String Index
7'h10: dout <= #1 8'h00; // S/N String Index
7'h11: dout <= #1 8'h01; // Number of possible config.
// ====================================
// ===== Configuration Descriptor =====
// ====================================
7'h12: dout <= #1 8'h09; // this descriptor length
7'h13: dout <= #1 8'h02; // descriptor type
7'h14: dout <= #1 8'd53; // total data length low byte
7'h15: dout <= #1 8'd00; // total data length high byte
7'h16: dout <= #1 8'h01; // number of interfaces
7'h17: dout <= #1 8'h01; // number of configurations
7'h18: dout <= #1 8'h00; // Conf. String Index
7'h19: dout <= #1 8'h40; // Config. Characteristics
7'h1a: dout <= #1 8'h00; // Max. Power Consumption
// ====================================
// ===== Interface Descriptor =====
// ====================================
7'h1b: dout <= #1 8'h09; // this descriptor length
7'h1c: dout <= #1 8'h04; // descriptor type
7'h1d: dout <= #1 8'h00; // interface number
7'h1e: dout <= #1 8'h00; // alternate setting
7'h1f: dout <= #1 8'h02; // number of endpoints
7'h20: dout <= #1 8'hff; // interface class
7'h21: dout <= #1 8'h01; // interface sub class
7'h22: dout <= #1 8'hff; // interface protocol
7'h23: dout <= #1 8'h00; // interface string index
// ====================================
// ===== Endpoint 1 Descriptor =====
// ====================================
7'h24: dout <= #1 8'h07; // this descriptor length
7'h25: dout <= #1 8'h05; // descriptor type
7'h26: dout <= #1 8'h81; // endpoint address
7'h27: dout <= #1 8'h03; // endpoint attributes
7'h28: dout <= #1 8'd64; // max packet size low byte
7'h29: dout <= #1 8'd00; // max packet size high byte
7'h2a: dout <= #1 8'h01; // polling interval
// ====================================
// ===== Endpoint 2 Descriptor =====
// ====================================
7'h2b: dout <= #1 8'h07; // this descriptor length
7'h2c: dout <= #1 8'h05; // descriptor type
7'h2d: dout <= #1 8'h02; // endpoint address
7'h2e: dout <= #1 8'h03; // endpoint attributes
7'h2f: dout <= #1 8'd64; // max packet size low byte
7'h30: dout <= #1 8'd00; // max packet size high byte
7'h31: dout <= #1 8'h01; // polling interval
// ====================================
// ===== Endpoint 3 Descriptor =====
// ====================================
7'h32: dout <= #1 8'h07; // this descriptor length
7'h33: dout <= #1 8'h05; // descriptor type
7'h34: dout <= #1 8'h83; // endpoint address
7'h35: dout <= #1 8'h02; // endpoint attributes
7'h36: dout <= #1 8'd64; // max packet size low byte
7'h37: dout <= #1 8'd00; // max packet size high byte
7'h38: dout <= #1 8'h01; // polling interval
// ====================================
// ===== Endpoint 4 Descriptor =====
// ====================================
7'h39: dout <= #1 8'h07; // this descriptor length
7'h3a: dout <= #1 8'h05; // descriptor type
7'h3b: dout <= #1 8'h04; // endpoint address
7'h3c: dout <= #1 8'h02; // endpoint attributes
7'h3d: dout <= #1 8'd64; // max packet size low byte
7'h3e: dout <= #1 8'd00; // max packet size high byte
7'h3f: dout <= #1 8'h01; // polling interval
// ====================================
// ===== Endpoint 5 Descriptor =====
// ====================================
7'h40: dout <= #1 8'h07; // this descriptor length
7'h41: dout <= #1 8'h05; // descriptor type
7'h42: dout <= #1 8'h85; // endpoint address
7'h43: dout <= #1 8'h03; // endpoint attributes
7'h44: dout <= #1 8'd64; // max packet size low byte
7'h45: dout <= #1 8'd00; // max packet size high byte
7'h46: dout <= #1 8'h01; // polling interval
/*
// ====================================
// ===== String Descriptor Lang ID=====
// ====================================
7'h47: dout <= #1 8'd06; // this descriptor length
7'h48: dout <= #1 8'd03; // descriptor type
7'h49: dout <= #1 8'd09; // Language ID 0 low byte
7'h4a: dout <= #1 8'd04; // Language ID 0 high byte
7'h4b: dout <= #1 8'd09; // Language ID 1 low byte
7'h4c: dout <= #1 8'd04; // Language ID 1 high byte
7'h4d: dout <= #1 8'd09; // Language ID 2 low byte
7'h4e: dout <= #1 8'd04; // Language ID 2 high byte
// ====================================
// ===== String Descriptor 0 =====
// ====================================
7'h50: dout <= #1 8'd010; // this descriptor length
7'h51: dout <= #1 8'd03; // descriptor type
7'h52: dout <= #1 "0";
7'h53: dout <= #1 " ";
7'h54: dout <= #1 "g";
7'h55: dout <= #1 "n";
7'h56: dout <= #1 "i";
7'h57: dout <= #1 "r";
7'h58: dout <= #1 "t";
7'h59: dout <= #1 "S";
// ====================================
// ===== String Descriptor 1 =====
// ====================================
7'h60: dout <= #1 8'd010; // this descriptor length
7'h61: dout <= #1 8'd03; // descriptor type
7'h62: dout <= #1 "1";
7'h63: dout <= #1 " ";
7'h64: dout <= #1 "g";
7'h65: dout <= #1 "n";
7'h66: dout <= #1 "i";
7'h67: dout <= #1 "r";
7'h68: dout <= #1 "t";
7'h69: dout <= #1 "S";
// ====================================
// ===== String Descriptor 2 =====
// ====================================
7'h70: dout <= #1 8'd010; // this descriptor length
7'h71: dout <= #1 8'd03; // descriptor type
7'h72: dout <= #1 "2";
7'h73: dout <= #1 " ";
7'h74: dout <= #1 "g";
7'h75: dout <= #1 "n";
7'h76: dout <= #1 "i";
7'h77: dout <= #1 "r";
7'h78: dout <= #1 "t";
7'h79: dout <= #1 "S";
*/
// ====================================
// ====================================
//default: dout <= #1 8'd00;
endcase
endmodule
|
 |