Design Article
How to design an FPGA from scratch
Sven Andersson, ZooCad Consulting
8/29/2007 11:34 AM EDT
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.
Learning-by-doing
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.
Learn C-programming
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
Lessons learned
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
Winter (see


Artfldgr
8/30/2007 2:42 PM EDT
Great article... though it wasnt too good to use Dewey as an example. Dewey was a subversive communist, and was found out when the venona transcripts were decoded.
here are some others..
"[Radical/leftist] Whitman and [atheist/humanist] Dewey tried to substitute hope for knowledge. They wanted to put shared utopian dreams-dreams of an ideally decent and civilized society-in the place of knowledge of God's Will, Moral Law, the Laws of History, or the Facts of Science...As long as we have a functioning political left, we still have a chance to achieve our country, to make it the country of Whitman's and Dewey's dreams." Richard Rorty, Achieving Our Country: Leftist Thought in Twentieth-Century America, p. 106, 7.
Doesnt sound like someone that helped education... in fact our education system is moribund BECAUSE of his changes to the system and incorporation of ideology over education.. (or havent you figured out why over 40 years we cant get to where we were?)
"In Dewey-disciple George S. Counts' Dare the School Build a New Social Order? he declared that 'teachers should deliberately reach for power and then make the most of their conquest [so as to] influence the social ideals, attitudes, and behavior of the coming generation.' Trust in Providence, he said, must be replaced through careful planning, capitalism would 'have to be displaced altogether...or changed radically,' and attitudes would have to be recast through education." B.K. Eakman, p. 127, 8.
"Most Americans believe that Russian education was highly academic despite its political propagandizing. They would be surprised to learn that one of Lenin's first official acts was to eliminate examinations, homework, failure and punishment, as well as to collectivize (consolidate) the schools. Even more remarkably, he began disseminating the works of [John] Dewey! By 1924, Soviet education theorists were saying that holding the correct view-points, including a 'collective spirit,' was more important than substantive knowledge. Indeed, the first Communist Five-Year Plan in 1927 included several education provisions aimed at building the 'new socialism' that was going to usher in a worker's paradise. Today, experts in America say something similar, that it will usher in a new era of competitiveness, prosperity and lead to less world conflict. New promises; same old collective philosophy." B. K Eakman, p. 134.
'The ultimate problem of all education,' wrote [John] Dewey, 'is to coordinate the psychological and social factor...' Dewey further stated that schools should 'take an active part in determining the social order of the future' and that teachers should align themselves with forces of social and economic control...By the late 1940s, Teachers' College at Columbia University had become the vehicle for spreading the wisdom of the collective." B. K. Eakman, p. 121. (Dewey was a founder of the Intercollegiate Socialist Society and president of the League of Industrial Democracy.) (Dewey was also a signatory of Humanist Manifesto in 1933.)
you can find early work that says that Dewey was an anticommunist... but thats before they decoded the transcripts.
singlehandedly he helped to create a situation in which the US went from number 1 and now is way down the list... with companies claiming that the kids are uneducated... i work in a medical college and we get potential doctors that cant read past 8th grade, or think independently.
"Out of this milieu in 1919 came New York Citys New School for Social Research, dedicated to teaching manifestations of socialism in all academic disciplines. Among its founders were historian Charles Beard, economists Thorstein Veblen and James Harvey Robinson, and philosopher John Dewey, all active and avowed socialists."
so rather than a hero... he is the opposite and has not improved schooling by removing the teachings of the west, fomenting sex ed earlier and earlier, teaching ideology to mould the new communist man from the schools.
"You can't make socialists out of individualists. Children who know how to think for themselves spoil the harmony of the collective society" - John Dewey, "the father of modern education," - avowed socialist, co-author of the "Humanist Manifesto." & member of 15 Marxist front organizations.
the ones who really focused on doing were the greek philosphers... who are now dead white guys we dont learn from any more.
other than this falst step...
the rest of your stuff is awesomely good!!!!
one last cut out...
the ethical foundation of the Progressive Movement: a contempt and loathing of "individualism" -- and its political expression in the Declaration of Independence and the Constitution:
§ Croly: "The Promise of American Life is to be fulfilled ... by a large measure of individual subordination and self-denial."
§ Sociologist Lester Ward: "The individual has reigned long enough."
§ Antitrust leader Henry Demarest Lloyd: Individualism is "one of the historic mistakes of humanity."
§ The Outlook editor Lyman Abbott: "[I]ndividualism is the characteristic of simple barbarism, not of republican civilization."
§ Baptist minister Walter Rauschenbusch: "[I]ndividualism means tyranny."
So great was this fear of the individual that John Dewey believed that the "mere absorbing of facts and truths is so exclusively individual an affair that it tends very naturally to pass into selfishness." "Progressive education" was developed to meet the individualist threat on the juvenile level
Sign in to Reply
medulius
8/31/2007 4:52 AM EDT
Really sad reading comments like yours, Artfldgr, on 2007 claiming that Comunist is cause of all bad things in the world and even surprinsingly, in US!!!
Incredible to read that just one guy is the cause of the incredibly bad education system in US.
Astonished that the cause is because the guy was comunist, because it's a fact that comunist countries had a great system education in terms of knowledge, or least people had a great knowledge on science and maths.
Ashame that somebody is able to use in a public and international site sentences like: "white guys".
Dejected about knowing that there is people who doesn't know yet that comunism and socialism are really different.
Sign in to Reply
Artfldgr
9/5/2007 1:32 PM EDT
Give me four years to teach the children and the seed I have sown will never be uprooted.
Vladimir Lenin
Education is a weapon whose effects depend on who holds it in his hands and at whom it is aimed.
Joseph Stalin
He alone, who owns the youth, gains the future.
Adolf Hitler
The universities are available only to those who share my revolutionary beliefs.
Fidel Castro
Ideas are far more powerful than guns. We dont allow our enemies to have guns, why should we allow them to have ideas?
Joseph Stalin
When one makes a Revolution, one cannot mark time; one must always go forward - or go back. He who now talks about the freedom of the press goes backward, and halts our headlong course towards Socialism.
Vladimir Lenin
obviously, they think socialism is the same, too bad they didnt talk to you medulius.
There are no morals in politics; there is only expedience. A scoundrel may be of use to us just because he is a scoundrel.
Vladimir Lenin
How fortunate for leaders that men do not think.
Adolf Hitler
Democracy is the road to socialism.
Karl Marx
Democracy is indispensable to socialism.
Vladimir Lenin
Sign in to Reply
Artfldgr
9/5/2007 1:34 PM EDT
The day of individual happiness has passed.
Adolf Hitler
All our lives we fought against exalting the individual, against the elevation of the single person, and long ago we were over and done with the business of a hero, and here it comes up again: the glorification of one personality. This is not good at all. I am just like everybody else.
Vladimir Lenin
I think that a man should not live beyond the age when he begins to deteriorate, when the flame that lighted the brightest moment of his life has weakened.
Fidel Castro
It is true that liberty is precious - so precious that it must be rationed.
Vladimir Lenin
We must confront the privileged elite who have destroyed a large part of the world.
Hugo Chavez
personally i think its sad that you side with them... than with someone who sides with liberty FOR ALL...
Sign in to Reply
stigskov
11/16/2010 1:42 PM EST
Thank you for standing up -
All that is necessary for evil to succeed is that good men do nothing.
~Edmund Burke
Sign in to Reply
CKV
9/6/2007 11:58 AM EDT
Sir, the article which you are attaching very useful for the beginners. could i get the FPGA development based on matlab environment, please attach to me, for which i am very much great full ever.
regards
Kumaravelu.C
Sign in to Reply
InnocommsRF
9/6/2007 1:20 PM EDT
This is just the sort of "How to" guide that I need to start learning about FPGA's. Thank you, Sven.
As to the Artful Dodger, as he appears to call himself, his rant is quite amusing and entertaining - An individualist, much as his namesake (but hopefully not a thief?), but he obviously doesn't understand all his quotes, eg:
"All our lives we fought against exalting the individual, against the elevation of the single person, and long ago we were over and done with the business of a hero, and here it comes up again: the glorification of one personality. This is not good at all. I am just like everybody else."
Vladimir Lenin
In this Vlad was referring to the cult of the individual, i.e. those who slavishly raised their leaders such as Mr Stalin and himself and treated them as heros, and saying that they were mistaken, that he is just an individual like everyone else, not some saint or superhero.
I suspect that many of the other quotes are equally out of context, but also suspect that Mr Dodgy Dodger probably thinks that "Liberal" is a term of insult.
Sign in to Reply
antennahead
9/6/2007 5:54 PM EDT
Please remember that Philosophy and Philosophers deal in shades of gray. Any attempt to study the subject with any seriousness quickly reveals this fact. Aside from the most basic axiomatic facts, right and wrong answers simply do not exist, though we all wish they did. Quoting snippets from your favorite contentious Philosophers is usually very inappropriate, probably worse than citing phrases from the Bible. If you believe in the First Amendment in our constitution you must respect their right to their own thoughts and opinions despite whatever you might think about those thoughts and opinions.
Carl Marx made many good points about the dark sides of capitalism- if you actually take the time to read it and set aside the brainwashing we've all received. He also made some pretty stupid suggestions about communism.
It's up to all of us to see what sticks and what doesn't for us individually. That process is called thinking and being an individual, and what true Philosophy is all about.
Sign in to Reply
Max the Magnificent
9/27/2007 5:09 PM EDT
I am flabbergasted (my "flabber" has rarely been so "gasted") -- I had no idea that this article on learning how to use FPGAs had so many ramifications with regard to political ideology (grin).
Sign in to Reply
Baskar
1/21/2008 6:58 AM EST
Thanks for your article...seems very descriptive....
Sign in to Reply
braver
8/12/2009 10:39 PM EDT
maybe the web is bad.
I can't open any part of the Contents of the tutorial.
Sign in to Reply
boogie knight
10/2/2009 1:13 PM EDT
just love it and will do my best as a beginner to follow it step by step here in Ghana.i need a mentor though,guess what i think i found you(grin).i hope to champion it just like you are doing one day in my home land.
thanks
(pliz get in touch)
Sign in to Reply
akshat
5/23/2010 11:35 AM EDT
I am surprised by the choice of author of not mentioning Lattice - a growing power in FGPA domain whose products are winning awards the world over - as one among the 3 major FPGA players.
Sign in to Reply
john.hoekstra
3/28/2011 3:40 PM EDT
I need help. I have taken your tutorial and it was a great help. I now want to create a GUI front end like the software the Xilinx and Altera boards come with, but they don't give you the source code or tell you the technical stuff needed it to do it yourself. I want to setup some registers in the FPGA to R/W so I can control stuff. Read the temp of the FPGA, flash some LEDs on the simple side. I could us an internal uP or ???. I want to use USB or Ethernet to be the control like to the PC, not a serial or GPIo port. how does one start this project that is common in the industry. I could do a custom implementation. I would like to do the same front end as Xilinx, Altera, Digilent and other FPGA demo manufactures, but they don't share. :)
Sign in to Reply
john.hoekstra
3/28/2011 3:44 PM EDT
a
Sign in to Reply
plotter
3/29/2013 1:48 PM EDT
Great Tutorial on FPGA's I'd ever seen. You did an awesome job sven. This is book marked and will definitely use it for reference in the future.
Sign in to Reply
darthbedder
4/25/2013 12:21 AM EDT
Very disturbing when the eye is forced to see. I had the bad experience of being born and raised in a communist/socialist country. The only ones allowed to have individualist feelings are those few chosen who mis-run the country, the rest is just the anonymous mass who can hardly get a book on Embedded Design or have access to the internet to read about dictators. It's 2013, we better talk about embedded, at least it shows real results that make an individual look like a giant with his cellphone in the middle of a crowd. If K. Marx had an iPod he had not probably written Das Kapital, saving a lot of trees, the ozone layer and the readers, of course. See, you can not mix science and politics, all my energy to read the tutorial is now wasted. Have to come back later to post the comments on Sven tutorial which look very promising.
Sign in to Reply
dirkmann
6/7/2013 12:39 PM EDT
@Artfldgr - After such vitriolic comments, perhaps you don't realize that Hitler was a FACIST, not a communist or socialist and that the auther who coined your moniker "Artful Dodger" was Charles Dickens was a socialist. Just another example of some one who spouts off without knowing what they're talking about a la Rush Limbaugh.
Sign in to Reply