Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Fixed point operations in C

Status
Not open for further replies.

kaushiksangam

Newbie level 6
Joined
Apr 9, 2006
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,387
I want to emulate an algorithm in C before actually writing to hardware.

This algorithm invovles lot of multiplications and additions of real numbers. Hence, I want to use fixed point operations(to represent real numbers) in C to emulate the algorithm.

Can someone please tell me or give me an example of how to perform fixed point operations in C.
 

hey can u give me the details of this topic
 

It is about the implementation of a Brain State in a Box (BSB) algorithm. Before implementinng this in hardware, i would want to emulate the same in C.

Already have implemented algorithm in C through floating point oprations.

I can also send you the code of the implementation.
 

Why dont use floating point?
Which up are you using?

NeuralC
 

u can use an array of two integers for each number then, for example
0.004676 can be stored as
var1=4676 and var2= -3 u can u short int for the var2 coz im assuming that ur powers would not vary too much
 

This is floating point....
 

kaushiksangam said:
Can someone please tell me or give me an example of how to perform fixed point operations in C.
Have a look at this: **broken link removed**
 

Hi,
Fixed point operations in C is not that difficult to implement.
Lets say we are storing numbers in 8.24 format. So we can use a 32 bit un-signed integer for that. We are going to store the integer 8 bits in the MSB side and the fractional 24 bits on the LSB side (as we always represent in digital form - Little Endian). Then may be you should write a small library for fixed operations. Then implement operations like multiplication as bit-wise operations.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top