Issue 3 March 2006 magazine mbedded EEMBEDDED SOLUTIONS FOR PROGRAMMABLE LOGIC DESIGNS

Endless Possibilities

INSIDE New EDK 8.1 Simplifies Embedded Design

Change Is Good

ESL Tools for FPGAs

Algorithmic Acceleration Through Automated Generation of FPGA Coprocessors

Bringing Floating-Point Math to the Masses

R Support Across The Board.™

Accelerate Your Learning Curve Spring 2006 SpeedWay Series on New Application Solutions • Xilinx MicroBlaze™ Development Workshop AvnetElectronicsMarketingoffersaseriesoftechnical,hands-on • Xilinx PowerPC® SpeedWay Design Workshops™ that will dramatically accelerate Development Workshop your learning curve on new application solutions, products and • Xilinx Embedded technologies like the Philips-Xilinx PCI Express two-chip solution. Development Workshop OurFAEpresentersusedetailedlaboratoryexercisesandAvnet • Introduction to FPGA Design developed design kits to reinforce the key topics presented during Workshop the workshops, ensuring that when you leave the class you will be • Creating a Low-Cost able to apply newly learned concepts to your current design. PCI Express Design Workshop • Every workshop features an Avnet developed design kit • Embedded Networking with Xilinx FPGAs Workshop • Workshops are systems and solutions focused

• Xilinx DSP Development • Design alternatives and trade-offs for targeted applications Workshop are discussed • Xilinx DSP for Video Workshop For more information about upcoming Xilinx SpeedWay workshops, visit: • Improving Design Performance Workshop www.em.avnet.com/xilinxspeedway

Enabling success from the center of technology™

1 800 332 8638 www.em.avnet.com

© Avnet, Inc. 2006. All rights reserved. AVNET is a registered trademark of Avnet, Inc. magazine Embedded Endless Possibilities

PUBLISHER Forrest Couch [email protected] 408-879-5270 Welcome to our third edition of Xilinx Embedded Magazine. As we prepared this issue, the theme for this year’s Embedded Systems Conference – “Five Days, One Location, Endless Possibilities” – EDITOR Charmaine Cooper Hussain Wresonated with the array of potential articles. Simply stated, we seemed to have endless possibilities for our embedded solutions to choose from and to share with you. ART DIRECTOR Scott Blair To capitalize on this theme, our ease-of-use initiative continues with Xilinx® Platform Studio and ADVERTISING SALES Dan Teie the Embedded Development Kit (EDK), as we recently released our latest version, 8.1i. This 1-800-493-5551 comes on the heels of EDN’s recognition of our 32-bit MicroBlaze™ soft- core as one of the “Hot 100 Products of 2005.” Taken together, the MicroBlaze core, the industry-standard www.xilinx.com/xcell/embedded PowerPC™ core embedded in our Virtex™ family of FPGAs, and a growing list of IP and supported industry standards offer more options than ever to create, debug, and launch an for production. The latest version of our kit serves one of the greatest appeals that the embed- ded solution holds for our FPGA customers – to create a “just-what-I-needed” processor subsystem that “just works.” In so doing, our customers can concentrate on the added value that differentiates their products in their marketplace. Here again, “endless possibilities” resonates with unlimited design flexibility. In this issue of Embedded Magazine we offer a collection of diverse articles unlocking the endless possibilities with Xilinx platforms. We welcome industry icon Jim Turley and his clever insight regarding shifts in the embedded industry with his article “Change Is Good.” In addition, our partners Echolab, Impulse, PetaLogix, Poseidon, Teja, Avnet, and Nu Horizons highlight their latest innovations for our embedded platforms. Our own experts provide tutorials on the latest release of EDK 8.1, along with a background look at the newly launched Xilinx ESL Initiative. Join us as we plumb the depths of these exciting new embedded solutions. I’m sure you’ll find our third edition of Embedded Magazine informative and inspiring as we endeavor to help you unlock the power of Xilinx programmability. The advantages are enormous, the possibilities … endless! Xilinx, Inc. 2100 Logic Drive San Jose, CA 95124-3400 Phone: 408-559-7778 FAX: 408-879-4780

© 2006 Xilinx, Inc. All rights reserved. XILINX, the Xilinx Logo, and other designated brands included herein are trademarks of Xilinx, Inc. PowerPC is a Mark Aaldering trademark of IBM, Inc. All other trademarks are the property of their respective owners. Vice President

The articles, information, and other materials included in Embedded Processing this issue are provided solely for the convenience of our & IP Divisions readers. Xilinx makes no warranties, express, implied, statutory, or otherwise, and accepts no liability with respect to any such articles, information, or other materials or their use, and any use thereof is solely at the risk of the user. Any person or entity using such information in any way releases and waives any claim it might have against Xilinx for any loss, damage, or expense caused thereby. s of others. ©2006 IBM Corporation. All rights reserved. rights All ©2006 others. s of IBM Corporation. product and service names and may be service mark trademarks or product

oration in the United States and/or other countries. Other company, Other company, other countries. States and/or the United in oration YOU CAN DELIVER INNOVATION M, the IBM logo and the On Demand Business logo are registered trademarks or trademarks of International Business Machines Corp Machines Business International trademarks of trademarks or registered are logo the On Demand Business and logo the IBM M, IB

Time to market, developer and programmer productivity, choice in fabrication facilities and EDA retooling costs for smaller and smaller geometries are all putting tremendous strain on system development groups around the globe. Enter IBM. Whether your design priorities are low power or high performance, or both, IBM’s Power Architecture™ microprocessors and cores can help you accelerate innovation in your designs. Find out what the world's fastest , Internet routers and switches, the Mars Rover, and the next generation game consoles all have in common. For more information visit ibm.com/power EMBEDDED MAGAZINE ISSUE 3, MARCH 2006

CONTENTS

Welcome ...... 3

Contents ...... 5 6

ARTICLES

New EDK 8.1 Simplifies Embedded Design ...... 6

Change Is Good ...... 10

Implementing Floating-Point DSP ...... 12

ESL Tools for FPGAs...... 15

10 Algorithmic Acceleration Through Automated Generation of FPGA Coprocessors ...... 18

Generating Efficient Board Support Packages...... 24

Bringing Floating-Point Math to the Masses ...... 30

Packet Subsystem on a Chip...... 34

Accelerating FFTs in Hardware Using a MicroBlaze Processor...... 38

Eliminating Data Corruption in Embedded Systems...... 42

15 Boost Your Processor-Based Performance with ESL Tools...... 46

CUSTOMER SUCCESS

Unveiling Nova ...... 51

WEBCASTS 18 Implementing a Lightweight Web Server Using PowerPC and Tri-Mode Ethernet MAC in Virtex-4 FX FPGAs ...... 57

BOARDS

Development Kits Accelerate Embedded Design ...... 61

PRODUCTS 30 30 MicroBlaze – The Low-Cost and Flexible Processing Solution ...... 64 NewNew EDKEDK 8.18.1 SimplifiesSimplifies EmbeddedEmbedded DesignDesign PlatformPlatform StudioStudio enhancementsenhancements streamlinestreamline processorprocessor systemsystem development.development.

by Jay Gould Product Marketing Manager, Xilinx Embedded Solutions Marketing Xilinx, Inc. [email protected]

After achieving an industry milestone, what’s next? In 2005, the Xilinx® Platform Studio tool suite (XPS) included in the Embedded Development Kit (EDK) won the IEC’s DesignVision Award for innova- tion in embedded design. The revolution- ary approach of design wizards brought abstraction and automation to an other- wise manual and error-prone development process for embedded system creation. The year 2006 brings a new version 8.1 update to the Platform Studio tool suite, with an emphasis on simplifying the devel- opment process and providing a more vis- ible environment. The result is a shortened learning curve for new users and an even more complete and easier-to-use environ- ment for existing designers.

6 Embedded magazine March 2006 Xilinx has updated the main user interface of Platform Studio to provide an intuitive feel for both hardware and software engineers ...

Just getting a complex design started A majority of the embedded design The “Project” tab contains a variety of can take a significant amount of time out cycle, before full system verification, is helpful information about the design, of a critical schedule, so Xilinx started with spent iterating on the core design, incre- including specific Xilinx device selection a premise that the first steps to a working mentally introducing new features, adding and settings (for example, a specific core design should be automated. The individual capabilities, and repeatedly Virtex™-4 or Virtex-II Pro device with Xilinx Base System Builder design wizard debugging after each step. Because this is one or two PowerPC™ processor cores) within the Platform Studio tool suite pro- excessively tedious and time consuming, and project file locations (hardware and vides a step-by-step interface to walk you this stage should be as easy and streamlined software project descriptions as well as log through the critical first stages of a design. as possible. Version 8.1 has a focus on mak- and report files for steps like synthesis), as Design wizards are a great innovation ing common (and repetitive) tasks simple well as simulation setup details. because they can provide a quick path to a and intuitive, benefiting both new and You can view software applications working core design even if you have min- existing users. under the “Applications” tab, which pro- imal expertise. The “smarter” the install vides access to all of the source and head- wizard is, the fewer issues occur, and the All Users Benefit from V8.1 er files that make up the embedded system less experience you need to have. Xilinx has updated the main user inter- design. This view also provides views of the Pre-configured hardware/software devel- face of Platform Studio to provide an compiler options and even the block RAM opment kits are also extremely valuable for intuitive feel for both hardware and soft- initialization process. getting a design “off the napkin” and into a ware engineers, making multiple views The “IP Catalog” tab contains in-depth quick but stable state. Xilinx hardware/soft- and customization easy for all. The inte- information about the IP cores created, ware development kits provide working grated development environment (IDE) bought, or imported for the design. Xilinx hardware boards, hardware-aware tools, and in Figure 1 displays a wide array of infor- provides several scores of processing IP pre-verified reference designs. The benefit mation, but also allows you to filter views cores in the Embedded Development Kit here is that you can power up hardware, and customize the toolbars. The left-hand software bundle as well as some high-value download a working design to a board, and pane provides an industry-standard “tab” cores for time-limited evaluations. You can start investigating a “working” core system method of displaying or hiding informa- research Xilinx processor IP at www. in a very short period of time, skipping past tion panels on the design “Project,” xilinx.com/ise/embedded/edk_ip.htm. the delays and complexities of debugging “Applications,” or “IP Catalog.” Just tog- The middle panel is the “Connectivity” new hardware, new firmware, and new soft- gle on the tab of choice to display the view, and the adjacent panel to the right of ware all at the same time. contents of that pane. that is the associated “System Assembly” view. The connectivity view gives a clear visual of the design busing structure and also provides a dynamic tool for creating new or editing existing connections. The color-coded view quickly makes it clear – even to novice users – the specifics of the bus type and how it might relate to IP. For example, in this view, peripherals connect- ed to the PLB (processor local bus) are pre- sented in orange; OPB (on-chip peripheral bus) connections are green; and point-to- point connections with a processor core, in this case the PowerPC 405, are in purple. The panel “filter” buttons allow you to cus- tomize or simplify the connection views so that you can focus on specific bus elements without the distraction of other elements. Platform Studio reduces the errors that a designer might make by maintaining cor- Figure 1 – New 8.1 Platform Studio GUI rect connections by construction – that is,

March 2006 Embedded magazine 7 XPS will only display connection migration ought to be as painless options for compatible bus types. as possible. Nobody wants to re- This saves debug headaches with invest design, debugging, and test tools that allow incompatible time to move an older design to a connections. newer set of tools or IP. However, The system assembly view (see there are often great advantages in Figure 2) more clearly displays an new IP/tools that make it advan- example of dynamic system con- tageous to upgrade. Platform struction using a “drag-and-drop Studio 8.1 has a migration capa- connectivity instantiation.” In bility (Figure 4) that steps you the figure, the gray highlighted Figure 2 – System assembly view through a wizard to automate and “opb_uartlite” IP core is selected accelerate the process. on the left panel from the IP XPS 8.1 can browse existing Catalog and has been dragged design projects, flag out-of-date and dropped into the right projects and IP cores, and then assembly window, creating a new walk you though the process of OPB bus connection option confirming automated updates automatically; just mouse-click to to the new IP and project files. connect. The views on the right The migration wizard updates also provide helpful information the project description files and such as IP types for perusing and summarizes the migration IP version numbers for project changes in document form. version control. Now, at a glance, Minimizing labor-intensive steps you can distinguish the system means that you can take advan- structure without reading reams tage of new advancements with- of documentation. out as much manual re-entering However, if design documen- or porting of designs. tation is what your project and Savvy software developers team require, Platform Studio 8.1 working on more sophisticated has the powerful capability to Figure 3 – XPS IP catalog code applications will be happy generate full design-reference with the enhancements to the material, including a full block diagram as a brief language description if the names XPS Software Development Kit IDE, view of the system elements and their inter- are too brief for context. This view allows based on Eclipse. The XPS-SDK has an connections. This automatic generation of you to manage your old and current IP as enhanced toolbar that more logically the docs saves valuable time (instead of cre- well as future IP upgrades (more powerful groups similar functions and buttons ating the materials manually) and reduces versions of cores with more features but while still allowing user customization. errors by creating the materials directly often faster and smaller in size). from the design. This method keeps the Additional information is available as docs and the design accurately in sync as well, such as which processor cores the IP well as displaying a clear high-level view of supports. Because Xilinx offers flexible sup- the entire project. port for both high-performance PowerPC hard and flexible MicroBlaze™ soft-proces- New Enhancements Help Existing Users sor cores, it is useful to know which IP cores Current Platform Studio users will be are dedicated to one processor, the other, or pleased to see advances in the support of both. In fact, a right mouse-click on the IP sophisticated software development, IP from the catalog yields quick access to the support, and the migration or upgrades of IP change history as well as complete PDF older designs. Figure 3 is an example of datasheets on the specifics. Software drivers what the IP Catalog tab might look like for for the peripherals have a similar platform a design, including all IP cores categorical- settings view for clarity, including version ly grouped on the left-hand side by logical control and embedded OS support. names. The specific IP cores will display a When a new version of tools and IP version number for design control as well becomes available, the upward design Figure 4 – XPS design migration

8 Embedded magazine March 2006 Version 8.1 introduces a more powerful C/C++ editor supporting code folding of functions, methods, classes, structures, and What’s New macros, as well as new compiler advance- ments. This new support provides the abil- ity to specify linker scripts and customized compiler options for PowerPC and MicroBlaze processor cores, plus a C++ class creation wizard. Combine this power- ful software environment with the innova- tive performance profiling views and unique XPS capability of integrated hard- ware/software debuggers, and 8.1 users will be creating better, more powerful embed- ded systems in less time than ever before.

Conclusion The award-winning Platform Studio has already streamlined embedded system design. Automated design wizards and pre- configured hardware/software development kits help kick-start designs while reducing errors and tail-chasing. Now that we have an industry-proven success in ramping-up the “getting started” process, it is time to improve the time-con- suming and cyclical nature at the heart of the development process. Create – Debug To complement our flagship publication Xcell Journal, – Edit – Repeat. Have you ever used a com- we’ve recently launched three new technology magazines: puter-aided tool where most of the steps were intuitive? Where you could guess Embedded Magazine, focusing on the use of embedded ® what a button did before you read the processors in Xilinx programmable logic devices. manual or saw a screen in which the con- DSP Magazine, focusing on the high-performance tents were all self-evident? capabilities of our FPGA-based reconfigurable DSPs. EDK/XPS version 8.1 focuses on ease-of- use improvements across the board, includ- I/O Magazine, focusing on the wide range of serial and ing enhancements to the main user parallel connectivity options available in Xilinx devices. interface, the software development envi- In addition to these new magazines, we’ve created ronment (including editing and compiling), a family of Solution Guides, designed to provide useful the upgrading of IP, the migrating of old information on a wide range of hot topics such as projects, documenting designs, viewing and Broadcast Engineering, Power Management, editing bus-based systems, and much more. and Signal Integrity. By making common tasks simple and Others are planned throughout the year. intuitive, we can make designing a little bit easier for experienced embedded engineers as well as those brand-new to designing with processors in programmable FPGA platforms. Use the extra time saved during the development process to innovate your own embedded products. See all of the new publications on our website: For more information about EDK ver- sion 8.1 and all of our embedded process- www.xilinx.com/xcell ing solutions, visit www.xilinx.com/edk.

March 2006 Embedded magazine 9 Change Is Good Hardware designers and software designers can’t often agree, but there is a middle ground that both might enjoy.

by Jim Turley Editor in Chief, Embedded Systems Design CMP Media LLC [email protected]

If you shout “microprocessor” in a crowded theatre, most people will think “Pentium.” ’s famous little chip has captured the public imagination to the point where many people think 90% of all the chips made come streaming out of Intel’s factories. Nothing could be further from the truth. The fact is, Pentium accounts for less than 2% of all of the microprocessors made and sold throughout the world. The lions’ share – that other 98% – are proces- sors embedded into everyday appliances, automobiles, cell phones, washers, dryers, DVD players, video games, and a million other “invisible computers” all around us. PCs are a statistically insignificant part of the larger world – and Pentium sales are a rounding error. Take heart, embedded developers, for though you may toil in obscurity, your deeds are great, your creations mighty, and your number legion. With few exceptions, most engineers are embedded systems devel- opers. We’re the rule, not the exception.

10 Embedded magazine March 2006 Processors As Simulators The Malleable Engineer More to the point, it’s no longer an What is exceptional is the number of differ- So now we’re faced with the proverbial (and either/or decision. The two disciplines are ent ways we approach a problem. All PCs overused) paradigm shift. We can toss out not mutually exclusive; engineering is not look pretty much the same, but there’s no everything we know about programming, a zero-sum game. We don’t have to come such thing as a typical embedded system. operating systems, software, real-time code, down firmly on the side of hardware or They’re all different. We don’t standardize compilers, boot loaders, and bit-twiddling software; we can straddle the middle on one operating system, one processor (or and go straight to hard-wired hardware ground as it suits us. When your hardware even processor family), or one power sup- implementations. is programmable, you can choose to “pro- ply, package, or peripheral mix. Among 32- Or not. gram” it or “design” it using traditional cir- bit processors alone there are more than 100 Maybe we like programming. There’s cuitry methods. Take your pick. Let different chips available from more than a something about software design that whimsy or convention be your guide. dozen different suppliers, each one with appeals to the inner artist in us. It’s a whole Engineers, like most craftsmen, place happy customers designing systems around different way of thinking compared to great stock in their tools. A recent survey them. Hardly a homogenous group, are we? hardware design, at least for a lot of engi- revealed that most developers choose There’s even a school of thought that neers. Software is like poetry; hardware is their tools (compiler, logic analyzer, microprocessors themselves are a IDE) first and the “platform” they work mistake – a technical dead-end. on second. For example, they let their The theory goes that microproces- choice of compiler determine their sors merely simulate physical func- choice of processor, not vice versa. The tions (addition, subtraction, FFT hardware – a microprocessor, generally – analysis), rather than performing is treated as a canvas or work piece on the function directly. Decoding which they ply their trade. This comes as and executing instructions, han- a bit of a blow to some of the more tra- dling interrupts, and calculating ditional microprocessor makers, who’d branches is all just overhead. A always assumed that the world revolved close look at any modern processor around their instruction set. chip would seem to bear this theo- The takeaway from this part of the ry out: only about 15% of the survey was that keeping developers in chip’s transistors do any actual their comfort zone is paramount. work. The rest are dedicated to Engineers don’t like to modify their skills cracking opcodes, handling flag or habits to accommodate someone else’s bits, routing buses, managing hardware. Instead, the hardware should caches, and other effluvia necessary adapt to them. In the best case, the hard- to make the hardware do what the ware should even adapt to a code jockey software tells it to do. one day and a circuit snob the next. The only reason processors Different tools for different approaches, were ever invented in the first but with one goal in mind: to create a place (so the thinking goes) is great design within time and budget (and because they were more malleable power, and heat, and pinout, and cost, than “real” hardware. You could change like architecture. There’s plenty of bad and performance) constraints. your code over time – but you couldn’t poetry because anyone can do it, but you There hasn’t been anything to accom- change your hardware. don’t see people tossing up buildings just to modate this flexibility until pretty recently. But that isn’t true any more. see if they stand. Programming requires Hardware was hardware; code was code. Following this line of reasoning, the much less discipline and training than But with “soft processors” in FPGAs living right approach is to do away with proces- hardware engineering. That’s why there are alongside seas of gates and coprocessors, sors and software altogether and imple- so many programmers in the world. we’ve got the ultimate canvas for creative ment your functions directly in hardware. This is a good thing. Really. The easier developers. Whether it’s VHDL or C++, Forget that 85% of processor overhead it is to enter the engineering profession, the these new chips can be customized in logic and get right down to the nuts and more (and better) engineers we’re likely to whatever way suits you. They’re as flexible bolts. Make every one of those little tran- have. And since hardware- and software- as any software program, and as fast and sistors work for a living. And hey, if you design mindsets are different, we get to efficient as “real” hardware implementa- change your mind, you can change your draw from a bigger cross section of the tions. We may finally have achieved the hardware – if it’s programmable. populace. Variety is good. best of both worlds.

March 2006 Embedded magazine 11 Implementing Floating-Point DSP Using PicoBlaze processors for high-performance, power-efficient, floating-point DSP.

