August 09, 2006
Converting C code to HDLHow to accelerate algorithms by automatically generating FPGA coprocessorsConverting C code to an HDL accelerator with a C-to-HDL tool is an efficient method for creating hardware coprocessors. The illustration in Fig 3 and the steps detailed below this figure summarize the C-to-HDL conversion process:
![]() 3. C-to-HDL design flow.
Impulse: C-to-HDL tool
![]() 4. Impulse C. Impulse C is designed for dataflow-oriented applications, but it is also flexible enough to support alternate programming models, including the use of shared memory. This is important because different FPGA-based applications have different performance and data requirements. In some applications, it makes more sense to move data between the embedded processor and the FPGA through block memory reads and writes; in other cases, a streaming communication channel might provide higher performance. The ability to quickly model, compile, and evaluate alternate algorithm approaches is an important part of achieving the best possible results for a given application. To this end, the Impulse C library comprises minimal extensions to the C language in the form of new data types and predefined function calls. Using Impulse C function calls, you can define multiple, parallel program segments (called processes) and describe their interconnections using streams, signals, and other mechanisms. The Impulse C compiler translates and optimizes these C-language processes into either:
The complete CoDeveloper development environment includes desktop simulation libraries compatible with standard C compilers and debuggers, including Microsoft Visual Studio and GCC/GDB. Using these libraries, Impulse C programmers are able to compile and execute their applications for algorithm verification and debugging purposes. C programmers are also able to examine parallel processes, analyze data movement, and resolve process-to-process communication problems using the CoDeveloper Application Monitor. The output of an Impulse C application, when compiled, is a set of hardware and software source files that are ready for importing into FPGA synthesis tools. These files include:
The result of this compilation process is a complete application, including the required hardware/software interfaces, ready for implementation on an FPGA-based programmable platform.
Design example
![]() 5. Mandelbrot image and code acceleration. The Mandelbrot image is an ideal candidate for hardware/software co-design because it has a single computation-intensive function. Making this critical function faster by moving it to the hardware domain significantly increases the speed of the whole system. The Mandelbrot application also lends itself nicely to clear divisions between hardware and software processes, making it easy to implement using C-to-HDL tools. We used the CoDeveloper tool set as the C-to-HDL tool set for this design example. We modified a software-only Mandelbrot C program to make it compatible with the C-to-HDL tools. Our changes included division of the software project into distinct processes (independent units of sequential execution); conversion of function interfaces (hardware to software) into streams; and the addition of compiler directives to optimize the generated hardware. We subsequently used the CoDeveloper tool set to create the Pcore coprocessor that was imported into Xilinx Platform Studio (XPS). Using XPS, we attached the PC to the PowerPC APU controller interface and tested the system. Xilinx Application Note XAPP901 provides a full description of the design along with design files for downloading. Meanwhile, User Guide UG096 provides a step-by-step tutorial in implementing the design example.
Performance improvement examples
![]() Table 2. Algorithm acceleration through coprocessor accelerators.
Conclusion Using a C-to-HDL tool such as Impulse C enables quick and easy accelerator generation. Virtex-4 FX FPGAs, with one or two embedded PowerPCs, enable tight coupling of the processor instruction pipeline to software accelerators. As demonstrated in this article, critical software routines can be accelerated from 10X to more than 30X, enabling a 300 MHz PowerPC to provide performance equaling or exceeding that of a high-performance multi-gigahertz processor. The above examples were generated in just a few days each, demonstrating the rapid design, implementation, and testing possible with a C-to-HDL flow. Glenn Steiner is Sr. Engineering Manager, Advanced Products Division Xilinx, Inc. Glenn can be reached at glenn.steiner@xilinx.com. Kunal Shenoy is a Design Engineer, Advanced Products Division Xilinx, Inc. Kunal can be reached at kunal.shenoy@xilinx.com. Dan Isaacs is Director of Embedded Processing, Advanced Products Division Xilinx, Inc. Dan can be reached at dan.isaacs@xilinx.com. David Pellerin is Chief Technology Officer at Impulse Accelerated Technologies. David can be reached at david.pellerin@impulsec.com. Editor's Note: This article first appeared in the Xilinx Embedded Magazine and is presented here with the kind permission of Xcell Publications.
|
|
||||||||||||||||||||||||||||
|
|
|
|