pif is a Field Programmable Gate Array (FPGA) add-on board for the Raspberry Pi.
What is it?
The pif board brings a powerful FPGA to the Raspberry Pi. FPGAs are programmable digital chips - here are some of the features of the pif FPGA:
- lookup tables (LUTs) to implement digital logic
- flip flops for storage
- routing tracks to connect everything together
- specialist resources such as SRAM blocks, PLLs, and hard-coded I2C/SPI communications channels.
Firmware determines how the pif FPGA uses these resources. Firmware starts with a program which is then converted into a configuration bitstream and injected into the FPGA. Usually FPGAs are programmed in a Hardware Definition Language (HDL). Most commonly this is VHDL or Verilog, though there are alternatives such as the Python based MyHDL. Here is a tiny fragment of VHDL code:
constant MAX : integer := 55; signal counter : integer range 0 to MAX := 0; -- counting happens when the clock ticks process (clock) begin if rising_edge(clock) then if resetSignal or (counter=MAX) then counter <= 0; else counter <= counter + 1; end if; outputSig <= (counter=MAX); end if; end process;
The development process is this:
- write and simulate an HDL program
- compile the HDL program to make a configuration bitstream
- download the configuration bitstream to the FPGA
For the pif board, simulation and compilation software is a free download from Lattice Semiconductor. We supply Python software to inject the bitstream into the FPGA.
FPGAs come in a huge range of sizes, with the latest and greatest FPGAs typically costing as much as a small motor car. Since an FPGA LUT is approximately equivalent to a 10cm (4") square logic board with four TTL logic packages, the 1280 LUTs in the smallest pif board are equivalent to a wall of logic measuring 350cmx350cm (140"x140"), more if SRAMs, PLLs and so on are included in the calculation.
- a complete FPGA development target - FPGA programming hardware is not needed
- plenty of on-chip 4-input LUTs - the pif-1200 has 1280, the pif-7000 has 6864
- plenty of on-chip 9-Kbit SRAM blocks - the pif-1200 has 7, the pif-7000 has 26
- the FPGA is non-volatile, with on-chip flash memory for storing the configuration bit stream
- up to 256Kbits user flash memory
- hard coded I2C, SPI, PLL, and timer/counter blocks
- powered from the Raspberry Pi expansion connector (P1)
- 47 pins of expansion connectors
- one 26-pin (2x13-pin) connector matches the Raspberry Pi's P1 connector
- one 13-pin connector
- one 8-pin connector
- red and green LEDs
- support software supplied (in Python) for injecting a new configuration into the FPGA
- example projects supplied, including a project that controls logic inside the FPGA from a web browser
pif-1200, including software $24.99 Add to Cart
pif-7000, including software $34.99 Add to Cart
Download the software bundle from the Github repo here.
Please note that the pif board is designed for users who are familiar with electronic design and debugging, and familiar with the usual safety precautions when working with electronic equipment.