The PIO is certainly one of the more interesting features of this chip.
The datasheet (commencing page 324) describes this versatile peripheral.
Each of the two PIO modules contains 4 state machines. Each state machine is individually programmable from a block of 32, 16-bit wide words.
There are 9 instructions: : JMP, WAIT, IN, OUT, PUSH, PULL, MOV, IRQ, and SET.
In addition there are 2 scratch registers, input and output shift-registers
A PIO state machine may be programmed from a library to function as several of the common peripheral interfaces such as UART, SPI, I2C, quad SPI and DVI or VGA.
Alternatively it’s resources can be used to create a wide range of interfaces, for example a custom video standard or possibly a serial communication link as used in the Transputer.
The PIO can be reprogrammed dynamically, and it can also execute instructions taken from the datastream, in the same way that commands can be mixed with data and can be sent to an SPI memory, controlling its various modes.
Further code can be used to allocate a state machine to a given set of GPIO pins - giving the greatest flexibility. If you want 8 separate SPI interfaces, with separate clocks - then this is feasible too.
Understanding the potential of this programmmable hardware block will be key to exploiting the RP2040 to its full.