Beginner / 60 min

Put a processor in your FPGA

RPGA Feather already has an RP2040 processor. So why put another processor in its FPGA?

Because this time, we get to see how the processor is built. We can follow an instruction from a program into the hardware that runs it, then change the hardware when we want it to do something different. That's a pretty useful playground.

We'll use two projects: OASIS and DungV. By the end, the FPGA will contain a small processor running a program that changes the onboard RGB LED. The RP2040 will help load everything over USB.

Two names, two jobs

OASIS stands for Open Architecture Simplified Instruction Set. An instruction set describes the operations a processor understands: add two numbers, move a value, store something, or jump to another part of a program.

Think of OASIS as the agreement about what those instructions mean. DungV is a processor built to carry out that agreement. Its hardware is described in Verilog, and our FPGA tools turn that description into working logic on RPGA Feather.

A processor built from configurable FPGA logic is often called a soft core. You can run software on it like another processor, but its internal design is something you can inspect and change too.

You don't need to memorize the instruction list to get started. We'll run an existing example, look at a few instructions, and make a small change we can see.

Three files with different jobs

There are three layers to this project:

Loading top.bin gives us the machine. Loading the program gives that machine something to do. Once those two steps feel familiar, the rest of the project gets much easier to follow.

Start with something you can see

Our first program uses DungV's RGB PWM hardware to fade the board's LED between colors. PWM switches an output on and off quickly; changing how much time it spends on changes the apparent brightness.

The processor writes brightness values into the PWM hardware, then goes back to running its program. The PWM hardware keeps generating the output between those writes. This is one of the useful parts of putting a processor beside other logic in an FPGA: each part can keep doing its own job.

DungV also has examples for GPIO, serial communication, I2C sensors, and addressable LEDs. We'll leave those for later so this first project only needs the RPGA Feather and a USB data cable.

Before you begin

You'll need Git, Python 3, Make, and OSS CAD Suite on your computer, plus CircuitPython and IcePython on the board. The next page walks through the setup. The build commands use a macOS or Linux shell; Windows users can build in WSL and copy files to the board from Windows.

OASIS and DungV are developing projects. This guide uses the Base-16 assembly path and DungV's explicit peripheral addresses. Older examples may use a different instruction format. Keep DungV's pinned OASIS copy with it, and use the compatibility notes when moving beyond these examples.

Continue: Run your first DungV program.