Home > Store

Practical FPGA Programming in C

Register your product to gain access to bonus material or receive a coupon.

Practical FPGA Programming in C

Book

  • Sorry, this book is no longer in print.
Not for Sale

About

Features

FPGA brings high performance applications to market quickly -- this book covers the many emerging platforms in a proven, effective manner

° Covers current and emerging FPGA-based platforms

° Excellent coverage of software-oriented design techniques and tools applicable to these platforms

° These techniques simplify development and save money

Description

  • Copyright 2005
  • Edition: 1st
  • Book
  • ISBN-10: 0-13-154318-0
  • ISBN-13: 978-0-13-154318-8

C-based techniques for building high-performance, FPGA-accelerated software applications

Circuits, Devices, and Systems

C-based Techniques for Optimizing FPGA Performance, Design Flexibility, and Time to Market

Forward written by Clive "Max" Maxfield.


High-performance FPGA-accelerated software applications are a growing demand in fields ranging from communications and image processing to biomedical and scientific computing. This book introduces powerful, C-based parallel-programming techniques for creating these applications, verifying them, and moving them into FPGA hardware.

The authors bridge the chasm between "conventional" software development and the methods and philosophies of FPGA-based digital design. Software engineers will learn to look at FPGAs as "just another programmable computing resource," while achieving phenomenal performance because much of their code is running directly in hardware. Hardware engineers will master techniques that perfectly complement their existing HDL expertise, while allowing them to explore design alternatives and create prototypes far more rapidly. Both groups will learn how to leverage C to support efficient hardware/software co-design and improve compilation, debugging, and testing.

  • Understand when C makes sense in FPGA development and where it fits into your existing processes

  • Leverage C to implement software applications directly onto mixed hardware/software platforms

  • Execute and test the same C algorithms in desktop PC environments and in-system using embedded processors

  • Master new, C-based programming models and techniques optimized for highly parallel FPGA platforms

  • Supercharge performance by optimizing through automated compilation

  • Use multiple-process streaming programming models to deliver truly astonishing performance

  • Preview the future of FPGA computing

  • Study an extensive set of realistic C code examples

Sample Content

Online Sample Chapter

The FPGA as a Computing Platform

Downloadable Sample Chapter

Untitled Document Download the Sample Chapter related to this title.

Table of Contents

Foreword by Clive "Max" Maxfield.

    Why is this book of interest to the hardware folks?

    And what about the software guys and gals?

    So what's the catch?

Preface.

    C Language for FPGA-Based Hardware Design?

    Compelling Platforms for Software Acceleration.

    The Power to Experiment.

    How This Book Is Organized.

    Where This Book Came From.

Acknowledgments/

1. The FPGA as a Computing Platform.

    A Quick Introduction to FPGAs.

    FPGA-Based Programmable Hardware Platforms.

    Increasing Performance While Lowering Costs.

    The Role of Tools.

    The FPGA as an Embedded Software Platform.

    The Importance of a Programming Abstraction.

    When Is C Language Appropriate for FPGA Design?

    How to Use This Book.

2. A Brief History of Programmable Platforms.

    The Origins of Programmable Logic.

    Reprogrammability, HDLs, and the Rise of the FPGA.

    Systems on a Programmable Chip.

    FPGAs for Parallel Computing.

    Summary.

3. A Programming Model for FPGA-Based Applications.

    Parallel Processing Models.

    FPGAs as Parallel Computing Machines.

    Programming for Parallelism.

    Communicating Process Programming Models.

    The Impulse C Programming Model.

    Summary.

4. An Introduction to Impulse C.

Preface

Untitled Document

This is a book about software programming for FPGAs. To be more specific, this book is about using parallel programming techniques in combination with the C language to create FPGA-accelerated software applications.

We have written this book to help bridge the gap—the large chasm in fact—that exists between software development methods and philosophies, and the methods and philosophies of FPGA-based digital design. We understand that as a result we may be writing to two quite different audiences: software application developers and digital hardware designers.

For software engineers, our goal is to present FPGAs as software-programmable computing resources. We hope to show that these devices, when programmed using appropriate methods, are not so different from other non-traditional computing platforms, such as DSPs. We will show, through example, that software development methods and software languages can be used in a practical way to create FPGA-based, high performance computing applications, without a deep knowledge of hardware design.

