F-Tile Ethernet Intel® FPGA Hard IP Design Example User Guide

ID 683804
Date 10/02/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

3.3. Simulation

The testbench provides basic functionality such as the startup and wait for lock and send and receive a few packets utilizing the PTP feature.
Since Fast Sim model does not support the PTP timestamp accuracy, the model is not enabled by default in the designs with enabled PTP feature. To utilize the Fast Sim model for functional purpose simulation, refer to Fast Sim Model for FGT Variants.
Note: In PTP design examples, the simulation printout displays the timestamp accuracy as RX ITS - TX ETS information.
  1. Assert global reset (i_rst_n) to reset the F-Tile Ethernet Intel FPGA Hard IP.
  2. Wait until resets acknowledgment. The o_rst_ack_n signal goes low.
  3. Deasserts the global reset.
  4. Wait until o_tx_lanes_stable bit is set to 1, indicating TX path is ready.
  5. Wait until o_rx_pcs_ready bit is set to 1, indicating RX path is ready.
  6. Perform the PTP user flow until tx_ptp_ready and rx_ptp_ready signals are set to 1.
  7. Write to PTP Asymmetry Delay and peer-to-peer MeanPathDelay Avalon® memory-mapped interface registers.
  8. Reset the PTP monitor.
  9. Read TX packet data information from 0x00 - 0x34 registers in sequential order.
    • 0x00: Set hw_pc_ctrl[6] = 1'b1 to enable snapshot bit to read the TX packet statistics.
    • 0x020/0x24: TX start of packet counter (LSB/MSB)
    • 0x28/0x2C: TX end of packet counter (LSB/MSB)
    • 0x30/0x34: TX error counter (LSB/MSB)
    • 0x00: Set hw_pc_ctrl[6] = 1'b0 to disable snapshot bit.
  10. Read RX packet data information from 0x38 - 0x4C registers in sequential order.
    • 0x00: Set hw_pc_ctrl[6] = 1'b1 to enable snapshot bit to read the RX packet statistics.
    • 0x38/0x3C: RX start of packet counter (LSB/MSB)
    • 0x40/0x44: RX end of packet counter (LSB/MSB)
    • 0x48/0x4C: RX error counter (LSB/MSB)
    • 0x00: Set hw_pc_ctrl[6] = 1'b0 to disable snapshot bit.
  11. Compare read counters to ensure 16 packets were sent and received.
  12. Instruct packet client to stop data transmission and clear the counters by writing hw_pc_ctrl[2:0]=3'b100 to stop the packet generator.
  13. Start the PTP checker.
    1. Wait until the packet transmission is complete. Poll the TX_PKT_VALID bit to monitor the transmission status.
    2. Read TX packet data information from 0x102 - 0x104 registers in sequential order, starting from the 0x102 register. The PTP monitor logic refreshes the 0x102 - 0x104 registers content to next data when read from 0x104 register.
    3. Repeat the previous step until the TX_PKT_EOP bit is set to 1 indicating the read operation reached the end of the packet.
    4. Read TX PTP command information from 0x105 - 0x10A registers in sequential order, starting from the 0x105 register. The PTP monitor logic refreshes the 0x105 - 0x10A registers content to next data when read from 0x10A register.
    5. If TX PTP command indicates a PTP packet:
      1. Wait until the TX egress timestamp is available. Use the TX_PTP_ETS_VALID signal to monitor the status.
      2. Read the TX egress timestamp from the 0x10C - 0x10F registers in sequential order, starting with the 0x10C register.
      The PTP monitor logic refreshes content of 0x10C - 0x10F registers to next data when read from the 0x10F register.
    6. Wait until the packets are loop backed in the RX data path. Poll the RX_PKT_VALID bit to monitor the transmission status.
    7. Read RX packet data information from 0x110 - 0x112 registers in sequential order, starting with the 0x110 register. The PTP monitor logic refreshes the 0x110 - 0x112 registers content to next data when read from 0x112 register.
    8. Repeat the previous step until the RX_PKT_EOP bit is set to 1 indicating the read operation reached the end of the packet.
    9. Read RX ingress timestamp.
      1. Read the RX ingress timestamp from the 0x114 - 0x116 registers in sequential order, starting with the 0x14 register. The PTP monitor logic refreshes the 0x114 - 0x116 registers content to next data when read from 0x116 register.
    10. Display the TX packet content, RX packet content, TX PTP commands, TX egress timestamp, and RX ingress timestamp information.
    11. Display the comparison information. Note that in 1-step commands, the TX/RX packets and PTP commands field content is the same.
    12. Repeat steps b through step k until the system processes all packets.
      Note: The design example simulation performs step 14 for only first six packets to reduce long simulation time.
  14. Perform Avalon® memory-mapped interface test on PTP-related registers.
    • Selective PTP Asymmetry Delay and P2P MeanPathDelay registers
    • Selective Master TOD Avalon® memory-mapped interface registers
  15. Perform Avalon® memory-mapped interface test. Write and read Ethernet IP registers.
    • 0x104: Scratch register
    • 0x108: Ethernet IP soft reset register
    • 0x214: TX MAC source address register [31:0]
    • 0x218: TX MAC source address register [47:32]
    • 0x21C: RX MAC frame size register
  16. Perform Avalon® memory-mapped interface 2 test. Write and read transceiver registers.

