Thread Subject: FPT : bitsra function and CORDIC

Subject: FPT : bitsra function and CORDIC

From: Michael Hui

Date: 19 Aug, 2008 17:27:02

Message: 1 of 1

This should be a follow-up on an active thread but I can't
find it now ... I apologize.

I converted the inner loop of my CORDIC from integer-only
implementation:

   x(i+1) = x(i) + sgn(y(i))*floor(y(i)*pow2(1-i));

   y(i+1) = y(i) - sgn(y(i))*floor(x(i)*pow2(1-i));

To FPT implementation:

   switch sgn(y(i))
       case -1 , x(i+1) = x(i) - bitsra(y(i),i-1);
       case 0 , x(i+1) = 0;
       case 1 , x(i+1) = x(i) + bitsra(y(i),i-1);
   end

   switch sgn(y(i))
       case -1 , y(i+1) = y(i) + bitsra(x(i),i-1);
       case 0 , y(i+1) = 0;
       case 1 , y(i+1) = y(i) - bitsra(x(i),i-1);
   end

I noticed two problems, when running 7.6.0 on Linux:

1) the underflow messages do appear when bitsra is used,
contrary to what the other thread just claimed.

2) the execution speed, at least in interpreted mode, slowed
way down, by more than factor of 20.

The integer-only implementation was written for speed,
admittedly, so it avoids the needless left and right shifts
during rounding just to maintain the binary point.

So the question is: is this the best way to do this simple
operation? I'm looking for something both easy to read and fast.

I'm using

   x(i+1) = x(i) + sgn(y(i))*floor(y(i)*pow2(1-i));

instead of

   x = x + sgn(y) * floor( y * pow2(1-i) );

just to keep track of what happens after each iteration.
It's not a required part of the algorithm.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
fpt cordic bitsra Michael Hui 19 Aug, 2008 13:30:20
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com