77
© November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary AN-516-2.3 © November 2009 10-Gbps Ethernet Reference Design Release Information Table 1 provides information about this release of the Altera ® 10-Gbps Ethernet reference design. Device Family Support Table 2 shows the level of support offered by the 10-Gbps Ethernet reference design to each Altera device family. New Features in Version 9.1 The new version of the 10-Gbps Ethernet reference design provides the following new feature: Support for optional error-correction code (ECC) in memories in the Soft XAUI PCS and in the transmit and receive FIFOs on Stratix IV devices. Features The 10-Gbps Ethernet reference design supports the following features: 10-Gbps Ethernet receiver and transmitter media access controller (MAC) in full-duplex mode, which conforms to the IEEE 802.3 2005 standard Table 1. Release Information Item Description Version 9.1 Ordering Code IP-10GETHERNET Product ID(s) E003 Vendor ID(s) 6AF7 Table 2. Device Family Support Device Family Support Arria ® GX Full Arria II GX Preliminary Stratix ® II Full Stratix II GX Full Stratix III Full Stratix IV Preliminary HardCopy ® III Preliminary HardCopy ® IV Preliminary Other device families No support

AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

  • Upload
    ngohanh

  • View
    219

  • Download
    2

Embed Size (px)

Citation preview

Page 1: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

© November 2009 Altera Corporation

© November 2009

10-Gbps Ethernet Reference Design

AN-516-2.3

Release InformationTable 1 provides information about this release of the Altera® 10-Gbps Ethernet reference design.

Device Family SupportTable 2 shows the level of support offered by the 10-Gbps Ethernet reference design to each Altera device family.

New Features in Version 9.1The new version of the 10-Gbps Ethernet reference design provides the following new feature:

■ Support for optional error-correction code (ECC) in memories in the Soft XAUI PCS and in the transmit and receive FIFOs on Stratix IV devices.

FeaturesThe 10-Gbps Ethernet reference design supports the following features:

■ 10-Gbps Ethernet receiver and transmitter media access controller (MAC) in full-duplex mode, which conforms to the IEEE 802.3 2005 standard

Table 1. Release Information

Item Description

Version 9.1

Ordering Code IP-10GETHERNET

Product ID(s) E003

Vendor ID(s) 6AF7

Table 2. Device Family Support

Device Family Support

Arria® GX Full

Arria II GX Preliminary

Stratix® II Full

Stratix II GX Full

Stratix III Full

Stratix IV Preliminary

HardCopy® III Preliminary

HardCopy® IV Preliminary

Other device families No support

10-Gbps Ethernet Reference DesignPreliminary

Page 2: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 2 Features

■ Passed the University of New Hampshire Interoperability Lab (UNH) 10-Gbps Ethernet tests of MAC, 10GBASE-X physical coding sublayer (PCS), and physical medium attachment (PMA)

■ Verified and hardware tested with standard 10-Gbps Ethernet test equipment

■ Flexible standard interfaces:

■ Seamless interface to commercial Ethernet PHY devices via 10-Gbps media independent interface (XGMII) or 10-Gbps attachment unit interface (XAUI)

■ Management data input/output (MDIO) master interface for PHY device management

■ 64-bit wide FIFO or no-FIFO interface to application logic based on the Avalon® Streaming (Avalon-ST) interface

f For more information about the Avalon-ST and Avalon-MM interfaces, refer to the Avalon Interface Specifications.

■ 10-Gbps full-duplex throughput rate

■ Flow control by programmable pause quanta

■ Pause frame generation controllable by user applications, enabling flexible traffic flow control

■ Parameterizable FIFO size (64 bytes to 64 Kbytes) and programmable threshold levels

■ Programmable MAC addresses and receive packet filtering based on up to five unicast or multicast and broadcast destination MAC address, and one destination VLAN address

■ Programmable maximum receiving frame length up to 64 Kbytes, including jumbo frames (1,519 to 9,618 bytes)

■ Support for promiscuous (transparent) and non-promiscuous (filtered) operation

■ Support for virtual local area network (VLAN) and stacked VLAN tagged frames according to the IEEE 802.IQ standard

■ Management interface and loopback for system test—local or line loopback on the XGMII

■ Statistics counters supporting RMON (RFC 2819), Ethernet type MIB (RFC 3635), and interface group MIB (RFC 2863)

■ Filtering of frames with CRC errors, length-check error, or oversized errors

■ Optional real-time single-bit error correction and two-bit error detection on transmit and receive FIFOs and the Soft XAUI PCS memory

■ Easy-to-use MegaWizardTM interface for parameterization

■ IP functional simulation models for use in Altera-supported VHDL and Verilog HDL simulators

■ Verilog HDL and VHDL testbench or verification environment

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 3: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

General Description Page 3

General DescriptionThe 10-Gbps Ethernet reference design provides an integrated Ethernet MAC, PCS, and PMA solution for Ethernet applications. The reference design works in full-duplex mode and supports both switching and network interface card (NIC) or line-card applications, by providing transparent and full Ethernet frame termination and generation.

Figure 1 shows the 10-Gbps Ethernet reference design block diagram. The function comprises the following main blocks: MAC and PCS. All blocks are parameterizable at synthesis time. A memory-mapped register interface controls the MAC and PCS blocks.

1 You can implement a MAC only function or implement the optional XAUI in soft logic in Stratix IV devices.

For the local interface, the reference design provides standard Avalon-ST interfaces, to allow interoperability with other Avalon-ST components. A host processor can manage the reference design via a separate Avalon Memory-Mapped (Avalon-MM) interface that provides access to the control register space. For the PHY interface, the reference design can seamlessly connect to any industry standard 10-Gb Ethernet PHY or MAC device via XGMII or XAUI. The XAUI is only available in Altera devices that have serial transceivers.

f For more information about the Avalon-ST interface, refer to the Avalon Interface Specifications.

Figure 2 shows an example application using the reference design as a stand-alone MAC without the PCS and PMA, serving as a bridge between the user application and external (industry-standard) Ethernet PHY devices.

Figure 1. 10-Gbps Ethernet Reference Design Block Diagram

Note to Figure 1:

(1) You can implement the optional XAUI in an Altera device transceiver or as soft logic, which gives a soft 10GBASE-X XAUI PCS.

10-GbpsEthernet MAC

Local (Avalon-ST)Interface

Host (Avalon-MM)Interface

PCSXGMII XAUI

10-Gbps Ethernet Reference Design

Optional (Note 1)

PMA PHY Device Interface

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 4: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 4 Verification

VerificationAltera verified the 10-Gbps Ethernet reference design through extensive in-house simulation and internal hardware verification.

Altera used a highly parameterizeable transaction-based testbench to test the following aspects of the reference design:

■ Register access

■ Management data input and output (MDIO) access

■ Frame transmission and error handling

■ Frame reception and error handling

■ Received ethernet frame MAC address filtering

■ Flow control

Altera has also validated the reference design with copper and optical media using the Spirent SmartBits and the following Altera development boards:

■ Stratix II GX video development board

■ Stratix II GX PCI Express development board

In the copper medium, Altera tested the reference design with an external 10GBASE-CX4 PHY device, a CX4 switch and CX4 test equipment; in the optical medium, Altera tested the 10-Gbps Ethernet reference design with a 10-Gbps X2 PHY board and various X2 optical pluggable modules interfacing to standard test equipment.

f For more information about X2, refer to www.X2msa.org.

For hardware testing, a 10-Gbps Ethernet MAC, PCS, PMA, and an internal system design are implemented in the FPGA. The internal system retrieves all frames received from the test equipment by the MAC function and returns them to the sender by manipulating the address fields, implementing a loopback at the internal system interface of the MAC.

Figure 2. Stand-Alone 10-Gbps Ethernet MAC

10-GbpsEthernet MAC

10-Gbps Ethernet Reference Design

10-Gbps Ethernet

PHY Device

User Application

Altera FPGA

MDIO Master

ManagementLogic

Aval

on-S

TIn

terfa

ceAv

alon

-MM

Inte

rface

XGM

IIIn

terfa

ceM

DIO

Inte

rface

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 5: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Performance and Resource Utilization Page 5

Performance and Resource UtilizationTable 3 shows the typical expected performance for different parameters, using the Quartus® II software version 9.1 targeting a Stratix II GX (EP2SGX30DF780C3) device.

For C4 and C5 device speed grades the fMAX is 156.25 MHz.

Table 4 shows the typical expected performance, using the Quartus II software v9.1 targeting a Stratix IV (EP4SGX70DF29C3) device.

Table 5 shows the typical expected performance, using the Quartus II software v9.1 targeting a Arria II GX (EP2AGX45CU17C5) device.

Installation and LicensingTo install the reference design, unzip the .tar.gz file to a directory on your PC.

1 Do not unzip to the standard Altera IP directory altera\<version>\ip.

In the Quartus II software add the 10-Gbps Ethernet library to the user library:

1. On the Tools menu click Options.

Table 3. 10-Gbps Ethernet Performance and Resource Utilization—Stratix II GX Device

XAUI

FIFO (eight-byte

words) MDIOStatistics Counter ECC

CombinationalALUTs

Logic Registers

fMAX (MHz) Memory

Avalon-MM

Avalon-ST

System Clock M4K M512

Yes 256 Yes Yes No 5,666 5,334 189 218 204 8 0

Yes 256 Yes No No 3,803 3,788 170 200 187 8 0

Yes 256 No No No 3,652 3,654 174 199 179 8 0

Yes No No No No 3,246 3,238 156 — 202 0 0

Table 4. 10-Gbps Ethernet Performance and Resource Utilization—Stratix IV Device

XAUI

FIFO (eight-byte

words) MDIOStatistics Counter ECC

CombinationalALUTs

Logic Registers

fMAX (MHz) Memory

Avalon-MM

Avalon-ST

System Clock M9K

Yes 256 Yes Yes No 5,666 5,346 230 220 197 4

Yes 256 Yes Yes Yes 6,808 6,119 187 175 175 6

Soft XAUI only — — — No 2,545 2,198 — — 156.25 6

Soft XAUI 256 Yes Yes No 8,136 7,478 177 252 188 10

Soft XAUI 256 Yes Yes Yes 10,080 8,409 180 175 168 13

Table 5. 10-Gbps Ethernet Performance and Resource Utilization—Arria II GX Device

XAUI

FIFO (eight-byte

words) MDIOStatistics Counter ECC

CombinationalALUTs

Logic Registers

fMAX (MHz) Memory

Avalon-MM

Avalon-ST

System Clock M9K

Yes 256 Yes Yes No 5,670 5,346 269 209 199 4

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 6: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 6 Getting Started

2. Click Global User Libraries.

3. In Library Name specify the eth_10g\lib directory.

After you purchase a license for the reference design, you can request a license file from the Altera website at www.altera.com/licensing and install it on your computer. When you request a license file, Altera emails you a license.dat file. If you do not have Internet access, contact your local Altera representative.

Getting StartedFigure 3 shows the stages for creating a system with the 10-Gbps Ethernet reference design and the Quartus II software. Each of the stages is described in detail in subsequent sections.

Design Flow SelectionYou customize the 10-Gbps Ethernet reference design by specifying parameters using the 10-Gbps Ethernet MegaWizard interface, launched from either the MegaWizard Plug-in Manager or SOPC Builder in the Quartus II software.

Figure 3. 10-Gbps Ethernet Design Flow

Specify Parameters

Select Design Flow

MegaWizard Plug-InManager Flow

SOPC BuilderFlow

Compile the Example Design

Program Device

Add Constraints

Simulate Core withTestbench

Instantiate Core in Design and Simulate

Specify Parameters

Simulate System

Complete SOPCBuilder System

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 7: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Getting Started Page 7

MegaWizard Plug-in Manager FlowUse the MegaWizard Plug-in Manager flow to create a variant that you can instantiate manually in your design.

SOPC Builder FlowUse the SOPC Builder flow for the following advantages:

■ You want to rapidly create a new SOPC Builder system design that includes an Ethernet interface.

■ You want to use the reference design in conjunction with other components available in SOPC Builder such as the Nios II processor, external memory controllers and the scatter-gather DMA controller.

MegaWizard Plug-in Manager FlowThe MegaWizard Plug-in Manager flow allows you to customize the 10-Gbps Ethernet reference design, and manually integrate the function into your design.

Specify ParametersFollow the steps below to specify 10-Gbps Ethernet parameters using the MegaWizard Plug-in Manager flow.

1. Create a Quartus II project using the New Project Wizard available from the File menu.

2. Launch MegaWizard Plug-in Manager from the Tools menu, and follow the prompts in the MegaWizard Plug-in Manager interface to create a custom megafunction variation.

1 You can find 10-Gbps Ethernet by expanding Installed Plug-Ins > Interfaces > Ethernet.

3. Specify the parameters on all pages in the Parameter Settings tab.

For detailed explanation of the parameters, refer to the “Parameter Settings” on page 10.

4. On the EDA tab, turn on Generate simulation model to generate an IP functional simulation model for the reference design in the selected language.

An IP functional simulation model is a cycle-accurate VHDL or Verilog HDL model produced by the Quartus II software.

1 Some third-party synthesis tools can use a netlist that contains only the structure of the reference design, but not detailed logic, to optimize performance of the design that contains the reference design. If your synthesis tool supports this feature, turn on Generate netlist.

c Use the simulation models only for simulation and not for synthesis or any other purposes. Using these models for synthesis creates a non-functional design.

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 8: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 8 Getting Started

5. On the Summary tab, select the files you want to generate. A grey checkmark indicates a file that is automatically generated. All other files are optional.

6. Click Finish to generate the reference design and supporting files.

Simulate with Provided TestbenchYou can simulate the reference design using the IP functional simulation model and testbench generated by the 10-Gbps Ethernet wizard.

f For more information about the testbench, see “Testbench” on page 67.

To run a simulation using the ModelSim simulator, follow these steps:

1. Start the ModelSim simulator.

2. Change the working directory to <project directory>\tb\verilog or <project directory>\tb\vhdl.

3. Run the following command to set up the required libraries, compile the generated IP functional simulation model, and exercise the simulation model with the provided testbench:

demo_run_modelsim.tclrThe ModelSim transcript pane (in Main window) displays messages from the testbench reflecting the current task being performed.

Instantiate the Reference Design in your DesignYou can now integrate your 10-Gbps Ethernet reference design variation into your design, and simulate the system with your custom testbench.

SOPC Builder FlowThe SOPC Builder flow allows you to add the reference design directly to a new or existing SOPC Builder system. You can also easily add other available components to quickly create an SOPC Builder system with an Ethernet interface, such as the Nios II processor, external memory controllers and scatter-gather DMA controllers. SOPC Builder automatically creates the system interconnect logic and system simulation environment.

f For more information about SOPC Builder, refer to Volume 4 of the Quartus II Handbook.

Specify ParametersFollow the steps below to specify 10-Gbps Ethernet parameters using the SOPC Builder flow.

1. Create a new Quartus II project using the New Project Wizard available from the File menu.

2. Launch SOPC Builder from the Tools menu.

3. For a new system, specify the system name and language.

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 9: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Getting Started Page 9

4. Add the reference design to the SOPC Builder component list:

a. On the Tools menu, click Options.

b. In the Category list click IP Search Path.

c. Click Add.

d. Add the <path>eth_10g\lib\ip_toolbench.

e. Click Finish.

f. On the File menu, click Refresh Component List.

5. Add 10-Gbps Ethernet to your system from the System Contents tab.

1 You can find 10-Gbps Ethernet by expanding Interface Protocols > Ethernet.

6. Specify the required parameters on all pages in the Parameter Settings tab.

f For detailed explanation of the parameters, refer to the “Parameter Settings” on page 10.

7. Click Finish to complete the reference design and add it to the system.

Complete the SOPC Builder SystemFollow the steps below to complete the SOPC Builder system.

1. Add and parameterize any additional components to the system.

1 A typical SOPC builder system that enables Ethernet connectivity uses a scatter-gather DMA controller on each of the transmit and receive paths, and a Nios II processor for configuration and control.

2. Connect the components using the SOPC Builder patch panel.

3. If you intend to simulate your SOPC builder system, select Simulate on the System Generation tab to generate a functional simulation model for the system.

4. Click Generate to generate the system.

Simulate the SystemDuring system generation, SOPC Builder optionally generates a simulation model and testbench for the entire system which you can use to easily simulate your system in any of Altera's supported simulation tools. SOPC Builder also generates a set of ModelSim Tcl scripts and macros that you can use to compile the testbench, IP Functional simulation models and plain-text RTL design files that describe your system in the ModelSim simulation software.

f For more information about simulating SOPC Builder systems, refer to Volume 4 of the Quartus II Handbook and AN 351: Simulating Nios II Systems.

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 10: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 10 Parameter Settings

Design Compilation and Device ProgrammingYou can use the Quartus II software to compile your design. After a successful compilation, you can program the targeted Altera device and verify the design in hardware.

f For more information about compiling a design and programming Altera devices, refer to Quartus II Help.

Parameter SettingsThis section describes the parameters and how they affect the behavior of the reference design. Each section corresponds to a page in the Parameter Settings tab in the 10-Gbps Ethernet MegaWizard interface.

1 When parameterizing a reference design using the SOPC Builder flow, the EDA and Summary tabs are not visible. In the SOPC Builder flow, simulation model settings are inherited from options specified in SOPC Builder.

f For more information about setting simulation options, refer to the Quartus II Help.

Figure 4. Options

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 11: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Parameter Settings Page 11

VariationSelect MAC + XGMII, MAC + XAUI, MAC only, Soft XAUI only, or MAC + soft XAUI. XGMII is a 32-bit double data rate interface at 156.25 MHz with four bits of control; XAUI is a four-lane serialized interface at 3.125 Gbps per lane. The XAUI is only available in Altera devices with a minimum of four integrated serial transceivers. The Soft XAUI only and MAC + soft XAUI options allow your design to use spare transceivers—serial transceivers with hard PCS and PMA, and transceivers with PMA only—in Stratix IV devices.

The soft XAUI is only available on Stratix IV devices and replicates the functionality of the XAUI PCS that is available in most transceivers. It allows the design to use all the available transceivers.

The Soft XAUI PCS includes the transceiver megafunction and the reset sequence controller, which applies the transceiver reset signals with the required constraints.

Soft XAUI Transmitter PLL TypeWhen you select MAC + soft XAUI or Soft XAUI only, you can select the soft XAUI transmitter PLL type. Select either CMU or ATX PLL type.

f For more information about CMU or ATX, refer to the Stratix IV Transceiver Architecture chapter in the Stratix IV Device Handbook.

FIFO OptionsTurn on Include Avalon Streaming FIFO to include receiver and transmitter FIFO buffers in the local interface.

