LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Any idea how to replace power of X function in FPGA?

Hi all,

Any idea how I need to use power of X function in FPGA. It is not available there, any idea how it works in FPGA?

 

0 Kudos
Message 1 of 4
(3,061 Views)

Hi WatFin,

 

use a loop to calculate (positive integer) powers of a value!

For other values you can use the high-throughput Exponential function! Simple math: x^y = e^(y*ln(x))…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(3,058 Views)

Thankyou,

I was thinking if there is ready function. I will do in that way.

0 Kudos
Message 3 of 4
(3,048 Views)

@GerdW wrote:

use a loop to calculate (positive integer) powers of a value!


For negative integer powers, compute 1/(x^|n|), i.e. the reciprocal of the positive integer power.  If n is small (say < 8), a For loop to do n multiplications is simple and quick.  If n is large, you can express it as a binary integer and work with squares of x (i.e. n = 10 = 1010b, compute x^2 and ((x^2)^2)^2 and multiply them together.  Note that you should probably do some timing tests to verify that the squaring method (a) works and (b) "makes a difference".

 

Bob Schor

0 Kudos
Message 4 of 4
(3,005 Views)