fixed bit field field the encoding fixes should be
| 127 | 126 | 125 | 124 | 123 | 122 | 121 | 120 | 119 | 118 | 117 | 116 | 115 | 114 | 113 | 112 | 111 | 110 | 109 | 108 | 107 | 106 | 105 | 104 | 103 | 102 | 101 | 100 | 99 | 98 | 97 | 96 |
| reuse | wait | rd_bar | wr_bar | yield | stall | ||||||||||||||||||||||||||
| 95 | 94 | 93 | 92 | 91 | 90 | 89 | 88 | 87 | 86 | 85 | 84 | 83 | 82 | 81 | 80 | 79 | 78 | 77 | 76 | 75 | 74 | 73 | 72 | 71 | 70 | 69 | 68 | 67 | 66 | 65 | 64 |
| mode | kind | ||||||||||||||||||||||||||||||
| 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 |
| bank | off | ||||||||||||||||||||||||||||||
| 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 |
| r | Rd | pred.not | pred | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | ||||||||||||||||
bits 15:0: ---- 1011 1000 0010
Runs execute_LDC.
| Field | Bits | From |
|---|---|---|
| reuse | 125:122 | the decoder |
| wait | 121:116 | the decoder |
| rd_bar | 115:113 | the decoder |
| wr_bar | 112:110 | the decoder |
| yield | 109 | the decoder |
| stall | 108:105 | the decoder |
| mode | 79:78 | execute_LDC |
| kind | 75:73 | execute_LDC |
| bank | 58:54 | execute_LDC |
| off | 53:38 | execute_LDC |
| r | 31:24 | execute_LDC |
| Rd | 23:16 | the decoder |
| pred.not | 15 | the decoder |
| pred | 14:12 | the decoder |
LDC: a constant buffer's word (or byte, halfword, pair: NAK's MemType at 73), at the offset 38-53 plus the register at 24
let kind = UInt(Field(73, 3));
let bank = UInt(Field(54, 5));
let off = UInt(Field(38, 16));
let r = UInt(Field(24, 8));
let mode = UInt(Field(78, 2));
if (mode != 0 & mode != 2) | kind > 5 then throw(Unsupported("LDC of type %u, mode %u", kind, mode));
if r < RZ then {
let index = R_read(r);
if mode == 2 then {
/* NAK's LdcMode::IndexedSegmented (.IS): the register holds the bank past the instruction's in its upper
half and the byte offset in its lower half, as NAK packs them with PRMT for a bank known only at run
time. A select over the banks from the instruction's on (an unbound one reads zeros). One game's vertex
program that draws its frame into the window reads a record of bank 1 for each vertex,
c[(VertexId << 5) + 0x10000 + 8] */
let seg = index >> 16;
let low = index & 0x0000ffff;
foreach (w from 0 to (if kind == 5 then 1 else 0)) {
var v : bits(32) = 0x00000000;
foreach (b from bank to 17) {
let here = if kind < 4 then CbufSubwordAt(b, off, low, kind) else CbufLoadAt(b, off + 4 * w, low);
let is = seg == to_bits(32, b - bank);
v = if is then here else v
};
if Dst() + w < RZ then R_write(Dst() + w, v)
}
} else {
if HandleIndexed() then NoteHandleIndex(index, off);
if kind < 4 then R_write(Dst(), CbufSubwordAt(bank, off, index, kind)) else {
R_write(Dst(), CbufLoadAt(bank, off, index));
if kind == 5 & Dst() < RZ then R_write(Dst() + 1, CbufLoadAt(bank, off + 4, index))
}
}
} else if kind < 4 then R_write(Dst(), CbufSubword(bank, off, kind)) else {
R_write(Dst(), CbufLoad(bank, off));
if kind == 5 & Dst() < RZ then R_write(Dst() + 1, CbufLoad(bank, off + 4))
}
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 Mesa's NAK (sm70_encode.rs, MIT) and CuAssembler's sm_86 records.