Integer, logic, video and predicate instructions
fixed bit field field the encoding fixes should be
| 63 | 62 | 61 | 60 | 59 | 58 | 57 | 56 | 55 | 54 | 53 | 52 | 51 | 50 | 49 | 48 | 47 | 46 | 45 | 44 | 43 | 42 | 41 | 40 | 39 | 38 | 37 | 36 | 35 | 34 | 33 | 32 |
| 0 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | |||||||||||||||||||
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| pred.not | pred | Ra | Rd | ||||||||||||||||||||||||||||
bits 63:48: 0101 1011 1101 1---
Runs execute_LEA with Form() 3.
| 63 | 62 | 61 | 60 | 59 | 58 | 57 | 56 | 55 | 54 | 53 | 52 | 51 | 50 | 49 | 48 | 47 | 46 | 45 | 44 | 43 | 42 | 41 | 40 | 39 | 38 | 37 | 36 | 35 | 34 | 33 | 32 |
| 0 | 0 | 0 | 1 | 1 | 0 | ||||||||||||||||||||||||||
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| pred.not | pred | Ra | Rd | ||||||||||||||||||||||||||||
bits 63:48: 0001 10-- ---- ----
Runs execute_LEA with Form() 4.
| 63 | 62 | 61 | 60 | 59 | 58 | 57 | 56 | 55 | 54 | 53 | 52 | 51 | 50 | 49 | 48 | 47 | 46 | 45 | 44 | 43 | 42 | 41 | 40 | 39 | 38 | 37 | 36 | 35 | 34 | 33 | 32 |
| 0 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | |||||||||||||||||||
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| pred.not | pred | Ra | Rd | ||||||||||||||||||||||||||||
bits 63:48: 0101 1011 1101 0---
Runs execute_LEA with Form() 0.
| 63 | 62 | 61 | 60 | 59 | 58 | 57 | 56 | 55 | 54 | 53 | 52 | 51 | 50 | 49 | 48 | 47 | 46 | 45 | 44 | 43 | 42 | 41 | 40 | 39 | 38 | 37 | 36 | 35 | 34 | 33 | 32 |
| 0 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | ||||||||||||||||||||
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| pred.not | pred | Ra | Rd | ||||||||||||||||||||||||||||
bits 63:48: 0100 1011 1101 ----
Runs execute_LEA with Form() 1.
| 63 | 62 | 61 | 60 | 59 | 58 | 57 | 56 | 55 | 54 | 53 | 52 | 51 | 50 | 49 | 48 | 47 | 46 | 45 | 44 | 43 | 42 | 41 | 40 | 39 | 38 | 37 | 36 | 35 | 34 | 33 | 32 |
| 0 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | ||||||||||||||||||||
| 31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| pred.not | pred | Ra | Rd | ||||||||||||||||||||||||||||
bits 63:48: 0011 011- 1101 0---
Runs execute_LEA with Form() 2.
The operation reads some of these fields in some forms alone (it chooses by Form()), so the diagrams show only the decoder's.
| Field | Bits | From |
|---|---|---|
| [50:48] | 50:48 | execute_LEA |
| sum | 47 | execute_LEA |
| hi | 46:39 | execute_LEA |
| pred.not | 19 | the decoder |
| pred | 18:16 | the decoder |
| Ra | 15:8 | RegA() |
| Rd | 7:0 | Dst() |
LEA: (a << shift) + b, its high form the high word of (c:a) << shift; negated with 45 (37, 56 in the high forms: the high word's two's complement with the low word's carry). .X adds the carry in (LO at 46, HI at 38 or 57), .CC writes the flags, and LO's predicate takes the add's carry out: LEA.LO ... P0 then LEA.HI.X is how a 64-bit address is formed
let f = Form(); /* 0 LR, 1 LC, 2 LI, 3 HR, 4 HC */
let high_form = f >= 3;
let shift = UInt(Field(if high_form then (if f == 3 then 28 else 51) else 39, 5));
let negative = Field(if high_form then (if f == 3 then 37 else 56) else 45, 1) == 0b1;
let source0 = R_read(RegA());
let rhs = if f == 0 | f == 3 then R_read(RegB()) else if f == 2 then Right(2) else Right(1);
let value : bits(32) = if high_form then {
let hi = R_read(UInt(Field(39, 8)));
let v = if shift != 0 then (source0 >> to_bits(32, 32 - shift)) | (hi << to_bits(32, shift)) else hi;
if negative then {
let carry = (source0 << to_bits(32, shift)) == 0x00000000;
not_vec(v) + (if carry then 0x00000001 else 0x00000000)
} else v
} else {
let source = if negative then 0x00000000 - source0 else source0;
source << to_bits(32, shift)
};
let extended = Field(if f == 3 then 38 else if f == 4 then 57 else 46, 1) == 0b1;
let old_carry = if extended then FlagRead(2) else false;
let sum = IntegerAdd(value, rhs, 0, if extended then 1 else 0, UInt(Field(47, 1)));
R_write(Dst(), sum);
if UInt(Field(48, 3)) < 7 then {
let carry0 = UInt(sum) < UInt(value);
let carry = if extended then RawOr(carry0, RawAnd(old_carry, sum == value)) else carry0;
PredWrite(UInt(Field(48, 3)), carry)
}
Made from ScarletNX's Sail at 166ad3910f80. The Sail and the encodings' file are ScarletNX's (GPL-3.0-or-later); its encodings are from Eden's maxwell.inc (GPL-2.0-or-later).