by Ji˘ri Kadlec high-performance implementations in atively simple sequence of pipelined oper- DSP Researcher UTIA Prague, Czech Republic Spartan™ devices. ations at the maximum clock speed and [email protected] returning the result(s) back to another and Reuse block RAM. You can effectively map these Stephen P.G. Chappell High-performance implementations of primitives to hardware, including the Director, Applications Engineering floating-point DSP algorithms in FPGAs complete autonomous data-flow control Celoxica Ltd., Abington, UK require single-cycle parallel memory in hardware. You can also code the related [email protected] accesses and effective use of pipelined dedicated generators of address counters arithmetic operators. Many common DSP and control signals in Handel-C, using For developers using FPGAs for the vector and matrix operations can be split several synchronized do-while loops. implementation of floating-point DSP into batch calculations fulfilling these Simulink is effective for fast derivation of functions, one key challenge is how to requirements. Our architectures comprise bit-exact models of the batch calculations decompose the computation algorithm Xilinx PicoBlaze worker processors, each in DSP hardware accelerators. into sequences of parallel hardware with a dedicated DSP hardware accelerator processes while efficiently managing data (Figure 1). Each worker can do preparato- Floating-Point Processor on a Single FPGA flow through the parallel pipelines of ry tasks for the next batch in parallel with Let’s consider an architecture for the evalu- these processes. its hardware accelerator. Once the DSP ation of a 1024 x 1024 vector product in In this article, we’ll discuss our experi- hardware accelerator finishes the computa- 18m12 floating point. (In the format AmB, ences exploring architectures with Xilinx® tion, it issues an interrupt to the worker. A is for the word length and B is for the PicoBlaze™ controllers, and present a The worker’s job is to combine the acceler- number of bits in the mantissa, including design strategy employing the ESL tech- ated parts of the computation into a com- the leading hidden bit representing 1.0.) niques of model-based and C-based plete DSP algorithm. We implemented this architecture design to demonstrate how you can rapid- It is ideal if you limit implementations using five PicoBlaze processors on a single ly integrate highly parameterizable DSP to the batch operations of each worker FPGA: one master and four simplified hardware primitives into power-efficient starting in a block RAM, performing a rel- workers (Figure 1). The master is connect-

12 Embedded magazine March 2006 ed to the workers by I/O-mapped dual- RAMs organized in 1,024 18-bit words. using one 18m12 multiplier (FP MUL) ported block RAMs organized in 2,048 8- Two block RAMs hold source vectors and and one 18m12 adder (FP ADD). bit words. The master maintains the one holds results data. In this case, the real-time base with 1 µs resolution and pro- workers perform one quarter of the com- Scalable, Short-Latency vides RS232 user-interface functions. Each putation each, namely a 256 x 256 vector Floating-Point Modules worker serves as a controller to a dedicated product. The DSP hardware accelerators We used a newly released version of a scala- floating-point DSP hardware accelerator are implemented in hardware, from block ble, short-latency pipelined floating-point connected through three dual-ported block RAM data source to block RAM data sink, library from Celoxica to build our DSP hard- ware accelerators. Table 1 considers some of PicoBlaze Master the parameterizations of this FPGA vendor- independent library to the formats 18m12, 32m24, and 64m53. The library includes IEEE754 rounding, including the round to even. It provides bit-exact results to the Xilinx LogiCORE™ floating-point opera- tors (v2.0), with latency set to approximately PicoBlaze Workers one half. The resulting maximum system clock is compatible with PicoBlaze and MicroBlaze™ embedded processors.

Simulink and the DK Design Suite Our design flow is based on the bit-exact modeling of Handel-C floating-point units in a Simulink framework, where the Handel-C is developed in the DK Design DSP Hardware Accelerators Suite combined simulation and synthesis environment. This enabled us to decompose Dual-Port Block RAMs a floating-point algorithm into a sequence of simple operations with rapid development and testing of different combinations. Figure 1 – PicoBlaze-based architecture for floating-point DSP. The DSP hardware accelerators are modeled and implemented using Celoxica DK. Step 1: Model in Simulink First, we built a model of the DSP hardware Part: 18m12: 32m24: 64m53: accelerator in Simulink (Figure 2). The data xc2v1000-4 125 MHz 110 MHz 100 MHz sources and sinks in this model will be the xc3s1500L-4 84 MHz 84 MHz 72 MHz block RAMs shared with the PicoBlaze Pipelined: FF LUT Pipe FF LUT Pipe FF LUT Pipe worker in the final implementation. Because the FPGA floating-point oper- ADD 834 793 5 1158 1290 5 1686 2007 5 ations are written in cycle-accurate and bit-exact Handel-C, we benefited from a MULT 639 488 3 967 626 4 2029 1256 5 single source for both implementation and simulation. For modeling, we export- F2FIXPT 581 637 4 649 744 4 808 1053 4 ed the Handel-C functions to S-functions FIXPT2F 695 709 6 792 787 6 1008 946 6 using Celoxica’s DK Design Suite. We then incorporated these into a bit-exact Sequential: Cycles Cycles Cycles Simulink model. In this fast functional simulation, we use delay blocks in DIV 739 605 17 987 772 29 2119 1143 58 Simulink to model pipeline stages (see the SQRT 766 604 16 1053 802 28 1729 1303 57 5-stage pipeline of the FP ADD operator and related registers in Figure 2). We used separate Simulink subsystems to model Table 1 – Used flip-flops, LUTs, pipeline/latency, and maximum clock for Celoxica floating-point modules in system implementations in the Celoxica RC200E (Virtex-II FPGA) and RC10 the bit-exact operation of the final (Spartan-3L FPGA) boards. Modules are pipelined, with the exception of DIV and SQRT. “pipeline flushing,” or “wind-up opera-

March 2006 Embedded magazine 13 tion.” In this case, six partial gramming of individual PicoBlaze sums have to be added by a workers and their interactions. single reused FP ADD mod- ule (Figure 3). The corre- Performance Results sponding hardware computes Test results using the Celoxica the final sum of the partial RC200E (Virtex™-II FPGA) sums by reconnecting the and RC10 (Spartan™-3L FPGA) pipelined floating-point boards are shown in Table 2. It is adder to different contexts interesting to compare the power for several final clock cycles. consumption of the PicoBlaze Figure 2 – Simulink test bench for floating-point 18m12 vector product based on Handel-C bit-exact models network architecture on Virtex-II Step 2: Cycle-Accurate devices (RC200E) with the iden- Verification tical design on the low-power 90 Our next stage was to create nm Spartan-3L device (RC10). test vectors using Simulink The latter part gives a highly and feed these into a bit- favorable floating-point perform- exact and cycle-accurate sim- ance-to-power ratio. ulation of the DSP hardware accelerator in the DK Conclusion Design Suite’s debugger. With minimal overhead, PicoBlaze Once we confirmed identical workers add flexibility to floating- results for both the DK and point DSP hardware accelerators Simulink models, we com- by their ability to call and reuse piled the Handel-C code to software functions (even if in an EDIF netlist. assembly language only). Our pro- posed architecture enables more Step 3: Hardware Test flexible and generic floating-point We took advantage of a lay- algorithms without the additional ered design approach by increase of hardware complexity using a single communica- associated with hardware-only tion API for data I/O func- implementations due to irregulari- tions that applies to both Figure 3 – Simulink subsystem based on Handel-C ties and complex multiplexing of bit-exact models, including delay model of calculation wind-up simulation and implementa- at the end of the vector product batch pipelined structures. PicoBlaze tion. This allowed us to veri- cores are compact, simple, and fy the DSP hardware accelerator design on therefore manageable, without designers real FPGA hardware by “linking” with an Part: MHz MFLOPs mW needing to combine too many new skills. appropriate board support library for xc2v1000-4 100 700 1360 The use of floating-point designs devel- implementation. We can optionally insert oped using the DK Design Suite in com- this hardware test back into the Simulink xc3s1500L-4 84 588 263 bination with a Simulink framework model for hardware-in-the-loop simula- provides an effective design path that is tions. The test on FPGA hardware provides Table 2 – Results for 1024 x 1024 vector relatively easy to debug and scalable to product in 18m12 floating point on the reliable area and clock figures. Celoxica RC200E (Virtex-II FPGA) and RC10 more complex designs. (Spartan-3L FPGA) boards Spartan-3L technology considerably Step 4: Create Reusable reduces power consumption compared to Module and Connect to Worker appropriate enable and controller inter- Virtex-II devices. Considering the bene- Finally, we treated the verified block rupt signals. At this stage we tested the fits in terms of performance/power/price, RAM-to-block RAM DSP hardware accel- function of the DSP hardware accelerator Spartan-3L FPGA implementations of erator as a new module and integrated it under worker control using memory dump floating-point DSP pipelines using net- into our main design by compiling the user support from the master. works of PicoBlaze processors are an Handel-C to EDIF or RTL using the DK interesting option. Design Suite. This reusable module is con- Step 5: Develop Complete DSP Design You can find complete information on nected to the PicoBlaze network by wiring We next assembled the complete design of the design and technology discussed in the ports of the block RAMs and the workers and master, moving to assembly pro- this article at www.celoxica.com/xilinx.

14 Embedded magazine March 2006 ESLESL ToolsTools forfor FPGAsFPGAs Empowering software developers to design with programmable hardware.

by Milan Saini Consider a couple of scenarios in which ESL promotes the concept of “explo- Technical Marketing Manager ESL and FPGAs make a great combination: rative design and optimization.” Using ESL Xilinx, Inc. methodologies in combination with pro- 1. Together, ESL tools and programma- [email protected] grammable hardware, it becomes possible ble hardware enable a desktop-based to try a much larger number of possible hardware development environment A fundamental change is taking place in the application implementations, as well as rap- that fits into a software developer’s world of logic design. A new generation of idly experiment with dramatically different workflow model. Tools can provide design tools is empowering software develop- software/hardware partitioning strategies. optimized support for specific FPGA- ers to take their algorithmic expressions This ability to experiment – to try new based reference boards, which soft- straight into hardware without having to approaches and quickly analyze perform- ware developers can use to start a learn traditional hardware design techniques. ance and size trade-offs – makes it possible project evaluation or a prototype. The These tools and associated design for ESL/FPGA users to achieve higher over- availability of these boards and the methodologies are classified collectively as all performance in less time than it would corresponding reference applications electronic system level (ESL) design, broadly take using traditional RTL methods. written in higher level languages referring to system design and verification Additionally, by working at a more makes creating customized, hardware- methodologies that begin at a higher level of abstract level, you can express your intent accelerated systems much faster and abstraction than the current mainstream reg- using fewer keystrokes and writing fewer easier. In fact, software programmers ister transfer level (RTL). ESL design lan- lines of code. This typically means a much are now able to use FPGA-based ref- guages are closer in syntax and semantics to faster time to design completion, and less erence boards and tools in much the the popular ANSI C than to hardware lan- chance of making errors that require same way as microprocessor reference guages like and VHDL. tedious, low-level debugging. boards and tools. How is ESL Relevant to FPGAs? 2. With high-performance embedded ESL’s Target Audience ESL tools have been around for a while, processors now very common in The main benefits of ESL flows for and many perceive that these tools are pre- FPGAs, software and hardware prospective FPGA users are their produc- dominantly focused on ASIC design flows. design components can fit into a tivity and ease-of-use. By abstracting the The reality, however, is that an increasing single device. Starting from a soft- implementation details involved in gener- number of ESL tool providers are focusing ware description of a system, you ating a hardware circuit, the tools are mar- on programmable logic; currently, several can implement individual design keting their appeal to a software-centric tools in the market support a system design blocks in hardware or software user base (Figure 1). Working at a higher flow specifically optimized for Xilinx® depending on the applications’ per- level of abstraction allows designers with FPGAs. ESL flows are a natural evolution formance requirements. ESL tools skills in traditional software programming for FPGA design tools, allowing the flexi- add value by enabling intelligent languages like C to more quickly explore bility of programmable hardware to be partitioning and automated export their ideas in hardware. In most instances, more easily accessed by a wider and more of software functions into equivalent you can implement an entire design in software-centric user base. hardware functions. hardware without the assistance of an

March 2006 Embedded magazine 15 experienced hardware designer. Software- ing a fast way to prototype new, com- 2. System modeling. System simulations centric application and algorithm develop- putation-oriented hardware blocks using traditional RTL models can be ers who have successfully applied the can also use module generation. very slow for large designs, or when benefits of this methodology to FPGAs processors are part of the complete include systems engineers, scientists, mathe- • Processor acceleration. In this design. A popular emerging ESL maticians, and embedded and firmware mode of use, the HLL compiler approach uses high-speed transaction- developers. allows time-critical or bottle- level models, typically written The profile of applications suitable for neck functions running in C++, to significantly ESL methodologies includes computational- on a processor to be speed up system sim- ly intensive algorithms with extensive inner- accelerated by HLL Synthesis ulations. ESL tools loop constructs. These applications can enabling the cre- Empowering The Software Developer provide you with realize tremendous acceleration through the ation of a cus- a virtual plat- concurrent parallel execution possible in tom accelerator FPGA form-based hardware. ESL tools have helped with suc- block in the Capture Design verification in "HLL" CPU cessful project deployments in application programmable environment External CPU domains such as audio/video/image process- fabric of the where you can ing, encryption, signal and packet process- FPGA. In addi- • No need to learn HDL analyze and tion to creating • No prior FPGA experience needed ing, gene sequencing, , • Create hardware modules from software code tune the func- geophysics, and astrophysics. the accelerator, the • Accelerate "slow" CPU code in hardware tional and per- tools can also auto- formance attributes of ESL Design Flows matically infer memories your design. This means ESL tools that are relevant to FPGAs cover and generate the required much earlier access to a vir- two main design flows: hardware-software interface Figure 1 – Most of the tual representation of the circuitry, as well as the ESL tools for FPGAs are system, enabling greater 1. High-level language (HLL) synthesis. targeted at a software- software device drivers that design exploration and HLL synthesis covers algorithmic or centric user base. enable communication what-if analysis. You can behavioral synthesis, which can pro- between the processor and evaluate and refine performance issues duce hardware circuits from C or C- the hardware accelerator block such as latency, throughput, and band- like software languages. Various (Figure 2). When compared to width, as well as alternative partner solutions take different paths code running on a CPU, FPGA- software/hardware partitioning strate- to converting a high-level design accelerated code can run orders of gies. Once the design meets its perform- description into an FPGA implemen- magnitude faster while consuming ance objectives, it can be committed to tation. How this is done goes to the significantly less power. implementation in silicon. root of the differences between the various ESL offerings. You can use HLL synthesis for a vari- ESL Tools Can ... Infer Memories ety of use cases, including: • Module generation. In this mode of Memory use, the HLL compiler can convert a (PCB, FPGA) Create Coprocessor functional block expressed in C (for Interface example, as a C subroutine) into a CPU corresponding hardware block. (Internal or The generated hardware block is External to FPGA) then assimilated in the overall APU FSL PLB OPB hardware/software design. In this way, Accelerator LCD the HLL compiler generates a sub- (FPGA) (PCB) module of the overall design.

Module generation allows software Synthesize C into Allow Direct Access from engineers to participate in the overall FPGA Gates C to PCB Components system design by quickly generating, then integrating, algorithmic hardware Figure 2 – ESL tools abstract the details associated with components. Hardware engineers seek- accelerating processor applications in the FPGA.

16 Embedded magazine March 2006 ...today’s ESL technologies are ready to deliver substantial practical value to a potentially large target audience.

The Challenges Faced by ESL Tool Providers include working to improve the com- available partner ESL solutions and is In relative terms, ESL tools for FPGAs are piler quality of results and enhance tool designed to help you decide which, if any, new to the market; customer adoption interoperability and overall ease-of-use. of the available solutions are a good fit for remains a key challenge. One of the biggest your applications. To get started with your 2. ESL awareness and evangelization. challenges faced by ESL tool providers is ESL orientation, visit www.xilinx.com/esl. Xilinx will evangelize the value and overcoming a general lack of awareness as Additionally, Xilinx has also started a new benefits of ESL flows for FPGAs to to what is possible with ESL and FPGAs, ESL for FPGAs discussion forum at current and prospective new customers. what solutions and capabilities already http://toolbox.xilinx.com/cgi-bin/forum. Here, The program will seek to inform and exist, and the practical uses and benefits of you can participate in a variety of discussions educate users on the types of ESL solu- the technology. Other challenges include on topics related to ESL design for FPGAs. tions that currently exist and how the user apprehension and concerns over the various offerings can provide better quality of results and learning curve associ- approaches to solving existing prob- Conclusion ated with ESL adoption. lems. The aim is to empower users to ESL tools for FPGAs give you the power to Although paradigm shifts such as make informed decisions on the suit- explore your ideas with programmable those introduced by ESL will take time to ability and fit of various partner ESL hardware without needing to learn low- become fully accepted within the existing offerings to meet their specific applica- level details associated with hardware FPGA user community, there is a need to tion needs. Greater awareness will lead design. Today, you have the opportunity to tackle some of the key issues that cur- to increased customer adoption, which select from a wide spectrum of innovative rently prohibit adoption. This is particu- in turn will contribute to a sustainable and productivity-enhancing solutions that larly important because today’s ESL partner ESL for FPGAs ecosystem. have been specifically optimized for Xilinx technologies are ready to deliver substan- FPGAs. With the formal launching of the tial practical value to a potentially large Getting Started With ESL ESL Initiative, Xilinx is thoroughly com- target audience. As a first step to building greater awareness mitted to working with its third-party on the various ESL for FPGA efforts, Xilinx ecosystem in bringing the best-in-class Xilinx ESL Initiative has put together a comprehensive ESL web- ESL tools to its current and potential Xilinx believes that ESL tools have the site. The content covers the specific and future customers. Stay tuned for continu- promise and potential to radically change unique aspects of each of the currently ing updates and new developments. the way hardware and software designers create, optimize, and verify complex elec- tronic systems. To bring the full range of Partner FPGA Synthesis Xilinx CPU Support FPGA Computing Solution benefits of this emerging technology to its customers and to establish a common plat- Celoxica Handel-C, SystemC to gates form for ESL technologies that target Impulse to gates FPGAs in particular, Xilinx has proactively Poseidon HW/SW partitioning, acceleration formed a collaborative joint ESL Initiative with its ecosystem partners (Table 1). Critical Blue Co-processor synthesis The overall theme of the initiative is to Teja C to multi-core processing accelerate the pace of ESL innovation for FPGAs and to bring the technology closer Mitrion Adaptable parallel processor in FPGA to the needs of the software-centric user System Crafter SystemC to gates base. As part of the initiative, there are two Bluespec SystemVerilog-based synthesis to RTL main areas of emphasis: Nallatech High-performance computing 1. Engineering collaboration. Xilinx will work closely with its partners to con- tinue to further increase the value of Table 1 – Xilinx ESL partners take different approaches ESL product offerings. This will from high-level languages to FPGA implementation.

March 2006 Embedded magazine 17 Algorithmic Acceleration Through Automated Generation of FPGA Coprocessors C-to-FPGA design methods allow rapid creation of hardware-accelerated embedded systems.

by Glenn Steiner converted into hardware coprocessors using The most frequently used coproces- Sr. Engineering Manager, Advanced Products Division design automation tools. The coprocessors sor is the floating-point unit (FPU), the Xilinx, Inc. can then be efficiently interfaced to the only common coprocessor that is tight- [email protected] offloaded processor, yielding “gigahertz- ly coupled to the CPU. There are no class” performance. general-purpose libraries of coproces- Kunal Shenoy In this article, we’ll explore code accel- sors. Even if there were, it is still diffi- Design Engineer, Advanced Products Division eration and techniques for code conversion cult to readily couple a coprocessor to a Xilinx, Inc. to hardware coprocessors. We will also CPU, such as a Pentium 4. [email protected] demonstrate the process for making trade- As shown in Figure 1, the Xilinx® Dan Isaacs off decisions with benchmark data through Virtex™-4 FX FPGA has one or two Director of Embedded Processing, Advanced Products an actual image-rendering case study PowerPCs, each with an APU interface. By Division involving an auxiliary processor unit embedding a processor within an FPGA, Xilinx, Inc. (APU)-based technique. The design uses you now have the opportunity [email protected] an immersed PowerPC™ implemented in to implement complete processing systems David Pellerin a platform FPGA. of your own design within a single chip. Chief Technology Officer The integrated PowerPC with APU Impulse Accelerated Technologies The Value of a Coprocessor interface enables a tightly coupled [email protected] A coprocessor is a processing element that coprocessor that can be implemented is used alongside a primary processing unit within the FPGA. Frequency require- Today’s designers are constrained by space, to offload computations normally per- ments and pin number limits make an power, and cost, and they simply cannot formed by the primary processing unit. external coprocessor less capable. Thus, afford to implement embedded designs Typically, the coprocessor function imple- you can now create application-specific with gigahertz-class computers. Fortunately, mented in hardware replaces several soft- coprocessors attached directly to the in embedded systems, the greatest compu- ware instructions. Code acceleration is PowerPC, providing significant soft- tational requirements are frequently deter- thus achieved by both reducing multiple ware acceleration. Because FPGAs are mined by a relatively small number of code instructions to a single instruction as reprogrammable, you can rapidly devel- algorithms. These algorithms, identified well as the direct implementation of the op and test CPU-attached coprocessor through profiling techniques, can be rapidly instruction in hardware. solutions.

