LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FXP build array and autoconversion in FPGA

Solved!
Go to solution

Hello,

 

I am working on repurposing an older project we use and came across a FIFO stream with a bunch of FXPs built into an array. Is there a scheme for the data type coercion in this case? It seems like it is just coercing the array type to the largest data type (FXP 64,45 in this case) and that holds true when you remove the larger variables, but remove the second largest (64,25) and the output data type remains the same while coercing the rest of the data.

 

Is it better practice to just coerce them manually prior to the array?

PDbnl_0-1687978729741.png

PDbnl_1-1687978940776.png

The initial project was made in LabVIEW 2014, the new one is 2023.

Thanks for any insight you can provide.

0 Kudos
Message 1 of 4
(908 Views)
Solution
Accepted by topic author PDbnl

Hi PD,

 


@PDbnl wrote:

a bunch of FXPs built into an array. Is there a scheme for the data type coercion in this case? It seems like it is just coercing the array type to the largest data type (FXP 64,45 in this case) and that holds true when you remove the larger variables, but remove the second largest (64,25) and the output data type remains the same while coercing the rest of the data.


The general rule will be to coerce to the largest FXP datatype so you don't lose any data…

 


@PDbnl wrote:

Is it better practice to just coerce them manually prior to the array?


The better practice is to define a suitable (FXP) datatype right from the beginning (aka when creating those "variables") instead of any explicit/implicit coercion later on!

(On FPGA you might use memory items/blocks instead of a lot local variables…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(861 Views)
Solution
Accepted by topic author PDbnl

Hi PD,

 

one small correction/idea to my last message:

The coercion might use a FXP datatype that is able to hold ALL/MOST data of the source FXP values. (Example: FXP6.4 and FXP7.3 might coerce to FXP8.4.)

You can easily test that with a simple VI…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 4
(848 Views)

That makes a lot of sense actually, it explains why the data type remained at 64.25 after I removed the 64.25 variable. Thanks for the insight!

0 Kudos
Message 4 of 4
(815 Views)