n-D Lookup Table

Approximate N-dimensional function (HDL Coder)

Description

The n-D Lookup Table block is available with Simulink®.

For information about the simulation behavior and block parameters, see n-D Lookup Table.

HDL Architecture

This block has a single, default HDL architecture.

HDL Block Properties

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.

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.

Restrictions

Required Block Settings

  • Number of table dimensions: HDL Coder™ supports a maximum dimension of 2.

  • Breakpoints specification: You can select either Explicit values or Even spacing.

  • Index search method: Select Evenly spaced points.

  • Extrapolation method: The coder supports only Clip. The coder does not support extrapolation beyond the table bounds.

  • Interpolation method: The coder supports only Flat or Linear.

  • Diagnostic for out-of-range input: Select Error. If you select other options, the coder displays a warning.

  • Use last table value for inputs at or above last breakpoint: Select this check box.

  • Require all inputs to have the same data type: Select this check box.

  • Fraction: Select Inherit: Inherit via internal rule.

  • Integer rounding mode: Select Zero, Floor, or Simplest.

Avoid Generation of Divide Operator

If HDL Coder encounters conditions under which a division operation is required to match the model simulation behavior, a warning is displayed. The conditions described cause this block to emit a divide operator. When you use this block for HDL code generation, avoid the following conditions:

  • If the block is configured to use interpolation, a division operator is required. To avoid this requirement, set Interpolation method : to Flat.

  • Uneven table spacing. HDL code generation requires the block to use the "Evenly Spaced Points" algorithm. The block mapping from the input data type to the zero-based table index in general requires a division. When the breakpoint spacing is an exact power of 2, this divide is implemented as a shift instead of as a divide. To adjust the breakpoint spacing, adjust the number of breakpoints in the table, or the difference between the left and right bounds of the breakpoint range.

Table Data Typing and Sizing

  • It is good practice to structure your table such that the spacing between breakpoints is a power of two. If the breakpoint spacing does not meet this condition, HDL Coder issues a warning. When the breakpoint spacing is a power of two, you can replace division operations in the prelookup step with right-shift operations.

  • Table data must resolve to a nonfloating-point data type.

  • All ports on the block require scalar values.

Was this topic helpful?