05-18-2006 10:52 AM
05-18-2006 11:44 AM
Just to add to this...
I've just re-compiled the exact same code on another PC and it passed, same utilisation, Compiled rate: 40.409 Theoretical Max: 40.548, what is going on????
06-08-2006 10:12 AM
07-27-2009 07:00 PM
07-27-2009 07:50 PM
07-28-2009 09:52 AM
First, to be blunt that fpga code isn't very good.
There are 8 divisions in the code and these should be stripped out wherever possible. Division is quite expensive and that is why such little code is taking 90+% of the FPGA.
Here is what I have to offer.
You have two x/16 that should replaced with x*2^(-4), same effect but free on the FPGA.
There is scaling done on the FPGA that could be done better on the RTHost, provided you don't need high rates. The pressure input may be a good candidate.
Do you need FP indicators and the FIFO? I would pick one.
I attached a JPEG showing some ideas for optimization in your code. I ran the code clean up tool first.
I may have something further, given more time.
I would attempt to keep datawidths in check wherever possbile. Forcing the output of a function will help, provided you KNOW the value won't overflow the datawidth you choose.
Good luck.
From xflow.log the timing violation seems to come from a fixed point multiply in the loop (as in bold):
Timing Summary:
---------------
Speed Grade: -4
Minimum period: 28.046ns (Maximum Frequency: 35.655MHz)
Minimum input arrival time before clock: 15.567ns
Maximum output required time after clock: 10.653ns
Maximum combinational path delay: No path found
Timing Detail:
--------------
All values displayed in nanoseconds (ns)
=========================================================================
Timing constraint: Default period analysis for Clock 'Clk40'
Clock period: 28.046ns (frequency: 35.655MHz)
Total number of paths / destination ports: 5660726965 / 8321
-------------------------------------------------------------------------
Delay: 28.046ns (Levels of Logic = 38)
Source: window/theVI/n_695/n_694/n_692/n_664/clockDataOutInternal_8 (FF)
Destination: window/theVI/n_695/n_694/n_692/prim_MUL_0172/NiLvFxpEnableHandlerx/NiLvFxpEnableHandlerSlvx/cOut_63 (FF)
Source Clock: Clk40 rising
Destination Clock: Clk40 rising
07-28-2009 06:55 PM
The reason i decided to do all my data manipulation in the FPGA vi is because when i put just the raw data into the DMA FIFO and use my RT vi to do data manipulation/scaling, i get all kinds of weird values, that don't make no sense at all. I even end up with the values being interchanged between my indicators (i.e. crank angle shows up in the index position field and so on).
The only reason i chose to use DMA FIFO in the first place is because my RT seemed to be too slow in updating compared to the FPGA resulting in severe data loss.
I've done some optimization and while the FPGA vi compiled, i'm still getting very unreasonable values in my RT vi (which is also doing the data logging) and now, I don't know how to go about getting high resolution data without losing data integrity.
07-29-2009 07:34 AM
Well, I finally got it to compile and meet timing. I had to use the NI Fixed Point Library.
Attached is a screen cap that shows the multiliers that caused the issue.
Also attached is a solution using the Fixed point library for the multiplies. Unfortunately those multiplies are going to take 3 cycles to complete, hower for an encoder loop it shouldn't slow it too much.
08-01-2009 02:01 AM
08-01-2009 03:38 PM