Providing Standardized Fixed-Point Arithmetics for Embedded C Programs

  • Wilfried Elmenreich
  • Andreas Wolf
  • Maximilian Rosenblattl
Part of the Lecture Notes in Electrical Engineering book series (LNEE, volume 38)

Abstract

The ISO/IEC Standard TR 18037 defines the syntax and semantics for fixedpoint operations for programming embedded hardware in C. However, there are currently only few compilers available that support this standard. Therefore, we have implemented a stand-alone library according to the standard that can be compiled with standard C compilers. The library is available as open source and written in plain C, thus can be used in various target architectures as long as a C compiler is available. This book chapter presents a brief description of the ISO/IEC standard and the library implementation followed by an evaluation of code size and performance of the fixed-point operations on the Atmel AVR architecture. A comparison with the standard floating-point library (which is machine code-optimized to the target architecture) shows that simple fixed-point functions such as addition, subtraction and multiplication are more efficient, while more complicate functions can only compete in the worst case behavior. The fixed-point approach provides a smaller memory foot print, for typical applications where only a small subset of functions is used. This is especially of interest for the big market of embedded microcontrollers with only a few Kbytes of program memory.

Keywords

Fixed-point arithmetic C Programming language Embedded C CORDIC 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    ISO/IEC, Programming Languages – C, approved by ANSI Accredited Standards Committee, ISO/IEC 9899:1999, December, 1999.Google Scholar
  2. 2.
    IEEE, Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985; IEC-60559:1989, 1985.Google Scholar
  3. 3.
    Altera Corporation, USA. Nios II Processor Reference Handbook Version 7.0, 2007Google Scholar
  4. 4.
    D.P. Magee, Matlab extensions for the development, testing and verification of real-time DSP software, In Proceedings of the 42nd Annual Conference on Design Automation, pages 603–606, San Diego, CA, USA, 2005.Google Scholar
  5. 5.
    ISO/IEC, Programming languages – C – Extensions to support embedded processors, ISO/IEC TR 18037:2008, JTC 1/SC 22, 2008.Google Scholar
  6. 6.
    P. Puschner, Worst-case execution time analysis at low cost, Control Engineering Practice, 6:129–135, January 1998.CrossRefGoogle Scholar
  7. 7.
    D. Goldberg, What every computer scientist should know about floating-point arithmetic, ACM Computing Surveys, 23(1):5–48, March, 1991.CrossRefGoogle Scholar
  8. 8.
    IEEE, Standard for Radix-independent Floating-point Arithmetic, ANSI/IEEE Std 854-1987, October 1987.Google Scholar
  9. 9.
    G. Frantz and R. Simar, Comparing fixed- and floating-point DSPs. Texas Instruments, Dallas, TX, USA, 2004. White paper available at http://ocus.ti.com/lit/ml /spry061/spry061.pdf.
  10. 10.
    M. Rosenblattl and A. Wolf, Fixed-point library according to ISO/IEC standard DTR 18037 for Atmel AVR processors, Bachelor’s thesis, Vienna University of Technology, Vienna, Austria, 2007. \url{http://sourceforge.net/projects/avrfix}.Google Scholar
  11. 11.
    J.E. Volder, The CORDIC trigonometric computing technique. IRE Transactions on Electronic Computers, EC-8(3), 9, 1959.Google Scholar

Copyright information

© Springer Science+Business Media B.V. 2009

Authors and Affiliations

  • Wilfried Elmenreich
    • 1
  • Andreas Wolf
    • 2
  • Maximilian Rosenblattl
    • 2
  1. 1.Lakeside Labs, Mobile Systems Group, Institute of Networked and Embedded SystemsUniversity of KlagenfurtAustria
  2. 2.Vienna University of Technology1040 ViennaAustria

Personalised recommendations