Modulo by Constant HDL Optimized
R2026bPerform mod operation with a constant denominator and generate optimized HDL code
Libraries:
Fixed-Point Designer HDL Support /
Math Operations
Description
The Modulo by Constant HDL Optimized block performs the modulo operation (remainder after division) with a constant denominator using an HDL-optimized architecture with cycle-true latency.
The Modulo by Constant block uses an algorithm that is functionally similar to a Barrett Reduction. The division operation is computed via a multiplication by inverse, which generally results in better performance on embedded systems.
Examples
Ports
Input
Output
Parameters
Programmatic Use: Add Block
To add the block programmatically, use the add_block function with one of these library block paths as the source.
"embeddedMatrixLib/Math Operations/Modulo by Constant HDL Optimized"
Example: add_block("embeddedMatrixLib/Math Operations/Modulo by Constant HDL Optimized","myModel/myBlock",MakeNameUnique="on")

