10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
1. About This IP Core
Avalon-ST
Interface
Client
Module
Altera FPGA
10GbE MAC or
1G/10GbE MAC or
10M/100M/
1000M/10GbE MAC
External PHY
XAUI or
10GBASE-R or
Backplane Ethernet
10GBASE-KR PHY or
1G/10Gbps Ethernet
SDR XGMII/
GMII/MII
Serial
Interface
The 10-Gbps Ethernet (10GbE) Media Access Controller (MAC) IP core is a
configurable component that implements the IEEE 802.3-2008 specification. The IP
core offers the following modes:
■ 10 Gbps mode—uses the Avalon
side and the single data rate (SDR) XGMII on the network side.
■ 1 Gbps/10 Gbps mode— uses the Avalon-ST interface on the client side and
GMII/SDR XGMII on the network side.
■ 10 Mbps/100 Mbps/1 Gbps/10 Gbps (10M-10G) mode—uses the Avalon-ST
interface on the client side and MII/GMII/SDR XGMII on the network side.
To build a complete Ethernet subsystem in an Altera
external device, you can use the 10GbE MAC IP core with an Altera PHY IP core such
as a soft XAUI PHY in FPGA fabric, hard silicon-integrated XAUI PHY, a 10GBASE-R
PHY, a Backplane Ethernet 10GBASE-KR PHY, or a 1G/10 Gbps Ethernet PHY IP.
®
Streaming (Avalon-ST) interface on the client
®
device and connect it to an
Figure 1–1 illustrates a system with the 10GbE MAC IP core.
■ Avalon-ST 64-bit wide client interface running at 156.25 MHz.
■ Direct interface to 4-bit MII running at 125 MHZ with clock enable; 2.5 MHz for
10 Mbps and 25 MHz for 100 Mbps.
■ Direct interface to 8-bit GMII running at 125 MHZ.
■ Direct interface to 64-bit SDR XGMII running at 156.25 MHZ.
■ Virtual local area network (VLAN) and stacked VLAN tagged frames filtering as
specified by IEEE 802.IQ and 802.1ad (Q-in-Q) standards respectively.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
1–2Chapter 1: About This IP Core
■ Optional cyclic redundancy code (CRC)-32 computation and insertion on the
Release Information
transmit datapath; CRC checking on the receive datapath with optional
forwarding of the frame check sequence (FCS) field to the client application.
■ Checking of receive frames for FCS error, undersized and oversized frames, and
payload length error.
■ Deficit idle counter (DIC) for optimized performance with average inter-packet
gap (IPG) of 12 bytes for LAN applications.
■ Optional statistics collection on the transmit and receive datapaths.
■ Packets termination when the transmit datapath receives incomplete packets.
■ Programmable maximum length of transmit and receive frames up to
64 Kbytes (KB).
■ Programmable promiscuous (transparent) mode.
■ Optional Ethernet flow control and priority-based flow control (PFC) using pause
frames with programmable pause quanta. The PFC supports up to 8 priority
queues.
■ Optional padding termination on the receive datapath and insertion on the
transmit datapath.
■ Design examples with optional loopback and testbench for design verification.
■ Optional preamble passthrough mode on the transmit and receive datapaths. The
preamble passthrough mode allows you to define the preamble in the client frame.
■ Programmable datapath option to allow separate instantiation of MAC TX block,
MAC RX block, or both MAC TX and MAC RX blocks.
■ Optional IEEE 1588v2 feature for the following configurations:
■10GbE MAC with 10GBASE-R PHY MegaCore function
■1G/10GbE MAC with Backplane Ethernet 10GBASE-KR PHY MegaCore
function
■Multi-speed 10M-10GbE MAC with Backplane Ethernet 10GBASE-KR PHY
MegaCore function
1.2. Release Information
Tab le 1– 1 lists information about this release of the 10GbE MAC IP core.
Table 1–1. Release Information
Version13.1
Release DateNovember 2013
Ordering CodeIP-10GETHMAC
Product IDID 00D9
Vendor ID6AF7
ItemDescription
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 1: About This IP Core1–3
Device Family Support
1.3. Device Family Support
MegaCore functions provide the following support for Altera device families:
■ Preliminary support—Altera verifies the IP core with preliminary timing models for
this device family. The core meets all functional requirements, but might still be
undergoing timing analysis for the device family. It can be used in production
designs with caution.
■ Final support—Altera verifies the IP core with final timing models for this device
family. The core meets all functional and timing requirements for the device family
and can be used in production designs.
Tab le 1– 2 shows the level of support offered by the 10GbE MAC for the following
Altera device family.
Table 1–2. Device Family Support for 10GbE MAC
Device FamilySupport
®
II GX, GZFinal
Arria
Arria V GT, GX, and GZPreliminary
Arria V SoCPreliminary
®
Cyclone
Cyclone VPreliminary
Cyclone V SoCPreliminary
Stratix
Stratix IVFinal
Stratix VPreliminary
IV GXFinal
III Final
Tab le 1– 3 shows the devices supported by the different configurations.
Table 1–3. Device Family Support for Configurations
ConfigurationArria V GTArria V GZStratix V
Multi-Speed 10M-10GbE MAC—vv
Multi-Speed 10M-10GbE MAC with IEEE 1588v2—vv
10GbE MAC with 10GBASE-R PHYvvv
10GbE MAC with 10GBASE-R PHY and IEEE
1588v2
Multi-Speed 10M-10GbE MAC with Backplane
Ethernet 10GBASE-KR PHY
Multi-Speed 10M-10GbE MAC with Backplane
Ethernet 10GBASE-KR PHY and IEEE 1588v2
Multi-Speed 10M-10GbE MAC with 1G/10Gbps
Ethernet PHY
Multi-Speed 10M-10GbE MAC with 1G/10Gbps
Ethernet PHY and IEEE 1588v2
Note for Table 1–3:
(1) Supports only Arria V GT devices with speed grade of 3_H3.
v (1)vv
—vv
———
—vv
—vv
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
1–4Chapter 1: About This IP Core
IP Core Verification
1.4. IP Core Verification
To ensure compliance with the IEEE specification, Altera performs extensive
validation of the 10GbE MAC IP core. Validation includes both simulation and
hardware testing.
1.4.1. Simulation Environment
Altera performs the following tests in the simulation environment:
■ Directed tests that test all types and sizes of transaction layer packets and all bits of
the configuration space.
■ Error injection tests that inject errors in the link, transaction layer packets, and data
link layer packets, and check for the proper response from the IP core.
■ Random tests that test a wide range of traffic patterns across one or more virtual
channels.
1.4.2. Compatibility Testing Environment
Altera has performed significant hardware testing of the 10GbE MAC IP core to
ensure a reliable solution. The IP core has been tested with the following devices:
■ Arria V, Stratix IV, and Stratix V
■ Soft XAUI PHY
■ Soft and hard 10GBASE-R PHY
■ Hard Backplane Ethernet 10GBASE-KR PHY
■ 1G/10Gbps Ethernet PHY
The IP core has passed all interoperability tests conducted by the UNH. In addition,
Altera internally tests every release with the Spirent Ethernet and 10G testers.
1.5. Performance and Resource Utilization
Tab le 1– 4 provides the estimated performance and resource utilization of the 10GbE
MAC for the Cyclone IV device family. The estimates are obtained by compiling the
10GbE MAC with the Quartus II software targeting a Cyclone IV
(EP4CGX110DF31C7) device with speed grade –7.
1To achieve your timing requirement in the Quartus II software, Altera recommends
that you use multiple seeds in the Design Space Explorer to find the optimal Fitter
settings for your design, follow the recommendations of the Timing Optimization
Advisor, apply the Speed Optimization Technique and use the LogicLock regions.
Table 1–4. Cyclone IV Performance and Resource Utilization
All options enabled with
memory-based statistics counters
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
4,4243,2452>156.25
11,8458,35511>156.25
MAX
(MHz)
Chapter 1: About This IP Core1–5
Performance and Resource Utilization
Tab le 1– 5 provides the estimated performance and resource utilization of the
10GbE MAC for the Stratix IV device family. The estimates are obtained by compiling
the 10GbE MAC with the Quartus II software targeting a Stratix IV GX
(EP4SGX70HF35C2) device with speed grade –2.
Table 1–5. Stratix IV Performance and Resource Utilization
All options enabled with
memory-based statistics counters
All options enabled with
register-based statistics counters
1,9543,1570>156.25
5,6848,3497>156.25
8,13510,1173>156.25
Tab le 1– 6 provides the estimated performance and resource utilization of the
10GbE MAC for the Cyclone V device family. The estimates are obtained by compiling
the 10GbE MAC with the Quartus II software targeting a Cyclone V GX
(5CGXFC7D6F31C6) device with speed grade –6.
Table 1–6. Cyclone V Performance and Resource Utilization
All options enabled with
memory-based statistics counters
All options enabled with
register-based statistics counters
2,3223,4442>156.25
4,4175,4646>156.25
6,8677,1132>156.25
MAX
MAX
(MHz)
(MHz)
Tab le 1– 7 provides the estimated performance and resource utilization of the
10GbE MAC for the Stratix V device family. The estimates are obtained by compiling
the 10GbE MAC with the Quartus II software targeting a Stratix V GX
(5SGXEA7H3F35C3) device with speed grade –3.
Table 1–7. Stratix V Performance and Resource Utilization for 10GbE MAC (Part 1 of 2)
SettingsCombinational ALUTs
All options disabled
All options enabled with
memory-based statistics counters
All options enabled with
register-based statistics counters
2,0013,0770>156.25
5,7728,1977>156.25
8,2029,9653>156.25
Dedicated Logic
Registers
Memory Block (M20K)f
MAX
(MHz)
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
1–6Chapter 1: About This IP Core
Performance and Resource Utilization
Table 1–7. Stratix V Performance and Resource Utilization for 10GbE MAC (Part 2 of 2)
SettingsCombinational ALUTs
Dedicated Logic
Registers
IEEE 1588v2 feature enabled with
2-step synchronization
■ Timestamping is enabled
■ ptp_1step is disabled
4,8275,9218>156.25
IEEE 1588v2 feature enabled with
1-step and 2-step synchronization
■ Timestamping is enabled
■ ptp_1step is disabled
6,8227,92611>156.25
Tab le 1– 8 provides the estimated performance and resource utilization of the
multi-speed 10M-10GbE MAC for the Stratix V device family. The estimates are
obtained by compiling the 10M-10GbE MAC with the Quartus II software targeting a
Stratix V GX (5SGXEA7H3F35C3) device with speed grade –3.
Table 1–8. Stratix V Performance and Resource Utilization for 10M-10GbE MAC
SettingsCombinational ALUTs
All options disabled
All options enabled with
memory-based statistics counters
All options enabled with
register-based statistics counters
3,6544,6457>156.25
4,8775,79711>156.25
7,3137,5447>156.25
Dedicated Logic
Registers
Memory Block (M20K)f
Memory Block (M20K)f
MAX
MAX
(MHz)
(MHz)
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
2. Getting Started with Altera IP Cores
<path>
<IP core name>
Contains the IP core files and documentation
common
Contains shared components
Installation directory
ip
Contains the Altera IP Library and third-party IP cores
altera
Contains the Altera IP Library
This chapter provides a general overview of the Altera IP core design flow to help you
quickly get started with any Altera IP core. The Altera IP Library is installed as part of
the Quartus II installation process. You can select and parameterize any Altera IP core
from the library. Altera provides an integrated parameter editor that allows you to
customize IP cores to support a wide variety of applications. The parameter editor
guides you through the setting of parameter values and selection of optional ports.
The following sections describe the general design flow and use of Altera IP cores.
2.1. Installation and Licensing
The Altera IP Library is distributed with the Quartus II software and
downloadable from the Altera website (www.altera.com).
Figure 2–1 shows the directory structure after you install an Altera IP core, where
<
path> is the installation directory. The default installation directory on Windows is
C:\altera\<version number>; on Linux it is /opt/altera<version number>.
Figure 2–1. IP core Directory Structure
You can evaluate an IP core in simulation and in hardware until you are satisfied with
its functionality and performance. Some IP cores require that you purchase a license
for the IP core when you want to take your design to production. After you purchase
a license for an Altera IP core, you can request a license file from the Altera Licensing
page of the Altera website and install the license on your computer. For additional
information, refer to Altera Software Installation and Licensing.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
2–2Chapter 2: Getting Started with Altera IP Cores
Design Flows
2.2. Design Flows
You can use the following flow(s) to parameterize Altera IP cores:
■ “MegaWizard Plug-In Manager Flow”
■ “Qsys System Integration Tool Design Flow”
Figure 2–2 shows the design flows for the MegaWizard Plug-In Manager and Qsys
system integration tool.
Figure 2–2. Design Flows
Select Design Flow
Perform
Functional Simulation
Does
Simulation Give
Expected Results?
Debug Design
Qsys
Flow
Specify Parameters
Complete
Qsys System
Optional
Yes
and Compile Design
MegaWizard
Flow
Specify Parameters
Add Constraints
IP Complete
2.3. MegaWizard Plug-In Manager Flow
The MegaWizard Plug-In Manager flow allows you to customize the 10GbE MAC IP
core and manually integrate the function into your design.
2.3.1. Specifying Parameters
To specify the 10GbE MAC IP core parameters with the MegaWizard Plug-In
Manager, follow these steps:
1. Open an existing Quartus II project or create a new project using the New Project Wizard available from the File menu.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 2: Getting Started with Altera IP Cores2–3
MegaWizard Plug-In Manager Flow
2. In the Quartus II software, launch the MegaWizard Plug-in Manager from the
Tools menu, and follow the prompts in the MegaWizard Plug-In Manager
interface to create or edit a custom IP core variation.
3. In the Installed Plug-Ins list on page 2a of the MegaWizard Plug-In Manager
interface, expand the Interfaces folder and then the Ethernet folder. Select
Ethernet 10G MAC. Specify the type and name of the output file you want to
create.
4. Specify the parameters on the Parameter Settings pages. For detailed explanations
of these parameters, refer to “10GbE MAC Parameter Settings” on page 2–6.
5. Specify appropriate options in the wizard to generate a simulation model.
1Altera IP supports a variety of simulation models, including
simulation-specific IP functional simulation models and encrypted RTL
models. These are all cycle-accurate models. The models allow for fast
functional simulation of your IP core instance using industry-standard
VHDL or Verilog HDL simulators.
f For more information about functional simulation models for Altera IP
cores, refer to Simulating Altera Designs in volume 3 of the Quartus II
Handbook.
cUse the simulation models only for simulation and not for synthesis or any
other purposes. Using these models for synthesis creates a nonfunctional
design.
6. Click Finish. The parameter editor generates the top-level HDL code for the
10GbE MAC IP core and a simulation directory which includes files for
simulation.
1The Finish button may be unavailable until all parameterization errors
listed in the messages window are corrected.
7. Click Yes if you are prompted to add the Quartus II IP File (.qip) to the current
Quartus II project. You can also turn on Automatically add Quartus II IP Files to all projects.
You can now integrate your custom 10GbE MAC IP core instance in your design,
simulate, and compile.
f For information about the Quartus II software and the MegaWizard Plug-In Manager,
refer to Quartus II Help.
2.3.2. Simulate the IP Core
You can simulate the 10GbE MAC IP core with the functional simulation model
generated by the Quartus II software. To perform a successful simulation of the 10GbE
MAC IP core using the MegaWizard Plug-In Manager flow, you are required to
compile all files listed in the <project directory>/<variation name>_sim output file.
Otherwise, the simulation may fail.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
2–4Chapter 2: Getting Started with Altera IP Cores
DDR3
SDRAM
Ethernet
Subsystem
Ethernet
Embedded Cntl
PCI Express
Subsystem
Qsys System
PCIe to Ethernet Bridge
PCIe
CSR
Mem
Mstr
Mem
Slave
PHY
Cntl
Mem
Mstr
CSR
DDR3
SDRAM
Controller
Qsys System Integration Tool Design Flow
f For more information about simulating Altera IP cores, refer to Simulating Altera
Designs in volume 3 of the Quartus II Handbook.
2.4. Qsys System Integration Tool Design Flow
You can use the Qsys system integration tool to build a system that includes your
customized IP core. You easily can add other components and quickly create a Qsys
system. Qsys automatically generates HDL files that include all of the specified
components and interconnections. In Qsys, you specify the connections you want.
The HDL files are ready to be compiled by the Quartus II software to produce output
files for programming an Altera device.
Figure 2–3 shows a high level block diagram of an example Qsys system.
Figure 2–3. Example Qsys System
f For more information about the Qsys system interconnect, refer to the Qsys
Interconnect chapter in volume 1 of the Quartus II Handbook and to the Avalon Interface
Specifications.
f For more information about the Qsys tool and the Quartus II software, refer to the
System Design with Qsys section in volume 1 of the Quartus II Handbook and to Quartus
II Help.
2.4.1. Specify Parameters
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
To specify parameters for your IP core using the Qsys flow, follow these steps:
1. Open an existing Quartus II project or create a new project using the New Project Wizard available from the File menu.
2. On the Tools menu, click Qsys.
3. On the Component Library tab, expand the Interfaces Protocols list and then the
Ethernet list. Double-click Ethernet 10G MAC to add it to your system. The
relevant parameter editor appears.
Chapter 2: Getting Started with Altera IP Cores2–5
Qsys System Integration Tool Design Flow
4. Specify the required parameters in the Qsys tool. For detailed explanations of
these parameters, refer to “10GbE MAC Parameter Settings” on page 2–6.
5. Click Finish to complete the IP core instance and add it to the system.
2.4.2. Complete the Qsys System
To complete the Qsys system, follow these steps:
1. Add and parameterize any additional components.
2. Connect the components using the Connections panel on the System Contents
tab.
3. In the Export As column, enter the name of any connections that should be a
top-level Qsys system port.
4. If you intend to simulate your Qsys system, on the Generation tab, turn on one or
more options under Simulation to generate desired simulation files.
5. If you want to generate synthesis RTL files, turn on Create HDL design files for synthesis.
6. Click Generate to generate the system. Qsys generates the system and produces
the <system name>.qip file that contains the assignments and information required
to process the IP core or system in the Quartus II Compiler.
7. In the Quartus II software, click Add/Remove Files in Project on the Project menu
and add the .qip file to the project.
8. Compile your design in the Quartus II software.
2.4.3. Simulate the System
During system generation, Qsys generates a functional simulation model which you
can use to simulate your system easily in any Altera-supported simulation tool.
f For information about the latest Altera-supported simulation tools, refer to the
Quartus II Software Release Notes.
f For general information about simulating Altera IP cores, refer to Simulating Altera
Designs in volume 3 of the Quartus II Handbook.
f For information about simulating Qsys systems, refer to the System Design with Qsys
section in volume 1 of the Quartus II Handbook.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
2–6Chapter 2: Getting Started with Altera IP Cores
10GbE MAC Parameter Settings
2.5. 10GbE MAC Parameter Settings
You customize the 10GbE MAC by specifying the parameters on the MegaWizard
Plug-in Manager, or Qsys in the Quartus II software. Tab le 2– 1 describes the
parameters and how they affect the behavior of the IP core.
Table 2–1. 10GbE Parameters
ParameterDescription
Use this parameter to select the speed options. By default, the 10G MAC option is
Speed select for 10G MAC
Preamble pass-through mode
Priority-based flow control (PFC)
Number of PFC priorities
Datapath option
Supplementary address
CRC on transmit path
Statistics collectionTurn on this parameter to collect statistics on the transmit and receive datapaths.
Statistics counters
Enable time stamping
Enable PTP 1-step clock support
Timestamp fingerprint width
selected. Select Enable 1G/10G MAC to implement the 10-Gbps and 1-Gbps MAC;
select Enable Multi-Speed 10M-10Gb MAC to implement the 10-Mbps, 100-Mbps, 1-
Gbps, and 10-Gbps MAC.
Turn on this parameter to enable the preamble passthrough mode. To enable the
preamble passthrough mode, you must turn on this parameter and set the
This parameter is disabled if you selected Enable 1G/10G MAC.
Turn on this parameter to enable PFC. Refer to “Priority-Based Flow Control” on
page 7–19 for more information on PFC and its operations.
Indicates the number of PFC priority levels that the 10GbE MAC IP core supports. The
valid range is from 2 to 8. This option is enabled only if you turn on the Priority-based flow control (PFC) parameter.
Use this parameter to select the datapath option that determines the MAC variation to
instantiate. By default, the TX & RX option is selected. The default datapath
instantiates the MAC TX and MAC RX blocks. Selecting TX only instantiates the MAC
TX block; selecting RX only instantiates the MAC RX block.
Turn on this parameter to enable supplementary addresses. To enable supplementary
addresses, you must turn on this parameter and set the
rx_frame_control
Turn on this parameter to calculate and insert CRC on the transmit datapath. To
compute and insert CRC on the transmit datapath, you must turn on this parameter
and set the
When you turn on Statistics collection, the default implementation of the statistics
counters is Memory-based.
Use Memory-based statistics counters to free up the logic elements (the MAC does
not clear the statistic counters after the counters are read); Register-based statistics
counters to free up the memory (the MAC clears the statistic counters after the
counters are read).
Register-based statistics counters are not supported for Cyclone IV GX devices.
Turn on this parameter to enable time stamping on the transmitted and received
frames.
Turn on this parameter to insert time stamp on PTP messages for 1-step clock based
on the TX Egress Timestamp Insert Control interface.
This parameter is disabled if you do not turn on Enable time stamping.
Use this parameter to set the width in bits for the time stamp fingerprint on the TX
path. The default value is 4 bits.
tx_crcins_control
register to 1.
registers to 1.
EN_SUPP0/1/2/3
[1] register bit to 1.
, and
bits in the
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
3. 10GbE MAC Design Examples
You can use the following 10GbE design examples and testbenches to help you get
started with the 10GbE MAC IP core and use the core in your design:
■ 10GbE MAC with XAUI PHY
■ 10GbE MAC with 10GBASE-R PHY
1XAUI PHY and 10GBASE-R PHY do not support Stratix III devices.
3.1. Software and Hardware Requirements
Altera uses the following hardware and software to test the 10GbE design examples
and testbenches:
■ Quartus II software 13.1
■ Stratix IV GX FPGA development kit (for XAUI PHY)
■ Transceiver Signal Integrity development kit, Stratix IV GT Edition (for
10GBASE-R PHY)
■ ModelSim
®
-AE 6.6c, ModelSim-SE 6.6c or higher
f For more information on the development kits, refer to the following documents:
■ Stratix IV GX Development Kit User Guide
■ Stratix IV GX Development Kit Reference Manual
■ Transceiver Signal Integrity Development Kit, Stratix IV GT Edition User Guide
■ Transceiver Signal Integrity Development Kit, Stratix IV GT Edition Reference Manual
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
Ethernet
Loopback
JTAG to Avalon Master
Bridge
Pipeline Bridge
10GbE MAC
XAUI
or
10GBASE-R
PHY
External
PHY
MDIO
64-bit Avalon-ST
64-bit Avalon-ST
32-bit
Avalon-MM
MDIO Signals
32-bit Avalon-MM
System Console
(for debugging)
XAUI / 10GBASE-R
72-bit SDR XGMII
72-bit SDR XGMII
Tx FIFO Buffer
Rx FIFO Buffer
Client
Application
Altera FPGA
Design Example
Client Application
(Configuration, Status, and
Statistics)
Avalon-ST
Single-Clock / Dual-Clock
FIFO
Configuration and Debugging Tools
32
64
64
72
72
72
72
32
64
64
3–2Chapter 3: 10GbE MAC Design Examples
10GbE Design Example Components
3.2. 10GbE Design Example Components
You can use the 10GbE MAC IP core design example to simulate a complete 10GbE
design in an Altera FPGA. You can compile the design example using the simulation
files generated by the Quartus II software and program the targeted Altera device
after a successful compilation.
Figure 3–1 shows the block diagram of the 10GbE design examples.
Figure 3–1. 10GbE Design Example Block Diagram
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 3: 10GbE MAC Design Examples3–3
10GbE Design Example Components
The design example comprises the following components:
■ 10GbE Ethernet MAC—the MAC IP core with default settings. This IP core
includes memory-based statistics counters.
■ XAUI PHY or 10GBASE-R PHY—the PHY IP core with default settings. The XAUI
PHY is set to Hard XAUI by default.
■ Ethernet Loopback— the loopback module provides a mechanism for you to
verify the functionality of the MAC and PHY. Refer to Section 3.2.0.1, Ethernet
Loopback Module for more information about this module.
■ RX and TX FIFO buffers—Avalon-ST Single-Clock or Dual-Clock FIFO cores that
buffer receive and transmit data between the MAC and client. These FIFO buffers
are 64 bits wide and 512 bits deep. The default configuration is Avalon-ST
Single-Clock FIFO, which operates in store and forward mode and you can
configure it to provide packet-based flushing when an error occurs.
1To enable the Avalon-ST Single-Clock FIFO to operate in cut through mode,
turn off the Use store and forward parameter in the Avalon-ST Single
Clock FIFO parameter editor.
■ Configuration and debugging tools—provides access to the registers of the
following components via the Avalon Memory-Mapped (Avalon-MM) interface:
MAC, MDIO, Ethernet loopback, PHY, and FIFO buffers. The provided testbench
includes an Avalon driver which uses the pipeline bridge to access the registers.
You can use the system console to access the registers via the JTAG to Avalon
Master Bridge core when verifying the design in the hardware.
f To learn more about the components, refer to the respective documents:
■ XAUI PHY and 10GBASE-R PHY, refer to Altera Transceiver PHY IP Core User
Guide.
■ Avalon-ST Single-Clock or Dual-Clock FIFO, JTAG to Avalon Master Bridge, and
MDIO cores, refer to Embedded Peripherals IP User Guide.
■ Pipeline bridge, refer to Avalon Memory-Mapped Bridges in volume 4 of the Quartus
II Handbook.
■ System Console, refer to Analyzing and Debugging Designs with the System Console in
volume 3 of the Quartus II Handbook.
3.2.0.1. Ethernet Loopback Module
You can enable one of the following loopback types:
■ Local loopback—turn on this loopback to verify the functionality of the MAC
during simulation. When you enable the local loopback, the Ethernet loopback
module takes the transmit frame from the MAC XGMII TX and loops it back to the
MAC XGMII RX datapath. During this cycle, the loopback module also forwards
the TX frame to the PHY. While the local loopback is turned on, the loopback
module ignores any frame it receives from the PHY.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
3–4Chapter 3: 10GbE MAC Design Examples
■ Line loopback—turn on this loopback to verify the functionality of the PHY when
10GbE Design Example Components
verifying the design example in hardware. When you enable the line loopback, the
Ethernet loopback module takes the XGMII RX signal received from the PHY and
loops it back to the PHY’s XGMII TX signal. During this cycle, the loopback
module also forwards the XGMII RX signal to the MAC. While the line loopback is
turned on, the loopback module ignores any frame transmitted from the MAC.
Tab le 3– 1 describes the registers you can use to enable or disable the desired loopback.
Table 3–1. Loopback Registers
Byte OffsetRegisterDescription
0x00
0x04Reserved—
0x08
line loopback
local loopback
Set this register to 1 to enable line loopback; 0 to disable it.
Set this register to 1 to enable local loopback; 0 to disable it.
3.2.0.2. Base Addresses
Tab le 3– 2 lists the design example components that you can reconfigure to suit your
verification objectives. To reconfigure the components, write to their registers using
the base addresses listed in the table and the register offsets described in the
components' user guides. Refer to Tab le 3– 1 for the Ethernet loopback registers.
Table 3–2. Base Addresses of Design Example Components
ComponentBase Address
10GbE MAC0x000
XAUI or 10GBASE-R PHY0x40000
MDIO0X10000
Ethernet loopback0x10200
RX FIFO (Avalon-ST Single-Clock FIFO)0x10400
TX FIFO (Avalon-ST Single-Clock FIFO)0x10600
1This design example uses a 19-bit width address bus to access the base address of
components other than the MAC.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 3: 10GbE MAC Design Examples3–5
10GbE Design Example Files
3.3. 10GbE Design Example Files
Figure 3–2 shows the directory structure for the design examples and testbenches. The
..\csr_script directory contains the design example script files.
Figure 3–2. Design Example Folders
<ip_lib>/ethernet/altera_eth_10g_design_example
altera_eth_10g_mac_base_r
testbench
altera_eth_10g_mac_base_r_sv
testbench
altera_eth_10g_mac_xaui
testbench
altera_eth_10g_mac_xaui_sv
testbench
csr_scripts
design_example_components
source
Tab le 3– 3 lists the design example files. For the description of testbench files, refer to
Table 3–5 on page 3–10.
Table 3–3. 10GbE Design Example Files (Part 1 of 2)
File NameDescription
A Tcl script that creates a new Quartus II project
setup_proj.tcl
and sets up the project environment for your
design example. Not applicable for Stratix V
design.
A Tcl script that creates a new Quartus II project
setup_proj_sv.tcl
for Stratix V design and sets up the project
environment for your design example.
A Qsys file for the 10GbE MAC and XAUI PHY
altera_eth_10g_design_mac_xaui.qsys
design example. The PHY is set to hard XAUI by
default.
A Qsys file for the 10GbE MAC and XAUI PHY
altera_eth_10g_design_mac_xaui_sv.qsys
design example with the Quartus II software
targeting the Stratix V device. The PHY is set to
hard XAUI by default.
altera_eth_10g_design_mac_base_r.qsys
A Qsys file for the 10GbE MAC and 10GBASE-R
PHY design example.
A Qsys file for the 10GbE MAC and 10GBASE-R
altera_eth_10g_design_mac_base_r_sv.qsys
PHY design example with the Quartus II software
targeting the Stratix V device.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
3–6Chapter 3: 10GbE MAC Design Examples
Table 3–3. 10GbE Design Example Files (Part 2 of 2)
File NameDescription
A Tcl script that sets the pin assignments and I/O
setup_SIVGX230C2ES.tcl
setup_EP4S100G5H40I3.tcl
setup_5SGXEA7N2F40C2ES.tcl
top.sdc
top.v
top_sv.v
common.tcl
config.tclA Tcl script that configures the design example.
csr_pkg.tcl
show_stats.tcl
altera_eth_10g_design_example_hw.tcl
standards for the Stratix IV GX FPGA
development board. Use this Tcl script for the
10GbE MAC with XAUI PHY design example.
A Tcl script that sets the pin assignments and I/O
standards for the Stratix IV GT Signal Integrity
development board. Use this Tcl script for the
10GbE MAC with 10GBASE-R PHY design
example.
A Tcl script that sets the pin assignments and I/O
standards for the Stratix V GX Signal Integrity
development board. Use this Tcl script for the
10GbE MAC with 10GBASE-R PHY design
example.
The Quartus II SDC constraint file for use with
the TimeQuest timing analyzer.
The top-level entity file of the design example for
verification in hardware. Not applicable for
Stratix V design.
The top-level entity file of the design example—
with the Quartus II software targeting the
Stratix V device—for verification in hardware.
A Tcl script that contains basic functions based
on the system console APIs to access the
registers through the Avalon-MM interface.
A Tcl script that maps address to the Avalon-MM
control registers. The script contains APIs which
is used by config.tcl and show_stats.tcl.
A Tcl script that displays the MAC statistics
counters.
A hardware Tcl script that contains the
composition of the Ethernet system.
Creating a New 10GbE Design
3.4. Creating a New 10GbE Design
You can use the Quartus II software to create a new 10GbE design. Altera provides a
customizable Qsys design example file to facilitate the development of your 10GbE
design. Follow these steps to create the design:
1. Copy the respective design example directory to your preferred project directory:
altera_eth_10g_mac_xaui or altera_eth_10g_mac_base_r from
<ip library>/ethernet/altera_eth_10g_design_example.
2. Launch the Quartus II software and open the top.v file from the project directory.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 3: 10GbE MAC Design Examples3–7
Creating a New 10GbE Design
3. Open the Quartus II Tcl Console window by pointing to Utility Windows on the
View menu and then selecting Tcl Co ns ol e. In the Quartus II Tcl Console window,
type the following command to set up the project environment:
source setup_proj.tcl
r
4. Load the pin assignments and I/O standards for the development board:
■For the 10GbE MAC with XAUI PHY design example, type the following
command:
source setup_SIVGX230C2ES.tcl
r
This command assigns the XAUI serial interface to the pins that are connected
to the HSMC Port A of the Stratix IV GX development board.
■For the 10GbE MAC with 10GBASE-R design example, type the following
command:
source setup_EP4S100G2F40I1.tcl
r
This command assigns the 10GBASE-R serial interface to the pins that are
connected to the SMA connectors (J38 to J41) of the Stratix IV GT development
board.
f For more information about the development boards, refer to the respective
reference manuals: Stratix IV GX Development Kit Reference Manual or
Transceiver Signal Integrity Development kit, Stratix IV GT Edition Reference
Manual.
5. Launch Qsys from the Tools menu and open the altera_eth_10g_mac_base_r.qsys
or altera_eth_10g_mac_xaui.qsys file. For design targeting the Stratix V device
family, use the altera_eth_10g_mac_base_r_sv.qsys or altera_eth_10g_mac_xaui_sv.qsys file.
1By default, the design example targets the Stratix IV device family. To
change the target device family, click on the Project Settings tab and select
the desired device from the Device family list.
6. Turn off the additional module under the Use column if your design does not
require them. This action disconnects the module from the 10GbE system.
7. Double-click eth_10g_design_example_0 to launch the parameter editor.
8. Specify the required parameters in the parameter editor. For detailed explanations
of these parameters, refer to “10GbE Design Example Parameter Settings” on
page 3–8.
9. Click Finish.
10. On the Generation tab, select either a Verilog HDL or a VHDL simulation model
and make sure that the Create HDL design files for synthesis option is turned on.
11. Click Generate to generate the simulation and synthesis files.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
3–8Chapter 3: 10GbE MAC Design Examples
10GbE Design Example Parameter Settings
3.5. 10GbE Design Example Parameter Settings
You can customize the 10GbE design example by specifying the parameters using the
parameter editor. Ta ble 3–4 describes these parameters.
Table 3–4. Design Example Parameters
NameValueDescription
Configuration
Specifies whether the Ethernet system requires a MDIO core to
access the external PHY device management registers for
configuration and management purposes.
Specifies which protocol-specific PHY IP core to use for the
Ethernet system. For XAUI PHY, you can choose to implement the
system in soft or hard logic.
Specifies which FIFO buffer to use for the Ethernet system. The
Avalon-ST Single Clock FIFO operates with a common clock for the
input and output ports while the Avalon-ST Dual Clock FIFO
operates with independent clocks for the input and output ports.
You cannot enable a different FIFO option for TX datapath and RX
datapath. If you select Avalon-ST Single Clock FIFO, the design
includes single clock FIFO at both TX and RX datapaths.
MDIO
PHY IP
FIFO
MDIO
None
XAUI PHY
10GBase-R PHY
None
Avalon-ST Single Clock FIFO
Avalon-ST Dual Clock FIFO
Avalon-ST Single Clock FIFO
+ Avalon-ST Dual Clock FIFO
None
1The parameter values you select on Configuration tab correspond with the
other tabs that require further parameterization. You should only
parameterize the components you selected and omit the others. Editing the
component parameters that were not selected may cause the system
generation to fail.
f For more information about the parameter settings of other components,
refer to the respective documents:
■ 10GbE MAC, refer to “10GbE MAC Parameter Settings” on page 2–6.
■ Avalon-ST Single-Clock or Dual-Clock FIFO and MDIO core, refer to
Embedded Peripherals IP User Guide.
■ XAUI PHY and 10GBASE-R PHY, refer to Altera Transceiver PHY IP Core
User Guide.
3.6. 10GbE Testbenches
Altera provides testbenches for you to verify the design examples. The following
sections in this document describe the testbench, its components, and use.
3.6.1. 10GbE Testbench
The testbenches operate in loopback mode. Figure 3–3 shows the flow of the packets.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 3: 10GbE MAC Design Examples3–9
10GbE Testbenches
Figure 3–3. Testbench Block Diagram
Testbench
Ethernet
Packet
Avalon-MM
Control
Register
Avalon-ST
Transmit
Frame
Generator
Monitor
Avalon-ST
DUT
Avalon-MM
Loopback
on XGMII
Avalon-ST
Receive
Frame
Monitor
avalon_bfm_wrapper.sv
Avalon Driver
Avalon-ST
Ethernet
Monitor
3.6.2. 10GbE Testbench Component
The 10GbE testbench comprises the following modules:
■ Device under test (DUT)—the design example.
■ Avalon driver—uses Avalon-ST bus functional models (BFMs) to exercise the
transmit and receive paths. The driver also utilizes the Avalon-MM BFM to access
the Avalon-MM interfaces of the design example components.
■ Packet monitors—monitors the transmit and receive datapaths, and displays the
frames in the simulator console.
3.6.3. 10GbE Testbench Files
The following directories contain the 10GbE testbench files which are in clear text:
Packet
■ 10GbE MAC and XAUI PHY testbench—<ip library>/ethernet/
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
3–10Chapter 3: 10GbE MAC Design Examples
10GbE Testbenches
Tab le 3– 5 describes the files that implement the testbench.
Table 3–5. Testbench Files
File NameDescription
avalon_bfm_wrapper.sv
A wrapper for the Avalon BFMs that the avalon_driver.sv file
uses.
A SystemVerilog HDL driver that utilizes the BFMs to exercise
avalon_driver.sv
the transmit and receive path, and access the Avalon-MM
interface.
A SystemVerilog HDL testbench that contains parameters to
avalon_if_params_pkg.sv
configure the BFMs. Because the configuration is specific to
the DUT, you must not change the contents of this file.
avalon_st_eth_packet_monitor.sv
eth_mac_frame.sv
eth_register_map_params_pkg.sv
tb_run.tcl
tb_run_sv.tcl
A SystemVerilog HDL testbench that monitors the Avalon-ST
transmit and receive interfaces.
A SystemVerilog HDL class that defines the Ethernet frames.
The avalon_driver.sv file uses this class.
A SystemVerilog HDL package that maps addresses to the
Avalon-MM control registers.
A Tcl script that starts a simulation session in the ModelSim
simulation software. Not applicable for Stratix V design.
A Tcl script that starts a simulation session in the ModelSim
simulation software for Stratix V design only.
The top-level testbench file. This file includes the customized
tb.sv
10GbE MAC which is the device under test (DUT), a client
packet generator, and a client packet monitor along with
other logic blocks. Not applicable for Stratix V design.
The top-level testbench file for Stratix V design only. This file
tb_sv.sv
includes the customized 10GbE MAC which is the device
under test (DUT), a client packet generator, and a client
packet monitor along with other logic blocks.
wave.do
A signal tracing macro script to be used with the ModelSim
simulation software to display testbench signals.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 3: 10GbE MAC Design Examples3–11
10GbE Testbenches
3.6.4. 10GbE Testbench Simulation Flow
Upon a simulated power-on reset, each testbench performs the following operations:
1. Initializes the DUT by configuring the following options via the Avalon-MM
interface:
a. In the MAC, enables address insertion on the transmit path and sets the
transmit primary MAC address to EE-CC-88-CC-AA-EE.
b. In the TX and RX FIFO (Avalon-ST Single Clock FIFO core), enables drop on
error.
2. Starts packet transmission. The testbench sends a total of eight packets:
a. 64-byte basic Ethernet frame
b. Pause frame
c. 1518-byte VLAN frame
d. 1518-byte basic Ethernet frame
e. 64-byte stacked VLAN frame
f. 500-byte VLAN frame
g. Pause frame
h. 1518-byte stacked VLAN frame
3. Ends the transmission and displays the MAC statistics in the transcript pane.
3.6.5. Simulating the 10GbE Testbench with the ModelSim Simulator
To use the ModelSim simulator to simulate the testbench design, follow these steps:
1. Copy the respective design example directory to your preferred project directory:
altera_eth_10g_mac_xaui or altera_eth_10g_mac_base_r from
<ip library>/ethernet/altera_eth_10g_design_example.
2. The design example and testbench files are set to read only. Altera recommends
that you turn off the read-only attribute of all design example and testbench files.
3. Launch the Quartus II software and open the top.v file from the project directory.
4. Open the Quartus II Tcl Console window by pointing to Utility Windows on the
View menu and then selecting Tcl Co ns ol e. In the Quartus II Tcl Console window,
type the following command to set up the project environment:
source setup_proj.tcl
5. Launch Qsys from the Tools menu and open altera_eth_10g_mac_base_r.qsys or
altera_eth_10g_mac_xaui.qsys in the File menu.
r
6. For the 10GbE MAC with XAUI design example, the default setting of the XAUI
PHY is Hard XAUI. Follow these steps if you want to set the PHY to Soft XAUI:
a. Double-click the XAUI PHY module to open the parameter editor.
b. On the General Options tab, select Soft XAUI for XAUI Interface Type.
7. On the Generation tab, select Verilog simulation model.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
3–12Chapter 3: 10GbE MAC Design Examples
10GbE Testbenches
8. Click Generate to generate the system.Launch the ModelSim simulator software.
9. Change the working directory to <project directory>/<design example directory>/testbench in the File menu.
10. 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:
do tb_run.tcl
r
The ModelSim transcript pane in Main window displays messages from the
testbench reflecting the current task being performed.
Upon a successful simulation, the simulator displays the following
and
You can turn on local loopback to verify the functionality of the MAC during
simulation. Follow these steps to enable local loopback:
1. Open the tb.sv file.
2. Insert the command
offset is the sum of the base address of the loopback module and the register offset,
and value is the value to write to the register.
3. Set value to 1 to enable local loopback; 0 to disable it. Altera recommends that you
insert the command after the command that configures the RX FIFO. For example,
the following code segment enables local loopback:
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
U_AVALON_DRIVER.avalon_mm_csr_wr(offset,value)
where
Chapter 3: 10GbE MAC Design Examples3–13
csr_clk_clk
csr_reset_reset_n
csr_address [18:0]
csr_read
csr_readdata [31:0]
csr_write
csr_writedata [31:0]
csr_waitrequest
40084
00000002
10GbE Testbenches
// Configure the RX FIFO
U_AVALON_DRIVER.avalon_mm_csr_wr(RX_FIFO_DROP_ON_ERROR_ADDR,RX_FIFO_DROP_ON_ERROR);
// Read the configured registers
U_AVALON_DRIVER.avalon_mm_csr_rd(RX_FIFO_DROP_ON_ERROR_ADDR, readdata);
$display("RX FIFO Drop on Error Enable = %0d", readdata[0]);
U_AVALON_DRIVER.avalon_mm_csr_wr(32'h948, 1)
4. Run the following command again to reconfigure the loopback module, set up the
required libraries, compile the generated IP Functional simulation model, and
exercise the simulation model:
do tb_run.tcl
r
3.6.7. 10GbE Simulation Timing Diagrams
Figure 3–4 shows the reset and initial configuration sequence. The first read or write
transaction must be at least one clock cycle after the
completes.
Figure 3–4. Reset and Configuration
csr_reset_reset_n
signal
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
3–14Chapter 3: 10GbE MAC Design Examples
10GbE Testbenches
Figure 3–5 shows the transmission of the first 60-byte frame upon a successful reset
and initial configuration. The same frame is looped back to the receive datapath.
Figure 3–5. Frame Transmission and Reception
Loopback
tx_clk_clk
avalon_st_tx_ready
avalon_st_tx_valid
avalon_st_tx_startofpacket
avalon_st_tx_endofpacket
avalon_st_tx_data [63:0]
avalon_st_tx_empty [2:0]
avalon_st_tx_error
040
rx_clk_clk
avalon_st_rx_ready
avalon_st_rx_valid
avalon_st_rx_startofpacket
avalon_st_rx_endofpacket
avalon_st_rx_data [63:0]
avalon_st_rx_empty [2:0]
avalon_st_rx_error [5:0]
04
0
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 3: 10GbE MAC Design Examples3–15
10GbE Design Example Compilation and Verification in Hardware
3.7. 10GbE Design Example Compilation and Verification in Hardware
Figure 3–6 shows the components in the top-level file provided with the 10GbE
design example.
Figure 3–6. 10GbE Top-Level Components
Altera Development Board
Address
Swapper
Avalon-ST
The address swapper swaps the destination address and source address in the receive
frame before sending the frame onto the transmit path. You must connect the DUT—
design example—to a remote partner that generates, transmits, and receives frames.
3.7.1. Compiling the 10GbE Design
You can use the Quartus II software to compile the design example and program the
targeted Altera device after a successful compilation.
Follow these steps to compile the design and program the device:
1. Copy the respective design example directory to your preferred project directory:
altera_eth_10g_mac_xaui or altera_eth_10g_mac_base_r from
<ip library>/ethernet/altera_eth_10g_design_example.
2. Launch the Quartus II software and open top.v from the project directory.
3. Open the Quartus II Tcl Console window by pointing to Utility Windows on the
View menu then clicking Tc l Co ns o le . In the Quartus II Tcl Console window, type
the following command to set up the project environment:
DUT
XAUI/
10GBASE-R
Remote
Partner
source setup_proj.tcl
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
r
3–16Chapter 3: 10GbE MAC Design Examples
10GbE Design Example Compilation and Verification in Hardware
4. Load the pin assignments and I/O standards for the development board:
■For the 10GbE MAC with XAUI PHY design example, type the following
command:
source setup_SIVGX230C2ES.tcl
r
This command assigns the XAUI serial interface to the pins that are connected
to the HSMC Port A of the Stratix IV GX development board.
■For the 10GbE MAC with 10BASE-R design example, type the following
command:
source setup_EP4S100G2F40I1.tcl
r
This command assigns the 10GBASE-R serial interface to the pins that are
connected to the SMA connectors (J38 to J41) of the Stratix IV GT development
board.
f For more information about the development boards, refer to the respective
reference manuals: Stratix IV GX Development Kit Reference Manual or
Transceiver Signal Integrity Development kit, Stratix IV GT Edition Reference
Manual.
5. Launch Qsys from the Tools menu and open altera_eth_10g_mac_base_r.qsys or
altera_eth_10g_mac_xaui.qsys.
6. For the 10GbE MAC with XAUI PHY design example, the default setting of the
PHY is Hard XAUI. Follow these steps if you want to set the PHY to Soft XAUI:
a. Double-click the XAUI PHY module to open the parameter editor.
b. On the General Options tab, select Soft XAUI for XAUI Interface Type.
7. Click Save on the File menu.
8. On the Generation tab, turn on Create Synthesis RTL Files.
9. Click Generate to generate the system.
10. Click Start Compilation on the Processing menu to compile the design example.
11. Upon a successful compilation, click Programmer on the Tools menu to program
the device.
f For more information about device programming, refer to Quartus II Programmer in
volume 3 of the Quartus II Handbook.
1If you are not using the Stratix IV GX FPGA development board or the Transceiver
Signal Integrity development board, Stratix IV GT Edition, modify setup_proj.tcl and
setup_SIVGX230C2ES.tcl or setup_EP4S100G2F40I1.tcl to suit your hardware.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 3: 10GbE MAC Design Examples3–17
10GbE Design Example Compilation and Verification in Hardware
3.7.2. Verifying the 10GbE Design in Hardware
After programming the targeted Altera device, follow these steps to verify your
design and collect the statistics:
1. Copy the csr_scripts directory to the design example directory.
2. Launch Qsys and access the System Console by clicking System Console on the
Tools menu.
3. Change the working directory to <project directory>/csr_scripts.
4. Type the following command to configure the design example:
source config.tcl
5. Start frame transmission on your remote partner to exercise the datapaths.
6. Type the following command to read and view the statistics:
source show_stats.tcl
1The
config.tcl
connection.
3.7.3. Debugging
You can use the system console to perform the following tasks for debugging
purposes:
■ Reconfigure the design example components and retrieve the registers during
runtime by following these steps:
a. Create a new Tcl script.
b. Add the following commands:
source common.tcl
# establishes the connection
open
_
jtag
# use rd32 to retrieve the register value
# base address = base address of the component
# offset = byte offset of the register
rd32 <base address> 0 <offset>
# use wr32 to configure the register
# base address = base address of the component
# offset = byte offset of the register
# value = value to be written to the register
wr32 <base address> 0 <offset> <value>
# closes the connection
close
_
jtag
r
and
show_stats.tcl
r
scripts support only one USB-Blaster
Save and close the Tcl script and type the following command:
source
■ Retrieve and view the statistics counters by typing the following command:
source show_stats.tcl
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
<script>
.tcl
r
r
3–18Chapter 3: 10GbE MAC Design Examples
■ Turn on the line loopback to verify the functionality of the XAUI/10GBASE-R
10GbE Design Example Compilation and Verification in Hardware
PHY by following these steps:
a. Edit the script config.tcl.
b. Add the command
write_line_loopback(value)
immediately after the
command that establishes the JTAG connection. Set the argument value, to 1 to
enable line loopback; 0 to disable line loopback. For example, the following
codes enable line loopback:
open_jtag
write_line_loopback 1
c. Save and close config.tcl, and type the following command:
source config.tcl
r
f For more information on the System Console, refer to Analyzing and Debugging Designs
with the System Console in volume 3 of the Quartus II Handbook.
3.7.4. 10GbE Design Transmit and Receive Latencies
Altera uses the following definitions for the transmit and receive latencies:
■ Transmit latency is the number of clock cycles the MAC function takes to transmit
the first byte on the network-side interface (XGMII SDR) after the bit was first
available on the Avalon-ST interface.
■ Receive latency is the number of clock cycles the MAC function takes to present
the first byte on the Avalon-ST interface after the bit was received on the
network-side interface (XGMII SDR).
Tab le 3– 6 shows the transmit and receive nominal latencies of the design example.
Table 3–6. Transmit and Receive Latencies of the 10GbE Design Example
Latency (Clock Cycles) (1) (2)
Configuration
(with respect to TX clock)
Tra nsmit
Receive
(with respect to RX clock)
MAC and Ethernet loopback1013
Dual Core FIFO66
Single Core FIFO1010
Soft XAUI PHY41 (3)
Hard XAUI PHY24 (3)
Soft 10GBASE-R PHY56 (3)
Notes to Table 3–6:
(1) The clocks in all domains are running at the same frequency.
(2) The latency values are based on the assumption that there is no backpressure on the Avalon-ST TX and RX
interface.
(3) Total latency for both transmit and receive in this design example targeting the Stratix IV device family.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 3: 10GbE MAC Design Examples3–19
10GbE Design Example Compilation and Verification in Hardware
3.7.5. 10GbE Design Performance and Resource Utilization
Tab le 3– 7 provides the estimated performance and resource utilization of the 10GbE
design example obtained by compiling the design with the Quartus II software
targeting the Stratix IV GX (EP4SGX230KF40C2ES) device with speed grade –2.
Table 3–7. Stratix IV Performance and Resource Utilization
Components
Combinational
ALUTs
Memory
ALUTs
Logic
Registers
Memory Block
(M9K)
f
MAX
(MHz)
MAC4,054364,7106156.25
Loopback29301824156.25
RX SC FIFO23102105156.25
TX SC FIFO21202104156.25
Hard XAUI PHY1,89201,2150156.25
MDIO11601330156.25
JTAG Master52304401156.25
Address Swapper660710156.25
Qsys Fabric99321,0180156.25
Total Resource Utilization7,840388,01920156.25
Tab le 3– 8 provides the estimated performance and resource utilization of the 10GbE
design example obtained by compiling the design with the Quartus II software
targeting the Cyclone V GX (5CGXFC7D6F31C6) device with speed grade –6.
Table 3–8. Cyclone V Performance and Resource Utilization
Components
Combinational
ALUTs
Logic Registers
Memory Block
(M10K)
f
MAX
(MHz)
MAC4,4175,4646156.25
Loopback2911994156.25
RX SC FIFO2422314156.25
TX SC FIFO2152324156.25
MDIO1181440156.25
Soft XAUI1,6421,7503156.25
JTAG Master5374681156.25
Address Swapper66710156.25
Qsys Fabric4446881156.25
Total Resource Utilization7,9729,24723156.25
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
3–20Chapter 3: 10GbE MAC Design Examples
10GbE Design Example Compilation and Verification in Hardware
Tab le 3– 9 provides the estimated performance and resource utilization of the 10GbE
design example obtained by compiling the design with the Quartus II software
targeting the Stratix V GX (5SGXEA7N2F40C2ES) device with speed grade –2.
Table 3–9. Stratix V Performance and Resource Utilization
Components
Combinational
ALUTs
Memory ALUTsLogic Registers
Memory Block
(M9K)
f
MAX
(MHz)
MAC4,110175,2124156.25
Loopback29001874156.25
RX SC FIFO23402362156.25
TX SC FIFO22002462156.25
MDIO11501460156.25
10GBASE-R PHY 11201140156.25
JTAG Master51905081156.25
Address Swapper660740156.25
Qsys Fabric44106790156.25
Total Resource Utilization6,10707,40213156.25
Tab le 3– 10 provides the estimated performance and resource utilization of the design
example with the IEEE 1588v2 feature enabled, obtained by compiling the design with
the Quartus II software targeting a Stratix V (5SGTMC5K2F40C2) device with speed
grade -2.
Table 3–10. Stratix V Performance and Resource Utilization with IEEE 1588v2 Feature
Components
Combinational
ALUTs
Logic Registers
Memory Block
(M20K)
DSP Blockf
MAX
(MHz)
MAC 6,8227,459102156.25
Loopback29126440156.25
10GBASE-R PHY 1,0661,67560156.25
Time-of-Day (ToD) Clock8122,26800156.25
Transceiver
Reconfiguration
1,24587160156.25
Qsys Fabric837300156.25
Total Resource Utilization10,31912,610262156.25
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
This section describes the 10GbE MAC with IEEE 1588v2 design example, testbench
and its components.
110GBASE-R PHY does not support Stratix III devices.
4.1. Software Requirements
Altera uses the following software to test the 10GbE with IEEE 1588v2 design example
and testbench:
■ Quartus II software 13.1
■ ModelSim-SE 10.0b or higher
4. 10GbE MAC with IEEE1588v2 Design
Example
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
4–2Chapter 4: 10GbE MAC with IEEE1588v2 Design Example
Ethernet
Packet
Classifier
Pulse Per
Second
Module
Time of
Day
Clock
Time of Day
10GbE MAC
Avalon MM Master
Translator
Client Application
(Configuration,
Status & Statistics)
Transceiver
Reconfiguration
Controller
10GBASE-R PHY
External PHY
10GBASE-R
72-Bit SDR
XGMII
64-Bit
Avalon ST
Time
of Day
32-Bit
Avalon MM
Reconfiguration
32-Bit
Avalon MM
64-Bit
Avalon ST
Pulse Per
Second
Timestamp &
Fingerprint
Client Application
Altera FPGA
Design Example
Ethernet Loopback
72-Bit SDR
XGMII
10GbE with IEEE 1588v2 Design Example Components
4.2. 10GbE with IEEE 1588v2 Design Example Components
You can use the 10GbE MAC IP core design example to simulate a complete 10GbE
with IEEE 1588v2 design in a simulator. You can compile the design example using
the Quartus II software and program the targeted Altera device after a successful
compilation.
Figure 4–1 shows the block diagram of the 10GbE with IEEE 1588v2 design example.
Figure 4–1. 10GbE with IEEE 1588v2 Design Example Block Diagram
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 4: 10GbE MAC with IEEE1588v2 Design Example4–3
10GbE with IEEE 1588v2 Design Example Components
The 10GbE with IEEE 1588v2 design example comprises the following components:
■ Altera Ethernet 10G design example—the default 10G design example that has the
following settings:
■10GbE Ethernet MAC—the MAC IP core with IEEE 1588v2 option enabled.
■10GBASE-R PHY—the PHY IP core with IEEE 1588v2 option enabled.
■Ethernet Loopback—the loopback module provides a mechanism for you to
verify the functionality of the MAC and PHY.
■MDIO and FIFO features turned off.
■ Transceiver Reconfiguration Controller—dynamically calibrates and reconfigures
the features of the PHY IP cores.
■ Ethernet Packet Classifier—decodes the packet type of incoming PTP packets and
returns the decoded information to the 10GbE Ethernet MAC.
■ Ethernet Time-of-Day (ToD) Clock—provides 64-bits and/or 96-bits time-of-day to
TX and RX of 10GbE Ethernet MAC.
■ Pulse Per Second Module—returns pulse per second (pps) to user.
■ Avalon MM Master Translator—provides access to the registers of the following
components through the Avalon-MM interface:
■MAC and Ethernet Loopback
■Transceiver Reconfiguration Controller
■ToD
f For more information about ToD clock, refer to Appendix B, Time-of-Day (ToD)
Clock; and for more information about Packet Classifier, refer to Appendix C, Packet
Classifier.
4.2.1. Base Addresses
Tab le 4– 1 lists the design example components that you can reconfigure to suit your
verification objectives. To reconfigure the components, write to their registers using
the base addresses listed in the table and the register offsets described in the
components' user guides.
Table 4–1. Base Addresses of 10GbE with IEEE 1588v2 Design Example Components
ComponentBase Address
MAC and Ethernet Loopback0x00000
Transceiver Reconfiguration Controller0x80400
Time of Day Clock0x81000
1This design example uses a 19-bit width address bus to access the base address of
components other than the MAC.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
4–4Chapter 4: 10GbE MAC with IEEE1588v2 Design Example
10GbE with IEEE 1588v2 Design Example Files
4.3. 10GbE with IEEE 1588v2 Design Example Files
Tab le 4– 2 shows the directory structure for the 10GbE with IEEE 1588v2 design
examples and testbenches.
Figure 4–2. 10GbE with IEEE 1588v2 Design Example Folders
<ip_lib>/ethernet/altera_eth_10g_design_example
altera_eth_10g_mac_base_r_1588
testbench
Tab le 4– 2 lists the files in the
Table 4–2. 10GbE with IEEE 1588v2 Design Example Files
File NameDescription
altera_eth_10g_mac_base_r_1588_top.v
altera_eth_10g_mac_base_r_1588_top.sdc
altera_eth_10g_mac_base_r_1588.qsys
..\altera_eth_10g_mac_base_r_1588 directory.
The top-level entity file of the design example for
verification in hardware.
The Quartus II SDC constraint file for use with
the TimeQuest timing analyzer.
A Qsys file for the 10GbE MAC and 10GBASE-R
PHY design example with IEEE 1588v2 option
enabled.
4.4. Creating a New 10GbE with IEEE 1588v2 Design
You can use the Quartus II software to create a new 10GbE with IEEE 1588v2 design.
Altera provides a Qsys design example file that you can customize to facilitate the
development of your 10GbE with IEEE 1588v2 design.
To create the design, perform the following steps:
1. Launch the Quartus II software and open the
altera_eth_10g_mac_base_r_1588_top.v file from the project directory.
2. Launch Qsys from the Tools menu and open the
altera_eth_10g_mac_base_r_1588.qsys file. By default, the design example targets
the Stratix V device family. To change the target device family, click on the Project Settings tab and select the desired device from the Device family list.
3. Turn off the additional module under the Use column if your design does not
require it. This action disconnects the module from the 10GbE with IEEE 1588v2
system.
4. Double-click on eth_10g_design_example_0 to launch the parameter editor.
5. Specify the required parameters in the parameter editor.
6. Click Finish.
7. On the Generation tab, select either a Verilog HDL or VHDL simulation model
and make sure that the Create HDL design files for synthesis option is turned on.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 4: 10GbE MAC with IEEE1588v2 Design Example4–5
10GbE with IEEE 1588v2 Testbench
8. Click Generate to generate the simulation and synthesis files.
4.5. 10GbE with IEEE 1588v2 Testbench
Altera provides testbench for you to verify the 10GbE with IEEE 1588v2 design
example. The following sections in this document describe the testbench, its
components, and use.
4.5.1. 10GbE with IEEE 1588v2 Testbench
The testbenches operate in loopback mode. Figure 4–3 shows the flow of the packets.
Figure 4–3. Testbench
Testbench
Ethernet
Packet
Avalon-MM
Control
Register
Monitor
Avalon-MM
Avalon-ST
Transmit
Frame
Generator
Avalon-ST
Receive
Frame
Monitor
avalon_bfm_wrapper.sv
Avalon Driver
Avalon-ST
DUT
Avalon-ST
Ethernet
Packet
Monitor
4.5.2. 10GbE with IEEE 1588v2 Testbench Components
The testbenches comprise the following modules:
■ Device under test (DUT)—the design example.
■ Avalon driver—uses Avalon-ST bus functional models (BFMs) to exercise the
transmit and receive paths. The driver also utilizes the Avalon-MM BFM to access
the Avalon-MM interfaces of the design example components.
■ Packet monitors—monitors the transmit and receive datapaths, and displays the
frames in the simulator console.
Loopback
on XGMII
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
4–6Chapter 4: 10GbE MAC with IEEE1588v2 Design Example
10GbE with IEEE 1588v2 Testbench
4.5.3. 10GbE with IEEE 1588v2 Testbench Files
The <ip
library>/ethernet/altera_eth_10g_design_example/altera_eth_10g_mac_base_r_1588
/testbench directory contains the testbench files.
Tab le 4– 3 describes the files that implement the 10GbE with IEEE 1588v2 testbench.
Table 4–3. 10GbE with IEEE 1588v2 Testbench Files
File NameDescription
avalon_bfm_wrapper.sv
avalon_driver.sv
avalon_if_params_pkg.sv
avalon_st_eth_packet_monitor.sv
default_test_params_pkg.sv
eth_mac_frame.sv
eth_register_map_params_pkg.sv
ptp_timestamp.sv
tb_run_simulation.tcl
tb_testcase.sv
tb_top.sv
wave.do
A wrapper for the Avalon BFMs that the avalon_driver.sv file
uses.
A SystemVerilog HDL driver that utilizes the BFMs to exercise
the transmit and receive path, and access the Avalon-MM
interface.
A SystemVerilog HDL testbench that contains parameters to
configure the BFMs. Because the configuration is specific to
the DUT, you must not change the contents of this file.
A SystemVerilog HDL testbench that monitors the Avalon-ST
transmit and receive interfaces.
A SystemVerilog HDL package that contains the default
parameter settings of the testbench.
A SystemVerilog HDL class that defines the Ethernet frames.
The avalon_driver.sv file uses this class.
A SystemVerilog HDL package that maps addresses to the
Avalon-MM control registers.
A SystemVerilog HDL class that defines the timestamp in the
testbench.
A Tcl script that starts a simulation session in the ModelSim
simulation software.
A SystemVerilog HDL testbench file that controls the flow of
the testbench.
The top-level testbench file. This file includes the customized
10GbE MAC, which is the device under test (DUT), a client
packet generator, and a client packet monitor along with
other logic blocks.
A signal tracing macro script for use with the ModelSim
simulation software to display testbench signals.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 4: 10GbE MAC with IEEE1588v2 Design Example4–7
10GbE with IEEE 1588v2 Testbench
4.5.4. 10GbE with IEEE 1588v2 Testbench Simulation Flow
Upon a simulated power-on reset, each testbench performs the following operations:
1. Initializes the DUT by configuring the following options through the Avalon-MM
interface:
■Configures the MAC. In the MAC, enables address insertion on the transmit
path and sets the transmit and receive primary MAC address to EE-CC-88-CCAA-EE. Also enables CRC insertion on transmit path.
■Configures Timestamp Unit in the MAC, by setting periods and path delay
adjustments of the clocks.
■Configures ToD clock by loading a predefined time value.
■Configures clock mode of Packet Classifier to Ordinary Clock mode.
2. Starts packet transmission with different clock mode. The testbench sends a total
of four packets:
■64-byte basic Ethernet frames
■1-step PTP Sync message over Ethernet
■1-step PTP Sync message over UDP/IPv4 with VLAN tag
■2-step PTP Sync message over UDP/IPv6 with stacked VLAN tag
3. Configures clock mode of Packet Classifier to End-to-end Transparent Clock
mode.
4. Starts packet transmission. The testbench sends a total of three packets:
■1-step PTP Sync message over Ethernet
■2-step PTP Sync message over UDP/IPv4 with VLAN tag
■1-step PTP Sync message over UDP/IPv6 with stacked VLAN tag
5. Ends the transmission.
4.5.5. Simulating 10GbE with IEEE 1588v2 Testbench with ModelSim
Simulator
To use the ModelSim simulator to simulate the testbench design, follow these steps:
1. Copy the respective design example directory to your preferred project directory:
altera_eth_10g_mac_base_r_1588 from
<ip library>/ethernet/altera_eth_10g_design_example.
2. Launch Qsys from the Tools menu and open the
altera_eth_10g_mac_base_r_1588.qsys file.
3. On the Generation tab, select either a Verilog HDL or VHDL simulation model.
4. Click Generate to generate the simulation and synthesis files.
5. Run the following command to set up the required libraries, to compile the
generated IP Functional simulation model, and to exercise the simulation model
with the provided testbench:
do tb_run_simulation.tcl
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
r
5. 1G/10GbE MAC Design Example
This section describes the 1G/10GbE MAC with Backplane Ethernet Backplane
Ethernet 10GBASE-KR PHY design example, the testbench, and its components. You
can configure the Backplane Ethernet 10GBASE-KR PHY IP to the following modes:
■ Backplane-KR mode to interface with copper backplane
■ 1G/10Gb Ethernet mode to interface with optical SFP+ modules or copper PHY
devices
1Backplane Ethernet 10GBASE-KR PHY only supports Arria V GZ and Stratix V
devices.
5.1. Software and Hardware Requirements
Altera uses the following hardware and software to test the 1G/10GbE design
example and testbench:
■ Altera Complete Design Suite 13.0
■ Backplane Ethernet 10GBASE-KR PHY
■ Transceiver Signal Integrity Development Kit, Stratix V GX Edition
■ ModelSim-AE 6.6c, ModelSim-SE 6.6c or higher
1The 1G/10GbE mode is only supported in the production silicon version of the
development board.
f For more information about the development kit, refer to Transceiver Signal Integrity
Development Kit, Stratix V GX Edition User Guide.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
5–2Chapter 5: 1G/10GbE MAC Design Example
System Console
(for Debugging)
Client Application
(Configuration, Status,
and Statistics)
JTAG to Avalon
Master Bridge
Pipeline Bridge
Configuration and Debugging Tools
PHY IP
Reset Controller
PHY IP
Reset Controller
1G/10GbE MAC
10GBASE-KR PHY
External PHY
64-Bit
Avalon-ST
GIGE/
10GBASE-R
TX FIFO
Buffer
RX FIFO
Buffer
Avalon-ST Single-Clock FIFO
64
64
1G/10GbE MAC
10GBASE-KR PHY
External PHY
64-Bit
Avalon-ST
GIGE/
10GBASE-R
TX FIFO
Buffer
RX FIFO
Buffer
Avalon-ST Single-Clock FIFO
64
64
Reconfiguration
Bundle
Altera FPGA
1G/10GbE Design Example Components
5.2. 1G/10GbE Design Example Components
You can use the 1G/10GbE MAC IP core design example to simulate a complete
1G/10GbE design in an Altera FPGA. You can compile the design example using the
simulation files generated by the Quartus II software and program the targeted Altera
device after a successful compilation.
Figure 5–1 shows the block diagram of a two-channel 1G/10GbE design example.
Figure 5–1. Two-Channel 1G/10GbE Design Example Block Diagram
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 5: 1G/10GbE MAC Design Example5–3
Single-Clock
FIFO
Single-Clock
FIFO
PLL
JTAG to Avalon
Master Bridge
Pipeline
Bridge
10GBASE-KR
PHY
1G/10GbE
MAC
Configure
Reconfig
gmii_rx_clk
gmii_tx_clk
rx_coreclkin_1g
rx_clkout_1g
xgmii_rx_clk
tx_clkout_1g
xgmii_tx_clk
tx_coreclkin_1g
rx_clk
ref clk
322.265625
ref clk
125
mm clk
100
tx_clk
125 Mhz
125 Mhz
156.25 Mhz
Reconfiguration
Bundle
PHY IP
Reset Controller
1G/10GbE Design Example Components
Figure 5–2 shows the clocking scheme for the design example.
Figure 5–2. 1G/10GbE Design Example Clocking Scheme
The 1G/10GbE design example comprises the following components:
■ 1G/10GbE Ethernet MAC—the MAC IP core with default settings. This IP core
includes memory-based statistics counters.
■ Backplane Ethernet 10GBASE-KR PHY—the PHY IP core operating as either
■ Reconfiguration Bundle—comprises the reconfiguration controller that switches
1000BASE-X PHY or 10GBASE-R PHY.
the speed between 1 Gbps and 10 Gbps, and the management ROM that stores
MIF information for 1/10GbE PHY or HSSI or hard PCS. This block arbitrates the
access to the reconfiguration controller and requests the reconfiguration controller
to start streaming MIF information.
■ Single-Clock FIFO—Avalon-ST Single-Clock RX and TX FIFO cores that buffer
receive and transmit data between the MAC and the client. These FIFO buffers are
64 bits wide and 2048 bits deep. The Single-Clock FIFO operates in store and
forward mode, and you can configure it to provide packet-based flushing when an
error occurs.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
5–4Chapter 5: 1G/10GbE MAC Design Example
1G/10GbE Design Example Components
1To enable the Avalon-ST Single-Clock FIFO to operate in cut through mode,
turn off the Use store and forward parameter in the Avalon-ST Single
Clock FIFO parameter editor.
■ PHY IP Reset Controller—configurable IP core that you can use to reset the
transceivers. Refer to the Transceiver PHY Reset Controller IP Core chapter in the
Altera Transceiver PHY IP Core User Guide for more information.
■ Configure Reconfiguration Block—provides the Avalon-MM interface to drive the
reconfiguration bundle component to switch speed.
1This component is required only if the automatic speed detection parameter
in the Backplane Ethernet 10GBASE-KR PHY is not enabled.
5.2.1. Reconfiguration Bundle Parameters
Tab le 5– 1 lists the parameters for the reconfiguration bundle block.
Table 5–1. Reconfiguration Bundle Parameters
ParameterDescription
PMA_RD_AFTER_WRITE
CHANNELS
PLLS
SYNTH_1588_1G
SYNTH_1588_10G
KR_PHY_SYNTH_LT
KR_PHY_SYNTH_AN
KR_PHY_SYNTH_GIGE
Always set this parameter to 0.
The number of channels instantiated for the Backplane Ethernet
10GBASE-KR PHY IP.
The number of PLLs.
If you turn on the 1G mode in the Backplane Ethernet 10GBASE-KR
PHY IP, this value will be two times the value of the CHANNELS
parameter.
Set this parameter to 1 if you use 1G mode with the 1588 options
turned on in the Backplane Ethernet 10GBASE-KR PHY IP.
Set this parameter to 1 if you use 10G mode with the 1588 options
turned on in the Backplane Ethernet 10GBASE-KR PHY IP.
Set this parameter to 1 if the Enable Link Training (LT) option is
turned on in the Backplane Ethernet 10GBASE-KR PHY IP.
Set this parameter to 1 if the Enable Auto Negotiation (AN) option is
turned on in the Backplane Ethernet 10GBASE-KR PHY IP.
Set this parameter to 1 if you use 1G mode in the Backplane Ethernet
10GBASE-KR PHY IP.
5.2.2. Base Addresses
Tab le 5– 2 lists the design example components that you can configure to suit your
verification objectives. To configure the components, write to their registers using the
base addresses listed in the table and the register offsets described in the components'
user guides.
Table 5–2. Base Addresses of 1G/10GbE Design Example Components
ComponentBase Address
1G/10GbE MAC Channel 00x00000
1G/10GbE MAC Channel 10x20000
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 5: 1G/10GbE MAC Design Example5–5
1G/10GbE Design Example Files
Table 5–2. Base Addresses of 1G/10GbE Design Example Components
1This design example uses a 19-bit width address bus to access the base address of
components other than the MAC.
f For more information about the 10GBASE-KR, refer to the 10GBASE-KR PHY IP Core
chapter in the Altera Transceiver PHY IP Core User Guide.
5.3. 1G/10GbE Design Example Files
Figure 5–3 shows the directory structure for the 1G/10GbE design examples and
testbenches.
Figure 5–3. 1G/10GbE Design Example Folders
<ip_lib>/ethernet/altera_eth_10g_design_example
altera_eth_10g_mac_base_kr
Tab le 5– 3 lists the files in the
Table 5–3. 1G/10GbE Design Example Files
File NameDescription
altera_eth_10g_mac_base_kr_top.v
altera_eth_10g_mac_base_kr_top.sdc
setup_proj.tcl
altera_eth_10g_mac_base_kr.qsys
reconfig.v
..\altera_eth_10g_mac_base_kr directory.
testbench
reconfig
The top-level entity file of the design example for
verification in hardware.
The Quartus II SDC constraint file for use with
the TimeQuest timing analyzer.
A Tcl script that creates a new Quartus II project
and sets up the project environment for your
design example.
A Qsys file for the 1G/10GbE MAC and 10G
BASE-KR PHY design example with the
Quartus II software targeting the Stratix V device.
A top-level entity file for the transceiver
reconfiguration controller IP.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
5–6Chapter 5: 1G/10GbE MAC Design Example
Creating a New 1G/10GbE Design
5.4. Creating a New 1G/10GbE Design
You can use the Quartus II software to create a new 1G/10GbE design. Altera
provides a Qsys design example file that you can customize to facilitate the
development of your 1G/10GbE design.
To create the design, perform the following steps:
1. Launch the Quartus II software and open the altera_eth_10g_mac_base_kr_top.v
file from the project directory.
2. Open the Quartus II Tcl Console window by pointing to Utility Windows on the
View menu and then selecting Tcl Co ns ol e. In the Quartus II Tcl Console window,
type the following command to set up the project environment and load the
necessary pins assignment for Stratix V GX signal integrity development kit
board:
source setup_proj.tcl
f For more information about the development kit, refer to Signal Integrity
Development Kit, Stratix V GX Edition User Guide.
3. Launch Qsys from the Tools menu and open the
altera_eth_10g_mac_base_kr.qsys file.
1At this point you can edit the settings to suit your design using the
parameter editor.
4. Click Finish.
5. On the Generation tab, select either a Verilog HDL or VHDL simulation model
and make sure that the Create HDL design files for synthesis option is turned on.
6. Click Generate to generate the simulation and synthesis files.
7. Launch the MegaWizard Plug-in Manager from the Tools menu. Select Edit an
existing custom megafunction variation and regenerate reconfig.v from the
reconfig folder.
8. Click Finish.
5.5. 1G/10GbE Testbench
r
Altera provides testbench for you to verify the 1G/10GbE design example. The
following sections describe the testbench, its components, and use.
5.5.1. 1G/10GbE Testbench
The testbench operates in loopback mode. Figure 5–4 shows the flow of the packets in
the design example.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 5: 1G/10GbE MAC Design Example5–7
1G/10GbE Testbench
Figure 5–4. 1G/10GbE Testbench Block Diagram
Testbench
Ethernet
Packe t
Avalon-MM
Control
Register
Avalon-ST
Transmit
Frame
Generator
Monitor
Avalon-ST
DUT
Avalon-MM
Ordinary Clock
Channel-0
Loopback
on Serial
Avalon-ST
Receive
Frame
Monitor
avalon_bfm_wrapper.sv
Avalon Driver
Avalon-ST
Ethernet
Packe t
Monitor
5.5.2. 1G/10GbE Testbench Components
The testbenches comprise the following modules:
■ Device under test (DUT)—the design example.
■ Avalon driver—uses Avalon-ST master bus functional models (BFMs) to exercise
the transmit and receive paths. The driver also uses the Avalon-MM master BFM
to access the Avalon-MM interfaces of the design example components.
■ Packet monitors—monitors the transmit and receive datapaths, and displays the
frames in the simulator console.
5.5.3. 1G/10GbE Testbench Files
The <ip library>/ethernet/altera_eth_10g_design_example/testbench directory
contains the testbench files.
Channel-1
Transparent Clock
Tab le 5– 4 describes the files that implement the 1G/10GbE testbench.
Table 5–4. 1G/10GbE Testbench Files
File NameDescription
avalon_bfm_wrapper.sv
A wrapper for the Avalon BFMs that the avalon_driver.sv file
uses.
A SystemVerilog HDL driver that utilizes the BFMs to exercise
avalon_driver.sv
the transmit and receive path, and access the Avalon-MM
interface.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
5–8Chapter 5: 1G/10GbE MAC Design Example
1G/10GbE Testbench
Table 5–4. 1G/10GbE Testbench Files
File NameDescription
A SystemVerilog HDL testbench that contains parameters to
avalon_if_params_pkg.sv
configure the BFMs. Because the configuration is specific to
the DUT, you must not change the contents of this file.
avalon_st_eth_packet_monitor.sv
eth_mac_frame.sv
eth_register_map_params_pkg.sv
tb_run.tcl
A SystemVerilog HDL testbench that monitors the Avalon-ST
transmit and receive interfaces.
A SystemVerilog HDL class that defines the Ethernet frames.
The avalon_driver.sv file uses this class.
A SystemVerilog HDL package that maps addresses to the
Avalon-MM control registers.
A Tcl script that starts a simulation session in the ModelSim
simulation software.
The top-level testbench file. This file includes the customized
tb.sv
1G/10GbE design example, which is the device under test
(DUT), a client packet generator, and a client packet monitor
along with other logic blocks.
wave.do
A signal tracing macro script for use with the ModelSim
simulation software to display testbench signals.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 5: 1G/10GbE MAC Design Example5–9
1G/10GbE Testbench
5.5.4. 1G/10GbE Testbench Simulation Flow
The 1G/10GbE testbench provides two modes for simulation:
■ 1G/10Gb Ethernet mode
■ Backplane-KR mode
By default the testbench runs in 1G/10Gb Ethernet mode.
To switch to backplane-KR mode, open the tb.sv file and specify the
MODE_1G10G_KR_BAR
5.5.4.1. 1G/10Gb Ethernet Mode
Upon a simulated power-on reset, the testbench performs the following operations:
1. Initializes the DUT by configuring the following options through the Avalon-MM
interface:
a. Changes both channel 1 and channel 0 to be operating speed at 10 Gbps.
b. Configures the MAC. In the MAC, enables address insertion on the transmit
path and sets the transmit primary MAC address to EE-CC-88-CC-AA-EE.
parameter to 0.
c. In the TX and RX FIFO buffers (Avalon-ST Single Clock FIFO core), enables
drop on error.
d. Waits for both the MAC and PHY to be ready to receive data.
2. Starts packet transmission. The testbench sends a total of eight packets:
a. Three 64-byte basic Ethernet frames
b. 1518-byte VLAN frame
c. 1518-byte basic Ethernet frame
d. 64-byte stacked VLAN frame
e. 500-byte VLAN frame
f. 1518-byte stacked VLAN frame
3. Displays the MAC statistics in the transcript panel.
4. Changes the operating speed for both channels.
a. Changes the operating speed for both channels to 1 Gbps.
b. Disables clause 37 auto-negotiation for both channels.
c. Waits for both the MAC and PHY to be ready to receive data
5. Starts packet transmission. The testbench sends a total of eight packets:
a. Three 64-byte basic Ethernet frames
b. 1518-byte VLAN frame
c. 1518-byte basic Ethernet frame
d. 64-byte stacked VLAN frame
e. 500-byte VLAN frame
f. 1518-byte stacked VLAN frame
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
5–10Chapter 5: 1G/10GbE MAC Design Example
1G/10GbE Testbench
6. Displays the MAC statistics in the transcript panel.
5.5.4.2. Backplane-KR Mode
To run backplane-KR mode in simulation, perform the following steps:
1. Open the altera_eth_10g_mac_base_kr.qsys file and edit the following
10GBASE-KR PHY instances of channels 1 and 0:
■IP variant = Backplane-KR
■Turn o n Enable Automatic Speed Detection.
■Turn o n Enable Auto-negotiation.
■Regenerate the Qsys system.
2. Change the default setting to backplane-KR mode.
3. Run simulation.
Upon a simulated power-on reset, the testbench performs the following operations:
1. Initializes the DUT by configuring the following options via the Avalon-MM
interface:
a. Configures the MAC. In the MAC, enables address insertion on the transmit
path and sets the transmit primary MAC address to EE-CC-88-CC-AA-EE.
b. In the TX and RX FIFO buffers (Avalon-ST Single Clock FIFO core), enables
drop on error.
c. Checks if auto-negotiation status is completed.
d. Waits for both the MAC and PHY to be ready to receive data.
2. Starts packet transmission. The testbench sends a total of eight packets:
a. Three 64-byte basic Ethernet frames
b. 1518-byte VLAN frame
c. 1518-byte basic Ethernet frame
d. 64-byte stacked VLAN frame
e. 500-byte VLAN frame
f. 1518-byte stacked VLAN frame
3. Displays the MAC statistics in the transcript panel.
5.5.5. Simulating the 1G/10GbE Testbench with the ModelSim Simulator
To use the ModelSim simulator to simulate the 1G/10GbE testbench design, perform
the following steps:
1. Copy the
<ip library>/ethernet/altera_eth_10g_design_example/altera_eth_10g_mac_bas
e_kr directory to your preferred project directory.
2. The design example and testbench files are set to read only. Altera recommends
that you turn off the read-only attribute of all design example and testbench files.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 5: 1G/10GbE MAC Design Example5–11
1G/10GbE Testbench
3. Launch the Quartus II software and open the altera_eth_10g_mac_base_kr_top.v
file from the project directory.
4. Open the Quartus II Tcl Console window by pointing to Utility Windows on the
View menu and then selecting Tcl Co ns ol e. In the Quartus II Tcl Console window,
type the following command to set up the project environment:
source setup_proj.tcl
r
5. Launch Qsys from the Tools menu and open altera_eth_10g_mac_base_kr.qsys in
the File menu.
6. On the Generation tab, select Verilog simulation model.
By default, the system will be running in 1G/10Gb Ethernet mode. To run in
backplane-KR mode, edit the following Backplane Ethernet 10GBASE-KR PHY
instances of channels 1 and 0:
■IP variant = Backplane-KR
■Turn o n Enable Automatic Speed Detection.
■Turn o n Enable Auto-negotiation.
7. Click Generate to generate the system.
8. Launch the ModelSim simulator software.
9. Change the working directory to <project directory>/<design example directory>/testbench in the File menu.
10. 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:
do tb_run.tcl
r
By default the system will be running in 1G/10Gb Ethernet mode. To run in
backplane-KR mode, open the tb.sv file and change the
MODE_1G10G_KR_BAR
parameter to 0, then run the command.
11. The ModelSim transcript pane in Main window displays messages from the
testbench reflecting the current task being performed.
Upon a successful simulation, the simulator displays the following
and
TX Statistics
# framesOK = 8
# framesErr = 0
# framesCRCErr = 0
# octetsOK = 5142
# pauseMACCtrlFrames = 0
# ifErrors = 0
# unicastFramesOK = 6
# unicastFramesErr = 0
# multicastFramesOK = 1
# multicastFramesErr = 0
# broadcastFramesOK = 1
:
RX Statistics
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
5–12Chapter 5: 1G/10GbE MAC Design Example
csr_clk_clk
csr_reset_reset_n
csr_address [18:0]
csr_read
csr_readdata [31:0]
csr_write
csr_writedata [31:0]
csr_waitrequest
40084
00000002
1G/10GbE Testbench
# broadcastFramesErr = 0
# etherStatsOctets = 5310
# etherStatsPkts = 8
# etherStatsUndersizePkts = 0
# etherStatsOversizePkts = 0
# etherStatsPkts64Octets = 4
# etherStatsPkts65to127Octets = 0
# etherStatsPkts128to255Octets = 0
# etherStatsPkts256to511Octet = 1
# etherStatsPkts512to1023Octets = 0
# etherStatsPkts1024to1518Octets = 3
# etherStatsPkts1519OtoXOctets = 0
# etherStatsFragments = 0
# etherStatsJabbers = 0
# etherStatsCRCErr = 0
# unicastMACCtrlFrames = 0
# multicastMACCtrlFrames = 0
# broadcastMACCtrlFrames = 0
1The same message will appear twice if you use 1G/10G Ethernet mode
because the system resets the statistic counters after changing the MAC
operating speed.
5.5.6. 1G/10GbE Simulation Timing Diagrams
Figure 5–5 shows the reset and initial configuration sequence. The first read or write
transaction must be at least one clock cycle after the
completes.
Figure 5–5. Reset and Configuration
csr_reset_reset_n
signal
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 5: 1G/10GbE MAC Design Example5–13
1G/10GbE Design Example Compilation
5.6. 1G/10GbE Design Example Compilation
You can use the Quartus II software to compile the 1G/10GbE design example and
program the targeted Altera device after a successful compilation.
5.6.1. Compiling the 1G/10GbE Design
Perform the following steps to compile the design and program the device:
2. Launch the Quartus II software and open altera_eth_10g_mac_base_kr_top.v
from the project directory.
3. Open the Quartus II Tcl Console window by pointing to Utility Windows on the
View menu then clicking Tc l Co ns o le . In the Quartus II Tcl Console window, type
the following command to set up the project environment and load pin
assignments and I/O standard for the development kit:
source setup_proj.tcl
f For more information about the development kit, refer to Signal Integrity
Development Kit, Stratix V GX Edition User Guide.
4. Launch Qsys from the Tools menu and open altera_eth_10g_mac_base_kr.qsys.
5. Click Save on the File menu.
6. On the Generation tab, turn on Create Synthesis RTL Files.
7. Click Generate to generate the system.
8. Click Start Compilation on the Processing menu to compile the design example.
9. Upon a successful compilation, click Programmer on the Tools menu to program
the device.
10. Launch the MegaWizard Plug-in Manager. Select Edit an existing custom megafunction variation and regenerate reconfig.v from the reconfig folder.
1If you want to share the PLL clock, connect the
controller to the
Ethernet 10GBASE-KR PHY IP.
For example, the
pll_powerdown
10GBASE-KR PHY IP.
pll_powerdown
pll_powerdown
signal from channel 0 and channel 1 of the Backplane Ethernet
r
signal from different channels of the Backplane
signal from reset controller 0 connects to the
pll_powerdown
signal from the reset
For more information about device programming, refer to Quartus II Programmer in
volume 3 of the Quartus II Handbook.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
5–14Chapter 5: 1G/10GbE MAC Design Example
1G/10GbE Design Example Compilation
5.6.2. 1G/10GbE Design Performance and Resource Utilization
Tab le 5– 5 provides the estimated performance and resource utilization of the
1G/10GbE design example obtained by compiling the design with the Quartus II
software targeting the Stratix V GX (EP5SGXEA7N2F40C2) device with speed grade
–2.
Table 5–5. Stratix V Performance and Resource Utilization
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
6. 10M-10GbE MAC with IEEE 1588v2
Design Example
This section describes the 10M/100M/1G/10 Gbps Ethernet (10M-10GbE) MAC with
IEEE 1588v2 design example, the testbench, and its components.
6.1. Software and Hardware Requirements
Altera uses the following hardware and software to test the 10M-10GbE MAC with
IEEE 1588v2 design example and testbench:
■ Altera Complete Design Suite 13.0
■ Stratix V GX FPGA Development Kit
■ ModelSim-SE 10.0b or higher
6.2. 10M-10GbE MAC with IEEE 1588v2 Design Example Components
You can use the 10M-10GbE MAC IP core design example to simulate a complete
10M-10GbE MAC with IEEE 1588v2 design in a simulator. You can compile the design
example using the Quartus II software and program the targeted Altera device after a
successful compilation.
Figure 6–1 shows the block diagram of a 10M-10GbE MAC with IEEE 1588v2 design
example.
1For the purpose of simplification, this diagram shows only one of the two channels in
the design example. Each channel has its own components but they share the
Avalon-MM Master Translator and Reconfiguration Bundle blocks.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
6–2Chapter 6: 10M-10GbE MAC with IEEE 1588v2 Design Example
Ethernet
Packe t
Classifier
Pulse Per
Second
Module
Time of
Day
Clock
Time of Day
1M/100M/1G/10G MAC
Avalon MM Master
Translator
Client Application
(Configuration,
Status & Statistics)
Reconfiguration
Bundle
10GBASE-KR PHY
External PHY
10GBASE-KR
72-Bit SDR
XGMII/10-bits
GMII
64-Bit
Avalon ST
Time
of Day
32-Bit
Avalon MM
Reconfiguration
32-Bit
Avalon MM
64-Bit
Avalon ST
Pulse Per
Second
Timestamp &
Fingerprint
Client Application
Altera FPGA
Design Example
10M-10GbE MAC with IEEE 1588v2 Design Example Components
Figure 6–1. 10M-10GbE MAC with IEEE 1588v2 Design Example Block Diagram
The 10M-10GbE MAC with IEEE 1588v2 design example comprises the following
components:
■ Altera Ethernet 10M-10GbE design example—the default 1G/10G design that has
■ Backplane Ethernet 10GBASE-KR PHY—the PHY IP core with IEEE 1588v2 option
■ Reconfiguration Bundle—comprises the reconfiguration controller that switches
■ Ethernet Packet Classifier—decodes the packet type of incoming PTP packets and
the following parameter settings:
enabled.
■10M-10GbE Ethernet MAC—the MAC IP core with IEEE 1588v2 option
■MDIO and FIFO features turned off.
enabled.
the speed between 1 Gbps and 10 Gbps, and the management ROM that stores
MIF information for 1/10GbE PHY or HSSI or hard PCS. This block arbitrates the
access to the reconfiguration controller and requests the reconfiguration controller
to start streaming MIF information.
returns the decoded information to the 10M-10GbE MAC.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 6: 10M-10GbE MAC with IEEE 1588v2 Design Example6–3
10M-10GbE MAC with IEEE 1588v2 Design Example Files
■ Ethernet ToD Clock—provides 64-bits and/or 96-bits time-of-day to TX and RX of
10GbE Ethernet MAC.
■ Pulse Per Second Module—returns pulse per second (pps) to user.
■ Avalon-MM Master Translator—provides access to the registers of the following
components through the Avalon-MM interface:
■MAC
■Backplane Ethernet 10GBASE-KR PHY
■Transceiver Reconfiguration Controller
■ToD C l ock
6.2.1. Base Addresses
Tab le 6– 1 lists the design example components that you can reconfigure to suit your
verification objectives. To reconfigure the components, write to their registers using
the base addresses listed in the table and the register offsets described in the
components' user guides.
Table 6–1. Base Addresses of 10M-10GbE MAC with IEEE 1588v2 Design Example Components
1This design example uses a 19-bit width address bus to access the base address of
components other than the MAC.
6.3. 10M-10GbE MAC with IEEE 1588v2 Design Example Files
Figure 6–2 shows the directory structure for the 10M-10GbE MAC with IEEE 1588v2
design examples and testbenches.
Figure 6–2. 10M-10GbE MAC with IEEE 1588v2 Design Example Folders
<ip_lib>/ethernet/altera_eth_10g_design_example
altera_eth_10g_mac_base_kr_1588
testbench
reconfig
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
6–4Chapter 6: 10M-10GbE MAC with IEEE 1588v2 Design Example
Creating a New 10M-10GbE MAC with IEEE 1588v2 Design
Tab le 6– 2 lists the files in the ..\altera_eth_10g_mac_base_kr_1588 directory.
Table 6–2. 10M-10GbE MAC with IEEE 1588v2 Design Example Files
File NameDescription
altera_eth_10g_mac_base_kr_1588_top.sv
altera_eth_10g_mac_base_kr_1588_top.sdc
altera_eth_10g_mac_base_kr_1588.qsys
The top-level entity file of the design example for
verification in hardware.
The Quartus II SDC constraint file for use with
the TimeQuest timing analyzer.
A Qsys file for the 10M-10GbE MAC and
10GBASE-KR PHY design example with IEEE
1588v2 option enabled.
6.4. Creating a New 10M-10GbE MAC with IEEE 1588v2 Design
You can use the Quartus II software to create a new 10M-10GbE MAC with IEEE
1588v2 design. Altera provides a Qsys design example file that you can customize to
facilitate the development of your 10M-10GbE MAC with IEEE 1588v2 design.
To create the design, perform the following steps:
1. Launch the Quartus II software and open a new Quartus II Project.
2. Run add_design_example_files.tcl in the Quartus II software to add the required
design example files to the project.
3. Launch Qsys from the Tools menu and open the
altera_eth_10g_mac_base_kr_1588.qsys file.
4. Turn off the additional module under the Use column if your design does not
require it. This action disconnects the module from the 10M-10GbE MAC with
IEEE 1588v2 system.
5. Double-click on eth_10g_design_example_0 and eth_10g_design_example_1 to
launch the parameter editor.
6. Specify the required parameters in the parameter editor.
7. Click Finish.
8. On the Generation tab, select either a Verilog HDL or VHDL simulation model
and make sure that the Create HDL design files for synthesis option is turned on.
9. Click Generate to generate the simulation and synthesis files.
10. Launch the MegaWizard Plug-in Manager from the Tools menu. Select Edit an
existing custom megafunction variation and regenerate reconfig.v from the
reconfig folder.
11. Click Finish.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 6: 10M-10GbE MAC with IEEE 1588v2 Design Example6–5
10M-10GbE with IEEE 1588v2 Testbench
6.5. 10M-10GbE with IEEE 1588v2 Testbench
Altera provides testbench for you to verify the 10M-10GbE with IEEE 1588v2 design
example. The following sections describe the testbench, its components, and use.
6.5.1. 10M-10GbE with IEEE 1588v2 Testbench
The testbench operates in loopback mode. Figure 6–3 shows the flow of the packets in
the design example.
Figure 6–3. Testbench Block Diagram
Testbench
Ethernet
Packe t
Avalon-MM
Control
Register
Avalon-ST
Transmit
Frame
Generator
Monitor
Avalon-ST
DUT
Avalon-MM
Ordinary Clock
Channel-0
Loopback
on Serial
Avalon-ST
Receive
Frame
Monitor
avalon_bfm_wrapper.sv
Avalon Driver
Avalon-ST
Ethernet
Packe t
Monitor
Channel-1
Transparent Clock
6.5.2. 10M-10GbE with IEEE 1588v2 Testbench Components
The testbenches comprise the following modules:
■ Device under test (DUT)—the design example.
■ Avalon driver—uses Avalon-ST master bus functional models (BFMs) to exercise
the transmit and receive paths. The driver also uses the master Avalon-MM BFM
to access the Avalon-MM interfaces of the design example components.
■ Packet monitors—monitors the transmit and receive datapaths, and displays the
frames in the simulator console.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
6–6Chapter 6: 10M-10GbE MAC with IEEE 1588v2 Design Example
10M-10GbE with IEEE 1588v2 Testbench
6.5.3. 10M-10GbE MAC with IEEE 1588v2 Testbench Files
The <ip library>/ethernet/altera_eth_10g_design_example/testbench directory
contains the testbench files.
Tab le 6– 3 describes the files that implement the 10M-10GbE MAC with IEEE 1588v2
testbench.
Table 6–3. 10M-10GbE MAC with IEEE 1588v2 Testbench Files
File NameDescription
avalon_bfm_wrapper.sv
avalon_driver.sv
avalon_if_params_pkg.sv
avalon_st_eth_packet_monitor.sv
default_test_params_pkg.sv
eth_mac_frame.sv
eth_register_map_params_pkg.sv
ptp_timestamp.sv
tb_run.tcl
tb_testcase.sv
tb_top.sv
wave.do
A wrapper for the Avalon BFMs that the avalon_driver.sv file
uses.
A SystemVerilog HDL driver that utilizes the BFMs to exercise
the transmit and receive path, and access the Avalon-MM
interface.
A SystemVerilog HDL testbench that contains parameters to
configure the BFMs. Because the configuration is specific to
the DUT, you must not change the contents of this file.
A SystemVerilog HDL testbench that monitors the Avalon-ST
transmit and receive interfaces.
A SystemVerilog HDL package that contains the default
parameter settings of the testbench.
A SystemVerilog HDL class that defines the Ethernet frames.
The avalon_driver.sv file uses this class.
A SystemVerilog HDL package that maps addresses to the
Avalon-MM control registers.
A SystemVerilog HDL class that defines the timestamp in the
testbench.
A Tcl script that starts a simulation session in the ModelSim
simulation software.
A SystemVerilog HDL testbench file that controls the flow of
the testbench.
The top-level testbench file. This file includes the customized
10M-10GbE MAC, which is the device under test (DUT), a
client packet generator, and a client packet monitor along
with other logic blocks.
A signal tracing macro script for use with the ModelSim
simulation software to display testbench signals.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 6: 10M-10GbE MAC with IEEE 1588v2 Design Example6–7
10M-10GbE with IEEE 1588v2 Testbench
6.5.4. 10M-10GbE MAC with IEEE 1588v2 Testbench Simulation Flow
Upon a simulated power-on reset, the testbench performs the following operations:
1. Initializes the DUT by configuring the following options through the Avalon-MM
interface:
■Changes both channel 1 and channel 0 to be operating speed at 10 Gbps.
■Waits for both the MAC and PHY to be ready.
■Configures the MAC. In the MAC, enables address insertion on the transmit
path and sets the transmit and receive primary MAC address to EE-CC-88-CCAA-EE. Also enables CRC insertion on transmit path.
■Configures Timestamp Unit in the MAC, by setting periods and path delay
adjustments of the clocks.
■Configures ToD clock by loading a predefined time value.
■Configures clock mode of channel-0 Packet Classifier to Ordinary Clock mode,
and channel-1 Packet Classifier to End-to-end Transparent Clock mode.
2. Starts packet transmission. The testbench sends a total of seven packets:
■64-byte basic Ethernet frames
■1-step PTP Sync message over Ethernet
■1-step PTP Sync message over UDP/IPv4 with VLAN tag
■2-step PTP Sync message over UDP/IPv6 with stacked VLAN tag
■1-step PTP Delay Request message over Ethernet
■2-step PTP Delay Request message over UDP/IPv4 with VLAN tag
■1-step PTP Delay Request message over UDP/IPv6 with stacked VLAN tag
3. Displays the MAC statistics on the transcript panel.
4. Changes the operating speed for both channels to 1 Gbps, 100 Mbps, and 10 Mbps.
5. Repeats steps 1 to 3.
6. Stops packet transmission and display statistics counter of the MAC.
6.5.5. Simulating 10M-10GbE MAC with IEEE 1588v2 Testbench with
ModelSim Simulator
To use the ModelSim simulator to simulate the testbench design, follow these steps:
1. Copy the respective design example directory to your preferred project directory:
altera_eth_10g_mac_base_kr_1588 from
<ip library>/ethernet/altera_eth_10g_design_example.
2. Launch Qsys from the Tools menu and open the
altera_eth_10g_mac_base_kr_1588.qsys file.
3. On the Generation tab, select either a Verilog HDL or VHDL simulation model.
4. Click Generate to generate the simulation and synthesis files.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
6–8Chapter 6: 10M-10GbE MAC with IEEE 1588v2 Design Example
10M-10GbE with IEEE 1588v2 Testbench
5. Run the following command to set up the required libraries, to compile the
generated IP Functional simulation model, and to exercise the simulation model
with the provided testbench:
do tb_run.tcl
r
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
The 10GbE MAC IP core handles the flow of data between a client and Ethernet
network through a 10-Gbps Ethernet PHY. On the transmit path, the MAC accepts
client frames and constructs Ethernet frames by inserting various control fields, such
as checksums before forwarding them to the PHY. Similarly, on the receive path, the
MAC accepts Ethernet frames via a PHY, performs checks, and removes the relevant
fields before forwarding the frames to the client. You can configure the MAC to collect
statistics on both transmit and receive paths. You can opt to use either 10GbE MAC,
1G/10GbE MAC, or 10M-10GbE MAC variant.
This chapter describes the MAC IP core, its architecture, interfaces, data paths,
registers, and interface signals.
7.1. Architecture
The 10GbE MAC IP core is a composition of three blocks: MAC receiver (MAC RX),
MAC transmitter (MAC TX), and Avalon-MM bridge. The MAC RX and MAC TX
handle data flow between the client and Ethernet network.
7. Functional Description
The Avalon-MM bridge provides a single interface to all Avalon-MM interfaces within
the MAC, which allows a host to access 32-bit configuration and status registers, and
statistics counters.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
7–2Chapter 7: Functional Description
Avalon-MM
Bridge
1G/10GbE MAC
64-bit
Avalon-ST
Receive Interface
Avalon-MM
Configuration
64-bit
Avalon-ST
Transmit Interface
Link
Fault
Flow
Control
MAC Tx
MAC Rx
64
64
32
XGMII
Transmit
Interface
72
GMII
Transmit
Interface
8
GMII
Receive
Interface
8
XGMII
Receive
Interface
72
Architecture
Figure 7–1, Figure 7–2, and Figure 7–3 show the block diagrams of the 10GbE MAC,
1G/10GbE MAC, and 10M-10GbE MAC variants of the MAC IP core.
Figure 7–1. 10GbE MAC IP Core Block Diagram
10GbE MAC
64-bit
Avalon-ST
Transmit Interface
Avalon-MM
Configuration
32
64
Avalon-MM
Bridge
64-bit
Avalon-ST
Receive Interface
64
Figure 7–2. 1G/10GbE MAC IP Core Block Diagram
Flow
Control
MAC Tx
MAC Rx
Link
Fault
XGMII
Transmit
72
Interface
XGMII
Receive
72
Interface
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 7: Functional Description7–3
Avalon-MM
Bridge
10M-10GbE MAC
64-bit
Avalon-ST
Receive Interface
Avalon-MM
Configuration
64-bit
Avalon-ST
Transmit Interface
Link
Fault
Flow
Control
MAC Tx
MAC Rx
64
64
32
XGMII Transmit
Interface
72
GMII Transmit
Interface
8
MII Transmit
Interface
4
GMII Receive
Interface
8
MII Receive
Interface
4
XGMII Receive
Interface
72
Interfaces
Figure 7–3. 10M-10GbE MAC IP Core Block Diagram
7.2. Interfaces
7.2.1. Avalon-ST Interface
The 10GbE MAC IP core offers the following modes:
■ Avalon-ST transmit and receive interface on the client side
■ Avalon-MM control and status register interface
■ SDR XGMII transmit and receive interface on the network side (10GbE MAC)
or
GMII or SDR XGMII transmit and receive interface on the network side (1G/10G
MAC)
or
MII, GMII or SDR XGMII transmit and receive interface on the network side
(10M-10G MAC)
The client-side interface of the MAC employs the Avalon-ST protocol, which is a
synchronous point-to-point, unidirectional interface that connects the producer of a
data stream (source) to a consumer of the data (sink). The key properties of this
interface include:
■ Frame transfers marked by
■ Signals from source to sink are qualified by the
■ Errors marking a current packet are aligned with the end-of-packet cycle.
■ Use of the
ready
signal by the sink to backpressure the source. The source must
respond to the
number of cycles defined by the ready latency.
ready
signal from sink by deasserting the
startofpacket
and
endofpacket
valid
signal.
valid
signals.
signal after a fixed
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
7–4Chapter 7: Functional Description
In the MAC, the Avalon-ST interface acts as a sink in the transmit datapath and source
in the receive datapath. These interfaces are 64 bits wide and support packets,
backpressure, and error. The ready latency on these interfaces is 0 and the MAC
expects the
f For more information about the Avalon-ST interface, refer to the Avalon Interface
Specifications.
empty
signal to contain a valid value.
Interfaces
7.2.2. SDR XGMII
The network-side interface of the 10GbE MAC implements the SDR version of the
XGMII protocol. The SDR XGMII consists of 64-bit data bus and 8-bit control bus
operating at 156.25 MHz. The data bus carries the MAC frame; the most significant
byte occupies the least significant lane.
7.2.3. GMII
The network-side interface of the 1GbE MAC implements the GMII protocol for the
1Gpbs mode. The GMII defines speeds up to 1000 Mbit/s, implemented using an
eight-bit data interface operating at 125 MHz.
7.2.4. MII
The network-side interface of the 10M/100MbE MAC implements the MII protocol
for the 10 Mbps and 100 Mbps mode. The MII defines speeds up to 10Mbit/s and
100Mbit/s. The speed is implemented using a four-bit data interface operating at
125 MHz, with the clock enable signal to divide the clock to 25 MHz for 100 Mbps and
2.5 MHz for 10 Mbps.
7.2.5. Avalon-MM Control and Status Register Interface
The Avalon-MM control and status register interface is an Avalon-MM slave port. This
interface uses word addressing which provides host access to 32-bit configuration and
status registers, and statistics counters.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 7: Functional Description7–5
Client - MAC Tx Interface
(optional)
Client Frame
MAC Frame
Destination
Addr[47:0]
Source
Addr[47:0]
Type/
Length[15:0]
Payload
[<p-1>:0]
Destination
Addr[47:0]
SFD[7:0]
Preamble
[55:0]
CRC32
[31:0]
PAD [<s>]
Source
Addr[47:0]
Client-Defined Preamble
[63:0]
(optional)
Type/
Length[15:0]
Payload
[<p-1>:0]
PAD [<s>]
CRC32
[31:0]
EFD[7:0]
IPG
[<l-1>:0]
Frame Length
(1)(2)
(3)
Frame Types
7.3. Frame Types
The MAC supports the following frame types:
■ Basic Ethernet frames, including jumbo frames.
■ VLAN and stacked VLAN frames.
■ Control frames, which include pause and PFC frames.
f Refer to Appendix A, Frame Format for the frame formats and fields.
7.4. Transmit Datapath
The MAC TX receives the client payload data with the destination and source
addresses, and appends various control fields. Depending on the MAC configuration,
the MAC TX could perform the following tasks: pads the payload to satisfy the
minimum Ethernet frame payload of 64 bytes, calculates and appends the CRC-32
field, modifies the source address, inserts inter-packet gap bytes, and accepts
client-defined preamble bytes.
To perform these tasks, the MAC TX deasserts the
the frame transfer.
Figure 7–4 shows the typical flow of frame through the MAC TX.
Figure 7–4. Typical Client Frame at Transmit Interface
You can disable pad bytes insertion by setting the
tx_padins_control
When disabled, the MAC IP forwards the frames to the receiver without checking the
frame length. Ensure that the minimum payload length is met; otherwise the current
frame may get corrupted. You can check for undersized frames by referring to the
statistics collected.
7.4.2. Address Insertion
By default, the MAC TX retains the source address received from the client. You can
configure the MAX TX to replace the source address with the primary MAC address
specified in the
the bit
tx_addrins_control[0]
tx_addrins_macaddr0
to 1.
and
tx_addrins_macaddr1
7.4.3. Frame Check Sequence (CRC-32) Insertion
The MAC TX computes and inserts CRC-32 checksum into transmit frames. The MAC
TX computes the CRC-32 checksum over the frame bytes that include the source
address, destination address, length, data, and pad bytes. The CRC checksum
computation excludes the preamble, SFD, and FCS bytes.
The following equation shows the CRC polynomial, as specified in the IEEE 802.3
Standard:
register to 0.
registers by setting
The 32-bit CRC value occupies the FCS field with X
first byte. The CRC bits are thus received in the following order: X
You can disable this function by setting the bit
31
in the least significant bit of the
tx_crcins_control
31
, X30,..., X1, X0.
[1] to 0. You can
also choose to omit the logic for CRC computation and insertion to save resources.
When you disable or omit the CRC computation and insertion, the MAC does not
append the CRC bits to the automatically generated pause frames.
Figure 7–5 on page 7–7 shows the timing diagram of the Avalon-ST transmit and
receive interface where the FCS insertion function is on. The MAC TX receives the
frame without CRC-32 checksum and inserts CRC-32 checksum (4EB00AF4) into the
frame. The frame is then loopback to the receive datapath with the
avalon_st_rx_data[63:0]
containing the CRC-32 checksum.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 7: Functional Description7–7
Transmit Datapath
Figure 7–5. Avalon-ST Transmit and Receive Interface with CRC-32 Checksum Insertion
tx_clk_clk
avalon_st_tx_ready
avalon_st_tx_valid
avalon_st_tx_startofpacket
avalon_st_tx_endofpacket
avalon_st_tx_data[63:0]
avalon_st_tx_empty[2:0]
avalon_st_tx_error
rx_clk_clk
avalon_st_rx_ready
avalon_st_rx_valid
04
...00000000
(1)
avalon_st_rx_startofpacket
avalon_st_rx_endofpacket
avalon_st_rx_data[63:0]
avalon_st_rx_empty[2:0]
avalon_st_rx_error[5:0]
0
...4EB30AF4
Note to Figure 7–5:
(1) This value (which varies depending on the frame size) indicates the number of symbols that are empty during the
cycles that mark the end of a frame.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
7–8Chapter 7: Functional Description
tx_clk_clk
avalon_st_tx_ready
avalon_st_tx_valid
avalon_st_tx_startofpacket
avalon_st_tx_endofpacket
avalon_st_tx_data[63:0]
avalon_st_tx_empty[2:0]
avalon_st_tx_error
0
rx_clk_clk
avalon_st_rx_ready
avalon_st_rx_valid
avalon_st_rx_startofpacket
avalon_st_rx_endofpacket
avalon_st_rx_data[63:0]
avalon_st_rx_empty[2:0]
avalon_st_rx_error[5:0]
...4EB30AF4
...4EB30AF4
0
Transmit Datapath
Figure 7–6 shows the timing diagram of the Avalon-ST transmit and receive interface
where the FCS insertion function is off. The MAC TX receives the frame which
contains a CRC-32 checksum (4EB00AF4) and forwards the frame without performing
CRC computation. The frame with the same CRC-32 field is then loopback to the
receive datapath.
Figure 7–6. Avalon-ST Transmit and Receive Interface with CRC-32 Computation Disabled
7.4.4. XGMII Encapsulation
The 10GbE MAC TX inserts 7-byte preamble, 1-byte SFD and 1-byte EFD (0xFD) into
frames received from the client. When you enable the preamble passthrough mode,
the 10GbE MAC TX accepts 8-byte client-defined preamble in the frames received
from the client and inserts a 1-byte EFD into the frames. For XGMII encapsulation, the
first byte of the preamble data is converted to a 1-byte START (0xFB).
An underflow could occur on the Avalon-ST transmit interface. An underflow occurs
when the
avalon_st_tx_valid
transmission. When this happens, the 10GbE MAC TX inserts an error character |E|
into the frame and forwards the frame to the XGMII.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
signal is deasserted in the middle of frame
Chapter 7: Functional Description7–9
Transmit Datapath
7.4.5. Inter-Packet Gap Generation and Insertion
The MAC TX maintains an average IPG between transmit frames as required by the
IEEE 802.3 Ethernet standard. The average IPG is maintained at 96 bit times (12 byte
times) using the deficit idle count (DIC). The MAC TX's decision to insert or delete
idle bytes depends on the value of the DIC; the DIC is bounded between a minimum
value of zero and maximum value of three. Averaging the IPG ensures that the MAC
utilizes the maximum available bandwidth.
7.4.6. SDR XGMII Transmission
To comply with the IEEE 802.3 Clause 46 Ethernet standard, the MAC TX ensures the
following when transmitting frames on the SDR XGMII:
■ Aligns the first byte of the frame to either lane 0 or lane 4 of the interface.
■ Performs endian conversion. Transmit frames received from the client on the
Avalon-ST interface are big endian. Frames transmitted on the SDR XGMII are
little endian; the MAC TX therefore transmits frames on this interface from the
least significant byte.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
7–10Chapter 7: Functional Description
Transmit Datapath
Figure 7–7 shows the timing for the transmit frames on the Avalon-ST interface and
the SDR XGMII. By comparing the data value in D3, the SDR XGMII performs endian
conversion by transmitting the frames from the least significant byte.
Figure 7–7. Endian Conversion
tx_clk_clk
avalon_st_tx_ready
avalon_st_tx_valid
avalon_st_tx_startofpacket
avalon_st_tx_endofpacket
avalon_st_tx_data [63:0]
avalon_st_tx_empty [2:0]
avalon_st_tx_error
tx_clk_clk
xgmii_tx_data[71]
xgmii_tx_data[70:63]
xgmii_tx_data[62]
xgmii_tx_data[61:54]
xgmii_tx_data[53]
xgmii_tx_data[52:45]
xgmii_tx_data[44]
xgmii_tx_data[43:36]
xgmii_tx_data[35]
xgmii_tx_data[34:27]
xgmii_tx_data[26]
xgmii_tx_data[25:18]
xgmii_tx_data[17]
xgmii_tx_data[16:9]
xgmii_tx_data[8]
xgmii_tx_data[7:0]
D1
(1)
D5
(1)
55
(1)
55
(1)
55
(1)
55
(1)
55
(1)
55
FBEE88020A121A222AFD
D2D3D4D5D6D7D8
04
CC010911192129F4
EE0008101820280A
EE2E070F171F27B3
AA00060E161E264E
CCEE050D151D252D
88AA040C141C242C
CC030B131B232B
Data value:
D1: EECC88CCAAEEEECC
D2: 88CCAAEE002E0001
D3: 0203040506070809
D4: 0A0B0C0D0E0F1011
D5: 1213141516171819
D6: 1A1B1C1D1E1F2021
D7: 2223242526272829
D8: 2A2B2C2D00000000
Note to Figure 7–7:
(1) In the preamble passthrough mode, the MAC TX frame starts with a 1-byte START and a 7-byte client-defined
preamble.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 7: Functional Description7–11
Client - MAC Rx Interface
(optional)
Client Frame
Destination
Addr[47:0]
Source
Addr[47:0]
Type/
Length[15:0]
Payload
[<p-1>:0]
Destination
Addr[47:0]
CRC32
[31:0]
PAD [<s>]
Source
Addr[47:0]
Client-Defined Preamble
[55:0]
(optional)
Type/
Length[15:0]
Payload
[<p-1>:0]
PAD [<s>]
CRC32
[31:0]
EFD[7:0]
Start[7:0]
Frame Length
(1)
(2)
MAC Frame
SFD[7:0]
Preamble
[47:0]
Start[7:0]
Receive Datapath
7.5. Receive Datapath
The MAC RX receives Ethernet frames from the SDR XGMII and forwards the
payload with relevant frame fields to the client after performing checks and filtering
invalid frames. Some frame fields are optionally removed from the frame before MAC
RX forwards the frame to the client.
Figure 7–8 shows the typical flow of frame through the MAC RX.
Figure 7–8. Typical Client Frame at Receive Interface
7.5.1. Minimum Inter-Packet Gap
Tab le 7– 1 shows the minimum IPG the MAC can receive for the different interfaces.
Table 7–1. Minimum IPG for the MAC on the Receive Path
InterfacesMinimum IPG (Bytes)
XGMII (10 Gbps)5
GMII (1 Gbps)8
MII (10 Mbps and 100 Mbps)6
7.5.2. XGMII Decapsulation
In the receive datapath, the MAC RX decodes the data lanes coming through the SDR
XGMII. The MAC RX expects the first byte of the receive frame to be in either lane 0
(most significant byte) or lane 4. The receive frame must also be preceded by a column
of idle bytes or an ordered set such as a local fault. A receive frame that does not
satisfy these conditions is invalid and the MAC RX drops the frame.
The MAC RX then checks the sequence of the frame. The frame must begin with a
1-byte START, 6-byte preamble, and 1-byte SFD. Otherwise, the MAC RX considers
the frame invalid and drops it. For all valid frames, the MAC RX removes the START,
preamble, SFD, and EFD bytes and ensures that the first byte of the frame aligns to
byte 0.
When you enable the preamble passthrough mode, the MAC RX only checks for the
following conditions: the frame begins with a 1-byte START and the minimum length
of the frame including the START and client-defined preamble is 12 bytes.
For frames that do not fulfill these conditions, the MAC RX considers the frames
invalid and drops them. For all valid frames, the MAC RX removes the EFD byte and
ensures that the first byte of the frame aligns to byte 0. The MAC RX forwards the
START and client-defined preamble to the client.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
The CRC polynomial, as specified in the IEEE 802.3 Standard, is shown in the
following equation:
31
The 32-bit CRC field is received in the following order: X
, X30,..., X1, X0, where X31 is
the MSB of FCS field and occupies the LSB position on first FCS byte field.
If a CRC-32 error is detected, the MAC RX marks the frame invalid by setting
avalon_st_rx_error[1]
to 1 and forwards the frame to the client.
7.5.4. Address Checking
The MAC RX can accept frames with the following address types:
■ Unicast address—bit 0 of the destination address is 0.
■ Multicast address—bit 0 of the destination address is 1.
■ Broadcast address—all 48 bits of the destination address are 1.
The MAC RX always accepts broadcast frames. By default, it also receives all unicast
and multicast frames unless configured otherwise in the
EN_ALLMCAST
bits of the
rx_frame_control
register.
EN_ALLUCAST
and
When the
EN_ALLUCAST
bit is set to 0, the MAC RX filters unicast frames received. The
MAC RX accepts only unicast frames if the destination address matches the primary
MAC address specified in the
the supplementary address bits are set to 1 (
register), the MAC RX also checks the destination address against the supplementary
addresses in use.
When the
EN_ALLMCAST
bit is set to 0, the MAC RX drops all multicast frames. This
condition doesn't apply to global multicast pause frames.
7.5.5. Frame Type Checking
The MAC RX checks the length/type field to determine the frame type:
■ Length/type < 0x600—The field represents the payload length of a basic Ethernet
frame. The MAC RX continues to check the frame and payload lengths.
■ Length/type >= 0x600—The field represents the frame type.
■Length/type = 0x8100—VLAN or stacked VLAN tagged frames. The MAC RX
continues to check the frame and payload lengths.
■Length/type = 0x8808—Control frames. The next two bytes are the Opcode
field which indicates the type of control frame. For pause frames (Opcode =
0x0001) and PFC frames (Opcode = 0x0101), the MAC RX proceeds with pause
frame processing (refer to “Congestion and Flow Control” on page 7–15). By
default, the MAC RX drops all control frames. If configured otherwise
(
FWD_CONTROL
control frames to the client.
bit in the
rx_frame_addr0
and
EN_SUPP0/1/2/3
rx_frame_control
rx_frame_addr1
in the
registers. If any of
rx_frame_control
register = 1), the MAC RX forwards
■For other field values, the MAC RX forwards the receive frame to the client.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 7: Functional Description7–13
Receive Datapath
If the length/type is less than payload, the MAC RX considers the frame to have
excessive padding and does not assert
avalon_st_rx_error[4]
. For detailed
information about the MAC behavior, refer to Ta bl e 7 –2 .
Table 7–2. MAC Behavior for Different Frame Types
CategoryPacket Size
Normal
Packet
Undersized Packet < 64
Oversized
65–1518
1518 < Packet
< 1535
7.5.6. Length Checking
The MAC RX checks the frame and payload lengths of basic, VLAN tagged, and
stacked VLAN tagged frames.
The frame length must be at least 64 (0x40) bytes and not exceed the following
maximum value for the different frame types:
Length/Type =
Payload
YesNoNoNoNo
NoYesNoNoavalon_st_rx_error[4] = 1
NoNoYesNoNo
YesNoNoNoavalon_st_rx_error[2] = 1
NoYesNo
NoNoYesNoavalon_st_rx_error[2] = 1
YesNoNoNoavalon_st_rx_error[3] = 1
NoYesNo
NoNoYesNoavalon_st_rx_error[3] = 1
Length/Type >
Payload
Length/Type <
Payload
Frame Dropavalon_st_rx_error [x]
No
No
No
No
MAC Behavior
avalon_st_rx_error[2] = 1
avalon_st_rx_error[4] = 1
avalon_st_rx_error[3] = 1
avalon_st_rx_error[4] = 1
■ Basic—The value in the
■ VLAN tagged—The value in the
■ Stacked VLAN tagged—The value in the
rx_frame_maxlength
rx_frame_maxlength
rx_frame_maxlength
register.
register plus four bytes.
register plus eight
bytes.
The MAC RX keeps track of the actual payload length as it receives a frame and
checks the actual payload length against the length/type or client length/type field.
The payload length must be between 46 (0x2E) and 1500 (0x5DC). For VLAN and
VLAN stacked frames, the minimum payload length is 42 (0x2A) or 38 (0x26)
respectively and not exceeding the maximum value of 1500 (0x5DC).
The MAC RX does not drop frames with invalid length. For the following length
violations, the MAC RX sets the corresponding error bit to 1:
■
avalon_st_rx_error[2]
■
avalon_st_rx_error[3]
■
avalon_st_rx_error[4]
—Undersized frame
—Oversized frame
—Invalid payload length, the actual payload length
doesn't match the value of the length/type field
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
7–14Chapter 7: Functional Description
tx_clk_clk
avalon_st_tx_ready
avalon_st_tx_valid
avalon_st_tx_startofpacket
avalon_st_tx_endofpacket
avalon_st_tx_data[63:0]
avalon_st_tx_empty[2:0]
avalon_st_tx_error
0000000000000000
1A1B1C1D1E1F2021
0
00000000AB704587
rx_clk_clk
avalon_st_rx_ready
avalon_st_rx_valid
avalon_st_rx_startofpacket
avalon_st_rx_endofpacket
avalon_st_rx_data[63:0]
avalon_st_rx_empty[2:0]
avalon_st_rx_error[5:0]
1A1B1C1D1E1F2021
FD07070707070707
0
Receive Datapath
7.5.7. CRC-32 and Pad Removal
By default, the MAC RX forwards receive frames to the client without removing pad
bytes from the frames. You can, however, configure the MAC RX to remove pad bytes
by setting the bit
removes the pad bytes as well as the CRC-32 field from receive frames before
forwarding the frames to the client.
The MAC RX removes pad bytes from receive frames whose 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
rx_padcrc_control
[1] to 1. When the bit is set to 1, the MAC RX
To retain the CRC-32 field, set the
rx_padcrc_control
register to 0.
Figure 7–9 on page 7–14 shows the timing for the Avalon-ST transmit and receive
interface where the MAC TX receives a frame with pad bytes and CRC-32 field
inserted. The MAC RX removes the pad bytes and CRC-32 field from the receive
frame when the
rx_padcrc_control
[1] bit is set to 1.
Figure 7–9. Avalon-ST Transmit and Receive Interface with Pad Bytes and CRC-32 Field Removed
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 7: Functional Description7–15
Transmit and Receive Latencies
7.5.8. Overflow Handling
When an overflow occurs on the client side, the client can backpressure the Avalon-ST
receive interface by deasserting the
avalon_st_rx_ready
signal. If an overflow occurs
in the middle of frame transmission, the MAC RX truncates the frame by sending out
the
avalon_st_rx_endofpacket
reasserted. The error bit,
signal after the
avalon_st_rx_ready
avalon_st_rx_error[5]
signal is
, is set to 1 to indicate an overflow. If
frame transmission is not in progress when an overflow occurs, the MAC RX drops
the frame.
7.6. Transmit and Receive Latencies
Altera uses the following definitions for the transmit and receive latencies:
■ Transmit latency is the number of clock cycles the MAC function takes to transmit
the first byte on the network-side interface (XGMII SDR) after the bit was first
available on the Avalon-ST interface.
■ Receive latency is the number of clock cycles the MAC function takes to present
the first byte on the Avalon-ST interface after the bit was received on the
network-side interface (XGMII SDR).
Tab le 7– 3 shows the transmit and receive nominal latencies of the MAC.
Table 7–3. Transmit and Receive Latencies of the MAC
MAC Configuration
MAC only1012
MAC with 10 Mbps mode3003,459
MAC with 100 Mbps mode47354
MAC with 1 Gbps mode1642
Notes to Table 7–3:
(1) The clocks in all domains are running at the same frequency.
(2) The latency values are based on the assumption that there is no backpressure on the Avalon-ST TX and RX
interface.
7.7. Congestion and Flow Control
The flow control, as specified by IEEE 802.3 Annex 31B, is a mechanism to manage
congestion at the local or remote partner. When the receiving device experiences
congestion, it sends an XOFF pause frame to the emitting device to instruct the
emitting device to stop sending data for a duration specified by the congested
receiver. Data transmission resumes when the emitting device receives an XON pause
frame (pause quanta = zero) or when the timer expires.
Latency (Clock Cycles) (1) (2)
Tra nsmit
(with respect to TX clock)
Receive
(with respect to RX clock)
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
7–16Chapter 7: Functional Description
Congestion and Flow Control
The PFC, as specified by IEEE 802.1Qbb, is a similar mechanism that manages
congestion based on priority levels. The PFC supports up to 8 priority queues. When
the receiving device experiences congestion on a priority queue, it sends a PFC frame
requesting the emitting device to stop transmission on the priority queue for a
duration specified by the congested receiver. When the receiving device is ready to
receive transmission on the priority queue again, it sends a PFC frame instructing the
emitting device to resume transmission on the priority queue.
1Ensure that only one type of flow control is enabled at any one time.
7.7.1. IEEE 802.3 Flow Control
This section describes the pause frame reception and transmission in the IEEE 802.3
flow control. To use the IEEE 802.3 flow control, set the following registers:
1. On the transmit datapath:
■Set
■Set
tx_pfc_priority_enable
tx_pauseframe_enable
to 1 to enable the IEEE 802.3 flow control.
to 0 to disable the PFC.
2. On the receive datapath:
■Set
■Set the
rx_pfc_control
IGNORE_PAUSE
to 1 to disable the PFC.
bit in the
rx_decoder_control register
to 0 to enable
the IEEE 802.3 flow control.
7.7.1.1. Pause Frame Reception
When the MAC receives an XOFF pause frame, it stops transmitting frames to the
remote partner for a period equal to the pause quanta field of the pause frame. If the
MAC receives a pause frame in the middle of a frame transmission, the MAC finishes
sending the current frame and then suspends transmission for a period specified by
the pause quanta. The MAC resumes transmission when it receives an XON pause
frame or when the timer expires. The pause quanta received overrides any counter
currently stored. When the remote partner sends more than one pause quanta, the
MAC sets the value of the pause to the last quanta it received from the remote partner.
You have the option to configure the MAC to ignore pause frames and continue
transmitting frames by setting the
IGNORE_PAUSE
bit in the
rx_decoder_control
register to 1.
7.7.1.2. Pause Frame Transmission
The MAC provides the following two methods for the client or connecting device to
trigger pause frame transmission:
■
avalon_st_pause_data
or a client. Setting
XOFF pause frames; setting
signal—You can connect this 2-bit signal to a FIFO buffer
avalon_st_pause_data[1]
avalon_st_pause_data[0]
to 1 triggers the transmission of
to 1 triggers the
transmission of XON pause frames.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 7: Functional Description7–17
Congestion and Flow Control
If pause frame transmission is triggered when the MAC is generating a pause
frame, the MAC ignores the incoming request and completes the generation of the
pause frame. Upon completion, if the
avalon_st_pause_data
signal remains
asserted, the MAC generates a new pause frame and continues to do so until the
signal is deasserted.
■
1The
avalon_st_pause_data
1Assert the
(
tx_tx_clk
avalon_st_pause_data
signal for at least 1 TX clock cycle
) for the MAC to generate the pause frame right after the current
transmitting packet.
tx_pauseframe_control
pause frames transmission. Setting
transmission of XOFF pause frames; setting
register—A host (software) can set this register to trigger
tx_pauseframe_control[1]
tx_pauseframe_control[0]
to 1 triggers the
to 1
triggers the transmission of XON pause frames. The register clears itself after the
request is executed.
You can configure the pause quanta in the
tx_pauseframe_quanta
register. The
MAC sets the pause quanta field in XOFF pause frames to this register value.
tx_pauseframe_control
register takes precedence over the
signal.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
7–18Chapter 7: Functional Description
Congestion and Flow Control
Figure 7–10 shows the transmission of an XON pause frame. The MAC sets the
destination address field to the global multicast address, 01-80-C2-00-00-01
(0x010000c28001) and the source address to the MAC primary address configured in
the
tx_addrins_macaddr0
and
tx_addrins_madaddr1
registers.
Figure 7–10. XON Pause Frame Transmission
tx_clk_clk
xgmii_tx_data[71]
xgmii_tx_data[70:63]
xgmii_tx_data[62]
xgmii_tx_data[61:54]
xgmii_tx_data[53]
xgmii_tx_data[52:45]
xgmii_tx_data[44]
xgmii_tx_data[43:36]
xgmii_tx_data[35]
xgmii_tx_data[34:27]
xgmii_tx_data[26]
xgmii_tx_data[25:18]
xgmii_tx_data[17]
xgmii_tx_data[16:9]
xgmii_tx_data[8]
xgmii_tx_data[7:0]
D5CC0100B9
55EE0006
5501080069
5500880096
5500EE00
55C2AA00
5580CC00
FB018800FD
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 7: Functional Description7–19
Congestion and Flow Control
7.7.2. Priority-Based Flow Control
This section describes the PFC frame reception and transmission. Follow these steps
to use the PFC:
1. Turn on the Priority-based flow control (PFC) parameter and specify the number
of priority levels using the Number of PFC priorities parameter. You can specify
between 2 to 8 PFC priority levels.
2. Set the following registers.
■On the transmit datapath:
■ Set
tx_pauseframe_enable
■ Set
tx_pfc_priority_enable[n]
■On the receive datapath:
to 0 to disable the IEEE 802.3 flow control.
to 1 to enable the PFC for priority queue n.
■ Set the
IGNORE_PAUSE
bit in the
rx_decoder_control register
to 1 to
disable the IEEE 802.3 flow control.
■ Set the
PFC_IGNORE_PAUSE_n
bit in the
rx_pfc_control
register to 0 to
enable the PFC.
3. Connect the
logic and the
avalon_st_tx_pfc_gen_data
signal to the corresponding RX client
avalon_st_rx_pfc_pause_data
signal to the corresponding TX client
logic.
4. You have the option to configure the MAC RX to forward the PFC frame to the
client by setting the
FWD_PFC
bit in the
rx_pfc_control
register to 1. By default, the
MAC RX drops the PFC frame after processing it.
7.7.2.1. PFC Frame Reception
When the MAC RX receives a PFC frame from the remote partner, it asserts the
avalon_st_rx_pfc_pause_data[n]
Enable [n] = 1) and greater than 0. The client suspends transmission from the TX
priority queue n for the period specified by Pause Quanta n. If the MAC RX asserts
the
avalon_st_rx_pfc_pause_data[n]
transmission for the TX priority queue n, the client finishes sending the current frame
and then suspends transmission for the queue.
When the MAC RX receives a PFC frame from the remote partner, it deasserts the
avalon_st_rx_pfc_pause_data[n]
Enable [n] = 1) and equal to 0. The MAC RX also deasserts this signal when the timer
expires. The client resumes transmission for the suspended TX priority queue when
the
avalon_st_rx_pfc_pause_data[n]
signal if Pause Quanta n is valid (Pause Quanta
signal in the middle of a client frame
signal if Pause Quanta n is valid (Pause Quanta
signal is deasserted.
When the remote partner sends more than one pause quanta for the TX priority queue
n, the MAC RX sets the pause quanta n to the last pause quanta received from the
remote partner.
f For more information on the PFC pause frame, refer to Appendix A.4, Priority-Based
Flow Control Frame.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
7–20Chapter 7: Functional Description
Remote Fault (0x9c000002)
Idle (07070707)
Remote Fault (0x9c000002)
Client
Interface
MAC
Tx
RS Tx
MAC
Rx
RS Rx
2
link_fault_status_xgmii_rx_data
XAUI /
10GBASE-R
PHY
External
PHY
Remote
Partner
XAUI /
10GBASE-R
Network
Interface
Local Fault (0x9c000001)
XGMII
Error Handling (Link Fault)
7.7.2.2. PFC Frame Transmission
PFC frame generation is triggered through the
Set the respective bits to generate XOFF or XON requests for the priority queues.
Refer to Table 9–9 on page 9–18 for more information about the signal.
For XOFF requests, you can configure the pause quanta for each priority queue using
the
pfc_pause_quanta_n
registers. For an XOFF request for priority queue n, the MAC
TX sets bit n in the Pause Quanta Enable field to 1 and the Pause Quanta n field to the
value of the
pfc_pause_quanta_n
register. You can also configure the gap between
successive XOFF requests for a priority queue using the
register. Refer to Table 8–2 on page 8–2 for more information about these registers.
For XON requests, the MAC TX sets the pause quanta to 0.
avalon_st_tx_pfc_gen_data
pfc_holdoff_quanta_n
signal.
7.8. Error Handling (Link Fault)
The 10GbE MAC includes a reconciliation sublayer (RS) located between the MAC
and the XGMII that handles local and remote faults.
When the local PHY reports a local fault (0x9c000001), the RS RX sets
link_fault_status_xgmii_rx_data
signal (0x9c000002) to the PHY, which the remote partner eventually receives.
to 01. The RS TX starts sending the remote fault
When the local PHY receives a remote fault signal, the RS RX sets
link_fault_status_xgmii_rx_data
(07070707). When the RS TX starts sending the remote fault or IDLE signal, all data
sent by the MAC TX is lost.
If the client and the remote partner both receive valid data in more than 127 columns,
the RS RX sets
Figure 7–11 shows fault signaling.
Figure 7–11. Fault Signaling
to 10. The RS TX transmits IDLE signal
link_fault_status_xgmii_rx_data
to 00.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 7: Functional Description7–21
tx_clk_clk
xgmii_tx_data[71]
xgmii_tx_data[70:63]
xgmii_tx_data[62]
xgmii_tx_data[61:54]
xgmii_tx_data[53]
xgmii_tx_data[52:45]
xgmii_tx_data[44]
xgmii_tx_data[43:36]
xgmii_tx_data[35]
xgmii_tx_data[34:27]
xgmii_tx_data[26]
xgmii_tx_data[25:18]
xgmii_tx_data[17]
xgmii_tx_data[16:9]
xgmii_tx_data[8]
xgmii_tx_data[7:0]
02
00
00
9C
02
00
00
9C
IEEE 1588v2
Figure 7–12 shows the timing for the XGMII TX interface transmitting the remote fault
signal (0x9c000002).
Figure 7–12. XGMII TX interface Transmitting Remote Fault Signal
When you instantiate the MAC RX only variation, connect the
link_fault_status_xgmii_rx_data
handle the link fault. Similarly, when you instantiate the MAC TX only variation,
connect the
link_fault_status_xgmii_tx_data
signal to the corresponding RX client logic to
signal to the corresponding TX client
logic. For more information on the signals, refer to
“SDR XGMII Signals” on page 9–8.
1The 1G/10GbE MAC does not support error handling through link fault. Instead, the
MAC uses the
7.9. IEEE 1588v2
gmii_rx_err
signal.
The IEEE 1588v2 option provides time stamp for receive and transmit frames in the
10GbE MAC IP core designs. The feature consists of Precision Time Protocol (PTP).
PTP is a layer-3 protocol that accurately synchronizes all real time-of-day clocks in a
network to a master clock.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
7–22Chapter 7: Functional Description
IEEE 1588v2
The IEEE 1588v2 option has the following features:
■ Supports 4 types of PTP clock on the transmit datapath:
■Master and slave ordinary clock
■Master and slave boundary clock
■End-to-end (E2E) transparent clock
■Peer-to-peer (P2P) transparent clock
■ Supports PTP with the following message types:
■PTP event messages—Sync, Delay_Req, Pdelay_Req, and Pdelay_Resp.
■PTP general messages—Follow_Up, Delay_Resp, Pdelay_Resp_Follow_Up,
Announce, Management, and Signaling.
■ Supports simultaneous 1-step and 2-step clock synchronizations on the transmit
datapath.
■1-step clock synchronization—The MAC function inserts accurate timestamp
in Sync PTP message or updates the correction field with residence time.
■2-step clock synchronization—The MAC function provides accurate timestamp
and the related fingerprint for all PTP message.
■ Supports the following PHY operating speed random error:
■10 Gbps—Timestamp accuracy of ± 3 ns
■1 Gbps—Timestamp accuracy of ± 2 ns
■100 Mbps—Timestamp accuracy of ± 5 ns
■ Supports static error of ± 3 ns across all speeds.
■ Supports IEEE 802.3, UDP/IPv4, and UDP/IPv6 protocol encapsulations for the
PTP packets.
■ Supports untagged, VLAN tagged, and Stacked VLAN Tagged PTP packets, and
any number of MPLS labels.
■ Supports configurable register for timestamp correction on both transmit and
receive datapaths.
■ Supports ToD clock that provides a stream of 96-bit timestamps. For more
information about the ToD clock, refer to Appendix B, Time-of-Day (ToD) Clock.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 7: Functional Description7–23
IEEE 1588v2
Tx Logic
IEEE 1588v2
Rx Logic
PTP Software
Stack
Time-of-Day
Clock
PHY
Tx
PHY
Rx
10GbE MAC IP
10GBASE-R PHY iP
tx_path_delay
rx_path_delay
Timestamp &
User Fingerprint
Correction
Time of Day
Timestamp Aligned to
Receive Frame
tx_egress_timestamp_request
tx_ingress_timestamp
tx_time_of_day
rx_time_of_day
IEEE 1588v2
7.9.1. Architecture
Figure 7–13 shows the overview of the IEEE 1588v2 feature.
Figure 7–13. Overview of IEEE 1588v2 Feature (Note 1)
Note to Figure 7–13:
(1) This figure shows only the datapaths related to the IEEE 1588v2 feature.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
7–24Chapter 7: Functional Description
IEEE 1588v2
7.9.2. Transmit Datapath
The IEEE 1588v2 feature supports 1-step and 2-step clock synchronizations on the
transmit datapath.
■ For 1-step clock synchronization,
■Timestamp insertion depends on the PTP device and message type.
■The MAC function inserts a timestamp in the PTP packet when the client
specifies the Timestamp field offset and asserts Timestamp Insert Request.
■Depending on the PTP device and message type, the MAC function updates
the residence time in the correction field of the PTP packet when the client
asserts
Update.The residence time is the difference between the egress and ingress
timestamps.
■For PTP packets encapsulated using the UDP/IPv6 protocol, the MAC function
performs UDP checksum correction using extended bytes in the PTP packet.
■The MAC function re-computes and re-inserts CRC-32 into the PTP packets
after each timestamp or correction field insertion.
tx_etstamp_ins_ctrl_residence_time_update
and Correction Field
■The format of timestamp supported includes 1588v1 and 1588v2, (as specified
in Y.1731)
■ For 2-step clock synchronization, the MAC function returns the timestamp and the
associated fingerprint for all transmit frames when the client asserts
tx_egress_timestamp_request_valid
.
Tab le 7– 4 summarizes the timestamp and correction field insertions for various PTP
messages in different PTP clocks.
Table 7–4. Timestamp and Correction Insertion for 1-Step Clock Synchronization
(1) Applicable only when 2-step flag in
(2) Applicable when you assert tx_etstamp_ins_ctrl_residence_time_update.
flagField
of the PTP packet is 0.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 7: Functional Description7–25
flagField
correctionField
transportSpecific | messageType
reserved | versionPTP
reserved
1 Octet
1 Octet
1 Octet
2 Octets
8 Octets
reserved4 Octets
SourcePortIdentify10 Octets
sequenceId2 Octets
controlField1 Octet
logMessageInterval1 Octet
TimeStamp
Payload
10 Octets
domainNumber
messageLength2 Octets
1 Octet
Length/Type = 0x88F7
Source Address
Destination Address
2 Octets
6 Octets
6 Octets
MAC Header
PTP Header
0..1500/9600 Octets
CRC4 Octets
(1)
IEEE 1588v2
7.9.3. Receive Datapath
In the receive datapath, the IEEE 1588v2 feature provides a timestamp for all receive
frames. The timestamp is aligned with the
avalon_st_rx_startofpacket
signal.
7.9.4. Frame Format
The MAC function, with the IEEE 1588v2 feature, supports PTP packet transfer for the
following transport protocols:
■ IEEE 802.3
■ UDP/IPv4
■ UDP/IPv6
7.9.4.1. PTP Packet in IEEE 802.3
Figure 7–14 shows the format of the PTP packet encapsulated in IEEE 802.3.
Figure 7–14. PTP Packet in IEEE 8002.3
Note to Figure 7–14:
(1) For packets with VLAN or Stacked VLAN tag, add 4 or 8 octets offsets before the length/type field.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
7–26Chapter 7: Functional Description
MAC Header
UDP Header
IP Header
PTP Header
Time To Live
Protocol = 0x11
Version | Internet Header Length
Differentiated Services
Flags | Fragment Offsets
1 Octet
1 Octet
2 Octets
1 Octet
1 Octet
Header Checksum2 Octets
Source IP Address4 Octets
Destination IP Address4 Octets
Options | Padding0 Octet
Source Port2 Octets
Destination Port = 319 / 3202 Octets
Identification
Total Length2 Octets
2 Octets
Length/Type = 0x0800
Source Address
Destination Address
2 Octets
6 Octets
6 Octets
Checksum
Length
2 Octets
2 Octets
flagField
correctionField
transportSpecific | messageType
reserved | versionPTP
reserved
1 Octet
1 Octet
1 Octet
2 Octets
8 Octets
reserved4 Octets
SourcePortIdentify10 Octets
sequenceId2 Octets
controlField1 Octet
logMessageInterval1 Octet
TimeStamp
Payload
10 Octets
domainNumber
messageLength2 Octets
1 Octet
0..1500/9600 Octets
CRC4 Octets
(1)
IEEE 1588v2
7.9.4.2. PTP Packet over UDP/IPv4
Figure 7–15 shows the format of the PTP packet encapsulated in UDP/IPv4.
Checksum calculation is optional for the UDP/IPv4 protocol. The 1588v2 TX logic
should set the checksum to zero.
Figure 7–15. PTP Packet over UDP/IPv4
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Note to Figure 7–15:
(1) For packets with VLAN or Stacked VLAN tag, add 4 or 8 octets offsets before the length/type field.
Chapter 7: Functional Description7–27
IEEE 1588v2
7.9.4.3. PTP Packet over UDP/IPv6
Figure 7–16 shows the format of the PTP packet transported over the UDP/IPv6
protocol. Checksum calculation is mandatory for the UDP/IPv6 protocol. You must
extend 2 bytes at the end of the UDP payload of the PTP packet. The MAC function
modifies the extended bytes to ensure that the UDP checksum remains
uncompromised.
Figure 7–16. PTP Packet over UDP/IPv6
6 Octets
6 Octets
2 Octets
4 Octet
2 Octets
1 Octet
2 Octets
2 Octets
1 Octet
1 Octet
1 Octet
1 Octet
2 Octets
8 Octets
10 Octets
Destination Address
Source Address
Length/Type = 0x86DD
Version | Traffic Class | Flow Label
Payload Length
Next Header = 0x111 Octet
Hop Limit
Source IP Address16 Octets
Destination IP Address16 Octets
Source Port2 Octets
Destination Port = 319 / 3202 Octets
Length
Checksum
transportSpecific | messageType
reserved | versionPTP
messageLength2 Octets
domainNumber
reserved
flagField
correctionField
reserved4 Octets
SourcePortIdentify10 Octets
sequenceId2 Octets
controlField1 Octet
logMessageInterval1 Octet
TimeStamp
(1)
MAC Header
IP Header
UDP Header
PTP Header
0..1500/9600 Octets
Payload
extended bytes2 Octets
CRC4 Octets
Note to Figure 7–16:
(1) For packets with VLAN or Stacked VLAN tag, add 4 or 8 octets offsets before the length/type field.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
8. Registers
This section defines the MAC registers. The statistics collected on the transmit and
receive datapaths are categorized as good, error, or invalid frames.
■ Good frame—Error-free frames with a valid frame length.
■ Error frame—Frames that contain errors or with an invalid frame length.
■ Invalid frame—Frames that are not addressed to the MAC. It may or may not
contain error within the frame or have an invalid frame length. The MAC drops
invalid frames.
When you select the MAC Rx only variation, the register offsets from 0x000 to 0x3FFF
are available for Rx status and configuration registers. Similarly, when you select the
MAC TX only variation, the register offsets from 0x4000 to 0x7FFF are available for TX
status and configuration registers. All status and configuration registers are as
defined in Table 8–2 on page 8–2.
c Altera recommends accessing only the available register spaces in the MAC Rx only
variation or the MAC TX only variation. Accessing unavailable register spaces may
cause the MAC to lock the Avalon-MM bus.
1Altera has updated all register address for the 10GbE MAC IP core as part of register
map expansion to accommodate new registers. Tab le 8– 1 summarizes the changes.
Table 8–1. Summary of Register Address Expansion
Component Name
RX Datapath
RX Packet Transfer0x000:0x00F0x000:0x0FF
RX Pad/CRC Remover0x010:0x01F0x100:0x1FF
RX CRC Checker0x020:0x0FF0x200:0x2FF
RX Packet Overflow 0x180:0x1FF0x300:0x3FF
RX Preamble Control —0x400:0x4FF
RX Lane Decoder—0x500:0x1FFF
RX Frame Decoder0x100:0x17F0x2000:0x2FFF
RX Statistics Counters0x200:0x3FF0x3000:0x3FFF
TX Datapath
TX Packet Transfer0x400:0x40F0x4000:0x40FF
TX Pad Inserter0x410:0x41F0x4100:0x41FF
TX CRC Inserter0x420:0x45F 0x4200:0x42FF
TX Packet Underflow0x580:0x5FF0x4300:0x43FF
TX Preamble Control—0x4400:0x44FF
TX Pause Frame Control and
Generator
Previous Address Range
(ACDS Version 10.0, 10.1)
.
New Address Range
(ACDS Version 11.0 Onwards)
0x460:0x47F0x4500:0x45FF
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
8–2Chapter 8: Registers
MAC Registers
Table 8–1. Summary of Register Address Expansion
Component Name
Previous Address Range
(ACDS Version 10.0, 10.1)
New Address Range
(ACDS Version 11.0 Onwards)
TX PFC Generator—0x4600:0x47FF
TX Address Inserter0x480:0x4FF0x4800:0x5FFF
TX Frame Decoder0x500:0x57F0x6000:0x6FFF
TX Statistics Counters0x600:0x7FF0x7000:0x7FFF
1If you instantiate the IP core using the MegaWizard Plug-in Manager flow, use double
word (dword) addressing to access the register spaces. Convert the byte offsets to
dword offsets by dividing the byte offsets by 4. For example,
■
rx_padcrc_control
■
rx_padcrc_control
byte offset = 0x100
word offset = 0x100 ÷ 4 = 0x040
1Do not reconfigure the MAC through the CSR registers when the datapath is not idle,
with the exception of the following registers:
■
tx_transfer_control
■
rx_transfer_control
■
tx_pauseframe_control
■
tx_stats_clr
■
rx_stats_clr
■
rx_pfc_control
■ All IEEE 1588v2 CSR registers
8.1. MAC Registers
Tab le 8– 2 shows the MAC registers.
Table 8–2. MAC Registers (Part 1 of 15)
Word
Offset
RX Packet Transfer (0x000:0x03F)
0x000
0x001
rx_transfer_control
rx_transfer_status
Register NameAccess
Reset
Value
RW0x0
RO0x0
Description
Receive path enable.
■ Bit 0 configures the receive path.
0—Enables the receive path.
1—Disables the receive path and drops all
receive frames.
■ Bits 1 to 31 are reserved.
■ Bit 0 indicates the status of the receive
path.
0—The receive path is enabled.
1—The receive path is disabled.
■ Bits 1 to 31 are reserved.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 8: Registers8–3
MAC Registers
Table 8–2. MAC Registers (Part 2 of 15)
Word
Offset
0x002 –
0x03F
Reserved——Reserved for future use.
Register NameAccess
RX Pad/CRC Remover (0x040:0x07F)
0x040
0x041 –
0x07F
rx_padcrc_control
Reserved——Reserved for future use.
RX CRC Checker (0x080:0x0BF)
0x080
0x081 –
0x0BF
rx_crccheck_control
Reserved——Reserved for future use.
RX Packet Overflow (0x0C0:0x0FF)
Reset
Value
RW0x1
RW0x2
Description
Padding and CRC removal (through the
avalon_st_rx_data
■ Bit 0 configures CRC removal.
signal).
0—Retains the CRC field in receive packets.
1—Removes the CRC field from receive
packets.
■ Bit 1 configures padding and CRC removal.
0—Retains the padding bytes and CRC
field.
1—Removes the padding bytes and CRC
field from receive packets. The setting of
this bit takes precedence over bit 0.
■ Bits 2 to 31 are reserved.
CRC checking:
■ Bit 0—Always set this bit to 0.
■ Bit 1 configures CRC checking.
0—Ignores the CRC field.
1—Checks the CRC field.
■ Bits 2 to 31 are reserved.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
8–4Chapter 8: Registers
MAC Registers
Table 8–2. MAC Registers (Part 3 of 15)
Word
Offset
Register NameAccess
0x0C0
0x0C10x0
rx_pktovrflow_error
0x0C2
rx_pktovrflow_
etherStatsDropEvents
Reset
Value
0x036-bit error counter that collects the number
RO
0x0
RO
0x0C30x0
0x0C4 –
0x0FF
Reserved——Reserved for future use.
RX Preamble Control (0x100:0x13F)
0x100
0x101 –
0x13F
rx_lane_decoder_preamble_control
Reserved——Reserved for future use.
RW0x0
RX Lane Decoder (0x140:0x7FF)
Description
of receive frames that are truncated when FIFO
buffer overflow persists:
■ The first 32 bits occupy the register at
offset 0x0C0.
■ The last 4 bits occupy the first four bits of
the register at offset 0x0C1. Bits 4 to 31 are
unused.
The counter will be cleared when the last 4 bits
have been read. If only the first 32 bits are
read, the counter will not be cleared.
36-bit error counter that collects the number
of receive frames that are dropped when FIFO
buffer overflow persists:
■ The first 32 bits occupy the register at
offset 0x0C2.
■ The last 4 bits occupy the first four bits of
the register at offset 0x0C3. Bits 4 to 31 are
unused.
The counter will be cleared when the last 4 bits
have been read. If only the first 32 bits are
read, the counter will not be cleared.
■ Bit 0 determines whether or not the
client-defined preamble is forwarded to the
client frame.
0—Removes the client-defined preamble
from the receive frame.
1—Forwards the client-defined preamble to
the client.
■ Bits 1 to 31 are reserved.
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Chapter 8: Registers8–5
MAC Registers
Table 8–2. MAC Registers (Part 4 of 15)
Word
Offset
0x140
0x141 –
0x7FF
rx_preamble_inserter_control
Reserved——Reserved for future use.
Register NameAccess
RX Frame Decoder (0x800:0xBFF)
0x800
0x801
0x802
0x803
rx_frame_control
rx_frame_maxlength
rx_frame_addr0
rx_frame_addr1
(1)RW0x0
Reset
Value
■ Bit 0 enables the preamble passthrough
Description
mode on the receive datapath.
0—Disables the preamble passthrough
mode.
1—Enables the preamble passthrough
RW0x0
mode.
■ Bits 1 to 31 are reserved.
For more information on the XGMII
decapsulation in the preamble passthrough
mode, refer to “XGMII Decapsulation” on
page 7–11.
Specifies valid frame types, pause frames
handling, and use of supplementary
RW0x3
addresses.
Refer to “Rx_frame_control Register” on
page 8–16 for the bit description.
■ Bits 0 to 15 specify the maximum allowable
frame length. The MAC asserts the
RW1518
avalon_st_rx_error[3]
length of the receive frame exceeds the
signal when the
value of this register.
■ Bits 16 to 31 are reserved.
RW0x06-byte primary MAC address. You must map
the address to the registers in the following
manner:
■
rx_frame_addr0
= Last four bytes of the
address
■
rx_frame_addr1[
0:15]= First two bytes of
the address.
Bits 16 to 31 are reserved.
Example:
If the primary MAC address is 00-1C-23-174A-CB, set
and
rx_frame_addr0
rx_frame_addr1
to 0x23174ACB
to 0x0000001C.
The IP core uses the primary MAC address to
filter unicast frames when the
bit of the
rx_frame_control
en_allucast
register is set
to 0.
February 2014 Altera Corporation10-Gbps Ethernet MAC MegaCore Function User Guide
8–6Chapter 8: Registers
MAC Registers
Table 8–2. MAC Registers (Part 5 of 15)
Word
Offset
0x804
0x805
0x806
0x807
0x808
0x809
0x80A
0x80B
0x818
0x819 –
0xBFF
rx_frame_spaddr0_0
rx_frame_spaddr0_1 (1)
rx_frame_spaddr1_0
rx_frame_spaddr1_1 (1)
rx_frame_spaddr2_0
rx_frame_spaddr2_1 (1)
rx_frame_spaddr3_0
rx_frame_spaddr3_1 (1)
rx_pfc_control
Reserved——Reserved for future use.
Register NameAccess
TX Packet Transfer (0x1000:0x103F)
0x1000
0x1001
0x1002 –
0x103F
tx_transfer_control
tx_transfer_status
Reserved——Reserved for future use.
TX Pad Inserter (0x1040:0x107F)
Reset
Value
Description
RW0x0You can specify up to four 6-byte
RW0x0
RW0x0
RW0x0
RW0x0
RW0x0
RW0x0
supplementary addresses:
■
rx_framedecoder_spaddr0_0/1
■
rx_framedecoder_spaddr1_0/1
■
rx_framedecoder_spaddr2_0/1
■
rx_framedecoder_spaddr3_0/1
You must map the supplementary addresses
to the respective registers in the same manner
as the primary MAC address. Refer to the
description of
rx_frame_addr1
rx_frame_addr0
.
The IP core uses the supplementary addresses
to filter unicast frames when the following
conditions are set:
RW0x0
■ The use of the supplementary addresses
are enabled using the respective bits in the
rx_frame_control
register (refer to
“Rx_frame_control Register” on
page 8–16).
■ The
en_allucast
rx_frame_control
bit of the
register is set to 0.
PFC enable for the priority queues on the
RW0x1
receive datapath.
Refer to “Rx_pfc_control Register” on
page 8–17 for the bit description.
Backpressure enable.
■ Bit 0 configures transmit transfer control.
0—Enables transmit transfer datapath.
RW0x0
1—Disables transmit transfer datapath on
the Avalon-ST transmit interface. The IP
core deasserts the
avalon_st_tx_ready
signal.
■ Bits 1 to 31 are reserved.
■ Bit 0 indicates if transmit transfer datapath
is enabled on the Avalon-ST transmit
RO0x0
interface.
0—Transmit transfer datapath is enabled.
1—Transmit transfer datapath is disabled.
■ Bits 1 to 31 are reserved.
and
10-Gbps Ethernet MAC MegaCore Function User GuideFebruary 2014 Altera Corporation
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.