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.

BRMI - Branch if Minus<br />

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

Description:<br />

Conditional relative branch. Tests the Negative flag (N) and branches relatively to PC if N is set. This instruction branches<br />

relatively to PC in either direction (PC - 63 ≤ destination ≤ PC + 64). The parameter k is the offset from PC and is represented<br />

in two’s complement form. (Equivalent to instruction BRBS 2,k).<br />

Operation:<br />

(i) If N = 1 then PC ← PC + k + 1, else PC ← PC + 1<br />

Syntax: Operands: Program Counter:<br />

(i) BRMI k -64 ≤ k ≤ +63 PC ← PC + k + 1<br />

PC ← PC + 1, if condition is false<br />

16-bit Opcode:<br />

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

Example:<br />

1111 00kk kkkk k010<br />

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

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

subi r18,4 ; Subtract 4 from r18<br />

brmi<br />

...<br />

negative ; Branch if result negative<br />

negative: nop ; Branch destination (do nothing)<br />

Words: 1 (2 bytes)<br />

Cycles: 1 if condition is false<br />

2 if condition is true<br />

29

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

Saved successfully!

Ooh no, something went wrong!