ADD $X,$Y,$Z | ADD $X,$Y,Z |
SUB $X,$Y,$Z | SUB $X,$Y,Z |
MUL $X,$Y,$Z | MUL $X,$Y,Z |
DIV $X,$Y,$Z | DIV $X,$Y,Z |
Specification:
ADD: s($X) | ← s($Y) + s($Z) | ||||||||||||
SUB: s($X) | ← s($Y) - s($Z) | ||||||||||||
MUL: s($X) | ← s($Y) * s($Z) | ||||||||||||
DIV: |
the integer part of the Quotient and
the remainder in special register rR. |
All instructions exist in two variants. The second operand can either be a register $Z or an immediate value Z.
Timing:
ADD: | 1υ |
SUB: | 1υ |
MUL: | 10υ |
DIV: | 60υ |
Description:
ADD: | The sum $Y +$Z or $Y +Z is placed into register X using signed, two's complement arithmetic. An integer overflow exception occurs if the sum is ≥ 263 or < -263. |
SUB: | The difference $Y - $Z or $Y - Z is placed into register X using signed, two's complement arithmetic. An integer overflow exception occurs if the difference is ≥ 263 or < -263 |
MUL: | The signed product of the number in register Y by either the number in $Z or the unsigned byte Z replaces the contents of register X. An integer overflow exception can occur, as with ADD or SUB, if the result is ≥ 263 or < -263. (Consider: Immediate multiplication by powers of 2 can be done more rapidly with the SL instruction) |
DIV: | The signed quotient of the number in $Y divided by either the number in $Z or the unsigned byte Z replaces the contents of $X, and the signed remainder is placed in the special remainder register rR. An integer divide check exception occurs if the divisor is zero; in that case $X is set to zero and rR is set to $Y. An integer overflow exception occurs if the number -263 is divided by -1; otherwise integer overflow is impossible. The quotient of y divided by z is defined to be [y/z], and the remainder is defined to be y - [y/z]z (also written y mod z). Thus, the remainder is either zero or has the sign of the divisor. (Consider: Dividing by z = 2t gives exactly the same quotient as shifting right via the SR command, and exactly the same remainder as anding with z - 1 via the AND command. Division of a positive 63-bit number by a positive constant can be accomplished more quickly by computing the upper half of a suitable unsigned product and shifting it right appropriately.) |
See also: