Main Content

coder.hdl.interface

Specify input to be mapped to the line buffer interface in HLS

Since R2023a

Description

example

coder.hdl.interface(inputVar, 'Line Buffer', imageSize, origin, 'ConstantFill', constantFillValue) enables you to map the input variable to the line buffer interface in Cadence® Stratus HLS. Various properties of the line buffer interface can be specified as arguments to the pragma.

You must insert this pragma at the start of the MATLAB® design. The specified line buffer properties are stored inside the ml.tcl file that is read by the Cadence Stratus importer.

This pragma does not affect MATLAB simulation behavior.

Examples

collapse all

In the following MATLAB function line_buffer_average takes in1 as working set and calculates the average of the values in the working set.

function out = line_buffer_average(in1)
   
    coder.hdl.interface(in1, 'Line Buffer', [20, 20], [2, 2], 'ConstantFill', 0);
    sum = 0;
    for i = 1:size(in1,1)
        for j = 1:size(in1,2)
            sum = sum + in1(i,j);
        end
    end
    out = sum / numel(in1);
end

The MATLAB test bench demonstrates the usage of the hdl.WorkingSet class and getWorkingSet method. It generates the working sets for each pixel of the input image.

image = rand(20, 20);
ws = hdl.WorkingSet(image, [3 3], [2 2], -1);
for x = 1:20
    for y = 1:20
        workingSet = ws.getWorkingSet(x, y);
        out = line_buffer_average(workingSet);
    end
end

Note

hdl.WorkingSet class and getWorkingSet method must be used inside the MATLAB test bench.

Input Arguments

collapse all

Working set input variable, specified as a matrix.

Original image size from which the working sets are to be generated, specified as a 2 element row vector of positive integers.

Example: [20, 20]

Origin of the working set, specified as a 2 element row vector of positive integers.

Example: [2, 2]

Specify the constant value to be filled in the working set for the pixels falling outside the image.

Example: 1

Version History

Introduced in R2023a