LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW FPGA Array operations

Hi, I am  a newbie for LabVIEW FPGA. I have been doing some exercise operations on LabVIEW FPGA mainly involving arrays.

 

To start with, I am trying to port my floating point VI's into FPGA target and make them compatible with FPGA. In the process, I discovered that if I copy an existing array constant into a VI on FPGA target and set the size of the array to a fixed value, all the elements in the constant array becomes 0. Values in the array remain 0 even if paste option is used. This is a problem if the number of elements to be written onto this array is huge (1000's of elements). Is there a way I can retain the values of the constant array in FPGA target even after setting the size of the array? 

 

Another problem that I am facing is that of use of case structure in FPGA target. If I use 2 cases in which 2 different sizes of arrays are used, VI shows error : Arrays must be fixed size in target. This error shows up even if array size has been set in both the cases. How to overcome this difficulty.

 

Please help me with these two issues. 

 

Thabks in advance.

 

 

 

 

 

 

 

 

 

0 Kudos
Message 1 of 16
(4,833 Views)

Hi scps,

 

you have to use arrays of the same size when both are connected to the same output tunnel of your case structure...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 16
(4,827 Views)

scps wrote:Another problem that I am facing is that of use of case structure in FPGA target. If I use 2 cases in which 2 different sizes of arrays are used, VI shows error : Arrays must be fixed size in target. This error shows up even if array size has been set in both the cases. How to overcome this difficulty.

Think of it this way: if you have two different sized arrays going to the same tunnel in a case structure, what should the size of the output be?  The problem is actually the size of the output array is not fixed in size.

 

 


@scps wrote:

To start with, I am trying to port my floating point VI's into FPGA target and make them compatible with FPGA. In the process, I discovered that if I copy an existing array constant into a VI on FPGA target and set the size of the array to a fixed value, all the elements in the constant array becomes 0. Values in the array remain 0 even if paste option is used. This is a problem if the number of elements to be written onto this array is huge (1000's of elements). Is there a way I can retain the values of the constant array in FPGA target even after setting the size of the array?


This sounds like a bug to me.  You might be able to copy the data of the first array (right click on the array and choose Data Operations->Copy Data) and then paste the data to the fixed size array (Data Operations->Paste Data).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 16
(4,822 Views)

Thanks for the reply , .

 

"You might be able to copy the data of the first array (right click on the array and choose Data Operations->Copy Data) and then paste the data to the fixed size array (Data Operations->Paste Data)."   I have tried this. It is not working.

 

Regarding Case structure issue, I am setting the output size to be maximum size of the array I am using in the case structure. But if that is not allowed, what is the alternative for using same operation for 2 arrays of different sizes without using case structure?!

 

0 Kudos
Message 4 of 16
(4,815 Views)

Hi scps,

 

you can't connect arrays of different size to the same wire/tunnel on a FPGA. Point.

When you need the same operation for different arrays: program the operation twice...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 16
(4,811 Views)

@scps wrote:

 

Regarding Case structure issue, I am setting the output size to be maximum size of the array I am using in the case structure. But if that is not allowed, what is the alternative for using same operation for 2 arrays of different sizes without using case structure?!

 


 

The point is how you set the output array size.

If you set it using a constant, it should work.

I'm afraid you have to init the array outside the case structure, then wire it inside the case structure, populate it and finally go out.

(Looking to your vi could help finding the issue)

Regards,

Marco

0 Kudos
Message 6 of 16
(4,808 Views)

 


GerdW : When you need the same operation for different arrays: program the operation twice...


I am surprised! Is there no work around or a different approach where same code can be called depending upon the case selected 😞 

 


MarcoMauri : Looking to your vi could help finding the issue 


I am attaching an example VI. I have 6 elements in one case and 10 in other. I have set output array size to be 10. It's not allowing me to run the program urging me not to use different sizes of arrays. Let me know if anything can be done to overcome this issue.

 

Also, Constant array issue remains unsolved. Using LUT is alternative for that? Can anyone confirm?

 

 

 

Download All
0 Kudos
Message 7 of 16
(4,772 Views)

Hi!

The array indicator has a fixed size but the wire exiting the case structure has not.

Did you Try as I suggested?

1) Initialize an array constant (10 elements)

2)WIre it inside the case structure

3)Copy 6 elements in the array in case 1

4)Copy 10 elements in the array in case 2

5) Exit from case structure and wire to the indicator

 

At the moment I don't have Labview FPGA and can't it myself----

 

Regards,

Marco

0 Kudos
Message 8 of 16
(4,769 Views)

1) Initialize an array constant (10 elements)

2)WIre it inside the case structure

3)Copy 6 elements in the array in case 1

4)Copy 10 elements in the array in case 2

5) Exit from case structure and wire to the indicator


 

Unfortunately it is also not working..

 

0 Kudos
Message 9 of 16
(4,766 Views)

Hi scps,

 

hmm, it doesn't show an error for me:

check.png

The array constant before the case structure is fixed to 10 elements, the constants inside the cases are fixed at 6 and 4 elements (true/false case). After the case structure you receive an array with 10 elements...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 16
(4,760 Views)