Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

abs Rd

Rd = |Rd|;
d ∈ {0, 1, …, 15}

Rev1+

010111000100

Rd

12

4

Description

The absolute value of the contents to the register specified is written back to the register. If the initial value equals the maximum negative value (0x80000000), the result will equal the initial value.

Status Flags:

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

(RES[31:0] == 0)

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

acall disp

LR = PC + 2;
PC = *(ACBA + (ZE(disp8)<<2));
disp ∈ {0, 4, ..., 1020}

Rev1+

1101

disp8/Label

0000

4

8

4

Description

The ACALL instruction performs an application function call.

Status Flags:

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Note:

ACBA must be word aligned. Failing to align ACBA correctly may lead to erronous be- havior.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

acr Rd

Rd = Rd + C;
d ∈ {0, 1, …, 15}

Rev1+

010111000000

Rd

12

4

Description

Adds carry to the specified destination register.

Status Flags

Q:

Not affected

V:

V = RES[31] AND ~Rd[31]

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0) AND Z

C:

C = ~RES[31] AND Rd[31]

Example:

; Add a 32-bit variable (R0) to a 64-bit variable (R2:R1)
add
R1, R0
acr
R2

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

adc Rd, Rx, Ry

Rd = Rx + Ry + C;
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

000000000100

Rd

3

4

5

4

12

4

Description

Adds carry and the two registers specified and stores the result in destination register.

Status Flags:

Q:

Not affected

V:

V = (Rx[31] AND Ry[31] AND ~RES[31]) OR (~Rx[31] AND ~Ry[31] AND RES[31])

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0) AND Z

C:

C = Rx[31] AND Ry[31] OR Rx[31] AND ~RES[31] OR Ry[31] AND ~RES[31]

Example

; Add two 64-bit variables R1:R0 and R3:R2 and store the result in R1:R0 add

R0, R2

adc

R1, R1, R3

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

add Rd, Rs

Rd = Rd + Rs;
{d, s} ∈ {0, 1, …, 15}

Rev1+

000

Rs

00000

Rd

3

4

5

4

2

add Rd, Rx, Ry << sa

Rd = Rx + (Ry<< sa2);
{d, x, y}∈ {0, 1, …, 15}
sa ∈ {0, 1, 2, 3}

Rev1+

111

Rx

00000

Ry

0000000000

Shift Amount

Rd

3

4

5

4

10

2

4

Description

Adds the two registers specified and stores the result in destination register. Format II allows shifting of the second operand.

Status Flags

Format I: OP1 = Rd, OP2 = Rs

Format II:OP1 = Rx, OP2 = Ry << sa2

Q:

Not affected

V:

V = (OP1[31] AND OP2[31] AND ~RES[31]) OR (~OP1[31] AND ~OP2[31] AND RES[31])

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

C = OP1[31] AND OP2[31] OR OP1[31] AND ~RES[31] OR OP2[31] AND ~RES[31]

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

addabs Rd, Rx, Ry

Rd = Rx + |Ry|;
{d, x, y}∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

000011100100

Rd

3

4

5

4

12

4

Description

Adds Rx and the absolute value of Ry and stores the result in destination register. Useful for cal- culating the sum of absolute differences.

Status Flags

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Z = (RES[31:0] == 0)

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

addhh.wRd, Rx:<part>, Ry:<part>

If (Rx-part == t) then operand1 = SE(Rx[31:16]) else operand1 = SE(Rx[15:0]);
If (Ry-part == t) then operand2 = SE(Ry[31:16]) else operand2 = SE(Ry[15:0]);
Rd = operand1 + operand2;
{d, x, y} ∈ {0, 1, …, 15}
part ∈ {t,b}

Rev1+

111

Rx

00000

Ry

0000111000

X

Y

Rd

3

4

5

4

10

1

2

0

Description

Adds the two halfword registers specified and stores the result in the destination word-register. The halfword registers are selected as either the high or low part of the operand registers.

Status Flags:

OP1 = operand1, OP2 = operand2

Q:

Not affected

V:

V = (OP1[31] AND OP2[31] AND ~RES[31]) OR (~OP1[31] AND ~OP2[31] AND RES[31])

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

C = OP1[31] AND OP2[31] OR OP1[31] AND ~RES[31] OR OP2[31] AND ~RES[31]

Example:

addhh.wR10, R2:t, R3:b
will perform R10 = SE(R2[31:16])  + SE(R3[15:0])

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

add{cond4}Rd, Rx, Ry

if ( cond4)
Rd = Rx + Ry;
{d, x, y} ∈ {0, 1, …, 15}
cond4 ∈ {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al}

Rev2+

111

Rx

11101

Ry

1110

cond4

0000

Rd

3

4

5

4

4

4

4

4

Description

Performs an addition and stores the result in destination register.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

and Rd, Rs

Rd = Rd AND Rs;
{d, s} ∈ {0, 1, …, 15}

Rev1+

000

Rs

00110

Rd

3

4

5

4

2

and Rd, Rx, Ry << sa

Rd = Rx AND (Ry << sa5);
{d, x, y} ∈ {0, 1, …, 15}
sa ∈ {0, 1, …, 31}

Rev1+

111

Rx

11110

Ry

0000000

sa5

Rd

3

4

5

4

7

5

4

3

and Rd, Rx, Ry >> sa

Rd = Rx AND (Ry >> sa5);
{d, x, y} ∈ {0, 1, …, 15}
sa ∈ {0, 1, …, 31}

Rev1+

111

Rx

11110

Ry

0000001

sa5

Rd

3

4

5

4

7

5

4

Description

Performs a bitwise logical AND between the specified registers and stores the result in the desti- nation register.

Status Flags

Q:

Not affected

V:

Not affected

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

andh Rd, imm

Rd[31:16] = Rd[31:16] AND imm16;
d ∈ {0, 1, …, 15}
imm ∈ {0, 1, ..., 65535}

Rev1+

111001

COH

00001

Rd

imm16

6

1

5

4

16

2

andh Rd, imm, COH

Rd[31:16] = Rd[31:16] AND imm16;
Rd[15:0] = 0;
d ∈ {0, 1, …, 15}
imm ∈ {0, 1, ..., 65535}

Rev1+

111001

COH

00001

Rd

imm16

6

1

5

4

16

3

andl Rd, imm

Rd[15:0] = Rd[15:0]   AND imm16;
d ∈ {0, 1, …, 15}
imm ∈ {0, 1, ..., 65535}

Rev1+

111000

COH

00001

Rd

imm16

6

1

5

4

16

4

andl Rd, imm, COH

Rd[15:0] = Rd[15:0]   AND imm16;
Rd[31:16] = 0;
d ∈ {0, 1, …, 15}
imm ∈ {0, 1, ..., 65535}

Rev1+

111000

COH

00001

Rd

imm16

6

1

5

4

16

Description

Performs a bitwise logical AND between the high or the low halfword in the specified register and a constant. The result is stored in the high or the low halfword of the destination register while the other bits remain unchanged. The Clear Other Half (COH) parameter allows the other half to be cleared.

Status Flags:

Q:

Not affected

V:

Not affected

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

andn Rd, Rs

Rd = Rd AND ~Rs;
{d, s} ∈ {0, 1, …, 15}

Rev1+

000

Rs

01000

Rd

3

4

5

4

Description

Performs a bitwise logical ANDNOT between the specified registers and stores the result in the destination register.

Status Flags

Q:

Not affected

V:

Not affected

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

and{cond4}Rd, Rx, Ry

if ( cond4)
Rd = Rx AND Ry;
{d, x, y} ∈ {0, 1, …, 15}
cond4 ∈ {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al}

Rev2+

111

Rx

11101

Ry

1110

cond4

0010

Rd

3

4

5

4

4

4

4

4

Description

Performs a bitwise logical AND between the specified registers and stores the result in the desti- nation register.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

asr Rd, Rx, Ry

Rd = ASR(Rx, Ry[4:0]);
d, x, y ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

000010000100

Rd

3

4

5

4

12

4

2

asr Rd, sa

Rd = ASR(Rd, sa5); 
d ∈ {0, 1, …, 15}
sa ∈ {0, 1, …, 31}

Rev1+

101

Bit[4:1]

1010

Bit[0]

Rd

3

4

4

1

4

3

asr Rd, Rs, sa

Rd = ASR(Rs, sa5);
{d,s} ∈ {0, 1, …, 15}
sa ∈ {0, 1, …, 31}

Rev1+

111

Rs

00000

Rd

00010100000

sa5

3

4

5

4

11

5

Description

Shifts all bits in a register to the right the amount of bits specified by the five least significant bits in Ry or an immediate while keeping the sign.

Status Flags:

Format I: Shamt = Ry[4:0], Op = Rx

Format II: Shamt = sa5, Op = Rd

Format III: Shamt = sa5, Op = Rs

Q:

Not affected

V:

Not affected

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

if (Shamt != 0) then

C = Op[Shamt-1]

else

C = 0

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

bfexts Rd, Rs, bp5, w5

Rd = SE(Rs[bp5+w5-1:bp5]);
{d, s} ∈ {0, 1, …, 15}
{bp5, w5} ∈ {0, 1, ..., 31}

Rev1+

111

Rd

11101

Rs

101100

bp5

w5

3

4

5

4

6

5

5

Description

This instruction extracts and sign-extends the w5 bits in Rs starting at bit-offset bp5 to Rd.

Status Flags:

Q:

Not affected

V:

Not affected

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

C = RES[31]

Note:

If (w5 = 0) or if (bp5 + w5 > 32) the result is undefined.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

bfextu Rd, Rs, bp5, w5

Rd = ZE(Rs[bp5+w5-1:bp5]);
{d, s} ∈ {0, 1, …, 15}
{bp5, w5} ∈ {0, 1, ..., 31}

Rev1+

111

Rd

11101

Rs

110000

bp5

w5

3

4

5

4

6

5

5

Description

This instruction extracts and zero-extends the w5 bits in Rs starting at bit-offset bp5 to Rd.

Status Flags:

Q:

Not affected

V:

Not affected

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

C = RES[31]

Note:

If (w5 = 0) or if (bp5 + w5 > 32) the result is undefined.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

bfins Rd, Rs, bp5, w5

Rd[bp5+w5-1:bp5] = Rs[w5-1:0];
{d, s} ∈ {0, 1, …, 15}
{bp5, w5} ∈ {0, 1, ..., 31}

Rev1+

111

Rd

11101

Rs

110100

bp5

w5

3

4

5

4

6

5

5

Description

This instruction inserts the lower w5 bits of Rs in Rd at bit-offset bp5.

Status Flags:

Q:

Not affected

V:

Not affected

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

C = RES[31]

Note:

If (w5 = 0) or if (bp5 + w5 > 32) the result is undefined.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

bld Rd, bp

C = Rd[bp5];
Z = Rd[bp5];
d ∈{0, 1, …, 15}
bp ∈ {0, 1, …, 31}

Rev1+

111011011011

Rd

00000000000

bp5

12

4

11

5

Description

Copy an arbitrary bit in a register to C and Z.

Status Flags

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Z = Rd[bp5]

C:

C = Rd[bp5]

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

breakpoint

if (SR[DM]==0)
     RSR_DBG = SR;
     RAR_DBG = address of first non-completed instruction;
     SR[R] = 1;
     SR[J] = 1;
     SR[D] = 1;
     SR[M2:M0] = B'110;
     SR[DM] = 1;
     SR[EM] = 1;
     SR[GM] = 1;
     PC = EVBA+0x1C;
else
     PC = PC + 2;
None

Rev1+

1101011001110011

16

Description

If the on chip debug system is enabled, this instruction traps a software breakpoint for debugging. The breakpoint instruc- tion will enter debug mode disabling all interrupts and exceptions. If the on chip debug system is not enabled, this instruction will execute as a nop.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Note:

If no on chip debug system is implemented, this instruction will execute as a "NOP".

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

brev Rd

Rd[31:0] = Rd[0:31];
d  ∈{0, 1, …, 15}

Rev1+

010111001001

Rd

12

4

Description

Bit-reverse the contents in the register.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Z = (RES[31:0] == 0)

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

br{cond3}disp

if (cond3)
      PC = PC + (SE(disp8) << 1);
else
      PC = PC + 2;
cond3 ∈ {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl}
disp ∈ {-256, -254, ..., 254}

Rev1+

1100

disp8

0

cond3

4

8

1

3

2

br{cond4}disp

if (cond4)
      PC = PC + (SE(disp21) << 1);
else
      PC = PC + 4;
cond4 ∈ {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al}
disp ∈ {-2097152, -2097150, ..., 2097150}

Rev1+

111

disp21[20:1]

0100

disp21

[16]

cond4

disp21[15:0]

3

4

4

1

4

16

Description

Branch if the specified condition is satisfied.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

bst Rd, bp

Rd[bp5] = C;
d ∈ {0, 1, …, 15}
bp ∈ {0, 1, …, 31}

Rev1+

111011111011

Rd

00000000000

bp5

12

4

11

5

Description

Copy the C-flag to an arbitrary bit in a register.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

cache Rp[disp], Op5

Issue a command to the cache
disp ∈ {-1024, -1023, ..., 1023}
p ∈ {0, 1, …, 15}

Rev1+

111101000001

Rp

Op5

disp11

12

4

5

11

Description

Control cache operation.

Op[4:3]

Semantic

00

Instruction Cache

01

Data Cache or unified cache

10

Secondary Cache

11

Tertiary Cache

Op[2:0]

Semantic

000

Implementation definedk

001

Implementation defined

010

Implementation defined

011

Implementation defined

100

Implementation defined

101

Implementation defined

110

Implementation defined

111

Implementation defined

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Note:

This instruction can only be executed in a privileged mode. Execution from any other mode will trigger a Privilege Violation exception.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

casts.h Rd

Rd[31:16] = Rd[15];
d ∈ {0, 1, …, 15}

Rev1+

010111001000

Rd

12

4

2

casts.b Rd

Rd[31:8] = Rd[7];
d ∈ {0, 1, …, 15}

Rev1+

010111000110

Rd

12

4

Description

Sign extends the halfword or byte that is specified to word size. The result is stored back to the specified register.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

C = RES[31]

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

castu.h Rd

Rd[31:16] = 0;
d ∈ {0, 1, …, 15}

Rev1+

010111000111

Rd

12

4

2

castu.b Rd

Rd[31:8] = 0:
d ∈ {0, 1, …, 15}

Rev1+

010111000101

Rd

12

4

Description

Zero extends the halfword or byte that is specified to word size. The result is stored back to the specified register.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

C = RES[31]

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

cbr Rd, bp

Rd[bp5] = 0;
d ∈ {0, 1, …, 15}
bp ∈ {0, 1, …, 31}

Rev1+

101

Bit[4:1]

1110

Bit[0]

Rd

3

4

4

1

4

Description

Clears a bit in the specified register. All other bits are unaffected.

Status Flags:

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Z = (RES[31:0] == 0)

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

clz Rd, Rs

temp = 32;
for (i = 31; i >= 0; i--)
      if (Rs[i] == 1) then
            temp  =  31 - i;
            break;
Rd = temp;
{d, s} ∈ {0, 1, …, 15}

Rev1+

111

Rs

00000

Rd

0001001000000000

3

4

5

4

16

Description

Counts the number of binary zero bits before the first binary one bit in a register value. The value returned from the operation can be used for doing normalize operations. If the operand is zero, the value 32 is returned.

Status Flags

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Z = (RES[31:0] == 0)

C:

C = (RES[31:0] == 32)

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

com Rd

Rd = ~Rd;
d ∈ {0, 1, …, 15}

Rev1+

010111001101

Rd

12

4

Description

Perform a one's complement of specified register.

Status Flags:

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Z = (RES[31:0] == 0)

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

cop CP#, CRd, CRx, CRy, Op

CP#(CRd) = CP#(CRx) Op CP#(CRy);
# ∈ {0, 1, …, 7}
Op ∈ {0, 1, …, 127}
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

11100

Op[6:5]

11010

Op[4:1]

CP#

Op[0]

CRd

CRx

CRy

5

2

5

4

3

1

4

4

4

Description

Addresses a coprocessor and performs the specified operation on the specified registers.

Status Flags:

Q:

Coprocessor-specific

V:

Coprocessor-specific

N:

Coprocessor-specific

Z:

Coprocessor-specific

C:

Coprocessor-specific

Example:

cop
CP2, CR0, CR1, CR2, 0

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

cp.b Rd, Rs

Rd[7:0] - Rs[7:0];
{d, s} ∈ {0, 1, …, 15}

Rev1+

111

Rs

00000

Rd

0001100000000000

3

4

5

4

16

Description

Performs a compare between the lowermost bytes in the two operands specified. The operation is implemented by doing a subtraction without writeback of the difference. The operation sets the status flags according to the result of the subtraction, but does not affect the operand registers.

Status Flags:

Q:

Not affected

V:

V = (Rd[7] AND ~Rs[7] AND ~RES[7]) OR (~Rd[7] AND Rs[7] AND RES[7])

N:

N = RES[7]

Z:

Z = (RES[7:0] == 0)

C:

C = ~Rd[7] AND Rs[7] OR Rs[7] AND RES[7] OR ~Rd[7] AND RES[7]

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

cp.h Rd, Rs

Rd[15:0] - Rs[15:0];
{d, s} ∈ {0, 1, …, 15}

Rev1+

111

Rs

00000

Rd

0001100100000000

3

4

5

4

16

Description

Performs a compare between the lowermost halfwords in the two operands specified. The oper- ation is implemented by doing a subtraction without writeback of the difference. The operation sets the status flags according to the result of the subtraction, but does not affect the operand registers.

Status Flags:

Format I: OP1 = Rd, OP2 = Rs

Q:

Not affected

V:

V = (OP1[15] AND ~OP2[15] AND ~RES[15]) OR (~OP1[15] AND OP2[15] AND RES[15])

N:

N = RES[15]

Z:

Z = (RES[15:0] == 0)

C:

C = ~OP1[15] AND OP2[15] OR OP2[15] AND RES[15] OR ~OP1[15] AND RES[15]

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

cp.w Rd, Rs

Rd - Rs;
{d, s} ∈ {0, 1, …, 15}

Rev1+

000

Rs

00011

Rd

3

4

5

4

2

cp.w Rd, imm

Rd - SE(imm6);
d ∈ {0, 1, …, 15}
imm ∈ {-32, -31, ..., 31}

Rev1+

010110

imm6

Rd

6

6

4

3

cp.w Rd, imm

Rd - SE(imm21);
d ∈ {0, 1, …, 15}
imm ∈ {-1048576, -104875, ..., 1048575}

Rev1+

111

imm21[20:17]

0010

imm21[16]

Rd

imm21[15:0]

3

4

4

1

4

16

Description

Performs a compare between the two operands specified. The operation is implemented by doing a subtraction without writeback of the difference. The operation sets the status flags according to the result of the subtraction, but does not affect the operand registers.

Status Flags:

Format I: OP1 = Rd, OP2 = Rs

Format II: OP1 = Rd, OP2 = SE(imm6)

Format III:OP1 = Rd, OP2 = SE(imm21)

Q:

Not affected

V:

V = (OP1[31] AND ~OP2[31] AND ~RES[31]) OR (~OP1[31] AND OP2[31] AND RES[31])

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

C = ~OP1[31] AND OP2[31] OR OP2[31] AND RES[31] OR ~OP1[31] AND RES[31]

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

cpc Rd, Rs

Rd - Rs - C;
{d, s} ∈ {0, 1, …, 15}

Rev1+

111

Rs

00000

Rd

0001001100000000

3

4

5

4

16

2

cpc Rd

