3.1.3 Indexed Addressing Mode
Indexed addressing mode creates the effective address by adding
two general-purpose registers together. CAVA only has indexed
loads, there being no regular way to specify 3 registers in the
instruction set. Fortunately, indexed loads are used far more
often than indexed stores.
CAVA has two flavors of indexed loads: plain and scaled. Following
the terminology of displacement mode addressing, the y register
contains the base address and the x register contains
the index, which is replaced by the load data. Plain indexed
loads simply sums the base and the index registers. Scaled indexed
loads first shifts the index by the size of the access before the
addition.
Load with Sign Extension
| Mnemonic |
Format |
Unit |
Semantics |
Description |
| lxd |
xR |
mu |
x.j = slong(y.i + x.i) |
Load Indexed Double |
| lxw |
xR |
mu |
x.i = sword(y.i + x.i) sex |
Load Indexed Word |
| lxh |
xR |
mu |
x.i = shalf(y.i + x.i) sex |
Load Indexed Halfword |
| lxb |
xR |
mu |
x.i = sbyte(y.i + x.i) sex |
Load Indexed Byte |
| lsxd |
xR |
mu |
x.j = slong(y.i + (x.i << 3)) |
Load Scaled Indexed Double |
| lsxw |
xR |
mu |
x.i = sword(y.i + (x.i << 2)) sex |
Load Scaled Indexed Word |
| lsxh |
xR |
mu |
x.i = shalf(y.i + (x.i << 1)) sex |
Load Scaled Indexed Halfword |
Load With Zero Extension
| Mnemonic |
Format |
Unit |
Semantics |
Description |
| luxw |
xR |
mu |
x.i = uword(y.i + x.i) zrx |
Load Unsigned Indexed Word |
| luxh |
xR |
mu |
x.i = uhalf(y.i + x.i) zrx |
Load Unsigned Indexed Halfword |
| luxb |
xR |
mu |
x.i = ubyte(y.i + x.i) zrx |
Load Unsigned Indexed Byte |
| lusxw |
xR |
mu |
x.i = uword(y.i + (x.i << 2)) zrx |
Load Unsigned Scaled Indexed Word |
| lusxh |
xR |
mu |
x.i = uhalf(y.i + (x.i << 1)) zrx |
Load Unsigned Scaled Indexed Halfword |