This is an expected behavior in Real-Time Workshop Embedded Coder.
To work around this issue, disable the option Eliminate superfluous temporary variables (Expression folding) which generates this code:
rtb_DataTypeConversion4 = (int16_T)sample_m_U.In1;
rtb_DataTypeConversion4 <<= 7U;
sample_m_Y.Out1 = rtb_DataTypeConversion4;
In order to disable the option "Eliminate superfluous temporary variables (Expression folding)", uncheck the checkbox for this option in the model's
Simulation -> Configuration Parameters -> Optimization pane.
Best Answer