Software Directory: DSP-C "Fix Points" C

Dec. 9, 2002
It started as an idea to handle DSP fixed-point features. However, the proposed ISO/IEC WDTR 18037 standard, also known as "Programming languages, their environments and system software interfaces—extensions for the programming language C...

It started as an idea to handle DSP fixed-point features. However, the proposed ISO/IEC WDTR 18037 standard, also known as "Programming languages, their environments and system software interfaces—extensions for the programming language C to support embedded processors," now looks like it will be incorporated into the C standard in 2003.

The C extension isn't just applicable to DSPs, although it has its roots in a proposal from ACE Associated Compiler Experts (www.ace.nl) of Amsterdam. The extension includes three major enhancements: fixed-point arithmetic, multiple-address space support, and basic I/O hardware addressing.

Fixed-Point Arithmetic: Standard C includes integer and floating point as basic data types. It doesn't support fixed-point arithmetic. Unfortunately, DSPs often support fixed-point arithmetic, so only a number of undesirable alternatives have existed for developers wanting to use C and fixed-point support. Motorola takes a portable approach using macros and functions. Others use nonstandard compiler extensions. Of course, an assembler is always an option.

Fixed-point support in the extension addresses all aspects for a new fixed-point data type. This includes constant definitions, fixed-point functions, and formatted I/O. It also addresses rounding and overflow details. The function interface is contained in the new "stdfix.h" header file.

The fixed-point data types include fract (fractional) and accum. While the fract data type has a value between -1.0 and +1.0, the accum data type contains an integer and fractional part like 10.23HQ.

Adding a new data type is no mean feat. The mix of attributes, functions, and semantics are more extensive than those for integers and floating points combined. This is necessary to provide the necessary flexibility to support the range of hardware fixed-point implementations.

Fixed-point support isn't restricted to systems that provide hardware support. Fixed-point data types can provide a level of accuracy not easily obtained by using just integers and floating point values. Fixed-point support is expected to find a home in a wide range of applications.

Multiple Address Spaces: Today's crop of DSPs and microcontrollers (MCUs) incorporates a wide range of memory technologies, such as RAM, ROM, flash memory, and segmented memory and I/O spaces. Operating systems and compilers typically hide these differences behind a set of functions or naming conventions. The multiple-address space support in this C extension provided a unified mechanism for de-fining an address space as well as variables within a specified address space.

Programmers can specify which ad-dress space is used for a particular heap-allocated variable. There's no named stack support.

Multiple-address space support can be implemented on any CPU. But it will most likely be used with DSP and MCU systems.

I/O Hardware Addressing: "Ideally, it should be possible to compile C or C++ source code which operates directly on I/O hardware registers with different compiler implementations for different platforms and get the same logical behavior at runtime" (excerpt from ISO/IEC WDTR 18037).

It's rare for a vendor to sell just one processor chip. Most DSP and MCU vendors sell one or more product lines with many chips in each. These may differ by package, but more importantly, they can vary in the number of pins and on-chip peripherals.

A number of compiler vendors already support the Embedded C proposal. Initially, the feature was found in products for DSP hardware, but this will likely change in the future.

www.dsp-c.org

ISO/IEC WDTR 18037
  • Extends C standard
  • Adds fixed-point data type support
  • Adds multiple-address space support
  • Adds basic I/O hardware addressing

  • Technical report completed
  • ISO approval expected in 2003
  • Current support available in a number of C and C++ compilers
  • Sponsored Recommendations

    TTI Transportation Resource Center

    April 8, 2024
    From sensors to vehicle electrification, from design to production, on-board and off-board a TTI Transportation Specialist will help you keep moving into the future. TTI has been...

    Cornell Dubilier: Push EV Charging to Higher Productivity and Lower Recharge Times

    April 8, 2024
    Optimized for high efficiency power inverter/converter level 3 EV charging systems, CDE capacitors offer high capacitance values, low inductance (< 5 nH), high ripple current ...

    TTI Hybrid & Electric Vehicles Line Card

    April 8, 2024
    Components for Infrastructure, Connectivity and On-board Systems TTI stocks the premier electrical components that hybrid and electric vehicle manufacturers and suppliers need...

    Bourns: Automotive-Grade Components for the Rough Road Ahead

    April 8, 2024
    The electronics needed for transportation today is getting increasingly more demanding and sophisticated, requiring not only high quality components but those that interface well...

    Comments

    To join the conversation, and become an exclusive member of Electronic Design, create an account today!