From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Next Steps - LabVIEW RIO Evaluation Kit

cancel
Showing results for 
Search instead for 
Did you mean: 

Single-Cycle Timed Loops

Hi Everybody!

This week I would like to talk about a very important and unique feature of FPGA programming; the Single-Cycle Timed Loop.

The Single-Cycle Timed Loop (SCTL) is the FPGA version of the Timed Loop that you see in Real-Time programming.  It is very useful because it allows us to perform multiple operations within a single tick of the FPGA’s clock.  Please refer to the link below.

Using Single-Cycle Timed Loops to Optimize FPGA VIs (FPGA Module)

So if we are using the default 40 MHz clock as our Top-Level Clock, each tick (or clock cycle) will take 25 ns to execute.  In the example above, that means it would take 100 ns to execute the code inside the while loop (excluding the 2 ticks of overhead for the while loop).  By placing that code inside an SCTL, it only takes 25 ns!

Unfortunately, we cannot just place all of our code inside an SCTL.  If you try and place too much code in a single combinatorial path inside the loop, you may get a timing violation, which means that compiler cannot fit all of that code into a single tick.  There are several ways to fix the timing violation, but some of the easiest ones are to either reduce the clock speed by deriving a slower clock, or by parallelizing the code with a technique called pipelining.  Below is another great resource for learning how to optimize FPGA code.

Optimizing your LabVIEW FPGA VIs: Parallel Execution and Pipelining

If you have any questions about Single-Cycle Timed Loops, please feel free to post them here!

Best,

Jeff S

Jeff S.
National Instruments
0 Kudos
Message 1 of 3
(13,655 Views)

I've also encountered situations, where a SCTL will compile but the code doesn't performed as desired.

0 Kudos
Message 2 of 3
(5,073 Views)

Hi Isaac,

Please post here or on the LabVIEW FPGA Discussion Forum (probably more eyes will see it there) if there's anything specific we can help with.

For more details on practical implementation of SCTL's, I recommend the LabVIEW High Performance FPGA Developer's Guide.

Deborah Burke
NI Hardware and Drivers Product Manager
Certified LabVIEW Architect
0 Kudos
Message 3 of 3
(5,073 Views)