Branches, calls, returns, the control stack's pushes and pops, KIL and EXIT
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 |
| 1 | 1 | 1 | 0 | 0 | 0 | 1 | 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 | |||||||||||||||||||||||||||||
bits 63:48: 1110 0010 0110 ----
Runs execute_CAL with Form() 0.
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 |
|---|---|---|
| [51:20] | 51:20 | IndirectTarget |
| [40:36] | 40:36 | IndirectTarget |
| offset | 35:20 | IndirectTarget |
| pred.not | 19 | the decoder |
| pred | 18:16 | the decoder |
| Ra | 15:8 | RegA() |
| [5] | 5 | execute_CAL |
CAL, JCAL and PRET: CAL pushes the instruction after it and jumps; PRET only pushes its target, where a later RET returns. Without a call stack, the CRS stack's static walk followed the program's returns: a PRET pushes nothing at run time
let pret = Form() == 2;
let sp = CallPtr();
let room = UInt(sp) < 32;
let address = to_bits(32, if pret then BraTarget() else NextInsn());
foreach (k from 0 to 31) {
let at = sp == to_bits(32, k);
let old = CallStackRead(k);
CallStackWrite(k, if at then address else old)
};
CallPtrWrite(sp + (if room then 0x00000001 else 0x00000000));
if not_bool(pret) then
PcWrite(if room then (if Form() == 1 | Field(5, 1) == 0b1 then IndirectTarget(Form() == 0, false)
else to_bits(32, BraTarget()))
else 0xffffffff)
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).