4.5. Impulse C Signed and Unsigned DatatypesImpulse C provides predefined unsigned and signed integer datatypes for selected bit lengths ranging from 1 to 64, as shown in the following examples:
A simple convention is used to name these predefined types. Signed types have the name co_int followed by the bit length, while unsigned types have the name co_uint followed by the bit length. Variables of these types may be used in an Impulse C program for either software or hardware processes. A stream may have one of these C integer types as its data element type. During desktop simulation, types whose widths do not match one of the standard C types (for example, a 24-bit integer) are modeled using the next largest integer type. This can result in differences in bit-accurate behavior between the desktop simulation environment and a hardware implementation. To prevent such differences and ensure bit-accurate modeling, you may choose to use the bit-accurate arithmetic macro operations defined in the Impulse C library. Here are some examples of these macro operations:
Note that the bit-accurate macro operations are specified in terms of their return value bit width, and there is no enforcement or checking of bit widths of the operands. |