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
Storage Class of Variables
- Fixed-Point Blockset code generation handles variables that do not match the target compiler sizes for
char
, short
, int
, or long
data types. 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 FPGAs, ASICs, 24-bit DSPs, and so on.
- The Fixed-Point Blockset supports floating-point types, except for custom floating-point types.
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 Real-Time Workshop to exclude saturation code.
Blocks
All blocks generate code for all operations with a few exceptions:
- The Look-Up Table, Look-Up Table (2D), and 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 Gain, Matrix Gain, and 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 Product block supports mismatched slope, but not mismatched bias. For more information about matched and mismatched [Slope Bias] scaling, refer to Signal Conversions.
- We generally recommend that signals with [Slope Bias] scaling (such as a sensor input) are immediately converted to radix point-only scaling. This typically produces more efficient code.
| Overview | | Generating Pure Integer Code |  |