LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

polynomial help required on FPGA!! please-

Hello, I am trying to implement a polynomical on the FPGA with not much luck. I need to keep it to a 32 bit number basically the polynomial is:

 

Rg = 2 xcubed -445 xsquared + 169x + 286060 where X = A/450 (where A is a value between +-10000)

 

we already have a big program to implement on the FPGA so space and speed is critical, we cannot afford to have a divide in it and the output needs to be then scaled up to 2 to the power 20.

 

 

I did think a lookup table might help but it would require 20000 elements which is not ideal!

 

thankyou.

 

Peter

0 Kudos
Message 1 of 12
(3,826 Views)
how fast do you want it to run and what is the allowable error in the result?
Stu
0 Kudos
Message 2 of 12
(3,787 Views)

Hai,

 

What is the problem you are facing while implementing the calc in FPGA.  Resource shortage or there is a problem in the computed output.

 

If you want just the calculation to be done and there is not much time constraints you can carry out the calculation in RT and pass in on to FPGA.

 

Revert back for queries.

With regards,
JK
(Certified LabVIEW Developer)
Give Kudos for Good Answers, and Mark it a solution if your problem is solved.
0 Kudos
Message 3 of 12
(3,776 Views)

attached is a fixed point implementation of your poly.  fairly fixed implementation.  Not sure what you meant by keeping it to a 32 bit number.  Do you mean the most significant 32 bits of the answer?

 

Stu
0 Kudos
Message 4 of 12
(3,773 Views)

Ok,

 

We are getting there, basically fixed point is fine but the input ideally cannot lose so much resolution. basically I have encoder values coming in between -10,000 and +10000 i then divide this by 450 to convert to angle for my equation, but I first need to scale up the encoder value as otherwise i lose resolution in my original divide. Hence needs to all be part of the equation. Fixed point would work. When i said I can't have 64bit, by this i mean an ouput of 64bit integer. or a divide at any point on a 65bit integer as this takes too much time to process. I need ideally the whole equation to be exucted in well under 100ticks of the fpga as am sampling at 100kHz.

 

Hence my problems. 

 

to clarify, input is 32bit integer of +-10000, output needs to be a number scaled to 2 to power 20 in 32bit integer format. (pre scaled values are between (0.1 and 0.4)

 

All help greatly appreciated!! Thanks 

 

 

0 Kudos
Message 5 of 12
(3,750 Views)
Either I have an error in my implementation of your poly or your coeffs are not right.  with an input of 0, I get 286060.  wth 10000, i get 92003 and -10000, 40593.  not .1 to .4
Stu
0 Kudos
Message 6 of 12
(3,742 Views)
If you have issues with time, consider running the FPGA faster.  It will consume more power and your code will have tighter timing constraints (which is why the default speed is low), but it is designed to run much faster, should you need it.  Consult your documentation for details.
0 Kudos
Message 7 of 12
(3,719 Views)

Hello thankyou for the continued response,

 

The answers are the values I told u scaled up to 2 to the 20, apologies for not making that clearer, just to check the values of the co-effieciants are:

 

-2,,-445,, 169,, 286061

 

Thanks

 

Peter

0 Kudos
Message 8 of 12
(3,709 Views)

Sorry to jump in late, but I have a quick question. You mentioned that the entire equation needs to execute in 100 ticks, is there any reason you can't put it in a single cycle timed loop? Then it would all happen in one tick. I don't see any shared resources or loops to prevent this.  This will also reduce overall size, by eliminated enable chain elements.

 

-Mello

 


Data Science Automation

CTA, CLA, CLED
SHAZAM!
0 Kudos
Message 9 of 12
(3,705 Views)

Develop-inG wrote:

Hello thankyou for the continued response,

 

The answers are the values I told u scaled up to 2 to the 20, apologies for not making that clearer, just to check the values of the co-effieciants are:

 

-2,,-445,, 169,, 286061

 

Thanks

 

Peter


Sorry for being slow.  How about if you post code in high level labview so that I can compare results with fixed point implementation.

Stu
0 Kudos
Message 10 of 12
(3,679 Views)