AVR8 virtual processor on FPGA

[Jack] wrote in to let us know about a project that creates a virtual microprocessor core based on the ATmega103 by using a Field-Programmable Gate Array. Great, we thought. Here’s another rather esoteric project like the NES on a FPGA, but what’s the motivation behind it? We asked [Jack] and he provided several scenarios where this is quite useful.

Implementing the AVR core allows code already written for the chips to be easily ported to an FPGA without a code rewrite. This way, if your needs outpaced the capabilities of the microcontroller long after the project has started, you can keep the code and move forward from that point with the added capabilities of the gate array. Having the core already implemented, you then only need to work with HDL for the parts of the project the AVR was unable to handle. He also makes the point that having an open source AVR core implementation provides a great tool for people already familiar with AVR to study when learning VHDL.

With products like the Butterfly that this project is based around, or the Maple we’ve seen in the past, programmable logic for the recreational hacker is starting to get a little easier.

The Digilent boards are pretty nice. I learned VHDL on them at my school.

@theorifice, that’s the first thing i thought of when i read this post… depending on how that VHDL was written, you could overclock the AVR “core” far beyond that of an actual AVR IC.

@urlax, i didnt even think about that! some of these wild FPGA’s (like the Virtexs) could theoretically implement a huge number of components, all in a single FPGA.

i knew that companies occasionally did this, but i did not know that the AVR8 hardware description was available… seems like theyd want to keep these things under wraps to dissuade cheap chinese copies…

If you can get the Altera DE1 board with a student discount, it’s only ~120 USD. It’s very similar to the much pricier DE2 board, but is much cheaper. I’m enjoying learning with that board right now in my spare time, and I’d recommend it to anybody interested in FPGA related technology (and using uC cores like this project on FPGAs is a great way to migrate to using FPGAs) :) good article!

When I was working on the floppy emulator for my vector06cc project, I needed a CPU core that would do all filesystem-related functions. There were a couple of AVR cores about that time already, but they were hard to compile and took way too much compilation time/too many LE’s. I ended up using a simple and compact 6502 core.

Nice and compact AVR core can be very useful for a variety of FPGA projects. The main benefit over legacy 8-bit processors is good compiler support. I wonder how many LE’s this core would take in a CycloneII, especially stripped of all peripherals.

You probably don’t want to synthesize too much memory in an FPGA.. you’ll waste a lot of gates; Most project-grade FPGA’s have < 100kbytes of BlockRAM/similar.

@pppd

"Multitasking" doesn't apply in the context of FPGA's.. there's no sharing/timeslicing involved, if your design synthesises into the available gates its all present and running at any given time.
There are good cheap FPGA board out there, the Digilent ones others have mentioned are very good.. the uploader software is shit though and the reference docs are full of errors. If you want something cheaper you could always go for a CPLD like the Coolrunner II instead.

@svofski

Altera and Xilinx have free IP for basic and not so basic CPU cores that are suited to their hardware….