Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > How many bits?

Reply
Thread Tools

How many bits?

 
 
Tricky
Guest
Posts: n/a
 
      09-10-2009
Quick question for everyone: is there an easy way to work out how many
bits are require to store the sum of N numbers at M bits per number.

In my case, I need to store the sum of 2^20 (1mill) 18bit numbers.

Theres probably another 2^n number in there, but I cant figure it out.

Thanks for the help.
 
Reply With Quote
 
 
 
 
Marty Ryba
Guest
Posts: n/a
 
      09-11-2009
"Tricky" <> wrote in message
news:1c48615c-5d8a-4c85-8f26-...
On 10 Sep, 09:59, Tricky <trickyh...@gmail.com> wrote:
> > Quick question for everyone: is there an easy way to work out how many
> > bits are require to store the sum of N numbers at M bits per number.
> >
> > In my case, I need to store the sum of 2^20 (1mill) 18bit numbers.
> >
> > Theres probably another 2^n number in there, but I cant figure it out.
> >
> > Thanks for the help.

>
> Lol - Im so stupid..please ignore my ramblings
>
> 38


Hi Tricky, that's not as dumb a question as it seems.

Sure, 38 bits will work, but unless every number is expected to possibly be
full scale all at once, it's gross overkill. If your numbers are signed,
they may average to zero. If you know the expected mean (over at least some
reasonable number of cases) and the expected variance, you can design things
to use far fewer bits. For instance, if these are A/D input samples, you may
wish to make them nominally zero mean by subtracting 2^17 first (with a
little analysis of representation it can take trivial gates; the synthesizer
will likely figure this out). Then, based on the expected variance (standard
deviation), you can multiply that by sqrt(N) to get a measure of how the
variance grows; take that number and multiply by 4 or so (2 bits) and you
now have a representation that has something like a one in a billion chance
of saturating.

Say this is A/D input of a fairly random signal. You likely set the gain to
keep most of the samples from saturating the A/D, so the standard deviation
may be at most 1/8th of full scale, or about 2^14. Summing 2^20 of these
increases the variance by 2^10, so you are at 2^24. So, you should be able
to easily make it with something like 26 or 27 bits. Making it 32 bits for
compatibility for readout on some bus will give you oodles of margin; it's
still less resources (and a faster Fmax given the shorter carry chain) than
a 38 bit accumulator.

Just something to think about...
-Marty


 
Reply With Quote
 
 
 
Reply

Thread Tools

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Many-to-many relationship / DataSet / child rows / DataRelation / sorting / navigation Marco Ippolito ASP .Net 0 10-11-2004 04:11 PM
Re: Cisco PIX many-to-many NAT problem Fredy Kuenzler Cisco 1 07-16-2004 07:30 PM
Cisco PIX many-to-many NAT problem Fredy Kuenzler Cisco 4 06-15-2004 07:06 PM
How many questions (avg) and How many can i miss? Josh MCSD 2 02-16-2004 07:25 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57