LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FPGA: Replace Array Subset vs. Build array

Hi,

 

I'm working on a sensor daq project and was wondering, which is the best way to fit the data input into an array before it is beeing written into a RT FIFO with a for loop.

 

In the first sreenshot the array is initialized before the loop and the data goes into the array with the "Replace Array Subset" function. In the second screenshot the sensor data is fitted into one array with the function "BuildArray".

Since the code looks much nicer with the Build Array function, I was wondering if this is the way to go. Is there a significant impact to the loop time/memory/....?

 

The code executes on a cRIO 9024 FPGA.

Download All
0 Kudos
Message 1 of 3
(3,080 Views)

Most likely the compiler will produce identical code with either approach shown here since the Replace Array Subset is overriding all the elements in the array. In general, if Build Array is sufficient, I would use that as it's more concise on the diagram and is unambiguous to the compiler. However, in many cases, replace array subset should be optimized pretty well by the compiler.

Message 2 of 3
(3,060 Views)

Arrays on FPGA need to resolve to a fixed size at compile time. (see also)

 

Both of your code alternatives will function identically and result in basically the same compiled code, so I would use "built array" because it uses fewer primitives and makes the diagram easier to read.

Message 3 of 3
(3,045 Views)