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

ID 683337
Date 6/26/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

11.6.2. Using Data Type Variables to Parameterize Designs

Commonly, you change the precision of a DSP Builder design by using scripts. However, writing scripts to update the floating-point precision drop-down menu for all blocks in the design is tedious.
Use data-type variables to parameterize designs by data type.

Procedure

  1. At the MATLAB console, initialize a variable with the following command:
    >> inputType = dspba.vpfloat(26,17)
    inputType = 
    Class: 'FLOAT' 
    ExpBits: 8 
    FracBits: 17

    This MATLAB structure specifies the floating-point precision similar to how fixdt() specifies fixed-point precisions.

  2. For the top-level Convert block on the input wire, open the parameter dialog box:
    1. Set the Output data type mode to Specify via dialog.
    2. Delete the Output data type field and type the variable name inputType.
  3. Repeat for the Convert block in the primitive subsystem, so that the same data type propagates to both inputs of the Mult blocks.
  4. Change the floating-point precision of the design, by assigning a different type to the variable inputType. You can also initialize the type variable using the data type name:
    >> inputType = dspba.namedVPFloat('float26_m17')
    >> inputType = dspba.namedVPFloat('single')