1 The MAC passes data to the receiver FIFO and receives data from the transmitter FIFO: the FIFO names are relative to the Ethernet link.

Select FIFO size for each of the receiver and transmitter FIFOs. FIFO size options are: 8, 64, 128, 256, 512, 1,024, 2,048, 4,096, or 8,192 eight-byte words. The two FIFOs can have different sizes.

1 The usable FIFO size is (FIFO size– 1). For example, if you select a FIFO size of 128 eight-byte words, the size you can use is 127 8-byte words.

Select Fill level (cut-through mode) and the read data available (avl_st_rx_dav) signal goes high when a threshold is reached or an end of packet (EOP). The fill level is passed continuously from the write side to the read side.

Select Store forward and the packet information is passed from the write side to the read side only when the EOP is reached on the write side. So data available only triggers on EOP. When you select Store forward, select the FIFO size to hold the longest possible frame in the system. Altera recommends twice the maximum possible frame size.

f For more information about thresholds, see “Receiver FIFO Thresholds” on page 19 and “Transmitter FIFO Thresholds” on page 23.

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 12: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 12 Parameter Settings

1 If you turn off Include Avalon Streaming FIFO, for the receiver there is no ready signal, so the data is sent automatically; for the transmitter, the read latency is 1. You must provide a full packet when the design indicates data is present.

MAC OptionsTurn on Enable MDIO, so the reference design instantiates an MDIO master, see “MDIO Interface” on page 32.

Turn on Enable Statistics Counter to allow reporting of statistics for transmitted and received frames.

Enter a number for the Customer version number, see rev bit in Table 18 on page 38.

Transceiver Reconfiguration OptionsFor Stratix II GX devices with XAUI, if you turn on Use external reconfiguration block, you can modify analog properties of the transceiver with an external reconfiguration block (ALT2GXB_RECONFIG). For Stratix IV or Arria II GX devices with XAUI, you must have an external reconfiguration block, so this option is always on. For Arria GX devices, this option is not available.

1 If you select this option, you must generate and use an external reconfiguration block on the same Altera device. The external configuration block is an ALT2GXB_RECONFIG megafunction that you can edit and generate in the Quartus II software.

f For more information about the ALT2GXB_RECONFIG megafunction, refer to the ALT2GXB_RECONFIG Megafunction User Guide.

In addition, when you turn on Use external reconfiguration block, you can select the starting channel number of the transceivers.

f For more information about starting channel number, refer to the ALT2GXB_RECONFIG Megafunction User Guide.

Table 6 shows the reference design signals that communicate with the reconfiguration block. Signal direction is relative to the reference design.

Table 6. External Reconfiguration Block Signals

Signal

Size (Bits)

DirectionStratix II GX Devices Stratix IV Devices

reconfig_fromgxb 1 17 Output

reconfig_togxb 3 4 Input

reconfig_clk 1 1 Input

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 13: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Functional Description Page 13

ECC OptionsFor Stratix IV devices, you can turn on ECC Protected RAMs to configure single-bit error (sbe) correction and double-bit error detection on the transmit and receive FIFOs and in the Soft XAUI PCS memory, to create a highly-reliable 10-Gbps Ethernet solution. When you generate the reference design by clicking Finish in the MegaWizard interface, an ALTECC megafunction is instantiated to implement this protection.

If you turn on the ECC feature, the reference design includes a set of error insertion registers to support ECC testing, and a set of ECC statistics counters that accumulate the counts of various types of ECC errors as they are detected.

Turning on the ECC feature affects the size and maximum achievable frequency of your reference design. For example, turning on this feature increases the widths of the ECC-protected FIFOs.

f For information about the ALTECC megafunction, refer to the Integer Arithmetic Megafunctions User Guide.

For additional information about the ECC feature implementation, refer to “Memory ECC Errors” on page 26 and to “ECC Monitoring and Testing” on page 60.

Functional DescriptionThe 10-Gbps Ethernet reference design provides an Avalon Streaming (Avalon-ST) interface to user applications and an industry standard XGMII or XAUI interface to external PHY devices.

Figure 5 shows a block diagram of the 10-Gbps Ethernet reference design.

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 14: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 14 Functional Description

Frame FormatA basic IEEE 802.3 Ethernet frame comprises the following fields:

■ Start—1 byte.

■ Preamble—6 bytes.

■ Start frame delimiter (SFD)—a 1-byte fixed value of 0xD5 which marks the beginning of a frame.

■ Destination and source addresses—6 bytes each. The least significant byte is transmitted first.

■ Length or type—a 2-byte value equal to or greater than 1,536 (0x600) indicates a type field. Otherwise, this field contains the length of the payload data. The most significant byte of this field is transmitted first on the serial line to the Ethernet network.

■ Payload data and pad—variable length data and padding of 00 data if frame length is less than 64 bytes long.

■ Frame check sequence (FCS )—a 4-byte cyclical redundancy check (CRC) value for detecting frame errors during transmission.

■ End of frame delimiter (EFD)

Figure 6 shows the format of a basic frame.

Figure 5. Block Diagram

Transmitter Control

CRCGeneration

TransmitFIFO Buffer Pause Frame

Generation

Avalon-STTransmitter

Configurationand

Statistics

MDIOMaster

Avalon-MMInterface

PHYManagementInterface

XGMIIReceiver

XGMIITransmitter

Receiver Control

Local Loopback

Line Loopback

CRCCheck

ReceiverFIFO Buffer Pause Frame

Termination

Avalon-STReceiver

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 15: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Functional Description Page 15

The extension of a basic frame is a virtual local area network (VLAN) tagged frame, which contains an additional 4-byte field for the VLAN tag and information between the source address and length/type fields. VLAN tagging is defined by the IEEE 802.1Q standard. VLANs can identify and separate many groups' network traffic from each other in enterprises and also in metro networks. Each VLAN group can consist of many users with varied MAC address in different geographical locations of a network. VLANs increase and scale the network performance and add privacy and safety to various groups or customers’ network traffic.

VLAN tagged frames have a maximum length of 1,522 bytes, excluding the preamble and the SFD bytes. Figure 7 shows the format of a VLAN tagged frame.

In some applications, frames can be tagged with two consecutive VLAN tags (stacked VLAN). Stacked VLAN frames contain an additional 8-byte field between the source address and client length/type fields, see Figure 8. Stacked VLANs allow virtual private networks (VPN) in metro Ethernet and across multiple carriers.

Figure 6. Frame Format

Figure 7. VLAN Tagged Frame Format

6 bytes Preamble

1 byte Start

1 bytes SFD 6 bytes Destination Address 6 bytes

Source Address

2 bytes

Length/Type

0..1500/9000 bytes

Payload Data

0..46 bytes Pad

4 bytes Frame Check Sequence

Frame Length

6

1

bytes

1 bytes

6 bytes

6 bytes

2 bytes

Client Length/Type

0..1500/9000 bytes

Payload Data

0..42 bytes Pad

4 bytes Frame Check Sequence

Frame Length

2 bytes

2 bytes

Length/Type (VLAN Tag 0x8100)

VLAN Info

Preamble

SFD

Destination Address

Source Address

byte Start

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 16: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 16 Functional Description

f For pause frame format, refer to Figure 14 on page 29.

Receiver OperationThis section describes the receiver operation. Figure 9 shows the flow of the receiver operation.

Preamble ProcessingThe preamble sequence is Start, six preamble bytes, and SFD. If this sequence is incorrect the frame is ignored. The Start word must be on the receiving lane 0 (most significant byte).

Figure 8. Stacked VLAN Tagged Frame Format

6 bytes

1 bytes

6 bytes

6 bytes

2

2

2

bytes

Client Length/Type

0..1500/9000 bytes

Payload Data

0..38 bytes Pad

4 bytes Frame Check Sequence

Frame Length

2 bytes

2 bytes

Length/Type (VLAN Tag 0x8100)

VLAN Info

bytes

bytes

Length/Type (VLAN Tag 0x8100)

VLAN Info

Stacked VLANs

Preamble

SFD

Destination Address

Source Address

1 byte Start

Figure 9. Receiver Flow

Remove Payload Pad

Write Data FIFO and Frame Status

discard Process Preamble

Check CRCerror

Check Frame Lengtherror

Check Frame Length/Typeerror

Check MAC Addressdiscard

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 17: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Functional Description Page 17

The reference design uses the SFD byte (0xD5) to identify the last byte of the preamble. The reference design looks for the Start, 6 preambles and SFD. If not found the frame is ignored.

The IEEE standard specifies that frames must be separated by an interframe gap (IFG) of an average of 96 bit times.

The reference design removes all preamble and SFD bytes from accepted frames.

Address CheckingBit 0 in the destination address field specifies the type of address.

■ If bit 0 is 0, the destination address is a unicast (individual) address.

■ If bit 0 is 1, the destination address defines a multicast (group) address.

■ If all 48 bits in the destination address are 1, it is a broadcast address.

The reference design accepts broadcast frames if bit 28 (BROAD_FILTER_ENA) in the command_config register is set to 0, which is the default. If you enable promiscuous operation (PROMIS_EN bit in the command_config register = 1), address checking is omitted and all received frames are accepted.

A frame is accepted only if its unicast destination address matches any of the following addresses:

■ The primary address, configured in the registers mac_0 and mac_1—these 32-bit registers build a 48-bit MAC address

■ The four supplemental addresses, configured in the following registers: smac_0_0 and smac_0_1, smac_1_0 and smac_1_1, and smac_2_0 and smac_2_1, and smac_3_0 and smac_3_1

Otherwise, the reference design discards the frame. The multicast address matching works the same way as the unicast. If the supplemental address is multicast, it is matched. For more information about the address registers, refer to Table 18 on page 38.

Frame Length/Type CheckingIf the length/type field represents the payload length, the reference design checks the payload length and reports any error in the frame status, avl_st_rx_err. Otherwise, the reference design forwards the frame to your application. The frame is forwarded even with the error except if filtered by the FIFO.

The maximum frame size is defined in a register, the value of the register determines the maximum length. The maximum frame size is 64 Kbyte. If the maximum frame size is exceeded, the packet is marked as error, and the error signal is set high.

1 Although the MAC supports maximum frame size of 64 Kbyte, the PCS is only rated to support 16 Kbyte frames with a clock tolerance of +/– 100 ppm, as defined in the IEEE 802.3 specification. To allow the PCS to run frames up to 64 Kbytes, the clocks must be of identical frequency (0-ppm difference) and must originate from the same clock.

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 18: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 18 Functional Description

VLAN Frame Processing

A value of 0x8100 in the length/type field denotes a VLAN tagged frame. A 2-byte VLAN tag follows the length/type field. VLAN tagged frames are received in the same manner as basic frames, and the entire frame, including the VLAN tag, is forwarded to the user application. The reference design sets the avl_st_vlan_tag signal to indicate that the current frame is a VLAN tagged frame.

The reference design removes the padding from VLAN tagged frames only when the value of the client length/type field, which comes after the VLAN control information field, is less than 42 and the PAD_EN bit in the command_config register is set to 1.

Stacked VLAN Frame Processing

A value of 0x8100 in the length/type field following the additional 2 bytes in VLAN tagged frames denotes a stacked VLAN tagged frame (see “Frame Format” on page 14). The reference design sets the avl_st_vlan_vlan_tag signal to indicate that the current frame is a stacked VLAN tagged frame.

The reference design removes the padding from stacked VLAN tagged frames only when the value of the client length/type field, which comes after the second VLAN tag field, is less than 38 and the PAD_EN bit in the command_config register is set to 1.

Pause Frame Termination

Pause frames are terminated within the receive engine; they are not forwarded to the receive FIFO. The reference design determines if a pause frame is valid by checking its CRC and frame length. The pause quanta in a valid pause frame is extracted and forwarded to the transmit engine. Invalid pause frames are ignored.

1 For the destination address, both the multicast and the unicast are taken. The frame must be valid, and be at least 64 bytes long and have a correct CRC.

The statistics counter aPAUSEMACCtrlFramesReceive is incremented each time a valid pause frame is received.

Payload Pad RemovalThe padding removal can be optional, depending on the payload length and the value of the PAD_EN bit in the command_config register.

The reference design removes the padding, prior to sending the frames to the receive FIFO, when the PAD_EN bit is set to 1 and the payload length is less than the following values for the different frame types:

■ 46 bytes for basic frames

■ 42 bytes for VLAN tagged frames

■ 38 bytes for stacked VLAN tagged frames

If the PAD_EN bit is set to 0, complete frames including the padding are forwarded to the receive FIFO.

CRC CheckingThe following equation shows the CRC polynomial, as specified in IEEE 802.3:

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 19: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Functional Description Page 19

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 X32 in the least significant bit of the first byte. The CRC bits are thus received in the following order: X32, X30,..., X1, X0.

If a CRC-32 error is detected, the reference design marks the frame invalid by setting the frame status, avl_st_rx_err, to 1.

The CRC-32 field is forwarded to the receive FIFO if the CRC_FWD and PAD_EN bits in the command_config register are 1 and 0 respectively.

Frame Length CheckingThe reference design checks the complete frame length to ensure that the length conforms to the following conditions:

■ The length of all frame types is not less than 64 bytes.

■ The length of basic frames is not greater than the maximum length specified in the frm_length register.

■ The length of VLAN tagged frames is not greater than the maximum length specified in the frm_length register plus four.

■ The length of stacked VLAN tagged frames is not greater than the maximum length specified in the frm_length register plus eight.

The reference design keeps track of the actual frame payload length as it receives a frame. The actual frame payload length is checked against the length/type or client length/type field, depending on the frame type, when the NO_LGTH_CHECK bit in the command_config register is set to 0 and a valid frame length is received for the following frame types:

■ Basic frames—the length/type field is between 0x2E and 0x0600 (46 to 1,536), excluding 0x600.

■ VLAN tagged frames—the client length/type field is between 0x2A and 0x0600 (42 to 1,536), excluding 0x600.

■ Stacked VLAN tagged frames—the client length/type field is between 0x26 and 0x0600 (38 to 1,536), excluding 0x600.

If the actual frame payload length and frame length received do not match, the reference design sets the received frame status bit avl_st_rx_err to 1, indicating a length error.

Receiver FIFO ThresholdsIf you turn on Include Avalon Streaming FIFO in the wizard, you can configure the following receiver FIFO thresholds to dynamically change the receive FIFO operations and effectively manage potential FIFO overflow or underflow:

■ Almost full off

■ Almost full on

■ Almost empty off

■ Almost empty on

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 20: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 20 Functional Description

The FIFO is 72 bits wide if the ECC feature is turned off, and 85 bits wide if the ECC feature is turned on. Each FIFO entry comprises 64 bits of data, 8 control bits, and optionally, 8 bits of ECC for the data and 5 bits of ECC for the control bits. All the thresholds are in bytes (8 bits). Figure 10 illustrates the receiver FIFO thresholds.

You set the receive FIFO thresholds via registers. Table 7 describes how each threshold can be used to change and manage FIFO operations.

1 When the FIFO buffer has N 8-byte entries, the minimum value is 0; maximum value is (N – 1). The on and off values must be different.

1 If you turn off the Include Avalon Streaming FIFO for the receiver there is no ready signal, so the data is sent automatically.

Figure 10. Receiver FIFO Thresholds

Almost Full Off

dav = 0

dav = 1

Almost Full On

Receiver FIFO Level

Almost Empty On

dav = 0

dav = 1

Almost Empty Off

Transmitter FIFO Level

Table 7. Receiver FIFO Threshold Register Descriptions

Threshold Register Name Description

Almost full off rx_almost_full_off

The number of unwritten entries in the FIFO before the FIFO is full. When the FIFO reaches this level, user_rx_dav is asserted.

Almost full on rx_almost_full_on

The number of unwritten entries in the FIFO before the FIFO is full. When the FIFO reaches this level, user_rx_dav is deasserted.

Almost empty off rx_almost_empty_off

Indicates that there are enough entries to read. When the FIFO reaches this level, avl_st_rx_dav is asserted.

Almost empty on rx_almost_empty_on

Indicates that there are insufficient entries in the FIFO for the user application to start reading. When the FIFO reaches this level, avl_st_rx_dav is deasserted unless an EOP is present in the FIFO.

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 21: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Functional Description Page 21

ECC in the Receiver FIFOIf you turn on Include Avalon Streaming FIFO and ECC Protected RAMs in the MegaWizard interface, the receiver FIFO entries have ECC protection. The reference design adds the ECC bits to each 64-bit data and 8-bit control entry, before adding it to the receiver FIFO. As each data entry is read from the receiver FIFO, the FIFO checks the ECC and indicates any ECC-detected error.

Link Fault SignalingThe receiver monitors the traffic for local and remote fault signaling. On receiving these faults, it requests the transmission of remote fault or idles respectively. On detection of local or remote faults, the receiver transmits remote fault or idle, which overrides the sent data.

The state machine for detecting and transmitting follows IEEE 802.3 Clause 46 state diagram.

Transmitter Operation Frame transmission starts when the transmit FIFO buffer holds enough data and initiates the following tasks:

■ Generates Start, preamble, and SFD field before frame transmission

■ Inserts source address if required

■ Adds padding to the frame, if required

■ Calculates and appends CRC-32 to the transmitted frame, if required

■ Sends frame with correct interframe gap (IFG)

■ Generates XOFF pause frames if the receive FIFO reports a congestion, if the xoff_gen signal is asserted, or if xoff_request signal is asserted (pulsed)

■ Generates XON pause frames if the receive FIFO congestion condition is cleared, if the xon_gen signal is asserted, or if xon_request signal is asserted (pulsed)

■ Suspends Ethernet frame transmission (XOFF) if a non-zero pause quanta is received from the receive path

■ Checks and generates the link fault condition

f For more information about XON and XOFF pause frames, see “Flow Control Operation” on page 27.

Figure 11 shows the transmitter flow.

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 22: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 22 Functional Description

Address InsertionIf address insertion is enabled (TX_ADDR_INS bit in the command_config register = 1), the source address in frames received from the transmit FIFO is replaced with the primary address.

If address insertion is disabled (TX_ADDR_INS bit in the command_config register = 0), the source address is forwarded to the Ethernet-side interface.

Frame Payload PaddingIEEE 802.3 defines a minimum frame length of 64 bytes. To avoid violating this specification, the reference design automatically inserts padding bytes (0x00) if it receives frames with payload length less than 46 bytes from the user application:

CRC-32 GenerationThe CRC polynomial, as specified in the IEEE 802.3, is shown in the following equation:

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

Figure 11. Transmitter Flow

Send Preamble

Send Destination Address

Send Local MAC Address(Overwrite FIFO Data)

Send Payload

Send Padding(if necessary)

Send CRC

Send IPG

Send Idles

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 23: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Functional Description Page 23

