Beginners guide to FPGAs

Hi,

Following on from the positive response to my previous blog post about adding an FPGA to your Arduino projects I received a request to write an beginners guide to FPGAs which I have now posted. You can read this new article and my previous posts at Beginners Guide . I hope you enjoy it and find it useful and I look forward to reading your feedback and comments.

A problem with FPGA's is that you have to program them. For that you need somekind of an IDE. And a programming language which is not C. IDE is often free, but a programming dongle may cost something, or you have to buy a demo board.

Playing with a FPGA is fun, of course. Like building a NAND gate or something. But I thing that getting something really usefull and making it work is much more difficult. Like learning VHDL or Verilog. Or studying some messy Open core design.

I am not an expert in this, so if I am wrong, I am happy to hear it.

A problem with FPGA's is that you have to program them

Like a micro-controler.

For that you need somekind of an IDE

It is a true IDE with editor, compilator, schematic editor, simulator

but a programming dongle may cost something

You can find at less than 10 €.

you have to buy a demo board.

Arduino boards are demo boards. On Ebay you can found demo-board around 15/20 €

I am not an expert in this, so if I am wrong, I am happy to hear it.

It will be no correct to say you are wrong, but you are not totaly right :grin: .

Programming an FPGA is very nice.
The language is close to the syntax of C, but it is not a programming language but description language.
You have to think in terms of hardware so a minimum knowledge of digital electronics is desirable although the possibility of using ready to use libraries exist.

FPGA / CPLD is actually multitasking.
Change output level with an avr take 7-8 clock cycles with direct register manipulation (8 more time with arduino function), change 10 output take 10 more times as operations are done in series.
Change output level with a FPGA or CPLD take ONE clock cycle whichever the number of outputs. The level of all outputs changes in the same clock cycle.

You can find open core to produce a micro-controller with a FPGA :grin: .

FPGA and CPLD need an external true oscillator not a simple cristal. The program must be loaded in EEPROM. With CPLD EEPROM is internal, with FPGA you must add EEPROM in external package.
The mixed Digital / Analog FPGA (op amp) are rare and expensive.

Not much to add.

Lattice's own dongle is expensive, I think 50£$€ or so, Ebay and such, have clones with less price.

The Open cores I looked at, were messy, I would not like to adopt them in my own design.

There was/are? many kinds of FPGA IDEs. Lattice's is very large or has more functions than MS Visual Studio, and much larger than Arduino IDE.

IDE for FPGA/CPLD can not be compare with Eclipse or Visual Studio
The FPGA/CPLD IDE have to do :
-edition
-compilation
-stimulation
AND proprietary operation inside the IC which requires knowledge within the IC.

It is only the IC manufacturer that can do it.
IDEs for Lattice, Xilinx, Alterra are all differents.

For Altera you can found :
up-to-date IDE for free. Limited version but perfectly usable. It lacks IC that are no longer manufactured. But all old versions are still avalaible to download.
On Ebay

  • Cyclone IV for 15/30 €, be careful big price difference for the same product,
  • Altera programming dongle less than 10 €.

I am not a specialist but generaly we can read :
best IC = Xilink
best IDE = Altera
most easy language to learn : verilog
most powerfull language, a bit more difficult, : VHDL

The FPGA vendor's IDEs can appear very intimidating - particularly if your experience is in software development with Eclipse of Visual Studio. However you can normally leave a lot of the interfaces with their default values to push your initial designs through the tool chain to create your programming file. (I'm currently writing a new post based on programming an FPGA shield using an Arduino which does not require any vendors expensive dongle so I will let you know when that is posted.)

Learning a new language is always a bit of a challenge and when comparing verilog and VHDL there is an old saying that with verilog you will spend most of your time in the simulator and with VHDL you will spend most of your time in the editor! Verilog is not strongly type checked so you can get some rather unexpected consequences from your code while VHDL is strongly type checked (and was originally based upon ADA) so can be a real pain to get to compile in the first instance.

Both are equally powerful with verilog tending to be more popular in the US while VHDL was more popular in Europe - Altera like to produce a lot of their IP in verilog too.

It is not about verilog or vhdl, or altera or xilinx - those are just tools.

It is about understanding digital electronics.

That understanding is very rare today, even among professionals.

So before you start with tools, you have to show to the beginners what it is good for.

I tried in past (see my xilinx cpld topic - a 32bit counter/freq meter) with minor response - CPLD and Arduino - a good mix - Other Hardware Development - Arduino Forum

I can hardly imagine somebody starts to mess with xilinx or altera ide without having a strong motivator. Yes, the idea you can create your own CPU this evening is nice, but a long way to go for vast majority of people here.

Hi Pito,

I'm not so sure that an understanding of digital electronics is rare but you're right to point out that there needs to be a strong motivator to spend time learning about a new subject. I think a lot of people are interested in FPGAs within the maker community because of their strength in being able to re-purpose the same hardware.

I think this is well demonstrated by the success of the Arduino family of development boards.

If a subject is interesting then people will spend time and effort learning about it and while a CPU is beyond most people a simple state-machine isn't. If you think of all the projects that people have created with Arduino and a bit of time and effort I personally think the same can apply to FPGAs.

After all it is almost as simple to get an LED flashing with an FPGA written in HDL as it is to get to the 'Blink' sketch running on the Arduino for the first time!

I agree with Pito: a good knowledge of electronics is required.
BTW I wrote:

You have to think in terms of hardware.

FPGA / CPLD are more affordable for an electronician than for a programmer.
The hardest part is not to find the schematic.
You must be able to know when you have to work in asynchronous or synchronous logic logic.
You must understand the significance and consequences of rise or fall time and propagation delay, and how to manage it.
Bad layout reduce max operating frequency. For huge project this requires being able to choose the location in the chip. This is possible only with experience.

For small project there are margins so you can let the IDE do the work :grin: .

In spite of everything if you have time and want to try it, don't hesitate, you can find on Ebay cheap product and the experience is very rewarding.

I am an (retire) analog electronician, without real knowledge in digital electronic. I try FPGA for pleasure, I have not persevered with : now time for project is completed :roll_eyes: .
I have found experience very interesting.

I don't think you need an in-depth understanding of electronics to get going with FPGAs. As 68tjs points out you can get cheap development boards that have the 'experience' built in and then use these to explore and develop your understanding of FPGAs. Experience comes from learning and tinkering with circuits. I think that is the real appeal of FPGAs and that it what I love about working with them - they can be a blank canvas that you can use to create interesting projects and learn about all of the things that 68tjs mentions.

After posting a new blog entry I have had to amend the hyperlink to point to the permanent location of the post. Sorry if this misled anyone.