Datasheet

Table Of Contents
3.5.4.1. Autopush Details
Pseudocode for an 'IN' with autopush enabled:
Ê1 isr = shift_in(isr, input())
Ê2 isr count = saturate(isr count + in count)
Ê3
Ê4 if rx count >= threshold:
Ê5 if rx fifo is full:
Ê6 stall
Ê7 else:
Ê8 push(isr)
Ê9 isr = 0
10 isr count = 0
Note that the hardware performs the above steps in a single machine clock cycle (unless there is a stall).
Threshold is configurable from 1 to 32.
3.5.4.2. Autopull Details
On non-'OUT' cycles, the hardware performs the equivalent of the following pseudocode:
1 if MOV or PULL:
2 osr count = 0
3
4 if osr count >= threshold:
5 if tx fifo not empty:
6 osr = pull()
7 osr count = 0
An autopull can therefore occur at any point between two 'OUT' s, depending on when the data arrives in the FIFO.
On 'OUT' cycles, the sequence is a little different:
Ê1 if osr count >= threshold:
Ê2 if tx fifo not empty:
Ê3 osr = pull()
Ê4 osr count = 0
Ê5 stall
Ê6 else:
Ê7 output(osr)
Ê8 osr = shift(osr, out count)
Ê9 osr count = saturate(osr count + out count)
10
11 if osr count >= threshold:
12 if tx fifo not empty:
13 osr = pull()
14 osr count = 0
The hardware is capable of refilling the OSR simultaneously with shifting out the last of the shift data, as these two
operations can proceed in parallel. However, it cannot fill an empty OSR and 'OUT' it on the same cycle, due to the long
logic path this would create.
The refill is somewhat asynchronous to your program, but an 'OUT' behaves as a data fence, and the state machine will
never 'OUT' data which you didn’t write into the FIFO.
RP2040 Datasheet
3.5. Functional Details 338