For hardware designers our intent is similar, but with a caveat; we are not trying to replace your existing methods of design or suggest that the methods and tools described in this book represent a "next wave" of hardware engineering. After all, if you are an FPGA designer using VHDL or Verilog to create complex electronic systems then the title of this book, Practical FPGA Programming in C , may sound like an oxymoron. How can C, a software programming language, be a practical way to describe digital electronic hardware? The truth is, sometimes the explicit and precise descriptions offered by hardware description languages (HDLs) are essential to achieve designs goals. But, as we'll see, this explicit control over hardware is not always necessary. In the same way that one might first write software in C and then recode key portions in assembler, the hardware designer can benefit from tools that allow them to mix high-level and low-level descriptions as needed to meet design goals as quickly as possible. Even when the entire hardware design will be eventually be recoded with a lower-level HDL, high-level design languages allow hardware engineers to rapidly explore the design space and create working prototypes.

So for you, the experienced hardware engineer, we'll state right up front that we agree with you. We do not believe that C and C++ (as used by legions of programmers worldwide) are practical replacements for VHDL, Verilog or any other HDL. And we agree with you that C and C++ may not play a leading, or perhaps even significant, role as a design entry language for general-purpose ASIC and FPGA design, at least not as we know such design today. Nevertheless we believe there is a place for C-based design in a hardware design flow. Still not convinced? Stay with us for a moment and we'll explain.

C LANGUAGE FOR FPGA-BASED HARDWARE DESIGN?

Let's think a bit more about the role of C—or lack of a role, as the case may be—in hardware design. Why is standard C not appropriate as a replacement for existing hardware design languages? Because any good programming language provides one important thing: a useful abstraction of its target. VHDL and Verilog (or more precisely, the synthesizable subsets of these languages) succeed very well because they provide a rational, efficient abstraction of a certain class of hardware: level- and edge-sensitive registers with reset and clock logic, arbitrary logic gates, and somewhat larger clocked logic elements arranged in a highly parallel manner. All of today's FPGAs fit this pattern, and it is the pattern also found in the vast majority of today's ASIC designs, no matter how complex.

The standard C language does not provide that level of abstraction (which we call register transfer level, or RTL), so "C-based" languages for hardware could add RTL-like constructs in the form of syntax decorations, extra functions or keywords, compiler hints and more, to create some meaningful way of expressing parallelism and describing low-level hardware structures such as clocks and resets. But in this case we would just have another HDL with new syntax. On the other hand, without the benefit of RTL constructs such as these, the developers of C compilers for FPGAs and other non-traditional targets would face a nearly impossible problem: how to efficiently map algorithms and applications written for one class of processing target (the traditional microprocessor) to something entirely different (arbitrary logic gates and registers combined with somewhat higher-level logic structures). Nobody has yet figured out how to do that mapping from a pure software application with a reasonable level of efficiency, although we are getting better at it.

So why use C at all for FPGA design? There are significant advantages, including the potential for hardware-software codesign, for the creation of test benches written in C and (if the modified C language supports it) the ability to compile and debug an FPGA application using a standard C development environment. And if a mid-level approach to hardware abstraction is taken—one that does not require that the programmer understand all details of the hardware target, and yet is guided by the programming model toward more appropriate methods of coding—then we can strike a balance between software design productivity and hardware design results, as measured in system performance and size.

COMPELLING PLATFORMS FOR SOFTWARE ACCELERATION

Here's where software developers come in. On the applications side there is an increasing trend toward using FPGAs as hardware accelerators for high-performance computing. Applications that demand such performance exist in many domains, including communications, image processing, streaming media and other general-purpose signal processing. Many of these applications are in the embedded software space while others represent scientific, biomedical, financial, and other larger-scale computing solutions.

When acceleration is required, these applications typically begin their lives as software models, often in C language, and are then manually re-written and implemented in hardware using VHDL or Verilog. This manual conversion of software algorithms to hardware is a process that can be long and tedious in the extreme, and hence there is a strong demand for more rapid paths to working hardware. There is also a strong desire to avoid later redesigns of that hardware to reflect software algorithm updates. Automating the process of software to hardware conversion—at the very least for the purpose of creating hardware prototypes—is therefore highly compelling. This automation also brings hardware acceleration within reach of design teams and developers that do not have vast hardware design expertise, or where hardware design might be cost-prohibitive using traditional approaches. C to hardware compilation is an enabling technology that has the potential to open up hardware acceleration for a whole new class of applications and developers.

On the hardware side, there have been recent advances in FPGA-based programmable platforms that make FPGAs even more practical for use as application accelerators. In fact, FPGAs with embedded processor cores have now become cost-effective as replacements for entire embedded systems. The concept of building a complete "system on an FPGA" is finally a reality, thanks to the continued efforts of the major FPGA providers and third-party intellectual property (IP) suppliers. What is common about these new FPGA-based platforms is that they combine one or more general-purpose processor cores with a large amount of programmable logic and (just as significantly) they come equipped with substantial amounts of royalty-free, pre-tested components and an ever-growing collection of licensable third-party and open-source components that can be assembled on-chip in a matter of hours to create an amazingly diverse set of potential hardware/software processing platforms.

