Project Requirements:

To create a fixed point math library with macros to perform the following operations with 8.8 precision fixed point math using the RL78’s Multiply/Divide/Accumulate peripheral:

(a) Conversion

FL_TO_FX(a)……………………………………….Floating point to Fixed point conversion

FX_TO_FL(a) ………………………………………Fixed point to Floating point conversion

(b) Basic Operations

FX_ADD(a,b)……………………………………….Fixed point Addition of 2 numbers

FX_SUB(a,b)……………………………………….Fixed point Subtraction of 2 numbers

FX_MUL(a,b)……………………………………….Fixed point Multiplication of 2 numbers

FX_DIV(a,b) ………………………………………..Fixed point Division of 2 numbers

(c) Exponentiation

FX_POW(a,b)………………………………………Fixed point Power function

FX_SQRT(a)………………………………………..Fixed point Square Root function

(d) Trigonometry using polynomial approximations

FX_SIN(a)…………………………………………..Fixed point Sine function

FX_COS(a)…………………………………………Fixed point Cosine function

FX_TAN(a)………………………………………….Fixed point Tangent function

FX_ARCSIN(a)……………………………………..Fixed point Arc Sine function

FX_ARCCOS(a)……………………………………Fixed point Arc Cosine function

FX_ARCTAN(a)……………………………………Fixed point Arc Tangent function


The detailed analysis of these macros w.r.t execution time and percentage error is given in the report. Please take a look at our report for the details. Contact us for any further clarifications or  information.

Project Achievements:

The fixed point library was created and successfully tested for the required math functions. For every

algorithm, the designated hardware multiply/divide/accumulate unit has been used to reduce the execution t

ime. Profiling was done to realize the advantages of the fixed point arithmetic implemented with RL78’s 

hardware multiply/divide/accumulate unit w.r.t its performance over the floating point counterpart. Also 

error analysis was done to calculate the error for each provided function which can be kept in mind when 

implementing fixed point math instead of floating point math in future applications.

Demonstration of the Functionality of Fixed Point Library :

For demonstrating the functionality of the macros in the fixed point library, some sample mathematical functions were developed. The results of four of these functions were displayed on the LCD. The functions displayed are (a+b)2, sin2(a)+cos2(a), √a and 2*a*b. Both the decimal equivalent and the corresponding floating point value after fixed to float operation were displayed for clarity. To make sure that the error remains minimized over a wide range of input values, arguments passed to these macros were changed dynamically using a for loop. A video showing this demonstration can be found on the website created for this project. Also later, profiling, showing the time taken to execute each mathematical function for both fixed point and floating point arithmetic were demonstrated.


This free website was made using Yola.

No HTML skills required. Build your website in minutes.

Go to www.yola.com and sign up today!

Make a free website with Yola