Hi Praveen,
There are many ways to calculate the square root, and the method you choose depends on several factors:
- how fast you need to do it (clock speed and latency requirements)
- how much hardware you want to use (and what resources are available in your chosen device)
- how accurate you need the answer to be
Commonly a simple look-up table is used, where the square root is pre-calculated and stored in a ROM. However, if you have a large range of input values, the size of the ROM can become prohibitive. You could reduce the size of the ROM and interpolate, at the expense of some accuracy.
Another method is to use a CORDIC. There are many VHDL implementations of the CORDIC around, if you search the web.
If you need true floating point, then things become more difficult, but it can still be done.
Finally, if you aren't too worried about speed, you could consider doing the square root in software (i.e. having a small software processor embedded in the design).
Hope this helps,
Siskin