PRFM (register)

Loads and stores

fixed bit field field the encoding fixes should be

Memory single general register

313029282726252423222120191817161514131211109876543210
11111000101Rmx1xS10RnRt
sizeopcoption_name

11111000101xxxxxx1xx10xxxxxxxxxx

Decode Sail

assert(not_bool((match Rt {
  [bitone, bitone, _, _, _] => true,
  _ => false
}) : bool));
wback : bool = false;
let postindex : bool = false;
let 'scale = UInt(size);
if [option_name[1]] == 0b0 then {
    throw(Error_Undefined())
};
let extend_type : ExtendType = DecodeRegExtend(option_name);
let 'shift = if S == 0b1 then scale else 0;
let 'n = UInt(Rn);
let 't = UInt(Rt);
let 'm = UInt(Rm);
let nontemporal : bool = false;
memop : MemOp = undefined;
is_signed : bool = undefined;
regsize : {32, 64} = 32;
if [opc[1]] == 0b0 then {
    memop = if [opc[0]] == 0b1 then MemOp_LOAD else MemOp_STORE;
    regsize = if size == 0b11 then 64 else 32;
    is_signed = false
} else {
    if size == 0b11 then {
        memop = MemOp_PREFETCH;
        if [opc[0]] == 0b1 then {
            throw(Error_Undefined())
        };
        ()
    } else {
        memop = MemOp_LOAD;
        if size == 0b10 & [opc[0]] == 0b1 then {
            throw(Error_Undefined())
        };
        regsize = if [opc[0]] == 0b1 then 32 else 64;
        is_signed = true
    }
};
let 'regsize = regsize;
let 'datasize = (8 << scale);
let tagchecked : bool = memop != MemOp_PREFETCH;
wb_unknown : bool = false;
rt_unknown : bool = false;
c : Constraint = undefined;
if ((memop == MemOp_LOAD & wback) & n == t) & n != 31 then {
    c = ConstrainUnpredictable(Unpredictable_WBOVERLAPLD);
    assert(c == Constraint_WBSUPPRESS | c == Constraint_UNKNOWN | c == Constraint_UNDEF | c == Constraint_NOP);
    match c {
      Constraint_WBSUPPRESS => {
          wback = false
      },
      Constraint_UNKNOWN => {
          wb_unknown = true
      },
      Constraint_UNDEF => {
          throw(Error_Undefined())
      },
      Constraint_NOP => {
          EndOfInstruction()
      },
      _ => ()
    }
};
if ((memop == MemOp_STORE & wback) & n == t) & n != 31 then {
    let c : Constraint = ConstrainUnpredictable(Unpredictable_WBOVERLAPST);
    assert(c == Constraint_NONE | c == Constraint_UNKNOWN | c == Constraint_UNDEF | c == Constraint_NOP);
    match c {
      Constraint_NONE => {
          rt_unknown = false
      },
      Constraint_UNKNOWN => {
          rt_unknown = true
      },
      Constraint_UNDEF => {
          throw(Error_Undefined())
      },
      Constraint_NOP => {
          EndOfInstruction()
      },
      _ => ()
    }
};
execute_aarch64_instrs_memory_single_general_register(datasize, extend_type, m, memop, n, nontemporal, postindex, regsize, rt_unknown, shift, is_signed, t, tagchecked, wb_unknown, wback)

Operation Sail

let offset : bits(64) = ExtendReg(m, extend_type, shift, 64);
address : bits(64) = undefined;
data : bits('datasize) = undefined;
let privileged : bool = PSTATE.EL != EL0;
let accdesc : AccessDescriptor = CreateAccDescGPR(memop, nontemporal, privileged, tagchecked);
if n == 31 then {
    if memop != MemOp_PREFETCH then {
        CheckSPAlignment()
    };
    address = SP_read()
} else {
    address = X_read(n, 64)
};
if not_bool(postindex) then {
    address = address + offset
};
match memop {
  MemOp_STORE => {
      if rt_unknown then {
          data = __UNKNOWN_bits(datasize)
      } else {
          data = X_read(t, datasize)
      };
      if not_bool(wback) then {
          AArch64_SetLSInstructionSyndrome(DIV(datasize, 8), false, t, regsize == 64, false)
      };
      Mem_set(address, DIV(datasize, 8), accdesc) = data
  },
  MemOp_LOAD => {
      if not_bool(wback) then {
          AArch64_SetLSInstructionSyndrome(DIV(datasize, 8), is_signed, t, regsize == 64, false)
      };
      let data : bits('datasize) = Mem_read(address, DIV(datasize, 8), accdesc);
      if is_signed then {
          assert(constraint(('datasize > 0 & 'regsize >= 'datasize)));
          X_set(t, regsize) = SignExtend(data, regsize)
      } else {
          assert(constraint(('datasize >= 0 & 'regsize >= 'datasize)));
          X_set(t, regsize) = ZeroExtend(data, regsize)
      }
  },
  MemOp_PREFETCH => {
      Prefetch(address, t[4 .. 0])
  }
};
if wback then {
    if wb_unknown then {
        address = __UNKNOWN_bits(64)
    } else if postindex then {
        address = address + offset
    } else ();
    if n == 31 then {
        SP_set() = address
    } else {
        X_set(n, 64) = address
    }
};
if SPESampleInFlight then {
    SPESampleGeneralPurposeLoadStore()
};
()

Made from ScarletNX's Sail at 166ad3910f80. sail-arm's definitions are Arm's ASL in Sail (BSD 3-Clause Clear, license); ScarletNX's fixups are GPL-3.0-or-later.