The 32-bit CRC value occupies the FCS field with X31 in the least significant bit of the first byte. The CRC bits are thus transmitted in the following order: X31, X30,..., X1, X0.

IFGThe IFG configured in the tx_ipg_length register is maintained between transmissions. The minimum IFG can be configured to any value between 64 and 216 bit times, where 64 bit times is the time it takes to transmit 64 bits of raw data on the medium.

The deficit idle counter maintains an average IFG. You can configure the average IFG value in the tx_ipg_length register (0x05c). The number is a multiple of 4 with a minimum of 8 and a maximum of 252. The default (IEEE required value) is 12. In the traffic, the IFG varies between (IFG value–3) and (IFG value+3) depending on the deficit idle counter.

Transmitter FIFO ThresholdsYou can configure the following transmitter FIFO thresholds to dynamically change the transmitter FIFO operation and effectively manage potential FIFO overflow or underflow:

■ Almost full off

■ Almost full on

■ Almost empty off

■ Almost empty on

The FIFO is 64 bits wide if the optional ECC feature is turned off, and 72 bits wide if the ECC feature is turned on. All the thresholds are in bytes (8 bits). Each FIFO entry comprises 64 bits of data, 8 control bits, and optionally, 8 bits of ECC for the data and 5 bits of ECC for the control bits. Figure 12 illustrates the transmitter thresholds.

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 24: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 24 Functional Description

The transmitter FIFO thresholds are configured via the registers. Table 8 describes how you can use each threshold to change and manage FIFO operations.

1 When the FIFO buffer has N 8-byte entries, the minimum value is 0; maximum value is (N – 1). The on and off values must be different.

1 If you turn off the Include Avalon Streaming FIFO for the transmitter, the read latency is 1. You must provide a full packet when the design indicates data is present.

Transmitter FIFO UnderflowDuring a frame transmission, if the transmit FIFO reaches the almost-empty threshold with no end of frame indication stored in the FIFO, the transmit control stops reading data from the FIFO and initiates the following actions:

1. The reference design indicates that the fragment transferred is not valid.

Figure 12. Transmitter FIFO Thresholds

Almost Full Off

dav = 0

dav = 1

Almost Full On

Receiver FIFO Level

Almost Empty On

dav = 0

dav = 1

Almost Empty Off

Transmitter FIFO Level

Table 8. Transmitter FIFO Threshold Register Descriptions

Threshold Register Name Description

Almost full off tx_almost_full_off The number of unread entries in the FIFO before the FIFO is full. When the FIFO reaches this level, avl_st_tx_dav is asserted.

Almost full on tx_almost_full_on The number of unwritten entries in the FIFO before the FIFO is full. When the FIFO reaches this level, avl_st_tx_dav is deasserted.

Almost empty off tx_almost_empty_off Indicates that there are enough entries to read. When the FIFO reaches this level, user_tx_dav is asserted.

Almost empty on tx_almost_empty_on Indicates that there are insufficient entries in the FIFO for the user application to start reading. When the FIFO reaches this level, user_tx_dav is deasserted unless there is another EOP in the FIFO.

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 25: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Functional Description Page 25

2. The reference design terminates the frame transmission.

3. After the underflow, the application completes the frame transmission.

4. The transmit control discards any new data in the FIFO until the EOP is reached.

5. The reference design starts to transfer data on the XGMII when the application sends a new frame with a start of frame indication.

ECC in the Transmitter FIFOIf you turn on Include Avalon Streaming FIFO and ECC Protected RAMs in the MegaWizard interface, the transmitter FIFO entries have ECC protection. The reference design adds the ECC bits to each 64-bit data and 8-bit control entry, before adding it to the receiver FIFO.As each data entry is read from the transmitter FIFO, the FIFO checks the ECC and indicates any ECC-detected error.

ErrorsThe transmitter and receiver allow errors. The reference design reports the error and acts to recover from an incoming or reported error.

From the Ethernet stream, the reference design can receive a command character error |E|, if for example there is a disparity error. From the Avalon-ST interface, you can trigger an error on the error pin alongside the data. In addition, for Stratix IV devices, the 10-Gbps Ethernet reference design optionally supports a single-error correct, double-error detect error correction code in the receive and transmit FIFOs and in the Soft XAUI FIFOs.

Ethernet ErrorsOn the transmit side, if the data runs dry on the input side without an EOP, an error is sent out to the PCS and Ethernet network and the reference design pulls data from the internal system until the EOP is read. If an error signal arrives alongside the data, the reference design ensures the error is propagated. In the transmitter, a FIFO underflow triggers an error (reading incorrect data). The transmitter state machine recovers from this condition. The transmitter errors the frame (transmits the error control character |E|) in the following cases:

■ There is a user error on the Avalon-ST interface, indicated with avl_st_tx_err if the reference design implements a FIFO, or user_tx_error if the reference design does not implement a FIFO. Each of these signals is asserted on the same cycle as the corresponding end-of-packet signal (avl_st_tx_eop or user_tx_eop).

■ The packet received on the Avalon-ST interface is malformed:

■ The Avalon-ST valid signal goes low while a packet is open—there is a valid start-of-packet (SOP) and before receiving the end-of-packet (EOP), the valid signal goes low

■ There is a second SOP while a packet is open (missing EOP)—there is a valid SOP, and before receiving the EOP, there is another SOP

On the receive side, avl_st_rx_err goes high if any of the following errors occur:

■ Malformed frame (missing end of frame)

■ Error during the packet signaled by the error command

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 26: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 26 Functional Description

■ Incorrect FCS

■ Incorrect length

If you select a store forward FIFO and set bit 26 (FIFO_ERR_DIS) in the command_config register to 1, error packets are discarded. A FIFO overflow in the receiver triggers the core to write an error to the packet.

Memory ECC ErrorsIf you turn on ECC Protected RAMs in the MegaWizard interface, the reference design instantiates ALTECC megafunctions to implement single-bit error correction and double-bit error detection in the receive and transmit FIFOs and in the Soft XAUI PCS RAMs.

1 The 10-Gbs Ethernet reference design ECC feature implements single-bit error correction and double-bit error detection only. The occurrence of three or more errors in close proximity in any of these FIFOs, which is an event with extremely low probability, leads to unpredictable results, which may include lack of detection, flagging of a multiple-bit error, or incorrect flagging and erroneous attempted correction of a single-bit error.

In all FIFOs, the ECC is generated for the data and control words separately. In the receive and transmit FIFOs, and in the rate-matching FIFO in the Soft XAUI PCS, the ECC feature changes FIFO entry widths as shown in Table 9.

In the rate-matching FIFO in the Soft XAUI PCS, the ECC feature changes FIFO entry widths as shown in Table 10.

In the per-lane deskew FIFOs in the Soft XAUI PCS, the ECC feature changes FIFO entry widths as shown in Table 11.

ECC-detected errors are indicated on the following three output signals:

■ ecc_sbe: Single-bit error detected and corrected

■ ecc_mbe: Multiple-bit error (mbe), more specifically double-bit error, detected

Table 9. Receive and Transmit FIFO Entries With and Without ECC Bits

Information Type Width Without ECC (bits) Number of ECC Bits Width with ECC (bits)

Data 64 8 72

Control 8 5 13

Table 10. Soft XAUI Rate-Matching FIFO Entries With and Without ECC Bits

Information Type Width Without ECC (bits) Number of ECC Bits Width with ECC (bits)

Data 64 8 72

Control 18 6 24

Table 11. Soft XAUI PCS Deskew FIFO Entries With and Without ECC Bits

Information Type Width Without ECC (bits) Number of ECC Bits Width with ECC (bits)

Data 22 6 28

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 27: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Functional Description Page 27

■ ecc_packet_dropped: Packet was dropped from receive or transmit FIFO

These signals are asserted for one Avalon-MM clock cycle to indicate a relevant error. A packet is dropped if an ECC-detected multiple-bit error obscures a valid SOP or EOP indication. Technically, two packets are merged, resulting in one incorrect packet in place of two correct packets. In addition, when the reference design detects a multiple-bit error in a packet, it flags an error by asserting the err bit with the packet in the EOP cycle.

The Soft XAUI PCS does not report packets dropped, but a packet start or end in a XAUI FIFO can be corrupted. If a multiple-bit error is detected, the reference design inserts a disparity error in the FIFO entry, which affects two columns. The IDLE conversion state machine translates the disparity error to a local fault. If an error occurs during a frame, the MAC terminates the frame and asserts the ecc_mbe signal.

Turning on the ECC feature instantiates a comprehensive set of error insertion registers to support error insertion for ECC testing, and a set of statistics counters available to be read by software. For more information about these registers, refer to “ECC Monitoring and Testing” on page 60.

Flow Control OperationThe full-duplex flow control manages three congestion types:

■ Remote device congestion—the remote device connected to the same Ethernet segment as the reference design reports congestion (by sending an XOFF pause frame) and requests the reference design to stop sending data. You can enable or disable this behavior using bit 30 in the command_config register.

■ Receive FIFO congestion—when the receive FIFO reaches a user defined threshold (rx_almost_full_on), the reference design generates and sends an XOFF pause frame to the remote device requesting the remote device to stop sending data. You can enable or disable this behavior using bit 8 in the command_config register.

■ Local device congestion—any device connected to the reference design can request the remote device to stop data transmission, which is typically done via the host processor.

Remote Device CongestionWhen the reference design receives and detects an XOFF pause frame from a remote Ethernet node, it records the pause quanta in that frame and then drops the frame. When the transmit control receives a valid pause quanta from the receive path, the reference design completes the transfer of the current frame and stops transmitting data for the amount of time specified by the pause quanta in 512 bit times increments.

Frame transmission resumes when the time specified by the quanta expires, and no new quanta value or pause frame with a quanta value set to 0x0000 is received.

Receive FIFO and Local Device CongestionThe transmit control generates pause frames at the request of the user application. You can enable or disable this behavior using bit 30 in the command_config register. For example, the FIFOs may be small and depending on their threshold, you may not want to always send XON and XOFF pause frames.

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 28: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 28 Functional Description

An XOFF pause frame is generated when one of the following three conditions are met:

■ The receive FIFO asserts the almost full on flag

■ The XOFF_GEN bit is set to 1 in the command_config register

■ The xoff_request signal is asserted for one clock cycle

Then the XOFF frame is sent to the Ethernet network when the current frame transmission completes.

1 If your user logic does not use the xon_request and xoff_request inputs signals, connect them to logical zero or ground.

When an XOFF pause frame is generated, the pause quanta bytes P1 and P2 (see “Pause Frames” on page 29) are filled with the value configured in the pause_quant register. The source address is set to the primary address configured in the mac_0 and mac_1 registers, and the destination address is set to a fixed multicast address, 01-80-C2-00-00-01 (0x010000c28001).

An XON pause frame is generated when one of the following three conditions are met:

■ The receive FIFO almost full off threshold is reached, which implies the receiver congestion condition is removed

■ The XON_GEN bit is set to 1 in the command_config register

■ The xon_request signal is asserted for one clock cycle

Then the XON frame is sent when the current transmission completes.

When an XON pause frame is generated, the pause quanta (payload bytes P1 and P2) is filled with 0x0000 (zero quanta). The source address is set to the primary address configured in the mac_0 and mac_1 registers and the destination address is set to a fixed multicast address, 01-80-C2-00-00-01 (0x010000c28001).

Pause frames generated are compliant to the IEEE 802.3 Annex 31A and B.

f For more information about pause frames, refer to “Pause Frames” on page 29.

Figure 13. Pause Frame Generation

Set XOFF_GEN Bit orAssert XOFF_REQUEST Signal

Set XON_GEN Bit orAssert XON_REQUEST Signal

Receiver FIFOBuffer

To Ethernet

From EthernetTo System

From System

pause_quant[15:0]

TransmitterFIFOBuffer

PauseFrame

Generator

ProgrammableThreshold

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 29: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Functional Description Page 29

1 The flow control mechanism can prevent any FIFO overflow on the receive path and protects the receive FIFO. When an overflow is detected on the receive FIFO, if you select Fill level in the wizard, the current frame is truncated with an error indication set in the receiver frame status, avl_st_rx_err. If you select a store forward FIFO and set bit 26 in the command_config register to 1, packets with errors are discarded.

Pause FramesA pause frame is generated by the receiving device to indicate congestion to the source device. The source device should stop sending data upon receiving pause frames if it supports flow control.

Figure 14 shows the format of pause frames. The length/type field has a fixed value of 0x8808, followed by a 2-byte opcode field of 0x0001. A 2-byte pause quanta is defined in the frame payload bytes 2 (P1) and 3 (P2). The pause quanta, P1, is the most significant. A pause frame has no payload length field, and is always padded with 42 bytes of 0x00.

If a pause frame with a pause quanta greater than zero is received, the reference design completes the current frame transmission, and subsequently suspends data transmission for a duration specified by the pause quanta. One pause quanta fraction is equivalent to 512 bit times, which equates to 512/64 (the width of our bus), which is the eight-clock cycle of the system clock.

Data transmission resumes when a pause quanta of zero is received.

The transmitter can insert XON and XOFF commands based on the thresholds given by the receiver FIFO.

The receiver detects the XON and XOFF commands and stops the transmission of data. The pause is triggered on one of the following address options:

■ The unicast address corresponding to the MAC

■ The reserved multicast address

In both cases, action is only taken between packets. If a packet is being transmitted, the action is only taken after the end of the packet.

Local and Line Loopback

f For more information about loopback, refer to bit 15 and bit 27 in Table 19 on page 44.

Figure 14. Pause Frame Format

6 bytes

1 bytes Preamble

1 bytes SFD 6 bytes Destination Address 6 bytes

Source Address

2 bytes

Type (0x8808)

Opcode (0x 0001)

Pause Quanta ({0xP1, 0xP2})

42 bytes PAD

Start

CRC

2 bytes

2 bytes

4 bytes

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 30: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 30 Functional Description

Promiscuous OperationThe Altera 10-Gbps Ethernet reference design can enable promiscuous operation for transmitting and receiving for some applications.

1 The reference design always adds CRC in transmit path.

Table 12 shows the command_config register bits that you set to enable promiscuous operation.

Also, you must set register 0x014 with a value greater than jumbo frame length

InterfacesThis section discusses the reference design interfaces.

FIFO InterfacesThe receiver and transmitter FIFO interfaces comply with the Avalon-ST interface specification.

f For more information about Avalon-ST interfaces, refer to the Avalon Interface Specification.

The receiver FIFO interface has a ready fixed latency of one; the transmitter FIFO interface has a ready fixed latency of one.

Frames received on the FIFO interface do not contain any preamble or SFD bytes. These are inserted and discarded by the reference design on transmit and receive, respectively.

Table 12. Promiscuous Operation

Bit Name Value Description

4 promis_en 1 Enables promiscuous operation in the receiver. Destination MAC address is not checked for filtering.

5 pad_en 1 Disables removing pad from the received frames.

6 crc_fwd 1 Receiver forwards the CRC field as received from the network to the user application.

Receiver always checks the CRC field and increments the respective statistics counter and sets the receive frame error bit.

7 pause_fwd 1 Receiver forwards to user application the pause frames to the user application.

8 pause_ignore 0 Receiver ignores received pause frames.

9 tx_addr_ins 0 Transmitter does not modify and does not insert the source MAC address into the transmit frame from user application.

23 cntl_frm_ena 1 Receiver accepts and forwards to user application all the control frames with any opcode other than 0x0001 (non-flow control).

24 no_length_check 1 Receiver does not check the received frame payload length against the length/type field of the frame.

28 broad_filter_ena 0 —

29 ins_crc_err 0 —

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 31: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Functional Description Page 31

1 The standard requires that the least significant byte of the address is transmitted first. For the other header fields, such as the length/type, VLAN tag, VLAN info, and pause quanta, the most significant byte is transmitted first.

The data bus is 64-bits wide and the first byte of the destination address is on bits 63:56. The address arrives in the same order as it was received. The bus is big endian.

Figure 15 shows the timing diagram for the receiver local interface (without FIFO buffer).

f For a description of the signal names, see “Signals” on page 50.

Figure 16 shows the timing diagram for the transmitter local interface (without FIFO buffer).

Figure 17 shows the timing diagram for the local interface (with FIFO buffer).

Figure 15. Local Interface Timing Diagram—Receiver

avalon_st_clk

user_rx_data[63:0]

user_rx_data_valid

user_rx_sop

user_rx_eop

user_rx_error

user_rx_mty[2:0]

user_rx_vlan_tag

user_rx_vlan_vlan_tag

0 6 0 5

Figure 16. Local Interface Timing Diagram—Transmitter

Note to Figure 16:

(1) The clock is serdes_sysclk if your 10-Gbs Ethernet reference design has a XAUI interface, and sys_clk if it has an XGMII interface.

clock (1)

user_tx_data[63:0]

user_tx_data_valid

user_tx_sop

user_tx_eop

user_tx_error

user_tx_mty[2:0]

user_tx_read

user_tx_dav

0 6 0 5

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 32: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 32 Functional Description

Figure 18 shows the timing diagram for Avalon-MM interface reads.

Figure 19 shows the timing diagram for Avalon-MM interface multiple writes.

MDIO InterfaceThe management data input/output (MDIO) interface is a two-wire management interface. The MDIO interface implements a standardized method to access the PHY device management registers. The reference design MDIO interface supports IEEE 802.3 Clause 22 (see Figure 20) and Clause 45.

Figure 17. Local Interface Timing Diagram

avl_st_clk

One cycle from ena to val

Signals an error, if presentSignals VLAN or stacked VLAN, if present

on first cycle

avl_st_rx_dat[63:0]

avl_st_rx_dav

avl_st_rx_ena

avl_st_rx_sop

avl_st_rx_eop

avl_st_rx_err

avl_st_rx_mty[2:0]

avl_st_rx_val

avl_st_rx_vlan_tag

avl_st_rx_vlan_vlan_tag

0 06

Figure 18. Avalon-MM Interface Timing Diagram—Reads

avalon_clk

avalon_reset_n

avalon_address[9:0]

avalon_write

avalon_writedata[31:0]

avalon_read

avalon_readdata[31:0]

avalon_waitrequest

00 2e 2c 1b 1f1b

Figure 19. Avalon-MM Interface Timing Diagram—Multiple Writes

avalon_clk

avalon_reset_n

avalon_address[9:0]

avalon_write

avalon_writedata[31:0]

avalon_read

avalon_readdata[31:0]

avalon_waitrequest

00 02 03 04 c0 c1 07 0807

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 33: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Functional Description Page 33

The PHY device MDIO registers are mapped in the register space and can be read and written from the Avalon-MM register interface. The reference design provides the flexibility to access PHY devices with the MDIO address set to any legal value.

