Discrete Delay
- Updated2025-01-28
- 8 minute(s) read
Delays input value for a number of loop iterations. This VI is analogous to a z^-n block where n can be constant or variable.
This function supports scalar and array values of integer, fixed-point, and Boolean data types, clusters, and arrays of clusters.

Dialog Box Options
| Parameter | Description |
|---|---|
| General |
Specifies general information about this function.
|
| Initial Values | Contains settings for the initial values of the internal registers this function uses.
|
| Configuration Feedback |
Displays information about how this function executes. This information is based on the configuration options you specify. |
Inputs/Outputs
D
—
Specifies the data to delay. Note The data type of D does not adapt to source.
Specifies the index of the internal register whose value reaches the Q output terminal. The value of n–1 can be between 0 and n–1, where n is the value of the Maximum delay control in the configuration dialog box. LabVIEW displays this terminal only if you select the Dynamic delay option in the configuration dialog box. Specifies whether this function ignores the input terminal D. The default value is TRUE, which means this function shifts all values to the next internal register and takes in a value of D to the first internal register. If enable is FALSE, this function ignores D and does not shift existing values, which means the internal registers retain the value they had during the previous clock cycle. Use this terminal to operate on only valid values of D. For example, you can wire the output valid output terminal of a High Throughput Math function to this input terminal. In this situation, the Discrete Delay function takes in a value of D only if the incoming value is valid. LabVIEW displays enable only if you place a checkmark in the Enable checkbox in the configuration dialog box. If you do not display this terminal, LabVIEW sets it to TRUE internally.
Q
—
Returns the delayed value of D. If this function is set to Constant delay, Q returns the value of the last internal register. If this function is set to Dynamic delay, Q returns the value of the register you specify with the n–1 input terminal. |
This function implements delays by using shift register lookup tables (SRLs) instead of flip-flops. SRLs combine many delays into a single lookup table (LUT), which can reduce FPGA resource usage significantly compared to flip-flops.
Differences between the Discrete Delay Function and the Feedback Node
The Feedback Node and the Discrete Delay function are similar but have some key differences. The following table provides information about the differences between these objects.
| Feedback Node | Discrete Delay Function | Recommendation | |
|---|---|---|---|
| Design and Features |
|
Designed for delaying an input signal by a constant or variable number of clock cycles. | Use the function that represents the use case you are programming. |
| Initialization options |
|
|
The Discrete Delay implements delays by using SRLs instead of flip-flops. SRLs combine many delays into a single lookup table (LUT), which can reduce FPGA resource usage significantly compared to flip-flops. |
| Ways of defining initial values | You define initial values by wiring a value to the initializer terminal on the diagram. | You define initial values by using the Initial Values table or by using a custom initialization VI. | Use the Discrete Delay function if you have an initialization VI or if you need to delay a fixed-size array. |
| Support for dynamic delay | ![]() |
![]() |
Use the Discrete Delay function if you need a dynamic delay. |
| Support for representing feedback on a block diagram | ![]() |
![]() |
Use the Feedback Node if you need to represent feedback on a block diagram. |
Constant Delay vs. Dynamic Delay
The following example illustrates the differences between a Constant delay and a Dynamic delay.
If you set Constant delay to 20 clock cycles, this function creates 20 internal registers, numbered 0 through 19, to store values you wire to D. A value you send to D on the first clock cycle will be stored until the 20th clock cycle, assuming the value of the enable terminal is TRUE.
As you send new values to D, the function shifts values from one register to another. The original value you enter moves from register 0, to register 1, to register 2, and so on, until the value reaches register 19 on the 20th clock cycle. On the 21st clock cycle, the output terminal Q returns the value you entered during the first clock cycle. The value has been delayed for 20 clock cycles.
The function behaves similarly for a Dynamic delay. If you set Maximum delay to 20 clock cycles, the function also creates 20 registers for storing values. A value you wire to D moves from register 0 to register 19 with each successive clock cycle.
However, the function also displays the n–1 input terminal, which you use to specify the number of an internal register. Q returns the value of this register instead of always returning the value of the last register.
For example, if 17 clock cycles have elapsed, the value of D you sent during the first clock cycle is in register 16. If you wire a value of 16 to n–1 during the 18th clock cycle, the function returns this value. The value has been delayed for 17 clock cycles, not 20.
Simulation Export Details
This node can increase simulation run time significantly when used in conjunction with downloading, stopping, or running the FPGA VI.
Examples
Refer to the following example files included with LabVIEW FPGA Module.
- labview\examples\CompactRIO\FPGA Fundamentals\FPGA Math and Analysis\High-Throughput Math\Multi-Channel Averaging\Multi-Channel Averaging.lvproj
- labview\examples\R Series\FPGA Fundamentals\FPGA Math and Analysis\High-Throughput Math\Multi-Channel Averaging\Multi-Channel Averaging.lvproj
D
—
Q
—