The following sample output illustrates a successful simulation test:

203145ns : Frame monitored by basic_avl_tb_top.U_MON_TX
203145ns : Frame length : 128
203145ns : Empty : 0
	----------------------------------------------------------
	      |  00 01 02 03 04 05 06 07  08 09 10 11 12 13 14 15 
	----------------------------------------------------------
	 0000 |  ab e4 23 39 f0 00 1e 84  33 9f 01 00 88 f7 00 00 
	 0010 |  10 11 12 13 aa 15 16 aa  18 19 1a 1b 1c 1d 1e 1f 
	 0020 |  20 21 22 23 bb cc 26 27  28 29 2a 2b 2c 2d 2e 2f 
	 0030 |  30 31 32 33 34 35 36 37  bb cc 3a 3b 3c 3d 3e 3f 
	 0040 |  40 41 42 43 44 45 46 47  48 49 4a 4b 4c 4d 4e 4f 
	 0050 |  50 51 52 53 54 55 56 57  58 59 5a 5b 5c 5d 5e 5f 
	 0060 |  60 61 62 63 64 65 66 67  68 69 6a 6b 6c 6d 6e 6f 
	 0070 |  70 71 72 73 74 75 76 77  78 79 7a 7b 7c 7d 7e 7f 
	----------------------------------------------------------

PTP Command found.
tx_timestamp_q.push_back
The time now is 210000ns 

210805ns : Frame monitored by basic_avl_tb_top.U_MON_RX
210805ns : Frame length : 128
210805ns : Empty : 0
	----------------------------------------------------------
	      |  00 01 02 03 04 05 06 07  08 09 10 11 12 13 14 15 
	----------------------------------------------------------
	 0000 |  ab e4 23 39 f0 00 1e 84  33 9f 01 00 88 f7 00 00 
	 0010 |  10 11 12 13 aa 15 16 aa  18 19 1a 1b 1c 1d 1e 1f 
	 0020 |  20 21 22 23 bb cc 26 27  28 29 2a 2b 2c 2d 2e 2f 
	 0030 |  30 31 32 33 34 35 36 37  bb cc 3a 3b 3c 3d 3e 3f 
	 0040 |  40 41 42 43 44 45 46 47  48 49 4a 4b 4c 4d 4e 4f 
	 0050 |  50 51 52 53 54 55 56 57  58 59 5a 5b 5c 5d 5e 5f 
	 0060 |  60 61 62 63 64 65 66 67  68 69 6a 6b 6c 6d 6e 6f 
	 0070 |  70 71 72 73 74 75 76 77  78 79 7a 7b 7c 7d 7e 7f 
	----------------------------------------------------------

------------------------------
TX PTP Command #1
------------------------------
Egress Timestamp Request            : 1
Insert Timestamp                    : 0
Update CorrectionField              : 0
Clear UDP/IPv4 Checksum             : 0
Update UDP/IPv6 Extended Bytes      : 0
Add Peer-to-Peer (P2P) MinPathDelay : 0
Add Asymmetry Delay                 : 0
Asymmetry Delay Sign                : 0
Asymmetry & P2P MinPathDelay Select : 0
Timestamp Field Offset              : 0x0000
Correction Field Offset             : 0x0000
TX Fingerprint Data                 : 0x00000001
TX Ingress Timestamp                : 0x00000000000000001234abcd
------------------------------
Timestamps #1
------------------------------
TX Egress Timestamp                 : 0x000000000000000265ae2c80
RX Ingress Timestamp                : 0x000000000000000265ae1680
TX User Fingerprint                 : 0x00000001
TX Returned Fingerprint             : 0x00000001
------------------------------
Comparison #1
------------------------------
RX_ITS - TX_ETS       : 0x1ffffffffffffffffffffea00/-0.0859 ns

TX Timestamp Fields   : 0x3031323334353637bbcc
RX Timestamp Fields   : 0x3031323334353637bbcc

TX Correction Fields  : 0x16aa18191a1b1c1d
RX Correction Fields  : 0x16aa18191a1b1c1d