Skip navigation
Electronic Design

Software Directory: DSP-C "Fix Points" 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 ( 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.

  • 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

  • TAGS: Digital ICs
    Hide comments


    • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

    Plain text

    • No HTML tags allowed.
    • Web page addresses and e-mail addresses turn into links automatically.
    • Lines and paragraphs break automatically.