Sunteți pe pagina 1din 7

Nr

Comenzile aritmetice i logice


Comanda Operanzii
Descrierea
ADD
Rd, Rr
Add without carry
Add eith carry
Add immediate to
work
Substract without
carry
Substract immediate
Substract with carry
Substract immediate
with carry
Substract immediate
from word
Logical And
Logical And with
Immediate
Logical Or
Logical Or with
Immediate
Exclusive OR
Ones complement
Twos complement

Traducerea
Adunarea aritmetic fr
transport
Adunare cu transport
Adunarea constantei la
un cuvnt
Scaderea fr transport

Operaia
Rd->Rd+Rr

Flags
Z,C,N,V,H

Rd>Rd+Rr+C
Rdh:Rdl
Rdh:Rdl+K
RdRd-Rr

Z,C,N,V,H
Z,C,N,V

Diferen cu o constant
Scdere cu transport
Diferen cu constant i
transport
Diferena constantei de
la cuvnt
SI logic
SI Logic cu o constant

RdRd-k
RdRd-Rr-C
RdRd-K-C

Z,C,N,V,H
Z,C,N,V,H
Z,C,N,V,H

Rdh:Rdl Rdh:RdlK
RdRd*Rr
RdRd*k

Z,C,N,V

SAU logic
SAU logic cu constant

RdRdRr
RdRdk

Z,N,V
Z,N,V

RdRdRr
Rd$FF-Rd
Rd$00-Rd

Z,N,V
Z,C,N,V
Z,C,N,V,H

RdRdk

Z,N,V

RdRd*($FF-k)

Z,N,V

RdRd+1
RdRd-1
RdRd*Rr
RdRdRr
Rd$FF

Z,N,V
Z,N,V
Z,N,V
Z,N,V
None

2
3

ADC
ADIW

Rd, Rr
Rd, k

SUB

Rd, Rr

5
6
7

SUBI
SBC
SBCI

Rd, k
Rd, Rr
Rd, k

SBIW

Rd, k

9
10

AND
ANDI

Rd, Rr
Rd, k

11
12

OR
ORI

Rd, Rr
Rd, k

13
14
15

EOR
COM
NEG

Rd, Rr
Rd
Rd

16

SBR

17

CBR

18
19
20
21
22

INC
DEC
TST
CLR
SER

Nr

Descrierea

Coma Operanzi
nda
LSL
Rd

Logical Shift Left Shiftare logic la


stinga

Z,C,N,V,H

LSR

Logical Shift
Righ

Z,C,N,V

ROL

SAU exclusiv
Complement fa de 1
Negarea complementului
binar
Rd, k
Set Bits in Register
Setarea bitului K n
registru
Rd, k
Clear Bits in Register tergerea bitului K n
registru
Rd
Increment
Incrementarea
Rd
Decrement
Decrementarea
Rd
Test for zero or minus Testarea la 0 sau la -
Rd
Clear Register
Curirea registrului
Rd
Set all bits in register Setarea biilor n registru
3. Comenzi pe biti

Rd

Rotate left
trough carry

Traducerea

Operaia

Rd(n+1)Rd(n),
Rd(0) 0CRd(7)
Shiftare Logic la
Rd(n)Rd(n+1),
dreapta
Rd(7) 0,
CRd(0)
Rotare la stinga peste Rd(0)C,
bitul de transport
Rd(n+1) Rd,
CRd(7)

Z,C,N,V,H

Z,N,V
Z,N,V

Flags

Z,C,N,V,H

ROR

Rd

Rotate right
trough carry

ASR

Rd

6
7
8
9

SWAP
BSET
BCLR
SBI

Rd
S
S
P, b

Arithmetic Shift
Right
Swap Nibbles
Flag Set
Flag Cleared
Set bit to I/O

10

CBI

P,b

11

BST

Rd, b

12

BLD

Rd, b

13

SEC

14

CLC

15

SEN

16

CLN

17

Clear bit in I/O


Register
Bit Store from
Register to T

Rotare la dreapta
peste bitul de
transport

CRd(7)
Rd(n+1) Rd,
C Rd(0)
Shiftare logic la
Rd(n) Rd(n+1)
dreapta
n=0..6
Inversarea jumtilor Rd(0..3) Rd(4..7)
Setarea flagului
SREG(s) 1
tergerea flagului
SREG(s) 0
Setarea bitului n
I/O (P,b) 1
registrul I/O
tergerea bitului din I/O (P,b) 0
registru I/O
Stocarea bitului din
registru n flagul T
T Rd(b)

Z,C,N,V

Z,C,N,V
None
SREG(s)
SREG(s)
None
None
T

Rd(b) T

None

C1

C0

N1

N0

SEZ

ncrcarea flagului T
in bitul registrului
Setarea transportul
flagului
Clear carry flag Stergerea transportul
flagului
Set negative flag Setarea flagului
negativ
Cleared
tergerea flagului
Negative flag
negativ
Set zero flag
Setarea flagului 0

Z1

18

CLZ

Clear zero flag

Z0

19

SEI

I1

20

CLI

I0

21

SES

