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.

how to convert floating numbers in hex to use in assembly?

Status
Not open for further replies.

smartshashi

Member level 4
Joined
Aug 11, 2004
Messages
68
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
513
convert floating point to binary assembler

I am working on butterworth IIR filter & I have to implement it in ARM assembly. This filter have some fractional coefficients. Can anybody explain me how to convert this fractional coefficients in hex so that I can use it in assembly without changing the response of filter?
 

convert to negative floating number to hexa

smartshashi,
You can easily convert decimal fractions to hex using a calculator. Supporse you're working with 16 bit numbers.
Step 1: multiply the fraction by 65536 (2^16)
Step 2: Convert to hex. This is easy on a scientific calculator.
The result is a binary fraction with the MSB having a weight of .5, the 2nd MSB having a weight of .25, etc.
.
Example, convert 0.75 to hex
Step 1: 0.75 X 65536 = 49152
Step 2 convert to hex = C000 (.5 + .25)
.
For negative numbers, just take the 2's complement as you would for an integer. This is done by complementing all the bits and adding 1 (Throw away the carry, if any)
.
When you are done, of course, you must divide the result by 65536 to get the proper scaling.
Regards,
Kral
 

convert fixed point to hex

I think you need to konw what algorithm you want, either Fix-Point alogrithm or floating-point alogrithm, for fix-point, the above explaination is sufficient, but for floating-point, you need to convert the hex-reprensentation of your floating numbers, and again you need to designate in your assemble code that your hex nubmer is represent of floating numbers. I do not konw how to do this..
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top