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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CPSE - Compare Skip if Equal<br />

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

Description:<br />

This instruction performs a compare between two registers Rd and Rr, and skips the next instruction if Rd = Rr.<br />

Operation:<br />

(i) If Rd = Rr then PC ← PC + 2 (or 3) else PC ← PC + 1<br />

Syntax: Operands: Program Counter:<br />

(i) CPSE Rd,Rr 0 ≤ d ≤ 31, 0 ≤ r ≤ 31 PC ← PC + 1, Condition false - no skip<br />

PC ← PC + 2, Skip a one word instruction<br />

PC ← PC + 3, Skip a two word instruction<br />

16-bit Opcode:<br />

<strong>Status</strong> <strong>Register</strong> (<strong>SREG</strong>) and Boolean Formula:<br />

Example:<br />

0001 00rd dddd rrrr<br />

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

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

inc r4 ; Increase r4<br />

cpse r4,r0 ; Compare r4 to r0<br />

neg r4 ; Only executed if r4r0<br />

nop ; Continue (do nothing)<br />

Words: 1 (2 bytes)<br />

Cycles: 1 if condition is false (no skip)<br />

2 if condition is true (skip is executed) and the instruction skipped is 1 word<br />

3 if condition is true (skip is executed) and the instruction skipped is 2 words<br />

55

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

Saved successfully!

Ooh no, something went wrong!