Set global
Interrupt flag
Clear global
interrupt flag
Set Signed Flag

Bit load from T


to Register
Set carry Flag

tergerea flagului 0

22

CLS

23

SEV

24

CLV

25

SET

Setarea flagului
intreruperii globale
tergerea flagului
intreruperii globale
Setarea flagului de
semn
Clear Signed
tergerea flagului de
Flag
semn
Set overflow flag Setarea flagului
fluxului de date
Clear overflow
Stergerea flagului
fluxului de date
Set T flag
Setarea flagului T

26

CLT

Clear T flag

Stergerea flagului T

T0

27

SEH

Set half carry


flag

Setarea flagului a
jumtii bitului de

H1

S
S1
S0

V1

V0

T1

28

Nr
1
2
3
4
4
5
6
7
8
9
10
11
12
13
14
15
16
17

CLH

Clear half carry


flag

Comenzile de transfer
Comanda Operanzi Descrierea
ELPM
Extend Load
Program
Memory
MOV
Rd, Rr
Copy Register
LDI
Rd, K
Load Immediate
LDS
Rd, X
Load direct
from RAM
LD
Rd, x
Load direct
LD
Rd, x+
Load indirect
and post
increment
LD
Rd, -x
Load Indirect
and pre
decrement
LD
Rd, Y
Load Indirect
LD
Rd, Y+
Load Indirect
and post
increment
LD
Rd, -Y
Load Indirect
and pre
decrement
LDD
Rd, Y+q Load indirect
with
displacement
LD
Rd, Z
Load indirect
LD
Rd, Z+
Load indirect
and post
increment
LD
Rd, -Z
Load indirect
and pre
decrement
LDD
Rd, Z+q Load indirect
with
deplacement
STS
k, Rr
Store Direct to
RAM
ST
X, Rr
Store Indiret
ST
X+, Rr
Store Indirect
and post

transport
tergerea flagului a
jumii bitului de
transport

H0

Traducerea
Extinderea ncrcrii memoriei de
program

Operaia
Ro=(Z+ELPM)

Flags
None

Copierea registrului
Incrcarea constantei
ncarc din RAM

RdRr
RdK
Rd(k)

None
None
None

ncrcare direct
ncarcare indirect apoi post
incrementare

Rd(x)
Rd(x)
x x+1

None
None

ncrcare indirect apoi pre


decrementare

Rd(x)
x x-1

None

ncrcare indirect
ncrcare indirect apoi post
incrementare

Rd(Y)
Rd(Y)
Y Y+1

None
None

ncrcare indirect apoi pre


decrementare

Rd(Y)
YY-1

None

ncarcare indirect cu deplasament Rd(Y+q)

None

ncarc indirect
ncarc indirect apoi post
incrementare

Rd(Z)
Rd(Z)
ZZ+1

None
None

ncarc indirect apoi pre


decrementare

Rd(Z)
ZZ-1

None

Incarc indirect cu deplasament

Rd(Z+q)

None

Stocheaz direct in RAM

(k) Rr

None

Stocheaz indirect
Stoceaz indirect apoi post
incrementare

(X) Rr
Rr(X)

None
None

18

ST

X-, Rr

19

STD

X+q, Rr

20
21

ST
ST

Y, Rr
Y+, Rr

22

ST

Y-, Rr

23

ST

Rd, Y+q

24
25

ST
ST

Rd, Z
Rd, Z+

26

ST

Z-, Rr

27

ST

Rd, Z+q

28

LPM

29

IN

Rd, P

30

OUT

P, Pr

31

PUSH

Rr

32

POP

Rd

increment
Store Indirect
and pre
decrement
Store indirect
with
deplacement
Store indirect
Store indirect
and post
increment
Store indirect
and pre
decrement
Store indirect
with
displacement
Store Indiret
Store indirect
and post
increment
Store indirect
and pre
decrement
Store indirect
with
deplacement
Load program
memory
Load on I/O
Port to Register
Store Register
to I/O port
Push Register
on Stack
Pop Register
from Stack

Stocheaz indirect apoi pre


decrementeaz

X X+1
Rr(X)
XX-1

None

Stoceaz indirect cu deplasament

Rr(X+q)

None

Stocheaz indirect
Stochez indirect si post
incrementeaz

(Y) Rr
Rd(Y)
Y Y+1

None
None

Stocheaz indirect i pre


decrementeaz

Rd(Y)
YY-1

None

Stocheaz indirect cu deplasament Rd(Y+q)

None

Stocheaz indirect
Stocheaz indirect apoi pre
decrementare

Rd(Z)
Rd(Z)
ZZ+1

None
None

Stocheaz indirect apoi pre


decrementeaz

Rd(Z)
ZZ-1

None

Stoceaz indirect cu deplasament

Rr(Z+q)

None

ncrcarea memoriei de program

R0(Z)

None

ncarc datele din portul I/O n


registru
Stocheaz datele din registru n
Portul I/O
Pune registrul n stiv

RdP

None

PRd

None

STACKRd

None

Scoate registrul din stiv

RdSTACK

None

Comenzile de transfer a controlului executiei


