Editor's Note: As you will soon discover, the author – Sven – has created the most fantastic on-going tutorial on learning how to design with FPGAs from the ground up. This article is merely an introduction to Sven's tutorial which – at the time of writing – has 38 parts and is getting larger as we speak (the current contents list – with links to each section – is provided at the end of this "How To").
Hello there. My name is Sven Andersson. I have been designing ASICs for more than 15 years. A few years ago I realized that there was another player in town – the FPGA. With increasing NRE costs and with the long turn-around times, ASIC designs have become high-risk projects. At the same time, FPGAs are getting bigger and faster and many companies have therefore decided to use only FPGAs. For this reason, I decided to take a closer look at FPGAs. This is my story of how I (hopefully) will learn to use FPGAs in my future designs.
John Dewey (1859-1952) was an American philosopher and educator whose writings and teachings have had profound influences on education in the United States. Dewey's philosophy of education, instrumentalism, focused on "learning-by-doing" rather than rote learning and dogmatic instruction, the current practice of his day.
For Dewey, it was vitally important that education should not be the teaching of mere dead fact, but that the skills and knowledge which students learned be integrated fully into their lives as persons, citizens and human beings. So . . . let's practice learning-by-doing.
Let's get started
In order to learn anything, it's best to have some "real-world" project to work with. On this basis, we will design an embedded system, implementing some form of processor-controlled test equipment.
Thereafter, we will write a software device driver and an application program to run on our system. The first thing we will do is to put together a FPGA design checklist. A checklist is used to compensate for the weaknesses of human memory so as to help ensure consistency and completeness in carrying out a task.
FPGA design checklist
- Make sure you have plenty of time to spare.
- Find a decent computer.
- If you can afford it, add a big display.
- Decide which operating system to use.
- Consider using a virtual machine (VM).
- Select an FPGA vendor.
- Pick out a suitable development board.
- Select an embedded processor to use.
- Download the FPGA design software.
- Add the latest service packs.
- Choosing a logic simulator.
- Choosing a synthesis tool.
- Learn C programming.
- Read my tutorial (grin) .
Make sure you have plenty of time to spare
It will take some time to set everything up, find all the information scattered all over the place and solve all problems along the way. I started this project December 2006 and I have not finished it yet. Learning from my mistakes will save you some time.
Find a decent computer
Almost any X86 equipped computer will do the job, but if you plan for some larger designs you should use a Intel Core Duo equipped computer. I am an old Mac fellow and will of course use my new MacBook with an Intel Core 2 Duo processor running at 2 GHz. I will add a 23" Cinema display to provide a large screen area.
Decide which operating system to use
Here we have three choices. We can use a UNIX operating system like Solaris if we happen to have a SPARC workstation from SUN available, or we can use Windows XP or Linux on an X86 computer. For myself the choice is easy. Coming from a UNIX world I will use a Linux distribution. After trying out Ubuntu Linux I fell in love immediately.
Consider using a virtual machine
I could of course install Linux directly on my computer, but that would stop me from using Mac OS X at the same time, and that I don't like. A perfect solution is to install Linux in a virtual machine (VM). There are at least three ways of doing this as follows
After trying out Parallells Desktop and VMware Fusion, I decided to go with VMware Fusion.
Select an FPGA vendor
The two major FPGA vendors are Altera and Xilinx. Choosing which one to use is not an easy decision. The deciding factor for me was the MicroBlaze soft processor from Xilinx.
Pick out a suitable development board
We could, of course, design an FPGA-based development system for ourselves, but using one of the development boards from Xilinx will make things much easier. Xilinx have a number of such boards in their catalog. Which one to pick? I decided to go for the ML403 board that has a Virtex-4 FPGA with a PowerPC 405 core. A cheaper alternative would be a Spartan 3 based board.
Select an embedded processor to use
As I mentioned earlier, I have already decided to use the MicroBlaze soft processor core. The MicroBlaze is a 32-bit Harvard RISC architecture optimized for Xilinx FPGAs. The basic architecture consists of 32 general-purpose registers, an Arithmetic Logic Unit (ALU), a shift unit, and two levels of interrupt.
Download the FPGA design software
The ML403 board is bundled with two software packages called the Integrated Software Environment (ISE) and Embedded Design Kit (EDK). These packages contain all the software needed to design and implement an embedded system. The latest version of the software can be downloaded from the Xilinx web page at www.xilinx.com.
Adding the latest service packs
As always with software products there are updates and bug fixes. These are delivered in service packs that have to be downloaded and installed. It's very important to ensure that you have the latest service pack(s) installed, because this will save you a lot of headaches.
Choosing a logic simulator
The Xilinx software includes a very simple Verilog and VHDL Simulator that runs only under Windows XP. The commercial simulators available from Cadence, Synopsys, and Mentor cost a fortune and are out of reach for the normal user. What to do? Fortunately, I managed to convince Cadence that it would be a nice idea to give me an evaluation license for their Incisive Unified Simulator that I could use.
Choosing a synthesis tool
The Xilinx software comes with the XST Synthesis Tool. There are a number of synthesis tool out on the market but I find XST to be sufficient for my needs.
If you don't have any experience with regard to programming in C, you should find a good textbook and start learning it immediately. Why? Well, apart from being a very useful thing to know in general, all the Xilinx software device drivers are written in C.
Read my tutorial
For a full description of my embedded design project, read my tutorial, which you will find on my www.fpgafromscratch.com website. Also please note that this is an interactive experience – I welcome your comments, suggestions, and questions, which you can post on my site.
Yes, it is possible to learn how to design an embedded system using an FPGA. The biggest problem is finding the documentation and understanding the whole design flow. Hopefully my tutorial will help you in that respect. If you have some hardware and software experience it will be easier, but even for a newbie it is doable.
Contents of the tutorial
- Part 1 Introduction / let's get started
- Part 2 Defining a design project
- Part 3 Introducing the development environment
- Part 4 Running Xilinx's Integrated Software Environment (ISE)
- Part 5 Setting up the simulation environment
- Part 6 The simulation process using NCSIM
- Part 7 Running a simulation and degugging the design
- Part 8 Using a HDL Analysis and Lint tool (HAL)
- Part 9 Regression testing
- Part 10 Synthesis with timing constraints
- Part 11 The Field Programmable Gate Array (FPGA) description
- Part 12 Adding synthesis constraints
- Part 13 Installing the Embedded Development Kit (EDK) from Xilinx
- Part 14 Software upgrades
- Part 15 Building a system using Xilinx Platform Studio (XPS)
- Part 16 Create or import a user peripheral
- Part 17 Adding our design object and generating a system netlist
- Part 18 Putting together a system simulation environment
- Part 19 Generating a Verilog testbench
- Part 20 Running our first simulation and adding the DDR SDRAM
- Part 21 Debugging IP blocks
- Part 22 Using the XPS Sofware Development Kit (SDK)
- Part 23 Simulating MicroBlaze program execution
- Part 24 More system simulations
- Part 25 Implementing the hardware platform. Generating the bitstream.
- Part 26 Using iMPACT, the configuration tool
- Part 27 The pin assignment closure process
- Part 28 Power calculations using XPower
- Part 29 Hardware and software setup
- Part 30 Running demonstration software applications
- Part 31 Adding a 16x2 character LCD display
- Part 32 Writing the "Hello World" program
- Part 33 Simulating the LCD driver
- Part 34 The MicroBlaze program layout
- Part 35 Using Simgen to generate simulation HDL files
- Part 36 Finishing the LCD driver
- Part 37 Software debugging using Xilinx Microprocessor Debugger (XMD)
- Part 38 Writing a software device driver
But wait, because there's more to come, including (but not limited to):
– Finishing the device driver
– Writing an application program
– Debugging using ChipScope
– Adding an interrupt controller and timer
– Installing a Linux OS
So keep coming back to my tutorial to see what's going on – best regards – Sven
The author – Sven – on a recent backpacking tour of the Swedish mountains
(the mountain in the background is called Ekorrhammaren ["Squirrel hammer"], but don't ask why!
Sven Andersson graduated from the Royal Institute of Technology in Stockholm in 1974 with a Master of Engineering Science in Electrical Engineering. He then worked at Ericsson Telecom for more than 30 years, the last 15 years of which were as an ASIC designer. In October 2006, Sven left Ericsson to start his own consulting company ZooCad Consulting, where he now specializes in freelance ASIC and FPGA designs.
Sven lives in downtown Stockholm. He is married to his wife, Elisabeth, and has one daughter called Sara. When he is not sitting in front of his computer, Sven likes staying outdoors and going on backpacking tours in the Swedish mountains in the summer and tour skating in the
www.wildskating.com. Sven is also a runner – last year he ran the New York Marathon.