So you wanna learn FPGAs…

FPGAs are the bee’s knees. Instead of programming a chip by telling it what to do, FPGAs allow you to tell a chip what to be. Like everything though, a new skill set is needed to fully exploit the power of FPGAs. [Mike Field] decided to give back to the internet community at large and put up a crash course in FPGA design.

Right now, [Mike] has a couple of modules up that include subjects like binary math, busses, counting, and of course setting up the FPGA hardware. The recommended hardware is the Papilio One, although the Digilent Nexys2 is what [Mike] has been using so far.

We’ve seen a ton of awesome stuff that uses FPGAs, like the emulated Mac Plus, breaking HDCP, and an Ocarina of Time. [Mike]’s tutorials look like a great starting point for some FPGA work. [Mike] is also looking for some feedback on his tutorials, so if you’ve got an idea of what he should cover be sure to drop him a line.

EDIT: The server was running on an FPGA and we can’t find a cache anywhere. If you’ve found a mirror, send a message. Apparently Amazon’s EC2 runs on an FPGA.

44 thoughts on “So you wanna learn FPGAs…

  1. Wish I had something like this when I started out. I used books, found some great ones along the way.
    Here’s my top 3 :)

    Contemporary Logic Design Randy H. Katz

    Digital Logic Design Principles

    Computer Organisation & Design Patterson and Hennesy

    But the BEST way to grind FPGA is to combine “Contemporary Logic Design” with the TI TTL logic book which you can get form the TI store for 10cents (including shipping) means you have plenty of circuits to implement both gate level and behvaiourally…

      1. Awesome link to the TI logic PDF. Question though, what are the “TG” blocks everywhere? I’m not familiar with the notation and I can’t seem to find anything recognizable using a Google search.

  2. Awesome!
    I’m a software guy but started with FPGAs a few months ago. It’s so difficult to learn everything from google and with no tutorials. I wish I had this earlier, but I will read all your Modules :D Please keep motivated to create more Modules.
    I have a Nexys3 Board :)
    Thank you very much, keep going

  3. Having a read on the opening page:
    “I’ll see if I can get a mention on Hack-a-day and get some feedback”
    tick :-)

    My two-pence worth of feedback woud have been to show people Verilog rather than VHDL. Yes, can be more fast-and-loose with verilog but it reads more like a software language (System Verilog is even closer but, from my experience in the industry, not as widely supported for synthesis). I was taught VHDL at uni over 6months but picked up more than enough verilog in a few days myself to now use it professionally, plus it’s what a large chunk of the design IP is sold in.

    Either way, from the few tutorials I looked at (I think the site is being HaDed), [Mike] should keep up the good work. The more people dabbling in this area the better, we need more practiced engineers!

  4. While I would only be a consumer of the tutorial, and highly unlikely I would ever use FPGA, my initial thought was I hope Mike created a wiki. Then enough his wiki came up in the other browser tab to show is was a wiki. The text that the browser shows the link urls is so small I missed it was a wiki. Can only wish that the wiki isn’t available to view, is that there are many people fleshing out the content of it. Hopefully enough of them are good technical writers to make it an easier study.

  5. I chose to learn Verilog over VHDL as I was told it would likely be the most widely used HDL in the future. For now, it seems most example projects I see are still written in VHDL. I hope I made the right choice!

      1. Meh,

        I learned VHDL for school work and got into Verilog at some summer jobs. They are different but they are more similar than not.

        The hard part you’ll have in learning either is getting your head around the fact that you’re specifying hardware and not programming a sequence of instructions for a processor. And that’s the same in both languages.

        I’m sure there are differences once you start digging into the details of the languages but I never got to that point.

        Basically if you learn either language you’ll have a much easier time picking up the other one afterwards. Just as with “normal” programming.

  6. Thanks all for the support & kind words.

    Please email through any edits or qns, and yes, I’ve kicked my poor little $0.01 Amazon EC2 instance around a bit to get MySQL back up and running.

    I guess you get what you pay for! :-)

  7. This is a cool post considering I just finished an advanced digital design course. We used the Nexys2 for the class and it is a great learning platform for FPGAs.

    I understand this tutorial is supposed to be about helping programmers get into using fpga’s but I would suggest talking about drawing a design out on paper first because using an hdl is not like programming and drawing a schematic really helps.

    I would also suggest talking about muxes and their uses because they are a pretty important basic building block and are really helpful if you want to be able to display multiple outputs to the LED’s / 7-segment displays.

  8. I would also suggest becoming aware of some emerging alternatives to the Verilog/VHDL duopoly:

    1. MyHDL:

    This Python-based package lets you do HDL in Python! While its synthesis capabilities are still evolving, its most important features are a) the ability to use the full power of Python in testbenches (especially Numpy), and b) cosimulation (mixing MyHDL and VHDL and Verilog) within a Python context.

    2. Migen:

    This is a new Python-based tool that already provides great combinatorial and sequential synthesis capabilities, and is being used in the Milkymist project (

    My hope is that MyHDL and Migen will one day find a way to merge.

  9. Why oh why would you use VHDL instead of verilog. :(

    Most of the cores on opencores are verilog for example, and IMHO, verilog is “easier” for a beginner to wrap their head around. Also, it is less demanding of syntax than VHDL, MUCH less.

  10. I think VHDL should be the starting point, since it helps force you to think in terms of hardware design instead of software. The similarity of Verilog to C in syntax leads to sloppier un-synthesizable code for begginners from a software background. I think this is similar to the idea behind Pascal – a language that forces structured programming. I personally find VHDL to be far more readable than Verilog. Readability is far more important for large designs, especially when debugging or maintaining it years later, especially if you are not the original author.

  11. I think the Papillo One was an suggestion for a more powerful board for those looking for solder-peripherals. The one he suggests for beginners is the the Digilent Basys2.

    He specifically recommends it because “a lot of the projects focus on the eight slide switches and eight LEDs.”

  12. does anybody know where i can get fpga tutorials using basys2 board? i have that board for a while now, but don’t find any tutorial using this board. thanks in advance

    1. I’m got a Basys2 on the way, and will be using it as the reference platform for the course.

      Any other Xilinx based dev board should be suitable too, but you might not have enough switches, leds, seven-segs or whatever to implement all projects.

  13. FPGAs are so neat. I’ve got a bunch of dev boards, and so I decided I wasn’t going to get anymore until I actually made more than one project with each of them (most of the boards were free), but I’m starting a big project, and especially now that theyve come down in cost so much, it seems like a great way to prototype something that I will later implement with discrete logic chips.

    1. Ben Heck did a project using an FPGA not too long ago. He goes into some of the problems an FPGA can solve which are hard to do with eg an Arduino.

      But basically, FPGAs are great when you have something fairly simple but very parallel to do. He uses it to drive a large LED dot matrix display.

  14. Hello Eirinn,

    I’m the guy who designed the Papilio FPGA board and have been following this thread waiting for a question where I could add some value. :)

    Here’s my take on why to get into FPGA’s. First of all, the Arduino is the perfect solution in many cases. If a microcontroller like the Arduino can solve the problem that you are working on then it is the best solution. Micros are the most cost effective solution to many, many problems and the Arduinos are great micros.

    Inevitably, you are going to run into something that you just can’t do with a micro. FPGA’s are the answer to that problem, they can do or become pretty much ANYTHING. A HackaDay reader explained FGPA’s like this:

    With micros you tell them what to DO, with FPGA’s you tell them what to BE. Being able to tell an FPGA what to BE means you can do pretty much anything you can imagine.

    Most people hear FPGA and they are instantly turned away because of the perception that they are hard to deal with. It is true that there is a fairly steep learning curve with VHDL. But the Papilio project is an Open Source project that is all about making FPGA technology usable for people who don’t know VHDL.

    There are tons of Open Source VHDL and Verilog projects out there that implement everything you can imagine, just look at Writing these types of cores is best left to HDL experts, but learning enough VHDL to be able to connect and use these cores is within the reach of anyone… Think about learning enough VHDL that you can treat these cores as chips on a circuit board, instead of soldering the chips to a microcontroller on a board you connect them inside the FPGA with VHDL.

    Getting back to the concept of telling an FPGA what to BE. If I put together a bunch of cores from OpenCores that tell the FPGA to BE something I can then share it with other people by providing a bit file. Think of the Papilio as a hardware platform to share FPGA designs with people. We already have some very cool designs that are shared:

    – We have a bit file that tells the Papilio to BE an Arduino clone. As an end user all you have to do to run Arduino sketches on the Papilio is download our special version of the Arduino IDE.
    – We have a bit file that tells the Papilio to BE a 32 channel 200Mhz Logic Analyzer.
    – We have bit files that tell the Papilio to BE classic arcade motherboards like Pac-man, Frogger, and Galaxian.

    With a common hardware platform like the Papilio it makes it so end users simply load the bit files to the hardware to make the FPGA BE what other people are sharing.

    And of course, since everything is open source, if the bit file does not do something you need it to do then you can download the VHDL source and start hacking away to add new cores that you might need. :)

    It’s all pretty exciting stuff to get involved with.


    1. Thank you Jack – very informative reply!

      I’m guessing that it’s a versatile computer board then? Chosen cores are emulated and run with chosen code? AKA. computing abilities with broken out digital, analog and computer-like IO ports?
      So a mix between standard micros and a computer motherboard?

      What are its limits? I’m guessing one would not simply install win7 or ubuntu on an fpga :) As i understand it’s mostly used for games/video, sound, emulation of roms, information processing and so on.

      I have no idea about what VHDL or or VeriLog is about sadly, but i’m guessing its a syntax?

      1. Eirinn,

        Think of an FPGA as a rewritable circuit board. The FPGA is like a sea of interconnected transistors.

        VHDL is a hardware description language (HDL) that is used to describe what digital logic the transistors should implement and how they should be connected. HDL’s are used to describe how most chips that are in our electronics operate. So that AVR chip that is in the Arduino was defined using a HDL like VHDL or Verilog. But with a chip like the AVR the design is manufactured like audio CD’s are. So an FPGA is like a rewritable CD that you can change what it does using an HDL.

        An FPGA is not really a versatile computer board, it can be, but is really more of a blank canvas. With the right HDL code you can turn it into a System On Chip design that would have a soft processor and whatever peripherals you would need; like USB, VGA, and uSD. If you have SRAM memory you can even run linux, but there is no solution I know of that runs ubuntu or win7. An FPGA System on a Chip design is not going to be very powerful… It will be more along the lines of a first generation Pentium running at 100Mhz then a modern motherboard that can run Win7.

        An FPGA is also not an emulator, in the case of running classic arcade games like Pac-man we recreate all of the chips in the Pac-man motherboard inside the FPGA. So it is an actual hardware recreation of the Pac-man motherboard instead of emulation.

        Well, I hope this is more helpful then confusing. I went into a little deeper explanation…


      2. Thank you Jack,

        The only part missing from your first post was whether the systems were emulated or not which you answered in this post. I find both posts highly informative!
        Regarding the computer motherboard analogy; I only used i to understand the limits of an FPGA. To me, when finding out about new platforms, it is critical to know what’s possible using said platform.

        Many questions have been answered and it does sound very intriguing.

        When i’ve prototyped something using the arduino i take the chip and use it stand alone with a crystal and a few caps. This makes me able to create a project cheaply and reliably. How would one go about doing something similar with an FPGA? Would one have to be an EE to do it? :)

      3. Hi Elrinn,

        Where are the limits?

        I’ve got ucLinux up and running on a US$79 dev board (see if you want a quick overview of the process) – I’m too cheep to pay for a license the NIOS II processor core that has a MMU and allows a full Linux distro. On a mid range FPGA you might get 200MHz out of a soft CPU core (based on numbers from

        Because you can build custom logic I’ve had my 4 year-old US$150 board render fractals about as fast as a single core of my AMD CPU in my laptop – using less than 2W.

        I’m redesigning my fractal view application to run on a current US$200 board and will speed it up 400% – 8 billion operations per second – as it runs twice as fast and has twice as many multipliers.

        On the top-of-the-range FPGA I would be looking at 40 billion ops…

      4. Oh – only just read your reply. Once your design is up and running if you aren’t an EE you could use something like

        It’s like an Arduino Nano but with an FPGA rather than an ATmega on it – with appropriate headers it could be mounted onto a custom PCB and for high value / small runs could be cheaper than designing a board.

      5. Thanks Mike,

        I know that something as complex as an fpga can’t really be “pulled out and soldered” like a single micro and something like this may be a viable option.

  15. Just found this Extremely informative, Open-Source VHDL book(PDF alert- 2.6MB) at the Free range factory website and the price is right(Free as in Beer). If there are other cash strapped newbies out-there with a resolution to start hacking FPGAs, go give it a try. You can even download the Latex files and edit the content to add Your inputs if that makes sense.

Leave a Reply

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

You are commenting using your 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