lswi

Load String Word Immediate

lswi RT, RA, NB

Loads a sequence of bytes from memory into general-purpose registers.

Details

Loads NB bytes from memory starting at address RA into a sequence of GPRs beginning at RT, filling registers left-to-right and wrapping from R31 back to R0 if necessary. This Base ISA instruction does not affect condition registers and provides a byte-oriented string load capability.

Pseudocode Operation

EA ← RA
reg ← RT
byte_index ← 0
for i ← 0 to (NB - 1) do
  GPRC[reg][(32 - 8*(byte_index+1)) : (31 - 8*byte_index)] ← MEM[EA+i : EA+i+7]
  byte_index ← byte_index + 1
  if byte_index = 4 then
    byte_index ← 0
    reg ← (reg + 1) mod 32
  end if
end for

Programming Note

This instruction is not supported in Little-Endian mode. If it is executed in Little-Endian mode, the system alignment error handler is invoked.

Example

lswi r3, r4, 4

Encoding

Binary Layout
31
0
RT
6
RA
11
NB
16
597
/
 
Format X-form
Opcode 0x7C0004AA
Extension Base

Operands

  • RT
    Start Register
  • RA
    Base
  • NB
    Byte Count