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 | 0 | 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 |
| Rb | pred.not | pred | Ra | Rd | |||||||||||||||||||||||||||
bits 63:48: 0101 1011 00-- ----
Runs execute_XMAD 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 | 1 | 0 | 0 | 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 |
| Rb | pred.not | pred | Ra | Rd | |||||||||||||||||||||||||||
bits 63:48: 0101 0001 0--- ----
Runs execute_XMAD 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 | 1 | 0 | 0 | 1 | 1 | 1 | cbuf.bank | cbuf.offset | |||||||||||||||||||||||
| 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 |
| cbuf.offset | pred.not | pred | Ra | Rd | |||||||||||||||||||||||||||
bits 63:48: 0100 111- ---- ----
Runs execute_XMAD with Form() 2.
| 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 | imm.sign | 0 | 0 | imm | |||||||||||||||||||||
| 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 |
| imm | pred.not | pred | Ra | Rd | |||||||||||||||||||||||||||
bits 63:48: 0011 011- 00-- ----
Runs execute_XMAD with Form() 3.
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 |
|---|---|---|
| mrg | 56 | execute_XMAD |
| psl | 55 | execute_XMAD |
| extended | 54 | execute_XMAD |
| left | 53 | execute_XMAD |
| half_b | 52 | execute_XMAD |
| sel | 52:50 | execute_XMAD |
| sel | 51:50 | execute_XMAD |
| right | 49 | execute_XMAD |
| left | 48 | execute_XMAD |
| sum | 47 | execute_XMAD |
| source_b | 46:39 | execute_XMAD |
| extended | 38 | execute_XMAD |
| mrg | 37 | execute_XMAD |
| psl | 36 | execute_XMAD |
| [35:20] | 35:20 | execute_XMAD |
| half_b | 35 | execute_XMAD |
| Rb | 27:20 | RegB() |
| pred.not | 19 | the decoder |
| pred | 18:16 | the decoder |
| Ra | 15:8 | RegA() |
| Rd | 7:0 | Dst() |
XMAD: Each form's operands and fields, as Eden reads them: B is Rb (R), Rc at bit 39 (RC), a constant buffer word (CR) or a 16-bit immediate (I), and C is Rc or the constant buffer word. The product of A's and B's halves (signed by bits 48 and 49) is shifted up 16 by PSL; the select picks C, its low or high half, or adds B << 16 to it (CBCC); MRG puts B's low half in the result's high half. X adds the carry and CC writes the flags, as IADD's do (Eden refuses both)
let f = Form();
let narrow = f == 1 | f == 2;
let source_b = if f == 0 then R_read(RegB()) else if f == 1 then R_read(UInt(Field(39, 8)))
else if f == 2 then CbufWord() else Bits32(ZeroExtend(Field(20, 16), 32));
let source_c = if f == 1 then CbufWord() else R_read(UInt(Field(39, 8)));
let sel = if narrow then UInt(Field(50, 2)) else UInt(Field(50, 3));
let half_b = if f == 0 then UInt(Field(35, 1)) else if narrow then UInt(Field(52, 1)) else 0;
let psl = if f == 2 then Field(55, 1) == 0b1 else if f == 1 then false else Field(36, 1) == 0b1;
let mrg = if f == 2 then Field(56, 1) == 0b1 else if f == 1 then false else Field(37, 1) == 0b1;
let extended = if narrow then UInt(Field(54, 1)) else UInt(Field(38, 1));
let sixteen = Bits32(0x00000010);
let left = XmadHalf(R_read(RegA()), UInt(Field(53, 1)), UInt(Field(48, 1)));
let right = XmadHalf(source_b, half_b, UInt(Field(49, 1)));
let product0 = left * right;
let product = if psl then product0 << sixteen else product0;
let third = if sel == 1 then XmadHalf(source_c, 0, 0) else if sel == 2 then XmadHalf(source_c, 1, 0)
else if sel == 4 then (source_b << sixteen) + source_c else source_c;
let sum = IntegerAdd(product, third, 0, extended, UInt(Field(47, 1)));
R_write(Dst(), if mrg then (sum & 0x0000ffff) | ((source_b & 0x0000ffff) << sixteen) else sum)
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).