Sunteți pe pagina 1din 9

ArhitecturaSistemelordeCalculLaborator4

1. Instruciunidetestareacondiieiimutricondiionate

Instruciunile de testare a condiiei i mutri condiionate sunt prezentate n


tabelulurmtor:
Instruciune Operaiaefectuat Format Exemplu
sltrd,rs,rt SetOnLessThan R slt$1,$9,$10

rd(rs<rt)
Dacrs<rt,atuncird=1(true),altfelrd=0
(false).

Valorilesuntconsideratecusemni
comparaianuntoarceoverflow.
slturd,rs,rt SetOnLessThanUnsigned R sltu$1,$9,$10

rd(rs<rt)
Dacrs<rt,atuncird=1(true),altfelrd=0
(false).

Valorilesuntconsideratefrsemni
comparaianuntoarceoverflow.
sltird,rs,imm SetOnLessThanImmediate R slti$1,$9,10

rd(rs<imm)
Dacrs<imm,atuncird=1(true),altfelrd=
0(false).

Valorilesuntconsideratecusemni
comparaianuntoarceoverflow.
sltiurd,rs,imm SetOnLessThanImmediateUnsigned R sltiu$1,$9,10

rd(rs<imm)
Dacrs<imm,atuncird=1(true),altfelrd=
0(false).

Valorilesuntconsideratefrsemni
comparaianuntoarceoverflow.
movnrd,rs,rt MoveConditionalonNotZero R movn$t1,$t2,$t3

Dacrt0,atuncirdrs
movzrd,rs,rt MoveConditionalonZero R movz$t1,$t2,$t3

Dacrt=0,atuncirdrs

1
Pseudiostruciunilederamificaresuntprezentatentabelulurmtor:
Pseudoinstruciune Operaiaefectuat Exemplu
seqrd,rs,rt SetonEqual seq$t1,$t2,$t3

rd(rs=rt)
Dacrs=rt,atuncird=1(true),altfelrd=
0(false).
snerd,rs,rt SetNotEqual sne$t1,$t2,$t3

rd(rsrt)
Dacrsrt,atuncird=1(true),altfelrd=
0(false).
slerd,rs,rt SetonLessThenorEqual sle$t1,$t2,$t3

rd(rsrt)
Dacrsrt,atuncird=1(true),altfelrd=
0(false).

Valorilesuntconsideratecusemn.
sgtrd,rs,rt SetonGreaterThen sgt$t1,$t2,$t3

rd(rs>rt)
Dacrs>rt,atuncird=1(true),altfelrd=
0(false).

Valorilesuntconsideratecusemn.
sgerd,rs,rt SetonGreaterThenorEqual sge$t1,$t2,$t3

rd(rsrt)
Dacrsrt,atuncird=1(true),altfelrd=
0(false).

Valorilesuntconsideratecusemn.
sleurd,rs,rt SetonLessThenorEqualUnsigned sleu$t1,$t2,$t3

rd(rsrt)
Dacrsrt,atuncird=1(true),altfelrd=
0(false).

Valorilesuntconsideratefarsemn.
sgturd,rs,rt SetonGreaterThenUnsigned sgtu$t1,$t2,$t3

rd(rs>rt)
Dacrs>rt,atuncird=1(true),altfelrd=
0(false).
Valorilesuntconsideratefrsemn.

2
sgeurd,rs,rt SetonGreaterThenorEqualUnsigned sgeu$t1,$t2,$t3

rd(rsrt)
Dacrsrt,atuncird=1(true),altfelrd=
0(false).

Valorilesuntconsideratefrsemn.

2. Instruciuniipseudoinstruciunideramificare

Instruciunilederamificaresuntprezentatentabelulurmtor:

Instruciune Operaiaefectuat Format Exemplu


beqrs,rt,eticheta BranchonEqual I beq$t1,$t2,et

Dacrs=rt,atuncisaltlaetichet;
bners,rt,eticheta BranchNotEqual I bne$t1,$t2,et

Dac rs rt, atunci salt la etichet;


bgtzrs,eticheta BranchonGreaterThenZero I bgtz$t1,et

Dacrs>0,atuncisaltlaetichet
bltzrs,eticheta BranchonLessThanZero I bltz$t1,et

Dacrs<0,atuncisaltlaetichet.
bgezrs,eticheta BranchonGreaterThanorEqualtoZero I bgez$t1,et

Dacrs0,atuncisaltlaetichet.
blezrs,eticheta BranchonLessThenorEqualtoZero I blez$t1,et

Dacrs0,atuncisaltlaetichet.
bltzalrs,eticehta BranchonLessThanZeroandLink I bltzalrs,eticheta

Dacrs<0, atunci saltla etichet ca