MDIO Frame Format (Clause 22)

The MDIO master controller communicates with the slave PHY device using frames, see Table 13. A complete frame is 64-bits long and consists of 32-bit preamble, 14-bit command, 2-bit bus direction change, and 16-bit data. Each bit is transferred on the rising edge of the MDIO clock (MDC). The PHY management interface supports the standard MDIO specification (IEEE803.2 Clause 22).

Figure 20. MDIO Interface (Clause 22)

PHYManagement

Registers0 to 31

PHY Device

PHY Address

MDIO FrameGeneration

And Decoding

Parallel-to-

SerialInterface

PHYManagement

Registers0 to 31

PHY Device

PHY Address

MDIOMDC

MDIO FrameGeneration

And Decoding

Parallel-to-

SerialInterface

MDIO FrameGeneration

And Decoding

RegisterInterface

10-GbpsEthernet Reference

Design

Avalon-MM Interface

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 34: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 34 Functional Description

Table 14 describes the fields of the MDIO frame (clause 22).

MDIO Frame Format (Clause 45)

The MDIO master controller communicates with the slave PHY device using frames, see Table 15. A complete frame is 64-bits long and consists of 32-bit preamble, 14-bit command, 2-bit bus direction change, and 16-bit data. Each bit is transferred on the rising edge of the MDIO clock (MDC). The PHY management interface supports the standard MDIO specification (IEEE803.2 Clause 45).

Table 16 describes the fields of the MDIO frame (clause 45).

Table 13. MDIO Frame Formats (Read/Write)

Type

Command

PRE ST OP PHYAD REGAD TA Data Idle

Read 1 ... 1 01 10 AAAAA RRRRR Z0 DDDDDDDDDDDDDDDD Z

Write 1 ... 1 01 01 AAAAA RRRRR 10 DDDDDDDDDDDDDDDD Z

Table 14. MDIO Frame Field Descriptions—Clause 22

Name Description

PRE Preamble. 32 bits of logical 1 sent prior to every transaction.

ST Start indication. Standard MDIO (Clause 22): 0b01.

OP The opcode defines whether a read or write operation is performed:

■ 0b10: a read operation is performed.

■ 0b01: a write operation is performed.

PHYAD The PHY device address (PHYAD). Up to 32 devices can be addressed. For PHY device 0, the Addr1 field is set to the value configured in the mdio_addr0 register.

REDAD Register address. Each PHY can have up to 32 registers.

TA Turnaround time. Two bit times are reserved for read operations to switch the data bus from write to read for read operations. The PHY device presents its register contents in the data phase and drives the bus from the 2nd bit of the turnaround phase.

Data 16-bit data written to or read from the PHY device.

Idle Between frames, the MDIO data signal is tristated.

Table 15. MDIO Frame Formats—Clause 45

Type

Command

PRE ST OP PRTAD DEVAD TA Address/Data Idle

Address 1 ... 1 00 00 PPPPP EEEEE 10 AAAAAAAAAAAAAAAA Z

Write 1 ... 1 00 01 PPPPP EEEEE 10 DDDDDDDDDDDDDDDD Z

Read 1 ... 1 00 11 PPPPP EEEEE Z0 DDDDDDDDDDDDDDDD Z

Post-read-increment-address 1 ... 1 00 10 PPPPP EEEEE Z0 DDDDDDDDDDDDDDDD Z

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 35: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Functional Description Page 35

MDIO Registers

The host processor can access the MDIO registers of a PHY device via an Avalon-MM interface. The PHY MDIO registers are mapped in the address space. Each PHY device has 32 registers.

The reference design supports both clause 22 and clause 45, but you cannot use both at the same time due to electrical restrictions. Only one clause should be accessed in a design.

For clause 22, follow these steps:

1. Set up the mdio_addr0 register at address 0x03C, where:

■ Bits 31:5 are unused

■ Bits 4:0 are PHYAD

2. Read or write to addresses 0x200 to 0x27C for direct access to the 32 register addresses present (REGAD).

Table 16. MDIO Frame Field Descriptions—Clause 45

Name Description

PRE Preamble. 32 bits of logical 1 sent prior to every transaction.

ST The start of frame for indirect access cycles is indicated by the <00> pattern. This pattern assures a transition from the default one and identifies the frame as an indirect access. Frames that contain the ST=01 pattern defined in Clause 22 are ignored by the devices specified in Clause 45.

OP The operation code field indicates the type of transaction being performed by the frame.

■ 00 indicates that the frame payload contains the address of the register to access.

■ 01 indicates that the frame payload contains data to be written to the register whose address was provided in the previous address frame.

■ 11 indicates that the frame is a read operation.

■ 10 indicates that the frame is a post-read-increment-address operation.

PRTAD The port address (PRTAD). The port address is five bits, allowing 32 unique port addresses. The first port address bit to be transmitted and received is the MSB of the address. A station management entity must have a prior knowledge of the appropriate port address for each port to which it is attached, whether connected to a single port or to multiple ports.

DEVAD The device address is five bits, allowing 32 unique MDIO manageable devices (MMDs) per port. The first device address bit transmitted and received is the MSB of the address.

TA The turnaround time is a 2-bit time spacing between the device address field and the data field of a management frame to avoid contention during a read transaction. For a read or post-read-increment-address transaction, both the STA and the MMD remain in a high-impedance state for the first bit time of the turnaround. The MMD drives a zero bit during the second bit time of the turnaround of a read or postread-increment-address transaction. During a write or address transaction, the STA drives a one bit for the first bit time of the turnaround and a zero bit for the second bit time of the turnaround.

Address/Data

The address/data field is 16 bits. For an address cycle, it contains the address of the register to be accessed on the next cycle. For the data cycle of a write frame, the field contains the data to be written to the register. For a read or post-read-increment-address frame, the field contains the contents of the register. The first bit transmitted and received is bit 15.

Idle The idle condition on MDIO is a high-impedance state. All three state drivers shall be disabled and the MMD’s pull-up resistor pulls the MDIO line to a one.

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 36: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 36 Functional Description

For clause 45, follow these steps:

1. Set up the mdio_addr0 register at address 0x03C, where:

■ Bits 31:16 are the Address

■ Bits 12:8 are the PRTAD

■ Bits 4:0 are the DEVAD

2. Read or write the register of the device of the port selected by reading or writing to address 0x320.

MDIO Clock Generation

The management data clock (MDC) is generated from the Avalon-MM interface clock signal, clk.

1 The division factor must be defined such that the MDC frequency does not exceed 2.5 MHz.

MDIO Buffer Connection

Figure 21 illustrates the buffers you can implement for the MDIO tristate bus.

Configuration and Statistics InterfacesThe configuration and statistics control interfaces have a register space of 256 registers (each register is up to 32-bits wide), providing access to all functional blocks within the reference design.

1 When the non-ECC statistics counters reach their maximum value, they roll over. Your software must calculate the difference between the current and the last read values to measure the change and should perform an accumulation operation in software.

Table 17 shows an overview of the register space for the reference design.

Figure 21. MDIO Buffer Connection

MDIOmdio_in

mdio_out

mdio_oeN

Table 17. Register Overview (Part 1 of 2)

Addr Offset Section Description

0x000 to 0x05C

Block configuration Base register set to parameterize the reference design.

0x060 to 0x0DC

Statistics counters Counters collecting traffic statistics.

0x200 to 0x27C

MDIO space 0

or PCS block configuration

MDIO registers for the first PHY device. These registers map directly to the 32 MDIO registers in a connected device.

If the configuration includes the PCS function, these registers control the PCS function.

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 37: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Functional Description Page 37

Control Interface Register MapThis section defines the control interface register map. Table 18 shows each usable register, except for the ECC feature management registers which are described in “ECC Monitoring and Testing” on page 60. The following list describes the columns HW reset, SW reset and access in Table 18:

■ The HW reset column specifies the value after hardware reset, which is controlled by the reset signal.

■ The SW reset column specifies the value or influence after a software reset, which is controlled by the SW_RESET bit in the command_config register.

■ “—” indicates that reset is not relevant to this register and has no influence.

■ “X” indicates that the value is unknown, which is typical for memory-based registers.

■ The access column indicates whether you can only read a register (RO), write it (WO) or read and write it (RW).

1 You must perform a software reset before you write to a non-ECC register, then re-enable the design.

f For more information about how to access 64-bit registers, refer to “64-Bit Statistics Counters” on page 60.

0x280 to 0x2FC

Reserved (1) Unused.

0x300 to 0x31C

Addresses Supplemental unicast addresses.

0x320 to 0x338

MDIO clause 45 Statistic counters.

0x33C Reserved (1) Unused.

0x340 to 0x348

Transceiver status Transceiver status for XAUI. Only in Altera devices with a minimum of four integrated serial transceivers.

0x34C Reserved (1) Unused.

0x350 to 0x424

“ECC Monitoring and Testing” on page 60

ECC test and statistics registers.

Note to Table 17:

(1) Altera recommends that you set all bits in reserved registers to 0 and ignore them on reads.

Table 17. Register Overview (Part 2 of 2)

Addr Offset Section Description

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 38: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 38 Functional Description

Table 18. Control Interface Register Map (Part 1 of 6)

Address Offset Name Description Access HW Reset SW Reset

0x000 rev Revision. This register is divided into two 16-bit fields:

■ Bits 15:0: reference design revision, set to 0x0702

■ Bit 31:16: Customer specific revision, set to 0 during reference design configuration. This field is controlled by the parameter CUST_VERSION defined in the top level generated for the 10-Gbps Ethernet reference design instance.

RO 0x00000702 —

0x004 scratch Scratch register. Provides a memory location for user applications to test the device memory operation.

RW 0 —

0x008 command_config Command register. The host processor uses this register to control and configure the reference design.

RW 0 bit 0 = 0

bit 1 = 0

Others not modified

0x00C mac_0 32-bit primary address word 0—bits 0 to 31 of the primary address.

Bit 0 maps to bit 0 of the address, bit 1 maps to bit 1 of the address, and so on.

RW 0 —

0x010 mac_1 32-bit primary address word 1—bits 32 to 47 of the primary address.

Bits 16 to 31 are reserved.

Bit 0 maps to bit 32 of the address.

RW 0 —

0x014 frm_length 14-bit maximum frame length. The receive logic uses this value to check frames. Typical value is 1518.

Bits 14 to 31 are reserved.

RW 1518 —

0x018 pause_quant 16-bit pause quanta. The pause quanta is used in each pause frame sent to a remote Ethernet device, in increments of 512 Ethernet bit times. Bits 16 to 31 are reserved.

RW 0 —

0x01C rx_almost_empty_off 12-bit receive FIFO almost empty off threshold. Bits 12 to 31 are unused.

RW 0 —

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 39: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Functional Description Page 39

0x020 rx_almost_empty_on 12-bit receive FIFO almost empty on threshold. Bits 12 to 31 are unused.

RW 0 —

0x024 tx_almost_empty_off 12-bit transmit FIFO almost empty off threshold. Bits 12 to 31 are unused.

RW 0 —

0x028 tx_almost_empty_on 12-bit transmit FIFO almost empty on threshold. Bits 12 to 31 are unused.

RW 0 —

0x02C rx_almost_full_off 12-bit receive FIFO almost-full threshold. Bits 12 to 31 are unused.

RW 0 —

0x030 rx_almost_full_on 12-bit receive FIFO almost-full threshold. Bits 12 to 31 are unused.

RW 0 —

0x034 tx_almost_full_off 12-bit transmit FIFO almost-full threshold. Bits 12 to 31 are unused.

RW 0 —

0x038 tx_almost_full_on 12-bit transmit FIFO almost-full threshold. Bits 12 to 31 are unused.

RW 0 —

0x03C mdio_addr0 MDIO address of PHY device 0.

■ 4:0 are the PHY address (clause 22) or the device address (clause 45)

■ 12:8 are the port address (clause 45 only)

■ 31:16 are the register address (clause 45 only). To read and write for clause 45, the read and write must be done at address 0x320

RW 0 —

0x040 Unused Unused. — — —

0x044 to 0x054

Reserved Reserved for user defined registers.

— 0 —

0x058 Reserved Reserved for user defined registers.

RO 0 —

0x05C tx_ipg_length Minimum IFG. Valid values are between 8 and 252 bytes. If this register is set to an invalid value, it defaults to 12 byte-times which is a typical value of minimum IFG. Bits 5 to 31 are reserved and set to read-only value 0.

RW 12 —

Table 18. Control Interface Register Map (Part 2 of 6)

Address Offset Name Description Access HW Reset SW Reset

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 40: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 40 Functional Description

0x060

0x064

aMacID This register is wired to mac_0 and mac_1 addresses respectively.

RO 0 —

0x068 aFramesTransmittedOK_0 See Table 20 on page 46. RO 0 0

0x06C aFramesReceivedOK_0 See Table 20 on page 46. RO 0 0

0x070 aFrameCheckSequenceErrors

See Table 20 on page 46. RO 0 0

0x074 aAlignmentErrors See Table 20 on page 46. RO 0 0

0x078 aOctetsTransmittedOK_0 See Table 20 on page 46. RO 0 0

0x07C aOctetsReceivedOK_0 See Table 20 on page 46. RO 0 0

0x080 aTxPAUSEMACCtrlFrames See Table 20 on page 46. RO 0 0

0x084 aRxPAUSEMACCtrlFrames See Table 20 on page 46. RO 0 0

0x088 ifInErrors See Table 21 on page 47. RO 0 0

0x08C ifOutErrors See Table 21 on page 47. RO 0 0

0x090 ifInUcastPkts See Table 21 on page 47. RO 0 0

0x094 ifInMulticastPkts See Table 21 on page 47. RO 0 0

0x098 ifInBroadcastPkts See Table 21 on page 47. RO 0 0

0x09C ifOutDiscards See Table 23 on page 48. RO 0 0

0x0A0 ifOutUcastPkts SeeTable 21 on page 47. RO 0 0

0x0A4 ifOutMulticastPkts See Table 21 on page 47. RO 0 0

0x0A8 ifOutBroadcastPkts See Table 21 on page 47. RO 0 0

0x0AC etherStatsDropEvents See Table 22 on page 48. RO 0 0

0x0B0 etherStatsOctets_0 See Table 22 on page 48. RO 0 0

0x0B4 etherStatsPkts_0 See Table 22 on page 48. RO 0 0

0x0B8 etherStatsUndersizePkts

See Table 22 on page 48. RO 0 0

0x0BC etherStatsOversizePkts See Table 22 on page 48. RO 0 0

0x0C0 etherStatsPkts64Octets See Table 22 on page 48. RO 0 0

0x0C4 etherStatsPkts65to127Octets

See Table 22 on page 48. RO 0 0

0x0C8 etherStatsPkts128to255Octets

See Table 22 on page 48. RO 0 0

0x0CC etherStatsPkts256to511Octets

See Table 22 on page 48. RO 0 0

0x0D0 etherStatsPkts512to1023Octets

See Table 22 on page 48. RO 0 0

0x0D4 etherStatsPkts1024to1518Octets

See Table 22 on page 48. RO 0 0

0x0D8 etherStatsPkts1519toXOctets

Any frame length from 1,519 to the maximum length configured in the frm_length register, if it is greater than 1,518.

RO 0 0

Table 18. Control Interface Register Map (Part 3 of 6)

Address Offset Name Description Access HW Reset SW Reset

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 41: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Functional Description Page 41

0x0DC etherStatsJabbers Too long frames with CRC error. RO 0 0

0x0E0 etherStatsFragments Too short frames with CRC error. RO 0 0

0x0E4 Reserved Unused RO — —

0x0EC linkFaultDetect Link remote and local fault detection according to IEEE 802.3ae:

■ Bit[0] =1'b1 and indicates a local fault has been detected

■ Bit[1] = 1'b1 and indicates a remote fault has been detected

■ Bit [1:0] = 2'b00 and indicates link is OK

All other bits are currently unused.

RO — —

0x200 to 0x27C

PHY Device 0 Internal Registers Registers 0 to 31 within PHY device 0 connected to the MDIO PHY management interface. Reading or writing immediately causes a corresponding MDIO transaction to read or write the underlying PHY device register. For configurations that include Ethernet and PCS blocks, the internal PCS is always device 0. In this case, reading and writing does not require an MDIO module as the application reads/writes directly to the PHY registers through the register interface.

The register at address offset 0x200 corresponds to register 0 of PHY device 0. The register at address offset 0x204 corresponds to register 1 of PHY device 0.

For all registers, bits 15:0 are significant. Bits 31:16 should be written with 0 and ignored on read.

RW — —

0x280 to 0x2FC

Reserved Reserved. — — —

0x300 smac_0_0 Supplemental address 0, bits 31:0.

Register bit 0 maps to bit 0 of the address, bit 1 maps to bit 1 of the address, and so on.

RW 0 —

Table 18. Control Interface Register Map (Part 4 of 6)

Address Offset Name Description Access HW Reset SW Reset

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 42: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 42 Functional Description

0x304 smac_0_1 Supplemental address 0, bits 47:32.

Register bit 0 maps to bit 32 of the address. Register bits 30:16 are reserved. register bit 31 enables address:

■ 0 to disable

■ 1 to enable

RW 0 —

0x308 smac_1_0 Supplemental address 1, bits 31:0.

Register bit 0 maps to bit 0 of the address, bit 1 maps to bit 1 of the address, and so on.

RW 0 —

0x30C smac_1_1 Supplemental address 1, bits 47:32.

Register bit 0 maps to bit 32 of the address. Register bits 30:16 are reserved. register bit 31 enables address:

■ 0 to disable

■ 1 to enable

RW 0 —

0x310 smac_2_0 Supplemental address 2, bits 31:0.

Register bit 0 maps to bit 0 of the address, bit 1 maps to bit 1 of the address, and so on.

RW 0 —

0x314 smac_2_1 Supplemental address 2, bits 47:32.

Register bit 0 maps to bit 32 of the address. Register bits 30:16 are reserved. register bit 31 enables address:

■ 0 to disable

■ 1 to enable

RW 0 —

0x318 smac_3_0 Supplemental address 3, bits 31:0.

Register bit 0 maps to bit 0 of the address, bit 1 maps to bit 1 of the address, and so on.

RW 0 —

0x31C smac_3_1 Supplemental address 3, bits 47:32.

Register bit 0 maps to bit 32 of the address. Register bits 30:16 are reserved. register bit 31 enables address:

■ 0 to disable

■ 1 to enable

RW 0 —

Table 18. Control Interface Register Map (Part 5 of 6)

Address Offset Name Description Access HW Reset SW Reset

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 43: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Functional Description Page 43

