NEGZ
Instruction: Get a value, or its additive inverse, based on Z.
NEGZ RValue, < # > Value
Result: Value or –Value is stored in RValue.
- RValue (d-field) is the register in which to write Value or –Value.
- Value (s-field) is a register or a 9-bit literal whose value (if Z = 0) or additive inverse value (if Z = 1) will be written to RValue.
Opcode Table:
–INSTR– ZCRI –CON– –DEST– –SRC– | Z Result | C Result | Result | Clocks |
101110 001i 1111 ddddddddd sssssssss | Result = 0 | S[31] | Written | 4 |
Concise Truth Table:
In | Out | ||||||
Destination | Source | Z | C | Effects | Destination | Z | C |
$----_----; - | $FFFF_FFFF; -1 | 0 | - | wz wc | $FFFF_FFFF; -1 | 0 | 1 |
$----_----; - | $FFFF_FFFF; -1 | 1 | - | wz wc | $0000_0001; 1 | 0 | 1 |
$----_----; - | $0000_0000; 0 | x | - | wz wc | $0000_0000; 0 | 1 | 0 |
$----_----; - | $0000_0001; 1 | 0 | - | wz wc | $0000_0001; 1 | 0 | 0 |
$----_----; - | $0000_0001; 1 | 1 | - | wz wc | $FFFF_FFFF; -1 | 0 | 0 |
$----_----; - | $7FFF_FFFF; 2,147,483,647 | 0 | - | wz wc | $7FFF_FFFF; 2,147,483,647 | 0 | 0 |
$----_----; - | $7FFF_FFFF; 2,147,483,647 | 1 | - | wz wc | $8000_0001; -2,147,483,647 | 0 | 0 |
$----_----; - | $8000_0000; -2,147,483,648 | x | - | wz wc | $8000_0000; -2,147,483,6481 | 0 | 1 |
$----_----; - | $8000_0001; -2,147,483,647 | 0 | - | wz wc | $8000_0001; -2,147,483,647 | 0 | 1 |
$----_----; - | $8000_0001; -2,147,483,647 | 1 | - | wz wc | $7FFF_FFFF; 2,147,483,647 | 0 | 1 |
1 The smallest negative number (-2,147,483,648) has no corresponding positive value in 32-bit two's-complement math.
Explanation
NEGZ stores Value (if Z = 0) or –Value (if Z = 1) into RValue.
If the WZ effect is specified, the Z flag is set (1) if Value is zero. If the WC effect is specified, the C flag is set (1) if Value is negative or cleared (0) if Value is positive. The result is written to RValue unless the NR effect is specified.
Unless otherwise noted, content on this site is licensed under the
Creative Commons Attribution-ShareAlike 4.0 International License.