Purpose: | To convert a Signed quantity to a different data type. |
Format: | opcode src.rx, dst.wy |
Operation: | dst <- converted src; |
Condition Codes: |
N <- dst LSS 0;
Z <- dst EQL 0;
V <- {src cannot be represented in dst};
C <- 0; |
Exceptions: | Integer Overflow;
Floating Point Overflow
Reserved Operand (Floating Point) |
Opcodes: |
99 | CVTBW | Convert Byte to Word |
98 | CVTBL | Convert Byte to Long |
4C | CVTBF | Convert Byte to Float |
6C | CVTBD | Convert Byte to Double |
33 | CVTWB | Convert Word to Byte |
32 | CVTWL | Convert Word to Long |
4D | CVTWF | Convert Word to Float |
6D | CVTWD | Convert Word to Double |
F6 | CVTLB | Convert Long to Byte |
F7 | CVTLW | Convert Long to Word |
4E | CVTLF | Convert Long to Float |
6E | CVTLD | Convert Long to Double |
48 | CVTFB | Convert Float to Byte |
49 | CVTFW | Convert Float to Word |
4A | CVTFL | Convert Float to Long |
4B | CVTRFL | Convert Rounded Float to Long |
56 | CVTFD | Convert Float to Double |
68 | CVTDB | Convert Double to Byte |
69 | CVTDW | Convert Double to Word |
6A | CVTDL | Convert Double to Long |
6B | CVTRDL | Convert Double Rounded to Long |
76 | CVTDF | Convert Double to Float |
|
Description: |
The source operand is convert to the data type of the destination operand and the destination operand is replaced by the result. The source operand is unaffected.
For integer format, conversion of a shorter data type to a longer data type is done by sign extension. A conversion of a longer data type to a shorter data type is done by truncation of the most significant bit.
For floating format, teh conversions are as follows:
CVTBF | exact | CVTFB | truncated |
CVTBD | exact | CVTDB | truncated |
CVTWF | exact | CVTFW | truncated |
CVTWD | exact | CVTDW | truncated |
CVTLF | rounded | CVTFL | truncated |
CVTLD | exact | CVTDL | truncated |
CVTFD | exact | CVTDF | rounded |
CVTRFL | rounded | CVTRDL | rounded |
|
Notes: |
- 1.
- Integer overflow occurs if any trucated bits of the source operand are not equal to the sign bit of the destination operand.
- 2.
- Only converts with an integer destination operand can result in an integer overflow. On integer overflow, the destination operand is replaced by the low order bits of the true result.
- 3.
- Only CVTDF can result in floating overflow. On floating overflow, the destination operand is replaced by an operand of all 0 bits except for a sign bit of 1 (a reserved operand). N <- 1; Z &lf- 0; V <-1; and C <- 0.
- 4.
- Only converts with a floating point source operand can result in a reserved operand fault. On a reserved operand fault, the destination operand is unaffected and the condition codes are unpredictable.
|