For information about the ECC test and statistics registers, at offsets 0x350 to 0x424, refer to “ECC Monitoring and Testing” on page 60. Although the ECC is integral to the 10-Gbps Ethernet reference design, its test interface is a set of registers for software to set up error insertion. The ECC itself is configured in the reference design instantiation, or not, based on your selection in the MegaWizard interface. The optional ECC feature does not have configurable parameters.

Command_Config Register

Table 19 describes the function of each bit and field in the command_config register.

0x320 MDIO clause 45 — RW — —

0x324 aFramesTransmittedOK_1 Packet and byte/octet counts for both transmitter and receiver are 64-bits wide.

For more information about how to access 64-bit registers, see “64-Bit Statistics Counters” on page 60.

See also Table 20 on page 46 and Table 22 on page 48.

RO 0 0

0x328 aFramesReceivedOK_1

0x32C aOctetsTransmittedOK_1

0x330 aOctetsReceivedOK_1

0x334 etherStatsOctets_1

0x338 etherStatsPkts_1

0x33C Reserved Reserved. — — —

0x340 ALTGX status0 Status of the transceivers (XAUI only).

■ 0 pll_locked

■ 1 rx_channelaligned

■ 7:4 rx_freqlocked

■ 11:8 rx_pll_locked

For more information, refer to the “Stratix IV Transceiver Architecture” chapter in the Stratix IV Device Handbook.

RO — —

0x344 ALTGX status1 Status of the transceivers (XAUI only).

■ 7:0 rx_disperr

■ 15:8 rx_errdetect

■ 23:16 rx_patterndetect

■ 31:24 rx_syncstatus

For more information, refer to the “Stratix IV Transceiver Architecture” chapter in the Stratix IV Device Handbook.

RO — —

0x348 Shadow MDIO Stores the last read value from the MDIO access.

— — —

Table 18. Control Interface Register Map (Part 6 of 6)

Address Offset Name Description Access HW Reset SW Reset

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 44: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 44 Functional Description

Table 19. Command_Config Register Bit Descriptions (Part 1 of 2)

Bit(s) Bit Name Access Description

0 TX_ENA RW Transmit enable. Setting this bit to 1 enables the transmit datapath. This bit is cleared following a hardware or software reset. See the SW_RESET bit description.

1 RX_ENA RW Receive enable. Setting this bit to 1 enables the receive datapath. This bit is cleared following a hardware or software reset. See the the SW_RESET bit description.

2 XON_GEN RW Pause frames generation. When this bit is set to 1, the reference design generates a pause frame with a pause quanta of 0, independent of the receive FIFO status.

3 Reserved — Self clear.

4 PROMIS_EN RW Promiscuous enable. Setting this bit to 1 enables promiscuous operation whereby the destination address of the receive frame is not checked.

5 PAD_EN RW Pad enable. Setting this bit to 1 enables pad removal in receive frames. The reference design removes receive frames padding before forwarding the frames to the user application. Transmit frames are always padded and this bit has no effect.

6 CRC_FWD RW Receive CRC forwarding.

■ If this bit is set to 1, the reference design forwards the CRC field to the user application.

■ If this bit is set to 0, the reference design removes the CRC field from the frame before forwarding the frame to the user application.

■ This bit is ignored if the PAD_EN bit is 1. In this case, the reference design checks the CRC field and removes it from the frame before forwarding the frame to the user application.

7 PAUSE_FWD RW Receive pause frame forwarding. Terminates or forwards pause frames.

■ If this bit is set to 1, the reference design forwards pause frames to the user application.

■ If this bit is set to 0, the reference design terminates and discards pause frames.

8 PAUSE_IGNORE RW Ignore pause frame quanta.

■ Setting this bit to 1 causes the reference design to ignore received pause frames.

■ Setting this bit to 0 causes the transmit process to stop for an amount of time specified in the pause quanta within the pause frame.

9 TX_ADDR_INS RW Set address on transmit.

■ If this bit is set to 1, the reference design overwrites the transmit frame source address with the address configured in the mac_0 and mac_1 registers, or in any of the supplemental address registers.

■ If this bit is set to 0, the reference design does not modify the source address.

12:10 Reserved — Reserved.

13 SW_RESET RW Software reset command. Setting this bit to 1 causes the reference design to disable the transmit and receive logic, flush the receive FIFO, and reset the statistics counters. This bit is automatically cleared when the software reset sequence completes.

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 45: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Functional Description Page 45

14 Reserved — Reserved.

15 LOCAL_LOOP_ENA RW Local loopback enable. Setting this bit to 1 enables a loopback. Frames sent through the transmitter interface are looped back into the receiver interface at the XGMII before the PCS.

The transition from straight-through to loopback and from loopback to straight-through mode only occurs between frames. If the reference design is transmitting a packet, the transition occurs after the EOP and when the frame is complete without corrupting any processed frame.

Only idle characters are transmitted to the Ethernet when in local loopback.

21:16 Reserved — Reserved.

22 XOFF_GEN RW Pause frame generation. If this bit is set to 1, the reference design generates a pause frame with the pause quanta set to the value configured in the pause_quant register, independent of the receive FIFO status.

23 CNTL_FRM_ENA RW Receive control frame enable bit self clear.

■ If this bit is set to 1, the receive control frames with any opcode other than 0x0001 are accepted and forwarded to the Avalon-ST interface.

■ If this bit is set to 0, the receive control frames with any opcode other than 0x0001 are discarded.

24 NO_LGTH_CHECK RW Receive payload length check disable.

■ If this bit is set to 0, the reference design checks the actual payload length of received frames against the length/type field in the received frames.

■ No checking is done if this bit is set to 1.

25 Reserved — Reserved.

26 FIFO_ERR_DISC RW Enable discard in FIFO. In store forward mode only, discards error and overflow frames if set to 1. Default value is 0.

27 LINE_LOOP_ENA RW Line loopback enable. Set to 1 to loopback the receiver traffic onto the transmitter path. Default value is 0.

To get correct loopback frames, you should first stop transmitting data, put the reference design into line loopback mode and then resume transmission.

28 BROAD_FILTER_ENA

RW Broadcast filtering enable. 0 lets the receive broadcast frames through; 1 filters them out. Default value is 0.

29 INS_CRC_ERR RW Insert one CRC error in the next transmit frame. For a generate fault, set to 1. An error is inserted in the next (or the one after due to latency to propagate the error) packet. The bit self clears.

30 NO_PAUSE_FIFO RW Disable FIFO pause. When set to 1, the receiver FIFO buffer does not trigger the generation of pause frames on the transmitter path. Otherwise, pause frames are triggered depending on thresholds.

31 CNT_RESET WC Self-clearing counter reset command. Setting this bit to 1 clears the statistics counters. This bit is automatically cleared when the counter reset sequence is completed.

Table 19. Command_Config Register Bit Descriptions (Part 2 of 2)

Bit(s) Bit Name Access Description

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 46: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 46 Functional Description

Software Reset

A software application can reset the reference design by setting the SW_RESET bit in the command_config register to 1. During a software reset, the reference design clears all statistics registers, flushes the receive FIFO, and disables the transmitter and receiver by setting the TX_ENA and RX_ENA bits in the command_config register to 0.

The value of configuration registers, such as the address and FIFO thresholds are preserved. The SW_RESET bit is cleared automatically when the software reset ends. For more information about the reset signal, refer to “Command_Config Register” on page 43.

Statistics Block

The statistics block accumulates statistics required in IEEE802.3 Basic, Mandatory and Recommended Management Information Packages, IEEE 802.3ah, Clause 30.

In addition, the reference design provides all signals to generate the applicable objects of the Management Information Base (MIB, MIB-II) according to IETF RFC2665 and Remote Network Monitoring (RMON) according to IETF RFC 2819 for SNMP Managed Environments.

The statistics block implements RMON (RFC 2819), MIB (RFC 3635), and MIB (RFC 2863).

IEEE 802.3 Management Packages

Table 20 lists the resources available to implement the IEEE 802.3 mandatory management packages defined in the Ethernet Standard 802.3 Clause 30 for the managed objects oMacEntity and oPauseEntity. Table 21 mentions objects and attributes only applicable to the reference design; other objects and attributes are derived from your application or higher layers.

Table 20. IEEE 802.3 oEntity and oPauseEntity Managed Object Support (Part 1 of 2)

IEEE802.3 Attribute

IEEE Management Packages

DescriptionBasic MandatoryRecommended

(Optional)

oEntity Managed Object Support

aMACID X — — The addresses.

aFramesTransmittedOK — X — Number of frames transmitted without error including pause frames.

aFramesReceivedOK — X — Number of frames received without error including pause frames.

aFrameCheckSequenceErrors

— X — Number of frames received with a CRC error.

aAlignmentErrors — X — Frame received with an alignment error.

aOctetsTransmittedOK — — X Sum of payload and padding octets of frames transmitted without error.

aOctetsReceivedOK — — X Sum of payload and padding octets of frames received without error.

oPauseEntity Managed Object Support

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 47: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Functional Description Page 47

f For more information about attributes and objects, refer to IEEE 802.3 Standard Clause 30.

IETF Management Information Base—(MIB, MIB-II) Objects Support

The Internet Engineering Task Force (IETF) Request for Comments 2665 (RFC2665) defines the Management Information Base (MIB, MIB-II) objects for the Ethernet-like interface types. RFC 2665 details the MIB (MIB-II) objects for Ethernet interfaces, which are defined in a more generic manner within RFC 2863.

IETF Remote Network Monitoring Support

The IETF RFC 2819 defines objects for managing remote network monitoring devices. These objects are usually implemented in a dedicated device (monitor/probe) for traffic monitoring and analysis within a network segment. Such a probe usually samples the values in a periodic manner to give relative usage estimations rather than absolute values. Table 22 lists the defined objects. The remote monitoring (RMON) MIB counts good and bad packets, defined as:

aPAUSEMACCtrlFramesTransmitted

— — X Number of transmitted pause frames.

aPAUSEMACCtrlFramesReceived

— — X Number of received pause frames.

Table 20. IEEE 802.3 oEntity and oPauseEntity Managed Object Support (Part 2 of 2)

IEEE802.3 Attribute

IEEE Management Packages

DescriptionBasic MandatoryRecommended

(Optional)

Table 21. IETF MIB (MIB-II) Objects Support

MIB Object Name Description

ifInUcastPkts Number of valid received unicast frames.

ifInMulticastPkts Number of valid received multicast frames (without pause).

ifInBroadcastPkts Number of valid received broadcast frames.

ifOutUcastPkts Number of valid transmitted unicast frames.

ifOutMulticastPkts Number of valid transmitted multicast frames.

ifOutBroadcastPkts Number of valid transmitted broadcast frames.

ifInErrors Number of frames received with error:

■ FIFO overflow error

■ CRC error

■ Length error

■ Alignment error

ifOutErrors Number of frames transmitted with error:

■ FIFO overflow error

■ FIFO underflow error

■ User application defined error

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 48: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 48 Functional Description

■ Good packets (valid frames): Good packets are error-free packets that have a valid frame length. A valid frame length is defined as between 64 bytes long and the value set in the frm_length register. The length does not include framing bits (preamble, SFD) but includes the FCS field.

■ Bad packets (invalid frames): Bad packets are packets that have proper framing and are therefore recognized as packets, but contain errors within the packet or have an invalid length. On the Ethernet, bad packets have a valid preamble and SFD, but have a bad CRC, or are either shorter than 64 bytes or longer than and the value set in the frm_length register.

Software Derived MIB Objects

To extend the management information base, the following counters and objects can be derived by the management or driver software, based on the counters available.

Table 23 describes three derived IETF MIB (MIB-II) objects.

Table 22. IEFT RMON MIB Object Support

MIB Object Name Support

etherStatsDropEvents Counts the number of dropped packets due to internal errors of the client. Occurs when FIFO overflow condition persists.

etherStatsOctets Total number of bytes received. Good and bad frames.

etherStatsPkts Total number of packets received. Counts good and bad packets.

etherStatsUndersizePkts Number of packets received with less than 64 bytes.

etherStatsOversizePkts Incremented with each well-formed packet that exceeds the valid maximum programmed frame length.

etherStatsPkts64Octets Incremented when a packet of 64 bytes length is received (good and bad frames are counted).

etherStatsPkts65to127Octets Frames (good and bad) with 65 to 127 bytes.

etherStatsPkts128to255Octets Frames (good and bad) with 128 to 255 bytes.

etherStatsPkts256to511Octets Frames (good and bad) with 256 to 511 bytes.

etherStatsPkts512to1023Octets Frames (good and bad) with 512 to 1023 bytes.

etherStatsPkts1024to1518Octets Frames (good and bad) with 1,024 to 1,518 bytes.

etherStatsPkts1519toXOctets Frames (good and bad) with 1,519 to maximum frame size defined address.

Table 23. Derived IETF MIB (MIB-II) Objects

MIB Object Description

ifInOctets Sum of bytes received except preamble (for example, header, payload, pad and FCS) of all valid received frames.

= 18 × aFramesReceivedOK + aOctetsReceivedOK

ifOutOctets Sum of bytes transmitted except preamble (for example, header, payload, pad and FCS) of all valid transmitted frames.

= 18 × aFramesTransmittedOK + aOctetsTransmittedOK

ifOutDiscards Not applicable. The reference design does not discard frames that you write into the FIFO. If a higher layer discards frames to be transmitted it implements this counter.

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 49: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Functional Description Page 49

Table 24 describes three derived IETF RMON MIB objects.

XAUI ReceiveThis section describes the XAUI receive operation, which includes comma detection, decoding, de-encapsulation, synchronization, and carrier sense.

Comma Detection

Ten-bit data received from PMA devices may not align on a valid 10-bit character. The comma detection function searches for the 10-bit encoded comma character, K28.1/K28.5/K28.7, in consecutive samples received from PMA devices. When the K28.1/K28.5/K28.7 comma code group is detected, the stream is realigned on a valid 10-bit character boundary. The aligned stream can subsequently be decoded with a standard 8b/10b decoder.

The comma detection function restarts the search for a valid comma character if the receive synchronization state machine loses the link synchronization.

8b/10b Decoding

The 8b/10b decoder checks the DC balancing (disparity check) and produces a decoded 8-bit stream of data for the frame de-encapsulation function.

Frame De-encapsulation

The frame de-encapsulation state machine detects the start of frame when the /I/ /S/ sequence is received. The frame bytes are decoded and transmitted to the reference design. The /T/ /R/ /R/ or the /T/ /R/ sequence is decoded as an EOP indication for the reference design.

The reception of a /V/ character is decoded as a frame error indication for the reference design. A wrong carrier is decoded when a sequence different from /I/ /I/ (Idle) or /I/ /S/ (Start of Frame) is detected.

During frame reception, the de-encapsulation state machine checks for invalid characters. If invalid characters are detected, the de-encapsulation state machine indicates an error to the reference design.

Synchronization

The link synchronization constantly monitors the decoded data stream and determines if the underlying receive channel is ready for operation. The link synchronization state machine acquires link synchronization if three code groups with comma are received consecutively without error.

Table 24. Derived IETF RMON MIB Objects

Object Support

etherStatsBroadcastPkts Any valid frame with Broadcast address:

= ifInBroadcastPkts

etherStatsMulticastPkts Any valid multicast frame, including pause frames:

= ifInMulticastPkts + aPAUSEMACCtrlFramesReceived

etherStatsCRCAlignErrors Incremented when frames of correct length but with CRC error are received:

= aFrameCheckSequenceErrors

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 50: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 50 Functional Description

Once link synchronization is acquired, the link synchronization state machine counts the number of invalid characters received. The state machine increments an internal error counter for each invalid character received and incorrectly positioned comma character. The internal error counter is decremented when four consecutive valid characters are received. When the counter reaches 4, the link synchronization is lost.

XAUI TransmitThis section describes the XAUI transmit operation, which includes frame encapsulation and encoding.

Frame Encapsulation

During transmission, the PCS function encapsulates frames according to the specification in IEEE 802.3 Clause 36. The first byte of the preamble in the frame is replaced with the start of frame /S/ symbol. Following the insertion on /S/, all of the frame is encoded with standard 8B/10B encoded characters. After the last FCS byte, the EOP /T/ /R/ /R/ or the /T/ /R/ sequence is inserted. The selection of the end packet sequence is based on odd/even number of character transmission. Between frames, /I/ symbols are transmitted.

If a frame is received from the reference design with an error indication, the encapsulation function inserts a /V/ character to encode an error that can be decoded by the remote end PHY device.

8b/10b Encoding

The 8B/10B encoder maps 8-bit words to 10-bit symbols to generate a DC balanced stream with a maximum run length of 5.

SignalsThis section describes all interface signals.

ClocksThe reference design MAC has a single clock domain—both the receiver and the transmitter run on the same system clock. You can share this clock with other components on the device but it must be tightly controlled to the exact required frequency of 156.25 MHz.

Table 25 shows the system clock and the different interface clocks in the 10-Gbps Ethernet reference design.

Table 25. Clocks (Part 1 of 2)

Name Description

sys_clk 156.25-MHz system clock for the state machines and datapath. Can be shared with other 10-Gbps Ethernet reference designs in the same device.

sysclk_90 The sys_clk clock phase-shifted by 90 degrees. This clock ensures that the transmitter clock and the transmit data are 90 degrees apart. In your design, this clock must be derived from the sys_clk or from the same source as sys_clk. The Synopsys Design Constraints (.sdc) file for the reference design enforces this constraint.

avalon_clk Avalon-MM clock that controls the Avalon-MM bus (for the statistics and configuration). This clock can be shared with other modules, an SOPC system, or can be tied to the system clock.

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 51: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Functional Description Page 51

Figure 22 shows the clocks with XGMII; Figure 23 shows the clocks with XAUI.

Control Interface SignalsThe control interface is an Avalon Memory-Mapped (Avalon-MM) slave port. This interface controls both the Ethernet and PCS blocks in the reference design. The slave port has the following properties:

avl_st_clk Avalon-ST clock input for the datapath, which can be different if a FIFO is present. This clock can be tied to the system clock.

xgmii_rx_clk

xgmii_tx_clk

XGMII clocks. To capture the data arriving on the XGMII receive interface, a PLL and local clock are required. The incoming clock is shifted by 90 degrees to capture the data. The xgmii_tx_clk clock is the same as sys_clk.

serdes_sysclk XAUI clock. When using the XAUI block, the transceiver module has its own PLL to derive the required output clocks. You can feed both the transmit and receive data clock, which are connected to the system clock, and the clock domain crossing from network clock to system clock occurs within the transceiver block.

phy_mdc MDIO clock. The MDIO clock runs very slowly (less than 2.5 MHz) and is derived from the Avalon-MM clock. The MDIO clock cannot be shared between modules.

cal_blk_clk Serializer/deserializer (SERDES) calibration clock.

Table 25. Clocks (Part 2 of 2)

