Pipeline MATLAB Expressions - MATLAB & Simulink (original) (raw)

Main Content

With the coder.hdl.pipeline pragma, you can specify the placement and number of pipeline registers in the HDL code generated for a MATLAB® expression.

If you insert pipeline registers and enable distributed pipelining, HDL Coderâ„¢ automatically moves the pipeline registers to break the critical path.

How To Pipeline a MATLAB Expression

To insert pipeline registers at the output of an expression in MATLAB code, place the expression in thecoder.hdl.pipeline pragma. Specify the number of registers.

You can insert pipeline registers in the generated HDL code:

Alternatively, to insert one pipeline register instead of multiple pipeline registers, you can omit the second argument in the pragma:

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

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

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

Limitations of Pipelining for MATLAB Expressions

Note

When you use the MATLAB code inside a MATLAB Function block and select theMATLAB Datapath architecture or enable theAggresiveDataflowConversion optimization, these limitations do not apply.

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

See Also

coder.hdl.pipeline