Main Content

getLatency

R2026b

Latency of biquad filter

Since R2022a

Description

Y = getLatency(hdliir) returns the latency, Y, between the first valid input sample and the first valid output sample, assuming contiguous input samples. The latency depends on the Structure property of the biquad filter object.

To return the latency of a multichannel or frame-based filter with this syntax, you must first call the object so that it can detect the input dimensions.

example

Y = getLatency(hdliir,V) returns the latency, Y, for an input vector of V elements. If the Structure property is 'Pipelined feedback form', then this dimension represents a column vector of frame-based data. If the Structure property is 'Direct form I fully serial', then this dimension represents a row vector for a multichannel filter.

example

Examples

collapse all

The latency of the dsphdl.BiquadFilter object varies with the filter structure and vector size. Use the getLatency function to find the latency of a particular configuration. The latency is the number of cycles between the first valid input and the first valid output, assuming that the input is contiguous.

Create a new dsphdl.BiquadFilter object and request the latency. The default filter structure is direct form II.

filtdf2=dsphdl.BiquadFilter
filtdf2 = 
  dsphdl.BiquadFilter with properties:

      Structure: 'Direct form II'
      Numerator: [1 2 1]
    Denominator: [1 0.1000 0.2000]
    ScaleValues: 1

  Show all properties

getLatency(filtdf2)
ans = 
12

Create an object with a different filter structure and compare the latency.

filtpff = dsphdl.BiquadFilter(Structure='Pipelined feedback form');
getLatency(filtpff)
ans = 
23

Request hypothetical latency information about a similar object with vector input data. You can only use vector input data with the 'Pipelined feedback form' filter structure.

getLatency(filtpff,8)
ans = 
55

Create an object with a serial filter structure and compare the latency.

filts = dsphdl.BiquadFilter(Structure='Direct form I fully serial');
getLatency(filts)
ans = 
16

Input Arguments

collapse all

HDL-optimized filter, specified as a dsphdl.BiquadFilter System object that you created and configured. For more information, see dsphdl.BiquadFilter.

Vector size, specified as a power of 2 in the range from 1 to 64. If the Structure property is 'Pipelined feedback form', then this dimension represents the size of the input column vector of frame-based data, and must be a power of 2 from 1 to 64. If the Structure property is 'Direct form I fully serial', then this dimension represents the number of channels in the input row vector for a multichannel filter. When you do not specify this argument, the function assumes the filter has scalar input.

Vector input is supported only when the Structure property is 'Pipelined feedback form' or 'Direct form I fully serial'.

Output Arguments

collapse all

Cycles of latency that the filter object takes between the first valid input and the first valid output. Each call to the object simulates one cycle. This latency assumes valid input data on every cycle.

Version History

Introduced in R2022a

See Also

Objects