Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > doing sqrt( ) for synthesis.

Reply
Thread Tools

doing sqrt( ) for synthesis.

 
 
Pontus
Guest
Posts: n/a
 
      10-17-2012
On 17 Okt, 05:02, Luis Cupido <cup...@ua.pt> wrote:
> Hello.
>
> I would like to have at some point of my code
>
> MV= sqrt(I^2+Q^2);
>


I saw somewhere that using the fact: sqrt(x)=x*1/sqrt(x) could be
useful since 1/sqrt(x)
"behaves" better and multipliers are (sometimes) free...

Do you really want the sqrt(i^2+q^2), or will you anyway do log(x)
[x=i^2+q^2] later on?
In that case you could use log(sqrt(x))=1/2log(x) and concentrate on
log().

HTH -- pontus
 
Reply With Quote
 
 
 
 
Luis Cupido
Guest
Posts: n/a
 
      10-18-2012
On 10/17/2012 9:15 PM, Anton Gunman wrote:
> Below is the modified code, let me know if there's still a problem.
>
> Anton


Excellent. works fantastic all the range.
Super thanks...
Now lets keep coding all the rest of it...

Many thanks.
Luis C.

p.s. drop me a line to put in the header for credits please. tks.
If I get famous for this device I'm doing (I doubt) you
deserve a share of the fame
 
Reply With Quote
 
 
 
 
Luis Cupido
Guest
Posts: n/a
 
      10-18-2012
On 10/17/2012 10:45 PM, Pontus wrote:
> On 17 Okt, 05:02, Luis Cupido<cup...@ua.pt> wrote:
>> Hello.
>>
>> I would like to have at some point of my code
>>
>> MV= sqrt(I^2+Q^2);
>>

>
> I saw somewhere that using the fact: sqrt(x)=x*1/sqrt(x) could be
> useful since 1/sqrt(x)
> "behaves" better and multipliers are (sometimes) free...
>
> Do you really want the sqrt(i^2+q^2), or will you anyway do log(x)
> [x=i^2+q^2] later on?
> In that case you could use log(sqrt(x))=1/2log(x) and concentrate on
> log().
>
> HTH -- pontus


Hi Pontus.

data is coming from a radix2 pipelined FFT what follows is a massive
accumulating memory so there is not really a log( ).

lc.

 
Reply With Quote
 
rickman
Guest
Posts: n/a
 
      10-19-2012
On 10/16/2012 11:02 PM, Luis Cupido wrote:
> Hello.
>
> I would like to have at some point of my code
>
> MV= sqrt(I^2+Q^2);
>
> but since the above I have no clue how to do in a single clock cycle
> I have just I^2+Q^2 in the form:
>
> pv <= i**i + q**q;
>
> That uses a few embedded multipliers and works great.
>
> The number of bits in the result is obviously in (2x)+1
> Since I can't afford to manipulate that wide word further
> down the chain I just truncated it to the same number of bits of the input.
>
> All fine but a lot of dynamic range was lost
> (this is some DSP coding as you might have guessed already).
>
> Is there any compression function just gates, that could work
> unclocked (for me to get done with one clock latency) that does the
> SQRT( ) or anything that resembles this function just to get the same
> dynamyc range preservation effect as the SQRT( ) does.
>
> Pardon me for being a bit off topic.
>
> Anyone has any idea ?
>
> Luis C.


From the way you express your question, I get the impression that your
real concern is the "dynamic" range of the squared result, or in other
words the number of bits. If it really is just the number of bits, you
could go with logarithmic compression, or in other terms, convert your
squared number to a floating point value. That should be pretty easy to
do in a single clock cycle, if needed the multiplier hardware can be
used to shift the mantissa.

Would that help you or do you really need the square root?

Rick
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
recommendation doing co-simulation between c/c++ with vhdl Carson VHDL 0 10-05-2005 07:40 PM
What is VS Doing to my Code??? downs.matt@gmail.com ASP .Net 1 09-02-2005 11:38 AM
Why is Mozilla doing this ... and how to fix it Joe S. Firefox 7 06-07-2005 04:12 AM
VB6/VB.Net Programming Question - what am i doing wrong? Salisha Khan ASP .Net 1 08-01-2003 01:55 PM
What am I doing wrong? Keith R. Williams VHDL 4 07-15-2003 03:08 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57