Fixed-Point Blockset | ![]() ![]() |
Generating Pure Integer Code
All blocks generate pure integer code except for the Gateway In, Gateway In Inherited, and Gateway Out blocks. These blocks must generate floating-point code when handling floating-point input or output. However, if the input or output is an integer and the block is configured to treat the input or output as a stored integer, then these blocks will also generate pure integer code.
Example: Generating Pure Integer Code
This example outlines the steps you should take when generating pure integer code for your Fixed-Point Blockset model. The steps follow the description in the fxpdemo_code_only
demo, which includes the model shown below.
fxpdemo_feedback
model used for code generation.
sfix(8)
data type and to have an output scaling of 2^-4
.
Fixed-step
and
discrete (no continuous states)
, and configure Fixed step size to the
required value. The Solver window for this configuration is shown below.
RTW
Embedded Coder
as the system target file as shown below, and click OK.
Note that you may not have ERT code generation capability. If this is the
case, you should select the Generic Real-Time Target.
ERT code
generation options (1)
from the Category parameter drop-down
menu. Select the Integer code only check box and any other options that
you require. The ERT code generation options for this configuration are
shown below. If you are using GRT, the dialog box choices are slightly
different.
ERT code generation options (2)
from the Category parameter
drop-down menu. Select the Initialize floats and doubles to 0.0 check
box and any other options that you require, as shown below.
General code generation
options from the Category parameter
drop-down menu. Select the Generate HTML report check box and any
other options that you require, as shown below.
![]() | Code Generation Support | HTML Report | ![]() |