|
Create efficient, speedy code
with the Diab XE C/C++
Compiler Suite for Xilinx FPGAs.
All compilers share many common features.
However, compilers designed specifically for
embedded systems have several unique
requirements:
- Flexibility and control
- Strict adherence to standards
- Industry-leading optimization technology.
The Diab™ C/C++ Compiler Suite
from Wind River Systems® has gained an
industry-wide reputation for generating the
fastest and smallest code. However, it takes
more than performance to become the
leading embedded compiler.
In this article, we will introduce the
Diab XE (Xilinx Edition) embedded compiler
from Wind River and explain how it
can help you develop a superior embedded
processing system with Xilinx Virtex-II
Pro™ FPGAs and IBM PowerPC™
(PPC)-enabled devices.
Adherence to Standards
Standards are critical for portability and
interoperability with other tools. The
Diab XE compiler uses the latest version
of the EDG (Edison Design Group) C++
front end and is 100% compliant with
American National Standards Institute
(ANSI) C++ standards. The Diab XE
compiler also uses run-time libraries
from Dinkumware™ Ltd., which provides
100% ANSI compliance for runtime
libraries and the Standard Template
Library (STL).
For applications where code size is
critical, the Diab XE compiler provides
an abridged version of the C++ run-time
library. This version of the library is also
100% standards-complaint, but it is
built with exception processing disabled,
thereby generating much smaller
applications. Tests have shown this
library to result in code sizes as much as
38% smaller.
Another aspect of standards compliance
is output formats. The Diab XE
compiler maintains strict compliance
with the various embedded application
binary interfaces (EABIs). Wind River also
works with embedded processor vendors to
stay current and is actively involved with
the development of EABIs.
Adherence to standards leads to easier
porting and ensures interoperability with
other development and maintenance tools.
Modular Architecture
As shown in Figure 1, the Diab XE compiler
is based on a modular design comprising
three primary modules:
- The front-end: Source code language
is parsed into tokens. These tokens are
the same regardless of the language
used – C, C++, Java, and others.
- The optimization stage: Optimizations
are applied to all languages, because
the tokens generated by the front-end
are the same regardless of language.
- The back-end: Code is generated. This
stage is target-specific. Diab XE’s modular
design permits the compiler to
fully utilize the architecture of the IBM
PowerPC 405 microprocessors within
Xilinx FPGAs.
Diab XE’s modular design enables you
to take advantage of all non-target-specific
optimizations. As the front-end and optimization
stages are shared, all advancements
made in these stages apply to
supported Diab XE target architectures.
Optimization Technology
Optimization falls into two primary areas –
front-end and back-end. Front-end optimizations
are concerned with the language.
Back-end optimizations use architecture-specific
code generation to use the design
aspects of the particular target processor.
Although almost all compilers do a
good job with front-end optimizations, the
Diab tool suite distinguishes itself from
other compilers with its efficient back-end
optimization technology.
The growing hardware complexity of
today’s processor designs makes it very difficult
to manually fine-tune applications.
The Diab XE compiler is specifically engineered
to enable you to maximize
pipelines, caches, and other architecture-specific
capabilities, including the IBM PowerPC 405 cores in Xilinx FPGAs.
The Diab XE compiler can further optimize
your application code based on application
profile information. No more
manual tweaking of your code is required –
the Diab XE compiler will do this for you.
Because Wind River Systems owns and
controls the technology that drives the
Diab XE compiler, they can advance the
technology on their own schedule without
requiring approval from an outside source.
Flexibility and Control
Embedded systems typically have many
design constraints – limited memory, limited
performance. To meet the demands imposed
by these constraints, an effective embedded
compiler must provide a wide range of flexibility
and control, with features such as:
- Addressing modes, which can have a
direct impact on both performance
and code size. The Diab XE compiler
uses intelligent default settings, but it
provides options to give you complete
control. Separate options also exist for
specifying both code and data modes.
- Support for position-independent code
and data (PIC/PID).
- Structure and bit-field packing. Here
too, intelligent defaults are used, but
with options for complete control over
how structures are packed and how
structure members are aligned. You can
also specify the type (short, int, long)
used for bit-fields.
- Function inlining, which can result
in significant performance gains.
Although all compiler vendors make
use of this technique, only the Diab
XE compiler enables you to specify
the precise size of the functions to be
inlined, giving you control over the
memory footprint.
- Loop unrolling. This is similar to
function inlining, because it can
result in significant performance
gains. Most compiler vendors use
loop unrolling. However, only the
Diab XE compiler gives you the ability
to control both the size of loops to
be unrolled and the number of times
to unroll them.
- Embedded assembly code. The Diab
XE compiler provides two methods: a
relatively simple string-based assembly
function and a powerful macro-based
function. The string-based approach
is ideal for writing values to a register.
The macro approach provides total
flexibility and control over which
registers are used for the macros.
- Diab XE’s robust linker command
files provide the controls for you to
precisely place all program elements in
the correct memory locations. Because
embedded applications often have
strict requirements for locating variables,
functions, and data in memory,
this is an especially important feature
when designing systems with multiple
memory types and sizes.
Quality Documentation
Diab XE’s documentation makes it easy to
learn about and take advantage of the compiler’s
power, flexibility, and control. All manuals have separate sections devoted to
each component in the suite:
- Compiler
- Assembler
- Linker
- Utilities
- Libraries
- ELF/COFF formats.
Brief Comparison with GNU GCC
The 2.96 release of the GNU Compiler
Collection (GCC) for C/C++ is a robust
and efficient compiler. Yet it lacks some of
the features for a truly effective embedded
compiler, because it was originally developed
for computer systems running the
Unix™ operating system.
For example, the GNU GCC C/C++
2.96 release does not recognize the PowerPC
405 core as a specific target and cannot take
advantage of PPC 405-only registers.
When your application needs to be as
small and as fast as it can be, the Diab XE
compiler will provide you with superior
results. The accompanying sidebar “High
Performance or Small Footprint?” clearly
shows the superiority of the Diab XE
C/C++ Compiler 5.6 when compared to
the GNU GCC C/C++ 2.96 in four critical
parameters:
- Dhrystone performance in milliseconds
- Dhrystone code size
- DES application performance
- DES application size.
Conclusion
As a core development tool, the Diab XE
C/C++ Compiler Suite enables you to create
exceptionally fast, tight code for your
embedded applications.
The superior flexibility and control
afforded by the Diab XE compiler enables
developers to fine-tune the compiler’s output
to meet and exceed the needs of
demanding embedded applications.
The Diab XE C/C++ Compiler Suite is
included in the Wind River package, which
is available from Xilinx at www.xilinx.com
(search for “Diab XE C/C++ Compiler”).
This version is full featured but limited to
a fully linked object size of 256 KB –
enough room to develop small applications
and well suited to Virtex-II Pro FPGAs
with embedded PowerPC processors.
Printable PDF version of this article with graphics. (12/11/03)370 KB |