18 Embedded magazine March 2006 Coprocessor Connection Models directly to and from the data execution PowerPC. Although the APU connection is Coprocessors are available in three basic pipeline. A single operation can result in instruction-pipeline-based, the C-to-HDL forms: CPU bus connected, I/O connect- two operands being processed, with both a tool set implements an I/O pipeline inter- ed, and instruction-pipeline connected. result and status being returned. face with a resulting behavior more typical Mixed variants also exist. As a directly connected interface, the of an I/O-connected accelerator. instruction-pipeline connected accelerators CPU Bus Connection can be clocked faster than a processor bus. FPGA/PowerPC/APU Interface Processor bus-connected accelerators The Xilinx implementation for this type of FPGAs allow hardware designers to imple- require the CPU to move data and send coprocessor connection model through the ment a complete computing system with commands through a bus. Typically, a APU interface demonstrates a 10x clock processor, decode logic, peripherals, and single data transaction can require many cycle reduction in the control and movement coprocessors all on one chip. An FPGA can processor cycles. Data trans- contain a few thousand to hun- actions can be hindered by dreds of thousands of logic cells. bus arbitration and the A processor can be implemented necessity for the bus to be from the logic cells, as in the clocked at a fraction of the Xilinx PicoBlaze™ or MicroBlaze processor clock speed. A bus- processors, or it can be one or more hard logic elements, as in connected accelerator can EMAC APU FCM include a direct memory Control the Virtex-4 FX PowerPC. The access (DMA) engine. At the high number of logic cells cost of additional logic, the PowerPC enables you to implement data- DMA engine allows a 405 Core processing elements that work coprocessor to operate on with the processor system and blocks of data located on are controlled or monitored by EMAC bus-connected memory, the processor. independent of the CPU. FPGAs, being reprogramma- Reset ble elements, allow you to pro- I/O Connection Debug gram parts and test them at any I/O-connected accelerators are stage during the design process. attached directly to a dedicated If you find a design flaw, you I/O port. Data and control are Figure 1 – Virtex-4 FX processor with APU interface and EMAC blocks can immediately reprogram a typically provided through part. FPGAs also allow you to GET or PUT functions. implement hardware computing Lacking arbitration, reduced control com- of data for a typical double-operand instruc- functions that were previously cost-pro- plexity, and fewer attached devices, these tion. The APU controller is also connected hibitive. The tight coupling of a CPU interfaces are typically clocked faster than a to the data-cache controller and can perform pipeline to FPGA logic, as in the Virtex-4 processor bus. A good example of such an data load/store operations through it. Thus, FX PowerPC, enables you to create high- interface is the Xilinx Fast Simplex Link the APU interface is capable of moving hun- performance software accelerators. (FSL). The FSL is a simple FIFO interface dreds of millions of bytes per second, Figure 2 is a block diagram showing the that can be attached to either the Xilinx approaching DMA speeds. PowerPC, integrated APU controller, and MicroBlaze™ soft-core processor or a Either I/O-connected accelerators or an attached coprocessor. Instructions from Virtex-4 FX PowerPC. Data movement instruction-pipeline-connected accelerators cache or memory are simultaneously pre- through the FSL has lower latency and a can be combined with bus-connected accel- sented to the CPU decoder and the APU higher data rate than data movement erators. At the cost of additional logic, you controller. If the CPU recognizes the through a processor bus interface. can create an accelerator that receives com- instruction, it is executed. If not, the APU mands and returns status through a fast, low- controller or the user-created coprocessor Instruction Pipeline Connection latency interface while operating on blocks of has the opportunity to acknowledge the Instruction-pipeline connected accelerators data located in bus-connected memory. instruction and execute it. Optionally, one attach directly to the computing core of a The C-to-HDL tool set described in this or two operands can be passed to the CPU. Being coupled to the instruction article is capable of implementing bus-con- coprocessor and a result or status can be pipeline, instructions not recognized by the nected and I/O-connected accelerators. It is returned. The APU interface also supports CPU can be executed by the coprocessor. also capable of implementing an accelerator the ability to transfer a data element with a Operands, results, and status are passed connected to the APU interface of the single instruction. The data element ranges

March 2006 Embedded magazine 19 2. Determine if floating-to-fixed point Processor Block Instructions from conversion is appropriate. Use libraries Cache or Memory or macros to aid in this conversion. Use a baseline test bench to analyze per- Fetch Stage formance and accuracy. Use the profiler

Decode Stage Fabric Coprocessor to reevaluate critical functions. Decode Decode Module (FCM) Instruction Control Registers 3. Using a C-to-HDL tool, such as Decode APU Decode Optional Decode Impulse C, iterate on each of the criti-

Control cal functions to: Pipeline Operands Control EXE Stage • Partition the algorithm into parallel Execution processes Execution Units Units Reset Buffers and • Create hardware/software process Synchronization interfaces (streams, shared memories, signals) Write Back (WB) Stage Register File • Automatically optimize and paral- Load Data lelize the critical code sections (such Load WB Stage as inner code loops) PPC405 APU Controller • Test and verify the resulting parallel algorithm using desktop simulation, Figure 2 – PowerPC, integrated APU controller, and coprocessor cycle-accurate C simulation, and actual in-system testing. in size from one byte to four 32-bit words. nected accelerator, we first implemented a 4. Using the C-to-HDL tool, convert the One or more coprocessors can be design with a processor bus-connected critical code segment to an HDL attached to the APU interface through a FPU and then with an APU/FCB- coprocessor. fabric coprocessor bus (FCB). connected FPU. Table 1 summarizes the 5. Attach the coprocessor to the APU Coprocessors attached to the bus range performance for a finite impulse response interface for final testing. from off-the-shelf cores, such as an FPU, (FIR) filter for each case. to user-created coprocessors. A coproces- As noted in the table, an FPU con- sor can connect to the FCB for control nected to an instruction pipeline accel- and status operations and to a processor erates software floating-point operations by 30x, and the APU inter- face provides a nearly 4x improvement Implementation Performance over a bus-connected FPU. Software Implementation 2 MFLOPS FPU Connected to Processor Bus 16 MFLOPS Converting C Code to HDL Converting C code to an HDL FPU Connected to APU 60 MFLOPS Interface via FCB accelerator with a C-to-HDL tool is an efficient method for creating Table 1 – Non-accelerated vs. accelerated hardware coprocessors. Figure 3 and floating-point performance the steps below summarize the C-to- HDL conversion process: bus, enabling direct access to memory data blocks and DMA data passing. A 1. Implement the application or simplified connection scheme, such as the algorithm using standard C FSL, can also be used between the FCB tools. Develop a software test and coprocessor, enabling FIFO data and bench for baseline performance control communication at the cost of and correctness (host or desktop some performance. simulations). Use a profiler (such To demonstrate the performance as gprof) to begin identifying Figure 3 – C-to-HDL design flow advantage of an instruction-pipeline-con- critical functions.

20 Embedded magazine March 2006 Impulse C is designed for dataflow-oriented applications, but it is also flexible enough to support alternate programming models...

Impulse: C-to-HDL Tool some applications, it makes more sense to • Standard C (with associated library Impulse C, shown in Figure 4, enables move data between the embedded proces- calls) that can be compiled onto sup- embedded system designers to create sor and the FPGA through block memory ported microprocessors through the use highly parallel, FPGA-accelerated applica- reads and writes; in other cases, a stream- of widely available C cross-compilers tions by using C-compatible library func- ing communication channel might pro- The complete CoDeveloper develop- tions in combination with the Impulse vide higher performance. The ability to ment environment includes desktop simu- lation libraries compatible with standard C compilers and debuggers, including Microsoft Visual Studio and GCC/GDB. Using these libraries, Impulse C program- mers are able to compile and execute their applications for algorithm verification and debugging purposes. C programmers are also able to examine parallel processes, ana- lyze data movement, and resolve process- to-process communication problems using the CoDeveloper Application Monitor. The output of an Impulse C applica- tion, when compiled, is a set of hardware and software source files that are ready for importing into FPGA synthesis tools. These files include:

• Automatically generated HDL files representing the compiled hardware process.

Figure 4 – Impulse C • Automatically generated HDL files representing the stream, signal, and memory components needed to CoDeveloper C-to-hardware compiler. quickly model, compile, and evaluate connect hardware processes to a Impulse C simplifies the design of mixed alternate algorithm approaches is an system bus. hardware/software applications through important part of achieving the best pos- • Automatically generated software the use of well-defined data communica- sible results for a given application. components (including a run-time tion, message passing, and synchroniza- To this end, the Impulse C library library) establishing the software side tion mechanisms. Impulse C provides comprises minimal extensions to the C of any hardware/software stream automated optimization of C code (such language in the form of new data types connections. as loop pipelining, unrolling, and opera- and predefined function calls. Using tor scheduling) and interactive tools, Impulse C function calls, you can define • Additional files, including script files, allowing you to analyze cycle-by-cycle multiple, parallel program segments for importing the generated applica- hardware behavior. (called processes) and describe their inter- tion into the target FPGA place and Impulse C is designed for dataflow-ori- connections using streams, signals, and route environment. ented applications, but it is also flexible other mechanisms. The Impulse C com- enough to support alternate programming piler translates and optimizes these C-lan- The result of this compilation process models, including the use of shared mem- guage processes into either: is a complete application, including the ory. This is important because different required hardware/software interfaces, FPGA-based applications have different • Lower-level HDL that can be synthe- ready for implementation on an FPGA- performance and data requirements. In sized to FPGAs, or based programmable platform.

March 2006 Embedded magazine 21 Design Example (hardware to software) into streams; and the Performance Improvement Examples The Mandelbrot image shown in Figure 5, addition of compiler directives to optimize We measured performance improve- a classic example of fractal geometry, is the generated hardware. We subsequently ments for the Mandelbrot image textur- widely used in the scientific and engineer- used the CoDeveloper tool set to create the ing problem, an image filtering ing communities to simulate chaotic Pcore coprocessor that was imported into application, and triple DES encryption. events such as weather. Fractals are also Xilinx Platform Studio (XPS). Using XPS, Table 2 documents the performance improvements, demonstrating accelera- tion ranging from 11x to 34x that of software.

Conclusion Constrained by power, space, and cost, you might need to make a non-ideal processor choice. Frequently, it is a choice where the processor is of lower performance than desired. When the software code does not run fast enough, a coprocessor code accelerator becomes an attractive solution. You can hand- craft an accelerator in HDL or use a C- to-HDL tool to automatically convert the C code to HDL. Using a C-to-HDL tool such as Impulse C enables quick and easy accel- erator generation. Virtex-4 FX FPGAs, with one or two embedded PowerPCs, Figure 5 – Mandelbrot image and code acceleration enable tight coupling of the processor instruction pipeline to software acceler- ators. As demonstrated in this article, used to generate textures and imaging in we attached the PC to the PowerPC APU critical software routines can be acceler- video-rendering applications. Mandelbrot controller interface and tested the system. ated from 10x to more than 30x, images are described as self-similar; on Xilinx application note XAPP901 enabling a 300 MHz PowerPC to pro- magnifying a portion of the image, anoth- (www.xilinx.com/bvdocs/appnotes/xapp901.p vide performance equaling or exceeding er image similar to the whole is obtained. df) provides a full description of the design that of a high-performance multi-giga- The Mandelbrot image is an ideal can- along with design files for downloading. hertz processor. The above examples didate for hardware/software co-design User Guide UG096 (www.xilinx.com/ were generated in just a few days each, because it has a single computation- bvdocs/userguides/ug096.pdf) provides a demonstrating the rapid design, imple- intensive function. Making this critical step-by-step tutorial in implementing the mentation, and testing possible with a function faster by moving it to the hard- design example. C-to-HDL flow. ware domain significantly increases the speed of the whole system. The Application PowerPC Only PowerPC + Coprocessor Acceleration Mandelbrot application also lends itself (300 MHz) (300/50 MHz) nicely to clear divisions between hardware and software processes, making it easy to Image Texturing implement using C-to-HDL tools. (Mandelbrot/Fractal) 21 sec 1.2 sec 17x We used the CoDeveloper tool set as the Image Filter C-to-HDL tool set for this design example. (Edge Detection) 0.14 sec 0.012 sec 11x We modified a software-only Mandelbrot C program to make it compatible with the C- Encryption to-HDL tools. Our changes included divi- (Triple DES) 2.3 sec 0.067 sec 34x sion of the software project into distinct processes (independent units of sequential Table 2 – Algorithm acceleration through coprocessor accelerators execution); conversion of function interfaces

22 Embedded magazine March 2006 +)* 1745'58#+.#$.'

26+/+<+0)+%41.#<'1(6 41%'5514;56'/5    ˜ G*174%.#55 ˜ 18'45$7+.&+0)#%1/2.'6' %7561/+<'&+%41.#<'51(6    241%'55145;56'/ +&'1f /#)+0).)14+6*/5+0  5 ˜ G*174%.#55 ˜ '4+(;&'5+)051061#%67#. *#4&9#4'75+0) 6*'40'6g $#5'&*#4&9#4'g+0g6*'g.112 %1g5+/7.#6+10T

0641&7%6+1061 /$'&&'& 19'4#0&1g41%'55141&' %%'.'4#6145 ˜ G*174%.#55 ˜ 18'45*1961$7+.&#*+)* 2'4(14/#0%''/$'&&'& 19'45;56'/

0641&7%6+106141)4#//+0)  59+6*  ˜ H*174%.#55 7 14+<105 .'%6410+%5142T+52417&6124'5'061740'9'56'&7%#6+10 ˜ 18'45#0+0641&7%6+1061 #0&64#+0+0)241)4#/g24'554#%-g9*+%*1(('45'0)+0''456*' (14  5 12214670+6;612#46+%+2#6'+06'%*0+%#.5'/+0#45%10&7%6'&#4170&6*' 70&#/'06#.51(   %17064;$;':2'465(1%75'&106*'.#6'566'%*01.1)+'5(41/+.+0:T*+5 ˜ E&#;%.#55 241)4#/2418+&'5*+)*'48'.1%+6;.'#40+0)61*'.2/+0+/+<'56#46g726+/' ˜ 18'45  LTE('#674'5 6137+%-.;$')+0;174&'5+)0241%'5576+.+<+0)6*'.#6'56&'8'.12/'06611.5X 51(69#4'#0&241&7%65(41/$16*7 14+<105#0&+.+0:T  '5+)0 064; ˜ E&#;%.#55 ˜ 18'45X X6#6' #0&  5+/7.#614