Rd - C;
d ∈ {0, 1, …, 15}

Rev1+

010111000010

Rd

12

4

Description

Performs a compare between the two registers specified. The operation is executed by doing a subtraction with carry (as borrow) without writeback of the difference. The operation sets the sta- tus flags according to the result of the subtraction, but does not affect the operand registers. Note that the zero flag status before the operation is included in the calculation of the new zero flag. This instruction allows large compares (64, 128 or more bits).

Status Flags:

In format II, Rs referred to below equals zero.

Q:

Not affected

V:

V = (Rd[31] AND ~Rs[31] AND ~RES[31]) OR (~Rd[31] AND Rs[31] AND RES[31])

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0) AND Z

C:

C = ~Rd[31] AND Rs[31] OR Rs[31] AND RES[31] OR ~Rd[31] AND RES[31]

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

csrf bp

SR[bp5] = 0;
bp ∈ {0, 1, …, 31}

Rev1+

1101010

bp5

0011

7

5

4

Description

Clears the status register (SR) flag specified.

Status Flags:

SR[bp5] = 0, all other flags unchanged.

Note:

Privileged if bp5 > 15, ie. upper half of status register. An exception will be triggered if the upper half of the status register is attempted changed in user mode.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

csrfcz bp

C = SR[bp5];
Z = SR[bp5];
bp ∈ {0, 1, …, 31}

Rev1+

1101000

bp5

0011

7

5

4

Description

Copies the status register (SR) flag specified to C and Z.

Status Flags:

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Z = SR[bp5]

C:

C = SR[bp5]

Note:

Privileged if bp5 > 15, ie. upper half of status register. A Privilege Violation exception will be trig- gered if the upper half of the status register is attempted read in user mode.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

divs Rd, Rx, Ry

