Idiot's Guide to FPGAs Please!

How's fpga4fun working for you?

Idiot's Guide to FPGAs Please!

Postby wavering » Sun Apr 04, 2010 10:24 am

I know absolutely nothing about FPGAs. So, is there a real idiot's guide somewhere that will help me understand the most basic details of what these devices are, how they work and what they can do? I have tried looking on the web but as usual, everything I find assumes that the reader knows the basics. I cannot even find out whether they have processors or if they are just logic gates!

By background, I actively write software in Visual Basic 6 with APIs written in a mixture of C++ and ASM. Specifically, I am interested in Genetic Programming and typically to find a solution my programs may run overnight or even for a week or so. This despite the fact that they are optimized for speed (hence inner loops written in ASM)

One way forward is to use multiple processors (eg several Desk tops with Quad processors in a wireless network). This is something I can do but I am interested in other possible routes - hence this question

So, could I run say 100 copies of an inner loop on an FPGA and if so how would this connect to my PC or network? Can I plug some kind of board into a USB Port or is this naive?

I have designed and built electronic devices in the past (about 15 years ago) but nothing involving processors

Many thanks
Bob
wavering
 
Posts: 2
Joined: Sun Apr 04, 2010 10:01 am

Postby NickH » Mon Apr 05, 2010 11:15 am

Well it's nothing like a complete answer, but I'll make some comments...

There are at least 3 different answers to "is an FPGA a processor?"

1. Basically, No. An FPGA is just gates. More accurately it's an array of programmable logic functions and storage elements (D-type flipflops), with programmable interconnect. (Often there are also some small blocks of RAM and fast adders/multipliers.)

2. Many FPGAs are big enough that you can construct a virtual or "soft" processor core inside them. Either one you designed yourself, or an "IP Core". So, Yes.

3. Just to add confusion, some larger FPGA chips incorporate genuine "hard" processor cores, amongst other bells and whistles.

You can get tools (not free) that will automatically generate and configure a core and some peripherals, to your specification (and let you incorporate some custom logic of your own), then let you compile and download software to it.

Custom FPGA logic is designed using a Hardware Description Language (Verilog or VHDL). HDLs look like a weird hybrid of hardware and software. Really, they are software that runs on a simulator. But if you follow certain rules, the code can also be compiled into equivalent hardware (or an FPGA configuration). Their style is very parallel and modular, so it's not hard to make 100 copies of some logic. These tools are free.

If you want lots of threads running software, then FPGA might not be the answer -- it's probably neither the cheapest nor the fastest way of doing it. But if you can express your "inner loop" as custom logic in an HDL, it might be the way to go.

Getting data in and out can be tricky. Serial is easy but slow. Parallel port may be a good choice if your board has it. USB can be tricky, it depends how much of the "protocol stack" is implemented by external chips on the board, and how much needs to be done by the FPGA. (By the way, many FPGA boards use USB or Parallel port to configure the FPGA -- but that's not the same as data I/O.)

Hope that helps a little,

Nick
NickH
 
Posts: 88
Joined: Tue Sep 02, 2008 1:53 pm

Postby wavering » Mon Apr 05, 2010 2:03 pm

Hope that helps a little


Nick
That helps a lot - thank you! Hopefully, it will help others too in due course

I have read that typically FPGAs have a clock speed of about 300MHz and indeed have found a statement which is interesting:

Image

I am assuming that in order to do the loop 32 times, the statement c[i] = a[i] * b[i]; is reproduced 32 times so that all 32 repeats happen on the same clock cycle?

I note the difficulty re input/output and clearly you need to design the program (oops, hardware gates) so that input/output is minimal and not time limiting

Can you suggest a kit which is, above all easy to use and would enable me to see if this approach will work? Obviously, I do not want to spend months getting into and then find it is no improvement ... cost is not a major factor - maybe up to say $1,000 all in for starters
Many thanks again
Bob
wavering
 
Posts: 2
Joined: Sun Apr 04, 2010 10:01 am

Postby elpuri » Mon Apr 05, 2010 10:18 pm

I've liked Altera's DE2 board, but that's because it's packed with all sorts of peripherals. I reckon you're more interested in data processing? If that is the case then you should probably consider http://digilentinc.com/Products/Detail.cfm?NavPath=2,400,819&Prod=GENESYS. The Virtex5 on the board is a monster (while the Cyclone II on the DE2 board is much more modest) and can do a lot of math.
elpuri
 
Posts: 55
Joined: Thu Apr 12, 2007 6:55 pm


Return to Comments