FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > DSP

DSP comp.dsp newsgroup, mailing list

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-25-2007, 11:34 PM
Greg Berchin
Guest
 
Posts: n/a
Default Fixed Point Arithmetic

I am implementing (A+B-C-D-E) in fixed-point logic. I am implementing
it as ((A+B)-((C+D)+E)). A, B, C, D, and E are all unsigned, more or
less uniformly distributed over the range [0, MAX), where MAX>>1, and
each also carries several fractional bits. The final result is signed.
I need for the accuracy of the final result to be reasonably close to
±½, but I also need to carry as few bits as possible in the arithmetic
operations to minimize real estate and maximize speed. Is there a
deterministic way to find the minimum number of fractional bits to keep
in A, B, C, D, E, (A+B), (C+D), and ((C+D)+E) at the inputs to the
adders, and whether to round or truncate?

Thanks,
Greg
Reply With Quote
  #2 (permalink)  
Old 08-26-2007, 04:37 AM
G Iveco
Guest
 
Posts: n/a
Default Re: Fixed Point Arithmetic


"Greg Berchin" <[email protected]> wrote in message
news:[email protected]..
>I am implementing (A+B-C-D-E) in fixed-point logic. I am implementing
> it as ((A+B)-((C+D)+E)). A, B, C, D, and E are all unsigned, more or
> less uniformly distributed over the range [0, MAX), where MAX>>1, and
> each also carries several fractional bits. The final result is signed.
> I need for the accuracy of the final result to be reasonably close to
> ±½, but I also need to carry as few bits as possible in the arithmetic
> operations to minimize real estate and maximize speed. Is there a
> deterministic way to find the minimum number of fractional bits to keep
> in A, B, C, D, E, (A+B), (C+D), and ((C+D)+E) at the inputs to the
> adders, and whether to round or truncate?
>
> Thanks,
> Greg


If the inputs ABCDE are undeterministic, then either A+B or A+C or whatever
doesn't
matter.

The goal of your "I need for the accuracy of the final result to be
reasonably close to
±½, " is pretty ambiguous.



Reply With Quote
  #3 (permalink)  
Old 08-26-2007, 05:06 AM
Randy Yates
Guest
 
Posts: n/a
Default Re: Fixed Point Arithmetic

"G Iveco" <[email protected]> writes:

> "Greg Berchin" <[email protected]> wrote in message
> news:[email protected]..
>>I am implementing (A+B-C-D-E) in fixed-point logic. I am implementing
>> it as ((A+B)-((C+D)+E)). A, B, C, D, and E are all unsigned, more or
>> less uniformly distributed over the range [0, MAX), where MAX>>1, and
>> each also carries several fractional bits. The final result is signed.
>> I need for the accuracy of the final result to be reasonably close to
>> ±½, but I also need to carry as few bits as possible in the arithmetic
>> operations to minimize real estate and maximize speed. Is there a
>> deterministic way to find the minimum number of fractional bits to keep
>> in A, B, C, D, E, (A+B), (C+D), and ((C+D)+E) at the inputs to the
>> adders, and whether to round or truncate?
>>
>> Thanks,
>> Greg

>
> If the inputs ABCDE are undeterministic, then either A+B or A+C or whatever
> doesn't
> matter.
>
> The goal of your "I need for the accuracy of the final result to be
> reasonably close to
> ±½, " is pretty ambiguous.


I'd look at max/mins. A+B has a max of 2*MAX and a min of 0. C+D+E has
a max of 3*MAX and a min of 0. Thus A+B-(C+D+E) has a max of 2*MAX and
a min of -1*3*MAX. You must carry enough bits to cover this range or
you'll lose something (either via saturation or roundoff, depending
on how you scale things).
--
% Randy Yates % "Watching all the days go by...
%% Fuquay-Varina, NC % Who are you and who am I?"
%%% 919-577-9882 % 'Mission (A World Record)',
%%%% <[email protected]> % *A New World Record*, ELO
http://home.earthlink.net/~yatescr
Reply With Quote
  #4 (permalink)  
Old 08-26-2007, 02:45 PM
Greg Berchin
Guest
 
Posts: n/a
Default Re: Fixed Point Arithmetic

Answering my own question; I think I've got it figured out. (Amazing
what a good night's sleep will do after a long week -- including
Saturday -- working on this stuff. Last night I just couldn't get my
head around it.)

Let's say that A, B, C, and D are all truncated to integers. Then each
has a tolerance of +0/-1.

Then (A+B) and (C+D) are each +0/-2.

And (A+B)-(C+D) is +2/-2.

If E is rounded, then it has a tolerance of ±½.

And (A+B)-(C+D)-E is ±2½.

If everything is rounded instead of truncated, the results are the same.

So if I carry two fractional bits, my final result will be
±2.5*0.25 = ±0.625.

Three fractional bit will give me ±2.5*0.125 = ±0.3125.

And so on.

Greg
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about Fixed-point Arithmetic! [email protected] DSP 1 08-18-2007 03:39 AM
Fixed point arithmetic [email protected] DSP 4 11-29-2006 06:56 AM
Who Offers Fixed-Point Arithmetic Libraries? Tim Wescott DSP 6 06-26-2005 03:49 PM
multiplication (by 0.1, 0.5, 0.7, 1.3 ...) in fixed point arithmetic Stefan Huber DSP 2 08-31-2004 05:16 PM
Fixed Point Arithmetic resources Ashwin DSP 6 07-14-2003 08:26 AM


All times are GMT +1. The time now is 03:08 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved