DSP Blockset | ![]() ![]() |
Performance-Related Settings in dspstartup.m
A number of the settings in the dspstartup
M-file are chosen to improve the performance of the simulation:
'SaveTime'
is set to 'off'
, Simulink does not save the tout
time-step vector to the workspace. The time-step record is not usually needed for analyzing discrete-time simulations, and disabling it saves a considerable amount of memory, especially when the simulation runs for an extended period of time. To enable time recording for a particular model, select the Time check box in the Workspace I/O panel of the Simulation Parameters dialog box (shown below).
'SaveOutput'
is set to 'off'
, Simulink Outport blocks in the top level of a model do not generate an output (yout
) in the workspace. To reenable output recording for a particular model, select the Output check box in the Workspace I/O panel of the Simulation Parameters dialog box (above).
'InvariantConstants'
is set to 'on'
, Simulink precomputes the values of all constant blocks (e.g., DSP Constant, Constant Diagonal Matrix) at the start of the simulation, and does not update them again for the duration of the simulation. Simulink additionally precomputes the outputs of all downstream blocks driven exclusively by constant blocks.
In the example below, the input to the top port (U
) of the Matrix Multiply block is computed only once, at the start of the simulation.
This eliminates the computational overhead of continuously reevaluating these constant branches, which in turn results in faster simulation, and smaller and more efficient generated code.
Note, however, that when 'InvariantConstants'
is set to 'on'
, changes that you make to parameters in a constant block while the simulation is running are not registered by Simulink, and do not affect the simulation. If you would like to adjust the model constants while the simulation is running, you can turn off 'InvariantConstants'
by clearing the Inline parameters check box in the Advanced panel of the Simulation Parameters dialog box.
However, because typical DSP processors offer zero-overhead looping, code size is the primary optimization constraint in most designs. It is therefore more efficient to minimize code size by generating a loop for every instance of iteration, regardless of the number of repetitions. This is what the 'RTWOptions'
loop-rolling setting in dspstartup
accomplishes.
![]() | Using dspstartup.m | Miscellaneous Settings | ![]() |