Rd = Rx / Ry;
Rd+1 = Rx % Ry;
d ∈ {0, 2, …, 14}
{x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

000011000000

Rd

3

4

5

4

12

4

Description

Performs a signed divide between the two 32-bit register specified. The quotient is returned in Rd, the remainder in Rd+1. No exceptions are taken if dividing by 0. Result in Rd and Rd+1 is UNDEFINED when dividing by 0. The sign of the remainder will be the same as the dividend, and the quotient will be negative if the signs of Rx and Ry are opposite.

Status Flags

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

divu Rd, Rx, Ry

Rd = Rx / Ry;
Rd+1 = Rx % Ry;
d ∈ {0, 2, …, 14}
{x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

000011010000

Rd

3

4

5

4

12

4

Description

Performs an unsigned divide between the two 32-bit register specified. The quotient is returned in Rd, the remainder in Rd+1. No exceptions are taken if dividing by 0. Result in Rd and Rd+1 is UNDEFINED when dividing by 0.

Status Flags

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

eor Rd, Rs

Rd = Rd XOR Rs;
{d, s} ∈ {0, 1, …, 15}

Rev1+

000

Rs

00101

Rd

3

4

5

4

2

eor Rd, Rx, Ry << sa

Rd = Rx XOR (Ry << sa5);
{d, x, y} ∈ {0, 1, …, 15}
sa ∈ {0, 1, …, 31}

Rev1+

111

Rx

11110

Ry

0010000

sa5

Rd

3

4

5

4

7

5

4

3

eor Rd, Rx, Ry >> sa

Rd = Rx XOR (Ry >> sa5);
{d, x, y} ∈ {0, 1, …, 15}
sa ∈ {0, 1, …, 31}

Rev1+

111

Rx

11110

Ry

0010001

sa5

Rd

3

4

5

4

7

5

4

Description

Performs a bitwise logical Exclusive-OR between the specified registers and stores the result in the destination register.

Status Flags

Q:

Not affected

V:

Not affected

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

eorh Rd, imm

Rd[31:16] = Rd[31:16] XOR imm16
d ∈ {0, 1, …, 15}
imm ∈ {0, 1, ..., 65535}

Rev1+

111011100001

Rd

imm16

12

4

16

2

eorl Rd, imm

Rd[15:0]   = Rd[15:0] XOR imm16
d ∈ {0, 1, …, 15}
imm ∈ {0, 1, ..., 65535}

Rev1+

111011000001

Rd

imm16

12

4

16

Description

Performs a bitwise logical Exclusive-OR between the high or low halfword in the specified regis- ter and a constant. The result is stored in the destination register.

Status Flags:

Q:

Not affected

V:

Not affected

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

eor{cond4} Rd, Rx, Ry

if ( cond4)
Rd = Rx XOR Ry;
{d, x, y} ∈ {0, 1, …, 15}
cond4 ∈ {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al}

Rev2+

111

Rx

11101

Ry

1110

cond4

0100

Rd

3

4

5

4

4

4

4

4

Description

Performs a bitwise logical Exclusive-OR between the specified registers and stores the result in the destination register.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

frs

Invalidate all entries in the return address stack.
none

Rev1+

1101011101000011

16

Description

Special instruction to invalidate the return address stack. This instruction is used when the user writes code that conflicts with the semantics required by the return address stack.

Status Flags:

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Note:

On implementation without a return stack this instruction will execute as a "NOP".

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

icall Rd

LR = PC + 2;
PC = Rd;
d ∈ {0, 1, …, 15}

Rev1+

010111010001

Rd

12

4

Description

Call to a subroutine pointed to by the pointer residing in Rp.

Status Flags:

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

incjosp imm

if ( JOSP[3:0] + imm < 0 ) 
      TRAP 4
else if (JOSP[3:0] + imm > 8 ) 
      TRAP 3
else
      JOSP = JOSP + imm;
imm ∈ {-4, -3, -2, -1, 1, 2, 3, 4}

Rev1+

110101101

imm3

0011

9

3

4

Description

Increment the system register "Java Operand Stack Pointer" with value.

imm3

imm

100

-4

101

-3

110

-2

111

-1

000

1

001

2

010

3

011

4

Status Flags:

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Note:

When trapped, this instruction will destroy R12. It is the programmer's responsibility to keep the R12value if needed.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

ld.d Rd, Rp++

Rd+1:Rd = *(Rp);
Rp = Rp + 8;
d ∈ {0, 2, 4, …, 14}
p, b, i ∈ {0, 1, …, 15}

Rev1+

101

Rp

10000

Rd

1

3

4

5

3

1

2

ld.d Rd, --Rp

Rp = Rp - 8;
Rd+1:Rd = *(Rp);
d ∈ {0, 2, 4, …, 14}
p, b, i ∈ {0, 1, …, 15}

Rev1+

101

Rp

10001

Rd

0

3

4

5

3

1

3

ld.d Rd, Rp

Rd+1:Rd = *(Rp);
d ∈ {0, 2, 4, …, 14}
p, b, i ∈ {0, 1, …, 15}

Rev1+

101

Rp

10000

Rd

0

3

4

5

3

1

4

ld.d Rd, Rp[disp]

Rd+1:Rd = *(Rp + (SE(disp16)));
d ∈ {0, 2, 4, …, 14}
p, b, i ∈ {0, 1, …, 15}

Rev1+

111

Rp

01110

Rd

0

disp16

3

4

5

3

1

16

5

ld.d Rd, Rb[Ri<<sa]

Rd+1:Rd = *(Rb + (Ri << sa2));
d ∈ {0, 2, 4, …, 14}
p, b, i ∈ {0, 1, …, 15}

Rev1+

111

Rb

00000

Ri

0000001000

sa2

Rd

3

4

5

4

10

2

4

Description

Reads the doubleword memory location specified.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Note:

Format I and II: If Rd = Rp, the result is UNDEFINED.

If Rd = Rp+1, the result is UNDEFINED.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

ld.sb Rd, Rp[disp]

Rd = SE( *(Rp + (SE(disp16))) );
d, p ∈ {0, 1, …, 15}
disp ∈ {-32768, -32767, ..., 32767}

Rev1+

111

Rp

10010

Rd

disp16

3

4

5

4

16

2

ld.sb Rd, Rb[Ri<<sa]

Rd = SE( *(Rb + (Ri << sa2)) );
d, b, i ∈ {0, 1, …, 15}
sa ∈ {0, 1, 2, 3}

Rev1+

111

Rb

00000

Ri

0000011000

sa2

Rd

3

4

5

4

10

2

4

Description

Reads the byte memory location specified and sign-extends it.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

ld.sb{cond4} Rd, Rp[disp]

if (cond4)
Rd = SE( *(Rp + (ZE(disp9))) );
d, p ∈ {0, 1, …, 15}
disp ∈ {0, 1, ..., 511}
cond4 ∈ {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al}

Rev2+

111

Rp

11111

Rd

cond4

011

disp9

3

4

5

4

4

3

9

Description

Reads the byte memory location specified and sign-extends it if the given condition is satisfied.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

ld.sh Rd, Rp++

Rd = SE( *(Rp) );
Rp = Rp + 2;
d, p, b, i ∈ {0, 1, …, 15}

Rev1+

000

Rp

10001

Rd

3

4

5

4

2

ld.sh Rd, --Rp

Rp = Rp - 2;
Rd = SE( *(Rp) );
d, p, b, i ∈ {0, 1, …, 15}

Rev1+

000

Rp

10101

Rd

3

4

5

4

3

ld.sh Rd, Rp[disp]

Rd = SE( *(Rp + (ZE(disp3) << 1)) );
d, p, b, i ∈ {0, 1, …, 15}

Rev1+

100

Rp

00

disp3

Rd

3

4

2

3

4

4

ld.sh Rd, Rp[disp]

Rd = SE( *(Rp + (SE(disp16)));
d, p, b, i ∈ {0, 1, …, 15}

Rev1+

111

Rp

10000

Rd

disp16

3

4

5

4

16

5

ld.sh Rd, Rb[Ri<<sa]

Rd = SE( *(Rb + (Ri << sa2));
d, p, b, i ∈ {0, 1, …, 15}

Rev1+

111

Rb

00000

Ri

0000010000

sa2

Rd

3

4

5

4

10

2

4

Description

Reads the halfword memory location specified and sign-extends it.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Note:

Format I and II: If Rd = Rp, the result is UNDEFINED.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

ld.sh{cond4} Rd, Rp[disp]

if (cond4)
Rd = SE( *(Rp + (ZE(disp9<<1))) );
d, p ∈ {0, 1, …, 15}
disp ∈ {0, 2, ..., 1022}
cond4 ∈ {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al}

Rev2+

111

Rp

11111

Rd

cond4

001

disp9

3

4

5

4

4

3

9

Description

Reads the halfword memory location specified and sign-extends it if the given condition is satis- fied.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

ld.ub Rd, Rp++

Rd = ZE( *(Rp) );
Rp = Rp + 1;
d, p, b, i ∈ {0, 1, …, 15}

Rev1+

000

Rp

10011

Rd

3

4

5

4

2

ld.ub Rd, --Rp

Rp = Rp - 1;
Rd = ZE( *(Rp) );
d, p, b, i ∈ {0, 1, …, 15}

Rev1+

000

Rp

10111

Rd

3

4

5

4

3

ld.ub Rd, Rp[disp]

Rd = ZE( *(Rp + (ZE(disp3))) );
d, p, b, i ∈ {0, 1, …, 15}

Rev1+

000

Rp

11

disp3

Rd

3

4

2

3

4

4

ld.ub Rd, Rp[disp]

Rd = ZE( *(Rp + (SE(disp16))) );
d, p, b, i ∈ {0, 1, …, 15}

Rev1+

111

Rp

10011

Rd

disp16

3

4

5

4

16

5

ld.ub Rd, Rb[Ri<<sa]

Rd = ZE( *(Rb + (Ri << sa2)) );
d, p, b, i ∈ {0, 1, …, 15}

Rev1+

111

Rb

00000

Ri

0000011100

sa2

Rd

3

4

5

4

10

2

4

Description

Reads the byte memory location specified and zero-extends it.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Note:

Format I and II: If Rd = Rp, the result is UNDEFINED.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

ld.ub{cond4} Rd, Rp[disp]

if (cond4)
Rd = ZE( *(Rp + (ZE(disp9))) );
d, p ∈ {0, 1, …, 15}
disp ∈ {0, 1, ..., 511}
cond4 ∈ {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al}

Rev2+

111

Rp

11111

Rd

cond4

100

disp9

3

4

5

4

4

3

9

Description

Reads the byte memory location specified and zero-extends it if the given condition is satisfied.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

ld.uh Rd, Rp++

Rd = ZE( *(Rp) );
Rp = Rp + 2;
d, p, b, i ∈ {0, 1, …, 15}

Rev1+

000

Rp

10010

Rd

3

4

5

4

2

ld.uh Rd, --Rp

Rp = Rp - 2;
Rd = ZE( *(Rp) );
d, p, b, i ∈ {0, 1, …, 15}

Rev1+

000

Rp

10110

Rd

3

4

5

4

3

ld.uh Rd, Rp[disp]

Rd = ZE( *(Rp + (ZE(disp3) << 1)) );
d, p, b, i ∈ {0, 1, …, 15}

Rev1+

100

Rp

01

disp3

Rd

3

4

2

3

4

4

ld.uh Rd, Rp[disp]

Rd = ZE( *(Rp + (SE(disp16))) );
d, p, b, i ∈ {0, 1, …, 15}

Rev1+

111

Rp

10001

Rd

disp16

3

4

5

4

16

5

ld.uh Rd, Rb[Ri<<sa]

Rd = ZE( *(Rb + (Ri << sa2)) );
d, p, b, i ∈ {0, 1, …, 15}

Rev1+

111

Rb

00000

Ri

0000010100

sa2

Rd

3

4

5

4

10

2

4

Description

Reads the halfword memory location specified and zero-extends it.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Note:

Format I and II: If Rd = Rp, the result is UNDEFINED.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

ld.uh{cond4} Rd, Rp[disp]

if (cond4)
Rd = ZE( *(Rp + (ZE(disp9<<1))) );
d, p ∈ {0, 1, …, 15}
disp ∈ {0, 2, ..., 1022}
cond4 ∈ {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al}

Rev2+

111

Rp

11111

Rd

cond4

010

disp9

3

4

5

4

4

3

9

Description

Reads the halfword memory location specified and zero-extends it if the given condition is satis- fied.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

ld.w Rd, Rp++

Rd =  *(Rp);
Rp = Rp + 4;
d, p, b, i ∈ {0, 1, …, 15}

Rev1+

000

Rp

10000

Rd

3

4

5

4

2

ld.w Rd, --Rp

Rp = Rp - 4;
Rd = *(Rp);
d, p, b, i ∈ {0, 1, …, 15}

Rev1+

000

Rp

10100

Rd

3

4

5

4

3

ld.w Rd, Rp[disp]

Rd = *(Rp + (ZE(disp5) << 2));
d, p, b, i ∈ {0, 1, …, 15}

Rev1+

011

Rp

disp5

Rd

3

4

5

4

4

ld.w Rd, Rp[disp]

Rd = *(Rp + (SE(disp16)));
d, p, b, i ∈ {0, 1, …, 15}

Rev1+

111

Rp

01111

Rd

disp16

3

4

5

4

16

5

ld.w Rd, Rb[Ri<<sa]

Rd = *(Rb + (Ri << sa2));
d, p, b, i ∈ {0, 1, …, 15}

Rev1+

111

Rb

00000

Ri

0000001100

sa2

Rd

3

4

5

4

10

2

4

6

ld.w Rd, Rb[Ri:<part> << 2]

If (part == b)
     Rd = *(Rb + (Ri[7:0] << 2) );
else if (part == l)
     Rd = *(Rb + (Ri[15:8] << 2) );
else if (part == u)
     Rd = *(Rb + (Ri[23:16] << 2) );
else
     Rd = *(Rb + (Ri[31:24] << 2) );
{d, b, i} ∈ {0, 1, …, 15}
part ∈ {t, u, l, b}

Rev1+

111

Rb

00000

Ri

0000111110

X

Y

Rd

3

4

5

4

10

1

1

4

Description

Format I to V: Reads the word memory location specified. Format VI: This instruction extracts a specified byte from Ri. This value is zero-extended, shifted left two positions and added to Rb to form an address. The contents of this address is loaded into Rd. The instruction is useful for indexing tables.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Note:

Format I and II: If Rd = Rp, the result is UNDEFINED.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

ld.w{cond4} Rd, Rp[disp]

if (cond4)
Rd = *(Rp + (ZE(disp9<<2)));
d, p ∈ {0, 1, …, 15}
disp ∈ {0, 4, ..., 2044}
cond4 ∈ {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al}

Rev2+

111

Rp

11111

Rd

cond4

000

disp9

3

4

5

4

4

3

9

Description

Reads the word memory location specified if the given condition is satisfied.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

ldc.d CP#, CRd, Rp[disp]

CP#(CRd+1:CRd) = *(Rp + (ZE(disp8) << 2));
# ∈ {0, 1, …, 7}

Rev1+

111010011010

Rp

CP #

1

CRd[3:1]

0

disp8

12

4

3

1

3

1

8

2

ldc.d CP#, CRd, --Rp

Rp = Rp-8;
CP#(CRd+1:CRd) = *(Rp);
# ∈ {0, 1, …, 7}

Rev1+

111011111010

Rp

CP #

0

CRd[3:1]

001010000

12

4

3

1

3

9

3

ldc.d CP#, CRd, Rb[Ri<<sa]

CP#(CRd+1:CRd) = *(Rb + (Ri << sa2));
# ∈ {0, 1, …, 7}

Rev1+

111011111010

Rp

CP #

1

CRd[3:1]

001

sa2

Ri

12

4

3

1

3

3

2

4

4

ldc.w CP#, CRd, Rp[disp]

CP#(CRd) = *(Rp + (ZE(disp8) << 2));
# ∈ {0, 1, …, 7}

Rev1+

111010011010

Rp

CP #

0

CRd

k8

12

4

3

1

4

8

5

ldc.w CP#, CRd, --Rp

Rp = Rp-4;
CP#(CRd) = *(Rp);
# ∈ {0, 1, …, 7}

Rev1+

111011111010

Rp

CP #

0

CRd

01000000

12

4

3

1

4

8

6

ldc.w CP#, CRd, Rb[Ri<<sa]

CP#(CRd) = *(Rb + (Ri << sa2));
# ∈ {0, 1, …, 7}

Rev1+

111011111010

Rp

CP #

1

CRd

00

sa2

Ri

12

4

3

1

4

2

2

4

Description

Reads the memory location specified into the addressed coprocessor.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Example:

ldc.d
CP2, CR0, R2[0]

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

ldc0.d CRd, Rp[disp]

CP0(CRd+1:CRd) = *(Rp + (ZE(disp12) << 2));
p ∈ {0, 1, …, 15}

Rev1+

111100111010

Rp

disp[11:8]

CRd[3:1]

0

disp[7:0]

12

4

3

4

1

8

2

ldc0.w CRd, Rp[disp]

CP0(CRd) = *(Rp + (ZE(disp12) << 2));
p ∈ {0, 1, …, 15}

Rev1+

111100011010

Rp

disp[11:8]

CRd

disp[7:0]

12

4

4

4

8

Description

Reads the memory location specified into coprocessor 0.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Example:

ldc0.d
CR0, R2[0]

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

ldcm.d CP#, Rp{++}, ReglistCPD8

Loadaddress  =Rp;
for (i = 7 to 0)
      if ReglistCPD8[i] == 1 then
            CP#(CR(2*i+1))   =*(Loadaddress++);
            CP#(CR(2*i))   =*(Loadaddress++);
if Opcode[++] == 1 then
      Rp   = Loadaddress;
# ∈ {0, 1, …, 7}
p ∈ {0, 1, …, 15}

Rev1+

111011011010

Rp

CP#

++

0100

ReglistCPD8[7:1]

CR

15-14

CR

13-12

CR

11-10

CR

9-8

CR

7-6

CR

5-4

CR

3-2

ReglistCPD8[0]

CR

1-0

12

4

3

1

4

7

1

2

ldcm.w CP#, Rp{++}, ReglistCPH8

Loadaddress  =Rp;
for (i = 7 to 0)
      if ReglistCPH8[i] == 1 then
            CP#(CRi+8)   =*(Loadaddress++);
if Opcode[++] == 1 then
      Rp   = Loadaddress;
# ∈ {0, 1, …, 7}
p ∈ {0, 1, …, 15}

Rev1+

111011011010

Rp

CP#

++

0001

ReglistCPH8[7:1]

CR

15

CR

14

CR

13

CR

12

CR

11

CR

10

CR

9

ReglistCPH8[0]

CR

8

12

4

3

1

4

7

1

3

ldcm.w CP#, Rp{++}, ReglistCPL8

Loadaddress  =Rp;
for (i = 7 to 0)
      if ReglistCPL8[i] == 1 then
            CP#(CRi)   =*(Loadaddress++);
if Opcode[++] == 1 then
      Rp   = Loadaddress;
# ∈ {0, 1, …, 7}
p ∈ {0, 1, …, 15}

Rev1+

111011011010

Rp

CP#

++

0000

ReglistCPL8[7:1]

CR

7

CR

6

CR

5

CR

4

CR

3

CR

2

CR

1

ReglistCPL8[0]

CR

0

12

4

3

1

4

7

1

Description

Reads the memory locations specified into the addressed coprocessor. The pointer register can optionally be updated after the operation.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Example:

ldcm.w CP2, SP++, CR2-CR5

Note:

Emtpy ReglistCPL8/ReglistCPL8/ReglistCPD8 gives UNDEFINED result.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

lddpc Rd, PC[disp]

Rd = *( (PC && 0xFFFF_FFFC) + (ZE(disp7) << 2));
d ∈ {0, 1, …, 15}
disp ∈ {0, 4, …, 508}

Rev1+

01001

disp7

Rd

5

7

4

Description

Performs a PC relative load of a register

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

lddsp Rd, SP[disp]

Rd = *( (SP && 0xFFFF_FFFC) + (ZE(disp7) << 2));
d ∈ {0, 1, …, 15}
disp ∈ {0, 4, …, 508}

Rev1+

01000

disp7

Rd

5

7

4

Description

Reads the value of a memory location referred to by the stack pointer register and a displace- ment.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

ldins.b Rd:<part>, Rp[disp]

If (part == b)
      Rd[7:0] = *(Rp+SE(disp12));
else if (part == l)
      Rd[15:8] = *(Rp+SE(disp12));
else if (part == u)
      Rd[23:16] = *(Rp+SE(disp12));
else
      Rd[31:24] = *(Rp+SE(disp12));
{p, d} ∈ {0, 1, …, 15}
part ∈ {t, u, l, b}
disp ∈ {-2048, -2047, ..., 2047}

Rev1+

111

Rp

11101

Rd

01

part

disp12

3

4

5

4

2

2

12

2

ldins.h Rd:<part>, Rp[disp]

If (part == b)
      Rd[15:0] = *(Rp+SE(disp12) << 1);
else
      Rd[31:16] = *(Rp+SE(disp12) << 1);
{p, d} ∈ {0, 1, …, 15}
part ∈ {t, b}
disp ∈ {-4096, -4094, ..., 4094}

Rev1+

111

Rp

11101

Rd

000

part

disp12

3

4

5

4

3

1

12

Description

This instruction loads a byte or a halfword from memory and inserts it into the addressed byte or halfword position in Rd. The other parts of Rd are unaffected.

Status Flags:

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

ldm Rp{++}, Reglist16

Loadaddress  = Rp;
if Reglist16[PC] == 1 then 
      if Rp == PC then
            Loadaddress = SP;
      PC = *(Loadaddress++);
      if Rp == PC then
            if Reglist16[LR,R12] == B'00
                  R12   =   0;
            else if Reglist16[LR,R12] == B'01
                  R12   =   1;
            else
                  R12   =    - 1;
            Test R12 and update flags;
      else
            if Reglist16[LR] == 1
                  LR = *(Loadaddress++);
            if Reglist16[SP] == 1
                  SP = *(Loadaddress++);
            if Reglist16[R12] == 1
                  R12 =  *(Loadaddress++);
            Test R12 and update flags;
else
      if Reglist16[LR] == 1
            LR = *(Loadaddress++);
      if Reglist16[SP] == 1
            SP = *(Loadaddress++);
      if Reglist16[R12] == 1
            R12 =  *(Loadaddress++);
for (i = 11 to 0)
      if Reglist16[i] == 1 then
            Ri   =
                  *(Loadaddress++);
if Opcode[++] == 1 then
      if Rp == PC then
            SP   = Loadaddress;
      else
            Rp   = Loadaddress;
Reglist16 ∈ {R0, R1, R2, ..., R12, LR, SP, PC} 
p ∈ {0, 1, …, 15}

Rev1+

111000

++

11100

Rp

Reglist16[15:1]

R15 R14 R13 R12 R11

R10

R9

R8

R7

R6

R5

R4

R3

R2

R1

Reglist16[0]

R0

6

1

5

4

15

1

Description

Loads the consecutive words pointed to by Rp into the registers specified in the instruction. The PC can be loaded, resulting in a jump to the loaded target address. If PC is loaded, the return value in R12 is tested and the flags are updated. The return value may optionally be set to -1, 0 or 1.

Status Flags:

Flags are only updated if Reglist16[PC] == 1.

They are set as the result of the operation cp R12, 0.

Q:

Not affected

V:

V = 0

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

C = 0

Note:

Emtpy Reglist16 gives UNDEFINED result. If Rp is in Reglist16 and pointer is written back the result is UNDEFINED. The R bit in the status register has no effect on this instruction.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

ldmts Rp{++}, Reglist16

Loadaddress  =Rp;
for (i = 15 to 0)
      if Reglist16[i] == 1 then
            Ri USER  =*(Loadaddress++);
if Opcode[++] == 1 then
      Rp   = Loadaddress;
Reglist16 ∈ {R0, R1, R2, ..., R12, LR, SP} 
p ∈ {0, 1, …, 15}

Rev1+

111001

++

11100

Rp

Reglist16[15:1]

R15 R14 R13 R12 R11

R10

R9

R8

R7

R6

R5

R4

R3

R2

R1

Reglist16[0]

R0

6

1

5

4

15

1

Description

Loads the consecutive words pointed to by Rp into the registers specified in the instruction.The target registers reside in the User Register Context, regardless of which context the instruction is called from.

Status Flags:

Not affected.

Note:

This instruction is intended for performing task switches. Emtpy Reglist16 gives UNDEFINED result. PC in Reglist16 gives UNDEFINED result.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

ldswp.shRd, Rp[disp]

temp[15:0] = *(Rp+SE(disp12) << 1);
Rd = SE(temp[7:0], temp[15:8]);
{d, p} ∈ {0, 1, …, 15}
disp ∈ {-4096, -4094, ..., 4094}

Rev1+

111

Rp

11101

Rd

0010

disp12

3

4

5

4

4

12

2

ldswp.uhRd, Rp[disp]

temp[15:0] = *(Rp+SE(disp12) << 1);
Rd = ZE(temp[7:0], temp[15:8]);
{d, p} ∈ {0, 1, …, 15}
disp ∈ {-4096, -4094, ..., 4094}

Rev1+

111

Rp

11101

Rd

0011

disp12

3

4

5

4

4

12

3

ldswp.wRd, Rp[disp]

temp = *(Rp+SE(disp12) << 2);
Rd = (temp[7:0], temp[15:8], temp[23:16], temp[31:24]);
{d, p} ∈ {0, 1, …, 15}
disp ∈ {-8192, -8188, ..., 8188}

Rev1+

111

Rp

11101

Rd

1000

disp12

3

4

5

4

4

12

Description

This instruction loads a halfword or a word from memory. If a halfword load is performed, the loaded value is zero- or sign-extended. The bytes in the loaded value are shuffled and the result is written back to Rd. The instruction can be used for performing loads from memories of differ- ent endianness.

Status Flags:

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

lsl Rd, Rx, Ry

Rd = LSL(Rx, Ry[4:0]);
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

000010010100

Rd

3

4

5

4

12

4

2

lsl Rd, sa

Rd = LSL(Rd, sa5);
d ∈ {0, 1, …, 15}
sa  ∈ {0, 1, …, 31}

Rev1+

101

sa5[4:1]

1011

sa5[0]

Rd

3

4

4

1

4

3

lsl Rd, Rs, sa

Rd = LSL(Rs, sa5);
{d,s} ∈ {0, 1, …, 15}
sa  ∈ {0, 1, …, 31}

Rev1+

111

Rs

00000

Rd

00010101000

sa5

3

4

5

4

11

5

Description

Shifts all bits in a register the amount of bits specified to the left. The shift amount can reside in a register or be specified as an immediate. Zeros are shifted into the LSBs. The last bit that is shifted out is placed in C.

Status Flags:

Format I: Shamt = Ry[4:0], Op = Rx

Format II: Shamt = sa5, Op = Rd

Format III: Shamt = sa5, Op = Rs

Q:

Not affected

V:

Not affected

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

if Shamt != 0

C = Op[32-Shamt]

else

C = 0

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

lsr Rd, Rx, Ry

Rd = LSR(Rx, Ry[4:0]);
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

000010100100

Rd

3

4

5

4

12

4

2

lsr Rd, sa

Rd = LSR(Rd, sa5);
d ∈ {0, 1, …, 15}
sa ∈ {0, 1, …, 31}

Rev1+

101

sa5[4:1]

1100

sa5[0]

Rd

3

4

4

2

0

3

lsr Rd, Rs, sa

Rd = LSR(Rs, sa5);
{d,s} ∈ {0, 1, …, 15}
sa ∈ {0, 1, …, 31}

Rev1+

111

Rs

00000

Rd

00010110000

sa5

3

4

5

4

11

5

Description

Shifts all bits in a register the amount specified to the right. The shift amount may be specified by a register or an immediate. Zeros are shifted into the MSB.

Status Flags:

Format I: Shamt = Ry[4:0], Op = Rx

Format II: Shamt = sa5, Op = Rd

Format III: Shamt = sa5, Op = Rs

Q:

Not affected

V:

Not affected

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

if Shamt != 0

C = Op[Shamt-1]

else

C = 0

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

mac Rd, Rx, Ry

Rd =  (Rx × Ry) + Rd;
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

000000110100

Rd

3

4

5

4

12

4

Description

Performs a Multiply-Accumulate operation and stores the result into the destination register.

Status Flags

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

machh.d Rd, Rx:<part>, Ry:<part>

If (Rx-part == t) then operand1 = SE(Rx[31:16]) else operand1 = SE(Rx[15:0]);
If (Ry-part == t) then operand2 = SE(Ry[31:16]) else operand2 = SE(Ry[15:0]);
(Rd+1:Rd)[63:16] = (operand1 × operand2)[31:0] + (Rd+1:Rd)[63:16];
Rd[15:0] = 0;
d ∈ {0, 2, 4, …, 14}
{x, y} ∈ {0, 1, …, 15}
part ∈ {t,b}

Rev1+

111

Rx

00000

Ry

0000010110

X

Y

Rd

3

4

5

4

10

1

1

4

Description

Multiplies the two halfword registers specified and adds the result to the specified doubleword- register. Only the 48 highest of the 64 possible bits in the doubleword accumulator are used. The 16 lowest bits are cleared. The halfword registers are selected as either the high or low part of the operand registers.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Example:

machh.d R10, R2:t, R3:b will perform 
(R11 : R10)[63:16] = ( SE(R2[31:16])  × SE(R3[15:0])  ) + (R11 : R10)[63:16]
R10[15:0] = 0

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

machh.w Rd, Rx:<part>, Ry:<part>

If (Rx-part == t) then operand1 = SE(Rx[31:16]) else operand1 = SE(Rx[15:0]);
If (Ry-part == t) then operand2 = SE(Ry[31:16]) else operand2 = SE(Ry[15:0]);
Rd = (operand1 × operand2) + Rd;
{d, x, y} ∈ {0, 1, …, 15}
part ∈ {t,b}

Rev1+

111

Rx

00000

Ry

0000010010

X

Y

Rd

3

4

5

4

10

1

1

4

Description

Multiplies the two halfword registers specified and adds the result to the specified word-register. The halfword registers are selected as either the high or low part of the operand registers.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Example:

machh.w  R10, R2:t, R3:b
will perform R10 = ( SE(R2[31:16])  × SE(R3[15:0])  ) + R10

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

macs.d Rd, Rx, Ry

acc = (Rd+1:Rd);
prod = (Rx × Ry);
res = prod + acc;
(Rd+1:Rd) = res;
d ∈ {0, 2, 4, …, 14}
{x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

000001010100

Rd

3

4

5

4

12

4

Description

Performs a Multiply-Accumulate operation with signed numbers and stores the result into the destination registers.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

macsathh.w Rd, Rx:<part>, Ry:<part>

If (Rx-part == t) then operand1 = SE(Rx[31:16]) else operand1 = SE(Rx[15:0]);
If (Ry-part == t) then operand2 = SE(Ry[31:16]) else operand2 = SE(Ry[15:0]);
If (operand1 == operand2 == 0x8000)
      product = 0x7FFF_FFFF;
else
      product = (operand1 × operand2) << 1;
Rd = Sat(product + Rd);
{d, x, y} ∈ {0, 1, …, 15}
part ∈ {t,b}

Rev1+

111

Rx

00000

Ry

0000011010

X

Y

Rd

3

4

5

4

10

1

1

4

Description

Multiplies the two halfword registers specified, shifts the results one position to the left and stores the result as a temporary word-sized product. If the two operands equals -1, the product is saturated to the largest positive 32-bit fractional number. The halfword registers are selected as either the high or low part of the operand registers. The temporary product is added with sat- uration to Rd.

Status Flags:

Q:

Set if saturation occurred, or if the accumulation overflows, or previously set.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Example:

macsathh.wR10, R2:t, R3:b
will perform R10 = Sat (Sat(( SE(R2[31:16])  × SE(R3[15:0]) ) << 1) + R10)

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

macu.d Rd, Rx, Ry

acc = (Rd+1:Rd);
prod = (Rx × Ry);
res = prod + acc;
(Rd+1:Rd) = res;
d ∈ {0, 2, 4, …, 14}
{x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

000001110100

Rd

3

4

5

4

12

4

Description

Performs a Multiply-Accumulate operation with unsigned numbers and stores the result into the destination registers.

Status Flags

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

macwh.d Rd, Rx, Ry:<part>

operand1 = Rx;
If (Ry-part == t) then operand2 = SE(Ry[31:16]) else operand2 = SE(Ry[15:0]);
(Rd+1:Rd)[63:16] = (operand1 × operand2)[47:0] + (Rd+1:Rd)[63:16];
Rd[15:0] = 0;
d ∈ {0, 2, …, 14}
{x, y} ∈ {0, 1, …, 15}
part ∈ {t,b}

Rev1+

111

Rx

00000

Ry

00001100100

Y

Rd

3

4

5

4

11

1

4

Description

Multiplies the word and halfword register specified and adds the result to the specified double- word-register. The halfword register is selected as either the high or low part of Ry. Only the 48 highest of the 64 possible bits in the doubleword accumulator are used. The 16 lowest bits are cleared.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Example:

macwh.dR10, R2, R3:bwill perform 
(R11:R10)[63:16] = (R2 × SE(R3[15:0])) + (R11:R10)[63:16]
R10[15:0]  = 0

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

max Rd, Rx, Ry

If Rx > Ry
      Rd = Rx;
else
      Rd = Ry;
d, x, y ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

000011000100

Rd

3

4

5

4

12

4

Description

Sets Rd equal to the signed maximum of Rx and Ry.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

mcall Rp[disp]

LR = PC + 4
PC = *((Rp & 0xFFFFFFFC) + (SE(disp16) << 2)) 
p ∈ {0, 1, …, 15}
disp ∈ {-131072, -131068,…, 131068}

Rev1+

111100000001

Rp

disp16

12

4

16

Description

Subroutine call to a call destination specified in a location residing in memory.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

memc imm, bp5

*(SE(imm15<<2)[bp5]) = 0 
bp5 ∈ {0, 1, …, 31}
imm ∈ {-65536, -65532,…, 65532}

Rev1+

111101100001

bp5[4:1]

b5[0]

imm15

12

4

2

0

Description

Performs a read-modify-write operation to clear an arbitrary bit in memory. The word to modify is pointed to by a signed 17-bit address. This allows the instruction to address the upper 64KB and lower 64KB of mem- ory. This instruction is part of the optional RMW instruction set.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

mems imm, bp5

*(SE(imm15<<2)[bp5]) = 1 
bp5 ∈ {0, 1, …, 31}
imm ∈ {-65536, -65532,…, 65532}

Rev1+

111110000001

bp5[4:1]

b5[0]

imm15

12

4

1

15

Description

Performs a read-modify-write operation to set an arbitrary bit in memory. The word to modify is pointed to by a signed 17-bit address. This allows the instruction to address the upper 64KB and lower 64KB of mem- ory. This instruction is part of the optional RMW instruction set.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

memt imm, bp5

*(SE(imm15<<2)[bp5]) =  ~*(SE(k15<<2)[bp5])
bp5 ∈ {0, 1, …, 31}
imm ∈ {-65536, -65532,…, 65532}

Rev1+

111110100001

bp5[4:1]

b5[0]

imm15

12

4

1

15

Description

Performs a read-modify-write operation to toggle an arbitrary bit in memory. The word to modify is pointed to by a signed 17-bit address. This allows the instruction to address the upper 64KB and lower 64KB of memory. This instruction is part of the optional RMW instruction set.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

mfdr Rd, DebugRegisterNo

Rd = DebugRegister[DebugRegisterAddress << 2];
DebugRegisterNo  ∈ {0, 4, 8, ..., 1020}

Rev1+

111001011011

Rd

00000000

DebugRegisterAddress

12

4

8

8

Description

The instruction copies the value in the specified debug register to the specified register in the register file. Note that special timing concerns must be considered when operating on the debug registers, see the Pipeline Chapter for details.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Note:

Debug registers are implementation defined. If accessing a debug register that does not exist, the result is UNDEFINED.

This instruction can only be executed in a privileged mode. Execution from any other mode will trigger a Privilege Violation exception.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

mfsr Rd, SystemRegisterAddress

Rd = SystemRegister[SystemRegisterAddress << 2];
SystemRegisterAddress  ∈ {0, 4, 8, ..., 1020}

Rev1+

111000011011

Rd

00000000

SystemRegisterAddress

12

4

8

8

Description

The instruction copies the value in the specified system register to the specified register in the register file. Note that special timing concerns must be considered when operating on the sys- tem registers, see the Pipeline Chapter for details.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Note:

Some system registers are implementation defined. If accessing a system register that does not exist, the result is UNDEFINED.

With the exception of accessing the JECR and JOSP system registers, this instruction can only be executed in a privileged mode. Execution from any other mode will trigger a Privilege Viola- tion exception.

JECR and JOSP can be accessed from all modes with this instruction.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

min Rd, Rx, Ry

If Rx < Ry
      Rd = Rx;
else
      Rd = Ry;
d, x, y ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Rd

000011010100

Rd

3

4

5

4

12

4

Description

Sets Rd equal to the signed minimum of Rx and Ry.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

mov Rd, imm

Rd = SE(imm8);
d ∈ {0, 1, …, 15}
imm ∈ {-128, -127, ..., 127}

Rev1+

0011

imm8

Rd

4

8

4

2

mov Rd, imm

Rd = SE(imm21);
d ∈ {0, 1, …, 15}
imm ∈ {-1048576, -104875, ..., 1048575}

Rev1+

111

imm21[20:17]

0011

imm21[16]

Rd

imm21[15:0]

3

4

4

1

4

16

3

mov Rd, Rs

Rd = Rs;
d, s ∈ {0, 1, …, 15}

Rev1+

000

Rs

01001

Rd

3

4

5

4

Description

Moves a value into a register. The value may be an immediate or the contents of another regis- ter. Note that Rd may specify PC, resulting in a jump. All flags are unchanged.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

movh Rd, imm

Rd = imm16<<16;
d ∈ {0, 1, …, 15}
imm ∈ {0, 1, ..., 65535}

Rev2+

111111000001

Rd

imm16

12

4

16

Description

Moves a value into the high halfword of a register. The low halfword is cleared. All flags are unchanged.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

mov{cond4} Rd, Rs

if ( cond4)
      Rd = Rs;
{d, s} ∈ {0, 1, …, 15}
cond4 ∈ {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al}

Rev1+

111

Rs

00000

Rd

00010111

cond4

0000

3

4

5

4

8

4

4

2

mov{cond4} Rd, imm

if ( cond4)
      Rd = SE(imm8);
d ∈ {0, 1, …, 15}
cond4 ∈ {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al}
imm ∈ {-128, -127, ..., 127}

Rev1+

111110011011

Rd

0000

cond4

imm8

12

4

4

4

8

Description

Copies the contents of the source register or immediate to the destination register. The source register is unchanged. All flags are unchanged.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

mtdr DebugRegisterAddress, Rs

DebugRegister[DebugRegisterAddress << 2] = Rs;
DebugRegisterAddress  ∈ {0, 4, 8, ..., 1020}

Rev1+

111001111011

Rs

00000000

DebugRegisterAddress

12

4

8

8

Description

The instruction copies the value in the specified register to the specified debug register. Note that special timing concerns must be considered when operating on the system registers, see the Pipeline Chapter for details.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Note:

The debug registers are implementation defined, and updates of these registers are handled in an implementation specific way.

This instruction can only be executed in a privileged mode. Execution from any other mode will trigger a Privilege Violation exception.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

mtsr SystemRegisterAddress, Rs

SystemRegister[SystemRegisterAddress << 2] = Rs;
SystemRegisterAddress  ∈ {0, 4, 8, ..., 1020}

Rev1+

111000111011

Rs

00000000

SystemRegisterAddress

12

4

8

8

Description

The instruction copies the value in the specified register to the specified system register. Note that special timing concerns must be considered when operating on the system registers, see the Implementation Manual for details.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Note:

Some system registers are implementation defined. If writing a system register that does not exist, or to a register that is read only, the instruction is executed but no registers are updated.

With the exception of accessing the JECR and JOSP system registers, this instruction can only be executed in a privileged mode. Execution from any other mode will trigger a Privilege Viola- tion exception. JECR and JOSP can be accessed from all modes with this instruction.

The instruction mtsr JOSP, Rx must be used with care. The programmer must ensure that no change of flow instruction nor an INCJOSP instruction follows mtsr JOSP, Rx within a number of instructions. This number of cycles is implementation defined. It should also be noted, that this is true even if the instructions are not to be executed. For instance the sequence

mtsr JOSP, Rx retj incjosp

will execute with an incorrect result. In practice this warning will only affect programmers writing their own Java Virtual Machine based on the AVR32 Java Extension module.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

mul Rd, Rs

Rd = Rd × Rs;
{d, s} ∈ {0, 1, …, 15}

Rev1+

101

Rs

10011

Rd

3

4

5

4

2

mul Rd, Rx, Ry

Rd = Rx × Ry;
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

000000100100

Rd

3

4

5

4

12

4

3

mul Rd, Rs, imm

Rd = Rs × SE(imm8)
{d, s} ∈ {0, 1, …, 15}
imm ∈ {-128, -127, ..., 127}

Rev1+

111

Rs

00000

Rd

00010000

imm8

3

4

5

4

8

8

Description

Multiplies the specified operands and stores the result in the destination register.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

mulhh.w Rd, Rx:<part>, Ry:<part>

If (Rx-part == t) then operand1 = SE(Rx[31:16]) else operand1 = SE(Rx[15:0]);
If (Ry-part == t) then operand2 = SE(Ry[31:16]) else operand2 = SE(Ry[15:0]);
Rd = operand1 × operand2;
{d, x, y} ∈ {0, 1, …, 15}
part ∈ {t,b}

Rev1+

111

Rx

00000

Ry

0000011110

X

Y

Rd

3

4

5

4

10

1

1

4

Description

Multiplies the two halfword registers specified and stores the result in the destination word-regis- ter. The halfword registers are selected as either the high or low part of the operand registers.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Example:

mulhh.wR10, R2:t, R3:b
will perform R10 = SE(R2[31:16])  × SE(R3[15:0])

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

mulnhh.w Rd, Rx:<part>, Ry:<part>

If (Rx-part == t) then operand1 = SE(Rx[31:16]) else operand1 = SE(Rx[15:0]);
If (Ry-part == t) then operand2 = SE(Ry[31:16]) else operand2 = SE(Ry[15:0]);
Rd = - (operand1 × operand2);
{d, x, y} ∈ {0, 1, …, 15}
part ∈ {t,b}

Rev1+

111

Rx

00000

Ry

0000000110

X

Y

Rd

3

4

5

4

10

1

1

4

Description

Multiplies the two halfword registers specified and stores the result in the destination word-regis- ter. The halfword registers are selected as either the high or low part of the operand registers. The result is negated.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

mulnwh.d Rd, Rx, Ry:<part>

operand1 = Rx;
If (Ry-part == t) then operand2 = SE(Ry[31:16]) else operand2 = SE(Ry[15:0]);
(Rd+1:Rd)[63:16] = - (operand1 × operand2);
Rd[15:0] = 0;
d ∈ {0, 2, 4, …, 14}
{x, y} ∈ {0, 1, …, 15}
part ∈ {t,b}

Rev1+

111

Rx

00000

Ry

00000010100

Y

Rd

3

4

5

4

11

1

4

Description

Multiplies the word register with the halfword register specified and stores the negated result in the destination register pair. The halfword register is selected as either the high or low part of Ry. Since the most significant part of the product is stored, no overflow will occur.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

muls.d Rd, Rx, Ry

Rd+1:Rd = Rx × Ry;
d ∈ {0, 2, 4, …, 14}
{x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

000001000100

Rd

3

4

5

4

12

4

Description

Multiplies the two registers specified and stores the result in the destination registers.

Status Flags

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

mulsathh.h Rd, Rx:<part>, Ry:<part>

If (Rx-part == t) then operand1 = SE(Rx[31:16]) else operand1 = SE(Rx[15:0]);
If (Ry-part == t) then operand2 = SE(Ry[31:16]) else operand2 = SE(Ry[15:0]);
If (operand1 == operand2 == 0x8000)
      Rd = 0x7FFF;
else
      Rd = SE(  (operand1 × operand2) >> 15  );
{d, x, y} ∈ {0, 1, …, 15}
part ∈ {t,b}

Rev1+

111

Rx

00000

Ry

0000100010

X

Y

Rd

3

4

5

4

10

1

1

4

Description

Multiplies the two halfword registers specified, shifts the results one position to the left and stores the sign-extended high halfword of the result in the destination word-register. If the two operands equals -1, the result is saturated to the largest positive 16-bit fractional number. The halfword registers are selected as either the high or low part of the operand registers.

Status Flags:

Q:

Set if saturation occurred, or previously set.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Example:

mulsathh.h R10, R2:t, R3:b
will perform R10 = SE( Sat(SE(R2[31:16])  × SE(R3[15:0]) )  >> 15 )

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

mulsathh.w Rd, Rx:<part>, Ry:<part>

If (Rx-part == t) then operand1 = SE(Rx[31:16]) else operand1 = SE(Rx[15:0]);
If (Ry-part == t) then operand2 = SE(Ry[31:16]) else operand2 = SE(Ry[15:0]);
If (operand1 == operand2 == 0x8000)
      Rd = 0x7FFF_FFFF;
else
      Rd = (operand1 × operand2) << 1;
{d, x, y} ∈ {0, 1, …, 15}
part ∈ {t,b}

Rev1+

111

Rx

00000

Ry

0000100110

X

Y

Rd

3

4

5

4

10

1

1

4

Description

Multiplies the two halfword registers specified, shifts the results one position to the left and stores the result in the destination word-register. If the two operands equals -1, the result is sat- urated to the largest positive 32-bit fractional number. The halfword registers are selected as either the high or low part of the operand registers.

Status Flags:

Q:

Set if saturation occurred, or previously set.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Example:

mulsathh.w R10, R2:t, R3:b
will perform R10 = Sat( (SE(R2[31:16])  × SE(R3[15:0] )) << 1)

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

mulsatrndhh.h Rd, Rx:<part>, Ry:<part>

If (Rx-part == t) then operand1 = SE(Rx[31:16]) else operand1 = SE(Rx[15:0]);
If (Ry-part == t) then operand2 = SE(Ry[31:16]) else operand2 = SE(Ry[15:0]);
If (operand1 == operand2 == 0x8000)
      Rd = 0x7FFF;
else
      Rd = SE( ((operand1 × operand2) + 0x4000 ) >> 15 );
{d, x, y} ∈ {0, 1, …, 15}
part ∈ {t,b}

Rev1+

111

Rx

00000

Ry

0000101010

X

Y

Rd

3

4

5

4

10

1

1

4

Description

Multiplies the two halfword registers specified, shifts the results one position to the left and stores the result in the destination word-register. If the two operands equal -1, the result is satu- rated to the largest positive 16-bit fractional number. The halfword registers are selected as either the high or low part of the operand registers. The product is rounded.

Status Flags:

Q:

Set if saturation occurred, or previously set.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Example:

mulsatrndhh.h R10, R2:t, R3:b
will perform R10 = SE( Sat( SE(R2[31:16])  × SE(R3[15:0]) ) + 0x4000) >> 15)

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

mulsatrndwh.w Rd, Rx, Ry:<part>

operand1 = Rx;
If (Ry-part == t) then operand2 = SE(Ry[31:16])  else operand2 = SE(Ry[15:0]);
If ((operand1 == 0x8000_0000) && (operand2 == 0x8000))
      Rd = 0x7FFF_FFFF;
else
      Rd = SE( ((operand1 × operand2) + 0x4000 ) >> 15 );
{d, x, y} ∈ {0, 1, …, 15}
part ∈ {t,b}

Rev1+

111

Rx

00000

Ry

00001011100

Y

Rd

3

4

5

4

11

1

4

Description

Multiplies the word register with the halfword register specified, rounds the upper 32 bits of the result and stores it in the destination word-register. The halfword register is selected as either the high or low part of Ry. Since the most significant part of the product is stored, no overflow will occur. If the two operands equals -1, the result is saturated to the largest positive 32-bit fractional number.

Status Flags:

Q:

Set if saturation occurred, or previously set.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Example:

mulsatrndwh.w  R10, R2, R3b  will perform R10 = (Sat( R2[31:16]  × SE(R3[15:0]) ) + 
0x4000) >> 15

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

mulsatwh.w Rd, Rx, Ry:<part>

operand1 = Rx;
If (Ry-part == t) then operand2 = SE(Ry[31:16])  else operand2 = SE(Ry[15:0]);
If ((operand1 == 0x8000_0000) && (operand2 == 0x8000))
      Rd = 0x7FFF_FFFF;
else
      Rd = (operand1 × operand2) >> 15;
{d, x, y} ∈ {0, 1, …, 15}
part ∈ {t,b}

Rev1+

111

Rx

00000

Ry

00001110100

Y

Rd

3

4

5

4

11

1

4

Description

Multiplies the word register with the halfword register specified and stores the upper 32 bits of the result in the destination word-register. The halfword register is selected as either the high or low part of Ry. Since the most significant part of the product is stored, no overflow will occur. If the two operands equal -1, the result is saturated to the largest positive 32-bit fractional number.

Status Flags:

Q:

Set if saturation occurred, or previously set.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Example:

mulsatwh.wR10, R2, R3:b
will perform R10 = Sat( R2  × SE(R3[15:0]))  >> 15

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

mulu.d Rd, Rx, Ry

Rd+1:Rd = Rx × Ry;
d ∈ {0, 2, 4, …, 14}
{x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Rd

000001100100

Rd

3

4

5

4

12

4

Description

Multiplies the two registers specified and stores the result in the destination registers.

Status Flags

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

mulwh.d Rd, Rx, Ry:<part>

operand1 = Rx;
If (Ry-part == t) then operand2 = SE(Ry[31:16]) else operand2 = SE(Ry[15:0]);
(Rd+1:Rd)[63:16] = operand1 × operand2;
Rd[15:0] = 0;
d ∈ {0, 2, 4, …, 14}
{x, y} ∈ {0, 1, …, 15}
part ∈ {t,b}

Rev1+

111

Rx

00000

Ry

00001101100

Y

Rd

3

4

5

4

11

1

4

Description

Multiplies the word register with the halfword register specified and stores result in the destina- tion register pair. The halfword register is selected as either the high or low part of Ry. Since the most significant part of the product is stored, no overflow will occur.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

musfr Rs

SR[3:0] = Rs[3:0];
s ∈ {0, 1, …, 15}

Rev1+

010111010011

Rs

12

4

Description

The instruction copies the lower 4 bits of the register Rs to the lower 4 bits of the status register.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

mustr Rd

Rd = ZE(SR[3:0]);
d ∈ {0, 1, …, 15}

Rev1+

010111010010

Rd

12

4

Description

The instruction copies the value of the 4 lower bits of the status register into the register Rd. The value is zero extended.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

mvcr.d CP#, Rd, CRs

(Rd+1:Rd) = CP#(CRs+1:CRs);
# ∈ {0, 1, …, 7}
{d, s} ∈ {0, 2, 4, …, 14}

Rev1+

111011111010

Rd

0

CP#

0

CRs

000010000

12

3

1

3

1

3

9

2

mvcr.w CP#, Rd, CRs

Rd = CP#(CRs);
# ∈ {0, 1, …, 7}
{d, s} ∈ {0, 1, …, 15}

Rev1+

111011111010

Rd

CP#

0

CRs

00000000

12

4

3

1

4

8

Description

Addresses a coprocessor and moves the specified registers into the register file.

Status Flags:

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Example:

mvcr.d CP2, R0, CR2

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

mvrc.d CP#, CRd, Rs

CP#(CRd+1:CRd) = Rs+1:Rs;
# ∈ {0, 1, …, 7}
{d, s} ∈ {0, 2, 4, …, 14}

Rev1+

111011111010

Rs

0

CP#

0

CRd

000110000

12

3

1

3

1

3

9

2

mvrc.w CP#, CRd, Rs

CP#(CRd) = Rs;
# ∈ {0, 1, …, 7}
{d, s} ∈ {0, 1, …, 15}

Rev1+

111011111010

Rs

CP#

0

CRd

00100000

12

4

3

1

4

8

Description

Moves the specified register into the addressed coprocessor.

Status Flags:

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Example:

mvrc.d CP2, CR0, R2

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

neg Rd

Rd = 0 -Rd;
d ∈ {0, 1, …, 15}

Rev1+

010111000011

Rd

12

4

Description

Perform a two's complement of specified register.

Status Flags:

Q:

Not affected

V:

V = Rd[31] AND RES[31]

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

C = Rd[31] OR RES[31]

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

nop

none
none

Rev1+

1101011100000011

16

Description

Special instructions for "no operation" that does not create data depencencies in the pipeline

Status Flags:

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

or Rd, Rs

Rd = Rd OR Rs;
{d, s} ∈ {0, 1, …, 15}

Rev1+

000

Rs

00100

Rd

3

4

5

4

2

or Rd, Rx, Ry << sa

Rd = Rx OR (Ry << sa5);
{d, x, y} ∈ {0, 1, …, 15}
sa ∈ {0, 1, …, 31}

Rev1+

111

Rx

11110

Ry

0001000

sa5

Rd

3

4

5

4

7

5

4

3

or Rd, Rx, Ry >> sa

Rd = Rx OR (Ry >> sa5);
{d, x, y} ∈ {0, 1, …, 15}
sa ∈ {0, 1, …, 31}

Rev1+

111

Rx

11110

Ry

0001001

sa5

Rd

3

4

5

4

7

5

4

Description

Performs a bitwise logical OR between the specified registers and stores the result in the desti- nation register.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

orh Rd, imm

Rd[31:16] = Rd[31:16] OR imm16;
d ∈ {0, 1, …, 15}
imm ∈ {0, 1, ..., 65535}

Rev1+

111010100001

Rd

imm16

12

4

16

2

orl Rd, imm

Rd[15:0]   = Rd[15:0] OR imm16;
d ∈ {0, 1, …, 15}
imm ∈ {0, 1, ..., 65535}

Rev1+

111010000001

Rd

imm16

12

4

16

Description

Performs a bitwise logical OR between the high or low word in the specified register and a con- stant. The result is stored in the destination register.

Status Flags:

Q:

Not affected

V:

Not affected

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

or{cond4} Rd, Rx, Ry

if ( cond4)
Rd = Rx OR Ry;
{d, x, y} ∈ {0, 1, …, 15}
cond4 ∈ {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al}

Rev2+

111

Rx

11101

Ry

1110

cond4

0011

Rd

3

4

5

4

4

4

4

4

Description

Performs a bitwise logical OR between the specified registers and stores the result in the desti- nation register.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

pabs.sb Rd, Rs

Rd[31:24] = | Rs[31:24] |; Rd[23:16] = | Rs[23:16] |;
Rd[15:8] = | Rs[15:8] |; Rd[7:0] = | Rs[7:0] |;
{d, s} ∈ {0, 1, …, 15}

Rev1+

111000000000

Rs

001000111110

Rd

12

4

12

4

2

pabs.sh Rd, Rs

Rd[31:16] = | Rs[31:16] |;
Rd[15:0] = | Rs[15:0] |;
{d, s} ∈ {0, 1, …, 15}

Rev1+

111000000000

Rs

001000111111

Rd

12

4

12

4

Description

Compute the absolute values of four packed signed bytes (pabs.sb) or two packed signed half- words (pabs.sh) from the source register and store the results as packed bytes or halfwords in the destination register.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

packsh.ub Rd, Rx, Ry

Rd[31:24] = SATSU(Rx[31:16], 8); Rd[23:16] = SATSU(Rx[15:0], 8);
Rd[15:8] = SATSU(Ry[31:16], 8); Rd[7:0] = SATSU(Ry[15:0], 8);
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001001001100

Rd

3

4

5

4

12

4

2

packsh.sb Rd, Rx, Ry

Rd[31:24] = SATS(Rx[31:16], 8); Rd[23:16] = SATS(Rx[15:0], 8);
Rd[15:8] = SATS(Ry[31:16], 8); Rd[7:0] = SATS(Ry[15:0], 8);
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001001001101

Rd

3

4

5

4

12

4

Description

Pack the four signed halfwords located in the two source registers into four bytes in the destina- tion register. Each of the signed halfwords are saturated to unsigned (packsh.ub) or signed bytes (packsh.sb).

Status Flags:

Q:

Flag set if saturation occured in one or more of the partial operations.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

packw.sh Rd, Rx, Ry

Rd[31:16] = SATS(Rx, 16); 
Rd[15:0] = SATS(Ry, 16); 
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001001000111

Rd

3

4

5

4

12

4

Description

Pack the two words given in the source registers into two halfwords in the destination register. Each of the words are saturated to signed halfwords before being packed.

Status Flags:

Q:

Flag set if saturation occured in one or more of the partial operations.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

padd.b Rd, Rx, Ry

Rd[31:24] = Rx[31:24] + Ry[31:24]; Rd[23:16] = Rx[23:16] + Ry[23:16];
Rd[15:8] = Rx[15:8] + Ry[15:8]; Rd[7:0] = Rx[7:0] + Ry[7:0];
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000110000

Rd

3

4

5

4

12

4

2

padd.h Rd, Rx, Ry

Rd[31:16] = Rx[31:16] + Ry[31:16];
Rd[15:0] = Rx[15:0] + Ry[15:0];
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000000000

Rd

3

4

5

4

12

4

Description

Perform addition of four pairs of packed bytes (padd.b) or two pairs of halfwords (padd.h). Upon overflow any additional bits are discarded and the result is wrapped around.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

paddh.ub Rd, Rx, Ry

Rd[31:24] = LSR(ZE(Rx[31:24], 9) + ZE(Ry[31:24], 9), 1) ; 
Rd[23:16] = LSR(ZE(Rx[23:16], 9) + ZE(Ry[23:16], 9), 1);
Rd[15:8] = LSR(ZE(Rx[15:8], 9) + ZE(Ry[15:8], 9), 1);
Rd[7:0] = LSR(ZE(Rx[7:0], 9) + ZE(Ry[7:0], 9), 1);
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000110110

Rd

3

4

5

4

12

4

2

paddh.sh Rd, Rx, Ry

Rd[31:16] = ASR(SE(Rx[31:16], 17) + SE(Ry[31:16], 17), 1);
Rd[15:0] = ASR(SE(Rx[15:0], 17) + SE(Ry[15:0], 17), 1);
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000001100

Rd

3

4

5

4

12

4

Description

Perform addition of four pairs of packed unsigned bytes (paddh.ub) or two pairs of packed signed halfwords (paddh.sh) with a halving of the result to prevent any overflows from occuring.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

padds.ub Rd, Rx, Ry

Rd[31:24] = SATU(ZE(Rx[31:24], 9) + ZE(Ry[31:24], 9), 8) ; 
Rd[23:16] = SATU(ZE(Rx[23:16], 9) + ZE(Ry[23:16], 9), 8);
Rd[15:8] = SATU(ZE(Rx[15:8], 9) + ZE(Ry[15:8], 9), 8); 
Rd[7:0] = SATU(ZE(Rx[7:0], 9) + ZE(Ry[7:0], 9), 8);
I, II, III, IV.{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000110100

Rd

3

4

5

4

12

4

2

padds.sb Rd, Rx, Ry

Rd[31:24] = SATS(SE(Rx[31:24], 9) + SE(Ry[31:24], 9), 8); 
Rd[23:16] = SATS(SE(Rx[23:16], 9) + SE(Ry[23:16], 9), 8);
Rd[15:8] = SATS(SE(Rx[15:8], 9) + SE(Ry[15:8], 9), 8); 
Rd[7:0] = SATS(SE(Rx[7:0], 9) + SE(Ry[7:0], 9), 8);
I, II, III, IV.{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000110010

Rd

3

4

5

4

12

4

3

padds.uh Rd, Rx, Ry

Rd[31:16] = SATU(ZE(Rx[31:16], 17) + ZE(Ry[31:16], 17), 16);
Rd[15:0] = SATU(ZE(Rx[15:0], 17) + ZE(Ry[15:0], 17), 16);
I, II, III, IV.{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000001000

Rd

3

4

5

4

12

4

4

padds.sh Rd, Rx, Ry

Rd[31:16] = SATS(SE(Rx[31:16], 17) + SE(Ry[31:16], 17), 16);
Rd[15:0] = SATS(SE(Rx[15:0], 17) + SE(Ry[15:0], 17), 16);
I, II, III, IV.{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000000100

Rd

3

4

5

4

12

4

Description

Perform addition of four pairs of packed bytes or two pairs of halfwords. The result is saturated to either unsigned bytes (padds.ub), signed bytes (padds.sb), unsigned halfwords (padds.uh) or signed halfwords (padds.sh).

Status Flags:

Q:

Flag set if saturation occured in one or more of the partial operations.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

paddsub.h Rd, Rx:<part>, Ry:<part>

If (Rx-part == t) then operand1 = Rx[31:16] else operand1 = Rx[15:0];
If (Ry-part == t) then operand2 = Ry[31:16] else operand2 = Ry[15:0];
Rd[31:16] = operand1 + operand2;
Rd[15:0] = operand1 - operand2;
{d, x, y} ∈ {0, 1, …, 15}
part ∈ {t,b}

Rev1+

111

Rx

00000

Ry

0010000100

X

Y

Rd

3

4

5

4

10

1

1

4

Description

Perform an addition and subtraction on the same halfword operands which are selected from the source registers. The two halfword results are packed into the destination register without per- forming any saturation.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

paddsubh.sh Rd, Rx:<part>, Ry:<part>

If (Rx-part == t) then operand1 = Rx[31:16] else operand1 = Rx[15:0];
If (Ry-part == t) then operand2 = Ry[31:16] else operand2 = Ry[15:0];
Rd[31:16] = ASR(SE(operand1, 17) + SE(operand2, 17), 1);
Rd[15:0] = ASR(SE(operand1, 17) - SE(operand2, 17), 1);
{d, x, y} ∈ {0, 1, …, 15}
part ∈ {t,b}

Rev1+

111

Rx

00000

Ry

0010001010

X

Y

Rd

3

4

5

4

10

1

1

4

Description

Perform an addition and subtraction on the same signed halfword operands which are selected from the source registers. The halfword results are halved in order to prevent any overflows from occuring

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

paddsubs.uh Rd, Rx:<part>, Ry:<part>

If (Rx-part == t) then operand1 = Rx[31:16] else operand1 = Rx[15:0];
If (Ry-part == t) then operand2 = Ry[31:16] else operand2 = Ry[15:0];
Rd[31:16] = SATU(ZE(operand1, 17) + ZE(operand2, 17), 16);
Rd[15:0] = SATSU(ZE(operand1, 17) - ZE(operand2, 17), 16);
{d, x, y} ∈ {0, 1, …, 15}
part ∈ {t,b}

Rev1+

111

Rx

00000

Ry

0010001000

X

Y

Rd

3

4

5

4

10

1

1

4

2

paddsubs.sh Rd, Rx:<part>, Ry:<part>

If (Rx-part == t) then operand1 = Rx[31:16] else operand1 = Rx[15:0];
If (Ry-part == t) then operand2 = Ry[31:16] else operand2 = Ry[15:0];
Rd[31:16] = SATS(SE(operand1, 17) + SE(operand2, 17), 16);
Rd[15:0] = SATS(SE(operand1, 17) - SE(operand2, 17), 16);
{d, x, y} ∈ {0, 1, …, 15}
part ∈ {t,b}

Rev1+

111

Rx

00000

Ry

0010000110

X

Y

Rd

3

4

5

4

10

1

1

4

Description

Perform an addition and subtraction on the same halfword operands which are selected from the source registers. The resulting halfwords are saturated to unsigned halfwords (paddsubs.uh) or signed halfwords (paddsubs.sh) and then packed together in the destination register.

Status Flags:

Q:

Flag set if saturation occured in one or more of the partial operations.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

paddx.h Rd, Rx, Ry

Rd[31:16] = Rx[31:16] + Ry[15:0] ;
Rd[15:0] = Rx[15:0] + Ry[31:16];
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000000010

Rd

3

4

5

4

12

4

Description

Add together the top halfword of Rx with the bottom halfword of Ry and the bottom halfword of Rx with the top halfword of Ry. The resulting halfwords are packed together in the destination register without performing any saturation.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

paddxh.sh Rd, Rx, Ry

Rd[31:16] = ASR(SE(Rx[31:16], 17) + SE(Ry[15:0], 17), 1);
Rd[15:0] = ASR(SE(Rx[15:0], 17) + SE(Ry[31:16], 17), 1);
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000001110

Rd

3

4

5

4

12

4

Description

Add together the top halfword of Rx with the bottom halfword of Ry and the bottom halfword of Rx with the top halfword of Ry. The resulting halfwords are halved in order to avoid any overflow and then packed together in the destination register.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

paddxs.uh Rd, Rx, Ry

Rd[31:16] = SATU(ZE(Rx[31:16], 17) + ZE(Ry[15:0], 17), 16) ;
Rd[15:0] = SATU(ZE(Rx[15:0], 17) + ZE(Ry[31:16], 17), 16);
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000001010

Rd

3

4

5

4

12

4

2

paddxs.sh Rd, Rx, Ry

Rd[31:16] = SATS(SE(Rx[31:16], 17) + SE(Ry[15:0], 17), 16) ;
Rd[15:0] = SATS(SE(Rx[15:0], 17) + SE(Ry[31:16], 17), 16);
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000000110

Rd

3

4

5

4

12

4

Description

Add together the top halfword of Rx with the bottom halfword of Ry and the bottom halfword of Rx with the top halfword of Ry. The resulting halfwords are saturated to unsigned halfwords (paddxh.uh) or signed halfwords (paddxh.sh) and then packed together in the destination regis- ter.

Status Flags:

Q:

Flag set if saturation occured in one or more of the partial operations.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

pasr.b Rd, Rs, sa

Rd[31:24] = ASR(Rs[31:24], sa3);
Rd[23:16] = ASR(Rs[23:16], sa3);
Rd[15:8] = ASR(Rs[15:8], sa3);
Rd[7:0] = ASR(Rs[7:0], sa3);
{d, s} ∈ {0, 1, …, 15}

Rev1+

111

Rs

000000

sa3

001001000001

Rd

3

4

6

3

12

4

2

pasr.h Rd, Rs, sa

Rd[31:16] = ASR(Rs[31:16], sa4);
Rd[15:0] = ASR(Rs[15:0], sa4);
{d, s} ∈ {0, 1, …, 15}

Rev1+

111

Rs

00000

sa4

001001000100

Rd

3

4

5

4

12

4

Description

Perform an arithmetic shift right on each of the packed bytes or halfwords in the source register.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

pavg.ub Rd, Rx, Ry

Rd[31:24] = LSR(ZE(Rx[31:24], 9) + ZE(Ry[31:24], 9) + 1, 1); 
Rd[23:16] = LSR(ZE(Rx[23:16], 9) + ZE(Ry[23:16], 9) + 1, 1);
Rd[15:8] = LSR(ZE(Rx[15:8], 9) + ZE(Ry[15:8], 9) + 1, 1);
Rd[7:0] = LSR(ZE(Rx[7:0], 9) + ZE(Ry[7:0], 9) + 1, 1);
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000111100

Rd

3

4

5

4

12

4

2

pavg.sh Rd, Rx, Ry

Rd[31:16] = ASR(SE(Rx[31:16], 17) + SE(Ry[31:16], 17) + 1, 1);
Rd[15:0] = ASR(SE(Rx[15:0], 17) + SE(Ry[15:0], 17) + 1, 1);
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000111101

Rd

3

4

5

4

12

4

Description

Computes the average of pairs of packed unsigned bytes (pavg.ub) or packed signed halfwords (pavg.sh). The averages are computed by adding two values together while also adding in a rounding factor in the least significant bit. The result is then halved by shifting it one position to the right.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

plsl.b Rd, Rs, sa

Rd[31:24] = LSL(Rs[31:24], sa3);
Rd[23:16] = LSL(Rs[23:16], sa3); 
Rd[15:8] = LSL(Rs[15:8], sa3);
Rd[7:0] = LSL(Rs[7:0], sa3); 
{d, s} ∈ {0, 1, …, 15}

Rev1+

111

Rs

000000

sa3

001001000010

Rd

3

4

6

3

12

4

2

plsl.h Rd, Rs, sa

Rd[31:16] = LSL(Rs[31:16], sa4);
Rd[15:0] = LSL(Rs[15:0], sa4);
{d, s} ∈ {0, 1, …, 15}

Rev1+

111

Rs

00000

sa4

001001000101

Rd

3

4

5

4

12

4

Description

Perform a logical shift left on each of the packed bytes or halfwords in the source register and store the result to the destination register.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

plsr.b Rd, Rs, sa

Rd[31:24] = LSR(Rs[31:24], sa3);
Rd[23:16] = LSR(Rs[23:16], sa3); 
Rd[15:8] = LSR(Rs[15:8], sa3);
Rd[7:0] = LSR(Rs[7:0], sa3); 
{d, s} ∈ {0, 1, …, 15}

Rev1+

111

Rs

000000

sa3

001001000011

Rd

3

4

6

3

12

4

2

plsr.h Rd, Rs, sa

Rd[31:16] = LSR(Rs[31:16], sa4);
Rd[15:0] = LSR(Rs[15:0], sa4);
{d, s} ∈ {0, 1, …, 15}

Rev1+

111

Rs

00000

sa4

001001000110

Rd

3

4

5

4

12

4

Description

Perform a logical shift right on each of the packed bytes or halfwords in the source register and store the result to the destination register.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

pmax.ub Rd, Rx, Ry

If ( Rx[31:24] > Ry[31:24] )  then Rd[31:24] = Rx[31:24] else Rd[31:24] = Ry[31:24] ;
If ( Rx[23:16] > Ry[23:16] )  then Rd[23:16] = Rx[23:16] else Rd[23:16] = Ry[23:16] ;
If ( Rx[15:8] > Ry[15:8] )  then Rd[15:8] = Rx[15:8] else Rd[15:8] = Ry[15:8] ;
If ( Rx[7:0] > Ry[7:0] )  then Rd[7:0] = Rx[7:0] else Rd[7:0] = Ry[7:0] ;
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000111000

Rd

3

4

5

4

12

4

2

pmax.sh Rd, Rx, Ry

If ( Rx[31:16] > Ry[31:16] )  then Rd[31:16] = Rx[31:16] else Rd[31:16] = Ry[31:16] ;
If ( Rx[15:0] > Ry[15:0] )  then Rd[15:0] = Rx[15:0] else Rd[15:0] = Ry[15:0] ;
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000111001

Rd

3

4

5

4

12

4

Description

Compute the maximum values of pairs of packed unsigned bytes (pmax.ub) or packed signed halfwords (pmax.sh).

Status Flags:

Format I:

Q:

Not affected.

V:

( Rx[7:0] > Ry[7:0] )

N:

( Rx[15:8] > Ry[15:8] )

Z:

( Rx[23:16] > Ry[23:16] )

C:

( Rx[31:24] > Ry[31:24] )

Format II:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

( Rx[15:0] > Ry[15:0] )

C:

( Rx[31:16] > Ry[31:16] )

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

pmin.ub Rd, Rx, Ry

If ( Rx[31:24] < Ry[31:24] )  then Rd[31:24] = Rx[31:24] else Rd[31:24] = Ry[31:24] ;
If ( Rx[23:16] < Ry[23:16] )  then Rd[23:16] = Rx[23:16] else Rd[23:16] = Ry[23:16] ;
If ( Rx[15:8] < Ry[15:8] )  then Rd[15:8] = Rx[15:8] else Rd[15:8] = Ry[15:8] ;
If ( Rx[7:0] < Ry[7:0] )  then Rd[7:0] = Rx[7:0] else Rd[7:0] = Ry[7:0] ;
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000111010

Rd

3

4

5

4

12

4

2

pmin.sh Rd, Rx, Ry

If ( Rx[31:16] < Ry[31:16] )  then Rd[31:16] = Rx[31:16] else Rd[31:16] = Ry[31:16] ;
If ( Rx[15:0] < Ry[15:0] )  then Rd[15:0] = Rx[15:0] else Rd[15:0] = Ry[15:0] ;
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000111011

Rd

3

4

5

4

12

4

Description

Compute the minimum values of pairs of packed unsigned bytes (pmin.ub) or packed signed halfwords (pmin.sh).

Status Flags:

Format I:

Q:

Not affected.

V:

( Rx[7:0] < Ry[7:0] )

N:

( Rx[15:8] < Ry[15:8] )

Z:

( Rx[23:16] < Ry[23:16] )

C:

( Rx[31:24] < Ry[31:24] )

Format II:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

( Rx[15:0] < Ry[15:0] )

C:

( Rx[31:16] < Ry[31:16] )

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

popjc

temp  =FRAME;
JAVA_LV0 =*(temp--);
JAVA_LV1 =*(temp--);
JAVA_LV2 =*(temp--);
JAVA_LV3 =*(temp--);
JAVA_LV4 =*(temp--);
JAVA_LV5 =*(temp--);
JAVA_LV6 =*(temp--);
JAVA_LV7 =*(temp--);
none

Rev1+

1101011100010011

16

Description

Fetch the system registers LV0 to LV7 used in Java state from the current method frame. The register FRAME (equal to R9) is used as pointer register.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

popm Reglist8 {, R12 = {-1, 0, 1}}

if Reglist8[PC] AND k == B'1
     PC   = *(SP++)
     if Reglist8[LR:R12] == B'00
           R12   =   0;
     else if Reglist8[LR:R12] == B'01
           R12   =   1;
     else
           R12   =    - 1;
     Test R12 and update flags;
else 
     if Reglist8[PC] == 1 then
           PC   = *(SP++);
     if Reglist8[LR] == 1 then
           LR   = *(SP++);
     if Reglist8[R12] == 1 then
           R12   =*(SP++);
     if Reglist8[PC] == 1 then
           Test R12 and update flags;
if Reglist8[5] == 1 then
     R11   =*(SP++);
if Reglist8[4] == 1 then
     R10   =*(SP++);
if Reglist8[3] == 1 then
     R9   = *(SP++);
     R8   = *(SP++);
if Reglist8[2] == 1 then
     R7   = *(SP++);
     R6   = *(SP++);
     R5   = *(SP++);
     R4   = *(SP++);
if Reglist8[1] == 1 then
     R3   = *(SP++);
     R2   = *(SP++);
     R1   = *(SP++);
     R0   = *(SP++);
Reglist8 ∈ {R0- R3, R4-R7, R8-R9, R10,R11, R12, LR, PC}

Rev1+

1101

Reglist8

PC

LR

12

11

10

9-8

7-4

3-0

k

010

4

8

1

3

Description

Loads the consecutive words pointed to by SP into the registers specified in the instruction. The PC can be loaded, resulting in a jump to the loaded value. If PC is popped, the return value in R12 is tested and the flags are updated. R12 can optionally be updated with -1, 0 or 1. The k bit in the instruction coding is used to optionally let the POPM instruction update the return register R12 with the values -1, 0 or 1.

Status Flags:

Flags are only updated if Reglist8[PC] == 1.

They are set as the result of the operation cp R12, 0

Q:

Not affected

V:

V = 0

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

C = 0

Note:

Emtpy Reglist8 gives UNDEFINED result. The R bit in the status register has no effect on this instruction.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

pref Rp[disp]

Prefetch cache line containing the address (Rp + SE(disp16)).
p ∈ {0, 1, …, 15}
disp ∈ {-32768, -32767, ..., 32767}

Rev1+

111100100001

Rp

disp16

12

4

16

Description

This instruction allows the programmer to explicitly state that the cache should prefetch the specified line. The memory system treats this instruction in an implementation-dependent man- ner, and implementations without cache treats the instruction as a NOP. A prefetch instruction never reduces the performance of the system. If the prefetch instruction performs an action that would lower the system performance, it is treated as a NOP. For example, if the prefetch instruc- tion is about to generate an addressing exception, the instruction is cancelled and no exception is taken.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

psad Rd, Rx, Ry

Rd    =  | Rx[31:24] - Ry[31:24] | + | Rx[23:16] - Ry[23:16] | +
      | Rx[15:8] - Ry[15:8] | + | Rx[7:0] - Ry[7:0] |;
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001001000000

Rd

3

4

5

4

12

4

Description

Compute the Sum of Absolute Differences (SAD) of four pairs of packed unsigned bytes from the source registers and store the result in the destination register.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

psub.b Rd, Rx, Ry

Rd[31:24] = Rx[31:24] - Ry[31:24]; Rd[23:16] = Rx[23:16] - Ry[23:16];
Rd[15:8] = Rx[15:8] - Ry[15:8]; Rd[7:0] = Rx[7:0] - Ry[7:0];
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000110001

Rd

3

4

5

4

12

4

2

psub.h Rd, Rx, Ry

Rd[31:16] = Rx[31:16] - Ry[31:16];
Rd[15:0] = Rx[15:0] - Ry[15:0];
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000000001

Rd

3

4

5

4

12

4

Description

Perform subtraction of four pairs of packed bytes (psub.b) or two pairs of halfwords (psub.h). Upon overflow any additional bits are discarded and the result is wrapped around.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

psubadd.h Rd, Rx:<part>, Ry:<part>

If (Rx-part == t) then operand1 = Rx[31:16] else operand1 = Rx[15:0];
If (Ry-part == t) then operand2 = Ry[31:16] else operand2 = Ry[15:0];
Rd[31:16] = operand1 - operand2;
Rd[15:0] = operand1 + operand2;
{d, x, y} ∈ {0, 1, …, 15}
part ∈ {t,b}

Rev1+

111

Rx

00000

Ry

0010000101

X

Y

Rd

3

4

5

4

10

1

1

4

Description

Perform an subtraction and addition on the same halfword operands which are selected from the source registers. The two halfword results are packed into the destination register without per- forming any saturation.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

psubaddh.sh Rd, Rx:<part>, Ry:<part>

If (Rx-part == t) then operand1 = Rx[31:16] else operand1 = Rx[15:0];
If (Ry-part == t) then operand2 = Ry[31:16] else operand2 = Ry[15:0];
Rd[31:16] = ASR(SE(operand1, 17) - SE(operand2, 17), 1);
Rd[15:0] = ASR(SE(operand1, 17) + SE(operand2, 17), 1);
{d, x, y} ∈ {0, 1, …, 15}
part ∈ {t,b}

Rev1+

111

Rx

00000

Ry

0010001011

X

Y

Rd

3

4

5

4

10

1

1

4

Description

Perform a subtraction and addition on the same halfword operands which are selected from the source registers. The halfword results are halved in order to prevent any overflows from occuring

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

psubadds.uh Rd, Rx:<part>, Ry:<part>

If (Rx-part == t) then operand1 = Rx[31:16] else operand1 = Rx[15:0];
If (Ry-part == t) then operand2 = Ry[31:16] else operand2 = Ry[15:0];
Rd[31:16] = SATSU(ZE(operand1, 17) - ZE(operand2, 17), 16);
Rd[15:0] = SATU(ZE(operand1, 17) + ZE(operand2, 17), 16);
{d, x, y} ∈ {0, 1, …, 15}
part ∈ {t,b}

Rev1+

111

Rx

00000

Ry

0010001001

X

Y

Rd

3

4

5

4

10

1

1

4

2

psubadds.sh Rd, Rx:<part>, Ry:<part>

If (Rx-part == t) then operand1 = Rx[31:16] else operand1 = Rx[15:0];
If (Ry-part == t) then operand2 = Ry[31:16] else operand2 = Ry[15:0];
Rd[31:16] = SATS(SE(operand1, 17) - SE(operand2, 17), 16 );
Rd[15:0] = SATS(SE(operand1, 17) + SE(operand2, 17), 16);
{d, x, y} ∈ {0, 1, …, 15}
part ∈ {t,b}

Rev1+

111

Rx

00000

Ry

0010000111

X

Y

Rd

3

4

5

4

10

1

1

4

Description

Perform a subtraction and addition on the same halfword operands which are selected from the source registers. The resulting halfwords are saturated to unsigned halfwords (psubadds.uh) or signed halfwords (psubadds.sh) and then packed together in the destination register.

Status Flags:

Q:

Flag set if saturation occured in one or more of the partial operations.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

psubh.ub Rd, Rx, Ry

Rd[31:24] = LSR(ZE(Rx[31:24], 9) - ZE(Ry[31:24], 9), 1); 
Rd[23:16] = LSR(ZE(Rx[23:16], 9) - ZE(Ry[23:16], 9), 1);
Rd[15:8] = LSR(ZE(Rx[15:8], 9) - ZE(Ry[15:8], 9), 1); 
Rd[7:0] = LSR(ZE(Rx[7:0], 9) - ZE(Ry[7:0], 9), 1);
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000110111

Rd

3

4

5

4

12

4

2

psubh.sh Rd, Rx, Ry

Rd[31:16] = ASR(SE(Rx[31:16], 17) - SE(Ry[31:16], 17), 1);
Rd[15:0] = ASR(SE(Rx[15:0], 17) - SE(Ry[15:0], 17), 1);
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000001101

Rd

3

4

5

4

12

4

Description

Perform subtraction of four pairs of packed unsigned bytes (psub.ub) or two pairs of signed half- words (psub.sh) with a halfing of the result to prevent any overflows from occuring.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

psubs.ub Rd, Rx, Ry

Rd[31:24] = SATSU(ZE(Rx[31:24], 9) - ZE(Ry[31:24], 9), 8) ; 
Rd[23:16] = SATSU(ZE(Rx[23:16], 9) - ZE(Ry[23:16], 9), 8);
Rd[15:8] = SATSU(ZE(Rx[15:8], 9) - ZE(Ry[15:8], 9), 8); 
Rd[7:0] = SATSU(ZE(Rx[7:0], 9) - ZE(Ry[7:0], 9), 8);
I, II, III, IV.{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000110101

Rd

3

4

5

4

12

4

2

psubs.sb Rd, Rx, Ry

Rd[31:24] = SATS(SE(Rx[31:24], 9) - SE(Ry[31:24], 9), 8); 
Rd[23:16] = SATS(SE(Rx[23:16], 9) - SE(Ry[23:16], 9), 8);
Rd[15:8] = SATS(SE(Rx[15:8], 9) - SE(Ry[15:8], 9), 8); 
Rd[7:0] = SATS(SE(Rx[7:0], 9) - SE(Ry[7:0], 9), 8);
I, II, III, IV.{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000110011

Rd

3

4

5

4

12

4

3

psubs.uh Rd, Rx, Ry

Rd[31:16] = SATSU(ZE(Rx[31:16], 17) - ZE(Ry[31:16], 17), 16);
Rd[15:0] = SATSU(ZE(Rx[15:0], 17) - ZE(Ry[15:0], 17), 16);
I, II, III, IV.{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000001001

Rd

3

4

5

4

12

4

4

psubs.sh Rd, Rx, Ry

Rd[31:16] = SATS(SE(Rx[31:16], 17) - SE(Ry[31:16], 17), 16);
Rd[15:0] = SATS(SE(Rx[15:0], 17) - SE(Ry[15:0], 17), 16);
I, II, III, IV.{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000000101

Rd

3

4

5

4

12

4

Description

Perform subtraction of four pairs of packed bytes or two pairs of halfwords. The result is satu- rated to either unsigned bytes (psubs.ub), signed bytes (psubs.sb), unsigned halfwords (psubs.uh) or signed halfwords (psubs.sh).

Status Flags:

Q:

Flag set if saturation occured in one or more of the partial operations.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

psubx.h Rd, Rx, Ry

Rd[31:16] = Rx[31:16] - Ry[15:0] ;
Rd[15:0] = Rx[15:0] - Ry[31:16];
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000000011

Rd

3

4

5

4

12

4

Description

Subtract the bottom halfword of Ry from the top halfword of Rx and the top halfword of Ry from the bottom halfword of Rx. The resulting halfwords are packed together in the destination regis- ter without performing any saturation.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

psubxh.sh Rd, Rx, Ry

Rd[31:16] = ASR(SE(Rx[31:16], 17) - SE(Ry[15:0], 17), 1);
Rd[15:0] = ASR(SE(Rx[15:0], 17) - SE(Ry[31:16], 17), 1);
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000001111

Rd

3

4

5

4

12

4

Description

Subtract the bottom halfword of Ry from the top halfword of Rx and the top halfword of Ry from the bottom halfword of Rx. The resulting halfwords are halved in order to avoid any overflow and then packed together in the destination register.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

psubxs.uh Rd, Rx, Ry

Rd[31:16] =  SATSU(ZE(Rx[31:16], 17) - ZE(Ry[15:0], 17), 16) ;
Rd[15:0] = SATSU(ZE(Rx[15:0], 17) - ZE(Ry[31:16], 17), 16);
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000001011

Rd

3

4

5

4

12

4

2

psubxs.sh Rd, Rx, Ry

Rd[31:16] = SATS(SE(Rx[31:16], 17) - SE(Ry[15:0], 17), 16) ;
Rd[15:0] = SATS(SE(Rx[15:0], 17) - SE(Ry[31:16], 17), 16);
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

001000000111

Rd

3

4

5

4

12

4

Description

Subtract the bottom halfword of Ry from the top halfword of Rx and the top halfword of Ry from the bottom halfword of Rx. The resulting halfwords are saturated to unsigned halfwords (psubxh.uh) or signed halfwords (psubxh.sh) and then packed together in the destination regis- ter.

Status Flags:

Q:

Flag set if saturation occured in one or more of the partial operations.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

punpckub.h Rd, Rs:<part>

If ( Rs-part == top )  then
      Rd[31:16] = ZE(Rs[31:24], 16); Rd[15:0] = ZE(Rs[23:16], 16);
else
      Rd[31:16] = ZE(Rs[15:8], 16); Rd[15:0] = ZE(Rs[7:0], 16);
{d, s} ∈ {0, 1, …, 15}
part ∈ {t, b}

Rev1+

111

Rs

000000000

00100100100

k

Rd

3

4

9

11

1

4

2

punpcksb.h Rd, Rs:<part>

If ( Rs-part == top )  then
     Rd[31:16] = SE(Rs[31:24], 16); Rd[15:0] = SE(Rs[23:16], 16);
else
     Rd[31:16] = SE(Rs[15:8], 16); Rd[15:0] = SE(Rs[7:0], 16);
{d, s} ∈ {0, 1, …, 15}
part ∈ {t, b}

Rev1+

111

Rs

000000000

00100100101

k

Rd

3

4

9

11

1

4

Description

Unpack two unsigned bytes (punpckub.h) or two signed bytes (punpcksb.h) from the source reg- ister to two packed halfwords in the destination register.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

pushjc

temp  =FRAME;
*(temp--)  =JAVA_LV0;
*(temp--)  =JAVA_LV1;
*(temp--)  =JAVA_LV2;
*(temp--)  =JAVA_LV3;
*(temp--)  =JAVA_LV4;
*(temp--)  =JAVA_LV5;
*(temp--)  =JAVA_LV6;
*(temp--)  =JAVA_LV7;
none

Rev1+

1101011100100011

16

Description

Stores the system registers LV0 to LV7 used in Java state to designated place on the current method frame. FRAME (equal to R9) is used as pointer register.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

pushm Reglist8

if Reglist8[0] == 1 then
     *(--SP)  =R0;
     *(--SP)  =R1;
     *(--SP)  =R2;
     *(--SP)  =R3;
if Reglist8[1] == 1 then
     *(--SP)  =R4;
     *(--SP)  =R5;
     *(--SP)  =R6;
     *(--SP)  =R7;
if Reglist8[2] == 1 then
     *(--SP)  =R8;
     *(--SP)  =R9;
if Reglist8[3] == 1 then
     *(--SP)  =R10;
if Reglist8[4] == 1 then
     *(--SP)  =R11;
if Reglist8[5] == 1 then
     *(--SP)  =R12;
if Reglist8[6] == 1 then
     *(--SP)  =LR;
if Reglist8[7] == 1 then
     *(--SP)  =PC;
Reglist8 ∈ {R0- R3, R4-R7, R8-R9, R10,R11, R12, LR, PC} 

Rev1+

1101

Reglist8[7:1]

PC

LR

12

11

10

9-8

7-4

Reglist8[0]

3-0

0001

4

7

1

4

Description

Stores the registers specified in the instruction into consecutive words pointed to by SP.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Note:

Emtpy Reglist8 gives UNDEFINED result. The R bit in the status register has no effect on this instruction.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

rcall PC[disp]

LR = PC + 2
PC = PC + (SE(disp10)<<1)
disp ∈ {-1024, -1022, ..., 1022}

Rev1+

1100

disp10[7:0]

11

disp10[9:8]

4

8

2

2

2

rcall PC[disp]

LR = PC + 4
PC = PC + (SE(disp21)<<1)
disp ∈ {-2097152, -2097150, ..., 2097150}

Rev1+

111

disp21[20:17]

0101

disp21[16]

0000

disp21[15:0]

3

4

4

1

4

16

Description

PC-relative call of subroutine

Status Flags

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

retd

SR = RSR_DBG
PC = RAR_DBG
None

Rev1+

1101011000100011

16

Description

Return from debug mode.

Status Flags:

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Note:

This instruction can only be executed in a privileged mode. Execution from any other mode will trigger a Privilege Violation exception.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

RETE

If (microarchitecture == AVR32A)
     SR = *(SPSYS++) 
     PC = *(SPSYS++)
     If ( SR[M2:M0] == {B'010, B'011, B'100, B'101} )
           LR = *(SPSYS++)
           R12 = *(SPSYS++)
           R11 = *(SPSYS++)
           R10 = *(SPSYS++)
           R9 = *(SPSYS++)
           R8 = *(SPSYS++)
     SREG[L] = 0;
else
     SR = RSRCurrent Context
     PC = RARCurrent Context
     SREG[L] = 0;
None

Rev1+

1101011000000011

16

Description

Returns from an exception or interrupt. SREG[L] is cleared to support atomical memory access with the stcond instruction. This instruction can only be executed in INT0-INT3, EX and NMI modes. Execution in Application or Supervisor modes will trigger a Privilege Violation exception.

Status Flags

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

retj

PC = LR;
J  = 1;
R =  0;
if ( SR[M2:M0] == B'001 )
     GM = 0;
None

Rev1+

1101011000110011

16

Description

Returns from a Java trap.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

RETS

If ( SR[M2:M0] == B'000 )
     Issue Privilege Violation Exception;
else if ( SR[M2:M0] == B'001 )
     If (microarchitecture == AVR32A)
           SR = *(SPSYS++) 
           PC = *(SPSYS++)
     else
           SR = RSRSUP; 
           PC = RARSUP;
else
     PC = LRCurrent Context
None

Rev1+

1101011000010011

16

Description

Returns from a supervisor call.

Status Flags

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

RETSS

If ( SR[SS] == 0 )
     Issue Privilege Violation Exception;
else 
      
     SR = SS_RSR 
     PC = SS_RAR
None

Rev3+

1101011101100011

16

Description

Returns from Secure State.

Status Flags

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

ret{cond4} Rs

If (cond4)
      If (Rs != {LR, SP, PC})
            R12 = Rs;
      else if (Rs == LR)
            R12 = -1;
      else if (Rs == SP)
            R12 = 0;
      else
            R12 = 1;
      Test R12 and set flags;
      PC = LR;
cond4 ∈ {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al}
s  ∈{0, 1, …, 15}

Rev1+

01011110

cond4

Rs

8

4

4

Description

Return from subroutine if the specified condition is true. Values are moved into the return regis- ter, the return value is tested, and flags are set.

Status Flags:

Flags are set as result of the operation CP R12, 0.

Q:

Not affected

V:

V = 0

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

C = 0

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

rjmp PC[disp]

PC = PC + (SE(disp10)<<1);
disp ∈ {-1024, -1022, ..., 1022}

Rev1+

1100

disp10[7:0]

10

disp10[9:8]

4

8

2

2

Description

Jump the specified amount relative to the Program Counter .

Status Flags

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

rol Rd

C´ = Rd[31];
Rd = Rd << 1;
Rd[0] = C;
C = C´;
d ∈ {0, 1, …, 15}

Rev1+

010111001111

Rd

12

4

Description

Shift all bits in Rd one place to the left. The C flag is shifted into the LSB. The MSB is shifted into the C flag.

Status Flags:

Q:

Not affected

V:

Not affected

N:

N = Res[31]

Z:

Z = (RES[31:0] == 0)

C:

C = Rd[31]

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

ror Rd

C´ = Rd[0];
Rd = Rd >> 1;
Rd[31] = C;
C = C´;
d ∈ {0, 1, …, 15}

Rev1+

010111010000

Rd

12

4

Description

Shift all bits in Rd one place to the right. The C flag is shifted into the MSB. The LSB is shifted into the C flag.

Status Flags:

Q:

Not affected

V:

Not affected

N:

N = Res[31]

Z:

Z = (RES[31:0] == 0)

C:

C = Rd[0]

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

rsub Rd, Rs

Rd = Rs - Rd;
{d, s} ∈ {0, 1, …, 15}

Rev1+

000

Rs

00010

Rd

3

4

5

4

2

rsub Rd, Rs, imm

Rd = SE(imm8) - Rs;
{d, s} ∈ {0, 1, …, 15}
imm ∈ {-128, -127, ..., 127}

Rev1+

111

Rs

00000

Rd

00010001

imm8

3

4

5

4

8

8

Description

Performs a subtraction and stores the result in destination register. Similar to sub, but the minu- end and subtrahend are interchanged.

Status Flags:

Format I: OP1 = Rs, OP2 = Rd

Format II: OP1 = SE(imm8), OP2 = Rs

Q:

Not affected

V:

V = (OP1[31] AND ~OP2[31] AND ~RES[31]) OR (~OP1[31] AND OP2[31] AND RES[31])

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

C = ~OP1[31] AND OP2[31] OR OP2[31] AND RES[31] OR ~OP1[31] AND RES[31]

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

rsub{cond4} Rd, imm

if ( cond4)
Rd = SE(imm8) - Rd;
d ∈ {0, 1, …, 15}
cond4 ∈ {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al}
imm ∈ {-128, -127, ..., 127}

Rev2+

111110111011

Rd

0000

cond4

imm8

12

4

4

4

8

Description

Performs a subtraction and stores the result in destination register. Similar to sub, but the minu- end and subtrahend are interchanged.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

satadd.hRd, Rx, Ry

temp = ZE(Rx[15:0]) + ZE(Ry[15:0]));
if (Rx[15] AND Ry[15] AND ~temp[15]) OR (~Rx[15] AND ~Ry[15] AND temp[15]) then
      if Rx[15] == 0 then
            Rd = 0x00007fff;
      else
            Rd = 0xffff8000;
else
      Rd = SE(temp[15:0]);
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

000000101100

Rd

3

4

5

4

12

4

Description

Adds the two halfword registers specified and stores the result in destination register. The result is saturated if it overflows the range representable with 16 bits. If saturation occurs, the Q flag is set.

Status Flags:

Q:

Q = (Rx[15] AND Ry[15] AND ~temp[15]) OR (~Rx[15] AND ~Ry[15] AND temp[15]) OR Q

V:

V = (Rx[15] AND Ry[15] AND ~temp[15]) OR (~Rx[15] AND ~Ry[15] AND temp[15])

N:

N = Rd[15]

Z:

Z = if (Rd[15:0] == 0)

C:

C = 0

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

satadd.wRd, Rx, Ry

temp = Rx + Ry;
if (Rx[31] AND Ry[31] AND ~temp[31]) OR (~Rx[31] AND ~Ry[31] AND temp[31]) then
      if Rx[31] == 0 then
            Rd = 0x7fffffff;
      else 
            Rd = 0x8000000;
else
      Rd = temp;
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

000000001100

Rd

3

4

5

4

12

4

Description

Adds the two registers specified and stores the result in destination register. The result is satu- rated if a two's complement overflow occurs. If saturation occurs, the Q flag is set.

Status Flags:

Q:

Q = (Rx[31] AND Ry[31] AND ~temp[31]) OR (~Rx[31] AND ~Ry[31] AND temp[31]) OR Q

V:

V = (Rx[31] AND Ry[31] AND ~temp[31]) OR (~Rx[31] AND ~Ry[31] AND temp[31])

N:

N = Rd[31]

Z:

Z = (Rd[31:0] == 0)

C:

C = 0

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

satrnds Rd >> sa, bp

Temp  = Rd >> sa
if (sa != 0)
      Rnd = Rd[sa-1]
      Temp = Temp + Rnd;
if ((Temp == SE( Temp[bp-1:0])) || (bp == 0) )
      Rd = Temp;
else
      if (Temp[31] == 1)
            Rd = -2bp-1;
      else
            Rd = 2bp-1 - 1;
d ∈ {0, 1, …, 15}
{sa, bp} ∈ {0, 1, …, 31}

Rev1+

111100111011

Rd

000000

bp

sa

12

4

6

5

5

Description

This instruction considers the value in (Rd>>sa)[bp-1:0] as a signed value. Rounding is per- formed after the shift. If the value in (Rd>>sa)[31:bp] is not merely a sign-extention of this value, overflow has occurred and saturation is performed to the maximum signed positive or negative value. If saturation occurs, the Q flag is set. An arithmetic shift is performed on Rd. If bp equals zero, no saturation is performed.

Status Flags:

Q:

Set if saturation occurred or Q was already set, cleared otherwise.

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

satrndu Rd >> sa, bp

Temp  = Rd >> sa
if (sa != 0)
      Rnd = Rd[sa-1]
      Temp = Temp + Rnd;
If ((Temp == ZE( Temp[bp-1:0]))  || (bp == 0) )
      Rd = Temp;
else
      if (Temp[31] == 1)
            Rd = 0x0000_0000;
      else
            Rd = 2bp - 1;
d ∈ {0, 1, …, 15}
{sa, bp} ∈ {0, 1, …, 31}

Rev1+

111100111011

Rd

000001

bp

sa

12

4

6

5

5

Description

This instruction considers the value in (Rd>>sa)[bp-1:0] as a unsigned value. Rounding is per- formed after the shift. If the value in (Rd>>sa)[31:bp] is not merely a zero extention of this value, overflow has occurred and saturation is performed to the maximum unsigned positive value or zero. If saturation occurs, the Q flag is set. An arithmetic shift is performed on Rd. If bp equals zero, no saturation is performed.

Status Flags:

Q:

Set if saturation occurred or Q was already set, cleared otherwise.

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

sats Rd >> sa, bp

Temp  = Rd >> sa
If ((Temp == SE( Temp[bp-1:0])) || (bp == 0))
      Rd = Temp;
else
      if (Temp[31] == 1)
            Rd = -2bp-1;
      else
            Rd = 2bp-1 - 1;
d ∈ {0, 1, …, 15}
{sa, bp} ∈ {0, 1, …, 31}

Rev1+

111100011011

Rd

000000

bp

sa

12

4

6

5

5

Description

This instruction considers the value in (Rd>>sa)[bp-1:0] as a signed value. If the value in (Rd>>sa)[31:bp] is not merely a sign-extention of this value, overflow has occurred and satura- tion is performed to the maximum signed positive or negative value. If saturation occurs, the Q flag is set. An arithmetic shift is performed on Rd. If bp equals zero, no saturation is performed.

Status Flags:

Q:

Set if saturation occurred or Q was already set, cleared otherwise.

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

satsub.hRd, Rx, Ry

temp = ZE(Rx[15:0]) - ZE(Ry[15:0]) ;
if (Rx[15] AND ~Ry[15] AND ~temp[15]) OR (~Rx[15] AND Ry[15] AND temp[15]) then
     if Rx[15]==0 then
           Rd = 0x00007fff;
     else
           Rd = 0xffff8000;
else
      Rd = SE(temp[15:0]);
{d, s} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

000000111100

Rd

3

4

5

4

12

4

Description

Performs a subtraction of the specified halfwords and stores the result in destination register. The result is saturated if it overflows the range representable with 16 bits. If saturation occurs, the Q flag is set.

Status Flags:

Q:

Q = (Rx[15] AND ~Ry[15] AND ~temp[15]) OR (~Rx[15] AND Ry[15] AND temp[15]) OR Q

V:

V = (Rx[15] AND ~Ry[15] AND ~temp[15]) OR (~Rx[15] AND Ry[15] AND temp[15])

N:

N = Rd[15]

Z:

Z = (Rd[15:0] == 0)

C:

C = 0

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

satsub.w Rd, Rx, Ry

temp = Rx - Ry;
{d, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

000000011100

Rd

3

4

5

4

12

4

2

satsub.w Rd, Rs, imm

temp = Rs - SE(imm16));
Format I: OP1 = Rx, OP2 = Ry
Format II: OP1 = Rs, OP2 = SE(imm16)
if (OP1[31] AND ~OP2[31] AND ~temp[31]) OR (~OP1[31] AND OP2[31] AND temp[31]) then
      if(OP1[31]==0) then
            Rd =  0x7fffffff;
      else
            Rd =  0x80000000;
else
      Rd =  temp
{d, s} ∈ {0, 1, …, 15}
imm ∈ {-32768, -32767, ..., 32767}

Rev1+

111

Rs

01101

Rd

imm16

3

4

5

4

16

Description

Performs a subtraction and stores the result in destination register. The result is saturated if a two's complement overflow occurs. If saturation occurs, the Q flag is set.

Status Flags:

Format I: OP1 = Rx, OP2 = Ry

Format II: OP1 = Rs, OP2 = SE(imm16)

Q:

Q = (OP1[31] AND ~OP2[31] AND ~temp[31]) OR (~OP1[31] AND OP2[31] AND temp[31]) OR

Q

V:

V = (OP1[31] AND ~OP2[31] AND ~temp[31]) OR (~OP1[31] AND OP2[31] AND temp[31])

N:

N = Rd[31]

Z:

Z = (Rd[31:0] == 0)

C:

C = 0

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

satu Rd >> sa, bp

Temp  = Rd >> sa
If ((Temp == ZE( Temp[bp-1:0])) || (bp == 0) )
      Rd = Temp;
else
      if (Temp[31] == 1)
            Rd = 0x0000_0000;
      else
            Rd = 2bp - 1;
d ∈ {0, 1, …, 15}
{sa, bp} ∈ {0, 1, …, 31}

Rev1+

111100011011

Rd

000001

bp

sa

12

4

6

5

5

Description

This instruction considers the value in (Rd>>sa)[bp-1:0] as a unsigned value. If the value in (Rd>>sa)[31:bp] is not merely a zero extention of this value, overflow has occurred and satura- tion is performed to the maximum unsigned positive value or zero. If saturation occurs, the Q flag is set. An arithmetic shift is performed on Rd. If bp equals zero, no saturation is performed.

Status Flags:

Q:

Set if saturation occurred or Q was already set, cleared otherwise.

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

sbc Rd, Rx, Ry

Rd = Rx - Ry - C;
{x, y, d} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

000000010100

Rd

3

4

5

4

12

4

Description

Subtracts a specified register and the value of the carry bit from a destination register and stores the result in the destination register.

Status Flags:

Q:

Not affected.

V:

V = (Rx[31] AND ~Ry[31] AND ~RES[31]) OR (~Rx[31] AND Ry[31] AND RES[31])

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0) AND Z

C:

C = ~Rx[31] AND Ry[31] OR Ry[31] AND RES[31] OR ~Rx[31] AND RES[31]

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

sbr Rd, bp

Rd[bp5] = 1;
d ∈ {0, 1, …, 15}
bp ∈ {0, 1, …, 31}

Rev1+

101

bp[4:1]

1101

bp[0]

Rd

3

4

4

1

4

Description

Sets a bit in the specified register. All other bits are unaffected.

Status Flags:

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Z = 0

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

scall

If ( SR[M2:M0] == {B'000 or B'001} )
      If (microarchitecture == AVR32A)
            *(--SPSYS) = PC + 2;
            *(--SPSYS) =  SR;
            PC = EVBA + 0x100;
            SR[M2:M0] = B'001;
      else
            RARSUP = PC + 2;
           RSRSUP =  SR;
           PC = EVBA + 0x100;
           SR[M2:M0] = B'001;
else 
      LRCurrent Context = PC + 2;
      PC = EVBA + 0x100;
none

Rev1+

1101011100110011

16

Description

The scall instruction performs a supervisor routine call. The behaviour of the instruction is dependent on the mode it is called from, allowing scall to be executed from all contexts. Scall jumps to a dedicated entry point relative to EVBA. Scall can use the same call convention as regular subprogram calls.

Status Flags:

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

scr Rd

Rd = Rd - C;
d ∈ {0, 1, …, 15}

Rev1+

010111000001

Rd

12

4

Description

Subtracts carry from the specified destination register.

Status Flags:

Q:

Not affected

V:

V = (Rd[31] AND ~RES[31])

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0) AND Z

C:

C = ~Rd[31] AND RES[31]

Example

; Subtract a 32-bit variable (R0) from a 64-bit variable (R2:R1) sub

R1, R0

scr

R2

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

sleep Op8

Set the system in the specified sleep mode.
Op8 ∈ {0, 1, …, 255}

Rev1+

1110100110110000

00000000

Op8

16

8

8

Description

Sets the system in the sleep mode specified by the implementation defined Op8 operand. The semantic of Op8 is IMPLEMENTATION DEFINED. If bit 7 in Op8 is one, SR[GM] will be cleared when entering sleep mode.

Status Flags:

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Note:

The sleep instruction is a privileged instruction, and will trigger a Privilege Violation exception if executed in user mode.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

sr{cond4} Rd

if (cond4)
      Rd = 1;
else
      Rd = 0;
cond4 ∈ {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al}
d ∈ {0, 1, ..., 15}

Rev1+

01011111

cond4

Rd

8

4

4

Description

Sets the register specified to 1 if the condition specified is true, clear the register otherwise.

Status Flags:

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

sscall

SS_RAR = PC;
SS_RSR =  SR;
If (microarchitecture == AVR32A)
      PC = 0x8000_0004;
else)
      PC = 0xA000_0004;
SR[SS] = 1;
SR[GM] = 1;
if (SR[M2:M0] == 0)
      SR[M2:M0] = 001;
none

Rev3+

1101011101010011

16

Description

The sscall instruction performs a secure state call. Sscall can use the same call convention as regular subprogram calls.

Status Flags:

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

ssrf bp

SR[bp5] = 1;
bp ∈ {0, 1, …, 31}

Rev1+

1101001

bp5

0011

7

5

4

Description

Sets the status register (SR) flag specified.

Status Flags:

SR[bp5] = 1, all other flags unchanged.

Note:

Privileged if bp5 > 15, ie. upper half of status register. An exception will be triggered if the upper half of the status register is attempted changed in user mode.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

st.b Rp++, Rs

*(Rp) = Rs[7:0];
Rp = Rp + 1;
{s , p} ∈ {0, 1, …, 15}

Rev1+

000

Rp

01100

Rs

3

4

5

4

2

st.b --Rp, Rs

Rp = Rp - 1;
*(Rp) = Rs[7:0];
{s , p} ∈ {0, 1, …, 15}

Rev1+

000

Rp

01111

Rs

3

4

5

4

3

st.b Rp[disp], Rs

*(Rp + ZE(disp3)) = Rs[7:0];
{s , p} ∈ {0, 1, …, 15}
disp ∈ {0, 1, ..., 7}

Rev1+

101

Rp

01

disp3

Rs

3

4

2

3

4

4

st.b Rp[disp], Rs

*(Rp + SE(disp16)) = Rs[7:0];
{s , p} ∈ {0, 1, …, 15}
disp ∈ {-32768, -32767, ..., 32767}

Rev1+

111

Rp

10110

Rs

disp16

3

4

5

4

16

5

st.b Rb[Ri << sa], Rs

*(Rb + (Ri << sa2)) = Rs[7:0];
{b, i, s} ∈ {0, 1, …, 15}
sa  ∈ {0, 1, 2, 3}

Rev1+

111

Rb

00000

Ri

0000101100

sa2

Rs

3

4

5

4

10

2

4

Description

The source register is stored to the byte memory location referred to by the pointer address.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Note:

For formats I. and II., if Rp = Rs the result will be UNDEFINED.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

st.b{cond4} Rp[disp], Rs

if (cond4)
*(Rp + ZE(disp9)) = Rs[7:0];
s, p ∈ {0, 1, …, 15}
disp ∈ {0, 1, ..., 511}
cond4 ∈ {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al}

Rev2+

111

Rp

11111

Rd

cond4

111

disp9

3

4

5

4

4

3

9

Description

The source register is stored to the byte memory location referred to by the pointer address if the given condition is satisfied.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

st.d Rp++, Rs

*(Rp) = Rs+1:Rs;
Rp = Rp + 8;
 p ∈ {0, 1, …, 15}
s ∈ {0, 2, …, 14}

Rev1+

101

Rp

10010

Rs

0

3

4

5

3

1

2

st.d --Rp, Rs

Rp = Rp - 8;
*(Rp) = Rs+1:Rs;
 p ∈ {0, 1, …, 15}
s ∈ {0, 2, …, 14}

Rev1+

101

Rp

10010

Rs

1

3

4

5

3

1

3

st.d Rp, Rs

*(Rp) = Rs+1:Rs;
 p ∈ {0, 1, …, 15}
s ∈ {0, 2, …, 14}

Rev1+

101

Rp

10001

Rs

1

3

4

5

3

1

4

st.d Rp[disp], Rs

*(Rp + SE(disp16)) = Rs+1:Rs;
p ∈ {0, 1, …, 15}
s ∈ {0, 2, …, 14}
disp ∈ {-32768, -32767, ..., 32767}

Rev1+

111

Rp

01110

Rs

1

disp16

3

4

5

3

1

16

5

st.d Rb[Ri << sa], Rs

*(Rb + (Ri << sa2)) = Rs+1:Rs;
{b, i} ∈ {0, 1, …, 15}
s ∈ {0, 2, …, 14}
sa  ∈ {0, 1, 2, 3}

Rev1+

111

Rb

00000

Ri

0000100000

sa2

Rs

3

4

5

4

10

2

4

Description

The source registers are stored to the doubleword memory location referred to by the pointer address.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Note:

For formats I. and II., if Rp == Rs the result will be UNDEFINED.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

st.h Rp++, Rs

*(Rp) = Rs[15:0];
Rp = Rp + 2;
{s , p} ∈ {0, 1, …, 15}

Rev1+

000

Rp

01011

Rs

3

4

5

4

2

st.h --Rp, Rs

Rp = Rp - 2;
*(Rp) = Rs[15:0];
{s , p} ∈ {0, 1, …, 15}

Rev1+

000

Rp

01110

Rs

3

4

5

4

3

st.h Rp[disp], Rs

*(Rp + ZE(disp3 << 1)) = Rs[15:0];
{s , p} ∈ {0, 1, …, 15}
disp ∈ {0, 2, ..., 14}

Rev1+

101

Rp

00

disp3

Rs

3

4

2

3

4

4

st.h Rp[disp], Rs

*(Rp + SE(disp16)) = Rs[15:0];
{s , p} ∈ {0, 1, …, 15}
disp ∈ {-32768, -32767, ..., 32767}

Rev1+

111

Rp

10101

Rs

disp16

3

4

5

4

16

5

st.h Rb[Ri << sa], Rs

*(Rb + (Ri << sa2)) = Rs[15:0];
{b, i, s} ∈ {0, 1, …, 15}
sa  ∈ {0, 1, 2, 3}

Rev1+

111

Rb

00000

Ri

0000101000

sa2

Rs

3

4

5

4

10

2

4

Description

The source register is stored to the halfword memory location referred to by the pointer address.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Note:

For formats I. and II., if Rp == Rs the result will be UNDEFINED.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

st.h{cond4} Rp[disp], Rs

if (cond4)
*(Rp + ZE(disp9<<1)) = Rs[15:0];
s, p ∈ {0, 1, …, 15}
disp ∈ {0, 2, ..., 1022}
cond4 ∈ {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al}

Rev2+

111

Rp

11111

Rs

cond4

110

disp9

3

4

5

4

4

3

9

Description

The source register is stored to the halfword memory location referred to by the pointer address if the given condition is satisfied.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

st.w Rp++, Rs

*(Rp) = Rs;
Rp = Rp + 4;
{s , p} ∈ {0, 1, …, 15}

Rev1+

000

Rp

01010

Rs

3

4

5

4

2

st.w --Rp, Rs

Rp = Rp - 4;
*(Rp) = Rs;
{s , p} ∈ {0, 1, …, 15}

Rev1+

000

Rp

01101

Rs

3

4

5

4

3

st.w Rp[disp], Rs

*(Rp + ZE(disp4 << 2)) = Rs;
{s , p} ∈ {0, 1, …, 15}
disp ∈ {0, 4, ..., 60}

Rev1+

100

Rp

1

disp4

Rs

3

4

1

4

4

4

st.w Rp[disp], Rs

*(Rp + SE(disp16)) = Rs;
{s , p} ∈ {0, 1, …, 15}
disp ∈ {-32768, -32767,…, 32767}

Rev1+

111

Rp

10100

Rs

disp16

3

4

5

4

16

5

st.w Rb[Ri << sa], Rs

*(Rb + (Ri << sa2)) = Rs;
{b, i, s} ∈ {0, 1, …, 15}
sa  ∈ {0, 1, 2, 3}

Rev1+

111

Rb

00000

Ri

0000100100

sa2

Rs

3

4

5

4

10

2

4

Description

The source register is stored to the word memory location referred to by the pointer address.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Note:

For formats I. and II., if Rp == Rs the result will be UNDEFINED.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

st.w{cond4} Rp[disp], Rs

if (cond4)
*(Rp + ZE(disp9<<2)) = Rs;
s, p ∈ {0, 1, …, 15}
disp ∈ {0, 4, ..., 2044}
cond4 ∈ {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al}

Rev2+

111

Rp

11111

Rd

cond4

101

disp9

3

4

5

4

4

3

9

Description

The source register is stored to the word memory location referred to by the pointer address if the given condition is satisfied.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

stc.d CP#, Rp[disp], CRs

*(Rp + (ZE(disp8) << 2)) = CP#(CRd+1:CRd);
# ∈ {0, 1, …, 7}

Rev1+

111010111010

Rp

CP #

1

CRs[3:1]

0

disp8

12

4

3

1

3

1

8

2

stc.d CP#, Rp++, CRs

*(Rp) = CP#(CRd+1:CRd);
Rp = Rp+8;
# ∈ {0, 1, …, 7}

Rev1+

111011111010

Rp

CP #

0

CRs[3:1]

001110000

12

4

3

1

3

9

3

stc.d CP#, Rb[Ri<<sa], CRs

*(Rb + (Ri << sa2)) = CP#(CRd+1:CRd);
# ∈ {0, 1, …, 7}

Rev1+

111011111010

Rp

CP #

1

CRs[3:1]

011

sa2

Ri

12

4

3

1

3

3

2

4

4

stc.w CP#, Rp[disp], CRs

*(Rp + (ZE(disp8) << 2)) = CP#(CRd);
# ∈ {0, 1, …, 7}

Rev1+

111010111010

Rp

CP #

0

CRs

disp8

12

4

3

1

4

8

5

stc.w CP#, Rp++, CRs

*(Rp) = CP#(CRd);
Rp = Rp+4;
# ∈ {0, 1, …, 7}

Rev1+

111011111010

Rp

CP #

0

CRs

01100000

12

4

3

1

4

8

6

stc.w CP#, Rb[Ri<<sa], CRs

*(Rb + (Ri << sa2)) = CP#(CRd);
# ∈ {0, 1, …, 7}

Rev1+

111011111010

Rp

CP #

1

CRs

10

sa2

Ri

12

4

3

1

4

2

2

4

Description

Stores the source register value to the location specified by the addressing mode.

Status Flags:

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Example:

stc.d
CP2, R2[0], CR0

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

stc0.d Rp[disp], CRs

*(Rp + (ZE(disp12) << 2)) = CP#(CRd+1:CRd);
p ∈ {0, 1, …, 15}
s ∈ {0, 2, …, 14}
s ∈ {0, 1, …, 15}
disp ∈ {0, 4, …, 16380}

Rev1+

111101111010

Rp

disp[11:8]

CRs[3:1]

0

disp[7:0]

12

4

4

3

1

8

2

stc0.w Rp[disp], CRs

*(Rp + (ZE(disp12) << 2)) = CP#(CRd);
p ∈ {0, 1, …, 15}
s ∈ {0, 2, …, 14}
s ∈ {0, 1, …, 15}
disp ∈ {0, 4, …, 16380}

Rev1+

111101011010

Rp

disp[11:8]

CRs

disp[7:0]

12

4

4

4

8

Description

Stores the coprocessor 0 source register value to the location specified by the addressing mode.

Status Flags:

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Example:

stc0.d
R2[0], CR0

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

stcm.d CP#, {--}Rp, ReglistCPD8

Storeaddress  =Rp;
if Opcode[--] == 1 then
      for (i = 0 to 7)
            if ReglistCPD8[i] == 1 then
                  *(--Storeaddress)   =CP#(CR(2*i));
                  *(--Storeaddress)   =CP#(CR(2*i+1));
      Rp   = Storeaddress;
else
      for (i = 7 to 0)
            if ReglistCPD8[i] == 1 then
                  *(Storeaddress++)   =CP#(CR(2*i+1));
                  *(Storeaddress++)   =CP#(CR(2*i));
p ∈ {0, 1, …, 15}
ReglistCPD8 ∈ {CR0-CR1,CR2-CR3,CR4-CR5,CR6-CR7,CR8-CR9,
            CR10-CR11,CR12-CR13,CR14-CR15}

Rev1+

111011011010

Rp

CP#

--

0101

ReglistCPD8[7:1]

CR

15-14

CR

13-12

CR

11-10

CR

9-8

CR

7-6

CR

5-4

CR

3-2

ReglistCPD8[0]

CR

1-0

12

4

3

1

4

7

1

2

stcm.w CP#, {--}Rp, ReglistCPH8

Storeaddress  =Rp;
if Opcode[--] == 1 then
      for (i = 0 to 7)
            if ReglistCPH8[i] == 1 then
                  *(--Storeaddress)   =CP#(CRi+8);
      Rp   = Storeaddress;
else
      for (i = 7 to 0)
            if ReglistCPH8[i] == 1 then
                  *(Storeaddress++)   =CP#(CRi+8);
ReglistCPH8 ∈ {CR8, CR9, CR10, ..., CR15}

Rev1+

111011011010

Rp

CP#

--

0011

ReglistCPH8[7:1]

CR

15

CR

14

CR

13

CR

12

CR

11

CR

10

CR

9

ReglistCPH8[0]

CR

8

12

4

3

1

4

7

1

3

stcm.w CP#, {--}Rp, ReglistCPL8

Storeaddress  =Rp;
if Opcode[--] == 1 then
      for (i = 0 to 7)
            if ReglistCPL8[i] == 1 then
                  *(--Storeaddress)   =CP#(CRi);
      Rp   = Storeaddress;
else
      for (i = 7 to 0)
            if ReglistCPL8[i] == 1 then
                  *(Storeaddress++)   =CP#(CRi);
ReglistCPL8 ∈ {CR0, CR1, CR2, ..., CR7}

Rev1+

111011011010

Rp

CP#

--

0010

ReglistCPL8[7:1]

CR

7

CR

6

CR

5

CR

4

CR

3

CR

2

CR

1

ReglistCPL8[0]

CR

0

12

4

3

1

4

7

1

Description

Writes multiple registers in the addressed coprocessor into the specified memory locations.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Example:

stcm.w CP2, --SP, CR2-CR5

Note:

Emtpy ReglistCPH8/ReglistCPL8/ReglistCPD8 gives UNDEFINED result.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

stcond Rp[disp], Rs

SREG[Z] = SREG[L];
If SREG[L] 
     *(Rp + SE(disp16)) = Rs;
{s , p} ∈ {0, 1, …, 15}
disp ∈ {-32768, -32767, ..., 32767}

Rev1+

111

Rp

10111

Rs

disp16

3

4

5

4

16

Description

The source register is stored to the word memory location referred to by the pointer address if SREG[L] is set. Also, SREG[L] is copied to SREG[Z] to indicate a success or failure of the oper- ation. This instruction is used for atomical memory access.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

SREG[Z] = SREG[L].

C:

Not affected.

Note:

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

stdsp SP[disp], Rs

*( (SP && 0xFFFF_FFFC) + (ZE(disp7) << 2) ) = Rs;
disp ∈ {0, 4, ..., 508}
s ∈ {0, 1, …, 15}

Rev1+

01010

disp7

Rs

5

7

4

Description

Stores the source register value to the memory location referred to specified by the Stack Pointer and the displacement.

Status Flags:

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

sthh.w Rp[disp], Rx:<part>, Ry:<part>

*(Rp + ZE(disp8 << 2)) = {high-part, low-part};
{p, x, y} ∈ {0, 1, …, 15}
disp ∈ {0, 4, ..., 1020}
part ∈ {b,t}

Rev1+

111

Rx

11110

Ry

11

X

Y

disp8

Rp

3

4

5

4

2

1

1

8

4

2

sthh.w Rb[Ri << sa], Rx:<part>, Ry:<part>

*(Rb + (Ri << sa2)) = {high-part, low-part};
{b, i, x, y} ∈ {0, 1, …, 15}
sa  ∈ {0, 1, 2, 3}
part ∈ {b,t}

Rev1+

111

Rx

11110

Ry

10

X

Y

Ri

00

sa2

Rb

3

4

5

4

2

1

1

4

2

2

4

Description

The selected halfwords of the source registers are combined and stored to the word memory location referred to by the pointer address.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

stm {--}Rp, Reglist16

Storeaddress  = Rp;
if Opcode[--] == 1 then
      for (i = 0 to 15)
            if Reglist16[i] == 1 then
                   *(--Storeaddress) =Ri;
      Rp   = Storeaddress;
else
      for (i = 15 to 0)
            if Reglist16[i] == 1 then
                   *(Storeaddress++) =Ri;
Reglist16 ∈ {R0, R1, R2, ..., R12, LR, SP, PC} 
p ∈ {0, 1, …, 15}

Rev1+

111010

--

11100

Rp

Reglist16[15:1]

R15 R14 R13 R12 R11

R10

R9

R8

R7

R6

R5

R4

R3

R2

R1

Reglist16[0]

R0

6

1

5

4

15

1

Description

Stores the registers specified to the consecutive memory locations pointed to by Rp. Both regis- ters in the register file and some of the special-purpose registers can be stored.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Note:

Emtpy Reglist16 gives UNDEFINED result.

If Rp is in Reglist16 and pointer is written back the result is UNDEFINED

The R bit in the status register has no effect on this instruction.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

stmts {--}Rp, Reglist16

Storeaddress  = Rp;
if Opcode[--] == 1 then
      for (i = 0 to 15)
            if Reglist16[i] == 1 then
                   *(--Storeaddress) =RiApp;
      Rp   = Storeaddress;
else
      for (i = 15 to 0)
            if Reglist16[i] == 1 then
                   *(Storeaddress++) =RiApp;
Reglist16 ∈ {R0, R1, R2, ..., R12, LR, SP} 
p ∈ {0, 1, …, 15}

Rev1+

111011

--

11100

Rp

Reglist16[15:1]

R15 R14 R13 R12 R11

R10

R9

R8

R7

R6

R5

R4

R3

R2

R1

Reglist16[0]

R0

6

1

5

4

15

1

Description

Stores the registers specified to the consecutive memory locations pointed to by Rp. The regis- ters specified all reside in the application context.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Note:

Emtpy Reglist16 gives UNDEFINED result. PC in Reglist16 gives UNDEFINED result.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

stswp.h Rp[disp], Rs

temp[15:0] = (Rs[7:0], Rs[15:8]);
*(Rp+SE(disp12) << 1) = temp[15:0];
{s, p} ∈ {0, 1, …, 15}
disp ∈ {-4096, -4094, ..., 4094}

Rev1+

111

Rp

11101

Rs

1001

disp12

3

4

5

4

4

12

2

stswp.wRp[disp], Rs

temp[31:0] = (Rs[7:0], Rs[15:8], Rs[23:16], Rs[31:24]);
*(Rp+SE(disp12) << 2) = temp[31:0];
{s, p} ∈ {0, 1, …, 15}
disp ∈ {-8192, -8188 ..., 8188}

Rev1+

111

Rp

11101

Rs

1010

disp12

3

4

5

4

4

12

Description

This instruction swaps the bytes in a halfword or a word in the register file and stores the result to memory. The instruction can be used for performing stores to memories of different endianness.

Status Flags:

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

sub Rd, Rs

Rd = Rd - Rs;
{d, s, x, y} ∈ {0, 1, …, 15}

Rev1+

000

Rs

00001

Rd

3

4

5

4

2

sub Rd, Rx, Ry << sa

Rd = Rx - (Ry << sa2);
{d, s, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rx

00000

Ry

0000000100

sa2

Rd

3

4

5

4

10

2

4

3

sub Rd, imm

if (Rd == SP)
     Rd = Rd - SE(imm8 << 2);
else
     Rd = Rd - SE(imm8);
{d, s, x, y} ∈ {0, 1, …, 15}

Rev1+

0010

imm8

Rd

4

8

4

4

sub Rd, imm

Rd = Rd - SE(imm21);
{d, s, x, y} ∈ {0, 1, …, 15}

Rev1+

111

imm21[20:17]

0001

imm21[16]

Rd

imm21[15:0]

3

4

4

1

4

16

5

sub Rd, Rs, imm

Rd = Rs - SE(imm16);
{d, s, x, y} ∈ {0, 1, …, 15}

Rev1+

111

Rs

01100

Rd

imm16

3

4

5

4

16

Description

Performs a subtraction and stores the result in destination register.

Status Flags:

Format I: OP1 = Rd, OP2 = Rs

Format II:OP1 = Rx, OP2 = Ry << sa2

Format III: OP1 = Rd, if (Rd==SP) OP2 = SE(imm8<<2) else OP2 = SE(imm8)

Format IV: OP1 = Rd, OP2 = SE(imm21)

Format V: OP1 = Rs, OP2 = SE(imm16)

Q:

Not affected

V:

V = (OP1[31] AND ~OP2[31] AND ~RES[31]) OR (~OP1[31] AND OP2[31] AND RES[31])

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

C = ~OP1[31] AND OP2[31] OR OP2[31] AND RES[31] OR ~OP1[31] AND RES[31]

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

subhh.wRd, Rx:<part>, Ry:<part>

If (Rx-part == t) then operand1 = SE(Rx[31:16]) else operand1 = SE(Rx[15:0]);
If (Ry-part == t) then operand2 = SE(Ry[31:16]) else operand2 = SE(Ry[15:0]);
Rd = operand1 - operand2;
{d, x, y} ∈ {0, 1, …, 15}
part ∈ {t,b}

Rev1+

111

Rx

00000

Ry

0000111100

X

Y

Rd

3

4

5

4

10

1

1

4

Description

Subtracts the two halfword registers specified and stores the result in the destination word-regis- ter. The halfword registers are selected as either the high or low part of the operand registers.

Status Flags:

OP1 = operand1, OP2 = operand2

Q:

Not affected

V:

V = (OP1[31] AND ~OP2[31] AND ~RES[31]) OR (~OP1[31] AND OP2[31] AND RES[31])

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

C = ~OP1[31] AND OP2[31] OR OP2[31] AND RES[31] OR ~OP1[31] AND RES[31]

Example:

subhh.wR10, R2:t, R3:b
will perform R10 = SE(R2[31:16])  - SE(R3[15:0])

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

sub{f}{cond4} Rd, imm

If  (cond4) then
      Rd = Rd - imm8;
      Update flags if opcode[f] field is cleared
cond4 ∈ {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al}
d ∈ {0, 1, …, 15}
imm ∈ {-128, -127, ..., 127}

Rev2+

111101

F

11011

Rd

0000

cond4

imm8

6

1

5

4

4

4

8

2

sub{cond4} Rd, Rx, Ry

If  (cond4) then
      Rd = Rx - Ry;
cond4 ∈ {eq, ne, cc/hs, cs/lo, ge, lt, mi, pl, ls, gt, le, hi, vs, vc, qs, al}
{d, x, y} ∈ {0, 1, …, 15}

Rev2+

111

Rx

11101

Ry

1110

cond4

0001

Rd

3

4

5

4

4

4

4

4

Description

Subtracts a value from a given register and stores the result in destination register if cond4 is true.

Status Flag:

K = SE(imm8)

Flags only affected if format I and (cond4) is true and F parameter is given

Q:

Not affected

V:

V = (Rd[31] AND ~K[31] AND ~RES[31]) OR (~Rd[31] AND K[31] AND RES[31])

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

C = ~Rd[31] AND K[31] OR K[31] AND RES[31] OR RES[31] AND ~Rd[31]

Example:

subfeq R3, 5 performs R3 = R3 - 5 and sets flags accordingly if Z flag set.
subeq R5, 7 performs R5 = R5 - 5 if Z flag set. Flags are not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

swap.b Rd

Temp  = Rd;
Rd[31:24] = Temp[7:0];
Rd[23:16] = Temp[15:8];
Rd[15:8] = Temp[23:16];
Rd[7:0] = Temp[31:24];
d ∈ {0, 1, …, 15}

Rev1+

010111001011

Rd

12

4

Description

Swaps different parts of a register.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

swap.bhRd

Temp  = Rd;
Rd[31:24] = Temp[23:16];
Rd[23:16] = Temp[31:24];
Rd[15:8] = Temp[7:0];
Rd[7:0] = Temp[15:8];
d ∈ {0, 1, …, 15}

Rev1+

010111001100

Rd

12

4

Description

Swaps different parts of a register.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

swap.h Rd

Temp  = Rd;
Rd[31:16] = Temp[15:0];
Rd[15:0] = Temp[31:16];
d ∈ {0, 1, …, 15}

Rev1+

010111001010

Rd

12

4

Description

Swaps different parts of a register.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

sync Op8

Finishes all pending memory operations.
0 <= Op8 <= 255

Rev1+

1110101110110000

00000000

Op8

16

8

8

Description

Finish all pending memory accesses and empties write buffers. The semantic of Op8 is IMPLE- MENTATION DEFINED.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

tlbr

if (TLBEHI[I] == 1)
     {TLBEHI, TLBELO} =ITLB[MMUCR[IRP]];
else
     {TLBEHI, TLBELO} =DTLB[MMUCR[DRP]];
None

Rev1+

1101011001000011

16

Description

Read the contents of the addressed ITLB or DTLB Entry into TLBEHI and TLBELO.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Note:

This instruction can only be executed in a privileged mode.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

tlbs

 MMUCR[N]   =1;
if (TLBEHI[I] == 1)
  TlbToSearch   =ITLB;
else
  TlbToSearch  =DTLB;
endif;
for (i = 0 to TLBToSearchEntries-1)
  if ( Compare(TlbToSearch[i]VPN, VA, TlbToSearch[i]SZ, TlbToSearch[i]V) )
  // VPN and VA matches for the given page size and entry valid
    if ( SharedVMM or 
      (PrivateVMM and ( TlbToSearch[i]G or (TlbToSearch[i]ASID==TLBEHI[ASID]) ) ) )
      ptr = i;
      MMUCR[N]   =0;
    endif;
  endif;
endfor;
if (TLBEHI[I] == 1)
  MMUCR[IRP]   =ptr;
else
  MMUCR[DRP]   =ptr;
endif;
None

Rev1+

1101011001010011

16

Description

Search the addressed TLB for an entry matching TLB Entry High and Low (TLBEHI/TLBELO) registers. Return a pointer to the entry in MMUCR[IRP] or MMUCR[DRP] if a match found, oth- erwise set the Not Found bit in the MMU control register, MMUCR[N].

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Note:

This instruction can only be executed in a privileged mode.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

tlbw

if (TLBEHI[I] == 1)
     ITLB[MMUCR[IRP]]  = {TLBEHI, TLBELO};
else
     ITLB[MMUCR[DRP]]  = {TLBEHI, TLBELO};
None

Rev1+

1101011001100011

16

Description

Write the contents of the TLB Entry High and Low (TLBEHI/TLBELO) registers into the addressed TLB entry.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Note:

This instruction can only be executed in a privileged mode.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

tnbz Rd

 if (Rd[31:24] == 0 OR 
     Rd[23:16] == 0 OR
     Rd[15:8] == 0 OR Rd[7:0] == 0 ) 
   SR[Z] = 1;
else 
   SR[Z] = 0;
d ∈ {0, 1, …, 15}

Rev1+

010111001110

Rd

12

4

Description

If any of the bytes 0,1,2,3 in the word is zero, the SR[Z] flag is set.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Z = (Rd[31:24] == 0 OR Rd[23:16] == 0 OR Rd[15:8] == 0 OR Rd[7:0] == 0 )

C:

Not affected.

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

tst Rd, Rs

Rd AND Rs;
{d,s} ∈ {0, 1, …, 15}

Rev1+

000

Rs

00111

Rd

3

4

5

4

Description

Test register. Used to check if a subset of a register includes one or more set bits. No writeback of the result is performed, but the flags are set.

Status Flags

Q:

Not affected

V:

Not affected

N:

N = RES[31]

Z:

Z = (RES[31:0] == 0)

C:

Not affected

Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

xchg Rd, Rx, Ry

Temp = *(Rx);
*(Rx) = Ry;
Rd = Temp;
{d,x,y} ∈ {0, 1, …, 14}

Rev1+

111

Rx

00000

Ry

000010110100

Rd

3

4

5

4

12

4

Description

Reads a word from memory pointed to by Rx into register Rd, and writes the value of register Ry to memory. This instruction can be used to implement binary semaphores (mutexes). The stcond instruction should be used to implement counting semaphores.

Status Flags:

Q:

Not affected

V:

Not affected

N:

Not affected

Z:

Not affected

C:

Not affected

Note:

If R15 is used as Rd, Rx or Ry, the result is UNDEFINED.

If Rd = Ry, the result is UNDEFINED. If Rd = Rx, the result is UNDEFINED.