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

ID 683337
Date 12/04/2023

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

Document Table of Contents Creating the Finite State Machine Configuration File

The DSP Builder m-script, substitutePlaceholderValues, allows you to insert parameter values into a .fsm configuration template file.
Figure 150. Example count_edges_template.fsm
# Counts N rising/falling edges
require version 23.3
inputs x
finish done
for n 0 < %NEDGES% : c
    transitions EdgeDetect
        state Initial
            if (~x) Low
            if (x) High
        state Low
            if (x) %RISING%
        state High
            if (~x) %FALLING%


  1. In the setup script for your DSP Builder model, create a cell array that defines the parameter values:
    Figure 151. Parameter ValuesThe parameter placeholder names do not have to be in the %NAME% format. They can be any arbitrary string. Adding a unique delimiter makes it easier to identify what is a parameter.
    parameterDefinitions = {
        {'%NEDGES%', 5 },
        {'%RISING%', 'Initial'},
        {'%FALLING%', 'Low'}};
  2. Generate the .fsm configuration file that the Finite State Machine block uses by calling the m-script:
    substitutePlaceholderValues(parameterDefinitions, 'count_edges_template.fsm', 'count_rising_edges.fsm');