ID 683621
Date 7/20/2022
Public

## 2.4.3.1.2. FIFO Latency Calculation

Latency through FIFOs (in PC mode) may vary from reset to reset. You can determine that variation by using the appropriate FIFO latency calculation logic. The phase measuring technique measures the distance between read and write counters. The phase measuring circuit is designed to work in the case of a phase comp FIFO and in the case of a phase comp FIFO where the read and write pointers may have an exact 2:1 ratio.

To measure the fullness of the FIFO, run your sampling clock at a rate that is not equal to the parallel clock. The guideline for calculating the sampling clock is that the sampling clock sweeps various phase relationships relative to the parallel clock. Using a simple counter, you should determine how often the resulting pulse is a 1 versus a 0. You can find this implementation in the FIFO latency calculation logic referenced below.

Figure 85. Phase Measuring FIFO

Below is an example implementation of the FIFO latency calculation logic. Each FIFO in phase compensation mode has a latency measurement port (read only) available at the PCS-Core interface. Each latency measurement port supplies the latency pulse whose duty cycle depends on the FIFO latency. This latency pulse is further processed in the FPGA fabric to calculate FIFO latency. There are four similar pulses for the four FIFOs, and you must perform latency calculations on all of them separately. The IP represented in the following figure represents the logic in the FPGA fabric that performs the latency calculation. This IP is not a part of the Native PHY IP core, so you must instantiate it exclusively. Output of the IP is the Total FIFO count bus. This bus produces the result of the FIFO latency calculation. This result can only be read when the calculation is complete, and is denoted by the result_ready signal coming out of the IP. Refer to FIFO Latency Calculation.

Figure 86. FIFO Latency Calculation

Once result_ready is asserted, you can read data on the Total FIFO count bus and calculate latency time using the following equation.

Figure 87. FIFO Latency Formula

The latency pulse available at a latency measurement port of a FIFO appears as shown below. The duty cycle of the pulse depends on the difference between the read and write pointers at a particular instant. The duty cycle of a pulse varies with time as both read and write pointers move. To find the actual latency through the FIFO, the IP block calculates the average of latency pulse duty cycles for an appropriate duration.

As seen in the figure below, a sampling clock (LATENCY_SCLK) samples the pulse. After the sampling duration, all the samples of 1s are accumulated and appear at the Total FIFO count output bus, which is then used in FIFO Latency Calculation to calculate latency (in nsec). The Number of pulses parameter is the actual number of latency pulses for which the latency calculation logic executes. This parameter defines the execution time of the latency calculation logic. The design file referenced below defaults to 128 latency pulses to calculate FIFO latency. Due to hardware limitations, the sampling clock cannot be higher than 260 MHz.

Figure 88. FIFO Latency Measurement Port Number of pulses and the LATENCY_SCLK period vary depending on your particular implementation.
Figure 89. FIFO Latency Calculation Logic
Table 91.  FIFO Latency Calculation IP Signals
Symbol Input/Output Description
latency_sclk Input Sampling clock required by the latency calculation logic
start_calc Input Control signal to start the latency calculation
fifo_latency_pulse Input Latency pulse
total_fifo_count Output Result from the latency calculation logic
result_ready Output Status signal that signifies completion of the latency calculation logic
Figure 90. FIFO Latency Calculation Logic for Four FIFOsPoint A is the assertion of start_calc signals, and point B is an assertion of result_ready signals. The total_fifo_count signal is valid after result_ready is asserted. Figure 91. FIFO Latency Formula for all FIFOs

Follow these guidelines for the preferred frequency for latency_sclk:

• latency_sclk must be ≤ 260 MHz.
• The ratio of parallel clock to latency_sclk, when expressed in lowest terms, should have denominator of at least 50, but preferably, more than 100. The ideal resultant latency_sclk should be between 200 MHz to 260 MHz.
• Do not use a latency_sclk frequency that is a multiple of tx_clkout.
• Examples:
Table 92.  Parallel Clock to latency_sclk Ratio Scenarios
tx_clkout Frequency Correct latency_sclk Frequency Incorrect latency_sclk Frequency
150 MHz 209 MHz 160 MHz
245 MHz 247 MHz 250 MHz
300 MHz 247 MHz 260 MHz

You can create latency_sclk using the IOPLL or the external reference clock.
{"ft_lang_label":"__label__en","ft_lang_prob":0.85364777,"math_prob":0.9710774,"size":4360,"snap":"2022-40-2023-06","text_gpt3_token_len":897,"char_repetition_ratio":0.18457301,"word_repetition_ratio":0.014326648,"special_character_ratio":0.20229357,"punctuation_ratio":0.0821382,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9897247,"pos_list":[0,1,2],"im_url_duplicate_count":[null,2,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-01-30T19:17:08Z\",\"WARC-Record-ID\":\"<urn:uuid:616fea2b-7f9b-4198-9e1a-595652e25535>\",\"Content-Length\":\"942200\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:40acb9fe-8fc4-4ca0-b480-2e62c6300099>\",\"WARC-Concurrent-To\":\"<urn:uuid:6d1d1d29-dd55-4860-9ecb-07f7f7cea428>\",\"WARC-IP-Address\":\"104.76.22.9\",\"WARC-Target-URI\":\"https://www.intel.com/content/www/us/en/docs/programmable/683621/current/fifo-latency-calculation.html\",\"WARC-Payload-Digest\":\"sha1:LR5BSBIFE65YG6THS35VPLLQAKK5CC2G\",\"WARC-Block-Digest\":\"sha1:H7D3QN3KNUKS3XZRHSZOASJBKLCSEZVM\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-06/CC-MAIN-2023-06_segments_1674764499826.71_warc_CC-MAIN-20230130165437-20230130195437-00695.warc.gz\"}"}