All instructions in this category are G1 instructions. In fact, they are the
same instruction: ALU, engaging the ALU in different operation modes. For
the programmer's convenience, the ALU instruction is assembled and
disassembled as different sub-instructions, depending on the contents of the
ALU instruction field. Since binary arithmetic and logic instructions are effectively one
instruction, semantics are the same throughout. Only the arithmetic or
logic operation differs.
Operation
These instructions apply an arithmetic or logic operation on the contents of
registers A (denoted by bits aaa) and B (denoted by bits bbb) and
store the result in register X (denoted by bits xxx).
Masking Modes
Use of Masking Modes modifies the way arithmetic/logic is performed
and masks the result. Vector mode (e.g. ADD.v or simply ADD) adds vector
operands (wo and rd ordinates added separately). Scalar mode
(e.g. XOR.s) treats register contents as 18-bit words. X and Y
modes (e.g. SUB.x and AND.y respectively) add only the rd
and wo parts of a word respectively, leaving the rest untouched.
Examples
The easiest and most illustrative instruction is, of course, addition. Using
initial register values $1=123456, $2=654321, $3=555555,
$4=$5=$6=$7=222222, the following instructions can be executed:
Final register values: $4=777777, $5=222777, $6=700233,
$7=701233. Note the difference between the last two instructions. The
Scalar mode instruction (.s prefix) propagates the carry past the wo/rd
boundary, whereas the default, vector mode does not.
ADD — Add registers
| Instruction | ADD x,a,b |
|---|---|
| Format | 1mm 000 xxx 000 aaa bbb |
| Semantics | X ← A + B |
| Cycles | 4 |
SUB — Subtract registers
| Instruction | SUB x,a,b |
|---|---|
| Format | 1mm 000 xxx 001 aaa bbb |
| Semantics | X ← A - B |
| Cycles | 4 |
AND — Bitwise And
| Instruction | AND x,a,b |
|---|---|
| Format | 1mm 000 xxx 010 aaa bbb |
| Semantics | X ← A ∧ B |
| Cycles | 4 |
Since there is no carry, this instruction works in exactly the same way in both Vector and Scalar modes.
OR — Bitwise Or
| Instruction | OR x,a,b |
|---|---|
| Format | 1mm 000 xxx 011 aaa bbb |
| Semantics | X ← A ∨ B |
| Cycles | 4 |
Since there is no carry, this instruction works in exactly the same way in both Vector and Scalar modes.
XOR — Bitwise Exclusive Or
| Instruction | XOR x,a,b |
|---|---|
| Format | 1mm 000 xxx 100 aaa bbb |
| Semantics | X ← A ⊗ B |
| Cycles | 4 |
Since there is no carry, this instruction works in exactly the same way in both Vector and Scalar modes.





Add new comment