User`s guide
3 Working with Real-Time Workshop
3-36
sin(example_P.SineWave_Freq * example_M->Timing.t[0] +
example_P.SineWave_Phase) + example_P.SineWave_Bias;
rtb_gain_out = rtb_sin_out * example_P.Gain_Gain;
example_Y.Out1 = rtb_gain_out;
}
This code is more efficient in terms of memory usage. The efficiency
improvement gained by enabling
Enable local block outputs and Reuse
block outputs
would be more significant in a large model with many signals.
A Further Optimization: Expression Folding
As a final optimization, you turn on expression folding, a code optimization
technique that minimizes the computation of intermediate results and the
use of temporary buffers or variables.
Enable expression folding and regenerate the code as follows:
1 On the Optimization pane of the Configuration Parameters dialog,
select the
Eliminate superfluous temporary variables (Expression
folding)
option.
2 Make sure that Signal storage reuse is still selected, as shown above.
3 Click Apply.