Verilog HDL Implementation of Usb To Ethernet Converter
Verilog HDL Implementation of Usb To Ethernet Converter
Verilog HDL Implementation of Usb To Ethernet Converter
Converter
______________________________________________________________________________
Abstract--Universal Serial Bus is a fast and reliable serial
interface standard, where as Ethernet MAC is widely used
networking standard. USB to Ethernet converter is one of
the most widely used protocol converter in several PC based
and embedded applications. The Verilog HDL
implementation of USB to Ethernet converter is useful either
for ASIC implementation or for FPGA based applications.
The three main blocks of this converter are Ethernet MAC,
USB device and the protocol converter between these two
interfaces.Generally used Ethernet MAC standard data rates
are 10/100/1000 Mbps. In this project Ethernet MAC
controller block will be implemented in Verilog HDL,
conforming to IEEE 802.3 specification. The Ethernet MAC
shall have optional half-duplex support for 10/100 Mbps
mode, and uses FIFO interface to user application. The
source MAC address insertion for transmitting frames, and
address filter for receiving frames destination MAC address,
will be implemented as optional features. The receiving
broadcast frames throughout constraint will also be
implemented as optional feature. The Ethernet MAC shall
also support Jumbo frame size of 9.6K, along with standard
MTU. The USB controller block handles the details of USB
communications. This block is responsible for responding to
requests to send and receive configuration data, and for
reading and writing other data. The controller chip has to
know how to detect and respond to events at a USB port and
it has to provide a way for the device to store data to be sent
and retrieve data that have been received. The interface
block between USB and Ethernet protocols manages a two
way handshake between these two controllers. This block
handles different synchronization aspects with proper clock
and control circuitry between USB and Ethernet
interfaces.Verilog HDL will be used for implementing all
these blocks. ModelSim Simulator tool will be used for
functional simulation of the design. The broad class of
applications of the implemented soft USB to Ethernet MAC
protocol converter will be studied.
1. INTRODUCTION
Ethernet was originally developed by Digital, Intel and
Xerox (DIX) in the early 1970's and has been designed as a
'broadcast' system, i.e. stations on the network can send
messages whenever and wherever it wants. All stations may
receive the messages, however only the specific station to
which the message is directed will respond.The original
format for Ethernet was developed in Xerox Palo Alto
Research Centre (PARC), California in 1972. Using Carrier
Sense Multiple Access with Collision Detection
2 . ETHERNET
The diagrams below describe the structure of the older DIX
(Ethernet II) and the now standard 802.3 Ethernet frames.
The numbers above each field represent the number of bytes.
Fig-1
2.1 MEDIA ACCESS CONTROL FRAME :
Fig-2
Preamble field: Establishes bit synchronisation and
transceiver conditions so that the PLS circuitry synchs in
with the received frame timing. The DIX frame has 8 bytes
for the preamble rather than 7, as it does not have a Start
Frame Delimiter (or Start of Frame).
Start Frame Delimiter: Sequence 10101011 in a separate
field, only in the 802.3 frame.
Destination address: Hardware address (MAC address) of
the destination station (usually 48 bits i.e. 6 bytes).
Source address: Hardware address of the source station
(must be of the same length as the destination address, the
802.3 standard allows for 2 or 6 byte addresses, although 2
byte addresses are never used, N.B. Ethernet II can only uses
6 byte addresses).
Type: Specifies the protocol sending the packet such as IP or
IPX (only applies to DIX frame).
Length: Specifies the length of the data segment, actually the
number of LLC data bytes, (only applies to 802.3 frame and
replaces the Type field).
Pad: Zeros added to the data field to 'Pad out' a short data
field to 46 bytes (only applies to 802.3 frame).
Data: Actual data which is allowed anywhere between 46 to
1500 bytes within one frame.
CRC: Cyclic Redundancy Check to detect errors that occur
during transmission (DIX version of FCS).
FCS: Frame Check Sequence to detect errors that occur
during transmission (802.3 version of CRC). This 32 bit
code has an algorithm applied to it which will give the same
result as the other end of the link, provided that the frame
was transmitted successfully. From the above we can deduce
that the maximum 802.3 frame size is 1518 bytes and the
minimum size is 64 bytes. Packets that have correct CRC's
(or FCS's) but are smaller than 64 bytes, are known as
'Runts'.
The hardware address, or MAC address is transmitted and
stored in Ethernet network devices in Canonical format i.e.
Least significant Bit (LSB) first. You may hear the
expression Little-Endian to describe the LSB format in
which Ethernet is transmitted. Token Ring and FDDI, on the
other hand, transmit the MAC address with the Most
Significant Bit (MSB) first, or Big-Endian, This is known as
Non-Canonical format. Note that this applies on a byte by
byte basis i.e. the bytes are transmitted in the same order it is
just the bits in each of those bytes that are reversed! The
storage of the MAC addresses in Token Ring and FDDI
devices however, may sometimes still be in Canonical
format so this can sometimes cause confusion. The reference
to, the distribution of MAC addresses and the OUI
desinations are always carried out in Canonical format.
2.2 I/G and U/L within the MAC address
With an Ethernet MAC address, the first octet uses the
lowest significant bit as the I/G bit (Individual/Group
address) only and does not have such a thing as the U/L bit
(Universally/Locally administered). The U/L bit is used in
Token Ring A destination Ethernet MAC address starting
with the octet '05' is a group or multicast address since the
first bit (LSB) to be transmitted is on the right hand side of
the octet and is a binary '1'. Conversely, '04' as the first octet
indicates that the destination address is an individual
address. Of course, in Ethernet, all source address will have
a binary '0' since they are always individual.
Description
Unused
Line state
ccess
1
5:5
ead only
4
:3
ead only
2
Interface
ead only
status1=Attached
1
R
Interface speed
ead only
1 = High speed
mode
0 = full speed
mode
0
R
1 = Suspend
ead only
mode
After reset, the device is initially in IDLE state. When token
is received it checks whether the token is a valid token or
not. If the token is invalid, error is reported. After receipt of
proper token, it is decoded to find out type of data transfer.
The 4-bit PID field of token packet determines whether the
data should be sent for special token processing state, setup
cycle, IN data cycle or OUT data cycle. In all of these states
the error in CRC is always checked and if there is any error
the state machine goes back to IDLE state. The main control
signals for these operations are generated by the protocol
engine. Various blocks of USB controller are explained
below. The VHDL code for different modules is given in
Appendix.
1. Packet disassembler: This block separates the various
constituents of the packet. It checks the token packet and
initiates the corresponding cycle depending on whether the
token corresponds to SETUP, IN, OUT or special data
processing. It generates an error flag that indicates an error if
B
it
A
ccess
1
5:7
R
/W
6
:0
Descr
iption
R
/W
Unus
ed
Devic
e address
4. RESULTS
4.1 Simulation results:
REFERENCES
1. Andrew S.Tanenbaum : computer Networks,PHI , Third
edition, 1996.
2. David G. Cunningham, Wiliam G.Lane: Gigabit Ethernet
Networking : Macmillan Technical publishing, USA1999.
3. Ethernet and fast Ethernet guide
http : // www.ots.utexas.edu/ethernet.
4.Gigabit Ethernet information (PAR,Drafts),
http:// www.ots.utexas.edu:8080/ Ethernet/descript- gigabitieee.html.
5. CONCLUSION
An efficient architecture of USB to Ethernet MAC
implementation is proposed in this paper. The design was