square root of a number in vhdl

Joined
Jul 25, 2007
Messages
2
Reaction score
0
hi

i have to find the square root of 36 bit data at 30MHz rate using vhdl and store it into the fifo at 5 Mhz. can some one help me with the code for finding the square root of the number. please it is very important.
 
Joined
May 4, 2007
Messages
49
Reaction score
0
vibeni,

Here's a sneaky formula for finding square roots.

G = (g + n/g)/2

Where n = 36-bit input number and g = your 1st guess.

Then after you calculate the 1st square_root (G) result, you must put this result back into the formula as 'g' and reiterate to get the next square_root result. You must do this multiple times until you are satisfied with the precision of the result. I would suggest setting up a spreadsheet to see how many iterations it will take to get a precise answer depending on what you choose as your 1st guess. You can reduce your iterations by making an intelligent input as to your first guess (this would include evaluating where your MSB is in your 36-bit input number and determining the order of the expected result).

If you really want to get tricky here's the code for finding higher order roots of any number.

G = ((m-1)*g + n/g^(m-1))/m where m=root_order

Scott C
 
Joined
Feb 25, 2010
Messages
38
Reaction score
0
here is code for square root function for unsigned numbers..
vhdlguru.blogspot.com/2010/03/vhdl-function-for-finding-square-root.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top