LabVIEW automatically optimizes code inside a single-cycle Timed Loop to execute more quickly and consume less space on the FPGA, compared to the same code inside a While Loop. The single-cycle Timed Loop does not include enable chain registers inside the loop, which saves time and space. In the following block diagram, the code within the While Loop takes four clock cycles to execute, excluding the overhead of the While Loop, which takes two additional clock cycles to execute. The red vertical lines indicate where each clock cycle ends inside the While Loop. The same operation in a single-cycle Timed Loop executes within one clock cycle, if the clock period is long enough.
You also can include logic in a single-cycle Timed Loop to optimize code in an FPGA VI, as shown in the following block diagram.
If you use a single-cycle Timed Loop within a While Loop, as shown in the block diagram above, wire a True constant to the condition terminal so that the code within the Timed Loop executes only once.
If you want to use the single-cycle Timed Loop, all operations inside the loop must fit within one cycle of the FPGA clock. You can use most VIs and functions in a single-cycle Timed Loop. However, LabVIEW reports a code generation or compile-time error for the single-cycle Timed Loop when you compile an FPGA VI with certain VIs, functions, or structures in a single-cycle Timed Loop. Refer to the single-cycle Timed Loop topic for more information about objects you cannot use in a single-cycle Timed Loop.