JCAL

Branches, calls, returns, the control stack's pushes and pops, KIL and EXIT

fixed bit field field the encoding fixes should be

JCAL

6362616059585756555453525150494847464544434241403938373635343332
111000100010
313029282726252423222120191817161514131211109876543210
pred.notpredRa

bits 63:48: 1110 0010 0010 ----

Runs execute_CAL with Form() 1.

Fields

The operation reads some of these fields in some forms alone (it chooses by Form()), so the diagrams show only the decoder's.

FieldBitsFrom
[51:20]51:20IndirectTarget
[40:36]40:36IndirectTarget
offset35:20IndirectTarget
pred.not19the decoder
pred18:16the decoder
Ra15:8RegA()
[5]5execute_CAL

Operation Sail

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).