Main Content

coder.hdl.constrainlatency

Specify the minimum and maximum acceptable hardware latency for a MATLAB function for High-Level Synthesis (HLS) code generation

Since R2022a

Description

coder.hdl.constrainlatency(minimum_latency, maximum_latency) pragma is created that enables you to specify the desired hardware latency range for a block of code for HLS code generation.

example

Examples

collapse all

Consider the MATLAB® functions hdltest and region1. The latency of the region1 function is constrained between 0 and 2 clock cycles in the generated HLS code.

function y = hdltest(a,b)
    u = a+8;
    v = b+6;
    y = region1(u,v);
end

function z = region1(a,b)
    % Optional comment between function defination and pragma
    coder.hdl.constrainlatency(0,2);
    m = a+1;
    n = b+2;
    z = m*n;
end

Input Arguments

collapse all

Minimum latency, specified as a positive integer.

Example: 4

Maximum latency, specified as a positive integer.

Example: 10

Version History

Introduced in R2022a

See Also