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.

Comments

  1. urlax says:

    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. theorifice says:

    Also, you’ll theoretically be able to clock at much higher speeds (depending on the FPGA).

  3. pppd says:

    FPGAs are really cool for hardware multitasking, if only the start up price was a bit more affordable :/

  4. tyco says:

    how about $90 for a 400kgate FPGA and a buttload of peripherals you’ll probably never use?
    http://www.digilentinc.com/Products/Detail.cfm?NavPath=2,400,797&Prod=NEXYS

    here’s another one for $60 if you can get the educational discount:
    http://www.digilentinc.com/Products/Detail.cfm?NavPath=2,400,790&Prod=BASYS2

    These still have tons of features; I bet someone else has a cheaper solution.

  5. samurai says:

    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…

  6. pppd says:

    @tyco Thanks, I guess I should’ve checked the recent prices before complaining:)

  7. Finger says:

    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!

  8. svofski says:

    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.

  9. cantido says:

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

  10. therian says:

    FPGAs are not that expensive anymore, well you dont really need one with massive number of gates, to try you own projects on it

  11. svofski says:

    @cantido: I don’t remember Altera having any, or at least any with a ready to use gcc toolchain. Maybe the situation has changed in the last 2 years?

  12. aurel says:

    Interesting, note there are already a few AVR implementation in VHDL available at opencores.net

  13. sgf says:

    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. :)

  14. kyboren says:

    @svofski: The NiosII has a full GCC toolchain. Starting at page 14 of the reference manual: http://www.altera.com/literature/hb/nios2/edh_ed51004.pdf

    I personally only have experience with Xilinx’s picoblaze and microblaze soft-cores, but I can say that soft-core processors on FPGAs make hardware/software codesign simpler and way more intuitive :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s