introducing: the GPU

Back in 2008, I had a vision: I wanted to build a computer from scratch. I have always used microcontrollers like Atmel’s AVR to power my electronic projects, and make a living of software development, and some (then) recent courses at university brought me back in contact with hardware design and FPGAs. So I wanted to combine all these (not so)-knowledge into one project: Build a computer. I had no real direction to follow, just some rough ideas. This has not changed until now, I don’t even know how the CPU of this computer should look like (some ideas have been: Atmel AVR, ARM, or even an old Intel 286?). My only contraints in building this thing are: no development-boards (build everything from scratch, know every interface) and no usage of software-libraries (code everything from scratch, even BIOS/OS). The last part may be not be taken as dogma, the more I think of it, maybe I don’t have the time coding a FAT32-driver myself…or an IP-stack?

Why am I writing about an old project, which has collected dust since 2008? The answer is: I stumbled upon the (excellect) blog of Blondiehacks, who posts about building her own DIY-computer, named “Veronica”. Reading her blog reminded me of the fun I had while developing the first parts of my computer, so I decided to write about it, hopefully getting some input from other DIY-computer enthusiasts and being able to complete my computer in the next ten to twenty years! We will see..

GPU schematic

I decided to start with the visually most impressive part: the graphics interface.

The GPU should have: a character-generator mode, VGA-output, and maybe a graphics-mode of (yet) unknown resolution. I read some bits and pieces about folks who build a graphical interface by using AVR controllers to directly output R,G,B, and sync signals to drive a monitor, but the resolutions they reached never really met my expectations. So building some custom hardware it was.

Searching for suitable FPGAs was my next step. Of course I could have bought a big development board, with plenty of available graphic interface IP-blocks, and build a simple graphic card within days, but as you remember my first rule: no dev-boards, everything from scratch!

For now, I just want to present the result of the work I put into this: the first board of my DIY-computer, the “GPU”:
GPU front side GPU backside

Main components are: a ALTERA FLEX FPGA, a 4MBit (512kx8) 55ns SRAM, and a ATMEL ATmega324p-20PU controller.

The FLEX logic is driven by a 25MHz generator, the ATmega runs at 20MHz.

Connectors: (left side) USB-Serial for debugging, standard VGA connector (right side) power connector, “main bus” connector (the future interface to the rest of the system)

Notice should be given to the 2 yellow cables in the bottom left of the backside picture: I succeeded in building this thing after a long planning phase in one! hardware revision, fully functional, including FPGA programming interface, SRAM access, …, but managed to swap RX/TX on the debugging serial connection! DOH!

The current implementation contains just the character generator mode for displaying standard 80×25 and 80×50 text, with the character-pixmaps also stored in SRAM, no graphics mode so far. Back in the 1980′s (where I started to fiddle with this stuff), 80×50 was high-resolution, so I am pretty happy with it!

I stumbled upon the following problems: At first, I ran out of macro-cells in the FPGA, to implement more features. The chip is used 90% with just the character generator, and I see no possibilities to bring this ratio down very much (but maybe I am a poor hardware designer, who knows!). The other caveat is VRAM access from the AVR controller: It is damn slow! I have no direct interface from the AVR to the SRAM, the FGPA logic is used as an address generator for accessing the SRAM from the controller, and this can only happen in the v-blank period of the signal. So for now, building a graphic mode into this thing seems unnecessary, as transferring bitmaps from the controller to the RAM is the limiting time factor here. I do not have any figures of available bandwidth, cause back in 2008, I did not really keep track of it.

This is the current state of the project, which I plan to extend in the next few months. Feel free to comment, I would be glad to share schematics and code with you as soon as I find the time to prepare them for releasing them in any readable form.

Cheers!