Name Description

Figure 22. Clocks—XGMII

Figure 23. Clocks—XAUI

10-GbpsEthernet MAC

sys_clk

phy_mdc

FIFO

Configurationand

Statistics

avl_st_clk

avalon_clk

MDIOMaster

xgmii_tx_clock

xgmii_rx_clock

sys_clk shifted 90 degrees

10-GbpsEthernet MAC

XAUIsys_clk

phy_mdc

FIFO

Configurationand

Statistics

avl_st_clk

MDIOMaster

cal_blk_clk

serdes_sysclk

avalon_clk

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 52: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 52 Functional Description

■ 32-bit readdata and writedata signals

■ 8-bit address signal

■ Variable wait states

f For more information about the Avalon-MM interface, refer to the Avalon Interface Specifications.

The 8-bit address provides access to a register space of 256 32-bit registers. The complete register map is described in Table 17 on page 36.

Table 26 describes the signals that comprise the register interface.

ResetsTable 27 describes the reset signals. Each reset signal must be deasserted synchronously with the rising edge of its corresponding clock, and must be asserted at least one clock cycle.

Table 26. Register Interface Signals

Signal NameAvalon-MM Signal Type Direction Description

avalon_write write Input Register write enable.

avalon_read read Input Register read enable.

avalon_address[9:0] address Input 32-bit word-aligned register address.

avalon_writedata[31:0] writedata Input Register write data. Bit 0 is the least significant bit.

avalon_readdata[31:0] readdata Output Register read data. Bit 0 is the least significant bit.

avalon_waitrequest waitrequest Output Register interface busy. Asserted (set to 1) during register read or register write access. Set to 0 to indicate the completion of the current register access.

Table 27. Reset Signal

Signal Name Direction Description

reset_n Input Global asynchronous reset.

This reset signal must be asserted at least one sys_clk cycle, and must be deasserted synchronously with the rising edge of sys_clk. For the Soft XAUI only reference design, refer to Table 31 on page 54.

avalon_reset_n Input Avalon-MM interface reset.

This reset signal must be asserted at least one avalon_clk cycle, and must be deasserted synchronously with the rising edge of avalon_clk.

avalon_st_reset_n Input Avalon-ST interface reset

This reset signal must be asserted at least one avalon_st_clk cycle, and must be deasserted synchronously with the rising edge of avalon_st_clk.

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 53: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Functional Description Page 53

PHY Interface SignalsTable 28 shows the XGMII signals.

Table 29 describes the XAUI signals.

Table 30 shows the reference design signals if you select MAC only in the MegaWizard interface.

When you select Soft XAUI only or MAC + Soft XAUI the design instantiates a transceiver megafunction with the required settings. After you generate the 10-Gbps Ethernet reference design, you can find the instantiated transceiver megafunction in the file serdes_4_unit_siv.v. You can use the MegaWizard Plug-In Manager to edit this existing ALTGX megafunction and customize the transceiver, if necessary for your design.

f For more information about the ALTGX megafunction signals, refer to the ALTGX Transceiver Setup Guide chapter in volume 3 of the Stratix IV Device Handbook.

Table 28. XGMII Signals

Name Direction Description

xgmii_rx_clk Input 156.25-MHz input clock for the data.

xgmii_rx_data[31:0] Input Data input.

xgmii_rx_ctrl[3:0] Input Control input alongside data.

xgmii_tx_clk Output 156.25-MHz clock output for the data (using both edges).

xgmii_tx_data[31:0] Output Data output.

xgmii_tx_ctrl[3:0] Output Control output alongside data.

Table 29. XAUI Signals

Name Direction Description

xaui_rx_data[3:0] Input Data input at 3.125-Gbps per lane.

xaui_tx_data[3:0] Output Data output at 3.125-Gbps per lane.

cal_blk_clk Input Calibration clock for the SERDES. Maximum frequency depends on device, but usually under 50 MHz.

serdes_sysclk Output Clock derived from the PLL of the SERDES.

Table 30. MAC Only Signals

Name Direction Description

rx_data[63:0] Input Data input.

rx_ctrl[7:0] Input Control input alongside data.

tx_data[63:0] Input Data output.

tx_ctrl[7:0] Input Control output alongside data.

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 54: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 54 Functional Description

Table 31 describes the Soft XAUI only non-ECC signals.

Table 31. Soft XAUI Only Non-ECC Signals (Part 1 of 2)

Name Width (Bits) Direction Description

reset_n 1 Input The global reset. This reset signal is active low. The Soft XAUI only reference design synchronizes this reset signal internally to pll_inclk.

cal_blk_clk 1 Input The transceiver’s on-chip termination resisters are calibrated by a single calibration block. This circuitry requires a calibration clock. The frequency range of cal_blk_clk is 10–125 MHz.

reconfig_clk 1 Input Reference clock for the dynamic reconfiguration controller.

gxb_powerdown 1 Input Transceiver quad reset and power down. This signal resets and powers down all circuits in the transceiver block. All the gxb_powerdown input signals of MegaCore functions and reference designs intended to be placed in the same quad should be tied together. The gxb_powerdown should be tied low or should remain asserted for at least 2 ms whenever it is asserted.

pll_inclk 1 Input Clock connection for the transmitter PLL.

rx_datain 4 Input Data input bus to the receiver.

tx_ctrlenable 8 Input Eight-bit control word indicator. A bit with value 1 indicates that the corresponding byte on the tx_datain bus is a control word.

tx_datain 64 Input Data input bus to the transmitter. The data on this bus is in little endian format.

reconfig_togxb 3 Input Driven from an external dynamic reconfiguration block. Supports the selection of multiple transceiver channels for dynamic reconfiguration. This signal supports the following one-hot encoded values:

Value Description

0 Serial data input

1 Switch signal for the quad

2 Serial shift load input for the quad

coreclkout 1 Output Clock output from CMU clock divider. Clocks the tx_datain and rx_dataout buses.

pll_locked 1 Output Indicates that the CMU or ATX PLL is locked to pll_inclk.

rx_channelaligned 1 Output Indicates deskew alignment status.

rx_ctrldetect 8 Output Transceiver 8b10b decoder detection control code.

rx_dataout 64 Output Recovered data, which streams from receiver transceiver to 10-Gbps Ethernet reference design as parallel data. The data on this bus is in little endian format.

rx_disperr 8 Output Transceiver 8b10b decoder disparity code.

rx_errdetect 8 Output Transceiver 8b10b code group violation signal bus. For details, refer to the serial transceivers section of the relevant Altera device handbook.

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 55: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Functional Description Page 55

Table 32 describes the Soft XAUI only ECC testing signals. These signals, in addition to the ECC output signals in Table 37 on page 58, are implemented if you turn on ECC Protected RAMs in the MegaWizard interface.

Local Interface SignalsIn the wizard, you can turn on Include Avalon-ST FIFO buffer for the local interface. Both interfaces (with or without FIFO buffer) offer Avalon-ST interfaces.

The optional FIFO buffer provides more flexibility. It is 64-bits wide (plus any bits used for control but less than 72 bits). You can also specify the FIFO size.

rx_freqlocked 4 Output Indicates that the receiver transceiver PLL is locked to the receiver data.

rx_pll_locked 4 Output Indicates that the receiver transceiver PLL is locked to the reference clock.

rx_syncstatus 8 Output Output status from pattern detector, including word alignment indication.

tx_dataout 4 Output Serial data output bus from the transmitter.

pma_stat_rst_done 1 Output Indicates reset of the transceivers is complete,

reconfig_fromgxb 68 Output Driven to an external dynamic reconfiguration block. The bus identifies the transceiver channel whose settings are being transmitted to the dynamic reconfiguration block.

Table 31. Soft XAUI Only Non-ECC Signals (Part 2 of 2)

Name Width (Bits) Direction Description

Table 32. Soft XAUI Only ECC Testing SIgnals

Signal NameWidth (Bits) Direction Description

ecc_clk 1 Input Clock for all ECC input and output signals.

ecc_reset_n 1 Input Reset signal for the ECC ports.

This reset signal must be asserted at least one ecc_clk cycle, and must be deasserted synchronously with the rising edge of ecc_clk.

ecc_error_mask_xaui_rate_ecc0

72 Input Error mask for data+ECC bits of rate-matching FIFO.

ecc_error_mask_xaui_rate_ecc1

24 Input Error mask for control+ECC bits of rate-matching FIFO.

ecc_error_mask_xaui_deskew_lane0

28 Input Error mask for deskew FIFO lane 0.

ecc_error_mask_xaui_deskew_lane1

28 Input Error mask for deskew FIFO lane 1.

ecc_error_mask_xaui_deskew_lane2

28 Input Error mask for deskew FIFO lane 2.

ecc_error_mask_xaui_deskew_lane3

28 Input Error mask for deskew FIFO lane 3.

ecc_insert_error_xaui 6 Input Error insertion requests. For bit correspondences, refer to Table 49 on page 63.

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 56: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 56 Functional Description

The local interface is implemented as two Avalon Streaming (Avalon-ST) ports. An Avalon-ST source port provides an interface to the receive FIFO; an Avalon-ST sink port provides an interface to the transmit FIFO. There are a few additional signals that are not associated with either Avalon-ST port.

f For more information about the Avalon-ST interface protocol, refer to the Avalon Interface Specifications.

When instantiating the reference design, the Avalon-ST signals appear at the top-level of the variant HDL file, and you must manually connect them.

Table 33 lists the local interface signals (without FIFO buffer).

Table 33. Local Interface Signals (without FIFO Buffer)

Signal Name Direction Avalon-ST Type Description

user_rx_data[63:0] Output data Receive data.

user_rx_data_valid Output valid Receive data valid. Asserted (set to 1) by the reference design to indicate that data is valid on user_rx_data, user_rx_sop, user_rx_eop, and user_rx_error.

user_rx_sop Output startofpacket Receive SOP. Set to 1 when the first byte or word of a frame is driven on user_rx_data.

user_rx_eop Output endofpacket Receive EOP. Set to 1 when the last byte or word of frame data is driven on user_rx_data.

user_rx_error Output error Receive error. Asserted with the final byte in the frame to indicate that an error was detected when receiving the frame.

user_rx_mty[2:0] Output empty Indicates non-valid bytes in cycle containing EOP.

user_rx_vlan_tag Output export Indicates that the packet contains a VLAN tag. The signal is active during SOP.

user_tx_data[63:0] Input data Transmit data.

user_tx_data_valid Input valid Transmit data write enable. Asserted by the transmit application to write data to the FIFO buffer. Indicates that user_tx_data, user_tx_sop, user_tx_eop are valid.

user_tx_sop Input startofpacket Transmit SOP. Set to 1 when the first byte in the frame (the first byte of the destination address) is driven on user_tx_data.

user_tx_eop Input endofpacket Transmit EOP. Set to 1 when the last byte in the frame (the last byte of the FCS field) is driven on user_tx_data.

user_tx_error Input error Transmit frame error. Asserted with the final byte in the frame to indicate that the transmitted frame is invalid. When user_tx_error is asserted, the frame is transmitted to the XGMII with an error.

user_tx_mty[2:0] Input empty Indicates non-valid bytes in cycle containing EOP.

user_tx_read Output ready Ready. Asserted by the reference design to indicate that it is ready to accept data from the user application.

user_tx_dav Input export Data available—a threshold or EOP is present.

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 57: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Functional Description Page 57

Table 34 lists all the local interface signals (with a FIFO buffer).

MDIO SignalsTable 35 lists the MDIO signals.

Table 34. Local Interface Signals (with FIFO Buffer)

Signal Name Direction Avalon-ST Type Description

avl_st_rx_dat[63:0] Output data Receive data.

avl_st_rx_dav Output export Read data available. Indicates FIFO threshold is reached.

avl_st_rx_ena Input ready User ready. Asserted by the user to indicate that you are ready to accept data from the reference design.

avl_st_rx_sop Output startofpacket Receive SOP. Set to 1 when the first byte or word of a frame is driven on avl_st_rx_dat.

avl_st_rx_eop Output endofpacket Receive EOP. Set to 1 when the last byte or word of frame data is driven on avl_st_rx_dat.

avl_st_rx_err Output error Indicates frame error.

For more information about errors, refer to “Errors” on page 25.

avl_st_rx_mty[2:0] Output empty Indicates non-valid bytes in cycle containing EOP.

avl_st_rx_val Output valid Data and SOP and EOP are valid.

avl_st_rx_vlan_tag Output export Indicates that the packet contains a VLAN tag. The signal is active during SOP.

avl_st_rx_vlan_vlan_tag

Output export Indicates that the packet contains a stacked VLAN tag. The signal is active during SOP.

avl_st_tx_dat[63:0] Input data Transmit data.

avl_st_tx_dav Output ready Indicates space in FIFO in transmitter.

avl_st_tx_ena Input valid Transmit data write enable. Asserted by the transmit application to write data to the FIFO buffer. Indicates that avl_st_tx_dat, avl_st_tx_sop, avl_st_tx_eop are valid.

avl_st_tx_sop Input startofpacket Transmit SOP. Set to 1 when the first byte in the frame (the first byte of the destination address) is driven on avl_st_tx_dat.

avl_st_tx_eop Input endofpacket Transmit EOP. Set to 1 when the last byte in the frame (the last byte of the FCS field) is driven on avl_st_tx_dat.

avl_st_tx_err Input error Transmit frame error. Asserted with the final byte in the frame to indicate that the transmitted frame is invalid. When avl_st_tx_err is asserted, the frame is transmitted to the XGMII with an error.

avl_st_tx_mty[2:0] Input empty Indicates non-valid bytes in cycle containing EOP.

Table 35. MDIO Signals (Part 1 of 2)

Signal Name Direction Description

phy_mdio_in Input Management data input.

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 58: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 58 Functional Description

Flow Control SignalsTable 36 lists the flow control signals.

ECC SignalsTable 37 lists the ECC signals. If you turn on ECC Protected RAMs in the MegaWizard interface, these signals are provided by the 10-Gbps Ethernet reference design. In addition, if you turn on Soft XAUI only, the reference design implements the signals described in Table 32 on page 55.

phy_mdio_out Output Management data output.

phy_mdio_oen Output Management data active low output enable.

Table 36. Flow Control Signals

Signal Name Direction Description

xoff_request Input Requests XOFF pause frame. Clocked on sysclk and must have a one cycle pulse to trigger.

The pause is put after the current packet if a packet is being transmitted.

xon_request Input Requests XON pause frame. Clocked on sysclk and must have a one cycle pulse to trigger.

The pause is put after the current packet if a packet is being transmitted.

Table 35. MDIO Signals (Part 2 of 2)

Signal Name Direction Description

Table 37. ECC Signals

Signal NameWidth (Bits) Direction Description

ecc_sbe Output Single-bit error detected and corrected. The signal is an aggregate of the single-bit error indications from the receive and transmit FIFOs and from the Soft XAUI FIFOs. ECC errors that involve more than two bits in the same FIFO lead to unpredictable results, which might include incorrect assertion of this signal. The signal is asserted for a single Avalon-MM clock cycle.

ecc_mbe Output Multiple-bit error detected.The signal is an aggregate of the multiple-bit error indications from the receive and transmit FIFOs and from the Soft XAUI FIFOs. The 10-Gbps Ethernet reference design ECC detects but cannot correct two-bit errors. ECC errors that involve more than two bits in the same FIFO lead to unpredictable results, which might include assertion of this signal. The signal is asserted for a single Avalon-MM clock cycle.

ecc_packet_dropped Output Indicates a packet is dropped from the receive or transmit FIFO as a result of an ECC-detected multiple-bit error that includes the absence of a valid SOP or EOP indication. The signal is asserted for a single Avalon-MM clock cycle.

In Soft XAUI only mode, this signal maintains the value 0.

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 59: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Software Programming Interface Page 59

Software Programming InterfaceThis section describes the software programming interface.

ConstantsTable 38 shows all constants defined for MAC register manipulation.

Table 38. Constants Mapping

Constant Value Description

ALT_ETH_10G_CMD_TX_ENA_OFST 0 Configures the TX_ENA bit.

ALT_ETH_10G_CMD_TX_ENA_MSK 0x1

ALT_ETH_10G_CMD_RX_ENA_OFST 1 Configures the RX_ENA bit.

ALT_ETH_10G_CMD_RX_ENA_MSK 0x2

ALT_ETH_10G_CMD_XON_GEN_OFST 2 Configures the XON_GEN bit.

ALT_ETH_10G_CMD_XON_GEN_MSK 0x4

ALT_ETH_10G_CMD_PROMIS_EN_OFST 4 Configures the PROMIS_EN bit.

ALT_ETH_10G_CMD_PROMIS_EN_MSK 0x10

ALT_ETH_10G_CMD_PAD_EN_OFST 5 Configures the PAD_EN bit.

ALT_ETH_10G_CMD_PAD_EN_MSK 0x20

ALT_ETH_10G_CMD_CRC_FWD_OFST 6 Configures the CRC_FWD bit.

ALT_ETH_10G_CMD_CRC_FWD_MSK 0x40

ALT_ETH_10G_CMD_PAUSE_FWD_OFST 7 Configures the PAUSE_FWD bit.

ALT_ETH_10G_CMD_PAUSE_FWD_MSK 0x80

ALT_ETH_10G_CMD_PAUSE_IGNORE_OFST 8 Configures the PAUSE_IGNORE bit.

ALT_ETH_10G_CMD_PAUSE_IGNORE_MSK 0x100

ALT_ETH_10G_CMD_TX_ADDR_INS_OFST 9 Configures the TX_ADDR_INS bit.

ALT_ETH_10G_CMD_TX_ADDR_INS_MSK 0x200

ALT_ETH_10G_CMD_SW_RESET_OFST 13 Configures the SW_RESET bit.

ALT_ETH_10G_CMD_SW_RESET_MSK 0x2000

ALT_ETH_10G_CMD_LOOP_ENA_OFST 15 Configures the LOOP_ENA bit.

ALT_ETH_10G_CMD_LOOP_ENA_MSK 0x8000

ALT_ETH_10G_CMD_XOFF_GEN_OFST 22 Configures the XOFF_GEN bit.

ALT_ETH_10G_CMD_XOFF_GEN_MSK 0x400000

ALT_ETH_10G_CMD_CNTL_FRM_ENA_OFST 23 Configures the CNTL_FRM_ENA bit.

ALT_ETH_10G_CMD_CNTL_FRM_ENA_MSK 0x800000

ALT_ETH_10G_CMD_NO_LGTH_CHECK_OFST 24 Configures the NO_LGTH_CHECK bit.

ALT_ETH_10G_CMD_NO_LGTH_CHECK_MSK 0x1000000

