Breaking News
Comments
Oldest First | Newest First | Threaded View
<<   <   Page 2 / 3   >   >>
tom-ii
User Rank
Blogger
Re: Fortran is lying to you
tom-ii   12/7/2013 5:48:22 PM
NO RATINGS
@AZskibum:

 

Fractional fixed point (often referred to as "Q" format) is efficient -- you choose exactly the precision you need, no less and no more -- and the bookkeeping exercise of keeping track of the radix point is not a big deal.

 

This is actually what I used in my final implementation - We'll get to that in a few weeks, I suppose....  (Max willing)

tom-ii
User Rank
Blogger
Re: math links
tom-ii   12/7/2013 5:49:11 PM
NO RATINGS
Brian,

 

Interesting stuff.  To be honest, though, I'm a complete n00b, and am teaching myself Verilog at this point.

sa_penguin
User Rank
Manager
Re: Fractional arithmetic
sa_penguin   12/7/2013 7:50:19 PM
NO RATINGS
I broke out Excel and did some quick fractions.

For a 12-bit number: 1/10 = 409.6/4096 and 410 = 19AH
16 bits: 1/10 = [6,553.6] / [65,536]  and 6,554 = 199AH
24 bits: 1/10 = [1,677,721.6] / [16,777,216] and 1,677,722 = 19 999AH

Yes, I have a habit of putting commas in decimal numbers and spaces in hex numbers. I find it makes them easier to distinguish.

Adam-Taylor
User Rank
Blogger
How FPGA do math
Adam-Taylor   12/8/2013 7:22:29 AM
Hi Tom

good blog, I wrote an article on this for Xcell a few years ago hope you do not mind me linking to it here

 

http://www.eetimes.com/document.asp?doc_id=1279807

tom-ii
User Rank
Blogger
Re: How FPGA do math
tom-ii   12/8/2013 10:31:35 AM
NO RATINGS
@Adam:

 

Of course I don't mind!

DrFPGA
User Rank
Blogger
Re: How FPGA do math
DrFPGA   12/8/2013 11:49:13 PM
NO RATINGS
Adam-

Thanx for posting the link to your article. Very detailed and even had some code!

Adam-Taylor
User Rank
Blogger
Re: How FPGA do math
Adam-Taylor   12/9/2013 3:47:20 AM
NO RATINGS
You are welcome I tried to make it as simple as possible to explain within the 2000 word limit how to do maths in FPGA's

The more complex things like filters and CORDICs etc are covered in other articles

I find a simple example often helps to demonstrate the principles

Adam-Taylor
User Rank
Blogger
How the divisor works
Adam-Taylor   12/9/2013 4:04:30 AM
NO RATINGS
1 saves
The divider works because the 0x199A for a 16 bit number is the reciprocal of 10 which is 1/10 or 0.1

This is then scaled by integer(2**16 * 0.1) = 6554 or 0x199A doing the multiply then works out the same as doing the divide. This trick can be used for any number when the divisor is fixed.

 

Max The Magnificent
User Rank
Blogger
Re: math links
Max The Magnificent   12/9/2013 10:01:11 AM
NO RATINGS
1 saves
@Brian: There's some nice material about constant division on the companion website for "Hacker's Delight"

I was going to mention that book Hacker's Delight -- it's a great book -- lots of useful tricks in it. I just now found there's a second edition (the link above) -- I have th efirst -- I'll have to add this second edition to my wish list :-)

 

Max The Magnificent
User Rank
Blogger
Re: math links
Max The Magnificent   12/9/2013 10:04:24 AM
NO RATINGS
@Kris: Pretty cool math...I wonder whether they teach something like that in vlsi classes...


I'd be interested to knwo that myself -- but I fear not. When I started out, everyone knew and "swapped" tips and tricks like this -- it was key to making programs run as fast as possible when you were limited in terms of memory size, clock frequency, and the fac tthat CPUs too multiple cycles to do anything.

Magazines like BYTE were always publishing stuff like this... I love this stuff

<<   <   Page 2 / 3   >   >>


Flash Poll
Top Comments of the Week
Like Us on Facebook
EE Times on Twitter
EE Times Twitter Feed

Datasheets.com Parts Search

185 million searchable parts
(please enter a part number or hit search to begin)
EE Life
Frankenstein's Fix, Teardowns, Sideshows, Design Contests, Reader Content & More
Max Maxfield

The Best of the Best Videos on YouTube
Max Maxfield
4 comments
A couple of days ago, my chum Paul was visiting me in my office. He'd wandered over from his cubicle in the next bay to take a brief coffee break. This week, Paul had been admiring the ...

Jolt Judges and Andrew Binstock

Jolt Awards: The Best Books
Jolt Judges and Andrew Binstock
1 Comment
As we do every year, Dr. Dobb's recognizes the best books of the last 12 months via the Jolt Awards -- our cycle of product awards given out every two months in each of six categories. No ...

Engineering Investigations

Air Conditioner Falls From Window, Still Works
Engineering Investigations
2 comments
It's autumn in New England. The leaves are turning to red, orange, and gold, my roses are in their second bloom, and it's time to remove the air conditioner from the window. On September ...

David Blaza

The Other Tesla
David Blaza
5 comments
I find myself going to Kickstarter and Indiegogo on a regular basis these days because they have become real innovation marketplaces. As far as I'm concerned, this is where a lot of cool ...