70&#/'06#.51('5+)0 ˜ E&#;%.#55 14#%1/2.'6'.+561(%1745'1(('4+0)5X1461 ˜ 18'45$#5+%5#0& 4')+56'4(14#5'/+0#40'#4;17X2.'#5'8+5+6U +06'424'6+0)4'21465(14 126+/7/2'4(14/#0%' 999T07*14+<105T%1/f:24'5564#%- '5+)0'%*0+37'5(1419156 ˜ E&#;%.#55 ˜ 18'45&'8'.12+0).19%156 241&7%652#46+%7.#4.;+0*+)* 81.7/'/#4-'65

 (14'5+)0 0)+0''45 ˜ E&#;%.#55 ˜ 18'45 .#0)7#)'#0& +/2.'/'06#6+10(14  5n 5 Generating Efficient Board

by Rick Moleres Manager of Software IP Support Packages Xilinx, Inc. [email protected] The Xilinx Platform Studio toolset enables quick and easy BSP Milan Saini Technical Marketing Manager generation for Virtex FPGAs with immersed PowerPC processors. Xilinx, Inc. [email protected]

Platform FPGAs with embedded processors offer you unprecedented levels of flexibility, integration, and performance. It is now pos- sible to develop extremely sophisticated and highly customized embedded systems inside a single programmable logic device. With silicon capabilities advancing, the challenge centers on keeping design methods efficient and productive. In embedded sys- tems development, one of the key activities is the development of the board support pack- age (BSP). The BSP allows an embedded software application to successfully initialize and communicate with the hardware resources connected to the processor. Typical BSP components include boot code, device driver code, and initialization code. Creating a BSP can be a lengthy and tedious process that must be incurred every time the microprocessor complex (proces- sor plus associated peripherals) changes. With FPGAs, fast design iterations com- bined with the inherent flexibility of the platform can make the task of managing the BSP even more challenging (Figure 1). This situation clearly underscores the need for and importance of providing an effi- cient process for managing BSPs. In this article, we’ll describe an innova- tive solution from Xilinx that simplifies the creation and management of RTOS BSPs. We chose the WindRiver VxWorks flow to illustrate the concept; however, the under- lying technology is generic and equally applicable to all other OS solutions that support Xilinx® processors.

24 Embedded magazine March 2006 erals in Xilinx Virtex™-II Pro and TraditionalTraditional EmbeddedEmbedded Platforms Platforms Platform FPGA FPGA Virtex-4 FPGAs. The generated BSP con- tains all of the necessary support software OPB OPB Low-Speed ArbiterOPB Low-Speed Arbiter Peripherals Arbiter Peripherals Custom for a system, including boot code, device Custom PLB-OPB Peripherals BridgePLB-OPB Peripherals Bridge PLB drivers, and VxWorks initialization. ArbiterPLB DifferentDifferent Arbiter Once a hardware system with the Memory Memory Hi-Speed Controller Hi-Speed Controller Peripherals Peripherals PowerPC 405 processor is defined in Platform Studio, you need only follow these three steps to generate a BSP for VxWorks: •Fixed• Fixedperipherals peripherals •Design• Design dependent dependent peripheralsperipherals •Fixed• Fixedaddress address maps maps •Each• Each board board is is unique unique and customcustom 1. Use the Software Settings dialog box •Fixed• FixedBSP BSP •Need• Need efficient efficient custom custom BSP creationcreation (see Figure 2) to select the OS you Figure 1 – Platform FPGA flexibility requires the software BSP generation process to be efficient. plan to use for the system. Platform Studio users can select vxworks5_4 or vxworks5_5 as their target operat- Xilinx Design Flow ing system. and Software BSP Generation 2. Once you have selected the OS, you Designing for a Xilinx processor involves a can go to the Library/OS Parameters hardware platform assembly flow and an tab, as shown in Figure 3, to tailor the embedded software development flow. Tornado BSP to the custom hardware. Both of these flows are managed within the You have the option of selecting any Xilinx Platform Studio (XPS) tool, which is UART device in the system as the part of the Xilinx Embedded Development standard I/O device (stdin and std- Kit (EDK). out). This results in the device being You would typically begin a design by used as the VxWorks console device. assembling and configuring the processor and its connected components in XPS. Figure 2 – Setting the embedded OS selection You can also choose which peripherals Once the hardware platform has been are connected peripherals, or which defined, you can then configure the soft- devices will be tightly integrated into ware parameters of the system. A key fea- the VxWorks OS. For example, the ture of Platform Studio is its ability to Xilinx 10/100 Ethernet MAC can be produce a BSP that is customized based integrated into the VxWorks Enhanced on your selection and configuration of Network Driver (END) interface. processor, peripherals, and embedded OS. Alternately, the Ethernet device need As the system evolves through iterative not be connected to the END inter- changes to the hardware design, the BSP face and can instead be accessed direct- evolves with the platform. ly from the VxWorks application. An automatically generated BSP enables 3. Generate the Tornado BSP by select- embedded system designers to: ing the Tools > Generate Libraries • Automatically create a BSP that com- Figure 3 – Configuring the OS-specific parameters and BSP menu option. The result- pletely matches the hardware design ing BSP resembles a traditional Tornado BSP and is located in the • Eliminate BSP design bugs by using Platform Studio project directory pre-certified components under ppc405_0/bsp_ppc405_0 • Increase designer productivity by (see Figure 4). jump-starting application software Note that ppc405_0 refers to the development instance name of the PowerPC 405 Creating BSPs for WindRiver VxWorks processor in the hardware design. Platform Studio users can specify a differ- Platform Studio can generate a cus- ent instance name, in which case the sub- tomized Tornado 2.0.x (VxWorks 5.4) or directory names for the BSP will match Tornado 2.2.x (VxWorks 5.5) BSP for the Figure 4 – Generated BSP directory structure the processor instance name. PowerPC™ 405 processor and its periph-

March 2006 Embedded magazine 25 The Tornado BSP is completely self- The Tornado BSP created by Platform Studio has a makefile contained and transportable to other direc- tory locations, such as the standard that you can modify at the command line if you would rather Tornado installation directory for BSPs at use the diab compiler instead of the gnu compiler. target/config. Xilinx device drivers are implemented named ppc405_0_drv_.c in Customized BSP Details in C and are distributed among several the BSP directory. This file includes the The XPS-generated BSP for VxWorks source files, unlike traditional VxWorks driver source files (*.c) for the given resembles most other Tornado BSPs drivers, which typically consist of single C device and is automatically compiled by except for the placement of Xilinx device header and implementation files. In addi- the BSP makefile. driver code. Off-the-shelf device driver tion, there is an OS-independent imple- This process is analogous to how code distributed with Tornado typically mentation and an optional OS-dependent VxWorks’ sysLib.c includes source for Wind resides in the target/src/drv directory in the implementation for device drivers. River-supplied drivers. The reason why Tornado distribution directory. Device The OS-independent part of the driver Xilinx driver files are not simply included in driver code for a BSP that is automatical- is designed for use with any OS or any sysLib.c like the rest of the drivers is because ly generated by Platform Studio resides in processor. It provides an application pro- of namespace conflicts and maintainability the BSP directory itself. gram interface (API) that abstracts the func- issues. If all Xilinx driver files are part of a single compilation unit, static functions and data are no longer private. This places restrictions on the device drivers and would negate their OS independence.

Integration with the Tornado IDE The automatically generated BSP is inte- grated into the Tornado IDE (Project Facility). The BSP is compilable from the command line using the Tornado make tools or from the Tornado Project. Once the BSP is generated, you can simply type make vxWorks from the command line to compile a bootable RAM image. This assumes that the Tornado environment has been previously set up, which you can do through the command line using the host/x86-win32/bin/torVars.bat script (on a Windows platform). If you are using the Tornado Project facility, you can create a Figure 5 – Tornado 2.x Project: VxWorks tab Figure 6 – Tornado 2.x Project: Files tab project based on the newly generated BSP, then use the build environment provided through the IDE to compile the BSP. In Tornado 2.2.x, the diab compiler is This minor deviation is due to the tionality of the underlying hardware. The supported in addition to the gnu compiler. dynamic nature of FPGA-based embed- OS-dependent part of the driver adapts the The Tornado BSP created by Platform ded systems. Because an FPGA-based driver for use with an OS such as VxWorks. Studio has a makefile that you can modify embedded system can be reprogrammed Examples are Serial IO drivers for serial at the command line if you would rather with new or changed IP, the device driver ports and END drivers for Ethernet con- use the diab compiler instead of the gnu configuration can change, calling for a trollers. Only drivers that can be tightly compiler. Look for the make variable more dynamic placement of device driver integrated into a standard OS interface named TOOLS and set the value to “diab” source files. The directory tree for the require an OS-dependent driver. instead of “gnu.” If using the Tornado automatically generated BSP is shown in Xilinx driver source files are included in Project facility, you can select the desired Figure 4. The Xilinx device drivers are the build of a VxWorks image in the same compiler when the project is first created. placed in the ppc405_0_drv_csp/xsrc sub- way that other BSP files are included in The file 50ppc405_0.cdf resides in the BSP directory of the BSP. the build. For every driver, a file exists directory and is tailored during creation of

26 Embedded magazine March 2006 the BSP. This file integrates the device drivers into the Tornado IDE menu system. The Microprocessor Library Definition (MLD) drivers are hooked into the BSP at the The technology that enables dynamic and custom BSP generation is based on a Hardware > Peripherals subfolder. Below this Xilinx proprietary format known as Microprocessor Library Definition (MLD). This are individual device driver folders. Figure 5 format provides third-party vendors with a plug-in interface to Xilinx Platform shows a menu with Xilinx device drivers. Studio to enable custom library and OS-specific BSP generation (see Figure 7). The The Files tab of the Tornado Project MLD interface is typically written by third-party companies for their specific flows. Facility will also show the number of files It enables the following add-on functionality: used to integrate the Xilinx device drivers • Enables custom design rule checks into the Tornado build process. These files are automatically created by Platform • Provides the ability to customize device drivers for the target OS environment Studio and you need only be aware that • Provides the ability to custom-produce the BSP in a format and folder structure the files exist. Figure 6 shows an example tailored to the OS tool chain of the driver build files. • Provides the ability to customize an OS/kernel based on the hardware system Some of the commonly used devices under consideration are tightly integrated with the OS, while other devices are accessible from the appli- The MLD interface is an ASCII-based cation by directly using the device drivers. open and published standard. Each HW OS Design Selection The device drivers that have been tightly RTOS flow will have its own set of unique MLD files. An MLD file set com- integrated into VxWorks include: prises the following two files: • 10/100 Ethernet MAC • A data definition (.mld) file. This file MLD • 10/100 Ethernet Lite MAC defines the library or operating sys- Files XPS tem through a set of parameters set .MLD .TCL • 1 Gigabit Ethernet MAC by the Platform Studio. The values of • 16550/16450 UART these parameters are stored in an HW RTOS internal Platform Studio database Netlist BSP • UART Lite and intended for use by the script file during the output generation. • Interrupt Controller To ISE To RTOS IDE • A .tcl script file. This is the file that • System ACE™ technology is called by XPS to create the custom Figure 7 – Structure of an MLD flow • PCI BSP. The file contains a set of proce- dures that have access to the complete design database and hence can write a All other devices and associated device custom output format based on the requirements of the flow. drivers are not tightly integrated into a VxWorks interface; instead, they are loose- The MLD syntax is described in detail in the EDK documentation (see “Platform ly integrated. Access to these devices is Specification Format Reference Manual” at www.xilinx.com/ise/embedded/ available by directly accessing the associat- psf_rm.pdf.). You can also find MLD examples in the EDK installation directory under sw/lib/bsp. ed device drivers from the user application. Once MLD files for a specific RTOS flow have been created, they need to be installed in a specific path for Xilinx Platform Studio to pick up on its next invoca- Conclusion tion. The specific RTOS menu selection now becomes active in the XPS dialog box With the popularity and usage of embedded (Project > SW Platform Settings > Software Platform > OS). processor-based FPGAs continuing to grow, tool solutions that effectively synchronize Currently, the following partners’ MLD files are available for use within XPS: and tie the hardware and software flows • Wind River (VxWorks 5.4, 5.5) (included in Xilinx Platform Studio) together are key to helping designer produc- • MontaVista (Linux) (included in Xilinx Platform Studio) tivity keep pace with advances in silicon. • Mentor Accelerated Technologies (Nucleus) (download from Xilinx users have been very positive www.xilinx.com/ise/embedded/mld/) about Platform Studio and its integration • GreenHills Software (Integrity) (download from with VxWorks 5.4 and 5.5. Xilinx fully www.xilinx.com/ise/embedded/mld/) intends to continue its development sup- port for the Wind River flow that will • Micrium (µc/OS-II) (download from www.xilinx.com/ise/embedded/mld/) soon include support for VxWorks 6.0 • µcLinux (download from www.xilinx.com/ise/embedded/mld/). and Workbench IDE.

March 2006 Embedded magazine 27 Visit us at

BOOTH 1208 REGISTER TODAY FOR AVNET ® SPEEDWAY DESIGN WORKSHOP “Software Development with Xilinx Embedded Processors” Wed, April 5 and Thurs, April 6 (Room K) www.em.avnet.com Some things have to go out on time

As an embedded software developer, you’re always facing the next deadline. We know it’s important to get your products to market before your competitors, and we can help. With our Eclipse-based development tools, tightly integrated embedded software and support that is second to none, we offer you a partner to get your product to market quickly and easily.

The EDGE Eclipse-based development environment provides a set of top-notch development tools in the industry today. You’ll see how quickly you can code, collaborate on and deliver your final product. Additionally, the Nucleus range of royalty- free RTOS and middleware products gives you a proven kernel with everything else you need in a modern OS. Open, available, affordable solutions.

Finally, our Customer Support has one goal: provide the most experienced, timely and one-on-one customer support in the industry. As the only five-time recipient of the Software Technical Assistance Recognition (STAR) Award for technical support excellence and global support center practices certified by the Support Center Practices (SCP), we are dedicated to your success. For a free evaluation of EDGE Development Tools, visit our website Mentor.com/embedded or e-mail [email protected] Embedded made easy.

©2006 Corporation. All Rights Reserved. Xilinx Productivity Advantage: Embedded Processing QuickStart!

Getting You Started With On-Site Embedded Training

www.xilinx.com/epq With Embedded Processing QuickStart!, Xilinx offers on-site training and support right from the start. Our solution includes a dedicated expert application engineer for one week, to train your hardware team on creating embedded systems, instruct software engineers how to best use supporting FPGA features, and help your team finish on time and on budget.

The Quicker Solution to Embedded Design

QuickStart! features include configuration of the Xilinx ISE™ design envi- ronment, an embedded processing and EDK (Embedded Development Kit) training class, and design architecture and implementation consultations with Xilinx experts. Get your team started today!

Contact your Xilinx representative or go to www.xilinx.com/epq for more information.

©2006 Xilinx, Inc. All rights reserved. XILINX, the Xilinx logo, and other designated brands included herein are trademarks of Xilinx, Inc. All other trademarks are the property of their respective owners. Bringing Floating-Point Math to the Masses Xilinx makes high-performance floating-point processing available to a wider range of applications.

by Geir Kjosavik Senior Staff Product Marketing Engineer, Embedded Processing Division Xilinx, Inc. [email protected]

Inside microprocessors, numbers are rep- resented as integers – one or several bytes stringed together. A four-byte value com- prising 32 bits can hold a relatively large range of numbers: 232, to be specific. The 32 bits can represent the numbers 0 to 4,294,967,295 or, alternatively, -2,147,483,648 to +2,147,483,647. A 32-bit processor is architected such that basic arith- metic operations on 32-bit integer numbers can be completed in just a few clock cycles, and with some performance overhead a 32- bit CPU can also support operations on 64- bit numbers. The largest value that can be represented by 64 bits is really astronomical: 18,446,744,073,709,551,615. In fact, if a Pentium processor could count 64-bit values at a frequency of 2.4 GHz, it would take it 243 years to count from zero to the maximum 64-bit integer.

30 Embedded magazine March 2006 Dynamic Range and Rounding Error Problems Considering this, you would think that integers work fine, but that is not always the 1 LSB case. The problem with integers is the lack of dynamic range and rounding errors. The quantization introduced through a finite resolution in the number format dis- torts the representation of the signal. 1 LSB However, as long as a signal is utilizing the range of numbers that can be represented by integer numbers, also known as the dynam- ic range, this distortion may be negligible. Figure 1 shows what a quantized signal Figure 1 – Signal quantization and dynamic range looks like for large and small dynamic swings, respectively. Clearly, with the Because of the truncation that happens when 1.001 can be written as 1.001 x 100. smaller amplitude, each quantization step you divide by 10,000, the resulting velocity In the first example, 3.0064771 is called is bigger relative to the signal swing and increase is 10.6% smaller than what you the mantissa, 10 the exponent base, and 7 introduces higher distortion or inaccuracy. asked for. Now, an error of 10.6% of 0.015% the exponent. The following example illustrates how may not sound like anything to worry about, IEEE standard 754 specifies a common integer math can mess things up. but as you continue to perform similar format for representing floating-point adjustments to the motor speed, these errors numbers in a computer. Two grades of pre- A Calculation Gone Bad will almost certainly accumulate to a point cision are defined: single precision and An electronic motor control measures the where they become a problem. double precision. The representations use velocity of a spinning motor, which typical- What you need to overcome this prob- 32 and 64 bits, respectively. This is shown ly ranges from 0 to10,000 RPM. The value lem is a numeric computer representation in Figure 2. is measured using a 32-bit counter. To allow that represents small and large numbers In IEEE 754 floating-point representa- some overflow margin, let’s assume that the with equal precision. That is exactly what tion, each number comprises three basic measurement is scaled so that 15,000 RPM floating-point arithmetic does. components: the sign, the exponent, and represents the maximum 32-bit value, the mantissa. To maximize the range of 4,294,967,296. If the motor is spinning at Floating Point to the Rescue possible numbers, the mantissa is divided 105 RPM, this value corresponds to the As you have probably guessed, floating- into a fraction and leading digit. As I’ll number 30,064,771 within 0.0000033%, point arithmetic is important in industrial explain, the latter is implicit and left out of which you would think is accurate enough applications like motor control, but also in the representation. for most practical purposes. a variety of other applications. An increas- The sign bit simply defines the polarity Assume that the motor control is ing number of applications that traditional- of the number. A value of zero means that instructed to increase motor velocity by ly have used integer math are turning to the number is positive, whereas a 1 denotes 0.015% of the current value. Because we floating-point representation. I’ll discuss a negative number. are operating with integers, multiplying this once we have looked at how floating- The exponent represents a range of num- with 1.0015 is out of the question – as is point math is performed inside a computer. bers, positive and negative; thus a bias value multiplying by 10,015 and dividing by must be subtracted from the stored exponent 10,000 – because the intermediate result IEEE 754 at a Glance to yield the actual exponent. The single pre- will cause overflow. A floating-point number representation on cision bias is 127, and the double precision The only option is to divide by integer a computer uses something similar to a sci- bias is 1,023. This means that a stored value 10,000 and multiply by integer 10,015. If entific notation with a base and an expo- of 100 indicates a single-precision exponent you do that, you end up with 30,094,064; nent. A scientific representation of of -27. The exponent base is always 2, and but the correct answer is 30,109,868. 30,064,771 is 3.0064771 x 107, whereas this implicit value is not stored.

63 55 47 39 31 23 15 7 0 S Exp. [30-23] Fraction [22-0] Single precision S Exponent [62-52] Fraction [51-0] Double precision

Figure 2 – IEEE floating-point formats

March 2006 Embedded magazine 31 For both representations, exponent rep- resented with single precision IEEE 754 With multiplication and division, the resentations of all 0s and all 1s are reserved representation is ±(2-2-23) x 2127, or approx- performance gap just increases; thus and indicate special numbers: imately ±1038.53. This range is astronomical for many applications, software float- compared to the maximum range of 32-bit ing-point emulation is not practical. • Zero: all digits set to 0, sign bit can be integer numbers, which by comparison is either 0 or 1 limited to around ±2.15 x 109. Also, where- Floating Point Co-Processor Units • ±∞: exponent all 1s, fraction all 0s as the integer representation cannot repre- For those who remember PCs based on • Not a Number (NaN): exponent all 1s, sent values between 0 and 1, the Intel 8086 or 8088 processor, they non-zero fraction. Two versions of NaN single-precision floating-point can repre- came with the option of adding a float- -149 -44.85 are used to signal the result of invalid sent values down to ±2 , or ±~10 . And ing-point coprocessor unit (FPU), the operations such as dividing by zero, and we are still using only 32 bits – so this has 8087. Though a compiler switch, you indeterminate results such as operations to be a much more convenient way to rep- could tell the compiler that an 8087 was with non-initialized operand(s). resent numbers, right? present in the system. Whenever the The answer depends on the requirements. 8086 encountered a floating-point oper- The mantissa represents the number to be ation, the 8087 would take over, do the • Yes, because in our example of multi- multiplied by 2 raised to the power of the operation in hardware, and present the plying 30,064,771 by 1.001, we can exponent. Numbers are always normalized; result on the bus. simply multiply the two numbers and that is, represented with one non-zero lead- Hardware FPUs are complex logic cir- the result will be extremely accurate. ing digit in front of the radix point. In bina- cuits, and in the 1980s the cost of the ry math, there is only one non-zero number, • No, because as in the preceding exam- additional circuitry was significant; thus 1. Thus the leading digit is always 1, allow- ple the number 30,064,771 is not rep- Intel decided that only those who needed ing us to leave it out and use all the mantissa resented with full precision. In fact, floating-point performance would have to bits to represent the fraction (the decimals). 30,064,771 and 30,064,770 are repre- pay for it. The FPU was kept as an option- Following the previous number exam- sented by the exact same 32-bit bit al discrete solution until the introduction ples, here is what the single precision repre- pattern, meaning that a software algo- of the 80486, which came in two versions, sentation of the decimal value 30,064,771 rithm will treat the numbers as identi- one with and one without an FPU. With will look like: cal. Worse yet, if you increment either the Pentium family, the FPU was offered The binary integer representation of number by 1 a billion times, none of as a standard feature. 30,064,771 is 1 1100 1010 1100 0000 them will change. By using 64 bits and 1000 0011. This can be written as representing the numbers in double Floating Point is Gaining Ground 1.110010101100000010000011 x 224. The precision format, that particular exam- These days, applications using 32-bit leading digit is omitted, and the fraction – ple could be made to work, but even embedded processors with far less process- the string of digits following the radix double-precision representation will ing power than a Pentium also require float- point – is 1100 1010 1100 0000 1000 face the same limitations once the ing-point math. Our initial example of 0011. The sign is positive and the exponent numbers get big – or small enough. motor control is one of many – other appli- is 24 decimal. Adding the bias of 127 and • No, because most embedded processor cations that benefit from FPUs are industri- converting to binary yields an IEEE 754 cores ALUs (arithmetic logic units) al process control, automotive control, exponent of 1001 0111. only support integer operations, which navigation, image processing, CAD tools, Putting all of the pieces together, the leaves floating-point operations to be and 3D computer graphics, including single representation for 30,064,771 is emulated in software. This severely games. shown in Figure 3. affects processor performance. A 32-bit As floating-point capability becomes CPU can add two 32-bit integers with more affordable and proliferated, applica- Gain Some, Lose Some one machine code instruction; howev- tions that traditionally have used integer Notice that you lose the least significant bit er, a library routine including bit math turn to floating-point representa- (LSB) of value 1 from the 32-bit integer manipulations and multiple arithmetic tion. Examples of the latter include high- representation – this is because of the lim- operations is needed to add two IEEE end audio and image processing. The ited precision for this format. single-precision floating-point values. latest version of Adobe Photoshop, for The range of numbers that can be rep- example, supports image formats where each color channel is represented by a floating-point number rather than the usual integer representation. The increased dynamic range fixes some problems inher- Figure 3 – 30,064,771 represented in IEEE 754 single-precision format ent in integer-based digital imaging.

32 Embedded magazine March 2006 • The overhead in function calls will Operation CPU Cycles without FPU CPU Cycles with CPU Acceleration severely decrease performance Addition 400 6 67x • Each operation involves at least five bus transactions; as the bus is likely to be Subtraction 400 6 67x shared with other resources, this not only affects performance, but the time needed Division 750 30 25x to perform an operation will be depend- ent on the bus load in the moment Multiplication 400 6 67x

Comparison 450 3 150x The MicroBlaze Way The optional MicroBlaze soft processor with Table 1 – MicroBlaze floating-point acceleration FPU is a fully integrated solution that offers high performance, deterministic timing, and ease of use. The FPU operation is completely If you have ever taken a picture of a FPGA. Similarly, any microcontroller can transparent to the user. person against a bright blue sky, you know be connected to an external FPU. However, When you build a system with an that without a powerful flash you are left unless you take special considerations on FPU, the development tools automatical- with two choices; a silhouette of the per- the compiler side, you cannot expect seam- ly equip the CPU core with a set of float- son against a blue sky or a detailed face less cooperation between the two. ing-point assembly instructions known to against a washed-out white sky. A floating- C-compilers for CPU architecture fam- the compiler. point image format partly solves this prob- ilies that have no floating-point capability lem, as it makes it possible to represent will always emulate floating-point opera- To perform y = x*y, you would simply write: subtle nuances in a picture with a wide tions in software by linking in the necessary float x, y, z; range in brightness. library routines. If you were to connect an Compared to software emulation, FPUs FPU to the processor bus, FPU access y = x * z; can speed up floating-point math opera- would occur through specifically designed and the compiler will use those special tions by a factor of 20 to 100 (depending driver routines such as this one: instructions to invoke the FPU and per- on type of operation) but the availability of form the operation. void user_fmul(float *op1, float *op2, float *res) embedded processors with on-chip FPUs is Not only is this simpler, but a hardware- limited. Although this feature is becoming { connected FPU guarantees a constant num- increasingly more common at the higher FPU_operand1=*op1; /* write operand a to FPU */ ber of CPU cycles for each floating-point end of the performance spectrum, these FPU_operand2=*op2; /* write operand b to FPU */ operation. Finally, the FPU provides an derivatives often come with an extensive extreme performance boost. Every basic FPU_operation=MUL; /* tell FPU to multiply */ selection of advanced peripherals and very floating-point operation is accelerated by a high-performance processor cores – fea- while (!(FPU_stat & FPUready)); /* wait for FPU to finish */ factor 25 to 150, as shown in Table 1. tures and performance that you have to pay *res = FPU_result /* return result */ for even if you only need the floating-point } Conclusion math capability. To do the operation, z = x*y in the main Floating-point arithmetic is necessary to meet program, you would have to call the above precision and performance requirements for FPUs on Embedded Processors driver function as: an increasing number of applications. With the MicroBlaze™ 4.00 processor, Today, most 32-bit embedded proces- float x, y, z; Xilinx makes an optional single precision sors that offer this functionality are deriva- FPU available. You now have the choice user_fmul (&x, &y, &z); tives at the higher end of the price range. whether to spend some extra logic to The MicroBlaze soft processor with FPU For small and simple operations, this achieve real floating-point performance or can be a cost-effective alternative to ASSP may work reasonably well, but for complex to do traditional software emulation and products, and results show that with the operations involving multiple additions, free up some logic (20-30% of a typical correct implementation you can benefit not subtractions, divisions, and multiplica- processor system) for other functions. only from ease-of-use but vast improve- tions, such as a proportional integral deriv- ments in performance as well. ative (PID) algorithm, this approach has Why Integrated FPU is the Way to Go For more information on the three major drawbacks: A soft processor without hardware support MicroBlaze FPU, visit www.xilinx.com/ for floating-point math can be connected to • The code will be hard to write, ipcenter/processor_central// an external FPU implemented on an maintain, and debug microblaze_fpu.htm.

March 2006 Embedded magazine 33 PacketPacket SubsystemSubsystem onon aa ChipChip Teja’s packet-engine technology integrates all of the key aspects of a flexible packet processor.

by Bryon Moyer VP, Product Marketing Teja Technologies, Inc. [email protected]

As the world gets connected, more and more systems rely on access to the network as a standard part of product configuration. Traditional circuit-based communications systems like the telephone infrastructure are gradually moving towards packet-based tech- nology. Even technologies like Asynchronous Transfer Mode (ATM) are starting to yield to the Internet Protocol (IP) in places. All of this has dramatically increased the need for packet-processing technology. The content being passed over this infrastructure has increased the demands on available bandwidth. Core routers target 10 Gbps; edge and access equipment work in the 1-5 Gbps range. Even some end-user equipment is starting to break the 100 Mbps range. The question is how to design systems to accommodate these speeds. These systems implement a wide variety of network protocols. Because the protocols start out as software, it’s easiest for network designers if as much of the functionality as possible can remain in software. So the fur- ther software programmability can be pushed up the speed range, the better. Although FPGAs can handle network speeds as high as 10 Gbps, RTL has typical- ly been required for 1 Gbps and higher.

34 Embedded magazine March 2006 Most traffic that goes through the system looks alike, and processors can be optimized for that kind of traffic.

Teja Technologies specializes in packet- Of course, to process packets, there Memory is required for packet storage, processing technologies implemented in must be a way to deliver the packets to and table storage, and for program and data high-level software on multi-core environ- from the fast-path processor. Coming off storage for both the fast and slow paths. ments. Teja has adapted its technology to an Ethernet port, the packets must first tra- Memory latency has a dramatic impact Xilinx® Virtex™-4 FPGAs, allowing high- verse the physical layer logic (layer one of on speed, so careful construction of the level software programmability of a packet- the stack, often a dedicated chip) and then memory architecture is paramount. processing engine built out of multiple the MAC (part of layer two, also often its Finally, there must be a way for the con- MicroBlaze™ soft-processor cores. This own dedicated chip). trol plane to access the subsystem. This is combination of high-level packet technology One of the most critical elements in important for initialization, making table and Xilinx silicon and core technology – getting performance is the memory. changes, diagnostics, and other control func- using Virtex-4 devices with on-board MACs, tions. Such access is typically accomplished PHYs, PowerPC™ hard-core processors, through a combination of serial connections and ample memory – provides a complete Data Control Plane and dedicated Ethernet connections, each packet-processing subsystem that can process Plane requiring logic to implement. more than 1 Gbps in network traffic. 7 Application Layer A diagram of this subsystem is shown in Figure 2; all of the pieces of this sub- The Typical Packet Subsystem system are critical to achieving the highest Transport Layer The network “stack” shown in Figure 1 is 4 performance. typically divided between the “control (TCP, UDP, ...) plane” and the “data plane.” All of the 3 Network Layer (IP) The Teja Packet Pipeline packets are handled in the data plane; the 2 Data Link Layer One effective way to accelerate processing is control plane makes decisions on how the Ethernet to use a multi-core pipeline. This allows you 1 Physical Layer (PHY) packets should be processed. The lowest to divide the functionality into stages and layer sees every packet; higher layers will add parallel elements as needed to hit per- see fewer packets. formance. If you were to try to assemble such The control plane comprises a huge Figure 1 – The network protocol stack a structure manually, you would immediate- amount of sophisticated software. The data-plane software is simpler, but must operate at very high speed at the lowest lay- ers because it has such a high volume of packets. Packet-processing acceleration Control usually focuses on layers one to three of the Access network stack, and sometimes layer four. Most traffic that goes through the sys- tem looks alike, and processors can be opti- mized for that kind of traffic. For this Slow-Path, reason, data-plane systems are often divid- Control Plane ed into the “fast path,” which handles aver- RISC Processor age traffic, and the “slow path,” which handles exceptions. Although the slow path Memory can be managed by a standard RISC processor like a PowerPC, the fast path Port usually uses a dedicated structure like a net- Fast-Path Processor Access work processor or an ASIC. The focus of the fast path is typically IP, ATM, VLAN, and similar protocols in layers two and three. Layer four protocols like TCP and Figure 2 – Typical packet-processing subsystem UDP are also often accelerated.

March 2006 Embedded magazine 35 ly encounter the kinds of challenges faced by Access to the pipeline is provided by a you can add more parallel processing, or experienced multi-core designers: how to block that takes each packet and delivers the create another pipeline stage. The reverse is structure communication between stages, critical parts to the pipeline. Because this also true: if a given pipeline provides more scheduling, and shared resource access. block is in the critical path for every packet, performance than the target system Teja has developed a pipeline structure by it must be very fast, and has been designed requires, you can remove engines, making creating its own blocks that implement the by Teja for very high performance. the subsystem more economical.

The Rest of the Subsystem What is so powerful about the combina- Processing Processing tion of Teja’s data-plane engine and the Engine Engine Port Port Virtex-4 FX devices is that most of the rest Access Access of the subsystem can be moved on-chip. (RX) (TX) Much of the external memory can now be Processing Processing moved into internal block RAM. Some

Communication IP Engine Communication IP Engine Communication IP external memory will still be required, but high-speed DRAM can be directly accessed Figure 3 – Teja packet-processing pipeline by the Virtex-4 family, so no intervening glue is required. The chips have built-in Ethernet MACs which, combined with the necessary functions for efficient processing The result of this structure is that each available PHY IP and RocketIO™ tech- and inter-communication. By taking advan- MicroBlaze processor and offload can be nology, allow direct access from Ethernet tage of this existing infrastructure, you can working on a different packet at any given ports onto the chip. assemble pipelines easily in a scalable fashion. time. High performance is achieved The integrated PowerPC cores (as many The pipeline comprises processing because many in-flight packets are being as two) allow you to implement the slow engines connected by communication handled at once. path and even the entire control plane on blocks and accessed through packet access The key to this structure is its scalability. the same chip over an embedded operating blocks. Figure 3 illustrates this arrangement. Anytime additional performance is needed, system such as Linux. You can also provide The engine consists primarily of a MicroBlaze processor and some private block RAM on the FPGA. In addition, if a stage has a particularly compute-inten- Virtex-4 FX sive function like a checksum, or a longer- lead function like an external memory Control Access read or write, an offload can be included MGT PHY MAC PowerPCs to accelerate that function. Because the (Slow Path, offload can be created as asynchronous if Control Plane) UART desired, the MicroBlaze processor is free to work on something else while the offload is operating. Fast Path Processor Memory

The communication blocks manage the (Block RAM) transition from stage to stage. As packet

information moves forward, the communi- MGT PHY MAC Fast-Path Pipeline External DRAM Memory Controller cation block can perform load balancing or route a packet to a particular engine. Although the direction of progress is usual- Fast-Path Offloads ly “forward” (left to right, as shown in Figure 3), there are times when a packet must move backwards. An example of this Dedicated Built Out of Software- is with IPv4/v6 forwarding, when an IPv6 RTL Silicon Logic Fabric Programmable packet is tunneled on IPv4. Once the IPv4 packet is decapsulated, an internal IPv6 packet is found, and it must go back for Figure 4 – Single-chip packet-processing subsystem IPv6 decapsulation.

36 Embedded magazine March 2006 control access through serial and Ethernet One of the most important aspects of now IPv4 still dominates. At its most basic, ports using existing IP. software programmability is field upgrades. IPv4 comprises the following functions: As a result, the entire subsystem shown With a software upgrade, you can change • Filtering in Figure 2 (with the exception of some your code – as long as you stay within the external memory) can be implemented on amount of code store available. As the Teja • Decapsulation a single chip, as illustrated in Figure 4. FPGA packet engine is software-program- • Classification mable, you can perform software upgrades. Flexibility: Customizing, Resizing, Upgrading But because it uses an FPGA, you can also • Validation Teja’s packet-processing infrastructure pro- upgrade the underlying hardware in the • Broadcast check vides access to our company’s real strength: field. For example, if a software upgrade providing data-plane applications that you requires more code store than is available, • Lookup/Next Hop calculation can customize. We deliver applications you can make a hardware change to make • Encapsulation such as packet forwarding, TCP, secure more code store available, and then the gateways, and others with source code. The software upgrade will be successful. Only Teja has implemented these in a two-stage reason for delivering source code is that if an FPGA provides this flexibility. pipeline, as shown in Figure 5. Offloads are used for the following functions: • Checksum calculation Stage 1 Stage 2 Filtering Next Hop Lookup • Hash lookup Decapsulation Encapsulation Classification Validation • Longest-prefix match Port Broadcast Check Port Access Access • Memory access (RX) (TX) Stage 1 Stage 1 This arrangement provides full gigabit Communication IP Communication IP Communication IP line-rate processing of a continuous stream

Stage 1 Stage 1 of 64-byte packets, which is the most strin- gent Ethernet load.

Figure 5 – IPv4 forwarding engine Conclusion Teja Technologies has adapted its packet- processing technology to the Virtex-4 FX you need to customize the operation of the Because a structure like this is typically family, creating an infrastructure of IP application, you can alter the delivered designed by high-level system designers blocks and APIs that take advantage of application using straight ANSI C. Even and architects, it is important that ANSI C Virtex-4 FX features. The high-level cus- though you are using an FPGA, it is still is the primary language. At the lowest level, tomizable applications that Teja offers software-programmable, and you can the hardware infrastructure, the mappings can be implemented using software design using standard software methods. between software and hardware, and the methodologies on a MicroBlaze multi- An application as delivered by Teja is software programs themselves are expressed core fabric while achieving speeds higher guaranteed to operate at a given line rate. in C. Teja has created an extensive set of than a gigabit per second. Software pro- When you modify that application, howev- APIs that allow both compile-time and grammability adds to the flexibility and er, the performance may change. Teja’s scal- real-time access from the software to the ease of design already inherent in the able infrastructure allows you to tailor the various hardware resources. Additional Virtex family. processor architecture to accommodate the tools will simplify the task of implementing The flexibility of the high-level source performance requirements in light of programs on the pipeline. code algorithms is bolstered by the fact that changed functionality. the underlying hardware utilization can be In a non-FPGA implementation, if you IPv4 Forwarding Provides Proof specifically tuned to the performance cannot meet performance, then you typical- Teja provides IPv4 and IPv6 forwarding as requirements of the system. And once ly have to go to a much larger device, which a complete data-plane application. IPv4 is a deployed, both software and hardware will most likely be under-utilized (but cost relatively simple application that can illus- upgrades are possible, dramatically extending full price). The beauty of FPGA implemen- trate the power of this packet engine. It is the potential life of the system in the field. tation is that the pipeline can be tweaked to the workhorse application under most of Teja Technologies, the Virtex-4 FX fam- be just the right configuration, and only the the Internet today. IPv6 is gradually gain- ily, and the MicroBlaze core provide a sin- amount of hardware required is used. The ing some ground, with its promise of plen- gle-chip customizable, resizable, and rest is available for other functions. ty of IP addresses for the future, but for upgradable packet-processing solution.

March 2006 Embedded magazine 37 Accelerating FFTs in Hardware Using a MicroBlaze Processor A simple FFT, generated as hardware from C language, illustrates how quickly a software concept can be taken to hardware and how little you need to know about FPGAs to use them for application acceleration.

by John Williams, Ph.D. written in VHDL or Verilog, languages methods involving hardware description CEO that are not generally part of a software languages like VHDL and Verilog. Now, PetaLogix programmer’s expertise. Other challenges with ever-higher FPGA gate densities and [email protected] have included deciding how and when to the proliferation of FPGA embedded partition complex applications between Scott Thibault, Ph.D. processors, there is strong demand for hardware and software and how to struc- even higher levels of abstraction. C repre- President ture an application to take maximum Green Mountain Computing Systems, Inc. sents that next generation of abstraction, [email protected] advantage of hardware parallelism. allowing you to access the resources of Tools providing C compilation and FPGAs for application acceleration. David Pellerin optimization for FPGAs can help solve For applications that involve embedded CTO these problems by providing a new level of processors, a C-to-hardware tool such as Impulse Accelerated Technologies, Inc. programming abstraction. When FPGAs Impulse C (Figure 1) can abstract away [email protected] first appeared two decades ago, the pri- many of the details of hardware-to-soft- mary method of design for these devices ware communication, allowing you to FPGAs are compelling platforms for hard- was the venerable schematic. FPGA appli- focus on application partitioning without ware acceleration of embedded systems. cation developers used schematics to having to worry about the low-level details These devices, by virtue of their massively assemble low-level components (registers, of the hardware. This also allows you to parallel structures, provide embedded sys- logic gates, and larger blocks such as coun- experiment with alternative software/hard- tems designers with new alternatives for ters and adders/subtractors) to create ware implementations. creating high-performance applications. FPGA-based systems. As FPGA devices Although such tools can dramatically There are challenges to using FPGAs as became more complex and applications improve your ability to create FPGA- software platforms, however. Historically, targeting them grew larger, schematics based applications, for the highest per- low-level hardware descriptions must be were gradually replaced by higher level formance you still need to understand

38 Embedded magazine March 2006 certain aspects of the underlying hardware. tively, through an analysis of how the appli- Impulse C In particular, you must understand how cation is being compiled to the hardware Compiler partitioning decisions and C coding styles and through the experimentation that C- will impact performance, size, and power language programming allows. usage. For example, the acceleration of crit- Graphical tools (see Figure 2) can help ical computations and inner-code loops to provide initial estimates of algorithm must be balanced against the expense of throughput such as loop latencies and moving data between hardware and soft- pipeline effective rates. Using such tools, ware. Fortunately, modern tools for FPGA you can interactively change optimization MicroBlaze compilation provide various types of analy- options or iteratively modify and recompile sis tools that can help you more clearly C code to obtain higher performance. Such understand and respond to these issues. design iterations may take only a matter of Hardware Accelerator Practically speaking, the initial results of minutes when using C, whereas the same MEMORY software-to-hardware compilation from C- iterations may require hours of even days PERIPHERALS language descriptions will not equal the when using VHDL or Verilog. performance of hand-coded VHDL, but Figure 1 – Impulse C custom hardware the turnaround time to get those first results Case Study: Accelerating an FFT accelerators run in the FPGA fabric to accelerate µClinux processor-based applications. working may be an order of magnitude bet- The Fast Fourier Transform (FFT) is an ter. Performance improvements occur itera- example of a DSP function that must accept sample data on its inputs and gener- ate the resulting filtered values on its out- puts. Using C-to-hardware tools, you can combine traditional C programming meth- ods with hardware/software partitioning to create an accelerated DSP application. The FFT developer for this example is compati- ble with any Xilinx® FPGA target, and demonstrates that you can achieve results similar to hand-coded HDL without resort- ing to low-level programming methods. Our FFT, illustrated in Figure 3, uti- lizes a 32-bit stream input, a 32-bit stream output, and two clocks, allowing the FFT to be clocked at a different rate than the embedded processor with which it com- municates. The algorithm itself is Figure 2 – A dataflow graph allows C programmers to analyze the generated hardware and described using relatively straightforward, perform explorative optimizations to balance tradeoffs between size and speed. Illustrated in this graph is the final stage of a six-stage pipelined loop. This graph also helps C programmers hardware-independent C code, with some understand how sequential C statements are parallelized and optimized. minor C-level optimizations for increased parallelism and performance. The FFT is a divide and conquer algo- Clk2 rithm that is most easily expressed recur- Clk1 sively. Of course, recursion is not possible on the FPGA, so the algorithm must be 32FSL 32 implemented using iteration instead. In FFT 32 32 fact, almost all software implementations FSL are written iteratively (using a loop) for efficiency. Once the algorithm has been Software Hardware implemented as a loop, we are able to Application Process enable the automatic pipelining capabilities of the Impulse compiler. Figure 3 – The FFT includes a 32-bit stream input, a 32-bit stream output, and two clocks, Pipelining introduces a potentially high allowing the FFT to be clocked at a different rate than the embedded processor. degree of parallelism in the generated

March 2006 Embedded magazine 39 The Impulse compiler generates appropriate FIFO buffers and Fast Simplex Link (FSL) interconnections for the target platform, thereby saving you from the low-level hardware design that would otherwise be needed. logic, allowing us to achieve the best pos- cations may be prototyped on desktop Xilinx MicroBlaze processor, and is deployed sible throughput. Our radix-4 FFT algo- Linux machines), a feature-rich set of net- in millions of consumer and industrial rithm on 256 samples requires working and file storage capabilities, a embedded systems worldwide. approximately 3,000 multiplications and tremendous array of existing software, and Integrating an Impulse C hardware core 6,000 additions. Nonetheless, using the no per-unit distribution royalties. into µClinux is straightforward; the Impulse pipelining feature of Impulse C, we were The µClinux (pronounced “you-see- tools include support for µClinux and can able to generate hardware to compute the Linux”) operating system is a port of the generate the required hardware/software FFT in just 263 clock cycles. open-source Linux version 2.4. The µClinux interfaces automatically, as well as generate a We then integrated the resulting FFT kernel is a compact operating system appro- makefile and associated software libraries to hardware processing core into an embed- priate for a wide variety of 32-bit, non-mem- implement the streaming and other func- ded Linux (µClinux) application running ory management unit (MMU) processor tions mentioned previously. Using the on the Xilinx MicroBlaze™ soft-proces- cores. µClinux supports a huge range of Xilinx FSL hardware interface, combined sor core. MicroBlaze µClinux is a free microprocessor architectures, including the with a freely available generic FSL device Linux-variant operating system ported at the University of Queensland and com- /* example 1 – simple use of ImpulseC-generated HW coprocessor and mercially supported by PetaLogix. * Linux FSL driver The software side of the application * / running under the control of the operating system interacts with the FFT through data #include streams to send and receive data, and to ini- #include tialize the hardware process. The streams #include #include themselves are defined using abstract com- munication methods provided in the #define BUFSIZE 1024 Impulse C libraries. These stream commu- nication functions include functions for void main(void) opening and closing data streams and read- { ing and writing those streams. Other func- unsigned int buffer[BUFSIZE]; tions allow the size (width and depth) of the streams to be defined. /* Open the FSL device (Impulse HW coprocessor)*/ int fd = open(“/dev/fslfifo0”,O_RDWR); By using these functions on both the soft- ware and hardware sides of the application, it while(1) is easy to create applications in which hard- { ware/software communication is abstracted /* Get incoming data – application dependent*/ through a software API. The Impulse com- get_input_data(buffer); piler generates appropriate FIFO buffers and Fast Simplex Link (FSL) interconnections /* Send data to ImpulseC HW processor on FSL port */ write(fd, buffer,BUFSIZE*sizeof(buffer[0]); for the target platform, thereby saving you from the low-level hardware design that /* Read the processed data back from the HW coprocessor */ would otherwise be needed. read(fd, buffer,BUFSIZE*sizeof(buffer[0]));

Embedded Linux Integration /* Do something with the data – application dependent */ The default Impulse C tool flow targets a send_output_data(buffer); standalone MicroBlaze software system. In } some applications, however, a fully featured } operating system like µClinux is required. Advantages of embedded Linux include a Figure 4 – Simple communication between µClinux applications and familiar development environment (appli- ImpulseC hardware using the generic FSL FIFO device driver

40 Embedded magazine March 2006 driver in the MicroBlaze µClinux kernel, The FIFO semantics of the FSL channels You can easily modify this basic structure makes the process of connecting the software map naturally onto the standard Linux soft- to further exploit the parallelism available. application to the Impulse C hardware accel- ware FIFO model, and to the streaming pro- One easy performance improvement is to erator relatively easy. gramming model of Impulse C. An FSL port overlap I/O and computation, using a dou- The generic FSL device driver maps the may be opened, read, or written to, just like ble-buffering approach (Figure 5). FSL ports onto regular Linux device nodes, a normal file. Here is a simple example that From these basic building blocks, you named /dev/fslfifo0 through to fslfifo7, with shows how easily a software application can are ready to tune and optimize your appli- the numbers corresponding to the physical interface to a hardware co-processing core cation. For example, it becomes a simple FSL channel ID. through the FSL interconnect (Figure 4). matter to instantiate a second FFT core in the system, connect it to the MicroBlaze /* example 2 – Overlapping communication and computation to exploit processor, and integrate it into an embed- * parallelism ded Linux application. * / An interesting benefit of the embedded Linux integration approach is that it allows #include developers to take advantage of all that #include Linux has to offer. For example, with the #include FFT core mapped onto FSL channel 0, we #include can use MicroBlaze Linux shell commands #define BUFSIZE 1024 to drive and test the core: $ cat input.dat > /dev/fslfifo0 &; cat /dev/fslfifo0 void main(void) > output.dat; { unsigned int buffer1[BUFSIZE],buffer2[BUFSIZE]; Linux symbolic links permit us to alias unsigned int *buf1=buffer1; the device names onto something more unsigned int *buf2=buffer2; user-friendly: unsigned int *tmp; $ ln -s /dev/fslfifo0 fft_core /* Open the FSL device (Impulse HW coprocessor)*/ int fd = open(“/dev/fslfifo0”,O_RDWR); $ cat input.dat > fft_core &; cat fft_core > output.dat; /* Get incoming data – application dependent*/ get_input_data(buf1); Conclusion Although our example demonstrates how while(1) you can accelerate a single embedded applica- { tion using one FSL-attached accelerator, /* Send data to ImpulseC HW processor on FSL port */ Xilinx Platform Studio tools also permit mul- write(fd, buf1,BUFSIZE*sizeof(buffer[0]); tiple MicroBlaze CPUs to be instantiated in the same system, on the same FPGA. By con- /* Read more data while HW coprocessor is working */ necting these CPUs with FSL channels and get_input_data(buf2); employing the generic FSL device driver architecture, it becomes possible to create a /* Read the processed data back from the HW processor */ small-scale, single-chip multiprocessor system read(fd, buf1,BUFSIZE*sizeof(buffer[0])); with fast inter-processor communication. In /* Do something with the data – application dependent */ such a system, each CPU may have one or send_output_data(buf1); more hardware acceleration modules (gener- ated using Impulse C), providing a balanced /* Swap buffers */ and scalable multi-processor hybrid architec- tmp=buf1; ture. The result is, in essence, a single-chip, buf1=buf2; hardware-accelerated cluster computer. buf2=tmp; To discover what reconfigurable cluster- } on-chip technology combined with C-to- } hardware compilation can do for your application, visit www.petalogix.com and Figure 5 – Overlapping communication and computation for greater system throughput www.impulsec.com.

March 2006 Embedded magazine 41 EliminatingEliminating DataData CorruptionCorruption inin EmbeddedEmbedded SystemsSystems SiliconSystems’ patented PowerArmor technology eliminates unscheduled system downtime caused by power disturbances. by Gary Drossel Director of Product Marketing SiliconSystems, Inc. [email protected]

Embedded systems often operate in less than ideal power conditions. Power distur- bances ranging from spikes to brown-outs can cause a significant amount of data and storage system corruption, causing field failures and potential loss of revenue from equipment returns. You must consider how your storage solution will operate in environments with varying power input stability. If the host system loses power in the middle of a write operation, critical data may be overwritten or sector errors may result, causing the system to fail.

Data Corruption The host system reads and writes data in minimum 512-byte increments called sec- tors. Data corruption can occur when the system loses power during the sector write operation, either because the system did not have time to finish or because the data was not written to the proper location. In the first scenario, the data in the sec- tor does not match the sector’s error- checking information. A read sector error will occur the next time the host system attempts to read that sector. Many appli- cations that encounter such an error will automatically produce a system-level error that will result in system downtime until the error is corrected.

42 Embedded magazine March 2006 In addition to losing the data, the solid- Embedded systems, on the other hand, embedded systems can integrate various state drive may thereafter interpret the usually have very strict timing require- techniques for mitigating these power-relat- read sector error as defective, and may ments. Even the slightest changes to the ed issues. These techniques are not econom- unnecessarily replace it with a spare. In host interface can cause significant issues. ically viable for consumer-based applications, general, about 1% of the storage capacity The most industry-recognized differen- but are essential to eliminate unscheduled is reserved for spares. Once the factory- tiator between solid-state storage and com- downtime in embedded systems. defined spares are depleted, the drive will mercial flash cards is in write/erase cycle SiliconSystems patented its PowerArmor fail and must be replaced. endurance. Solid-state drives have superior technology to eliminate drive corruption In another potential problem, a brown- error-correction capabilities and wear level- caused by power disturbances. Figure 1 out or low-power condition could cause ing algorithms that can significantly extend shows how PowerArmor integrates voltage- the address lines of the storage device to the life of standard storage components. detection circuitry to provide an early warn- become unstable. If this happens – but The power issues I’ve described are signifi- ing of a possible power anomaly. Once a there is still enough power to program the cantly less well-known but are much more voltage threshold has been reached, the non-volatile storage component – data prevalent in embedded applications. SiliconDrive sends a busy signal to the host could be written to the wrong address. This Approximately 75% of field failures are the so that no more commands are received again could result in a critical failure, result of power-related corruption. until the power level stabilizes. requiring drive replacement. Solid-state drives specifically designed for Next, address lines are latched (as shown These types of errors can be frustrating for you to find. At the point the drive fails, Parameter SiliconSystems SiliconDrive CF CompactFlash Card it is sent back to the factory. The factory then validates the error during the failure Write/Erase Endurance >2 M Cycles per Block <100 K Cycles per Card analysis process. However, for the vendor to determine whether or not it is a compo- Error Correction (ECC) 6 bit 1-2 bit nent failure, they must re-initialize the drive back to factory settings. After re-ini- Wear Leveling Algorithm Over the Entire SiliconDrive Over Free Space Only tialization, the drive operates normally and is sent back. This is the typical return sce- Power-Down Protection Yes No nario that flags a power issue. The critical point to understand is that R/W Speed (MBps) the drive is not physically damaged, nor is Single Sector 1-2 MBps 30-40 KBps it “worn out.” In both cases, the data will Large File 6-8 MBps 3-5 MBps be lost and downtime will occur, but the drive can be used again. Re-Qualification Cycle 3-5 Years 1 Year

Solid-State Drives versus Flash Cards Maximum Capacity 8 GB 4 GB Not all solid-state storage products are cre- ated equal. Even though they physically Table 1 – Key performance metrics distinguishing solid-state drives designed for embedded systems from flash cards used in consumer electronic devices look the same, solid-state drives in a CompactFlash (CF) form factor differ greatly from CompactFlash cards designed HOST PowerArmor for the consumer electronics market. The SYSTEM inherent technology differences are out- VOLTAGE DETECTION lined in Table 1. AND REGULATION The term “standard CompactFlash READY/BUSY card” can be a bit misleading. Flash cards R/B LOGIC 512-Byte Buffer must pass the test suite defined by the PWR OUT PWR CompactFlash Association (CFA). These VIN tests allow for a relatively wide range in ADDRESS/DATA/CONTROL Array Solid-State Storage some timing parameters, which can vary with both hardware and firmware changes. SILICONDRIVE Most consumer-oriented products have enough other system overhead to render Figure 1 – SiliconDrive with integrated PowerArmor technology these changes insignificant.

March 2006 Embedded magazine 43 Solid-state storage will continue to replace rotating hard disk drives in embedded systems as the cost per usable gigabyte (that is, the cost for the capacity required by the application) continues its rapid decline. in Figure 2) to ensure that data is written to The ability to handle power problems has time – yet the storage device may contin- the proper location. In contrast, most an impact on overall reliability, customer ue to operate. The worst-case scenario is microcontroller-based flash cards’ address goodwill, and total cost of ownership. that the first read sector error occurs in a lines can float to undetermined states if You must consider many factors when system file or critical data area. You may input power drops below the specified developing a test system that characterizes choose to run the test until it encounters minimum operating level. the effects of power disturbances on the the first read sector error or until the drive SiliconDrive technology integrates a storage device. First, the power-down ramp becomes inoperable. RISC-based DSP that allows for a 512-byte rate on power and all I/O pins must obvi- SiliconSystems has designed a general- purpose power-down tester based on the Vcc Power Supply Xilinx® ML401 development platform. This system, along with available source Threshold code to facilitate multi-threaded opera- tion, allows you to quickly qualify and val- Address Lines idate various storage media based on individual application needs. Latched Address Lines Conclusion Data Lines Solid-state storage will continue to replace rotating hard disk drives in embedded sys- tems as the cost per usable gigabyte (that is, the cost for the capacity required by the application) continues its rapid decline. Figure 2 – Latching the address lines when Vcc reaches its lower threshold The immense success of Apple’s iPod will ensure data is written to the proper location. nano, which uses solid-state storage buffer size. This is 1/4 to 1/8 the size of a ously be fast enough to emulate the loss of instead of hard drives, is currently the microcontroller-based flash card. The system power. In the case of implementing most visible example of things to come. smaller buffer size limits the time that data a CF or PC card form factor, the ramp rate This trend will, however, come with a is in volatile memory, thereby reducing the must also be able to emulate the steeper price. The engineering tradeoffs between power and time required to clear the buffer, ramp associated with pulling out the prod- storage component reliability – lower update the control bytes, and complete the uct during a write cycle. write/erase cycle endurance and higher bit- data transaction. A robust, repeatable power-down test error rates – and cost will accelerate the Larger buffer sizes require additional requires power disturbances at various inter- need for PowerArmor, enhanced error cor- capacitance to hold the power up longer. vals of the write cycle. The ability to strictly rection, and wear leveling capabilities. In This extra capacitance is physically very control and repeat this variable will expose addition, new technologies like large and will generally not scale to form any weaknesses in the write cycle and accel- SiliconSystems’ SiSMART, which moni- factors smaller than 2.5- or 3.5-inch drives. erate any failures. It is also extremely impor- tors and predicts the SiliconDrive’s SiliconDrive technology does not require tant to cut power to I/O and Vcc at the remaining usable life span, will be required this added capacitance and can therefore same time. Many test platforms may only for embedded systems with multi-year scale to virtually any industry-standard cut power to Vcc and leave the I/O pow- deployments. This will drive an even larg- form factor. ered. This will result in invalid test data and er differentiation between solid-state potential damage to the device under test. drives designed specifically for embedded Testing for Power Issues The amount of verification performed systems and flash cards designed for con- Many companies have included power- will directly impact the test time. Testing sumer electronic applications. down testing in the qualification process for after every cycle could be prohibitive, and For more information, visit www. any new storage media they are considering. read sector errors may occur at any point in siliconsystems.com.

44 Embedded magazine March 2006 A “little” Mistake That Could Cost You $100,000 Per Year

A “little” mistake is in thinking that all solid-state SiliconDrive is certified for use with the Xilinx® storage is engineered equal. System ACE™ Development Environment. Not even close. SiliconSystems SiliconDrive is advanced storage technology engineered to overcome the problems associated with hard drives and flash cards. What does this mean to you? For starters, thousands of dollars in costs savings from eliminating unscheduled downtime resulting from field failures, product wear-out or forced product re-qualifications.

To learn more about SiliconDrive and its many advantages, visit us at www.siliconsystems.com/xilinx

SiliconSystems™, SiliconDrive™, PowerArmor™ and SiSMART™ and the SiliconSystems logo are trademarks or registered trademarks of SiliconSystems and may be used publicly only with permission from SiliconSystems and require proper acknowledgement. Other listed names and brands and trademarks are trademarks or registered trademarks of their respective owners. BoostBoost YourYour Processor-BasedProcessor-Based PerformancePerformance withwith ESLESL ToolsTools Shorten design cycles and lower costs while increasing performance for Xilinx FPGAs using Poseidon’s breakthrough ESL technology.

by Farzad Zarrinfar VP of Worldwide Sales & Marketing Poseidon Design Systems [email protected]

Bill Salefski VP of Technology Poseidon Design Systems [email protected]

Stephen Simon Sr. Director of Marketing and Business Development Poseidon Design Systems [email protected]

Rapid increases in FPGA platform capa- bility are fueling a corresponding increase in complex SOC designs. This added complexity is pushing designers to rethink their traditional design flow. Designers are looking to system-level tools to aid them in making critical architectural decisions; they are also using pre-defined cores to simplify their design tasks and reduce the overall design cycle. The additions of embedded processors like the PowerPC™ and Xilinx® MicroBlaze™ soft-core processor have greatly expanded the capa- bility of these platforms and have likewise added to the overall complexity.

46 Embedded magazine March 2006 The embedded processor provides real The second critical issue is the need to methodologies to augment your architec- advantages over discrete implementations support complex memory hierarchies and tural design methodology. It is also difficult when developing complex systems: reduced system peripherals. To reach the perform- to perform an effective partition of the silicon area, higher flexibility, and a shorter ance potential of modern-day processors, hardware/software early in the design, design cycle. These advantages are con- designers have turned to memories and which is critical to an effective develop- firmed with the current rapid growth of architectures, which rely on special burst ment of the architecture. embedded FPGA designs, but they do have modes and caching to keep up with proces- To maximize the benefits of processor- some limitations. The major challenges of sor data requirements. It is critical that the based designs, you must verify architectures these designs are: memories and architectures operate in early in the design cycle. You cannot wait these modes to have a high-efficiency until RTL development to discover that your • Insufficient processor performance to system design. architecture does not support your system support ever-increasing functional Effective hardware and software parti- requirements. This “redesign loop” quickly demands tioning can be a confusing task. It is diffi- erodes time-to-market advantages, which • Complex memory hierarchy and cult to determine the proper mix of makes FPGA-based systems preferred. system architecture bottlenecks hardware and software to meet system With Poseidon tools, you can overcome • Hardware/software partitioning requirements without the costly and time- these design challenges. consuming task of moving large portions of • Implementing closely coupled an algorithm to hardware. Triton Tool Suite interfaces such as APU or FSL Special interfaces bring expanded capa- Poseidon’s Triton Tool suite is a system • Productivity limitations and dealing bility to the system architecture. These fea- design and acceleration environment that with the complexity of RTL design tures add an efficient high-speed interface enables you to quickly develop, analyze, to the processor core and are ideal for par- and optimize system architectures. With Processor solutions run out of process- titioning certain processing-intensive func- these ESL tools, the abstraction level of the ing power rapidly when implementing tions to hardware. But this capability does design is above RTL – you can quickly math-intensive operations. It is very costly come at a price. These interfaces are com- address system issues without having to to simply increase the clock rate or move plex and take a substantial amount of time solve the detailed issues surrounding RTL the newest technology to enable the design and expertise to effectively utilize when implementation. Thus, you can quickly to be scalable. These designs must be able interfacing to custom logic. perform architectural “what-if” analysis to scale the performance of the processor Designing an efficient processor-based and accelerate time to market. The tool architecture to match the ever-increasing system architecture with overall system per- suite was created specifically for processor- demand placed on the system. It is costly to formance and optimized for a specific based systems requiring efficient, robust move to new processor architectures or uti- application is not trivial; accomplishing architectures with the need to optimize lize higher performance FPGAs. this feat requires breakthrough tools and performance, power, and cost. Triton comprises two main tools: • Triton Tuner – a system and software analysis tool • Triton Builder – a hardware/software partitioning tool Triton Tuner is a simulation and analy- sis environment based on SystemC. Simulation is performed at the transaction level from models of both the processor and surrounding buses and peripherals. Using Tuner, you co-simulate the hardware with the application software. During simulation, the tool collects both hardware and software performance data. The environment then provides tools to visualize and analyze the data, reducing the effort required to identify inefficiencies Figure 1 – Bus activity graph in the design. Figure 1 shows a bus activity

March 2006 Embedded magazine 47 With Triton Builder, you can easily offload compute-intensive loops and functions from software to hardware. graph – a visualization tool to help identify environment that unobtrusively plugs ware components are exactly matched for bus congestion and bottlenecks in the sys- into a Xilinx EDK design flow, enabling trouble-free design. The tool also gener- tem design. you to quickly make dramatic improve- ates an RTL test bench and SystemC Triton Tuner also links hardware and ments in the performance and power con- model for verifying the new hardware. software events, giving you a key tool in sumption of your application. determining causal relationships between Triton Builder generates the RTL for FPGA-Based Accelerator Design Architecture hardware and software systems. This fea- the complete accelerator, as well as the The Builder tools create a design architec- ture greatly simplifies the task of evaluat- driver required to invoke the accelerator, ture ideally matched to FPGA design. Using Triton Builder, you can quickly cre- ate a peripheral using the C code that runs on the processor. The tool moves the com- Applications in ANSI C putationally intensive portions of the code Thread 3 = Poseidon-Generated Accelerator and Driver into a hardware accelerator. This accelera- Thread 1 Thread 2 Driver Driver tion hardware is connected directly onto the processor bus or the tightly coupled Off-Chip interface (APU or FSL) and is implement- Memory ed on the FPGA fabric. A block diagram MicroBlaze Cache Accelerator Accelerator I/O of a typical accelerated architecture is or 1 2 Memory shown in Figure 2. PowerPC Controller If while executing the application code the processor hits a section of code that has been moved to hardware, control is passed OPB or PLB Bus to the accelerator through the inserted driver, which then performs the accelerat- Figure 2 – Accelerated system architecture ed function. The accelerator runs inde- pendently from the processor, freeing it to ing and optimizing system performance. perform other tasks. When the accelerated Triton Tuner also provides tools to opti- Local Compute task is completed, the results are passed mize the memory structure. This can Memory Core back to the application program. You can greatly reduce the need for costly caches implement multiple independent accelera- and other high-speed memories. tors within the same system. Triton Builder is an automated parti- DMA Controller To create a complete accelerator periph- tioning tool, which simplifies the task of eral, you need more than just a C synthe- accelerating the performance of processor- sis tool. Poseidon Builder includes not just based algorithms. With Triton Builder, Bus Interface a C-to-RTL synthesizer that creates the you can easily offload compute-intensive compute core; it also generates the com- loops and functions from software to munication and control hardware. The hardware. The tool automatically creates a Poseidon tool creates a complete accelera- OPB or PLB Bus direct memory access (DMA)-based hard- tor peripheral, the block diagram of which ware accelerator to perform the offloaded is shown in Figure 3. In addition to the task. All hardware and source-code modi- compute core, the accelerator includes a Figure 3 – Accelerator block diagram fications are also created to greatly simpli- multi-channel DMA controller, bus inter- fy the re-partitioning process. face, local memories, and other logic to With the Builder tool, you can control and inserts the driver into the proper create a plug-and-play peripheral. a number of key parameters in which to place in the original application. The optimize the solution to your system RTL can be generated in either Verilog or Interfacing to Xilinx Tools requirements. Together, these tools pro- VHDL. This integral generation process Triton Tools are extremely flexible, allow- vide a system design and optimization ensures that necessary hardware and soft- ing you to use either Triton Tuner or

48 Embedded magazine March 2006 Triton Builder independently or together analyze system performance, determine that allows you to move between the tools as an integrated suite. These tools were inefficiencies, modify the system, and to develop the optimal architecture. developed to enhance the productivity in check the resulting performance. When A typical flow (shown in Figure 4) com- developing processor-based designs and the architecture performs to the desired prises these steps: vastly increase their capability. level, the system is then transferred back • The designer develops the target archi- Triton Tools link seamlessly to EDK into the Xilinx tool chain. Triton Tools tecture using selected Xilinx tools tools. A typical system design flow is usu- accelerate the process of identifying prob- ally an iterative process where you would lem areas and establish an integrated flow • The architecture description is read from the microprocessor hardware spec- ification file (.mhs) from EDK, and the ANSI C Application Code ANSI C application source code is read and into the Triton tools Architecture Description • Triton Tuner profiles the ANSI C code, Poseidon reveals bottlenecks in the code or archi- Triton Tool Suite tecture, and eliminates inefficiencies • The designer selects which software will be partitioned to hardware System Simulation Hardware/Software Performance Partitioning • Triton Builder partitions compute- Analysis Acceleraton intensive algorithms in ANSI C into hardware and generates a hardware accelerator Accelerator RTL • Triton Tuner verifies that the new sys- Modified C-Code Accelerator Model tem performs to the desired level RTL Test Bench • RTL, test bench, modified C code,

Co-Design: Hardware <> Software Partitioning driver, and architecture are exported back into the Xilinx environment Embedded Hardware Embedded Processor Software Design (XPS) Subsystem Design Conclusion Poseidon’s Triton Tool suite enables you to App SW Code IP Design HW rapidly and predictability analyze, optimize, Co-Verification BFM Entry IP RTOS and accelerate processor-based architec- Instruction

BSP Set Simulator OnChip Debug ISE Implementation tures. With Triton Tuner’s SystemC simula- Compiler Debugger tion environment, you can develop robust efficient processor architectures. With Triton Builder, you can add sophisticated hardware acceleration to your processor- based systems and generate RTL from C. Custom Memory PowerPC APU Auxillary The Triton tool suite enables design Controller Controller Processor architects to achieve higher system through- CoreConnect OPD Custom Bridge

Logic CoreConnect PLB put, reduced power consumption, and cost,

GPIO as well as shorten design cycles. This is for FPGAs implementing DSP-intensive applications using embedded Xilinx

UART PowerPC and MicroBlaze processors.

Custom For more information, visit our website FSL (optional) MicroBlaze GPIO Logic at www.poseidon-systems.com or contact a

CoreConnect OPD Other Memory sales representative at (925) 292-1670. To Controller be qualified for a free tool evaluation of the Poseidon Builder and Tuner and a free white paper, e-mail farzad.zarrinfar@ Figure 4 – Integrated Poseidon and Xilinx tool flow poseidon-systems.com.

March 2006 Embedded magazine 49 FREE on-line training with Demos On Demand

A series of compelling, highly technical product demonstrations, presented by Xilinx experts, is now available on-line. These comprehensive videos provide excellent, step-by-step tutorials and quick refreshers on a wide array of key topics. The videos are segmented into short chapters to respect your time and make for easy viewing.

Ready for viewing, anytime you are

Offering live demonstrations of powerful tools, the videos enable you to achieve complex design requirements and save time. A complete on-line archive is easily accessible at your fingertips. Also, a free DVD containing all the video demos is available at www.xilinx.com/dod. Order yours today!

www.xilinx.com/dod

Pb-free devices available now

©2006 Xilinx, Inc. All rights reserved. XILINX, the Xilinx logo, and other designated brands included herein are trademarks of Xilinx, Inc. All other trademarks are the property of their respective owners. UnveilingUnveiling NovaNova Using a single Virtex-II Pro FPGA to create a reprogrammable video switching system.

By Roger Smith Chief Engineer Echolab LLC, Inc. [email protected]

Television mixers have historically been built with dedicated hardware to achieve a specific fixed functionality. As mixers have evolved from devices built with discrete transistors to more modern mixers with advanced large-scale integration (LSI) inte- grated circuits, a common limitation has been that these devices were built with fixed signal and data paths that pre-define the topology of the mixer. Thus, a mixer targeted for two mix/effects (M/Es) and two keyers per M/E is built specifically for that function, with limited or no future adaptability. The Echolab Nova series completely breaks with tradition in this regard, moving to a completely reconfigurable platform based on a system-on-chip architecture. We used a single Xilinx® Virtex™-II Pro FPGA to create a completely repro- grammable video switching system. By absorbing the interconnects of the mixer into a single FPGA, the limitations of a fixed signal path architecture have been removed, and the topology of the mixer can be redefined again and again through- out the life of the product.

March 2006 Embedded magazine 51 Nova Family Xilinx parts is support for internal termina- clock cannot be initially used to sample all In 2004, Echolab launched the first mem- tion of high-speed differential inputs. of the incoming signals. ber of the Nova series, the Nova 1716. This Because of the high-speed nature of this Typically, most SDI mixers use individ- product is a full program/preset mixer with video I/O, the wires must be treated as ual clock and data separator circuits on each 16 inputs and 16 outputs, two downstream transmission lines, with great care paid to input so that the hardware can recover the keyers, and a full M/E upstream complete electrical termination. Historically, these individual bits from each stream. After the with two effects keyers. In 2005, we intro- termination resistors would be placed data streams are separated and decoded, duced several new members of the family. directly outside the chip, as close as possi- sync detector circuits are used to write these The Nova 1932 is a 32-input program/pre- ble to the end of the line. The need for a streams into FIFO memories. A common set mixer, with two upstream M/Es and a substantial amount of terminations so close genlock clock and reference is then used to read out the video streams from the memo- ries for effects processing downstream. This topology is not viable for Echolab’s system-on-chip architecture. The large number of clocks created by these front- end clock and data separators would over- whelm the FPGA’s support for the total number of clocks, as well as the inherent need to crowd these parts near the FPGA. The video interface to the FPGA must be Figure 1 – The Nova switcher family simpler, and require few or no parts near the FPGA. Thus, traditional clock and data full complement of six keyers. The identity4 to the chip would be a layout complication. separation techniques do not work here. is a 1 M/E 16-input look-ahead preview Because Xilinx can support internal termi- Echolab applied an asynchronous data- mixer. The identity4 brings tremendous nation of these high-speed video signals, recovery technique from Xilinx application advances in video layering, with four this has greatly simplified the architecture, note XAPP224 (“Data Recovery”) original- upstream and two downstream keyers and making the support of large blocks of high- ly developed for the networking market. five internal pattern generators, all in a speed video I/O possible. The technique uses precise low-skew clocks flight-pack-size panel and frame. The next challenge was deciphering the to sample the inputs in excess of a gigahertz. As shown in Figure 1, what is unique SMPTE 259M stream. Because the SDI The samples are examined to determine the about these mixers is that they share a streams are coming from all over the stu- location of the data bit cell transitions. The common frame and electronics, which are dio, even when genlocked (synchronizing a encoded data is extracted from the stream simply re-programmed to fit the target video source with other television signals to and can cross into the genlock clock mixer design. allow the signals to be mixed), there can be domain without ever extracting the clock large phase shifts of +/- half a line between from the input stream. For more informa- I/O these signals, and therefore, a common tion about this technique, see www. Major advances in FPGA design were nec- xilinx.com/bvdocs/appnotes/xapp224.pdf. essary to undertake such a dramatic shift in The FPGA’s ability to route nets and mixer architectures. One of the first chal- guarantee skew performances on the order of lenges that we had to overcome was how to picoseconds has enabled development and get the video bandwidth into and out of implementation of this unique SDI input. the FPGA. Another design challenge in digital mix- Even the smallest Nova family member ers has been the implementation of video (shown in Figure 2) has 16 SDI inputs and line delays and FIFOs, which have histori- 16 SDI outputs. At 270 Mbps, this is an cally been used in large numbers to time aggregate video data bandwidth of more internal video paths and outputs. It is often than 8.5 Gbps. The Nova 1732 and 1932 necessary to add delay lines to AUX bus family members have 32 inputs and 16 out- outputs to keep them in time with the pri- puts, approaching approximately 13 Gbps. mary mixer outputs. These delay lines and One of the key aspects of the Virtex-II FIFOs have typically been implemented Pro device is its ability to support I/O with discrete memory devices. bandwidths in excess of 400 MHz on all The Xilinx FPGA solution contains Figure 2 – Nova SDI I/O FPGA I/O pins. Another key feature of large numbers of video line-length memo-

52 Embedded magazine March 2006 serializers within the part. The SWITCHER SDRAM COMPACT SERIAL PORTS ETHERNET CONTROL Program DVE Frame Memory Virtex-II Pro FPGA’s ability to FLASH CARD (DB9) (RJ45) PANEL Memory (ZBT) generate multiples of the gen- © 2005 lock clock within the part with FLASH Controller UARTS MAC Memory Controller low skew allows you to create POWER PC whole sections of the chip that SDI VIDEO INPUTS can run at the SMPTE 259M (16/32) CROSSPOINT ARRAY BNC bit-serial rate of 270 MHz. This ASYNC FIFO Sampling implementation of an SDI serial rate crosspoint array (Figure 3) SDI INPUT CIRCUITS effectively limits the use of valu- BNC DVE able FPGA fabric to less than 10 Black Colorizers Generator SDI VIDEO GENLOCK OUTPUTS percent of the capacity of the SDI (16) target chip. ME 1 Delay Line ME1 OUT SERIALIZERS

FRAME BUFFERS Delay Line AUX Effects Generation Once the streams have gone VIDEO FRAME Delay Line PRG MEMORIES ME 0 PRV through the crosspoint array and Delay Line CLFD have been de-serialized, the video

CHROMAKEY buses, now “timed,” can be rout- DE-SERIALIZERS ed to the appropriate processing blocks within the FPGA to per- Xilinx Virtex-II Pro FPGA form various video effects (see Figure 4). Figure 3 – Virtex-II Pro switcher implementation The creation of video effects within the FPGA such as wipes, mixes, and keys is easily per- ries on chip, which lend themselves natu- By the time you add it all up, the formed with the basic building blocks of the rally to delay lines. Xilinx has enough of required internal crosspoint array is easily FPGA. Most basic video effects can be per- these memories on-chip to allow all AUX 30 x 30 for the 16-input mixer. To develop formed with nothing more than simple bus outputs on the Nova series to be timed. this crosspoint array as a 10-bit wide paral- combinations of addition, subtraction, and lel implementation would consume a large multiplication. Hundreds of embedded Crosspoint Array amount of resources within the FPGA. high-speed multipliers within the FPGA The next challenge was to implement a A more effective use requires the fabric allow a variety of video effects to be crosspoint array of sufficient size to support design of high-speed serializers and de- performed effortlessly with very high preci- these large mixers without overwhelming sion. the resources of the chip. Although the Embedded memory can also be used crosspoint array appears to be a reasonable for LUTs and filter coefficient storage. An size from the front panel, the array is often example of an often-used filter would be much larger because it must support all of an interpolating filter for 4:4:4 up-sam- the internal sources and functions inside pling before a DVE or Chromakey. the mixer. A high-precision circle wipe requires a The Nova 1716 has 16 external inputs, square-root function. This complicated but it also has 3 internal colorizers, black, mathematical function was implemented three internal frame buffers, and several with a CORDIC core provided by Xilinx. intermediate sources generated by the These blocks of pre-built and tested IP upstream M/E. For outputs from the from Xilinx and other third-party devel- array, each M/E requires seven video opers allow you to rapidly deploy designs buses (A/B, key 1 cut and fill, key 2 cut without having to develop and test every and fill, as well as video for borders). building block from scratch. There are also 12 AUX bus feeds and ded- Development with these IP cores can icated buses to support capture on the Figure 4 – Effects remain at a very high level, providing internal frame buffers. quick time to market. Also, the optimized

March 2006 Embedded magazine 53 size of these cores allows the design of letproof as previous generations of mixers. 6), designed to hold all of the firmware and complex mixers within a single chip. Echolab has chosen Micrium’s µC/OS- software to configure and boot the Nova. II real-time operating system (RTOS) for With a user-accessible mode switch, you Embedded PowerPC the Nova series (see www.micrium.com). can load as many as eight different on-line The computer horsepower necessary to run This OS is a priority-based, pre-emptive configurations of Nova firmware and soft- today’s large vision mixers has grown multitasking kernel that has been certified ware from a single flash card. immensely over the last dozen years. The for use in safety-critical applications in The remaining storage on the card is need to accurately support field-rate effects medical and aviation instruments. Time- available to store user data such as on multiple M/E banks while at the same critical video processing is assigned to the sequences and panel saves, as well as key time communicating with complex control highest priority task. Management of the memories and other user settings. Also, the panels and many external devices has tested file system, console I/O, and network stack Compact Flash is designed to hold all of the limits of earlier 8- and 16-bit micro- are allocated to lower priority tasks, allow- the graphics and stills online. Support for processors. ing the processor to utilize spare processor cards up to 2 GB or more provides an Most manufacturers have either used cycles in the background without ever immense storage capacity, well beyond the several smaller distributed processors or a interfering with the video hardware. archaic floppy disks found in competitive larger, faster 32-bit microprocessor. The tasks communicate with each other products. Echolab’s system-on-chip architecture (see – and synchronize their activity – with Given Nova’s unique architecture, it is Figure 5 – PowerPC™ implementation) thread-safe semaphores and message easy for the product to be extended takes advantage of two 32-bit PowerPCs queues provided by the OS. through downloadable firmware updates. These updates can be as simple as a routine

