03-29-2010 07:24 PM
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.
03-29-2010 08:53 PM - edited 03-29-2010 08:53 PM
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?
03-30-2010 09:42 AM
Have you looked at the Xilinx Cordec ? in corgen
Why simulink ?
03-30-2010 11:43 AM
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.
04-14-2010 05:29 PM
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.
04-14-2010 06:02 PM
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.
Good luck with your studies.
The real world is harsh.
05-30-2021 02:27 PM
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.
05-30-2021 06:36 PM
I'm with @john.h on this one... Straight homework assignment with no attempt to show any work already completed, or for that matter any attempt to disguise the question. The professor/lecturer wanted you to do the assignment, not us...
With that said - @mralam, it would make sense to tell us your level of HDL programming too. From the original post, I'm guessing "never looked at HDL before"? Because most of the text there would be trivial for anyone who has done even basic HDL (eg. managing the start and done bits). If that is the case, then diving straight into a CORDIC implementation is not likely to go well; you would be well advised to start with a simpler project that is easy to debug (eg. a basic FSM) and work up to CORDIC.