TYPECAST

Type casting / Fixed point
Inputs(1) i
Parameters(0)
Default
Text1
Text2
Select from Components/Blocks/All
Function Type casting for creating the typesb in the embedded C code or Fixed Point simulations.

The C type of the variables can be determined per component. Although the compiler has the ability to handle all variables of the type double, for efficiency reasons integer or byte types can improve the size and speed of the code. For example, the data type "byte" can be efficient for an eight-bit microprocessor and the "int" type for a 16-bit microprocessor. Be careful with using "bit" types, since they mostly use 8 or 16 bits instead.

Also the fixed-point types are available as _int8 until _int64. Prefixes as external or static declarations can be defined separately.

If components should not be exported to C-code, a checkmark is provided to disable the export of the code for that particular component.

Some compilers offer register variables, but their explicit use can sometimes disprove the overall performance. Therefore Caspoc does not support this type. The assignment of register variables is left to the compiler, which in some cases will dedicate regular used variables to a register in the microprocessor. In Caspoc you can choose between Register, extern and static declarations.

In the simulation the output of the component is also limited in data-size to the defined type. For example, a component defined as being of the type _int8, will be limited to +/- 128 bits. And a short char will be limited between 0 and 256.

This avoids the need for a special block set for fixed-point models. To change the type of a signal in the block-diagram, the block Typecast can be used.

Special Use the type casting also for creating fixed point simulation!
© 2018 CASPOC, All rights reserved. Home   |   Terms and Conditions   |   Legal   |   Export Compliance   |   Privacy Policy   |   Site Map