Figure 5 – PowerPC implementation

(running at 270 MHz) embedded directly System Connectivity in the fabric of the Xilinx FPGA. This tight All Nova series switchers have multiple coupling between the processor and the ports for broadcast studio interconnectivi- Figure 6 – Compact Flash mixer hardware leads to substantial per- ty. An industry-standard RS-422 port formance improvements. allows for the implementation of industry- A vast library of pre-built processor standard editing protocols. A standard RS- software patch, as complex as adding a peripherals from Xilinx and third parties 232 port is available for PC connectivity. keyer to an AUX bus output, or restructur- makes it easy for functions like serial ports, An Ethernet port allows the switcher to be ing the internal video flow within an ME memory controllers, and even Ethernet directly connected to a network. for a specialized application. Architectures peripherals to be dropped right into the Under control of Nova’s µC/OS-II, sev- as different as the 2 ME Nova 1716 (with design. Custom peripherals are also easy to eral servers are running concurrently that its program/preset architecture) and the design. provide an integrated Web server for Nova identity4 (with a six-keyer look- Several large switcher manufacturers remote status and display, an embedded ahead preview structure) can be loaded into have gone to commercial operating systems XML-RPC server for remote control, as the same hardware. like Windows or Linux to improve their well as a full TFTP server for remote software productivity. Although the early upload and download of graphics and stills. Roadmap to the Future benefits can be appealing, the downside to Next-generation Virtex-4 FPGA technology this transition is a loss of control over the Compact Flash and Re-Configurability from Xilinx will allow Echolab to move its reliability of the switcher’s code base, mak- At the heart of the Nova system is an indus- system-on-chip architecture to support high- ing a device that is not as robust and bul- try-standard Compact Flash card (Figure definition products. Virtex-4 FPGAs bring a

54 Embedded magazine March 2006 higher level of performance to the embedded logic, as well as the embedded peripherals. Get Published Some of these enhancements include: Fabric enhancements • Larger arrays • Faster • Lower power I/O enhancements • General-purpose I/O speeds to 1 GHz • Dedicated Rocket IO™ transceiver speeds beyond 10 GHz Dedicated hardware resources • Multiple tri-mode Ethernet MACs • 500 MHz multipliers with integrated 48-bit accumulators for DSP functions • Block memories now have dedicated address generators for FIFO support

Conclusion Would you like to write Television mixers have grown larger and for Xcell Publications? more complex in the last dozen years. More and more, they are the focal point for the interconnection of a wide range of studio equipment. It's easier than you think! One of the primary benefits of the sys- Submit an article draft for our Web-based or printed tem-on-chip architecture is reduced parts count. This reduction in parts count con- publications and we will assign an editor and a tributes directly to lower power, reduced graphic artist to work with you to make PCB complexity, higher reliability, and your work look as good as possible. reduced cost. Another major benefit of the system-on- For more information on this exciting and highly chip architecture is that it is almost entire- rewarding program, please contact: ly reconfigurable. This has allowed multiple products with different video architectures to be built on a common plat- form. This also lends itself to easy cus- Forrest Couch tomization for specialized applications or Publisher, Xcell Publications specific vertical markets. [email protected] As the computer network continues to play more of a role in today’s modern tele- vision studio, the Nova series will be ready with support for streaming video over Gigabit Ethernet. H.264 and WMV9 codecs will drop right into the Nova’s sys- tem-on-chip architecture, providing future features on today’s hardware. For more information, please feel free to See all the new publications on our website. see Echolab’s complete line of television www.xilinx.com/xcell mixers at www.echolab.com.

March 2006 Embedded magazine 55

Implementing a Lightweight Web Server Using PowerPC and Tri-Mode Ethernet MAC in Virtex-4 FX FPGAs Using Ethernet, you can connect your device to the Internet, monitoring and controlling it remotely.

by Jue Sun Systems Engineering Intern Xilinx, Inc. [email protected]

Peter Ryser Sr. Manager, Systems Engineering Xilinx, Inc. [email protected]

The Tri-Mode Ethernet MAC (TEMAC) UltraController-II Module (UCM) is a min- imal footprint, embedded network process- ing engine based on the PowerPC™ 405 (PPC405) processor core and the TEMAC core embedded within a Xilinx® Virtex™-4 FX Platform FPGA. It allows you to interact with your Virtex-4-based system through an Ethernet connection and to control or mon- itor your system remotely using TCP/IP from miles away. Our design uses minimal resources and ensures that you will have enough logic area for your application. In this article, we will explain the advantage of our design and how it is implemented on an ML403 board. We will also introduce a few applications that you can build on top of this implementation.

March 2006 Embedded magazine 57 Implementation The TEMAC UCM leverages key innova- tions in Virtex-4 FPGAs to implement TCP/IP applications with minimal resource usage, as shown in Figure 1. The whole implementation takes one embed- ded PPC405, one integrated TEMAC, two Virtex-4 FIFO16s, 20 slice flip-flops, and 18 look-up tables (LUTs). On the ML403 board, the TEMAC UCM connects to an external PHY through a gigabit media independent interface (GMII) and a management data input/out- put (MDIO) interface, and auto-negotiates tri-mode (10/100/1000 Mbps) Ethernet Figure 1 – General datapath of TEMAC UCM speeds. Other physical interfaces like RGMII and SGMII are possible and take a minimum amount of change in the refer- ence design that is provided as source code. The software is ported from the open- source µIP TCP/IP stack and runs com- pletely out of the PPC405’s 16 KB instruction and 16 KB data cache. It access- es Ethernet frames in two FIFO16s through the PPC405 on-chip memory (OCM) interface. One FIFO buffers inbound while the other buffers outbound Ethernet frames. The FIFOs also act as entities to synchronize clock domains between the PPC405 OCM Figure 2 – Example Web server allowing remote control of ML403 and the TEMAC. The PPC405 is capable of running the software at maximum frequen- cy, for example, 350 MHz in a -10 speed grade FPGA. The application implemented in Xilinx DBGC405DEBUGHALT C405DBGMSRWE HALT Logic Application Note XAPP807, “Minimal ISOCMBRAMWRDBUS Footprint Tri-Mode Ethernet MAC GPIO_IN[0:31] BRAMDSOCMRDDBUS GPIO_OUT[0:31] INTERRUPT ISFILL Processing Engine,” (www.xilinx.com/ EICC405EXTINPUTIRQ DCR 0x3F1 SYS_CLK bvdocs/appnotes/xapp807.pdf) runs a Web CPMC405CLOCK Reset and Interrupt PLBC405ICURDDBUS server on top of the µIP TCP/IP stack. The Vector (Hardwired)

Reset and Boot Web server serves a Web form to connect- BRAMISOCMRDBUS Code (Hardwired) Instruction Cache ing clients. You simply enter a string in a (16KB) JTAG_TCK JTGC405TCK text field and submit it to the server, which Data Cache JTAG_TDI (16KB) interprets the data and displays the string JTGC405TDI JTAG_TMS on a two-line character LCD. See Figure 2 JTGC405TMS

JTAG_TCK JTAG_TDO for a picture of the process. C405JTGTDO RSTC405RESETCORE SYS_RST Reset RSTC405RESETCHIP JTAG_TDOEN The µIP TCP/IP stack has a well- Logic C405JTGTDOEN RSTC405RESETSYS SYS_RST_OUT defined API and comes with other demon- C405RSTSYSRESETREQ stration applications like telnet. Based on Ultra the well-written µIP documentation, you PowerPC Controller-II can implement your own application with- out much effort. The stack is optimized for minimal footprint at the cost of perform- ance. The restriction on TCP/IP perform- Figure 3 – UltraController-II ports

58 Embedded magazine March 2006 Other configuration solutions besides System ACE CF can load code and data into the PPC405 caches. Such solutions include Xilinx Platform Flash as well as external processors and methods... ance is not a limiting issue for most moni- Embedded Microcontroller” (www.xilinx. nostics, display control, or math and data tor and control applications. com/bvdocs/appnotes/xapp058.pdf). manipulation operations. The cache loading solution emphasizes A system application that deals with Implementation Flow another new feature in the Virtex-4 FPGA MPEG transport streams gathers statistical Implementing the TEMAC UCM is family. The USER_ACCESS register is a information about the video and audio straightforward. The implementation flow 32-bit register that provides a port from streams. The TEMAC UMC makes this comprises three main parts: one flow in the configuration block into the FPGA information available through the Web Project Navigator for hardware bit file gen- fabric. For loading the caches, the interface. On the control side, the content eration; one flow in EDK for software ELF USER_ACCESS register is connected provider dynamically loads decryption file generation; and another flow to com- through a small state machine to the keys for encrypted streams into the system bine the software and hardware file into a JTAG port of the PPC405. A script con- through the same Web interface. single bitstream or PROM file to program verts a software ELF file into a bitstream In another example, an FPGA con- the Virtex-4 FX12 FPGA or the Platform that you can load into the processor trolled machine gathers information about Flash on the ML403 board, respectively. caches with Impact or the ChipScope™ erroneous conditions that the machine Project files and scripts for all of these flows Analyzer. If you are interested in finding manufacturer accesses locally or remotely are included in XAPP807. The hardware out more about this solution, Xilinx for diagnosis. In return, the manufacturer source code for the TEMAC UCM is avail- Application Note XAPP719, “PowerPC loads new machine parameters into the able in Verilog and VHDL. The software Cache Configuration Using the system to adjust undesired behavior. source code is written in C. USR_ACCESS_VIRTEX4 Register,” In a third example, some networking The TEMAC UCM is based on (www.xilinx.com/bvdocs/appnotes/ equipment reports its operational status on UltraController-II, as shown in Figure 3 and xapp719.pdf) provides full details. a regular basis through e-mail to a control documented in XAPP575, “UltraController- center where the information is processed. II: Minimal Footprint Embedded Processing Use Cases for the TEMAC UCM The control center equipment or personnel Engine” (www.xilinx.com/bvdocs/appnotes/ Figure 4 shows some use cases for the takes action if the equipment reports a xapp575.pdf). UltraController-II is a black- TEMAC UCM. Besides monitoring and malfunction or fails to report at all. box processing engine that includes 32 bits of control application, other applications In all of these cases, the TEMAC user-defined general-purpose input and out- include statistics gathering, system diag- UCM fits into a design for which it was put, as well as interrupt handling capability.

Loading the Software into Caches Remote Monitoring Loading software into the instruction and Display Control Industrial Control data caches of the PowerPC has been possi- ble for some time through System ACE™ CF technology or other JTAG-based meth- ods. However, for the first time, the TEMAC UCM makes this also possible Control Plane, Ultra Diagnostic through all configuration modes, including Statistics Gathering Controller-II Interfaces JTAG mode, slave and master serial modes, and slave and master SelectMap modes. Other configuration solutions besides System ACE CF can load code and data Data Conversion, into the PPC405 caches. Such solutions Variable Data & Math Complex Algorithm Manipulations include Xilinx Platform Flash as well as System Configuration external processors and methods described in application notes such as XAPP058, “Xilinx In-System Programming Using an Figure 4 – UltraController-II’s possible applications

March 2006 Embedded magazine 59 not originally designed. Its small hard- instructions (UDI). Typically, a software ated by the Mandelbrot function. The soft- ware and software footprint makes it suit- application running on the PPC405 uses ware running on the PC divides the whole able for designs that already use all of the the APU to accelerate the execution speed. picture into smaller areas and distributes the available FPGA resources. In this case, however, the application soft- parameters for these smaller areas to the ware runs on a regular PC that distributes ML403 boards through TCP connections. Network-Attached Co-Processor the workload to multiple ML403 boards The PPC405 on each ML403 board reads In a recent experiment, we combined the with integrated TEMAC UCM and APU, the parameters from the TCP socket, loops TEMAC UCM with the auxiliary proces- as shown in Figure 5. The ML403 acts as a through the area, and calculates every pixel sor unit (APU) on the PPC405. The APU network-attached co-processor, speeding using a MandelPoint co-processor connect- provides a direct way to access hardware up the application running on the PC. ed to the APU interface. The PPC405 sends accelerators by the way of user-defined For example, we compute pictures gener- the results of this calculation back to the PC through the same TCP connection. Finally, the PC collects all the results from the net- work-attached co-processors and displays Switch ML403 192.168.1.2 the final picture on the screen. Figure 6 shows the result of the acceler- PPC405 MAC ation. A single ML403 connected to the PC APU computes a 1024 x 768 picture in about three seconds, including communication overhead. Adding more ML403 boards

ML403 192.168.1.3 brings the overall computation time down below 1.5 seconds for three boards. Four PPC405 boards do not show a significant improve- PC MAC 192.168.1.100 APU ment, as communication overhead becomes the main part of the computation. Solving the same problem natively on a high-end Linux workstation takes about ML403 192.168.1.4 three seconds, about the same amount of time as one network-attached ML403 with MAC PPC405 APU TEMAC UMC and APU acceleration.

Conclusion The TEMAC UCM provides a conven- Figure 5 – Several ML403s with APU activated to accelerate computation ient and inexpensive way of adding Ethernet functionality to any design. It uses a minimal amount of FPGA resources and the software runs from the embedded PPC405 caches. As a result of Number of Boards vs. Amount of Time Taken these simple interfaces, development

3.5 time is reduced. The Web server applica- tion is used to demonstrate the design, 3 but you can use it for other solutions, as 2.5 shown with the example of the network- 2 attached co-processors. 1.5 For more information about the Time/Sec 1 TEMAC UltraController Module, down- 0.5 load XAPP807, including the reference 0 design for the Xilinx ML403 board, and see 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 the Xilinx Webcast, “Learn about the UltraController-II Reference Design with Number of Boards PowerPC and Tri-Mode EMAC in Virtex-4 FPGAs,” at www.xilinx.com/events/webcasts/ Figure 6 – Use multiple boards to shorten computation time 110105_ultracontroller2.htm.

60 Embedded magazine March 2006 DevelopmentDevelopment KitsKits AccelerateAccelerate A single Virtex-4 FX12 EmbeddedEmbedded DesignDesign Development Kit supports both PowerPC and MicroBlaze .

by Jay Gould suming task of building custom hard- change wildly from one product to the Product Marketing Manager, ware. By starting with a “working” hard- next. Having multiple processor core Xilinx Embedded Solutions Marketing ware platform, embedded teams can choices and the flexibility to change the Xilinx, Inc. evaluate the merits of one processor core design after the development cycle has [email protected] versus another, begin writing application started is highly desirable. code, and even experiment with IP Xilinx offers system developers the Do you always have the best balance of peripherals before prematurely commit- choice of high-performance, “hard” processor, performance, IP, and peripherals ting to a specific hardware design. PowerPC™ or flexible “soft” Xilinx® on your first embedded application design A development kit should provide a MicroBlaze™ processor cores for embed- partition? Would experimenting with cus- stable hardware evaluation environment, ded designs. The PowerPC cores provide tomizable IP and a choice of hard- and/or complete with all required cables and high performance because they are hard- soft-processor cores give you a better feel probes, so that you can focus on your immersed into the Virtex™-4 FPGA for the best fit to your embedded applica- own application and not worry about device fabric. They also have additional per- tion before committing to devices and debugging problems with a new board or formance-enhancing features, such as inte- hardware? Programmable platforms allow broken connection. Imagine the time-to- grated 10/100/1000 Mbps Ethernet and powerful customization of processor-based market advantages of being able to imme- Auxiliary Processor Unit (APU) controllers. systems, but which one do you start with? diately write, test, and debug code on a The 32-bit RISC MicroBlaze soft IP Why not utilize a development kit that working reference board well in advance processor can be instantiated in any of the supports it all? of any custom hardware being ready. Xilinx Platform FPGAs because it is built Ideally, modern development kits pro- like a macro out of FPGA elements. vide a comprehensive design environment Processor “P” or Processor “M”? Although the hard PowerPC processor will with everything embedded developers Choosing the most appropriate processor always be faster and smaller by nature, the require to create processor-based systems. for a specific embedded application is MicroBlaze soft-processor core has the They should include both the hardware always a design concern. A processor used flexibility to instantiate at any time dur- platform and software tools so that you on a previous project may not be a good fit ing the design cycle. MicroBlaze cores can can get started creating modules to prove for the next project. Requirements for per- also be used as complements to PowerPC out a design concept before the time-con- formance, features, size, and cost may cores in Virtex-4 platforms, often provid-

March 2006 Embedded magazine 61 ing workload distribution to optimize total The Virtex-4 FX device also supports an for Virtex-4 FX12 designs. The kit compris- system performance. APU controller that provides a high-band- es the following contents (Figure 2): With a unified strategy of supporting width interface between the PowerPC 405 • Virtex-4 FX12 development both processors with the same IP library core and co-processors to execute custom board – ML403 and design tool suite, you have the power to instructions in the FPGA fabric. choose the best processor/IP configuration Additionally, the ML403 showcases the • Platform Studio embedded tool for any given design requirement. With this FX12 implementation of two fully inte- suite and Embedded Development scenario, you do not have to throw away grated 10/100/1000 Ethernet MACs for Kit (EDK) good work or start a design over again with system communication and management • ISE™ (Integrated Software different tools or IP libraries just because a functions. These FX capabilities enable Environment) FPGA tools processor change has been made. developers to optimize their designs for high performance. • JTAG probe, Ethernet, and Best of Both Worlds serial cables The Virtex-4 FX family of FPGAs com- Completely Integrated Development Kit bines the best of both hard- and soft-pro- The Xilinx PowerPC and MicroBlaze • ChipScope™ Pro Analyzer cessing options with a unique format for Development Kit Virtex-4 FX12 Edition (Evaluation Version) the embedded industry. For example, the integrates a complete environment for • Reference designs powerful Virtex-4 FX12 device implement- embedded development. The kit supports ed on the Xilinx ML403 development both the PowerPC 405 immersed hard In addition to the ML403 board, the kit board (Figure 1) offers an immersed processor and the MicroBlaze soft processor showcases the IEC DesignVision award- PowerPC core at a value price point. This winning Xilinx Platform Studio (XPS) same device and board can easily support embedded tool suite. XPS is the integrated the addition of MicroBlaze soft-processor development environment that includes the designs, creating one unique platform sup- design GUI, automated configuration wiz- porting two core options. ards, compiler, and debugger. XPS is built Engineers researching the appropriate on the Eclipse framework and supports the processor choice for their next project can GNU tool chain. Design wizards automate now experiment with a broader set of the process of configuring the processor- processor and IP offerings while making based system, connect and customize the IP, their decision. With a single tool suite and and organize the project. Additionally, IP library supporting both processor Platform Studio can automatically generate Figure 1 – ML403 development board options, you can really do an apples-to- example test code, software drivers, and even apples evaluation of the benefits versus your BSPs for some of the most popular RTOSs. own design requirements for the best fit. The ML403 development board pro- vides a rich set of features, including periph- erals, memory, audio, video, and user interfaces, enabling you to easily and cost- effectively prototype your embedded system design. The actual board itself includes: • Memory interfaces for DDR SDRAM, ZBT SRAM, and flash • Audio and video interfaces • Numerous user interfaces: dual PS/2, IIC Bus, RS-232, USB, and tri-mode Ethernet • Multiple FPGA programming modes: Platform Flash, the System ACE™ solution, Linear Flash, and PC4 • Support for multiple clock sources and differential clock inputs Figure 2 – Virtex-4 FX12 PPC/MicroBlaze Development Kit

62 Embedded magazine March 2006 XPS is fully aware of the ML403 devel- ger so that you can examine the state of the These reference systems can save you opment board and, unlike “universal” hardware. Alternatively, if you locate a days and even months of development time tools, automatically populates the GUI problem after a hardware event, cross-trig- compared to manually generating every with the feature options supported by that ger the software debugger to step through design module yourself. Leveraging existing board. Intelligent tools automate the flow, the code that is executing at that time. The examples jump-starts your design cycle. reduce learning curves, and accelerate the FX12 kit includes an evaluation version of design process. Users are amazed that they the Xilinx ChipScope Pro hardware debug- Conclusion can create a basic embedded system using ging tool to encourage you to explore the A complete development environment of Platform Studio’s automated flow in less merits of platform debug. hardware board, design tools, IP, and pre- than 15 minutes. verified reference designs can dramatical- EDK bundles the XPS tool suite with Pre-Verified Reference Designs ly accelerate embedded development. the impressive embedded IP library and The last and critical ingredient of the inte- Additionally, for a quick, out-of-the-box MicroBlaze processor license. This is a one- grated development kit that can really jump- experience, the ideal development envi- time license; there is no royalty to be paid start your entire design process is a collection ronment also provides all of the extra for MicroBlaze designs shipped. The IP of reference designs or reference systems. By JTAG probe, serial, and Ethernet cables. library supports the CoreConnect bus, including pre-verified or pre-existing work- Intelligent, award-winning design tools bridge, and arbiters, and offers a large ing example designs with the kit, you can that are “platform aware” make the kit peripheral catalog including more than 60 unpack the box and have the basic system up easy to use, providing wizards that help memory controllers, Ethernet, UARTs, and running in minutes. Reference designs you configure the system by automating timers, GPIO, DMA, and interrupt con- can prove that the hardware and connections the flow for the known features on the trollers, as well as many other cores. are working before you start creating new development board. ISE FPGA tools are the design utilities code or IP, and prevent you from mistakenly The programmable platform and intelli- employed for the FPGA implementation, debugging your design when what you really gent XPS tools provided with the PowerPC including entry, synthesis, verification, have is a bad board or cable. and MicroBlaze Development Kit enable and place and route. This design flow can These reference systems also act as you to craft embedded systems with the be invoked directly from the Platform examples for the broad set of features on optimal combination of features, perform- Studio IDE. the ML403 platform, such as Ethernet, ance, area, and cost. You can choose the Target boards need a connection for DDR memory, video, and audio functions. most effective processor core for the target the various kinds of communication com- You can use these examples as templates to application, customize IP, optimize the per- ing from the host computer where tools get your own design features modeled, or formance, and validate the software on a are executed and design files created. The run as-is if your custom board targets the development board before your own hard- most common method of connection to same feature. ware is even back from the shop. an embedded target board is through an The FX12 Development Kit includes Engineers need options and flexibility industry-standard JTAG probe. Xilinx boot-able eOS (embedded operating sys- when trying to satisfy all of their project offers a choice of either parallel or USB tems) or RTOS examples for Wind River requirements. The Xilinx Virtex-4 FX12 for JTAG probes; this single connection Systems’ VxWorks and MontaVista embed- Development Kit uniquely offers two can be used for both FPGA ded Linux from a Compact Flash device. The processor cores for easy evaluation in a sin- download/debugging and embedded soft- ML403 board is supported by other third- gle, integrated environment. A single IP ware download/debugging. This capabili- party embedded RTOS or hardware/software library and common tool suite unifies the ty reduces your need for multiple probes design tool partners as well. design environment for both cores, pro- and the inconvenience of constantly Sample reference systems include: viding total embedded architecture flexi- swapping probes. The FX12 kit also bility. The inclusion of numerous • PowerPC Reference System with includes Ethernet and serial cables. pre-verified reference designs empowers VxWorks and Linux One unique, powerful feature that you to jump-start the development cycle Xilinx offers is “platform debug” – the inte- • MicroBlaze Reference System so that you can spend more time adding gration of the embedded software debugger • DCM Phase Shift Using MicroBlaze value to your end application. and hardware debugger. By integrating the Reference System To learn more about the low-cost Virtex- cross-triggering of both hardware and soft- 4 FX12 Development Kit supporting both ware debuggers, embedded engineers can • UltraController-II Reference Design PowerPC and MicroBlaze processor cores, now find and fix system bugs faster. Can’t • Gigabit System Reference Design please visit www.xilinx.com/embdevkits. A detect the problem when the software goes (GSRD) good starting point to learn about all of off into the weeds? Have the software our embedded processing solutions is debugger cross-trigger the hardware debug- • APU Co-Processing Acceleration www.xilinx.com/processor.

March 2006 Embedded magazine 63 MicroBlaze – The Low-Cost and Flexible Processing Solution

Finding a processor to meet performance, feature, and cost targets can be very challenging in today’s competitive environ- ment. With the continued advances in FPGA technology features, increased performance and higher density devices, scalable processor systems can now be offered as an economical, superior alternative for real-time processing needs. A flexible processor system that’s easy-to- use, area-efficient, optimized for cost-sensitive designs, and The MicroBlaze Advantage able to support you well into Xilinx unleashes the potential of embedded FPGA designs with the award-winning MicroBlaze soft processor solution. The MicroBlaze core is a 3-stage pipeline 32-bit the future is delivered by RISC Harvard architecture soft processor core with 32 general purpose registers, ALU, the award-winning Xilinx and a rich instruction set optimized for embedded applications. It supports both on- MicroBlaze™ solution. chip block RAM and/or external memory. With the MicroBlaze soft processor solution, you have complete flexibility to select any combination of peripherals, memory and The Xilinx MicroBlaze interface features that you need to give you the best system performance at the lowest processor, named to EDN’s Hot cost on a single FPGA. 100 Products of 2005, is a 32-bit Hardware Acceleration using Fast Simplex Link The MicroBlaze Fast Simplex Link (FSL) lets you connect hardware co-processors to RISC “soft” core operating at up accelerate time-critical algorithms. The FSL channels are dedicated uni-directional to 200 MHz on the Virtex™-4 point-to-point data streaming interfaces. Each FSL channel provides a low latency interface to the processor pipeline making them ideal for extending the processor’s FPGA and costs less than 50 execution unit with custom hardware accelerators. cents to implement in the Floating-Point Unit Support Spartan™-3E FPGA. Because the MicroBlaze introduces an integrated single precision, IEEE-754 compatible Floating Point Unit (FPU) option optimized for embedded applications such as industrial control, processor is a soft core, you can automotive, and office automation. The MicroBlaze FPU provides designers with a choose from any combination processor tailored to execute both integer and floating point operations. of highly customizable features Hardware Configurability The MicroBlaze processor solution provides a high level of configurabilty to tailor the that will bring your products processor sub-system to the exact needs of the target embedded application. to market faster, extend your Configurable features such as: the barrel shifter, divider, multiplier, instruction and data product’s life cycle, and avoid caches, FPU, FSL interfaces, hardware debug logic, and the hardware exceptions, provide great flexibility but does not add to the cost if they are not used. processor obsolescence. Award-Winning Platform Studio Tool Suite The Embedded Development Kit (EDK) is an all encompassing solution for designing embedded programmable systems. This pre-configured kit includes the award-winning Platform Studio™ Tool Suite, the MicroBlaze soft processor core as well as all the documen- tation and soft peripheral IP that you require for designing FPGA-based embedded processor systems.

www.edn.com

64 Embedded magazine March 2006 Embedded Development Kit MicroBlaze Hardware Options and Configurable Blocks and Platform Studio Tool Suite Hardware Functions For development, Xilinx offers the Embedded Development Kit (EDK), • Hardware Barrel Shifter which is the common design environment for both MicroBlaze and • Hardware Divider PowerPC-based embedded systems. The EDK is a set of microprocessor • Machine Status Set and Clear Instructions design tools and common software platforms, such as device drivers • Hardware Exception Support and protocol stacks. The EDK includes the Platform Studio tool suite, • Pattern Compare Instructions the MicroBlaze core, and a library of peripheral IP cores. • Floating-Point Unit (FPU) • Hardware Multiplier Enable Using these tools, design engineers can define the processor subsystem • Hardware Debug Logic hardware and configure the software platform, including generating a Board Support Package (BSP) for a variety of development boards. Cache and Cache Interface Platform Studio Software Development Kit (SDK) is based on the • Data Cache (D-Cache) Eclipse open-source C development tool kit and includes a full-featured • Instruction Cache (I-Cache) development environment and a feature-rich GUI debugger. The • Instruction-side Xilinx Cache Link (IXCL) MicroBlaze processor is supported by the GNU compiler and debugger • Data-side Xilinx Cache Link (DXCL) tools. The debugger connects the MicroBlaze via JTAG. For debugging Bus Infrastructure visibility and control over the embedded system, design engineers can • Data-side On-chip Peripheral Bus (DOPB) add the ChipScope Pro™ verification tools from Xilinx, which are • Instruction-side On-chip Peripheral Bus (IOPB) integrated into the hardware/software debug capabilities of the EDK. • Data-side Local Memory Bus (DLMB) • Instruction-side Local Memory Bus (ILMB) Device Family Max Clock Frequency Max Dhrystone 2.1 Performance • Fast Simplex Link (FSL) Virtex-4 200 MHz 166 DMIPS

Virtex-II Pro 170 MHz 138 DMIPS Take the Next Step www.xilinx.com/microblaze Spartan-3 100 MHz 92 DMIPS Visit our website for more information . To order your Embedded Development Kit visit www.xilinx.com/edk. Note: The maximum clock frequency and maximum Dhrystone 2.1 performance benchmarks are not based on the same system. Depending on the configured options, the MicroBlaze soft processor core size is about 900 – 2600 LUTs.

Instruction-side Data-side bus interface bus interface

D-Cache Multi- Multi- I-Cache ALU DOPB OPB OPB IOPB Channel Memory OPB Memory Channel Memory Memory Program Controller Peripherals Controller Counter Special Shift Controller Controller Purpose Registers Barrel Shift IXCL DXCL On-chip Peripheral Bus (OPB) Multiplier

Divider

Bus FPU Bus IF IF DLMB Instruction ILMB Buffer HW/SW Accelerator

Instruction FSL Decode Block RAM Register File 32 X 32b

Basic Processor Functions Configurable Functions Designer Defined Blocks Peripherals – Xilinx or 3rd Party or Designer Defined

Corporate Headquarters European Headquarters Japan Asia Pacific Distributed By: Xilinx, Inc. Xilinx Xilinx, K.K. Xilinx Asia Pacific Pte. Ltd. 2100 Logic Drive Citywest Business Campus Shinjuku Square Tower 18F No. 3 Changi Business Park Vista, #04-01 San Jose, CA 95124 Saggart, 6-22-1 Nishi-Shinjuku Singapore 486051 Tel: (408) 559-7778 Co. Dublin Shinjuku-ku, Tokyo Tel: (65) 6544-8999 Fax: (408) 559-7114 Ireland 163-1118, Japan Fax: (65) 6789-8886 Web: www.xilinx.com Tel: +353-1-464-0311 Tel: 81-3-5321-7711 RCB no: 20-0312557-M Fax: +353-1-464-0324 Fax: 81-3-5321-7765 Web: www.xilinx.com Web: www.xilinx.com Web: www.xilinx.co.jp

© 2006 Xilinx, Inc. All rights reserved. XILINX, the Xilinx logo, and other designated brands included herein are trademarks of Xilinx, Inc. PowerPC is a trademark of IBM, Inc. All other trademarks are the property of their respective owners.

March 2006 Embedded magazine 65

SeamlessFPGA_PrintAd.eps 3/6/06 8:53:33 AM NOT ALL CODE IS HARD TO UNDERSTAND

/**********************************/ /* FPGA embedded challenge */ /**********************************/

volatile project; const short schedule; complex hardware, software;

if (FPGA && CPU) { success = seamless_FPGA(symbolic_debug, early_HW_access, easy2use); performance = 1000 * faster; visibility++; } else { visibility = NULL; performance = SLOW; vacation = 0; }

// evaluate it at www.seamlessFPGA.com

INTEGRATED SYSTEM DESIGN + DESIGN FOR MANUFACTURING + ELECTRONIC SYSTEM LEVEL DESIGN +

Hardware/Software Integration You work late nights and weekends, but that can only get you so far when you have a huge device with logic, memory, processors, complex IP – and a tight schedule. How do you ensure that hardware/software integration goes smoothly? Seamless® FPGA from Mentor Graphics® is the only hardware/software integration tool that matches support for the Virtex FPGA family with models for the PowerPC and MicroBlaze processor architectures, giving you full software and THE EDA TECHNOLOGY LEADER hardware visibility and the performance you need to spot hardware/software integration issues early in the design cycle. To learn more about Seamless FPGA, go to www.seamlessFPGA.com, email [email protected] or call 800.547.3000.

©2006 Mentor Graphics Corporation. All Rights Reserved. Mentor Graphics is a registered trademark of Mentor Graphics Corporation. Xilinx is Embedded Processing

Discover endless possibilities as Xilinx brings you hands-on, FREE workshops at ESC Silicon Valley. You’ll gain valuable embedded design experience in real time. And only Xilinx Platform FPGAs offer programmable flexibility with the optimal choice of integrated hard and/or soft processors — that means fast and flexible solutions for your processing needs.

FREE Hands-On Workshops (90 minutes each) Room C1  High Performance Design with the Embedded PowerPC and Co-Processor Code Accelerators (April 4 — 10am, 2pm & 4pm)  Learn to Build and Optimize a MicroBlaze Soft Processor System in Minutes (April 5 — 10am, Noon, 2pm & 4pm)  Design and Verify Video/Imaging Algorithms with the Xilinx Video Starter Kit (April 6 — 9am, 11am & 1pm)

Live Demonstrations Explore embedded processing with the flexible PowerPC™ and MicroBlaze 32-bit processor cores, plus XtremeDSP performance and our PCI Express solutions. And see for yourself why the embedded industry has recognized award-winning products like Platform Studio and MicroBlaze.

Xilinx will also offer numerous Theatre Presentations and Technical Program Papers. Check in at booth #315 for a program schedule, and find out why Xilinx is embedded processing. Visit Xilinx at Embedded Systems Conference Silicon Valley, April 4 –6, 2006 — Booth #315 IN-DEPTH PRODUCT DEMONSTRATIONS & PRESENTATIONS | FREE HANDS-ON WORKSHOPS

©2006 Xilinx, Inc. All rights reserved. XILINX, the Xilinx logo, and other designated brands included herein are trademarks of Xilinx, Inc. All other trademarks are the property of their respective owners. PN 0010924