03-23-2009 04:50 AM
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
03-23-2009 07:56 PM
03-23-2009 09:55 PM
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.
03-23-2009 10:15 PM
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?
03-24-2009 05:29 AM
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
03-24-2009 07:12 AM
03-25-2009 07:18 AM
03-25-2009 10:36 AM
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
03-25-2009 10:45 AM
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
03-25-2009 08:12 PM
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.