This Answer Record is applicable to all versions of the SPI4.2 Core.
The SPI-4.2 Sink Core might display the following unusual behavior:
- Although the Sink core is receiving data, SnkFFAlmostEmpty_n and SnkFFEmpty_n might still be asserted.
- It might take a significant number of cycles for SnkFFAlmostEmpty_n and SnkFFEmpty_n to be deasserted.
- SnkFFAlmostEmpty_n and SnkFFEmpty_n might get asserted simultaneously as SnkAlmostFull_n.
This unusual behavior is more noticeable under the following circumstances:
- SnkFFClk is proportionally faster than RDClk (that is, reading out faster than data is coming in).
- Sink FIFO is very shallow. The shallowness of the FIFO is determined by the SnkAFThresholdAssert setting, and a value closer to 508 is considered a shallow FIFO.
These are all expected behaviors of the Sink core for the following reasons:
The flags SnkFFAlmostEmpty_n and SnkFFEmpty_n are not actually indicating the true status of the FIFO, but they are simply indicators that the data is not ready to be read out from the read pipeline of the FIFO interface. Consequently, some amount of data might have been written into Sink FIFO, but the data might not be ready to be read out until some number of cycles later. Furthermore, AlmostFull threshold is a write side threshold running in RDClk domain, and SnkFFEmpty and SnkFFAlmostEmpty are the read indicators running in the SnkFFClk domain. The logic in these two independent clock domains reports the status of the sink FIFO differently. Consequently, an Almost Empty and an Almost Full condition can be asserted simultaneously.
The Sink Core must receive a complete burst of data before processing and passing it on to the read (FIFO) interface. If the Almost Full threshold is set smaller than the data burst received (plus ~24 credit for processing overhead), it is possible to achieve SnkFFAlmostFull status, which might back pressure the SPI-4.2 data transfer affecting the overall bandwidth. If the sink FIFO threshold is not larger than a data burst, the partial burst sent to the Sink core might stall in the core and not be processed, resulting in an indefinite assertion of SnkFFAlmostEmpty_n and SnkFFEmpty_n.
Recommendations to Prevent Unusual Behavior
Starting with the SPI-4.2 v8.2 Core, the Sink core has a Read Mode option. This option allows you to choose "Partial Burst" or "Full Burst." "Full Burst" Read Mode is compatible with previous versions in which the Sink core does not process the data until the full burst has been received by the sink core. Conversely, "Partial Burst" Read Mode allows the sink core to process the data as it arrives without waiting for the end of the burst. Using "Partial Burst" Read Mode minimizes the chances of running into FIFO overflow and Sink core lock-up condition.
Run SnkFFClk relatively proportional to RDClk (that is, avoid reading out the data faster than they are coming in). The SPI-4.2 Core does not require RDClk and SnkFFClk to be proportional; however, when SnkFFClk is relatively faster than RDClk, it is likely that the read interface will be empty, periodically resulting in the SnkFFEmpty and SnkFFAlmostEmpty assertions.
Set the Almost Full Threshold values large enough to receive a complete burst plus 24 additional credits or limit the size of the burst so that a complete burst can be received by the Sink FIFO without exceeding the Almost Full threshold level. The effective depth of the FIFO is determined by the SnkAFThresholdAssert setting. The SnkAFThreshold levels are based on empty spaces of the FIFO. Consequently, the SnkAFThresholdAssert value closer to 508 is considered a very shallow FIFO.
Large packets (jumbo frames) must be segmented into smaller bursts on the Tx device. The bursts must be small enough to fit in the sink FIFO with 24 credits of overhead room in the FIFO.