begin:addi $t0, $zero, 0 - PowerPoint PPT Presentation

1 / 7
About This Presentation
Title:

begin:addi $t0, $zero, 0

Description:

begin:addi $t0, $zero, 0 – PowerPoint PPT presentation

Number of Views:31
Avg rating:3.0/5.0
Slides: 8
Provided by: tsa64
Category:
Tags: addi | begin | zero | zero1

less

Transcript and Presenter's Notes

Title: begin:addi $t0, $zero, 0


1
????? 1
?????? ????? ?????? ???? ??????? ?? ??? ?????.
????? ?- a0 ???? ???? ??? ????? n.
  • begin addi t0, zero, 0
  • addi t1, zero, 1
  • loop slt t2, a0, t1
  • bne t2, zero, finish
  • add t0, t0, t1
  • addi t1, t1, 2
  • j loop
  • finish add v0, t0, zero

2
????? 2
??????? ???? ???? ?????? ????? ???????? ??????
?????? ?- a0 ?????? ?????? ?- a1 ?????? ?? ????
?????? ??? ?????? ?- v0. ????? ??????? ?????? ??
?? ????? ??? ???? ???? ??? 0. ???? ???? ??????
??????. ???? ????.
  • loop lw v1, 0(a0)
  • addi v0, v0, 1
  • sw v1, 0(a1)
  • addi a0, a0, 1
  • addi a1, a1, 1
  • bne v1, zero, loop

3
????? 3
???? ????? ?? ???? ???? C ???? ?????? ?? ??????
????
while (savei k) i i j counter
i, j ?- k ?????? ????????? s3, s4 ?- s5
??????, ????? ????? ????? ????? ????? ?-
s6 ????? ???? ??????? s0, ????? ???? ?????
???????
t1 2I t1 4I t1 address of
savei t0 savei go to Exit if (savei
! k) i i j counter go to Loop
  • Loop add t1, s3, s3
  • add t1, t1, t1
  • add t1, t1, s6
  • lw t0, 0(t1)
  • bne t0, s5, Exit
  • add s3, s3, s4
  • addi s0,s0,1
  • j Loop
  • Exit

??? ??????? ?????? ??? ??? ?????? ????? (??????
??? ??????). ?? ?????????? ?? ?????? ????? ?????
????. ????? ?? ?????? ???? ?????? ?? ??????
?????? ????? ????? ??? ???????. ??? ?????? ??
???????? ???? ?? ???? ??????? ???????? ???? ????
?? ?? ???? ??????? ???????? ????? ?- k.
4
????? 3 (???? 1)
???? ?? ???? ??????? ???????? ????? ???????
??????? ???? ???? ??????? ???????? ??????
?? ?? ?????? ?????? 810 ???? ?????
?????? (????? ?- k) ?????? ??? ????? ???????
???????? 5 ??"? 85 ??????
??? ?????? ??????
  • add t1, s3, s3
  • add t1, t1, t1
  • add t1, t1, s6
  • lw t0, 0(t1)
  • bne t0, s5, Exit
  • Loop add s3, s3, s4
  • addi s0,s0,1
  • add t1, s3, s3
  • add t1, t1, t1
  • add t1, t1, s6
  • lw t0, 0(t1)
  • beq t0, s5, Loop
  • Exit

t1 2I t1 4I t1 address of
savei t0 savei go to Exit if (savei
! k) i i j counter t1 2I t1
4I t1 address of savei t0 savei
go to Loop if (savei k)
5
????? 3 (???? 2)
???? ?? ???? ??????? ???????? ????? ???????
??????? ???? ????? ?????? ??????? ???????
????? ?????? 5 ???? ???? ??????? ?????
?????? ?? ?? ?????? ?????? 710 ??"? 57
??????
??? ????? ????
  • add t2 ,s4, s4
  • add t2, t2, t2
  • add t1, s3, s3
  • add t1, t1, t1
  • add t1, t1, s6
  • lw t0, 0(t1)
  • bne t0, s5, Exit
  • Loop add t1, t1, t2
  • addi s0,s0,1
  • lw t0, 0(t1)
  • beq t0, s5, Loop
  • Exit

t2 2j t2 4j t1 2I t1 4I
t1 address of savei t0 savei go to
Exit if (savei ! k) t1 address of
savei counter t0 savei go to Loop
if (savei k)
6
????? 3 (???? 3)
???? ?? ???? ??????? ???????? ????? ???????
??????? ???? ????? ?????? ??????? ???????
????? ?????? 7 ???? ???? ??????? ?????
?????? ?? ?? ?????? ?????? 410 ??"? 47
??????
7
????? 4
  • a0 array0 a1 n

add a1, a1, a1 add a1, a1, a1 add
v0, zero, zero add t0, zero, zero outer
add t4, a0, t0 lw t4, 0(t4) add
t5, zero, zero add t1, zero, zero
inner add t3, a0, t1 lw t3, 0(t3)
bne t3, t4, skip addi t5, t5, 1 skip
addi t1, t1, 4 bne t1, a1, inner slt
t2, t5, v0 bne t2, zero, next add
v0, t5, zero add v1, t4, zero next
addi t0, t0, 4 bne t0, a1, outer
Write a Comment
User Comments (0)
About PowerShow.com