Payload pad removal, Crc checking, Length checking – Altera Triple Speed Ethernet MegaCore Function User Manual
Page 46
Payload Pad Removal
You can turn on padding removal by setting the
PAD_EN
bit in the
command_config
register to 1. The MAC
function removes the padding, prior to forwarding the frames to the user application, when the payload
length is less than the following values for the different frame types:
• 46 bytes for basic MAC frames
• 42 bytes for VLAN tagged frames
• 38 bytes for stacked VLAN tagged frames
When padding removal is turned off, complete frames including the padding are forwarded to the Avalon-
ST receive interface.
CRC Checking
The following equation shows the CRC polynomial, as specified in the IEEE 802.3 standard:
FCS(X) = X
32
+X
26
+X
23
+X
22
+X
16
+X
12
+X
11
+X
10
+X
8
+X
7
+X
5
+X
4
+X
2
+X
1
+1
The 32-bit CRC value occupies the FCS field with
X
31 in the least significant bit of the first byte. The CRC
bits are thus received in the following order:
X
31,
X
30,...,
X
1,
X
0.
If the MAC function detects CRC-32 error, it marks the frame invalid by asserting the following signals:
•
rx_err[2]
in MAC variations with internal FIFO buffers.
•
data_rx_error[1]
in MAC variations without internal FIFO buffers.
The MAC function discards frames with CRC-32 error if the
RX_ERR_DISC
bit in the
command_config
register
is set to 1.
The MAC function forwards the CRC-32 field to the user application if the
CRC_FWD
and
PAD_EN
bits in the
command_config
register are 1 and 0 respectively. Otherwise, the CRC-32 field is removed from the frame.
Length Checking
The MAC function checks the frame and payload lengths of basic, VLAN tagged, and stacked VLAN tagged
frames.
The frame length must be at least 64 (0x40) bytes and not exceed the following maximum value for the
different frame types:
• Basic frames—the value specified in the
frm_length
register
• VLAN tagged frames—the value specified in the
frm_length
register plus four
• Stacked VLAN tagged frames—the value specified in the
frm_length
register plus eight
To prevent FIFO buffer overflow, the MAC function truncates the frame if it is more than 11 bytes longer
than the allowed maximum length.
For frames of a valid length, the MAC function continues to check the payload length if the
NO_LGTH_CHECK
bit in the
command_config
register is set to 0. The MAC function keeps track of the payload length as it
receives a frame, and checks the length against the length/type field in basic MAC frames or the client
length/type field in VLAN tagged frames. The payload length is valid if it satisfies the following conditions:
• The actual payload length matches the value in the length/type or client length/type field.
• Basic frames—the payload length is between 46 (0x2E)and 1536 (0x0600) bytes, excluding 1536.
• VLAN tagged frames—the payload length is between 42 (0x2A)and 1536 (0x0600), excluding 1536.
Functional Description
Altera Corporation
UG-01008
Payload Pad Removal
4-10
2014.06.30