Monday, November 4

Gigantic FPGA in a Game Boy Form Factor, 2019 Supercon Badge is a Hardware Siren Song

Look upon this conference badge and kiss your free time goodbye. The 2019 Hackaday Superconference badge is an ECP5 FPGA running a RISC-V core in a Game Boy form factor complete with cartridge slot that is more open than anything we’ve ever seen before: multiple open-source CPU designs were embedded in an open system, developed using the cutting-edge in open-source FPGA tools, and running (naturally) open-source software on top. It’s a 3,000-in-one activity kit for hardware people, software people, and everyone in between.

The brainchild of Jeroen Domburg (aka Sprite_TM), this design has been in the works since the beginning of this year. For more than 500 people headed to Supercon next week, this is a source of both geeky entertainment and learning for three action-packed days and well beyond. Let’s take a look at what’s on the badge, what you need to know to hack it, and how the design serves as a powerful development tool long after the badge hacking ceremonies have wrapped up.

The Big Story is Openness

Over the past few years several people have asked to design a Hackaday conference badge around an FPGA, but only this year did we think the time was right. FPGAs have finally achieved an all-encompassing level of openness as several open source toolchains are maturing and the RISC-V core delivers an powerful and modern instruction set architecture to the open source ecosystem.

This is a huge project, and Jeroen has been doing an unbelievable amount of heavy lifting, but to support the effort a large badge team as rushed in to aid in stabilizing the design, rooting out and fixing bugs in the toolchains, designing workshops around the badge to help teach FPGA principles, and writing C programs that run on top of it all.

This is not to be understated — working with this hardware as a distributed engineering team is a celebration of open truly means. The end result is that you can poke and prod almost any level of the system from the solder and silicon up.

The Hardware

I suspect it’s the gritty details you’re after so here’s the chip rundown. The FPGA is the Lattice LFE5U-45F, an ECP5 with 45k LUTs. For the uninitiated, that’s a huge chip — the biggest would be the 85k but this is still more than you will likely ever need in three days of hacking. (I’d love it if you proved me wrong.) Supporting that chip are two Lyontek LY68L6400 64 Mbit SPI SRAM chips and a Winbond W25Q128JVSIQ 128 Mbit NOR flash chip. In theory you could just barely run Linux on this badge; seeing someone hang extra DDR memory off of the cartridge slot would be a great hack to make Linux purr would be fun, wouldn’t it?

In keeping with the Game Boy form factor, you’ll find a beautiful 480 x 320 color LCD display and eight user buttons arranged in the familiar D-pad/select/start/B/A layout. There is mono sound available on J3 and we’ll have speakers on hand for you to add with just two solder points. A “hardware” synthesizer inspired a little by the SID chip is fresh in the repository for you to play with.

On the rear side of the badge you’ll find a USB port for loading your software. FPGA bitstreams can be flashed via the DFU bootloader, and compiled RISC-V C programs are even easier to load because the badge enumerates as USB mass storage.

One of the most titillating inclusions is an HDMI port at the bottom of the badge. We hope to put the badge hacks up on the big screen — this is begging to be a demoscene showcase. On the front, just above the screen, there are two add-on connectors with an IRDA module and an unpopulated PMOD footprint in between. On the back is a 40-pin 2.54 mm female breakout header, and every person who gets a badge will also get a protoboard cartridge that includes a flash memory chip and plugs right in. That’s right, the Death Star cartridge slot is fully operational and the badge can load games (or any other programs) written to the chip on the breakout cartridge. There is also a JTAG connector between the two AA battery holders for flashing the FPGA directly, should anything go wrong.

The final production version of the badge hardware is breathtaking. The beauty of the matte black solder mask as the canvas for a miniature metropolis of support components and a salting of silk screen labels — both practical and amusing — add up to a pleasing aesthetic.

The Software

In this case, the software is the hardware for this project as the FPGA must be programmed for anything to work. It’s all open all the way down to the transistors. The two main parts of the architecture are the System on Chip (SoC) and the Initial Program Loader (IPL). The SoC is FPGA gateware that creates the CPUs and all their peripherals, servicing everything from buttons and audio, to HDMI and the cartridge connector. The IPL is a system software that runs on top of this and implements the best graphics tricks from a range of classic gaming consoles. If you saw it on an SNES, you can do the same thing on this badge.

It’s hard to overstate how empowering an FPGA really is. The badge has numerous LEDs on it which are not directly controlled by the RISC-V processor. Instead, Jeroen has implemented a PIC microcontroller core in the SoC to handle the low-level driving duties. Need an extra timer or other “hardware” peripheral? Implement it on the FPGA and hook it into the RISC-V core. Hang some wacky hardware off of the cartridge connector and build whatever adapter you need using the gates inside the chip itself. Your CPU shouldn’t bother itself with bit-banging or cycle-counting. That’s what programmable logic is for.

David Williams will be speaking about the FPGA revolution in small electronics. He added a camera to the cartridge slot of his prototype badge.

The IPL software “OS” layer delivers great power to anyone looking to write C games and other programs. It takes compiled .elf files from the flash chip on the badge or on the expansion cartridge, adds them to a menu system, allowing the user to run them. If you just want to program games, you don’t even have to worry about the FPGA underneath it all. It’s just another microprocessor, or four.

The SDK for writing in C is packed full of goodies. There’s functionality for a background image, two tile layers that display 16 x 16 pixel tiles from a 16 x 32 tilemap with a 16-color palette. On top of it all is a sprite layer. Not only can these all run concurrently, but you can scale and skew them with hardware-driven speed that far outpaces what you’d normally accomplish with a single CPU. Sprite_TM has essentially built his own custom GPU here, and you are invited to use it.

What You Need to Know; What to Bring With You

Jump in feet first and try something new with this badge. If you’ve been sitting on the FPGA sidelines, now’s the time to dabble in it, and a few hundred people registered for the beginner FPGA workshops using the badge are planning to do just that. If you’ve never written a tile-based game before, now’s your chance to write that Frogger clone you’ve had on your project list. The beauty of a top-to-bottom open project is that you can get in on whatever floor you’re comfortable.

First and foremost, you need to bring a Laptop and a micro USB cable. You have a much better time if you arrive with the toolchain pre-installed. There’s good news on this front, as Sean Cross has put together a dependancy-free toolchains for Linux, Mac, and Windows. Just head to his repo, download the archive for your OS, and make sure the folder with the binaries is in your path. It comes with all the open source goodness: yosys and nextpnr-ecp5 for FPGA development, dfu-util and riscv-gcc for C work, and wishbone-tool for debugging.

Those planning to spend a substantial chunk of their time in the badge hacking area may want to pack more. Extra AA batteries, rechargeables or disposable, are a very very wise choice here. Make sure to pack your USB-to-Serial cable so that you can printf your way out of any trouble. If you’ll be working with the FPGA you should bring along any PMOD boards you have on hand. As mentioned, your badge will have a prototyping cartridge so work on your schematic, or even assemble some prototypes ahead of time. Bring along anything you think you’d like to hang off this beast.

The amount work that went into this piece of hardware art is staggering, and Jeroen will tell the full story of that during his talk at the Hackady Superconference on Saturday, November 16th. If you can’t be there, head over to Hackaday’s YouTube page and check out the live stream. If you are one of the lucky ones who scored a ticket before they sold out, the next part of the adventure is all yours. We’re excited to be a part of the open FPGA revolution. See you at Supercon!

No comments:

Post a Comment