ALT_ETH_10G_CMD_FIFO_ERR_DISC_OFST 26 Configures the FIFO_ERR_DISC bit.

ALT_ETH_10G_CMD_FIFO_ERR_DISC_MSK 0x4000000

ALT_ETH_10G_CMD_LINE_LOOP_ENA_OFST 27 Configures the LINE_LOOP_ENA bit.

ALT_ETH_10G_CMD_LINE_LOOP_ENA_MSK 0x8000000

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 60: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 60 Software Programming Interface

64-Bit Statistics CountersTo access a 64-bit wide statistics counter (see Table 18 on page 38), follow these steps:

1. Read the lower 32 bits. It caches the upper 32 bits.

2. When reading the upper 32 bits, it reads the cached value.

If you perform a read access to an address other than the upper 32 bits after reading the lower part, the cached value may be lost.

To read a 64-bit register, read the lower part, immediately followed by the upper part.

If an upper 64-bit register is read without accessing the lower 32 bits first, the stored value is given (not the cached value).

ECC Monitoring and TestingThe 10-Gbps Ethernet reference design provides ECC management registers to support ECC monitoring and testing by error injection. Single-event memory upsets are infrequent, and extremely unlikely to occur during testing without error injection. The ECC management registers support software testing of the optional ECC feature, and also provide cumulative statistics counters for ECC-detected errors.

The following sections describe the ECC management registers and how the reference design implements ECC testing based on the values in these registers.

ECC Management RegistersIf you turn on ECC Protected RAMs in the MegaWizard interface, and the MAC is instantiated, the ECC testing registers and ECC statistics counters are implemented in the 10-Gbps Ethernet reference design. Because the ECC management registers are available only if the MAC is instantiated, they are not available in Soft XAUI only mode. However, in Soft XAUI only mode, special input signals allow software to specify Soft XAUI error injection to the reference design. Therefore, in this case you can test the ECC feature, even though the reference design does not maintain ECC testing registers or cumulative statistics information.

The ECC statistics counters are cleared upon read (RC). Their implementation is based on an assumption that single-event upsets are rare. The statistics registers might not provide an accurate count if two errors occur less than 10 clock cycles apart, or if two different blocks attempt to increment a register simultaneously.

ALT_ETH_10G_CMD_BROAD_FILTER_ENA_OFST 28 Configures the BROAD_FILTER_ENA bit.

ALT_ETH_10G_CMD_BROAD_FILTER_ENA_MSK 0x10000000

ALT_ETH_10G_CMD_INS_CRC_ERROR_OFST 29 Configures the INS_CRC_ERROR bit.

ALT_ETH_10G_CMD_INS_CRC_ERROR_MSK 0x20000000

ALT_ETH_10G_CMD_NO_FIFO_PAUSE_OFST 30 Configures the NO_FIFO_PAUSE bit.

ALT_ETH_10G_CMD_NO_FIFO_PAUSE_MSK 0x40000000

ALT_ETH_10G_CMD_CNT_RESET_OFST 31 Configures the CNT_RESET bit.

ALT_ETH_10G_CMD_CNT_RESET_MSK 0x80000000

Table 38. Constants Mapping

Constant Value Description

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 61: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Software Programming Interface Page 61

Table 39 provides a memory map for the ECC management registers. Table 40 through Table 57 describe the registers that support software testing of the ECC feature, and Table 58 through Table 67 describe the ECC statistics counters.

Table 39. ECC Management Registers Memory Map

Address Name Expanded Name

0x350 Reserved

0x354 ECC_FIFO_INS FIFO Errors Insert

0x358 ERR_FIFO_TX_DATA_ECC_0 Tx FIFO Data Errors Word 0

0x35C ERR_FIFO_TX_DATA_ECC_1 Tx FIFO Data Errors Word 1

0x360 ERR_FIFO_TX_DATA_ECC_2 Tx FIFO Data Errors Word 2

0x364 ERR_FIFO_TX_CTRL_ECC Tx FIFO Control Errors

0x368 ERR_FIFO_RX_DATA_ECC_0 Rx FIFO Data Errors Word 0

0x36C ERR_FIFO_RX_DATA_ECC_1 Rx FIFO Data Errors Word 1

0x370 ERR_FIFO_RX_DATA_ECC_2 Rx FIFO Data Errors Word 2

0x374 ERR_FIFO_RX_CTRL_ECC Rx FIFO Control Errors

0x378 Reserved

0x37C ECC_XAUI_INS Soft XAUI PCS Errors Insert

0x380 ERR_XAUI_DESKEW_CHAN0 XAUI Errors Deskew Lane 0

0x384 ERR_XAUI_DESKEW_CHAN1 XAUI Errors Deskew Lane 1

0x388 ERR_XAUI_DESKEW_CHAN2 XAUI Errors Deskew Lane 2

0x38C ERR_XAUI_DESKEW_CHAN3 XAUI Errors Deskew Lane 3

0x390 ERR_XAUI_RATE_DATA_ECC_0 XAUI Rate FIFO Data Errors Word 0

0x394 ERR_XAUI_RATE_DATA_ECC_1 XAUI Rate FIFO Data Errors Word 1

0x398 ERR_XAUI_RATE_DATA_ECC_2 XAUI Rate FIFO Data Errors Word 2

0x39C ERR_XAUI_RATE_CTRL_ECC XAUI Rate FIFO Control Errors

0x3A0–0x3FC Reserved

0x400 ECC_COUNT_FIFO_TX_SBE Recovered Tx FIFO ECC Errors

0x404 ECC_COUNT_FIFO_TX_MBE Fatal Tx FIFO ECC Errors

0x408 ECC_COUNT_FIFO_RX_SBE Recovered Rx FIFO ECC Errors

0x40C ECC_COUNT_FIFO_RX_MBE Fatal Rx FIFO ECC Errors

0x410 ECC_COUNT_XAUI_SBE Recovered XAUI ECC Errors

0x414 ECC_COUNT_XAUI_MBE Fatal XAUI ECC Errors

0x418 ECC_COUNT_TOTAL_SBE Total Recovered ECC Errors

0x41C ECC_COUNT_TOTAL_MBE Total Fatal ECC Errors

0x420 FIFO_TX_DROP_COUNT Tx FIFO ECC Packets Dropped

0x424 FIFO_RX_DROP_COUNT Rx FIFO ECC Packets Dropped

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 62: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 62 Software Programming Interface

Table 40. ECC_FIFO_INS—FIFO Errors Insert—Offset: 0x354

Bits Access Function HW Reset Value

[31:4] RW Reserved. 0x0

[3] Insert Rx control error. Clears after the error is inserted. 0

[2] Insert Rx datapath error. Clears after the error is inserted. 0

[1] Insert Tx control error. Clears after the error is inserted. 0

[0] Insert Tx datapath error. Clears after the error is inserted. 0

Table 41. ERR_FIFO_TX_DATA_ECC_0—Tx FIFO Data Errors Word 0—Offset: 0x358

Bits Access Function HW Reset Value

[31:0] RW Errors inserted in bits [31:0] of the Tx FIFO data+ECC. For each bit position, the value 1 indicates an error is inserted, and the value 0 indicates no error is inserted.

0x0

Table 42. ERR_FIFO_TX_DATA_ECC_1—Tx FIFO Data Errors Word 1—Offset: 0x35C

Bits Access Function HW Reset Value

[31:0] RW Errors inserted in bits [63:32] of the Tx FIFO data+ECC. For each bit position, the value 1 indicates an error is inserted, and the value 0 indicates no error is inserted.

0x0

Table 43. ERR_FIFO_TX_DATA_ECC_2—Tx FIFO Data Errors Word 2—Offset: 0x360

Bits Access Function HW Reset Value

[31:8] RW Reserved. 0x0

[7:0] Errors inserted in bits [71:64] of the Tx FIFO data+ECC. For each bit position, the value 1 indicates an error is inserted, and the value 0 indicates no error is inserted.

0x0

Table 44. ERR_FIFO_TX_CTRL_ECC—Tx FIFO Control Errors—Offset: 0x364

Bits Access Function HW Reset Value

[31:13] RW Reserved. 0x0

[12:0] Errors inserted in the 13-bit Tx FIFO control+ECC. For each bit position, the value 1 indicates an error is inserted, and the value 0 indicates no error is inserted.

0x0

Table 45. ERR_FIFO_RX_DATA_ECC_0—Rx FIFO Data Errors Word 0—Offset: 0x368

Bits Access Function HW Reset Value

[31:0] RW Errors inserted in bits [31:0] of the Rx FIFO data+ECC. For each bit position, the value 1 indicates an error is inserted, and the value 0 indicates no error is inserted.

0x0

Table 46. ERR_FIFO_RX_DATA_ECC_1—Rx FIFO Data Errors Word 1—Offset: 0x36C

Bits Access Function HW Reset Value

[31:0] RW Errors inserted in bits [63:32] of the Rx FIFO data+ECC. For each bit position, the value 1 indicates an error is inserted, and the value 0 indicates no error is inserted.

0x0

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 63: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Software Programming Interface Page 63

Table 47. ERR_FIFO_RX_DATA_ECC_2—Rx FIFO Data Errors Word 2—Offset: 0x370

Bits Access Function HW Reset Value

[31:8] RW Reserved. 0x0

[7:0] Errors inserted in bits [71:64] of the Rx FIFO data+ECC. For each bit position, the value 1 indicates an error is inserted, and the value 0 indicates no error is inserted.

0x0

Table 48. ERR_FIFO_RX_CTRL_ECC—Rx FIFO Control Errors—Offset: 0x374

Bits Access Function HW Reset Value

[31:13] RW Reserved. 0x0

[12:0] Errors inserted in the 13-bit Rx FIFO control+ECC. For each bit position, the value 1 indicates an error is inserted, and the value 0 indicates no error is inserted.

0x0

Table 49. ECC_XAUI_INS—Soft XAUI PCS Errors Insert—Offset: 0x37C

Bits Access Function HW Reset Value

[31:6] RW Reserved. 0x0

[5] Insert rate-matching control error. Clears after the error is inserted. 0

[4] Insert rate-matching datapath error. Clears after the error is inserted. 0

[3] Insert deskew channel 3 error. Clears after the error is inserted. 0

[2] Insert deskew channel 2 error. Clears after the error is inserted. 0

[1] Insert deskew channel 1 error. Clears after the error is inserted. 0

[0] Insert deskew channel 0 error. Clears after the error is inserted. 0

Table 50. ERR_XAUI_DESKEW_CHAN0—XAUI Errors Deskew Lane 0—Offset: 0x380

Bits Access Function HW Reset Value

[31:28] RW Reserved. 0x0

[27:0] Errors inserted in bits [27:0] of the deskew lane 0 data+ECC. For each bit position, the value 1 indicates an error is inserted, and the value 0 indicates no error is inserted.

0x0

Table 51. ERR_XAUI_DESKEW_CHAN1—XAUI Errors Deskew Lane 1—Offset: 0x384

Bits Access Function HW Reset Value

[31:28] RW Reserved. 0x0

[31:0] Errors inserted in bits [27:0] of the deskew lane 1 data+ECC. For each bit position, the value 1 indicates an error is inserted, and the value 0 indicates no error is inserted.

0x0

Table 52. ERR_XAUI_DESKEW_CHAN2—XAUI Errors Deskew Lane 2—Offset: 0x388

Bits Access Function HW Reset Value

[31:28] RW Reserved. 0x0

[31:0] Errors inserted in bits [27:0] of the deskew lane 2 data+ECC. For each bit position, the value 1 indicates an error is inserted, and the value 0 indicates no error is inserted.

0x0

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 64: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 64 Software Programming Interface

Table 53. ERR_XAUI_DESKEW_CHAN3—XAUI Errors Deskew Lane 3—Offset: 0x38C

Bits Access Function HW Reset Value

[31:28] RW Reserved. 0x0

[31:0] Errors inserted in bits [27:0] of the deskew lane 3 data+ECC. For each bit position, the value 1 indicates an error is inserted, and the value 0 indicates no error is inserted.

0x0

Table 54. ERR_XAUI_RATE_DATA_ECC_0—XAUI Rate FIFO Data Errors Word 0—Offset: 0x390

Bits Access Function HW Reset Value

[31:0] RW Errors inserted in bits [31:0] of the rate-matching FIFO data+ECC. For each bit position, the value 1 indicates an error is inserted, and the value 0 indicates no error is inserted.

0x0

Table 55. ERR_XAUI_RATE_DATA_ECC_1—XAUI Rate FIFO Data Errors Word 1—Offset: 0x394

Bits Access Function HW Reset Value

[31:0] RW Errors inserted in bits [63:32] of the rate-matching FIFO data+ECC. For each bit position, the value 1 indicates an error is inserted, and the value 0 indicates no error is inserted.

0x0

Table 56. ERR_XAUI_RATE_DATA_ECC_2—XAUI Rate FIFO Data Errors Word 2—Offset: 0x398

Bits Access Function HW Reset Value

[31:8] RW Reserved 0x0

[7:0] RW Errors inserted in bits [71:64] of the rate-matching FIFO data+ECC. For each bit position, the value 1 indicates an error is inserted, and the value 0 indicates no error is inserted.

0x0

Table 57. ERR_XAUI_RATE_CTRL_ECC—XAUI Rate FIFO Control Errors—Offset: 0x39C

Bits Access Function HW Reset Value

[31:24] RW Reserved 0x0

[23:0] RW Errors inserted in the 24-bit rate-matching FIFO control+ECC. For each bit position, the value 1 indicates an error is inserted, and the value 0 indicates no error is inserted.

0x0

Table 58. ECC_COUNT_FIFO_TX_SBE—Recovered Tx FIFO ECC Errors—Offset: 0x400

Bits Access Function HW Reset Value

[31:8] RC Reserved 0x0

[7:0] Number of single-bit errors detected and corrected in Tx FIFO. This register saturates at the value 255; after it reaches 255, it maintains this value until read. Reading this register resets it automatically.

0x0

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 65: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Software Programming Interface Page 65

Table 59. ECC_COUNT_FIFO_TX_MBE—Fatal Tx FIFO ECC Errors—Offset: 0x404

Bits Access Function HW Reset Value

[31:8] RC Reserved 0x0

[7:0] Number of multiple-bit errors detected in Tx FIFO. These errors are not corrected. This register saturates at the value 255; after it reaches 255, it maintains this value until read. Reading this register resets it automatically.

0x0

Table 60. ECC_COUNT_FIFO_RX_SBE—Recovered Rx FIFO ECC Errors—Offset: 0x408

Bits Access Function HW Reset Value

[31:8] RC Reserved 0x0

[7:0] Number of single-bit errors detected and corrected in Rx FIFO. This register saturates at the value 255; after it reaches 255, it maintains this value until read. Reading this register resets it automatically.

0x0

Table 61. ECC_COUNT_FIFO_RX_MBE—Fatal Rx FIFO ECC Errors—Offset: 0x40C

Bits Access Function HW Reset Value

[31:8] RC Reserved 0x0

[7:0] Number of multiple-bit errors detected in Rx FIFO. These errors are not corrected. This register saturates at the value 255; after it reaches 255, it maintains this value until read. Reading this register resets it automatically.

0x0

Table 62. ECC_COUNT_XAUI_SBE—Recovered XAUI ECC Errors—Offset: 0x410

Bits Access Function HW Reset Value

[31:8] RC Reserved 0x0

[7:0] Number of single-bit errors detected and corrected in Soft XAUI PCS. This register saturates at the value 255; after it reaches 255, it maintains this value until read. Reading this register resets it automatically.

0x0

Table 63. ECC_COUNT_XAUI_MBE—Fatal XAUI ECC Errors—Offset: 0x414

Bits Access Function HW Reset Value

[31:8] RC Reserved 0x0

[7:0] Number of multiple-bit errors detected in Soft XAUI PCS. These errors are not corrected. This register saturates at the value 255; after it reaches 255, it maintains this value until read. Reading this register resets it automatically.

0x0

Table 64. ECC_COUNT_TOTAL_SBE—Total Recovered ECC Errors—Offset: 0x418

Bits Access Function HW Reset Value

[31:8] RC Reserved 0x0

[7:0] Total number of single-bit errors detected and corrected. This register saturates at the value 255; after it reaches 255, it maintains this value until read. Reading this register resets it automatically.

0x0

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 66: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 66 Software Programming Interface

ECC TestingThis section describes how to test the ECC feature. This section assumes the following definitions:

■ Error mask registers—All the ECC management registers except for the ECC_FIFO_INS and ECC_XAUI_INS and statistics registers.

■ Error insertion registers—The ECC_FIFO_INS and ECC_XAUI_INS registers.

To test the ECC feature in your 10-Gbps Ethernet reference design, perform the following steps:

1. Reset the ECC management registers. All registers reset to the value 0.

2. Write values to the error mask registers to indicate the bit errors you wish to insert.

3. Set the appropriate bits in the error insertion registers.

4. Run a test sequence that includes sending a packet. For example, you can run the code in the testbench provided with the 10-Gbps reference design, described in “Testbench”. To run the default testbench with ECC, you must update its address space from 10 to 11 bits, by updating the relevant tasks, such as demo_config_eth10gb.write_avalon and demo_config_eth10gb.read_avalon, to use an 11-bit address argument.

5. Monitor the ecc_sbe, ecc_mbe, and ecc_packet_dropped signals to ensure the reference design detected the inserted errors correctly.

6. Repeat steps 2 to 5 until you are satisfied you have verified the ECC implementation.

Table 65. ECC_COUNT_TOTAL_MBE—Total Fatal ECC Errors—Offset: 0x41C

Bits Access Function HW Reset Value

[31:8] RC Reserved 0x0

[7:0] Total number of multiple-bit errors detected. These errors are not corrected. This register saturates at the value 255; after it reaches 255, it maintains this value until read. Reading this register resets it automatically.

0x0

Table 66. FIFO_TX_DROP_COUNT—Tx FIFO ECC Packets Dropped—Offset: 0x420

Bits Access Function HW Reset Value

[31:8] RC Reserved 0x0

[7:0] Number of ECC-detected packets dropped from Tx FIFO. This register saturates at the value 255; after it reaches 255, it maintains this value until read. Reading this register resets it automatically.

0x0

Table 67. FIFO_RX_DROP_COUNT—Rx FIFO ECC Packets Dropped—Offset: 0x424

Bits Access Function HW Reset Value

[31:8] RC Reserved 0x0

[7:0] Number of ECC-detected packets dropped from Rx FIFO. This register saturates at the value 255; after it reaches 255, it maintains this value until read. Reading this register resets it automatically.

0x0

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 67: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Testbench Page 67