Nr Comanda Operanzii Descrierea
Traducerea

Operaia

Flags

23 CP
24 CPC

Rd, Rk
Rd, Rk

Compare
Compare with carry

Rd-Rk
Rd-Rk-C

Z,C,N,V,H
Z,C,N,V,H

25 CPI

Rd, k

Rd-K

Z,C,N,V,H

26 RJMP

Compare with
Immediate
Relative Jump

Comparare
Compar cu bitul de
transport
Compar cu o constant
Salt relativ la k

PCPC+
K+1

None

27 IJMP
28 JUMP
29 RCALL

K
K
K

Indirect Jump
Jump
Relative Call

Salt indirect la k
Salt necondiionat
Salt relativ la subrutin

30
31
32
33
34

K
K
K
K
Rd, Rk

Indirect Call
Call
Return from subrutine
Return from Intrerrupt
Compare skip if equal

Salt indirect la subrutin


Apelare rutin
Returnare din subrutin
Returnare din ntrerupere
Compar skip daca e egal

35 SBRC

Rr, b

Skip if Bit in Register


is Clear

Sare dac bitul din registru


este 0

36 SBRS

Rr, b

Skip if Bit in Register


is Set

Sare dac bitul din registru


este setat

37 SBIC

P,b

Skip if Bit I/O is clear

Sare dac bitul din registrul


I/O este ters

38 SBIS

P, b

Skip if Bit I/O is set

Sare dac bitul din registrul


I/O este setat

39 BRBS

s, k

Branch If Bit in SREG Sare dac bitul din registrul


is Set
SREG este setat

40 BRBC

s, k

Branch If Bit in SREG Sare dac bitul din registrul


in Cleared
SREG este ters

41 BREQ

Branch if Equal

Salt la egalitate

42 BRNE

Branch if Not Equal

Salt dac nu este egalitate

ICALL
CALL
RET
RETI
CPSE

PCZ
PC K
PCPC+
K+1
PCZ
PC K
PCstack
PCstack
If Rd=Rk
then
PCPC+2
(or 3)
If Rr (b)=0
then
PCPC
+ 2 (or 3)
If Rr (b)=1
then
PCPC
+ 2 (or 3)
If I/O
(P,b)=0
then
PCPC
+ 2 (or 3)
If I/O
(P,b)=1
then
PCPC
+ 2 (or 3)
If SREG=1
then
PCPC+k
+1
If SREG=0
then
PCPC+k
+1
If
Rd=Rr(z=1
) then
PCPC+k
+1
If
RdRr(z=0
) then
PCPC+k

None
None
None
None
None
None
I
None

None

None

None

None

None

None

None

None

44 BRCS

Branch if carry set

Sare dac transportul este


setat

45 BRCC

Branch if carry cleard

Sare dac transportul este


ters

46 BRSH

Branch if Same or
Higher

Sare dac este egal sau mai


mare

47 BRLO

Branch if Lower

Sare dac este mai mic

48 BRMI

Branch if Minus

Sare dac este minus

49 BRPL

Branch if Plus

Sare dac este +

50 BRGE

Branch if Greater or
Equal

Sare dac este mai mare sau


egal cu bitul transportului

51 BRLT

Branch if Less then


(Signed)

Sare dac este mai mic dect


, (cu semn)

52 BRHS

Branch if Half Carry


flag is set

Sare dac jumtate din


constanta flagului este setat

53 BRHC

Branch is Half Carry


flag is cleared

Sare dac jumtate dn


constanta flagului este tears

54 BRTS

Branch if T flag is set

Sare dac flagul T este setat

55 BRTC

Branch if T flag is
cleared

Sare dac flagul T este ters

55 BRVS

Branch if Overflow is
set

Sare dac fluxul de date este


setat

+1
If C=1 then
PCPC+k
+1
If C=0 then
PCPC+k
+1
If
RdRr(C=
0) then
PCPC+k
+1
If
Rd<Rr(C=
1) then
PCPC+k
+1
If N=1 then
PCPC+k
+1
If N=0 then
PCPC+k
+1
F RdRr
(NV=0)t
hen
PCPC+k
+1
F Rd<Rr
(N1=0)th
en
PCPC+k
+1
If H=1 then
PCPC+k
+1
If H=0 then
PCPC+k
+1
If T=1 then
PCPC+k
+1
If T=0 then
PCPC+k
+1
If V=1 then
PCPC+k

None

None

None

None

None

None

None

None

None

None

None

None

None

56 BRVC

Brach if Overflow is
cleared

57 BRIE

Branch if Intrerrupt is
set

58 BRIC

Branch if Intrerrupt is
cleared

+1
Sare dac fluxul de date este If V=0 then None
ters
PCPC+k
+1
Sare dac ntreruperea este If I=1 then None
setat
PCPC+k
+1
Sare dac ntreruperea este If V=0 then None
tears
PCPC+k
+1

4. Comenzi de control al sistemului


29 NOP

No operation

Nici o operaie

30 SLEEP

Sleep

Regimul adormire

31 WDR

Wathdog Reset

Setare regimului wathdog

S-ar putea să vă placă și