Main Content

coder.hdl.pipeline

Insert pipeline registers at output of MATLAB expression

Description

example

out = coder.hdl.pipeline(expr) inserts one pipeline register at the output of expr in the generated HDL code. This pragma does not affect MATLAB® simulation behavior.

Use this pragma to specify exactly where to insert pipeline registers. For example, in a MATLAB assignment statement, you can specify the coder.hdl.pipeline pragma:

  • On the entire right side of the assignment statement.

  • On a subexpression.

  • By nesting multiple pragmas.

  • On a call to a subfunction, if the subfunction returns a single value. You cannot specify the pragma for a subfunction that returns multiple values.

If you enable distributed pipelining, HDL Coder™ can move the pipeline registers to break the critical path.

HDL Coder cannot insert a pipeline register at the output of a MATLAB expression if any of the variables in the expression are:

  • A persistent variable that maps to a state element, like a state register or RAM.

  • In a data feedback loop. For example, in the following code, you cannot pipeline an expression containing the t or pvar variables:

    persistent pvar;
    t = u + pvar;
    pvar = t + v;

example

out = coder.hdl.pipeline(expr,num) inserts num pipeline registers at the output of expr in the generated HDL code. This pragma does not affect MATLAB simulation behavior.

Use this pragma to specify exactly where to insert pipeline registers. For example, in a MATLAB assignment statement, you can specify the coder.hdl.pipeline pragma:

  • On the entire right side of the assignment statement.

  • On a subexpression.

  • By nesting multiple pragmas.

  • On a call to a subfunction, if the subfunction returns a single value. You cannot specify the pragma for a subfunction that returns multiple values.

If you enable distributed pipelining, HDL Coder can move the pipeline registers to break the critical path.

HDL Coder cannot insert a pipeline register at the output of a MATLAB expression if any of the variables in the expression are:

  • A persistent variable that maps to a state element, like a state register or RAM.

  • In a data feedback loop. For example, in the following code, you cannot pipeline an expression containing the t or pvar variables:

    persistent pvar;
    t = u + pvar;
    pvar = t + v;

Examples

collapse all

At the output of a MATLAB expression, a + b * c, insert a single pipeline register.

y = coder.hdl.pipeline(a + b * c);

At the output of a MATLAB expression, a + b * c, insert three pipeline registers.

    y = coder.hdl.pipeline(a + b * c, 3);

For a MATLAB expression, a + b * c, after the computation of b * c, insert five pipeline registers.

    y = a + coder.hdl.pipeline(b * c, 5);

At an intermediate stage and at the output of a MATLAB expression, use nested coder.hdl.pipeline pragmas to insert pipeline registers.

For a MATLAB expression, a + b * c, after the computation of b * c, insert five pipeline registers, and insert two pipeline registers at the output of the whole expression.

    y = coder.hdl.pipeline(a + coder.hdl.pipeline(b * c, 5),2);

Input Arguments

collapse all

MATLAB expression to pipeline. At the output of this expression in the generated HDL code, insert pipeline registers.

Example: a + b

Number of pipeline registers to insert at the output of expr in the generated HDL code, specified as a positive integer.

Example: 3

Version History

Introduced in R2015a