Assembly:

UALH rt, offset(rs)

nanoMIPS, not available in NMS

Unaligned Load Half

Purpose:

Unaligned Load Half.

Load signed halfword to register $rt from memory address $rs +

offset (register plus immediate), guaranteeing that the operation completes even if the address is not halfword aligned.

Availability:

nanoMIPS, not available in NMS

Format:

101001

rt

rs

s[8]

0100

0

01

s[7:0]

6

5

5

1

4

1

2

8

Operation:

if C0.Config5.NMS == 1:
    raise exception('RI')
offset = sign_extend(s, from_nbits=9)
va = effective_address(GPR[rs], offset, 'Load')
data = read_memory_at_va(va, nbytes=2, unaligned_support='always')
GPR[rt] = sign_extend(data, from_nbits=16)

UALH will not cause an Address Error exception for unaligned addresses.

An unaligned load/store instruction may be implemented using more than one memory transaction.It is possible for a subset of these memory transactions to have completed and then for a TLB exception to

occur on a remaining transaction.It is also possible that memory could be modified by another thread or device in between the completion of the memory transactions. This behavior is equivalent to what

might occur if the unaligned load/store was carried out in software using a series of separate aligned instructions, for instance using LWL/LWR on a pre-R6 MIPS™ core. Software should take equivalent

steps to accommodate this lack of guaranteed atomicity as it would for the multiple instruction case.

Exceptions:

Bus Error. Reserved Instruction on NMS cores. TLB Invalid. TLB Refill. TLB Read Inhibit. Watch.