Lancaster Hunt Systems Ltd
Web site design, surrey
web site hosting

Designing FPGAS In VHDL On A Budget

Introduction

FPGAs or Field Programmable Logic Arrays to give them their full name, are large lumps of uncommitted logic. The field programmable bit gives the clue to their usage and utility. This basically means that on their own their don’t know what to do, they have to be programmed and that generally happens once they have been stuck down to the PCB. FPGAs are the logic equivalent of the EPROM/FLASH in the processor world.

Back in the good old days FPGAs were the domain of big corporates, due to the high price of silicon and the exorbitant price of design tools. Fortunately the world is now different and FPGAs and design tools are available for every size of pocket.

Why Use FPGAs?

Because they are cool.

Because they make PCB layout less risky, as changes to the design can often be accommodated in the FPGA.

Because in a commercial environment they enable the PCB layout to proceed earlier.

Because things can be done in an FPGA that are impossible in discrete logic due to physics and signal integrity issues.

Because they provide design security. It is much more difficult to reverse engineer an FPGA design than a design in discrete logic.

Because they are a cheap option.

Because they are very dense compared to standard logic.

Because they use less power than the discrete equivalent.

Because it looks good on the CV.

Because I can’t afford to make ASICS.

Because there are lots of existing designs to re-use. Design re-use either through your own developed libraries or through external IP allows for fast design times.

Brief History Of FPGAs

FPGAs have grown out of an older technology called PLDs. Programmable logic arrays. These where basically small devices of up to 24 pins which contained an array of similar gates. The early devices typically contained AND gates for outputs, and the user programmed which of the inputs got used in each AND gate. The idea took hold and developed with the addition of flipflops and more internal stuff.

Now modern FPGAs have thousands of flip flops, million gate capacity, internal RAM, PLLs, DSP blocks, fancy interfaces and run internally at really whizzy speeds like 500MHz.

Technologies
All the technologies use a loads of programmable switches to route signals and configure functionality with the device. The switch can be FLASH, SRAM or ANTIFUSE based. Of the three technologies for implementing FPGAS, FLASH and SRAM based dominate. ANTIFUSE technology is generally used only for specialist stuff, like radiation hardened for space and mission critical stuff.

FLASH
The basic Array is made of FLASH based cells. This means the device is non volatile, it remembers the program when it is powered down. Typically FLASH is less dense that the other options. It can be programmed in circuit.

SRAM
The logic array is based on SRAM cells. These are definitely volatile so the program has to be downloaded every time the power is applied. There are ICs which have been designed to do the downloading or it can be done under processors control. This facility makes the upgrading of FGPA code in the field an option and this also opens up the route to reconfigurable circuits. Some FPGAs allow for sections to be reprogrammed on the fly. This is a denser option than FLASH as the SRAM cells need less transistors than the equivalent FLASH cell.

ANTIFUSE
The array is made of small silicon fuses. They use real fuses which are blown by passing excessive current through them. This means they cannot be reprogrammed. They are not widely used, except in stuff like RAD hardened space rocket and satellites. Tends to be the most expensive option.

Silicon Costs
Costs are very low, especially compared to PCB costs and component costs of a logic implementation. For example an Altera EP1k10 device has a roughly contains 576 registers and 12,228 bits of SRAM. Assuming a usage of 90 % this gives 518 registers and 11,000 bits of RAM.

If the registers are just plain d-type flip flops, thats around 72 octal packages in equivalent gates in the space of a 144 pin TQFP, for the cost of around $15. Plus it will run much faster that any discrete TTL logic.

Toolsets

To program an FPGA a number of software tools are required. All the top silicon vendors provide their own kit, plus there is a lot of third party software vendors out there. Most of the third party stuff is too expensive to be considered for this article. All the toolsets comprise of roughly the following set to tools.

Compilers
The compiler takes your description of the FPGA and converts it into something the rest of the tools can handle. The most used options these days are :

  • VHDL
  • VERILOG
  • SCHEMATIC ENTRY

VHDL and VERILOG are hardware description languages ( HDL ), somewhat akin to C. Both are supported by all the main vendors. Which you choose is really a question of religion, if you want a good dust up try posting VERILOG/VHDL stinks on one of the many HDL forums. I use VHDL cause thats what got cheapest first.

Schematic capture is still available for the recalcitrant hardware designer who can’t/ won’t use anything resembling code. But for big designs the HDLs rule the roost.

There are a number of older languages still kicking round which predate the modern HDLs. Examples are ABEL and PALASM.

Synthesizers, fitters,a assemblers etc
These take the output of the compiler stage and make it fit into the FGPA. They will also produce timing information, so that the simulators can do a proper job.

Simulators
So you have written your 100k gate super dooper widget and put it into the hardware and amazingly enough it doesn’t work. Now what ? – here comes the simulator to the rescue. So the simulator allows the design to be tested as a piece of software. It allow stimulus to be applied to the inputs and provides a record of the outputs. It will also allow the probing of internal bits of the design that you can’t get to when it is in the hardware. Almost all simulators now provide a graphical view of the outputs and either a graphical input scheme or a scripting language to provide input stimulus.

Modern simulators will use HDLs to provide the test stimuluses, known as a testbench.

Modelsim and Leonardo Spectrum are pretty well the industry standard, but deep pockets are generally required. Sometimes these are available as part of silicon vendors package at the right sort of price for me. But beware that sometimes these allegiances can be temporary affairs.

VHDL Simili is a low cost ( FREE ish ) VHDL only simulator that provides a good compromise for people lacking deep pockets. The completely free version is restricted in performance and design size.

Both Xilinx ( Webpack ) and Altera (Quartus ) provide complete design systems for free. And very good they are too. They offer a limited range of device types and sizes. If you want the very latest, biggest and fastest devices be prepared to get out your wallet. But for hobbyists and small companies they are a perfect solution.

Programming OK so you have got the design finished and polished by repeated simulation, so off to the real hardware. So how does it get there ?

Well some sort of programmer obviously, all the silicon guys will provide a PC based programmer – low cost ones run off the parallel port, more fancy ones use USB. Rolling your own is a route that can be followed, see here for a connection diagram. The parallel port versions are pretty simple affairs.

Another solution is to roll the programmer into the design. For instance a 5 pins of micro controller will program a RAM based devices. If the design is hanging off a PC, use the PC to control the downloading.

Learning Resources

As usual the web knows all. There are many excellent resources on the web for learning VHDL. Plus a whole industry of books available from all the normal places.

In addition there are style guides, example code, intellectual property – all only a google search away. A mere smattering of the useful sites can be found below.

Conclusions

FPGAs are now available and usable by anybody irrespective of size of the wallet. It is possible to do professional FPGA design without spending a penny on design tools or programming gear.

Links and things

Silicon
Xilinx – one of the top two silicon vendors – toolsets, programmers and devices.
Altera -the other one.
Tools ( See above as well )
vhdl Simili – excellant low cost vhdl simulator
Learning
Accolade VHDL reference – loads of reference stuff
Dulous FPGA design site – loads of reference stuff and tutorials
VHDL Verification Course – Tutorial on test benches.
VHDL-Online – Tutorial on starting with VHDL, test benches etc
Libraries and IP
FMF Home Page – Free Model foundry
Free IP cores @ open cores – VHDL models
CorePool About CorePool – More models.
The hamburg archive of VHDL stuff – all flavours of vhdl stuff

Staines web hosting
Surrey web site
Web site design