LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Operations inside FPGA VI

Hello!:) I would just like to ask what operations are allowed inside the FPGA VI? Please correct me if I’m wrong, the inverse sine is not allowed right? I resulted to using a LUT to perform inverse sine inside the FPGA VI. In particular, are the Mean VI (of the Probability & Statistics VIs palette) and the inverse tangent 2 input (of Trigonometric Functions palette, NOT the high throughput tangent inverse) allowed? Thank you so much for you time! God Bless! 🙂

0 Kudos
Message 1 of 13
(2,897 Views)

In general, only the functions that show up in the FPGA palettes (the palettes that show up when the VI is open within an FPGA Target) are supported. Many of the analysis functions are supported on the FPGA, but the actual implementation may be different since the Desktop version uses floating point and the FPGA version uses fixed point.

0 Kudos
Message 2 of 13
(2,887 Views)

Thank you for your response! 🙂 How can I get the sum of the elements of an array inside the FPGA VI? 🙂 The 'Add Array Elements Function' is not available inside FPGA VI 😞 So what I did is to use a for loop. However, the 'shift register' automatically 'returns' a 'double' data type as illustrated in my attached picture. How do I fix this?:( Thank you very much! 😄

0 Kudos
Message 3 of 13
(2,864 Views)

You found the magic of the fixed point type. The fixed point type in LabVIEW was created as a mathematical type, not a machine type (like integers). When fixed point goes through operators, the output fixed point type is calculated (and usually gains bits) so the operation won't lose any data. This has the interesting caveat of creating scenarios like these where there is no (easily) determinable correct size for the types because of the accumulation in the shift registers. To fix this, you must explicitly put in a node to break that cycle and pick the type for LabVIEW.

 

Take a look at this thread, particularly the last entry, and hopefully that will help: http://forums.ni.com/t5/NI-Applications-Engineers/When-open-a-FPGA-with-fixed-point-in-LV2011-the-da...

0 Kudos
Message 4 of 13
(2,858 Views)

Thank you! 😄 However, I can't open the link due to 'unexpected error' 😞 Sorry but what do you mean about putting a node to break the cycle? Thank you! 😄

0 Kudos
Message 5 of 13
(2,855 Views)

Sorry about that, the other link isn't valid. I will retype my reply on the other thread here. The other thread actually talked about a bug in the fixed point type propagation in LabVIEW 2010 and earlier, but for the most part it is a good overview of the fixed point type propagation.

 

LabVIEW type propagation for fixed-point tries to ensure that, by default, no data can be lost. When you have a feedback loop as shown in the example given, type propagation cannot statically determine a single fixed-point type that will not lose data for any number of iterations of the loop. To get around this limitiation, the system coerces the fixed-point type on the output of the feedback node to a double (a more dynamic type).

 

feedback.png

 

There were bugs in LabVIEW versions previous to 2011 that allowed the type propagation system to pick an "incorrect" fixed-point type instead of switching to double for examples similar to these. Many of these issues were fixed in LabVIEW 2010 and 2011.

 

In general, the way to resolve these loops in the diagram is to explicitly override a part of the loop explicitly with additional knowledge the user knows about the system. For instance, if you knew that the loop would get reset at most every 1024 iterations, you can override the output of the add operator to include an additional 10 bits. I've also given an example that uses operations on the diagram to calculate the type for you making the code a bit easier to maintain.

 

feedback.solution.png

 

0 Kudos
Message 6 of 13
(2,843 Views)

Hi! 🙂 I was able to get rid of the automatic conversion to 'double' data type as seen in attached picture. However, an error still occurred: 

 

Shift register: Shift register: unwired from inside the loop

Details: You must wire a valid data type from inside the loop to the shift register on the right edge of the loop, or delete the shift register.

 

I already double-checked the wire connection of the said shift register and it is really connected 😞

0 Kudos
Message 7 of 13
(2,835 Views)

I'm not exactly sure what this VI is trying to do, but it seems like you probably don't want to wire the output of the top adder to the type input of the feedback node since those types are so different. Can you describe what you are trying to accomplish and maybe I can be of more help.

0 Kudos
Message 8 of 13
(2,809 Views)

I am tasked to implement this expression: E{x1*(t)x2(t)}.

x1(t) and x2(t) are both complex signals so that I have separated the real and imaginary components of each signal.

In effect, I have 4 arrays 'in the beginning'.

I'm having a hard time implementing E or the average which is the last part of the code.

I made the necessary adjustments as a response to your previous reply. 🙂

However, I'm still getting the error which I specified in my last message 😞

 

0 Kudos
Message 9 of 13
(2,800 Views)

I took a stab at implementing this with the fixed point type calculation code in those loops on the right. I also cleaned up the other code a little where LabVIEW does things automatically for you.

 

complex.png

 

I may have completely missed the point of the actual algorithm, but hopefully the code can be useful somehow.

Message 10 of 13
(2,793 Views)