When you enable the insertion of a bit error by performing steps 2 and 3 in the preceding instructions, the reference design implements error insertion differently for the receive and transmit FIFOs than for the Soft XAUI PCS FIFOs. In the case of the receive and transmit FIFOs, if you enable insertion during an idle cycle, the reference design inserts the error on the first cycle of the next packet written to the FIFO. In the case of the Soft XAUI PCS FIFOs, because data is written to the FIFOs continuously, the reference design inserts errors when requested. In both cases, the error insertion bit clears within a few clock cycles after the error is inserted.

Inserting a bit error in a Soft XAUI PCS FIFO affects two or three columns, which could be in two different clock cycles.

The Soft XAUI PCS rate-matching FIFO might skip a write during rate compensation. In that case, a bit error is inserted in the following write. A bit error inserted during an idle cycle might cause the MAC to ignore the next packet or insert an error in the previous packet. The Soft XAUI PCS cannot signal a dropped packet using the ecc_packet_dropped signal.

For more information about the subsequent actions of the reference design, refer to “Memory ECC Errors” on page 26.

Testbench You can use the testbench provided with the 10-Gbps Ethernet reference design to exercise your reference design. The testbench includes the following features:

■ Easy-to-use simulation environment for any standard HDL simulator

■ Simulation of all basic Ethernet packet transactions

■ Open source Verilog HDL testbench files

f For more information about simulation, see “Simulate with Provided Testbench” on page 8.

Testbench ArchitectureThis section describes the testbench architecture for each 10-Gbps Ethernet reference design.

Figure 24 shows the 10-Gbps Ethernet testbench architecture.

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 68: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 68 Testbench

When you select the Soft XAUI only option in the MegaWizard interface, the testbench has a loopback on the Avalon-ST side. The traffic goes from the Ethernet generator to the reference design, via the direct loopback back to the reference design and to the Ethernet monitor.

OverviewThe testbench demonstrates and verifies the following functionality:

■ Transmit and receive datapaths are functionally correct.

■ Ethernet frames of valid length (greater than 64 bytes) received on the Avalon-ST transmit interface are sent out through the XGMII transmit interface with correct CRC-32 inserted by the reference design. Short frames are always padded by the reference design up to at least 64 bytes in length.

■ The CRC-32 is optionally discarded before forwarding the frames onto the Avalon-ST receive interface.

Default TestbenchThe default testbench:

■ Sets the command_config register to 0x80000203.

■ Configures the interframe gap to 12.

■ Simulates the receive and transmit datapaths independently.

■ Sends five Ethernet frames of payload length 100, 101, 102, 103 and 104 bytes to the Avalon-ST transmit interface and the XGMII (and XAUI) receive interface without errors.

■ Forwards all received frames that are not filtered based on the destination address of the received frames.

Figure 24. Testbench Architecture

Avalon-STEthernetFrame

Generator

10-GbpsEthernet

ReferenceDesign

MDIOSlave 1

TestbenchControl

Simulation Parameters

XGMIIEthernetFrame Monitor

Soft XAUI only

Avalon-STEthernetFrame Monitor

XGMIIEthernetFrame

Generator

MDIOSlave 0

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 69: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Testbench Page 69

1 The testbench works with a FIFO size of equal to or greater than 64 bytes.

Test FlowThe testbench performs the following operations upon a simulated power-on reset:

■ Initialize the reference design, which consists the following operations:

■ Set the operation mode via the command_config register.

■ Set the address via the mac_0 and mac_1 registers.

■ Set the IFG for transmit frames via the tx_ipg_length register.

■ Set the Avalon-ST FIFO threshold registers.

■ Set the supplemental unicast addresses.

■ Start transmission and clear receive and transmit FIFO.

Using the TestbenchThe testbench can send and check received frames. The testbench supports the following basic functions:

■ Generates valid Ethernet frames and checks their validity

■ Generates Ethernet frames with CRC errors

■ Generates frames on the Avalon-ST interface

■ Allows access to the register interface

■ Generates frames with vlan or stacked vlan tags

■ Allows MDIO reads and writes

The maximum supported frame size is 16 Kbytes.

The functions are similar in Verilog HDL and VHDL, but have slightly different names. Also the VHDL functions have more ports.

1 The procedures are VHDL; tasks are Verilog HDL.

The VHDL functions are part of the package in the eth_10g_rd_lib library. The Verilog HDL functions are called with the command (for example, demo_eth_gen.gen_crc_errored_frame).

Ethernet Frame Generationprocedure gen_valid_eth_frame (pkt_type, pkt_length, packet_number, current_idc, pkt_ifg, clk, eth_generated_data, eth_generated_ctrl) task demo_eth_gen.gen_valid_frame; (pkt_length, pkt_type, min_ipg)

where:

■ pkt_type is the two octet type or length

■ pkt_length is the physical size, which includes the payload only and must be greater than 4

■ packet_number is a 32-bit vector that you must define in the testbench

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 70: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 70 Testbench

■ current_idc is a two-bit vector deficit idle counter

■ pky_ifg: 16-bit vector packet interframe gap, which you must specify. The minimum value is 8 bytes

■ clk is the clock for the generation, which should be 156.25 MHz

■ eth_generated_data is a 32-bit vector DDR data signal sent to the MAC

■ eth_generated_ctrl is a four-bit DDR control signal sent to the MAC

procedure gen_crc_errored_eth_frame (pkt_type, pkt_length, packet_number, current_idc, pkt_ifg, clk, eth_generated_data, eth_generated_ctrl) task demo_eth_gen.gen_crc_errored_frame; (pkt_length, pkt_type, min_ipg)procedure gen_vlan_eth_frame (pkt_type, pkt_length, packet_number, current_idc, pkt_ifg, clk, eth_generated_data, eth_generated_ctrl) task demo_eth_gen.gen_vlan_frame; (pkt_length, pkt_type, min_ipg)procedure gen_vlan_vlan_eth_frame (pkt_type, pkt_length, packet_number, current_idc, pkt_ifg, clk, eth_generated_data, eth_generated_ctrl) task demo_eth_gen.gen_vlan_vlan_frame; (pkt_length, pkt_type, min_ipg)procedure gen_pause_eth_frame (pause_length, use_multicast, packet_number, current_idc, clk, eth_generated_data, eth_generated_ctrl) task demo_eth_gen.gen_pause_frame; (pause_length, use_multicast)

where:

■ pause_length is the 16-bit pause length, which is the length of the pause to transmit in 512-bit time units

■ use_multicast is 1 to use the pause multicast address; 0 to use the MAC unicast address

procedure gen_eth_idle (number_of_idle, clk, eth_generated_data, eth_generated_ctrl)

where:

■ number_of_idle is an integer number of idle bytes, which must be a multiple of 4

task demo_eth_gen.gen_idle; (number_of_idle)

where:

■ number_of_idle is the number of idle cycles sent

Avalon-ST Frame Generationprocedure gen_valid_avl_st_frame (pkt_type, pkt_length, packet_number, clk, avl_st_tx_dat, avl_st_tx_sop, avl_st_tx_eop, avl_st_tx_err, avl_st_tx_ena, avl_st_tx_dav, avl_st_tx_mty)

where:

■ pkt_type is the two octet type or length

■ pkt_length is the physical size, which includes the payload only and must be greater than 4.

■ packet_number is a 32-bit vector that you must define in the testbench

■ clk is the clock for the generation, which should be 156.25 MHz

■ avl_st_tx_*** are the Avalon-ST interface signals (see Table 34)

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 71: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Testbench Page 71

task demo_avl_st_gen.gen_valid_frame; (pkt_length, pkt_type, min_ipg)

where:

■ pkt_type is the data that you entered in the length and type field of the frame

■ pkt_length is the length of the payload in bytes

■ packet_number is a number on each packet that is incremented after it is sent

procedure gen_avl_st_idle (number_of_idle, clk, avl_st_tx_dat, avl_st_tx_sop, avl_st_tx_eop, avl_st_tx_err, avl_st_tx_ena, avl_st_tx_dav, avl_st_tx_mty)

where:

■ number_of_idle is in clock cycles

task demo_avl_st_gen.gen_idle; (idle_length)

Avalon-MM InterfaceThe following function writes to the configuration and MDIO interface:

procedure write_avalon (data_to_write, address_to_write, avalon_writedata, avalon_address, avalon_write, avalon_waitrequest, avalon_clk)task demo_config_eth10g.write_avalon; (data_to_write, address_to_write)

where:

■ data_to_write is the data to write

■ address_to_write is the address of the register to write to

■ avalon_*** are the Avalon-MM interface signals (see Table 26)

The following function reads to the configuration and MDIO interface:

procedure read_avalon (address_to_read, data_read, avalon_readdata, avalon_address, avalon_read, avalon_waitrequest, avalon_clk)task demo_config_eth10g.read_avalon; (address_to_read, data_read)

where:

■ address_to_read is the address of the register to read from

■ data_read is the data to read

The following function performs a write to an MDIO register:

procedure write_mdio (clause45, prtadr, devphyadr, regadr, data, avalon_writedata, avalon_address, avalon_write, avalon_waitrequest, avalon_clk)task demo_config_eth10g.write_mdio; (clause45, prtadr, devphyadr, regadr, data)

where:

■ clause45 is set to 1 if the MDIO is for clause 45; set to 0 if the MDIO is for clause 22

■ portadr is the port address (clause 45 only)

■ devphyadr is the device or PHY address (device in clause 45; PHY in clause 22)

■ regadr is the register address. 16 -bit address in clause 45; only the bottom 5-bits for clause 22

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 72: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 72 External Reconfiguration Block Example

The following function performs a read an MDIO register:

procedure read_mdio (clause45, prtadr, devphyadr, regadr, data_read, avalon_writedata, avalon_readdata, avalon_address, avalon_write, avalon_read, avalon_waitrequest, avalon_clk)taskdemo_config_eth10g.read_mdio; (clause45, prtadr, devphyadr, regadr, data_read)

Testbench ErrorsBy default, the testbench stops after it encounters the first error. You can change this setting by editing the value of tb.err_limit to a higher number.

External Reconfiguration Block ExampleThis section describes an example design where the 10-Gbps Ethernet MAC uses an external reconfiguration block. This example shows a way of connecting the blocks for a design targeting Arria II GX devices. The example design is in the eth_10g\reconfig_example directory.

1 The external reconfiguration block is optional when targeting Stratix II GX devices but mandatory when targeting Arria II GX or Stratix IV devices.

Figure 25 shows the example overview.

You can use this example in real hardware but you may need to map the Avalon MM interfaces to an internal bus structure as the number of pins required may be high.

The example includes an Altera-generated a 10-Gbps Ethernet reference design, mac_10g_example.v, and the following files:

■ demo_hookup.iv, which uses example_top.v and has two new Avalon-MM interfaces and does not have local Avalon-ST interfaces

■ demo_run_modelsim.tcl includes modifications to compile the new files

Figure 25. External Reconfiguration Block Example Overview

demo_hookup.iv

example_top.v

tb.v

10-GbpsEthernet MAC

Reference DesignLoopback

XAUI Transmit

XAUI Receive

External Reconfiguration

Block

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 73: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

External Reconfiguration Block Example Page 73

■ do_msim.do is the ModelSim script that runs the simulation

■ tb.v does not configure the MAC and only sends data on the receiver channel. The loopback function sends the packets sent on the receiver back on the transmitter.

Figure 26 shows the example block diagram.

The example has the following blocks:

■ Example top-level design (example_top.v)

■ Reference design (mac_10g_example.v)

■ MAC initialization (init_mac.v)

■ XAUI reconfiguration (xaui_reconfig.v)

■ Transceiver reconfiguration (gxb_reconfig_aiigx.v)

■ Transceiver initialization (init_gxb.v)

■ Loopback (loopback_module.v)

■ PLL (eth_pll.v)

Example Top-Level DesignThe top-level design file, which has the following interfaces:

■ XAUI for its data channel

■ Avalon-MM interface for the MAC. The clock for this interface is provided by the example top block

■ Avalon-MM for the XAUI reconfiguration block. The clock for this interface is provided by the example top. It is the same as the one for the Avalon MM for the MAC and must run at exactly 1/4 of the system clock.

■ Input clock, which is fed to a PLL

■ Reset signal

Figure 26. Example Block Diagram

10-GbpsEthernet MAC

10-Gbps Ethernet MAC Reference Design

Example Top-Level Design

InitializeMAC

XAUIMonitor

GeneratorFIFO

PLL

Loopback

Configurationand

Statistics

InitializeTransceiver

XAUI Reconfiguration

TransceiverReconfiguration

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 74: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 74 External Reconfiguration Block Example

Reference Design The 10-Gbps Ethernet reference design has the following main parameters:

■ XAUI with External reconfiguration block

■ FIFO support

MAC InitializationThe MAC initialization for the MAC registers waits a certain amount of time at startup, then configures various registers such as FIFO thresholds and the configuration register (by turning on the receiver and transmitter and setting the receiver to pass through). When the configuration finishes, the commands are then taken from the Avalon-MM interface.

XAUI ReconfigurationThe XAUI reconfiguration instantiates the transceiver reconfiguration block. This block converts Avalon-MM instructions into a format supported by the transceiver configuration module. In this design example, the clock relationship between the system clock and the reconfiguration clock is critical.

Transceiver ReconfigurationThe transceiver reconfiguration is an instantiation of the transceiver reconfiguration block. It has access to the relevant parameters to the XAUI interface. You can view the parameters by opening the the file with the MegaWizard Plug-In.

Transceiver InitializationSimilarly to the MAC initialization, the transceiver initialization first waits for the system to stabilize (reset the blocks). Then it writes then reads access to the reconfiguration block. When complete, the Avalon-MM interface can control the reconfiguration block. The read after configuration is important.

Table 68 shows the interface mapping.

Table 68. Interface Mapping (Part 1 of 2)

Address Access Bit Mapping

0x0 RW 0 Start operation.

1 0 perform read; 1 perform write.

0x4 RO 0 Busy.

0x8 RW 2:0 vodctrl to write.

8:4 Preamphasis to write.

19:16 Receiver equalizer to write.

25:24 DC gain to write.

29:28 Channel number to write.

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 75: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

External Reconfiguration Block Example Page 75

LoopbackThe loopback reads the data from the Avalon-ST receiver interface of the 10-Gbps Ethernet MAC reference design, replaces the source address with the destination addresses, and then forwards the data back to the transmitter channel. It expects a FIFO interface and does not work if the reference design has no FIFO.

PLLThe PLL generates all the clocks required for the example. It assumes that the input clock frequency is 100 MHz. The example has the following output clocks:

■ C0 is the Avalon-ST clock (for the loopback) running at 200 MHz

■ C1 is the Avalon-MM clock running at 80 MHz

■ C2 is the reconfiguration block running at 1/4 of the Avalon-MM clock at 20 MHz

Table 69 shows the example design’s signals.

0xC RO 2:0 vodctrl status.

8:4 Preamphasis status.

19:16 Receiver equalizer status.

25:24 DC gain status

Table 68. Interface Mapping (Part 2 of 2)

Address Access Bit Mapping

Table 69. Design Example Signals

Port Name Direction Size Avalon Type Description

reset_n Input 1 reset_n Reset signal.

inclk Input 1 export Main input for the example top, expected to run at 100 MHz.

serdes_refclock Input 1 export Clock that runs the MAC and SERDES, running at 156.25 MHz.

avlclk Output 1 export The clock that connects to the Avalon-MM interfaces.

avl_mm_mac_address Input 32 address MAC Avalon-MM address.

avl_mm_mac_write_n Input 1 write_n MAC Avalon-MM write.

avl_mm_mac_writedata Input 32 writedata MAC Avalon-MM write data.

avl_mm_mac_read_n Input 1 read_n MAC Avalon-MM read.

avl_mm_mac_readdata Output 32 readdata MAC Avalon-MM read data.

avl_mm_mac_waitrequest Output 1 waitrequest MAC Avalon-MM wait request.

avl_mm_gxb_address Input 32 address Reconfiguration Avalon-MM address.

avl_mm_gxb_write_n Input 1 write_n Reconfiguration Avalon-MM write.

avl_mm_gxb_writedata Input 32 writedata Reconfiguration Avalon-MM write data.

avl_mm_gxb_read_n Input 1 read_n Reconfiguration Avalon-MM read.

avl_mm_gxb_readdata Output 32 readdata Reconfiguration Avalon-MM read data.

© November 2009 Altera Corporation 10-Gbps Ethernet Reference DesignPreliminary

Page 76: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Page 76 Document Revision History

Simulate the Example DesignTo simulate the example design, follow these steps:

1. Start the ModelSim simulator.

2. Change the working directory to the eth_10g\reconfig_example directory.

3. Run the following command:

do_modelsim.dor

Document Revision HistoryTable 70 shows the revision history for this application note.

avl_mm_gxb_waitrequest Output 1 waitrequest Reconfiguration Avalon-MM wait request.

xaui_rx_data Input 4 export XAUI receive data.

xaui_tx_data Output 4 export XAUI transmit data.

Table 69. Design Example Signals

Port Name Direction Size Avalon Type Description

Table 70. Document Revision History

Date and Document Version Changes Made Summary of Changes

October 2009 v2.3 ■ Added optional ECC feature —

March 2009 v2.2 ■ Added soft XAUI option information

■ Added MAC only option information

February 2009 v2.1 Added extra notes on xon_request and xoff_request signals

February 2009 v2.0 ■ Added extra supplemental address information

■ Updated information about 64-bit statistics counters

■ Added flow control signals

■ Increased maximum frame size and added PCS limitation note.

October 2008 v1.1 ■ Added clocking diagram

■ Added external reconfiguration block information

June 2008 v1.0 First release. —

10-Gbps Ethernet Reference Design © November 2009 Altera CorporationPreliminary

Page 77: AN516: 10-Gbps Ethernet Reference Design - · PDF fileGeneral Description Page 3 © November 2009 Altera Corporation 10-Gbps Ethernet Reference Design Preliminary General Description

Document Revision History

101 Innovation DriveSan Jose, CA 95134www.altera.comTechnical Supportwww.altera.com/support

Copyright © 2009 Altera Corporation. All rights reserved. Altera, The Programmable Solutions Company, the stylized Altera logo, specific device designations, and all other words and logos that are identified as trademarks and/or service marks are, unless noted otherwise, the trademarks and service marks of Altera Corporation in the U.S. and other countries. All other product or service names are the property of their respective holders. Altera products are protected under numerous U.S. and foreign patents and pending applications, maskwork rights, and copyrights. Altera warrants performance of its semiconductor products to current specifications in accordance with Altera's standard warranty, but reserves the right to make changes to any products and services at any time without notice. Altera assumes no responsibility or liability arising out of the application or use of any information, product, or service described herein except as expressly agreed to in writing by Altera Corporation. Altera customers are advised to obtain the latest version of device specifications before relying on any published information and before placing orders for products or services.