Skip to content

Blog

Toolchain part 4 - Booting from SPI flash

With the UART bootloader, the FPGC runs any program the PC sends it, but only while a PC is connected. Now that the SPI flash works, the boot ROM can also load a program from there, so the FPGC can start on its own after a power cycle. This post is about that second way of booting, and about how a program gets into the flash in the first place.

Read more →

2026-11-28

SoC part 5 - SPI controller and SPI flash

The FPGC can now load programs over UART, but it forgets them at every power cycle. The board has SPI flash chips for exactly that, and four more chips that also talk SPI: two USB host chips, an Ethernet chip and a micro SD card. This post is about SPI itself, one controller for all six of them, getting the SPI flash to run at 50 MHz on four data lines, and a small trick that makes reading much faster.

Read more →

2026-11-28

Toolchain part 3 - UART bootloader

The assembler gives a binary image of a program. To run it, the program has to get into the SDRAM of the FPGC. This post is about how that works: a small bootloader in the boot ROM that receives a program over the UART, and the program on the host PC that sends it.

Read more →

2026-11-28

Toolchain part 2 - Assembler

The previous post described the assembly language of the FPGC. This post is about the assembler: the program that turns that language into the words the CPU runs. It is a small program, and works using a simple two-pass approach to handle labels.

Read more →

2026-11-28

Toolchain part 1 - Assembly language

The FPGC can now run programs from SDRAM. All those programs, from the boot ROM to the memory test, were written in assembly, but so far I have not explained the language they are written in. This post starts a new series about the toolchain: the tools that turn source code into programs and get them onto the FPGC. The first part is about the language itself.

Read more →

2026-11-28

SoC part 4 - SDRAM hardware test

The SDRAM controller from the previous post works in simulation, but a simulation does not know anything about what happens between the pins of the FPGA and the pins of the SDRAM chips. At 100 MHz, a cycle is only 10 ns, and a signal that leaves the FPGA needs to be stable at the SDRAM pin when it samples, and vice versa. This post is about getting that part right: the timing between two chips on a PCB, and how I calculated it instead of finding it by trial and error. And at the end, the FPGC finally runs programs from SDRAM.

Read more →

2026-11-23

SoC part 3 - SDRAM controller

With the FPGC’s first sign of life, it still cannot run real programs as it misses a critical component: RAM. It is still not connected to the L1 cache controller, and needs a dedicated controller to interface with. That is what this post is about, including some background on the type of RAM the FPGC uses.

Read more →

2026-11-23

SoC part 2 - UART and first sign of life

The last part that prevents me from testing the FPGC on real hardware is the UART controller. UART is needed to communicate with in this case my PC so I can validate that the CPU works and does not lock up somewhere. While the SDRAM controller, and by extension the SDRAM itself, is still not connected, with UART I can already test a simple ROM program that allows me to validate that the CPU is actually working in hardware instead of just in simulation. So this post is about building the UART controller and seeing the first sign of life on real hardware.

Read more →

2026-11-23

SoC part 1 - Device bridge and the first IO devices

The CPU is done for now, so it is time to build the system around it so we can get the CPU running on a real FPGA with a minimal design containing ROM for a test program, SDRAM for main memory, and UART to talk to the PC. Let’s make this a new series of posts called “SoC”, which is everything around the CPU. In this first post, I (re)define the memory map, connect the first devices to the CPU over the bus using a new module called the device bridge, and build the first simple devices: a cycle counter, timer, and a register for the LED and DIP switches on the PCB. UART gets its own post as it is more complex and this post will already be quite long.

Read more →

2026-11-21

CPU part 18 - One bus for everything else

With the caches, the CPU can read and write SDRAM, and it has its own internal registers. But the memory map has more: the ROM can also be read as data, the I/O region holds devices like UART, SPI, internal timers, and other interfaces and memories that do not require the lowest latency possible. In this post, all of those get connected via a single bus for everything that is not SDRAM.

Read more →

2026-11-15