FPGA权威指南英文版
FPGA
权威
指南
英文
Clive “Max”Maxfield is six feet tall,outrageously handsome,English and proud of it.In addition to being a hero,trendsetter,and leader of fashion,he is widely regarded as an expert in all aspects of electronics and computing(at least by his mother).After receiving his B.Sc.in Control Engineering in 1980 from Sheffield Polytechnic(now Sheffield Hallam University),England,Max began his career as a designer of central processing units for mainframe computers.During his career,he has designed everything from ASICs to PCBs and has meandered his way through most aspects of Electronics Design Automation(EDA).To cut a long story short,Max now finds himself President of TechBites Interactive( ).A marketing consultancy,TechBites specializes in com-municating the value of its clients technical products and services to non-t echnical audiences through a variety of media,including websites,advertising,technical documents,brochures,collaterals,books,and multimedia.In addition to numerous technical articles and papers appearing in maga-zines and at conferences around the world,Max is also the author and co-author of a number of books,including Bebop to the Boolean Boogie(An Unconventional Guide to Electronics),Designus Maximus Unleashed(Banned in Alabama),Bebop BYTES Back(An Unconventional Guide to Computers),EDA:Where Electronics Begins,The Design Warriors Guide to FPGAs,and How Computers Do Math ( ).In his spare time(Ha!),Max is co-editor and co-publisher of the web-d elivered electronics and computing hobbyist magazine EPE Online ( ).Max also acts as editor for the Programmable Logic DesignLine website( )and for the iDESIGN section of the Chip Design Magazine website( ).On the off-chance that youre still not impressed,Max was once referred to as an “industry notable”and a “semiconductor design expert”by someone famous who wasnt prompted,coerced,or remunerated in any way!About the Abio-h8974.indd xibio-h8974.indd xi6/20/2008 3:35:05 PM6/20/2008 3:35:05 PM The Fundamentals Chapter 1 FPGA Defi nitions Field programmable gate arrays (FPGAs)are digital integrated circuits(ICs)that contain confi gurable(programmable)blocks of logic along with confi gurable interconnects between these blocks.Design engineers can confi gure,or pro-gram,such devices to perform a tremendous variety of tasks.Depending on how they are implemented,some FPGAs may only be pro-grammed a single time,while others may be reprogrammed over and over again.Not surprisingly,a device that can be programmed only one time is referred to as one-time programmable (OTP).The “fi eld programmable”portion of the FPGAs name refers to the fact that its programming takes place “in the fi eld”(as opposed to devices whose internal functionality is hardwired by the manufacturer).This may mean that FPGAs are confi gured in the laboratory,or it may refer to modifying the function of a device resident in an electronic system that has already been deployed in the outside world.If a device is capable of being programmed while remaining resident in a higher-level system,it is referred to as being in-system programmable (ISP).In this book,well be referring to programmable logic devices(PLDs),a pplication-specifi c integrated circuits(ASICs),application-specifi c standard parts(ASSPs),andof courseFPGAs.WHY USE FPGAS?Various aspects of PLDs,ASICs,and FPGAs will be discussed later in more detail.For now,we need only be aware that PLDs are devices whose i nternal In an InstantWhy Use FPGAS?ApplicationsSome Technology BackgroundFusible-link TechnologyFPGA Programming TechnologiesInstant SummaryCH001-H8974.indd 1CH001-H8974.indd 16/21/2008 4:56:12 PM6/21/2008 4:56:12 PMFPGAs:Instant Aarchitecture is predetermined by the manufacturer,but are created in such a way that they can be configured by engineers in the field to perform a variety of different functions.In comparison to an FPGA,however,these devices con-tain a relatively limited number of logic gates,and the functions they can be used to implement are much smaller and simpler.At the other end of the spectrum are ASICs and ASSPs that can contain hundreds of millions of logic gates and can be used to create incredibly large and complex functions.ASICs and ASSPs are based on the same design processes and manufacturing technologies.Both are custom-designed to address a specific application,the only difference being that an ASIC is designed and built to order for use by a specific company,while an ASSP is marketed to multiple customers.ALERT !When we use the term ASIC from now on,it may be assumed that we are also referring to ASSPs unless otherwise noted or where such interpretation is incon-sistent with the context.Although ASICs offer the ultimate in size(number of transistors),com-plexity,and performance,designing and building one is an extremely time-consuming and expensive process,with the added disadvantage that the final design is “frozen in silicon”and cannot be modified without creating a new version of the device.Thus,FPGAs occupy a middle ground between PLDs and ASICs because their functionality can be customized in the field like PLDs,but they can con-tain millions of logic gates and be used to implement extremely large and c omplex functions that previously could be realized using only ASICs.Technology Trade-offs The cost of an FPGA design is much lower than that of an ASIC(although the ensuing ASIC components are much cheaper in large production runs).Implementing design changes is much easier in FPGAs.Time to market for FPGAs is much faster.FPGAs make many small,innovative design companies viable becausein addition to their use by large system design housesFPGAs facilitate “Fred-in-the-shed”-type operations.This means they allow individual engi-neers or small groups of engineers to realize their hardware and software con-cepts on an FPGA-based test platform without having to incur the enormous nonrecurring engineering(NRE)costs or purchase the expensive toolsets asso-ciated with ASIC designs.Hence,there were estimated to be only 1,500 to 4,000 ASIC design starts and 5,000 ASSP design starts in 2003(these numbers are falling dramatically year by year),as opposed to an educated “guesstimate”of around 450,000 FPGA design starts in the same year.CH001-H8974.indd 2CH001-H8974.indd 26/21/2008 4:56:13 PM6/21/2008 4:56:13 PM3Chapter|1 The F APPLICATIONS When they first arrived on the scene in the mid-1980s,FPGAs were largely used to implement glue logic,medium-complexity state machines,and rela-tively limited data processing tasks.During the early 1990s,as the size and sophistication of FPGAs started to increase,their big markets at that time were in the telecommunications and networking arenas,both of which involved pro-cessing large blocks of data and pushing that data around.Later,toward the end of the 1990s,the use of FPGAs in consumer,automotive,and industrial applications underwent a humongous growth spurt.FPGAs are often used to prototype ASIC designs or to provide a hardware platform on which to verify the physical implementation of new algorithms.However,their low development cost and short time-to-market mean that they are increasingly finding their way into final products(some of the major FPGA vendors actually have devices they specifically market as competing directly against ASICs).High-performance FPGAs containing millions of gates are currently avail-able.Some of these devices feature embedded microprocessor cores,high-speed input/output(I/O)devices,and the like.The result is that todays FPGAs can be used to implement just about anything,including communications devices and software-defined radio;radar,image,and other digital signal pro-cessing(DSP)applications;and all the way up to system-on-chip (SoC)com-ponents that contain both hardware and software elements.Insider Info These design-start numbers are a little hard to pin down because its difficult to get everyone to agree what a “design start”actually is.In the case of an ASIC,for example,should we include designs that are canceled in the middle,or should we only consider designs that make it all the way to tape-out?Things become even fluffier when it comes to FPGAs due to their reconfigurability.Perhaps even more telling is the fact that,after pointing me toward an FPGA-centric industry analysts Web site,a representative from one FPGA vendor added,“But the values given there arent very accurate.”When I asked why,he replied with a sly grin,“Mainly because we dont provide him with very good data!”FAQs What are the major market segments for FPGAs?ASIC and custom silicon:FPGAs are increasingly being used to implement designs that previously were realized by using only ASICs and custom silicon.Digital signal processing:Todays FPGAs can contain embedded multipliers,dedicated arithmetic routing,and large amounts of on-chip RAM,all of which facilitate DSP operations.When coupled with the massive parallelism provided CH001-H8974.indd 3CH001-H8974.indd 36/21/2008 4:56:13 PM6/21/2008 4:56:13 PMFPGAs:Instant A SOME TECHNOLOGY BACKGROUND The first FPGA devices contained only a few thousand simple logic gates(or the equivalent),and the flows used to design these componentsp redominantly based on the use of schematic capturewere easy to understand and use.By comparison,todays FPGAs are incredibly complex,and there are more design tools,flows,and techniques than you can swing a stick at.In this section well look at some technology basics.Key Concept What distinguishes an FPGA from an ASIC is embodied in the name:ProgrammableFieldGate Array Fusible-link Technology Lets first consider a very simple programmable function with two inputs called a and b and a single output y (Figure 1-1 ).The inverting NOT gates associated with the inputs mean that each input is available in both its true (unmodified)and complemented (inverted)form.Observe the locations of the potential links.In the absence of any of these by FPGAs,this results in outperforming the fastest DSP chips by a factor of 500 or more.Embedded microcontrollers:Low-cost microcontrollers,which contain on-chip program and instruction memories,timers and I/O peripherals wrapped around a processor core,are used in small control functions.With falling FPGA prices,however,and increased capability to implement a soft processor core com-bined with a selection of custom I/O functions,FPGAs are becoming increas-ingly attractive for embedded control applications.Physical layer communications:FPGAs have long been used for the glue logic that interfaces between physical layer communication chips and high-level networking protocol layers.Now high-end FPGAs can contain multiple high-speed transceivers,which means that communications and networking func-tions can be consolidated into a single device.Reconfi gurable computing(RC):FPGAs have created this new market seg-ment.This refers to exploiting the inherent parallelism and reconfi gurabil-ity provided by FPGAs to “hardware accelerate”software algorithms.Various companies are currently building huge FPGA-based reconfi gurable computing engines for tasks ranging from hardware simulation to cryptography analysis to discovering new drugs.CH001-H8974.indd 4CH001-H8974.indd 46/21/2008 4:56:13 PM6/21/2008 4:56:13 PM5Chapter|1 The Flinks,all of the inputs to the AND gate are connected via pull-up resistors to a logic 1 value.In turn,this means that the output y will always be driving a logic 1,which makes this circuit a very boring one in its current state.To make this function more interesting,we need a mechanism that allows us to establish one or more of the potential links.This mechanism is fusible-link technology.In this case,the device is manufactured with all of the links in place,with each link referred to as a fuse (Figure 1-2 ).These fuses are similar to the fuses you find in household products like a television.If anything untoward occurs such that the television starts to con-sume too much power,its fuse will burn out,resulting in an open circuit,which protects the rest of the unit from harm.Of course,the fuses in silicon chips are formed using the same processes that are employed to create the transistors and wires on the chip,so theyre microscopically small.a Logic 1 y?1(N/A)&b Pull-up resistors Potential links NOT NOT AND FIGURE 1-1 A simple programmable function.a FatLogic 1 y?0(N/A)&Fafb FbtFbfPull-up resistors NOT NOT AND Fuses FIGURE 1-2 Augmenting the device with unprogrammed fusible links.CH001-H8974.indd 5CH001-H8974.indd 56/21/2008 4:56:13 PM6/21/2008 4:56:13 PMFPGAs:Instant A Although fusible-link technology is not used in todays FPGAs,it sets the stage for understanding technologies that are,so well explore it briefly.When you purchase a programmable device based on fusible links,all the fuses are initially intact.This means that,in its unprogrammed state,the output from our example function is always logic 0.(Any 0 presented to the input of an AND gate will cause its output to be 0,so if input a is 0,the output from the AND will be 0.Alternatively,if input a is 1,then the output from its NOT gatewhich we shall call !a will be 0,and once again the output from the AND will be 0.A similar situation occurs in the case of input b.)The point is that design engineers can selectively remove undesired fuses by applying pulses of relatively high voltage and current to the devices inputs.For example,consider what happens if we remove fuses F af and F bt (Figure 1-3 ).Removing these fuses disconnects the complementary version of input a and the true version of input b from the AND gate(the pull-up resistors asso-ciated with these signals cause their associated inputs to the AND to be pre-sented with logic 1 values).This leaves the device to perform its new function,which is y?a&!b.(The “&”character in this equation is used to represent the AND,while the “!”character is used to represent the NOT.)This process of removing fuses is typically called programming the device,but it may also be called blowing the fuses or burning the device.a FatLogic 1 y?a&!b&b FbfPull-up resistors NOT NOT AND FIGURE 1-3 Programmed fusible links.Key Concept Devices based on fusible-link technologies are one-time programmable ,or OTP,because once a fuse has been blown,it cant be replaced and theres no going back.CH001-H8974.indd 6CH001-H8974.indd 66/21/2008 4:56:13 PM6/21/2008 4:56:13 PM7Chapter|1 The F FPGA Programming Technologies Three different major technologies are in use today for programming FPGAs:antifuse,SRAM,and FLASH EPROM.Antifuse Technology As a diametric alternative to fusible-link technologies,we have their antifuse counterparts,in which each configurable path has an associated link called an antifuse.In its unprogrammed state,an antifuse has such a high resistance that it may be considered an open circuit(a break in the wire).How It Works Figure 1-4 shows how the device appears when first purchased.However,antifuses can be selectively “grown”(programmed)by applying pulses of relatively hig