03-06-2013 04:50 AM
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.
03-06-2013 05:59 AM
03-06-2013 06:09 AM
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).
03-06-2013 06:19 AM
Thanks for the reply crossrulz, GerdW.
"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?!
03-06-2013 06:40 AM
03-06-2013 06:42 AM
@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
03-07-2013 12:44 AM
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?
03-07-2013 01:00 AM
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
03-07-2013 01:27 AM
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..
03-07-2013 02:26 AM
Hi scps,
hmm, it doesn't show an error for me:
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...