Login

Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.

ARM Community: Floating point operation on ARM9 - ARM Community

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Floating point operation on ARM9 Rate Topic: -----

#1 User is offline   vold 

  • Member
  • Pip
  • Group: Members
  • Posts: 5
  • Joined: 08-June 12

Posted 08 June 2012 - 05:22 AM

Hi everyone,
I am using ARM9 processor. I want to do some floating point operation like calculating division,square root,angle between two point( atan2 function in c ).
The sqrt or atan2 function ( in c language) are slower. What i know arm is an integer processor and i have to do floating point operation on integer processor.

Can any one help me to calcutale square root angle between two point in arm ?

Regards
0

#2 User is offline   ttfn 

  • Super Contributor
  • PipPipPipPip
  • Group: Members
  • Posts: 576
  • Joined: 29-September 06

Posted 08 June 2012 - 07:55 AM

Some ARM9s have floating point coprocessors. If your part has one you need to enable it, install some support code and build the code to take advantage of it. You will probably see C library calls, but the library functions should then make use of the FP instructions.

Otherwise your stuck with the software implementation in the library. There is nothing to stop you from writing your own - question is how confident are you that you will do a better job than whoever wrote the C library?
1

#3 User is offline   vold 

  • Member
  • Pip
  • Group: Members
  • Posts: 5
  • Joined: 08-June 12

Posted 11 June 2012 - 05:14 AM

Thanks for reply.
I am using two microprocessor ie. s3c2440 32 bit and s3c2416 32bit (samsung).
s3c2440 is developed using ARM920T core. s3c2440 dose not have any external coprocessor or any on chip coprocessor.(page -108,coprocessor instructions,s3c2440 datasheet)
So what i think i can not use the advantage of coprocessor on s3c2440.

s3c2416 is developed using ARM926EJ.From s3c2416 datasheet i did not get anything related to coprocessor.So i do not know about the coprocessor of s3c2416 (s3c2416 datasheet).

If both does not have any coprocessor then please help me about the floating point operation.

regards.
0

#4 User is offline   cfbsoftware 

  • Member
  • Pip
  • Group: Members
  • Posts: 9
  • Joined: 06-May 10

Posted 11 June 2012 - 06:06 AM

One option for you is to use an external floating-point processor e.g. one of the processors from MicroMegaCorp:

http://www.micromegacorp.com/

If that is not feasible, let us know what your required performance is, and why that leads you to believe the C implementation is to slow.


This post has been edited by cfbsoftware: 11 June 2012 - 06:09 AM

Chris Burrows
CFB Software
http://www.astrobe.com
0

#5 User is offline   vold 

  • Member
  • Pip
  • Group: Members
  • Posts: 5
  • Joined: 08-June 12

Posted 12 June 2012 - 05:34 AM

Below i gave a code which i tested in s3c2440 microprocessor.It was taking 46ms(approximately).

int i,j,m,n;
for(i = 0, m =75;  i < 75;  i++,m--)
{
   for(j  = 0, n = 75;  j < 75;  j++,n--)
   {
   	sqrt( pow(i - m, 2) + pow(j - n, 2));
   }
}



Is it faster ?
For fingerprint matching I have to do 500 to 1000 matches in around 1 sec. So for calculating distance if it will take 46ms then how i will achive my target.
Please give me any solution which will help me to achive my target.
0

#6 User is offline   isogen74 

  • Super Contributor
  • PipPipPipPip
  • Group: Members
  • Posts: 1097
  • Joined: 20-March 07

Posted 12 June 2012 - 11:21 AM

A couple of points.

  • You are using "pow" to square two integer values - why? The pow function takes double values, but just doing it by hand "(i-m)*(i-m)" will stay in integer, and not be any less precise (unless integer values are so large that they overflow).
  • There are plenty of well known integer-based square root methods provided you know the bounds of the value you are square rooting does not exceed certain max values. Alternatively you may use a more approximate value which is "precise enough" for your use case.
  • Lastly it look like you are calculating a distance for each "pixel" in a 75 by 75 grid. Assuming the scan always uses the same 75 by 75 dimensions, just do it offline and compile a lookup table into your program that will be _much_ faster =)

This post has been edited by isogen74: 12 June 2012 - 11:23 AM

When optimizing software, consider that the quickest code to run is the bit you removed from the call path.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic