Gain

Multiply input by constant (HDL Coder)

Description

The Gain block is available with Simulink®.

For information about the simulation behavior and block parameters, see Gain.

Tunable Parameters

You can use a tunable parameter in a Gain block intended for HDL code generation. For details, see Generate DUT Ports for Tunable Parameters.

HDL Architecture

ConstMultiplierOptimizationDescription
none(Default)

By default, HDL Coder™ does not perform CSD or FCSD optimizations. Code generated for the Gain block retains multiplier operations.

csd

When you specify this option, the generated code decreases the area used by the model while maintaining or increasing clock speed, using canonical signed digit (CSD) techniques. CSD replaces multiplier operations with add and subtract operations.

CSD minimizes the number of addition operations required for constant multiplication by representing binary numbers with a minimum count of nonzero digits.

fcsd

This option uses factored CSD (FCSD) techniques, which replace multiplier operations with shift and add/subtract operations on certain factors of the operands. These factors are generally prime but can also be a number close to a power of 2, which favors area reduction. You can achieve a greater area reduction with FCSD at the cost of decreasing clock speed.

auto

When you specify this option, the coder chooses between the CSD or FCSD optimizations. The coder chooses the optimization that yields the most area-efficient implementation, based on the number of adders required. When you specify auto, the coder does not use multipliers, unless conditions are such that CSD or FCSD optimizations are not possible (for example, if the design uses floating-point arithmetic).

HDL Block Properties

ConstMultiplierOptimization

Canonical signed digit (CSD) or factored CSD optimization. The default is none. See also ConstMultiplierOptimization.

ConstrainedOutputPipeline

Number of registers to place at the outputs by moving existing delays within your design. Distributed pipelining does not redistribute these registers. The default is 0. See also ConstrainedOutputPipeline.

DSPStyle

Synthesis attributes for multiplier mapping. The default is none. See also DSPStyle.

InputPipeline

Number of input pipeline stages to insert in the generated code. Distributed pipelining and constrained output pipelining can move these registers. The default is 0. See also InputPipeline.

OutputPipeline

Number of output pipeline stages to insert in the generated code. Distributed pipelining and constrained output pipelining can move these registers. The default is 0. See also OutputPipeline.

Complex Data Support

This block supports code generation for complex signals.

Was this topic helpful?