Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 4

Simple packet router

Introduction:
The simple packet router routes the incoming packet to one of the four output ports depending on
the entry in the look up table. The module also modifies the incoming packet before outputting on
to the output ports. The error packets are dropped.

Description:
Incoming packet format

7 0
Header Byte 0 SOP

Pattern Byte 1

Payload Length Byte 2

Byte 3

Payload

Byte n EOP
Packet Field Description
Header 1 byte. 0x5D. Indicates valid packet.
Pattern 4 bits. `b0000 to `b1111. Matched with
look up table.
Payload Length 1 byte. Cannot be zero. Indicates
number of bytes in the
payload.
Payload Minimum payload is 1 byte. Maximum
payload is 255 bytes.

Byte 0 is transmitted first.


Outgoing packet format

Byte 0 SOP

Payload

Byte n EOP

Packets are rejected if


• Header is not 5D
• There is no entry for the pattern in the look up table
• Packet is in error
• Missing end of packet

Look up table

There will be 16 elements in the look up table. Each element is 8 bits in width and has two fields.
The Pattern field of the packet is the address for the look up table.
• Output port number
• Valid

A single look up table element structure is shown below

7 6 5 4 3 2 1 0
Reserved Output port Valid
number
The output port number indicates to which port the incoming packet with this pattern should be
routed. Valid bit indicates entry is valid. If the valid bit is 0, entry is not present. More than one
pattern can be routed to the same port.
Block diagram:

The packet router has three interfaces. Input packet interface, Output packet interface and the
configuration interface. There is only one clock on which the module works. Reset is active low
reset.

Note: Internally a single FIFO is maintained for each of the output port. The FIFO size is equal to
the maximum packet size possible, i.e. 3bytes + 255bytes (258). Only one packet (min or max
size) can be held in the FIFO at a time.

Input packet interface


SOP: Start of packet. Indicates start of packet. Pulse. First byte is transferred when this pulse is
set (0x5D).
EOP: End of packet. Indicates end of packet. Pulse. Last byte of the packet gets transferred
when this pulse is set.
ERR: Error. Valid only when EOP is set. The packet should be discarded if this is set.
Ready: Flow control signal. Packet should be transmitted only when this is set.
Data[7:0] : Incoming Byte Data.

Output packet interface


Port0SOP: Start of packet. Pulse. First byte is transferred when this pulse is set.
Port0EOP: End of packet. Pulse. Last byte of the packet gets transferred when this pulse is set.
Port0Data: Byte data.

Note: If an EOP is missed during transfer, i.e. if two SOPs occur the packet without EOP should
be rejected.
These are three more ports similar to port 0. The signals SOP, EOP and Data are prefixed with
Port1, Port2, Port3.

Configuration interface
This interface is used to program the look up table.

Write: Write signal. Indicates write operation when 1, read operation when 0.
Valid: Indicates a valid write or read transaction.
LutAddr: 4 bit LUT element address. Qualified with Valid = 1.
LutData: Multiplexed. Byte data Written or read.
Clk
Clk
Port0SOP
nReset
Port0EOP PORT0
SOP Port0Data[7:0]
EOP
ERR
Data[7:0] Packet Router PORT1
Ready

write PORT2
valid
LutAddr[3:0]
PORT3
LutData[7:0]

You might also like