apel_procedur: n registrul $ra ($31)
pstreazadresadentoarcere,adicadresa
urmtoareiinstruciuni
bgezalrs,eticheta BranchonGreaterThanorEqualtoZeroand I bgezal$t0,et
Link

Dacrs0, atuncisaltla etichet ca


apel_procedur: n registrul $ra ($31)
pstreazadresadentoarcere,adicadresa
urmtoareiinstruciuni

3
_Formatulexactalfiecreiinstruciunilgsiila:
http://www.cs.cornell.edu/courses/cs3410/2008fa/MIPS_Vol2.pdf

Pseudiostruciunilederamificaresuntprezentatentabelulurmtor:

Pseudoinstruciune Operaiaefectuat Exemplu


betichet Branch bet

Saltlaetichet(saltnecondiionat)
beqzrs,eticheta BranchonEqualtoZero beqz$t1,et

Dacrs=0,atuncisalt
bnezrs,etichet BranchNotEqualtoZero bnez$t1,et

Dacrs0,atuncisalt.
bltrs,rt,eticheta BranchonLessThan blt$t1,$t2,et

Dacrs<rt,atuncisaltlaetichet
(numerelesuntconsideratecusemn)
blers,rt,eticheta BranchonLessThenorEqual ble$t1,$t2,et

Dacrsrt,atuncisaltlaetichet
(numerelesuntconsideratecusemn)
bgtrs,rt,eticheta BranchonGreaterThen bgt$t1,$t2,et

Dacrs>rt,atuncisaltlaetichet
(numerelesuntconsideratecusemn)
bgers,rt,eticheta BranchonGreaterThenorEqual bge$t1,$t2,et

Dacrsrt,atuncisaltlaetichet
(numerelesuntconsideratecusemn)
blturs,rt,eticheta BranchonLessThanUnsigned bltu$t1,$t2,et

Dacrs<rt,atuncisaltlaetichet
(numerelesuntconsideratefrsemn)
bleurs,rt,etichet BranchonLessThenorEqualUnsigned bleu$t1,$t2,et

Dacrsrt,atuncisaltlaetichet
(numerelesuntconsideratefarsemn)
bgturs,rt,eticheta BranchonGreaterThenUnsigned bgtu$t1,$t2,et

Dacrs>rt,atuncisaltlaetichet
(numerelesuntconsideratefarsemn)

4
bgeurs,rt,eticheta BranchonGreaterThenorEqual bgeu$t1,$t2,et
Unsigned

Dacrsrt,atuncisaltlaetichet
(numerelesuntconsideratefarsemn)

3. Instruciuniipseudoinstruciunidesalt

Instruciuniledesaltsuntprezentatentabelulurmtor:

Instruciune Operaiaefectuat Format Exemplu


jeticheta Jump J jet

Saltnecondiionatlaetichet.

NuestePCrelativ,adicnformatul
instruciuniinusepstreaz deplasamentul
fade
instruciunea
curent(can
cazul
instruciunilorbranch),ciadresadatde
etichet.
jaleticheta JumpandLink J jalet

Saltlaetichetcaapel_procedur:nregistrul
$ra($31)pstreazadresadentoarcere,adic
adresaurmtoareiinstruciuni.

NuestePCrelativ,adicnformatul
instruciuniinusepstreaz deplasamentul
fadeinstruciuneacurent(cancazul
instruciunilorbranch),ciadresadatde
etichet.
jalr<rd,>rs JumpandLinkRegister R jalr$t1,$t2

Saltlaetichetcupstrareaadresei
urmtoareiinstruciuninregistrul$rd.Dac
lipseteregistrulrd,atunciacestaeste
consideratimplicitregistrulra.

NuestePCrelativ,adicnformatul
instruciuniinusepstreaz deplasamentul
fadeinstruciuneacurent(cancazul
instruciunilorbranch),ciadresadatde
etichet.
jrrs JumpRegister R jr$t1

Saltlaadresastocatnregistrulrs
Celemaifrecventutilizatentreruperisistemsegsescntabeluldemaijos:

Codulapeluluisistem
Serviciul
(introdusn$v0)

printinteger 1

printfloat 2

printdouble 3

printstring 4

readinteger 5
readfloat 6
readdouble 7

readstring 8

memo
ry

9alloca
tion
exit
(end
of
10
progra
m)
Argumente Rezultate

$a0=valoareintegercarese
afieaz
$f12=valoarefloatcarese
afieaz
$f12=valoaredoublecarese
afieaz
$a0=adresastringuluicarese
afieaz
$v0=valoareaintegercitita
$f0=valoareafloatcitita
$f0=valoareadoublecitita
$a0=adresalacareseva
memora stringul
$a1=numruldecaractere
careurmeazsfiecitite+1
$a0=numrulde octeide $v0=adresabloculuide
memoriealocai memorie