10-Gbps Ethernet MAC MegaCore Function User Guide 10-Gbps Ethernet MAC MegaCore Function User Guide 101 Innovation Drive San Jose, CA 95134 www.altera.com UG-01083-3.4 Document last updated for Altera Complete Design Suite version: Document publication date: 14.0 August 2014 Feedback Subscribe Copyright (c) 2014 Altera Corporation. All rights reserved. Altera, The Programmable Solutions Company, the stylized Altera logo, and specific device designations are trademarks and/or service marks of Altera Corporation in the U.S. and other countries. All other words and logos identified as trademarks and/or service marks are the property of Altera Corporation or their respective owners. Altera products are protected under numerous U.S. and foreign patents and pending applications, maskwork rights, and copyrights. Altera warrants performance of its semiconductor products to current specifications in accordance with Altera's standard warranty, but reserves the right to make changes to any products and services at any time without notice. Altera assumes no responsibility or liability arising out of the application or use of any information, product, or service described herein except as expressly agreed to in writing by Altera. Altera customers are advised to obtain the latest version of device specifications before relying on any published information and before placing orders for products or services. 10-Gbps Ethernet MAC MegaCore Function User Guide August 2014 Altera Corporation Contents Chapter 1. About This IP Core 1.1. Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1 1.2. Release Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2 1.3. Device Family Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3 1.4. IP Core Verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3 1.4.1. Simulation Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3 1.4.2. Compatibility Testing Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4 1.5. Performance and Resource Utilization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4 Chapter 2. Getting Started with Altera IP Cores 2.1. Introduction to Altera IP Cores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1 2.2. Installing and Licensing IP Cores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1 2.2.1. OpenCore Plus IP Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2 2.3. IP Catalog and Parameter Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2 2.4. Using the Parameter Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3 2.5. Customizing and Generating IP Cores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4 2.6. Specifying the Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5 2.7. Upgrading Outdated IP Cores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5 2.8. Simulating IP Cores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6 2.9. 10GbE MAC Parameter Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8 Chapter 3. 10GbE MAC Design Examples 3.1. Software and Hardware Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1 3.2. 10GbE Design Example Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2 3.2.0.1. Ethernet Loopback Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3 3.2.0.2. Base Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4 3.3. 10GbE Design Example Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5 3.4. Creating a New 10GbE Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6 3.5. 10GbE Design Example Parameter Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8 3.6. 10GbE Testbenches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8 3.6.1. 10GbE Testbench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8 3.6.2. 10GbE Testbench Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9 3.6.3. 10GbE Testbench Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9 3.6.4. 10GbE Testbench Simulation Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-11 3.6.5. Simulating the 10GbE Testbench with the ModelSim Simulator . . . . . . . . . . . . . . . . . . . . . . . 3-11 3.6.6. Enabling Local Loopback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-12 3.6.7. 10GbE Simulation Timing Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-13 3.7. 10GbE Design Example Compilation and Verification in Hardware . . . . . . . . . . . . . . . . . . . . . . . . 3-15 3.7.1. Compiling the 10GbE Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-15 3.7.2. Verifying the 10GbE Design in Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-17 3.7.3. Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-17 3.7.4. 10GbE Design Transmit and Receive Latencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-18 3.7.5. 10GbE Design Performance and Resource Utilization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-19 Chapter 4. 10GbE MAC with IEEE1588v2 Design Example 4.1. Software Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1 4.2. 10GbE with IEEE 1588v2 Design Example Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2 4.2.1. Base Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3 August 2014 Altera Corporation 10-Gbps Ethernet MAC MegaCore Function User Guide Contents iv 4.3. 10GbE with IEEE 1588v2 Design Example Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4 4.4. Creating a New 10GbE with IEEE 1588v2 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4 4.5. 10GbE with IEEE 1588v2 Testbench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5 4.5.1. 10GbE with IEEE 1588v2 Testbench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5 4.5.2. 10GbE with IEEE 1588v2 Testbench Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5 4.5.3. 10GbE with IEEE 1588v2 Testbench Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6 4.5.4. 10GbE with IEEE 1588v2 Testbench Simulation Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6 4.5.5. Simulating 10GbE with IEEE 1588v2 Testbench with ModelSim Simulator . . . . . . . . . . . . . . . 4-7 Chapter 5. 1G/10GbE MAC Design Example 5.1. Software and Hardware Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1 5.2. 1G/10GbE Design Example Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2 5.2.1. Reconfiguration Bundle Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4 5.2.2. Base Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4 5.3. 1G/10GbE Design Example Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-5 5.4. Creating a New 1G/10GbE Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6 5.5. 1G/10GbE Testbench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6 5.5.1. 1G/10GbE Testbench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6 5.5.2. 1G/10GbE Testbench Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-7 5.5.3. 1G/10GbE Testbench Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-7 5.5.4. 1G/10GbE Testbench Simulation Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-9 5.5.4.1. 1G/10Gb Ethernet Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-9 5.5.4.2. Backplane-KR Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-10 5.5.5. Simulating the 1G/10GbE Testbench with the ModelSim Simulator . . . . . . . . . . . . . . . . . . . . 5-10 5.5.6. 1G/10GbE Simulation Timing Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-12 5.6. 1G/10GbE Design Example Compilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-13 5.6.1. Compiling the 1G/10GbE Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-13 5.6.2. 1G/10GbE Design Performance and Resource Utilization . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-14 Chapter 6. 10M-10GbE MAC with IEEE 1588v2 Design Example 6.1. Software and Hardware Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1 6.2. 10M-10GbE MAC with IEEE 1588v2 Design Example Components . . . . . . . . . . . . . . . . . . . . . . . . . 6-1 6.2.1. Base Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3 6.3. 10M-10GbE MAC with IEEE 1588v2 Design Example Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3 6.4. Creating a New 10M-10GbE MAC with IEEE 1588v2 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4 6.5. 10M-10GbE with IEEE 1588v2 Testbench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4 6.5.1. 10M-10GbE with IEEE 1588v2 Testbench . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-5 6.5.2. 10M-10GbE with IEEE 1588v2 Testbench Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-5 6.5.3. 10M-10GbE MAC with IEEE 1588v2 Testbench Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-6 6.5.4. 10M-10GbE MAC with IEEE 1588v2 Testbench Simulation Flow . . . . . . . . . . . . . . . . . . . . . . . 6-7 6.5.5. Simulating 10M-10GbE MAC with IEEE 1588v2 Testbench with ModelSim Simulator . . . . . 6-7 Chapter 7. Functional Description 7.1. Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1 7.2. Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3 7.2.1. Avalon-ST Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-3 7.2.2. SDR XGMII . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4 7.2.3. GMII . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4 7.2.4. MII . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4 7.2.5. Avalon-MM Control and Status Register Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4 7.3. Frame Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5 7.4. Transmit Datapath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5 7.4.1. Frame Payload Padding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5 August 2014 Altera Corporation 10-Gbps Ethernet MAC MegaCore Function User Guide Contents v 7.4.2. Address Insertion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-6 7.4.3. Frame Check Sequence (CRC-32) Insertion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-6 7.4.4. XGMII Encapsulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8 7.4.5. Inter-Packet Gap Generation and Insertion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-9 7.4.6. SDR XGMII Transmission . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-9 7.4.7. Unidirectional Feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-10 7.5. Receive Datapath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-12 7.5.1. Minimum Inter-Packet Gap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-12 7.5.2. XGMII Decapsulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-12 7.5.3. Frame Check Sequence (CRC-32) Checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-13 7.5.4. Address Checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-13 7.5.5. Frame Type Checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-13 7.5.6. Length Checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-14 7.5.7. CRC-32 and Pad Removal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-15 7.5.8. Overflow Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-16 7.6. Transmit and Receive Latencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-16 7.7. Congestion and Flow Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-17 7.7.1. IEEE 802.3 Flow Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-17 7.7.1.1. Pause Frame Reception . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-18 7.7.1.2. Pause Frame Transmission . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-18 7.7.2. Priority-Based Flow Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-20 7.7.2.1. PFC Frame Reception . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-20 7.7.2.2. PFC Frame Transmission . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-21 7.8. Error Handling (Link Fault) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-21 7.9. IEEE 1588v2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-22 7.9.1. Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-24 7.9.2. Transmit Datapath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-24 7.9.3. Receive Datapath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-25 7.9.4. Frame Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-26 7.9.4.1. PTP Packet in IEEE 802.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-26 7.9.4.2. PTP Packet over UDP/IPv4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-27 7.9.4.3. PTP Packet over UDP/IPv6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-28 Chapter 8. Registers 8.1. MAC Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2 8.1.1. Rx_frame_control Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-16 8.1.2. Rx_pfc_control Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-17 8.2. MAC Registers for IEEE 1588v2 Feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-18 8.2.1. Configuring PMA Analog and Digital Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-19 8.3. Register Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-20 Chapter 9. Interface Signals 9.0.1. Clock and Reset Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2 9.0.2. Avalon-ST Transmit and Receive Interface Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2 9.0.2.1. Timing Diagrams--Avalon-ST Transmit Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3 9.0.2.2. Timing Diagrams--Avalon-ST Receive Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-6 9.0.3. SDR XGMII . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-8 9.0.3.1. Timing Diagrams--SDR XGMII . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-9 9.0.4. GMII Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-11 9.0.5. MII Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-11 9.0.6. Unidirectional Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-12 9.0.7. Avalon-MM Programming Interface Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-12 9.0.8. Avalon-ST Status and Pause Interface Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-13 August 2014 Altera Corporation 10-Gbps Ethernet MAC MegaCore Function User Guide vi Contents 9.0.9. 10M-10GbE MAC Speed Control Signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-20 9.0.10. IEEE 1588v2 Interface Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-20 9.0.10.1. IEEE 1588v2 Timestamp Interface Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-20 9.0.10.2. ToD Clock Interface Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-25 9.0.10.3. Path Delay Interface Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-25 9.0.10.4. Timing Diagrams--IEEE 1588v2 Timestamp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-27 Chapter 10. Design Considerations 10.1. SDR XGMII to DDR XGMII Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-1 10.1.1. ALTDDIO_IN Megafunction Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-1 10.1.2. ALTDDIO_OUT Megafunction Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-1 10.2. 10GbE MAC and PHY Connection with XGMII . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2 10.3. Sharing TX and RX Clocks for Multi-Port System Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2 10.4. Sharing Reference Clocks for Multi-Port System Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2 Appendix A. Frame Format A.1. Ethernet Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.2. VLAN and Stacked VLAN Tagged MAC Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.3. Pause Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A.4. Priority-Based Flow Control Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-1 A-2 A-3 A-4 Appendix B. Time-of-Day (ToD) Clock B.1. Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.2. Device Family Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.3. Performance and Resource Utilization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.4. Parameter Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.5. ToD Clock Interface Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.5.1. Avalon-MM Control Interface Signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.5.2. Avalon-ST Transmit Interface Signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.6. ToD Clock Configuration Register Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.6.1. Adjusting ToD's Drift . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-1 B-1 B-1 B-2 B-2 B-3 B-3 B-4 B-5 Appendix C. Packet Classifier C.1. Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C.2. Packet Classifier Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C.2.1. Common Clock and Reset Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C.2.2. Avalon-ST Interface Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C.2.3. Ingress Control Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C.2.4. Control Insert Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C.2.5. Timestamp Field Location Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-1 C-2 C-2 C-2 C-3 C-4 C-4 Appendix D. ToD Synchronizer D.1. Device Family Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.2. Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.3. ToD Synchronizer Parameter Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.4. ToD Synchronizer Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.4.1. Common Clock and Reset Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D.4.2. Interface Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D-1 D-2 D-3 D-4 D-4 D-4 Additional Information Document Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Info-1 How to Contact Altera . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Info-4 Typographic Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Info-4 10-Gbps Ethernet MAC MegaCore Function User Guide August 2014 Altera Corporation 1. About This IP Core 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(R) Streaming (Avalon-ST) interface on the client 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(R) device and connect it to an 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. Figure 1-1 illustrates a system with the 10GbE MAC IP core. Figure 1-1. Typical Application of 10GbE MAC Altera FPGA XAUI or 10GbE MAC or 10GBASE-R or Client Module Avalon-ST Interface 1G/10GbE MAC or 10M/100M/ 1000M/10GbE MAC SDR XGMII/ GMII/MII Backplane Ethernet 10GBASE-KR PHY or Serial Interface External PHY 1G/10Gbps Ethernet 1.1. Features The 10GbE MAC supports the following features: August 2014 Operating modes: 10 Mbps, 100 Mbps, 1 Gbps and 10 Gbps. Support for full duplex only. 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. Altera Corporation 10-Gbps Ethernet MAC MegaCore Function User Guide 1-2 Chapter 1: About This IP Core Release Information Optional cyclic redundancy code (CRC)-32 computation and insertion on the 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 Table 1-1 lists information about this release of the 10GbE MAC IP core. Table 1-1. Release Information Item Version Release Date Ordering Code Description 14.0 June 2014 IP-10GETHMAC Product ID ID 00D9 Vendor ID 6AF7 10-Gbps Ethernet MAC MegaCore Function User Guide August 2014 Altera Corporation Chapter 1: About This IP Core Device Family Support 1-3 1.3. Device Family Support f For new additions and enhancements to the latest Quartus II software and Altera IP, refer to the What's New for Altera IP page of the Altera website. f For a list of IP support for all device families, refer to the All Intellectual Property page of the Altera website. Table 1-2 shows the devices supported by the different configurations. Table 1-2. Device Family Support for Configurations Configuration Arria V GT Arria V GZ Stratix V Multi-Speed 10M-10GbE MAC -- v v Multi-Speed 10M-10GbE MAC with IEEE 1588v2 -- v v 10GbE MAC with 10GBASE-R PHY v v v v (1) v v Multi-Speed 10M-10GbE MAC with Backplane Ethernet 10GBASE-KR PHY -- v v Multi-Speed 10M-10GbE MAC with Backplane Ethernet 10GBASE-KR PHY and IEEE 1588v2 -- -- -- Multi-Speed 10M-10GbE MAC with 1G/10Gbps Ethernet PHY -- v v Multi-Speed 10M-10GbE MAC with 1G/10Gbps Ethernet PHY and IEEE 1588v2 -- v v 10GbE MAC with 10GBASE-R PHY and IEEE 1588v2 Note for Table 1-2: (1) Supports only Arria V GT devices with speed grade of 3_H3. 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: August 2014 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. Altera Corporation 10-Gbps Ethernet MAC MegaCore Function User Guide 1-4 Chapter 1: About This IP Core Performance and Resource Utilization 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 Table 1-3 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. 1 To achieve your timing requirement in Quartus II, Altera recommends that you use multiple seeds in the Design Space Explorer to find the optimal Fitter settings for your design, follow the Timing Optimization Advisor's recommendations, apply the Speed Optimization Technique and use the LogicLock regions. Table 1-3. Cyclone IV Performance and Resource Utilization Settings All options disabled All options enabled with memory-based statistics counters Logic Elements Logic Registers Memory Block (M9K) fMAX (MHz) 4,424 3,245 2 >156.25 11,845 8,355 11 >156.25 Table 1-4 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-4. Stratix IV Performance and Resource Utilization Combinational ALUTs Logic Registers Memory Block (M9K) fMAX (MHz) 1,954 3,157 0 >156.25 All options enabled with memory-based statistics counters 5,684 8,349 7 >156.25 All options enabled with register-based statistics counters 8,135 10,117 3 >156.25 Settings All options disabled 10-Gbps Ethernet MAC MegaCore Function User Guide August 2014 Altera Corporation Chapter 1: About This IP Core Performance and Resource Utilization 1-5 Table 1-5 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-5. Cyclone V Performance and Resource Utilization Combinational ALUTs Logic Registers Memory Block (M10K) fMAX (MHz) 2,322 3,444 2 >156.25 All options enabled with memory-based statistics counters 4,417 5,464 6 >156.25 All options enabled with register-based statistics counters 6,867 7,113 2 >156.25 Settings All options disabled Table 1-6 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-6. Stratix V Performance and Resource Utilization for 10GbE MAC Combinational ALUTs Dedicated Logic Registers Memory Block (M20K) fMAX (MHz) 2,001 3,077 0 >156.25 All options enabled with memory-based statistics counters 5,772 8,197 7 >156.25 All options enabled with register-based statistics counters 8,202 9,965 3 >156.25 4,827 5,921 8 >156.25 6,822 7,926 11 >156.25 Settings All options disabled IEEE 1588v2 feature enabled with 2-step synchronization Timestamping is enabled ptp_1step is disabled IEEE 1588v2 feature enabled with 1-step and 2-step synchronization Timestamping is enabled ptp_1step is disabled August 2014 Altera Corporation 10-Gbps Ethernet MAC MegaCore Function User Guide 1-6 Chapter 1: About This IP Core Performance and Resource Utilization Table 1-7 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-7. Stratix V Performance and Resource Utilization for 10M-10GbE MAC Combinational ALUTs Dedicated Logic Registers Memory Block (M20K) fMAX (MHz) 3,654 4,645 7 >156.25 All options enabled with memory-based statistics counters 4,877 5,797 11 >156.25 All options enabled with register-based statistics counters 7,313 7,544 7 >156.25 Settings All options disabled 10-Gbps Ethernet MAC MegaCore Function User Guide August 2014 Altera Corporation 2. Getting Started with Altera IP Cores This chapter provides a general overview of the Altera IP core design flow to help you quickly get started with any Altera IP core. 2.1. Introduction to Altera IP Cores Altera(R) and strategic IP partners offer a broad portfolio of off-the-shelf, configurable IP cores optimized for Altera devices. Altera delivers an IP core library with the Quartus(R) II software. OpenCore Plus IP evaluation enables fast acquisition, evaluation, and hardware testing of all Altera IP cores. Nearly all complex FPGA designs include optimized logic from IP cores. You can integrate optimized and verified IP cores into your design to shorten design cycles and maximize performance. The Quartus II software includes the Altera IP Library, and supports IP cores from other sources. You can define and generate a custom IP variation to represent complex design logic in your project. The Altera IP Library provides the following types of IP cores: Basic functions DSP functions Interface protocols Memory interfaces and controllers Processors and peripherals For more information about specific IP cores, refer to IP user guide documentation. 2.2. Installing and Licensing IP Cores The Quartus II software includes the Altera IP Library. The library provides many useful IP core functions for production use without additional license. You can fully evaluate any licensed Altera IP core in simulation and in hardware until you are satisfied with its functionality and performance. Some Altera IP cores, such as MegaCore(R) functions, require that you purchase a separate license for production use. After you purchase a license, visit the Self Service Licensing Center to obtain a license number for any Altera product. For additional information, refer to Altera Software Installation and Licensing. Figure 2-1. IP core Installation Path acds quartus - Contains the Quartus II software ip - Contains the Altera IP Library and third-party IP cores altera - Contains the Altera IP Library source code - Contains the IP core source files August 2014 Altera Corporation 10-Gbps Ethernet MAC MegaCore Function User Guide 2-2 Chapter 2: Getting Started with Altera IP Cores IP Catalog and Parameter Editor 1 The default installation directory on Windows is :\altera\; on Linux it is /altera/. 2.2.1. OpenCore Plus IP Evaluation Altera's free OpenCore Plus feature allows you to evaluate licensed MegaCore IP cores in simulation and hardware before purchase. You need only purchase a license for MegaCore IP cores if you decide to take your design to production. OpenCore Plus supports the following evaluations: Simulate the behavior of a licensed IP core in your system. Verify the functionality, size, and speed of the IP core quickly and easily. Generate time-limited device programming files for designs that include IP cores. Program a device with your IP core and verify your design in hardware. OpenCore Plus evaluation supports the following two operation modes: Untethered--run the design containing the licensed IP for a limited time. Tethered--run the design containing the licensed IP for a longer time or indefinitely. This requires a connection between your board and the host computer. All IP cores using OpenCore Plus in a design time out simultaneously when any IP core times out. 2.3. IP Catalog and Parameter Editor The Quartus II IP Catalog (Tools > IP Catalog) and parameter editor help you easily customize and integrate IP cores into your project. You can use the IP Catalog and parameter editor to select, customize, and generate files representing your custom IP variation. The IP Catalog automatically displays the IP cores available for your target device. Double-click any IP core name to launch the parameter editor and generate files representing your IP variation. The parameter editor prompts you to specify your IP variation name, optional ports, architecture features, and output file generation options. The parameter editor generates a top-level .qsys or .qip file representing the IP core in your project. Alternatively, you can define an IP variation without an open Quartus II project. When no project is open, select the Device Family directly in IP Catalog to filter IP cores by device. 1 The IP Catalog is also available in Qsys (View > IP Catalog). The Qsys IP Catalog includes exclusive system interconnect, video and image processing, and other system-level IP that are not available in the Quartus II IP Catalog. Use the following features to help you quickly locate and select an IP core: Filter IP Catalog to Show IP for active device family or Show IP for all device families. Search to locate any full or partial IP core name in IP Catalog. Click Search for Partner IP, to access partner IP information on the Altera website. 10-Gbps Ethernet MAC MegaCore Function User Guide August 2014 Altera Corporation Chapter 2: Getting Started with Altera IP Cores Using the Parameter Editor 2-3 Right-click an IP core name in IP Catalog to display details about supported devices, installation location, and links to documentation. Figure 2-2. Quartus II IP Catalog Search and filter IP for your target device Double-click to customize, right-click for information 1 The IP Catalog and parameter editor replace the MegaWizardTM Plug-In Manager in the Quartus II software. The Quartus II software may generate messages that refer to the MegaWizard Plug-In Manager. Substitute "IP Catalog and parameter editor" for "MegaWizard Plug-In Manager" in these messages. 2.4. Using the Parameter Editor The parameter editor helps you to configure your IP variation ports, parameters, architecture features, and output file generation options: August 2014 Use preset settings in the parameter editor (where provided) to instantly apply preset parameter values for specific applications. View port and parameter descriptions and links to detailed documentation. Altera Corporation 10-Gbps Ethernet MAC MegaCore Function User Guide 2-4 Chapter 2: Getting Started with Altera IP Cores Customizing and Generating IP Cores Generate testbench systems or example designs (where provided). Figure 2-3. IP Parameter Editors View IP port and parameter details Legacy parameter editors Specify your IP variation name and target device Apply preset parameters for specific applications 2.5. Customizing and Generating IP Cores You can customize IP cores to support a wide variety of applications. The Quartus II IP Catalog displays IP cores available for the current target device. The parameter editor guides you to set parameter values for optional ports, features, and output files. To customize and generate a custom IP core variation, follow these steps: 1. In the IP Catalog (Tools > IP Catalog), locate and double-click the name of the IP core to customize. The parameter editor appears. 2. Specify a top-level name for your custom IP variation. This name identifies the IP core variation files in your project. If prompted, also specify the target Altera device family and output file HDL preference. Click OK. 3. Specify the desired parameters, output, and options for your IP core variation: Optionally select preset parameter values. Presets specify all initial parameter values for specific applications (where provided). Specify parameters defining the IP core functionality, port configuration, and device-specific features. Specify options for generation of a timing netlist, simulation model, testbench, or example design (where applicable). Specify options for processing the IP core files in other EDA tools. 4. Click Finish or Generate to generate synthesis and other optional files matching your IP variation specifications. The parameter editor generates the top-level .qip or .qsys IP variation file and HDL files for synthesis and simulation. Some IP cores also simultaneously generate a testbench or example design for hardware testing. 10-Gbps Ethernet MAC MegaCore Function User Guide August 2014 Altera Corporation Chapter 2: Getting Started with Altera IP Cores Specifying the Parameters 2-5 When you generate the IP variation with a Quartus II project open, the parameter editor automatically adds the IP variation to the project. Alternatively, click Project > Add/Remove Files in Project to manually add a top-level .qip or .qsys IP variation file to a Quartus II project. To fully integrate the IP into the design, make appropriate pin assignments to connect ports. You can define a virtual pin to avoid making specific pin assignments to top-level signals. 2.6. Specifying the Parameters 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. 4. Specify the required parameters in the Qsys tool. For detailed explanations of these parameters, refer to "10GbE MAC Parameter Settings" on page 2-8. 5. Click Finish to complete the IP core instance and add it to the system. 2.7. Upgrading Outdated IP Cores Altera IP cores have a version number that corresponds with the Quartus II software version. The Quartus II software alerts you when your IP core is outdated with respect to the current Quartus II software version. Click Project > Upgrade IP Components to easily identify and upgrade outdated IP cores. You are prompted to upgrade IP when the new version includes port, parameter, or feature changes. You are also notified if IP is unsupported or cannot be migrated in the current software. Most Altera IP cores support automatic simultaneous upgrade, as indicated in the GUI. IP cores unsupported by auto upgrade require regeneration in the parameter editor. To upgrade outdated IP cores in your design, follow these steps: 1. In the latest version of the Quartus II software, open the Quartus II project containing an outdated IP core variation. 2. Click Project > Upgrade IP Components. The Upgrade IP Components dialog box displays all outdated IP cores in your project, along with basic instructions for upgrading each core. 3. Upgrading IP cores changes your original design files. To preserve these original files, click Project > Archive and save a project archive preserving your original files. 4. To simultaneously upgrade all IP cores that support automatic upgrade, click Perform Automatic Upgrade. The IP variation upgrades to the latest version. August 2014 Altera Corporation 10-Gbps Ethernet MAC MegaCore Function User Guide 2-6 Chapter 2: Getting Started with Altera IP Cores Simulating IP Cores 5. To upgrade IP cores unsupported by automatic upgrade, select the IP core in Upgrade IP Components dialog box, and then click Upgrade in Editor. The parameter editor appears. Click Finish or Generate to regenerate the IP variation and complete the upgrade. The version number updates when complete. Figure 2-4. Upgrading Outdated IP Cores Indicates that IP upgrade is: Required Optional Complete Unsupported Displays upgrade status for all IP cores in the Project Upgrades all IP core that support "Auto Upgrade" Upgrades individual IP cores unsupported by "Auto Upgrade" 1 Altera verifies that the current version of the Quartus II software compiles the previous version of each IP core. The MegaCore IP Library Release Notes and Errata reports any verification exceptions. Altera does not verify compilation for IP cores older than the previous release. Alternatively, you can upgrade IP cores at the command line. To upgrade a single IP core: quartus_sh --ip_upgrade -variation_files To upgrade a list of IP cores: quartus_sh --ip_upgrade -variation_files ;; 1 File paths must be relative to the project directory and you must reference the IP variation .v or .vhd file or .qsys file, not the .qip file. 2.8. Simulating IP Cores The Quartus II software supports RTL- and gate-level design simulation of Altera IP cores in supported EDA simulators. Simulation involves setting up your simulator working environment, compiling simulation model libraries, and running your simulation. You can use the functional simulation model and the testbench or example design generated with your IP core for simulation. The functional simulation model and testbench files are generated in a project subdirectory. This directory may also include scripts to compile and run the testbench. For a complete list of models or libraries required to simulate your IP core, refer to the scripts generated with the testbench. You can use the Quartus II NativeLink feature to automatically generate simulation files and scripts. NativeLink launches your preferred simulator from within the Quartus II software. 10-Gbps Ethernet MAC MegaCore Function User Guide August 2014 Altera Corporation Chapter 2: Getting Started with Altera IP Cores Simulating IP Cores 2-7 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, you are required to compile all files listed in the /_sim output file. Otherwise, the simulation may fail. f For more information about simulating Altera IP cores, refer to Simulating Altera Designs in volume 3 of the Quartus II Handbook. August 2014 Altera Corporation 10-Gbps Ethernet MAC MegaCore Function User Guide 2-8 Chapter 2: Getting Started with Altera IP Cores 10GbE MAC Parameter Settings 2.9. 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. Table 2-1 describes the parameters and how they affect the behavior of the IP core. Table 2-1. 10GbE Parameters Parameter Speed Enable preamble pass-through mode Description Use this parameter to select the speed options. By default, the 10G MAC option is 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, 1Gbps, 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 tx_preamble_control, rx_lane_decoder_preamble_control, and rx_preamble_inserter_control registers to 1. This parameter is disabled if you selected Enable 1G/10G MAC. Enable priority-based flow control (PFC) Turn on this parameter to enable PFC. Refer to "Priority-Based Flow Control" on page 7-20 for more information on PFC and its operations. Number of PFC queues 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. Enable unidirectional mode Turn on this parameter to enable unidirectional mode on transmit path for 10G. This feature only works in 10G speed and in the transmit datapath. Datapath option 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. Enable supplementary address Turn on this parameter to enable supplementary addresses. To enable supplementary addresses, you must turn on this parameter and set the EN_SUPP0/1/2/3 bits in the rx_frame_control register to 1. Enable CRC on transmit path 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 tx_crcins_control[1] register bit to 1. Enable statistics collection Turn on this parameter to collect statistics on the transmit and receive datapaths. When you turn on Statistics collection, the default implementation of the statistics counters is Memory-based. Statistics counters 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. Enable time stamping Enable PTP 1-step clock support 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. Timestamp fingerprint width Use this parameter to set the width in bits for the time stamp fingerprint on the TX path. The default value is 4 bits. 10-Gbps Ethernet MAC MegaCore Function User Guide August 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: 1 10GbE MAC with XAUI PHY 10GbE MAC with 10GBASE-R PHY XAUI 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 14.0 Stratix IV GX FPGA development kit (for XAUI PHY) Transceiver Signal Integrity development kit, Stratix IV GT Edition (for 10GBASE-R PHY) ModelSim(R)-AE 6.6c, ModelSim-SE 6.6c or higher f For more information on the development kits, refer to the following documents: August 2014 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 Altera Corporation 10-Gbps Ethernet MAC MegaCore Function User Guide 3-2 Chapter 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 Altera FPGA Client Application 64-bit Avalon-ST Avalon-ST 64 Single-Clock / Dual-Clock FIFO 64 Design Example Rx FIFO Buffer 64 Tx FIFO Buffer 64-bit Avalon-ST 64 Configuration and Debugging Tools 10GbE MAC Pipeline Bridge 32 32 32-bit Avalon-MM Client Application (Configuration, Status, and Statistics) 32-bit Avalon-MM 72 72-bit SDR XGMII 72 JTAG to Avalon Master Bridge Ethernet Loopback 72 MDIO 72-bit SDR XGMII 72 XAUI or 10GBASE-R PHY XAUI / 10GBASE-R System Console (for debugging) 10-Gbps Ethernet MAC MegaCore Function User Guide MDIO Signals External PHY August 2014 Altera Corporation Chapter 3: 10GbE MAC Design Examples 10GbE Design Example Components 3-3 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. 1 To 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: August 2014 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. Altera Corporation 10-Gbps Ethernet MAC MegaCore Function User Guide 3-4 Chapter 3: 10GbE MAC Design Examples 10GbE Design Example Components Line loopback--turn on this loopback to verify the functionality of the PHY when 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. Table 3-1 describes the registers you can use to enable or disable the desired loopback. Table 3-1. Loopback Registers Byte Offset Register 0x00 line loopback 0x04 Reserved 0x08 local loopback Description 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 Table 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 Table 3-1 for the Ethernet loopback registers. Table 3-2. Base Addresses of Design Example Components Component 10GbE MAC 1 Base Address 0x000 XAUI or 10GBASE-R PHY 0x40000 MDIO 0X10000 Ethernet loopback 0x10200 RX FIFO (Avalon-ST Single-Clock FIFO) 0x10400 TX FIFO (Avalon-ST Single-Clock FIFO) 0x10600 This 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 Guide August 2014 Altera Corporation Chapter 3: 10GbE MAC Design Examples 10GbE Design Example Files 3-5 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 /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 Table 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 Name August 2014 Description setup_proj.tcl A Tcl script that creates a new Quartus II project and sets up the project environment for your design example. Not applicable for Stratix V design. setup_proj_sv.tcl A Tcl script that creates a new Quartus II project for Stratix V design and sets up the project environment for your design example. altera_eth_10g_design_mac_xaui.qsys A Qsys file for the 10GbE MAC and XAUI PHY design example. The PHY is set to hard XAUI by default. altera_eth_10g_design_mac_xaui_sv.qsys A Qsys file for the 10GbE MAC and XAUI PHY 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. altera_eth_10g_design_mac_base_r_sv.qsys A Qsys file for the 10GbE MAC and 10GBASE-R PHY design example with the Quartus II software targeting the Stratix V device. Altera Corporation 10-Gbps Ethernet MAC MegaCore Function User Guide 3-6 Chapter 3: 10GbE MAC Design Examples Creating a New 10GbE Design Table 3-3. 10GbE Design Example Files (Part 2 of 2) File Name Description setup_SIVGX230C2ES.tcl A Tcl script that sets the pin assignments and I/O standards for the Stratix IV GX FPGA development board. Use this Tcl script for the 10GbE MAC with XAUI PHY design example. setup_EP4S100G5H40I3.tcl 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. setup_5SGXEA7N2F40C2ES.tcl 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. top.sdc The Quartus II SDC constraint file for use with the TimeQuest timing analyzer. top.v The top-level entity file of the design example for verification in hardware. Not applicable for Stratix V design. top_sv.v The top-level entity file of the design example-- with the Quartus II software targeting the Stratix V device--for verification in hardware. common.tcl A Tcl script that contains basic functions based on the system console APIs to access the registers through the Avalon-MM interface. config.tcl A Tcl script that configures the design example. csr_pkg.tcl 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. show_stats.tcl A Tcl script that displays the MAC statistics counters. altera_eth_10g_design_example_hw.tcl A hardware Tcl script that contains the composition of the Ethernet system. 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 /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 Guide August 2014 Altera Corporation Chapter 3: 10GbE MAC Design Examples Creating a New 10GbE Design 3-7 3. Open the Quartus II Tcl Console window by pointing to Utility Windows on the View menu and then selecting Tcl Console. In the Quartus II Tcl Console window, type the following command to set up the project environment: source setup_proj.tclr 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.tclr 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.tclr 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. 1 By 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. August 2014 Altera Corporation 10-Gbps Ethernet MAC MegaCore Function User Guide 3-8 Chapter 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. Table 3-4 describes these parameters. Table 3-4. Design Example Parameters Name Value Description Configuration MDIO Specifies whether the Ethernet system requires a MDIO core to access the external PHY device management registers for configuration and management purposes. MDIO None XAUI PHY PHY IP 10GBase-R PHY None Avalon-ST Single Clock FIFO Avalon-ST Dual Clock FIFO FIFO Avalon-ST Single Clock FIFO + Avalon-ST Dual Clock FIFO None 1 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. The 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-8. 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 Guide August 2014 Altera Corporation Chapter 3: 10GbE MAC Design Examples 10GbE Testbenches 3-9 Figure 3-3. Testbench Block Diagram Testbench Avalon-MM Control Register Avalon-ST Transmit Frame Generator Avalon-ST Receive Frame Monitor avalon_bfm_wrapper.sv Avalon Driver Ethernet Packet Monitor Avalon-MM Avalon-ST DUT Loopback on XGMII Avalon-ST Ethernet Packet 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: August 2014 10GbE MAC and XAUI PHY testbench--/ethernet/ altera_eth_10g_design_example/altera_eth_10g_mac_xaui/testbench 10GbE MAC and 10GBASE-R PHY testbench-- /ethernet/ altera_eth_10g_design_example/altera_eth_10g_mac_base_r/testbench Altera Corporation 10-Gbps Ethernet MAC MegaCore Function User Guide 3-10 Chapter 3: 10GbE MAC Design Examples 10GbE Testbenches Table 3-5 describes the files that implement the testbench. Table 3-5. Testbench Files File Name Description avalon_bfm_wrapper.sv A wrapper for the Avalon BFMs that the avalon_driver.sv file uses. avalon_driver.sv A SystemVerilog HDL driver that utilizes the BFMs to exercise the transmit and receive path, and access the Avalon-MM interface. avalon_if_params_pkg.sv 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. avalon_st_eth_packet_monitor.sv A SystemVerilog HDL testbench that monitors the Avalon-ST transmit and receive interfaces. eth_mac_frame.sv A SystemVerilog HDL class that defines the Ethernet frames. The avalon_driver.sv file uses this class. eth_register_map_params_pkg.sv A SystemVerilog HDL package that maps addresses to the Avalon-MM control registers. tb_run.tcl A Tcl script that starts a simulation session in the ModelSim simulation software. Not applicable for Stratix V design. tb_run_sv.tcl A Tcl script that starts a simulation session in the ModelSim simulation software for Stratix V design only. tb.sv 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. Not applicable for Stratix V design. tb_sv.sv The top-level testbench file for Stratix V design only. 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. 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 Guide August 2014 Altera Corporation Chapter 3: 10GbE MAC Design Examples 10GbE Testbenches 3-11 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 /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 Console. In the Quartus II Tcl Console window, type the following command to set up the project environment: source setup_proj.tclr 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. 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. August 2014 Altera Corporation 10-Gbps Ethernet MAC MegaCore Function User Guide 3-12 Chapter 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 //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.tclr 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 RX Statistics and TX Statistics: # # # # # # # # # # # # # # # # # # # # # # # # # # # # # framesOK = 8 framesErr = 0 framesCRCErr = 0 octetsOK = 5138 pauseMACCtrlFrames = 2 ifErrors = 0 unicastFramesOK = 4 unicastFramesErr = 0 multicastFramesOK = 1 multicastFramesErr = 0 broadcastFramesOK = 1 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 = 1 multicastMACCtrlFrames = 1 broadcastMACCtrlFrames = 0 3.6.6. Enabling Local Loopback 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 U_AVALON_DRIVER.avalon_mm_csr_wr(offset,value) where 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 Guide August 2014 Altera Corporation Chapter 3: 10GbE MAC Design Examples 10GbE Testbenches 3-13 // 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.tclr 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 csr_reset_reset_n signal completes. Figure 3-4. Reset and Configuration csr_clk_clk csr_reset_reset_n csr_address [18:0] 40084 csr_read csr_readdata [31:0] csr_write csr_writedata [31:0] 00000002 csr_waitrequest August 2014 Altera Corporation 10-Gbps Ethernet MAC MegaCore Function User Guide 3-14 Chapter 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] 0 4 0 avalon_st_tx_error 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] 0 avalon_st_rx_error [5:0] 0 10-Gbps Ethernet MAC MegaCore Function User Guide 4 August 2014 Altera Corporation Chapter 3: 10GbE MAC Design Examples 10GbE Design Example Compilation and Verification in Hardware 3-15 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 DUT XAUI/ 10GBASE-R Remote Partner 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 /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 Tcl Console. In the Quartus II Tcl Console window, type the following command to set up the project environment: source setup_proj.tclr August 2014 Altera Corporation 10-Gbps Ethernet MAC MegaCore Function User Guide 3-16 Chapter 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.tclr 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.tclr 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. 1 If 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 Guide August 2014 Altera Corporation Chapter 3: 10GbE MAC Design Examples 10GbE Design Example Compilation and Verification in Hardware 3-17 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 /csr_scripts. 4. Type the following command to configure the design example: source config.tclr 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.tclr 1 The config.tcl and show_stats.tcl scripts support only one USB-Blaster 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 0 # 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 0 # closes the connection close_jtag Save and close the Tcl script and type the following command: source