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.

15 thoughts on “AVR8 Virtual Processor On FPGA

  1. the fun of this is that you can build peripherals into the same FPGA! so if you want to control a led matrix, you could connect a port expander to PORTA & B, but you can do the same inside the FPGA!

    you can, for example build some video-RAM inside the FPGA and offload a lot from the processor, and improve your hardware without even turning on your soldering iron

  2. 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…

  3. 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!

  4. 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.

  5. @urlax

    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….

  6. It seems there are plenty of nice, cheap FPGA dev boards available in the US (like the Diligent), but if you try to order one in the UK, the P&P comes to about the cost of the board!

    Most irritating. :)

Leave a Reply to pppdCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.