Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

sqt function required for rms calculation

Status
Not open for further replies.

habbas33

Newbie level 5
Newbie level 5
Joined
Oct 19, 2008
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,346
i want to calculate rms values of some signals.

xrms = sqrt{ 1/n*( x_1^2 + x_2^2 + ...... + x_n^2 ) }.

but the problem is sqrt operation. i have used cordac but it does not gives precise values u can either give integers or fractions. I have also tried sqrt function from fixed_alg_ug pkg but its not synthesizable because it depends on real_math pkg.
i need a sqrt code which can give me precise answer for example

when 48 goes to => sqrt => gives 6.928 => not 7
 

fixed point will be precise to the nearest 2^-N, where N is the number of fraction bits. I guess with cordic you didnt give enough fraction bits.
Have you also considered a look up table (it uses less resources and has smaller latency than cordic.)
 

fixed point will be precise to the nearest 2^-N, where N is the number of fraction bits. I guess with cordic you didnt give enough fraction bits.
Have you also considered a look up table (it uses less resources and has smaller latency than cordic.)

to get result in fraction, cordic can only take 1 bit integer...

can u please explain the how can i use look up table method because i dont have known values of inputs and ouputs
 

Code:
to get result in fraction, cordic can only take 1 bit integer...

can you change your cordic 'vendor' ?
Richard Herveille cordic core is 16bit in /20 bit out length in standard.
 

A look up table is just a ROM. The input address is the X value, the output is the squaroot answer. The ROM values need to be pre-calculated (this can easily be done with something like matlab and can even be generated in VHDL).
 

Most FPGA vendors have IP (Megafunction, core generator, ...) for integer squareroot. It can be applied for fixed point calculations by applying suitable scaling.

The first point to write synthesizable code for operations like this is to design the involved number formats.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top