Fixed-Point Blockset |
 |
Code Generation Support
All fixed-point blocks support code generation, but not every simulation feature is supported. The code generation support is described below.
Languages
- C support only
- No Ada support
Storage Class of Variables
- Fixed-Point Blockset code generation handles variables that do not match the target compiler's sizes for char, short, int, or long. Code generation supports any variable having a width less than or equal to a long, either signed or unsigned. For example, the C40 compiler defines a long to be 32 bits. Therefore, the allowable sizes for variables range between 1 and 32 bits. This capability is particularly useful if you want to:
- Prototype on one target chip, but use a different target chip for production.
- Provide bit-true simulation in a rapid prototyping environment for odd data type sizes used by FPGA's, ASIC's, 24-bit DSP's, and so on.
- No floating-point support except for the fixed-point gateway blocks.
Storage Class of Parameters
- The Real-Time Workshop external mode support requires that parameters be 1 to 32 bits, either signed or unsigned. The parameter size must also be compatible with the target C compiler.
- No floating-point support
Rounding Modes
- All four rounding modes are supported.
- Rounding to floor generates the most efficient code for most cases.
Overflow Handling
- Saturation mode is supported.
- Wrapping mode is supported and generates the most efficient code.
- Automatic exclusion of saturation code when hardware saturation is available is currently not supported. Wrapping must be selected for the Real-Time Workshop to exclude saturation code.
Blocks
All blocks generate code for all operations with a few exceptions:
- The FixPt Look-Up Table, FixPt Look-Up Table (2D), and FixPt Dynamic Look-Up Table blocks generate code for all look-up methods except extrapolation.
- A few combinations of scaling and operations lead to highly inefficient code. These few cases are described in the next section.
Scaling
- Radix point-only scaling is supported.
- Slope/bias scaling is supported for all blocks except when it leads to highly inefficient code. All blocks except four support all cases of slope/bias scaling. The FixPt Gain, FixPt Matrix Gain, and FixPt FIR blocks support matched slope/bias scaling where the block input signals and output signals have the same slopes and biases, but not mismatched slope/bias scaling. The FixPt Product block supports mismatched slope, but not mismatched bias. For more information about matched and mismatched slope/bias scaling, refer to Signal Conversions.
It is generally recommended that signals with slope/bias scaling (such as a sensor input) are immediately converted to radix point-only scaling. This will typically produce more efficient code.
| Code Generation | | Generating Pure Integer Code |  |