DSP Builder for Intel® FPGAs (Advanced Blockset): Handbook

ID 683337
Date 9/30/2024
Public
Document Table of Contents

14.4.34. Look-Up Table (Lut)

The DSP Builder Lut block outputs the contents of a look-up table, indexed by the input.

q = LUT[a]

The size of the table determines the size of the initialization arrays.

Table 215.  Parameters for the Lut Block
Parameter Description
Output data type mode Determines how the block sets its output data type:
  • Inherit via internal rule: the number of integer and fractional bits is the maximum of the number of bits in the input data types.
  • Inherit via back projection: a downstream block that this block drives determines the output data type. If the driven block does not propagate a data type to the driver, you must use a Simulink SameDT block to copy the required data type to the output wire.
  • Specify via dialog: you can set the output type of the block explicitly using additional fields that are available when this option is selected. This option reinterprets the output bit pattern from the LSB up according to the specified type.
  • Boolean: the output type is Boolean.
  • Single: single-precision floating-point data.
  • Double: double-precision floating-point data.
  • Variable precision floating point: variable precision floating-point output type
Output data type Specifies the output data type. For example, sfix(16), uint(8).
Output scaling value Specifies the output scaling value. For example, 2^-15.
Output value map Specifies the location of the output values. For example, round([0;254]/17). This parameter may also be a fi object when specifying data of arbitrarily high precision.
Floating point precision Specifies the floating-point precision. For example, float32_m23.

You can specify the contents of the Lut block in one of the following ways:

  • Specify table contents with a single row or column vector. The length of the 1D row or column vector determines the number of addressable entries in the table. If DSP Builder reads vector data from the table, all components of a given vector share the same value.
  • When a look-up table contains vector data, you can provide a matrix to specify the table contents. The number of rows in the matrix determines the number of addressable entries in the table. Each row specifies the vector contents of the corresponding table entry. The number of columns must match the vector length, otherwise DSP Builder issues an error.
Note: The default initialization of the LUT is a row vector round([0:255]/17). This vector is inconsistent with the default for the DualMem block, which is a column vector [zeros(16, 1)]. The latter form is consistent with the new matrix initialization form in which the number of rows determines the addressable size.

Every Primitive library block accepts double-precision floating-point values when specifying mask parameters. This format limits precision to no more than 53 bits, which is more than sufficient for most of the blocks. For higher precision, the Const, DualMem, or LUT blocks optionally accept values using Simulink's Fixed Point data type. For example:

constValue = fi(0.142, 1, 16, 15)

vectorValue = fi(sin([0:10]'), 1, 18, 15)

To configure a Const, DualMem, or LUT with data of precision higher than IEEE double precision, create a MATLAB fi object of the required precision that contains the high precision data. Avoid truncation when creating this object. Use the fi object to specify the Value of the Const, the Initial Contents of the DualMem block, or the Output value map of the LUT block.

Table 216.  Port Interface for the Lut Block
Signal Direction Type Description Vector Data Support Complex Data Support
a Input Any fixed--point type Operand Yes No
q Output Derived fixed- or floating-point type Result Yes Yes (with output value map)