From a tools perspective what is interesting about these new devices—and the new computing platforms that they represent—is that they are flexible enough to support the use of methods and tools from the software development world, including traditional software debuggers. Using languages such as C and C++ in conjunction with software-to-hardware compilers makes it practical to implement software applications directly onto a mixed hardware/software platform.

It is here that FPGA designers who are questioning the use of software design languages and methods for FPGAs may be missing the point. C is not likely to replace HDLs such as VHDL and Verilog for traditional, general-purpose hardware design. C will, however, play a strong role in the kind of mixed hardware/software applications that are emerging today—applications in which the line between what is software and what is hardware is becoming increasingly blurred, and where the ability to rapidly prototype and experiment with implementation alternatives is critical.

In addition, because of the prevalence of embedded FPGA processors, C language is already being used for FPGAs by thousands of software engineers. The problem is that the vast majority if these software engineers are only able to program for the embedded microprocessor within the FPGA. Our goal in this book is to make C-language programming applicable to the entire FPGA, not just the embedded microprocessor within it.

THE POWER TO EXPERIMENT

Using C language programming as an aid to FPGA-based hardware design gives you the power to experiment. Experiment with alternate algorithmic approaches, with alternate hardware/software partitioning and with alternate target platforms. Using the same design entry language, you now have the ability to evaluate your applications and their constituent algorithms using different hardware and software targets.

In this book we will show you how you can, for example, set up a test in which the same C-language algorithm can, with only minor modifications, be executed in a desktop computing environment (under the control of a C debugger such as found in Visual Studio, gbd or Eclipse) for the purpose of functional simulation, be executed in-system on an embedded processor, and be compiled directly to an FPGA as dedicated hardware. Using this approach, fundamentally different computing alternatives can be tried and alternative hardware/software partitioning strategies can be evaluated. As we'll see, this power to quickly generate and experiment with hardware/software prototypes is the key advantage of using software-based methods and tools for FPGAs.

HOW THIS BOOK IS ORGANIZED

For software and hardware developers, we present important background information about FPGA devices, their history and the types of tools available for them, and we survey as well some of the available FPGA-based computing platforms.

After setting the stage, we then present a method of programming, using the C language, and a programming model that is appropriate for use with highly parallel programmable hardware platforms. This programming model is somewhat different from traditional, more procedural C-language programming but is easy for experienced software engineers to pick up and use.

From that foundation we then move into a series of examples, all written in C, that demonstrate how to take advantage of the massive levels of parallelism that are available in an FPGA-based platform. We will describe software coding techniques that allow better optimization of C-language statements by automated compiler tools. These techniques are not difficult to understand but can have dramatic impacts on the performance of an FPGA application.

Later chapters present examples of how a streaming programming model can be used to create even higher levels of performance. Using a multiple-process streaming programming model can result in truly astonishing levels of performance with relatively little effort, but to the traditional C programmer the methods used to achieve such levels of performance may be somewhat new and different.

WHERE THIS BOOK CAME FROM

This book, like many projects in the real world, began its life as a prototype, one that had been taken off the shelf, fiddled with and put back repeatedly over a number of years. In its initial conception—long before the grueling, months-long process to create the book you now hold in your hands—the book was to have a different title and quite a different emphasis, one on reconfigurable hardware platforms, both FPGA-based and non FPGA-based. That book—the one that didn't get written but that survives in bits and pieces in certain chapters if this book—was conceived as a follow-on to an earlier book on programmable logic devices authored by David Pellerin and Michael Holley and titled Practical Design Using Programmable Logic (Prentice Hall, 1991).

When the idea for such a book was presented to Bernard Goodwin at Prentice Hall, his initial response was "but of course!" (It is the nature of acquisitions editors, we suppose, to be enthusiastic about every project prior to actually seeing the awful sludge of the first sample chapters.) As we worked on refining the proposal, Bernard suggested that we increase the emphasis on one particular area, an area of which we—due to our current roles in a technology startup—might have a greater than usual understanding. Hence the emphasis on C programming for FPGAs, and on the design and optimization of parallel applications for FPGA targets. Bernard was, of course, eying the bottom line and steering us in a direction that would maximize sales (C is popular and FPGAs are popular, ergo we will attract more readers by having both terms in the title). What Bernard did not know—what none of us know, really—is how widely C programming for FPGAs can and will be accepted. Time will tell, of course. With this book we hope to convince you that such an approach is indeed a practical one.

David Pellerin
Kirkland, Washington

Scott Thibault
Colchester, Vermont

Foreword

Untitled Document

Download the Foreword file related to this title.

Index

Untitled Document Download the Index file related to this title.

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020