GTS Ethernet Hard IP User Guide: Agilex™ 3 FPGAs and SoCs

ID 848477
Date 7/07/2025
Public
Document Table of Contents

12.4.3.2. Adjust RX UI

  1. Request snapshot of initial RX TAM:
    csr_write (ptp_uim_tam_snapshot.rx_tam_snapshot, 1’b1)
  2. Read snapshotted initial TAM and counter values:
    rx_tam_0_31_0 = csr_read (ptp_rx_uim_tam_info0.tam_31_0[31:0])
    rx_tam_0_47_32 = csr_read (ptp_rx_uim_tam_info1.tam_47_32[15:0])
    rx_tam_0_cnt   = csr_read (ptp_rx_uim_tam_info1.tam_cnt[30:16])
    rx_tam_0_valid = csr_read (ptp_rx_uim_tam_info1.tam_valid[31])
    • If rx_tam_0_valid = 1, complete TAM by concatenating the initial TAM values:
      rx_tam_0 = {rx_tam_0_47_32, rx_tam_0_31_0};
    • If rx_tam_0_valid = 0, restart from step1.
  3. Starting from time when step 1 is executed, wait for time duration as specified in the Minimum and Maximum Reference Time (TAM) Interval for UI Measurement (Hardware) section.
  4. Request snapshot of Nth RX TAM:
    csr_write (ptp_uim_tam_snapshot.rx_tam_snapshot, 1’b1)
  5. Read snapshotted Nth TAM and counter values:
    rx_tam_n_31_0  = csr_read (ptp_rx_uim_info0.tam_31_0[31:0])
    rx_tam_n_47_32 = csr_read (ptp_rx_uim_tam_info1.tam_47_32[15:0])
    rx_tam_n_cnt   = csr_read (ptp_rx_uim_tam_info1.tam_cnt[30:16])
    rx_tam_n_valid = csr_read (ptp_rx_uim_tam_info1.tam_valid[31])
    Form the TAM by concatenating snapshotted Nth TAM values:
    rx_tam_n = {rx_tam_n_47_32, rx_tam_n_31_0};
  6. Check if there was a large change to TOD value impacting TAM value:
    rx_tam_n_valid = csr_read (ptp_rx_uim_tam_info1.tam_valid[31])

    If rx_tam_n_valid = 0, restart step 1. If you used rx_tam_n as a new rx_tam_0 and rx_tam_n_cnt as a new rx_tam_0_cnt, you can skip step 1 and 2. Then, you can start the wait time in step 3 when step 4 executes.

  7. Calculation:
    1. Get TAM interval
      rx_tam_interval = <Refer to Reference Time Interval>
      rx_tam_interval_per_pl = rx_tam_interval / PL
    2. Calculate time elapsed:
      rx_tam_delta = 
         (rx_tam_n <= rx_tam_0) ? [(rx_tam_n + 10^9ns) – rx_tam_0] 
                                 : (rx_tam_n – rx_tam_0)
      Per step 3, rx_tam_0 and rx_tam_n difference must be within the expected time range.
      • If rx_tam_delta (in ms) is lesser that the minimum time, which is 0.16 ms, discard the result and restart from step 3.
      • If rx_tam_delta (in ms) is greater than the maximum value, which is 536.85 ms, discard the result and restart from step 1 or step 3 by using rx_tam_n as a new rx_tam_0.
      Note: 10^9ns = 48’h 3B9A_CA00_0000
    3. Calculate TAM count value:
      rx_tam_cnt = (rx_tam_n_cnt < rx_tam_0_cnt) ? [(rx_tam_n_cnt + 2^15) – rx_tam_0_cnt]
      : (rx_tam_n_cnt – rx_tam_0_cnt)
      Per step 3, rx_tam_0 and rx_tam_n difference must be within the expected time range.
      • If rx_tam_cnt (in ms) is lesser that the minimum time value, which is 10 ms, discard the result and restart from step 3.
      • If rx_tam_cnt (in ms) is greater than the maximum value, which is, 32,767 ms, discard the result and restart from step 1 or step 3 by using rx_tam_n as a new rx_tam_0.
    4. Calculate UI value:
      rx_ui = (rx_tam_delta) / (rx_tam_cnt * rx_tam_interval_pl)
  8. Write the calculated UI value to IP:
    csr_write (rx_ptp_ui, rx_ui)

    Ensure the format is {4-bit nanoseconds, 28-bit fractional nanoseconds}.

  9. After first UI measurement, for every minimum TAM interval or longer duration, repeat step 1 to 8. This is to prevent time counter drift from the golden time-of-day in the system whenever the clock ppm changes.