Operations:

Syntax:

Operation:

Operands:

Program Counter:

Opcode

Comment

Stack

SBIW Rd,K

R[d+1]:Rd = R[d+1]:Rd - K

d ∈ {24,26,28,30}, 0 <= K <= 63

PC = PC + 1

10010111KKddKKKK

Description

Subtracts an immediate value (0-63) from a register pair and places the result in the register pair. This instruction operates on the upper four register pairs and is well suited for operations on the Pointer Registers.

This instruction is not available on all devices. Refer to Appendix A.

Status Register (SREG) and Boolean Formula

I

T

H

S

N XOR V, for signed tests.

V

~R15 AND Rdh7

Set if two's complement overflow resulted from the operation; cleared otherwise.

N

R15

Set if MSB of the result is set; cleared otherwise.

Z

~R15 AND ~R14 AND ~R13 AND ~R12 AND ~R11 AND ~R10 AND ~R9 AND ~R8 ANDR7 AND ~R6 AND ~R5 AND ~R4 AND ~R3 AND ~R2 AND ~R1 AND ~R0

Set if the result is 0x0000; cleared otherwise.

C

R15 AND ~Rdh7

Set if the absolute value of K is larger than the absolute value of Rd; cleared otherwise.

R (Result)

R (Result) equals R[d+1]:Rd after the operation.

Example:

      sbiw  r24,1   ; Subtract 1 from r25:r24
      sbiw  YL,63   ; Subtract 63 from the Y-pointer(r29:r28)

Words

1 (2 bytes)

Table Cycles

Name

Cycles

AVRe

2

AVRxm

2

AVRxt

2

AVRrc

N/A