cancel
Showing results for
Show  only  | Search instead for
Did you mean:
Newbie
11,753 Views
Registered: ‎03-29-2010

## Square Root Calculator

Hi All,

I was wondering if i can get some help in implementing a solution to my problem. Below is the description of the problem i am having:

I need to develop a high-speed FPGA design to calculate the square root of a number according to the following specifications:

+ have two inputs ‘x’ and ‘start’.
+ Input signal ‘x’ is an unsigned positive integer.
+ The bit-width for ‘x’ is W bits, where W is a parameter specified in the PreLoadFcn function of the Simulink MDL file. W can be set to 8, 10, 20, 32

+ Input signal ‘start’ is a Boolean.
+ When input signal ‘start’ goes to HIGH for one clock cycle, calculation should begin. I will have to assume that the signal ‘start’ will not go HIGH again until calculation is completed.
+ The device will have two outputs ‘y’ and ‘valid’.
+ Output ‘y’ will store the square root of ‘x’, calculated to the second binary digit.

+ When the device finishes calculating ‘y’, it should make output signal ‘valid’ go HIGH for exactly one clock cycle.

I would like to point out that the block Square Root cannot be used in the design

I will be working on this and will be waiting for someone to direct me in the right direction.

Thanks,

George

Tags (2)
7 Replies
Explorer
11,749 Views
Registered: ‎02-27-2010

What in the heck is a "block square root" and why do you want us to do your work for you?

Can you do a square root on paper?  If not, find out how.  If so, use that knowledge to figure out how to put it into hardware.

Would you like us to do your work for you after you graduate as well?

Message Edited by john.h on 03-29-2010 11:53 PM
Teacher
11,728 Views
Registered: ‎07-09-2009

HI

Have you looked at the Xilinx Cordec ? in corgen

Contributor
11,720 Views
Registered: ‎10-17-2008

You can do this with successive approximation - google newton's method. I've used this in the past with good success.

You need to start with a guess - table lookup - and then iterate to get the precision you want.

Reyk

Newbie
11,581 Views
Registered: ‎03-29-2010

Well john.h if you dont want to help out fair enough but you dont have to go around abusing people. At the bottom of my post i clearly said that i will be working on it, i wasnt waiting for someone to give me the solution, i asked direction. So for next time keep your negative comments to yourself. If you dont know what a square root block then you dont have the right to complain.

drjohnsmith and reyk, thank you for your advise. I eneded up going with drjohnsmith's advise about using Cordic algorithm. Newton's method was good too but it was taking longer duration to perform the same calculation as compared to the one using the cording algorithm. It also used more resources. So again thanks drjohnsmith for your advise.

P.S: john.h, maybe you can learn something from drjohnsmith and be helpful instead of abusing people.

Explorer
11,578 Views
Registered: ‎02-27-2010

And thank you for your kind words, mralam.

In your original post you stated a problem which appears virtually verbatim from a university assignment.  You did not mention any way in which you tried to approach the problem yourself, research you had already pursued, or ideas you had on approaches that we might help you narrow down.

You asked for someone to give you what you needed with no demonstration that you were attempting anything on your own beyond your promise to work on it while forum users give you suggestions you should find on your own.  If you had demonstrated knowledge about the subject... if you had shown that you put forth a true, solid effort... there are many - myself included - who are willing to help an honest, striving student.

If you search for the term "block square root" you'll find there is very little information on the web - at least in english - that uses that term.  I was unable to determine if the method you were not permitted to use was the same as the very simple grade-school method used to determine square roots in base-10 math.  The extension of this manual method is a beautiful implementation in base-2 arithmetic.  I asked if you knew how to do a square root on paper.  You did not say whether you had.  Neither did you say if you knew of any method to determine square roots.  Why, then, not use your resources at your university to solve your problems?

This forum has students and professionals, certainly.  Taking up time and space with questions which are better addressed through other resources clutter this forum and make it less usable.  Serious issues go unanswered because they're buried with calls for help where people don't read or even search for the available application notes, literature, or data sheets.  Or they don't ask their professor.  I'd like to see this forum continue to be an active aid to people who need help, not people who find it convenient to avoid doing real work (ar at least the appearance of real work).  Trying to help too many people with issues devoid of substance will make this forum useful for too few.

The real world is harsh.

617 Views
Registered: ‎08-10-2020

Hey john, The real world is truly harsh but it doesn't mean that you should post irrelevant stuff under a question. If you can't help just keep scrolling. It's funny how you talk about people cluttering the forum when you just did the exact same thing with your first reply.