21.08.2013 Views

AVR Instruction Set Nomenclature: Status Register (SREG ...

AVR Instruction Set Nomenclature: Status Register (SREG ...

AVR Instruction Set Nomenclature: Status Register (SREG ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

SWAP - Swap Nibbles<br />

Description:<br />

Swaps high and low nibbles in a register.<br />

Operation:<br />

(i) R(7:4) ← Rd(3:0), R(3:0) ← Rd(7:4)<br />

Syntax: Operands: Program Counter:<br />

(i) SWAP Rd 0 ≤ d ≤ 31 PC ← PC + 1<br />

130<br />

16-bit Opcode:<br />

<strong>Status</strong> <strong>Register</strong> and Boolean Formula:<br />

R (Result) equals Rd after the operation.<br />

Example:<br />

1001 010d dddd 0010<br />

I T H S V N Z C<br />

- - - - - - - -<br />

Words: 1 (2 bytes)<br />

Cycles: 1<br />

inc r1 ; Increment r1<br />

swap r1 ; Swap high and low nibble of r1<br />

inc r1 ; Increment high nibble of r1<br />

swap r1 ; Swap back<br />

<strong>Instruction</strong> <strong>Set</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!