NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

Organizasyon project :
-m1 ve m2 matris.
-m2 nin transpozunu al.
ve m1 le multiple et.
4 adım =



main ( ){
a = matrix_transpose(m2);
b = matrix_multiply(m1,a);
print(b);}


matrix_multiply(r1,c1,A,r2,c2,B,C){
inner_product(r,num_columns1,M,c,num_rows,num_columns2,N);};


add $t0, $s1, $s2
sub $t0, $s1, $s2
register file ($t0, $s1, $s2)
lw $t0, 4($s3) #load word from memory
sw $t0, 8($s3) #store word to memory
add $t1, $s3, $s3 #array index i is in $s3
add $t1, $t1, $t1 #temp reg $t1 holds 4*i
add $t1, $t1, $s4 #addr of A[i] now in $t1
sub $s2, $t1, $s1
addi $s3, $s3, 4 #$s3 = $s3 + 4
bne $s0, $s1, Lbl #go to Lbl if $s0≠$s1
beq $s0, $s1, Lbl #go to Lbl if $s0=$s1
j Lbl #go to Lbl
slt $t0, $s0, $s1 # if $s0 < $s1
slti $t0, $s0, 10 # if $s0 < 10
slt $at, $s1, $s2 #$at set to 1 if
bne $at, $zero, Lbl # $s1 < $s2
less than or equal to ble $s1, $s2, Lbl
greater than bgt $s1, $s2, Lbl
great than or equal to bge $s1, $s2, Lbl
jr $t1 #go to address in $t1
lb $t0, 1($s3) #load byte from memory
sb $t0, 6($s3) #store byte to memory
lh $t0, 1($s3) #load half word from memory
sh $t0, 6($s3) #store half word to memory
Shifts move all the bits in a word left or right
sll $t2, $s0, 8 #$t2 = $s0 << 8 bits
srl $t2, $s0, 8 #$t2 = $s0 >> 8 bit
sra $t2, $s0, 8 #$t2 = $s0 >> 8 bits arithmetic shift
and $t0, $t1, $t2 #$t0 = $t1 & $t2
or $t0, $t1, $t2 #$t0 = $t1 | $t2
nor $t0, $t1, $t2 #$t0 = not($t1 | $t2
andi $t0, $t1, 0xff00 #$t0 = $t1 & ff00
ori $t0, $t1, 0xff00 #$t0 = $t1 | ff00
lui $t0, 0xaaaa
jal gcd #jump to routine gcd
-----------------------------------------------------------
array kullanımı ve loop.
while (save[i] == k)
i + = 1;
Loop: sll $t1, $s3, 2 # t1 = s3 << 2 bits
add $t1, $t1, $s6 # t1 = t1 + s6
lw $t0, 0($t) # load word from memory # t0 =memory(0+t0)
bne $t0, $s5, Exit # not equal t0 != s5 jump Exit
addi $s3, $s3, 1 # else s3 = s3 + 1;
j Loop # jump Loop
Exit: . . .
--------------------------------------------------------------
int leaf_ex (int g, int h, int i, int j){
int f;
f = (g+h) – (i+j);
return f;
}
leaf_ex: addi $sp,$sp,-8 #make stack room (sp = sp - 8) (sp = stack pointer )
sw $t1,4($sp) #save $t1 on stack (memory(sp + 4) = t1)
sw $t0,0($sp) #save $t0 on stack (memory(sp +0) = t0)
add $t0,$a0,$a1 # t0 = a0 + a1;
add $t1,$a2,$a3 # t1 = a2 + a3; (a = arguments)
sub $v0,$t0,$t1 # v0 = t0 - t1; (t = temporaries v = function results)
lw $t0,0($sp) #restore $t0 ( t0 = memory(sp + 0))
lw $t1,4($sp) #restore $t1 (t1 = memory(sp + 4))
addi $sp,$sp,8 #adjust stack ptr (sp = sp + 8)
jr $ra # jump register return address
-----------------------------------------------------------------------------------------------------
int rt_1 (int i) {
if (i == 0) return 0;
else return rt_2(i-1);
}
caller: jal rt_1 #jump and link rt_1
next: . . .
rt_1: bne $a0, $zero, to_2 #branch not equal a0 != 0 => jump to_2
add $v0, $zero, $zero #else v0 = 0 + 0;
jr $ra # jump register return address
to_2: addi $a0, $a0, -1 # a0 = a0 - 1; arguments
jal rt_2 # jump and link rt_2
jr $ra # jump register return address
rt_2: . . .
-----------------------------------------------------------------------------------------
Nested procedures (i passed in $a0, return value in $v0)
rt_1: bne $a0, $zero,
add $v0, $zero, $zero
jr $ra
to_2: addi $sp, $sp, -8
sw $ra, 4($sp)
sw $a0, 0($sp)
addi $a0, $a0, -1
jal rt_2
bk_2: lw $a0, 0($sp)
lw $ra, 4($sp)
addi $sp, $sp, 8
jr $ra
----------------------------------------------------------------
compiling recursive procedure
fact: addi $sp, $sp, -8 #adjust stack pointer
sw $ra, 4($sp) #save return address
sw $a0, 0($sp) #save argument n
slti $t0, $a0, 1 #test for n < 1
beq $t0, $zero, L1 #if n >=1, go to L1
addi $v0, $zero, 1 #else return 1 in $v0
addi $sp, $sp, 8 #adjust stack pointer
jr $ra #return to caller (1st)
L1: addi $a0, $a0, -1 #n >=1, so decrement n
jal fact #call fact with (n-1)
#this is where fact returns
bk_f: lw $a0, 0($sp) #restore argument n
lw $ra, 4($sp) #restore return address
addi $sp, $sp, 8 #adjust stack pointer
mul $v0, $a0, $v0 #$v0 = n * fact(n-1)
jr $ra #return to caller (2nd)
-----------------------------------------------------------------Organizasyon project :
-m1 ve m2 matris.
-m2 nin transpozunu al.
ve m1 le multiple et.
4 adım =



main ( ){
a = matrix_transpose(m2);
b = matrix_multiply(m1,a);
print(b);}


matrix_multiply(r1,c1,A,r2,c2,B,C){
inner_product(r,num_columns1,M,c,num_rows,num_columns2,N);};


add $t0, $s1, $s2
sub $t0, $s1, $s2
register file ($t0, $s1, $s2)
lw $t0, 4($s3) #load word from memory
sw $t0, 8($s3) #store word to memory
add $t1, $s3, $s3 #array index i is in $s3
add $t1, $t1, $t1 #temp reg $t1 holds 4*i
add $t1, $t1, $s4 #addr of A[i] now in $t1
sub $s2, $t1, $s1
addi $s3, $s3, 4 #$s3 = $s3 + 4
bne $s0, $s1, Lbl #go to Lbl if $s0≠$s1
beq $s0, $s1, Lbl #go to Lbl if $s0=$s1
j Lbl #go to Lbl
slt $t0, $s0, $s1 # if $s0 < $s1
slti $t0, $s0, 10 # if $s0 < 10
slt $at, $s1, $s2 #$at set to 1 if
bne $at, $zero, Lbl # $s1 < $s2
less than or equal to ble $s1, $s2, Lbl
greater than bgt $s1, $s2, Lbl
great than or equal to bge $s1, $s2, Lbl
jr $t1 #go to address in $t1
lb $t0, 1($s3) #load byte from memory
sb $t0, 6($s3) #store byte to memory
lh $t0, 1($s3) #load half word from memory
sh $t0, 6($s3) #store half word to memory
Shifts move all the bits in a word left or right
sll $t2, $s0, 8 #$t2 = $s0 << 8 bits
srl $t2, $s0, 8 #$t2 = $s0 >> 8 bit
sra $t2, $s0, 8 #$t2 = $s0 >> 8 bits arithmetic shift
and $t0, $t1, $t2 #$t0 = $t1 & $t2
or $t0, $t1, $t2 #$t0 = $t1 | $t2
nor $t0, $t1, $t2 #$t0 = not($t1 | $t2
andi $t0, $t1, 0xff00 #$t0 = $t1 & ff00
ori $t0, $t1, 0xff00 #$t0 = $t1 | ff00
lui $t0, 0xaaaa
jal gcd #jump to routine gcd
-----------------------------------------------------------
array kullanımı ve loop.
while (save[i] == k)
i + = 1;
Loop: sll $t1, $s3, 2 # t1 = s3 << 2 bits
add $t1, $t1, $s6 # t1 = t1 + s6
lw $t0, 0($t) # load word from memory # t0 =memory(0+t0)
bne $t0, $s5, Exit # not equal t0 != s5 jump Exit
addi $s3, $s3, 1 # else s3 = s3 + 1;
j Loop # jump Loop
Exit: . . .
--------------------------------------------------------------
int leaf_ex (int g, int h, int i, int j){
int f;
f = (g+h) – (i+j);
return f;
}
leaf_ex: addi $sp,$sp,-8 #make stack room (sp = sp - 8) (sp = stack pointer )
sw $t1,4($sp) #save $t1 on stack (memory(sp + 4) = t1)
sw $t0,0($sp) #save $t0 on stack (memory(sp +0) = t0)
add $t0,$a0,$a1 # t0 = a0 + a1;
add $t1,$a2,$a3 # t1 = a2 + a3; (a = arguments)
sub $v0,$t0,$t1 # v0 = t0 - t1; (t = temporaries v = function results)
lw $t0,0($sp) #restore $t0 ( t0 = memory(sp + 0))
lw $t1,4($sp) #restore $t1 (t1 = memory(sp + 4))
addi $sp,$sp,8 #adjust stack ptr (sp = sp + 8)
jr $ra # jump register return address
-----------------------------------------------------------------------------------------------------
int rt_1 (int i) {
if (i == 0) return 0;
else return rt_2(i-1);
}
caller: jal rt_1 #jump and link rt_1
next: . . .
rt_1: bne $a0, $zero, to_2 #branch not equal a0 != 0 => jump to_2
add $v0, $zero, $zero #else v0 = 0 + 0;
jr $ra # jump register return address
to_2: addi $a0, $a0, -1 # a0 = a0 - 1; arguments
jal rt_2 # jump and link rt_2
jr $ra # jump register return address
rt_2: . . .
-----------------------------------------------------------------------------------------
Nested procedures (i passed in $a0, return value in $v0)
rt_1: bne $a0, $zero,
add $v0, $zero, $zero
jr $ra
to_2: addi $sp, $sp, -8
sw $ra, 4($sp)
sw $a0, 0($sp)
addi $a0, $a0, -1
jal rt_2
bk_2: lw $a0, 0($sp)
lw $ra, 4($sp)
addi $sp, $sp, 8
jr $ra
----------------------------------------------------------------
compiling recursive procedure
fact: addi $sp, $sp, -8 #adjust stack pointer
sw $ra, 4($sp) #save return address
sw $a0, 0($sp) #save argument n
slti $t0, $a0, 1 #test for n < 1
beq $t0, $zero, L1 #if n >=1, go to L1
addi $v0, $zero, 1 #else return 1 in $v0
addi $sp, $sp, 8 #adjust stack pointer
jr $ra #return to caller (1st)
L1: addi $a0, $a0, -1 #n >=1, so decrement n
jal fact #call fact with (n-1)
#this is where fact returns
bk_f: lw $a0, 0($sp) #restore argument n
lw $ra, 4($sp) #restore return address
addi $sp, $sp, 8 #adjust stack pointer
mul $v0, $a0, $v0 #$v0 = n * fact(n-1)
jr $ra #return to caller (2nd)
---------------------------------------------------------------------


Organizasyon project :
-m1 ve m2 matris.
-m2 nin transpozunu al.
ve m1 le multiple et.
4 adım =



main ( ){
a = matrix_transpose(m2);
b = matrix_multiply(m1,a);
print(b);}


matrix_multiply(r1,c1,A,r2,c2,B,C){
inner_product(r,num_columns1,M,c,num_rows,num_columns2,N);};


add $t0, $s1, $s2
sub $t0, $s1, $s2
register file ($t0, $s1, $s2)
lw $t0, 4($s3) #load word from memory
sw $t0, 8($s3) #store word to memory
add $t1, $s3, $s3 #array index i is in $s3
add $t1, $t1, $t1 #temp reg $t1 holds 4*i
add $t1, $t1, $s4 #addr of A[i] now in $t1
sub $s2, $t1, $s1
addi $s3, $s3, 4 #$s3 = $s3 + 4
bne $s0, $s1, Lbl #go to Lbl if $s0≠$s1
beq $s0, $s1, Lbl #go to Lbl if $s0=$s1
j Lbl #go to Lbl
slt $t0, $s0, $s1 # if $s0 < $s1
slti $t0, $s0, 10 # if $s0 < 10
slt $at, $s1, $s2 #$at set to 1 if
bne $at, $zero, Lbl # $s1 < $s2
less than or equal to ble $s1, $s2, Lbl
greater than bgt $s1, $s2, Lbl
great than or equal to bge $s1, $s2, Lbl
jr $t1 #go to address in $t1
lb $t0, 1($s3) #load byte from memory
sb $t0, 6($s3) #store byte to memory
lh $t0, 1($s3) #load half word from memory
sh $t0, 6($s3) #store half word to memory
Shifts move all the bits in a word left or right
sll $t2, $s0, 8 #$t2 = $s0 << 8 bits
srl $t2, $s0, 8 #$t2 = $s0 >> 8 bit
sra $t2, $s0, 8 #$t2 = $s0 >> 8 bits arithmetic shift
and $t0, $t1, $t2 #$t0 = $t1 & $t2
or $t0, $t1, $t2 #$t0 = $t1 | $t2
nor $t0, $t1, $t2 #$t0 = not($t1 | $t2
andi $t0, $t1, 0xff00 #$t0 = $t1 & ff00
ori $t0, $t1, 0xff00 #$t0 = $t1 | ff00
lui $t0, 0xaaaa
jal gcd #jump to routine gcd
-----------------------------------------------------------
array kullanımı ve loop.
while (save[i] == k)
i + = 1;
Loop: sll $t1, $s3, 2 # t1 = s3 << 2 bits
add $t1, $t1, $s6 # t1 = t1 + s6
lw $t0, 0($t) # load word from memory # t0 =memory(0+t0)
bne $t0, $s5, Exit # not equal t0 != s5 jump Exit
addi $s3, $s3, 1 # else s3 = s3 + 1;
j Loop # jump Loop
Exit: . . .
--------------------------------------------------------------
int leaf_ex (int g, int h, int i, int j){
int f;
f = (g+h) – (i+j);
return f;
}
leaf_ex: addi $sp,$sp,-8 #make stack room (sp = sp - 8) (sp = stack pointer )
sw $t1,4($sp) #save $t1 on stack (memory(sp + 4) = t1)
sw $t0,0($sp) #save $t0 on stack (memory(sp +0) = t0)
add $t0,$a0,$a1 # t0 = a0 + a1;
add $t1,$a2,$a3 # t1 = a2 + a3; (a = arguments)
sub $v0,$t0,$t1 # v0 = t0 - t1; (t = temporaries v = function results)
lw $t0,0($sp) #restore $t0 ( t0 = memory(sp + 0))
lw $t1,4($sp) #restore $t1 (t1 = memory(sp + 4))
addi $sp,$sp,8 #adjust stack ptr (sp = sp + 8)
jr $ra # jump register return address
-----------------------------------------------------------------------------------------------------
int rt_1 (int i) {
if (i == 0) return 0;
else return rt_2(i-1);
}
caller: jal rt_1 #jump and link rt_1
next: . . .
rt_1: bne $a0, $zero, to_2 #branch not equal a0 != 0 => jump to_2
add $v0, $zero, $zero #else v0 = 0 + 0;
jr $ra # jump register return address
to_2: addi $a0, $a0, -1 # a0 = a0 - 1; arguments
jal rt_2 # jump and link rt_2
jr $ra # jump register return address
rt_2: . . .
-----------------------------------------------------------------------------------------
Nested procedures (i passed in $a0, return value in $v0)
rt_1: bne $a0, $zero,
add $v0, $zero, $zero
jr $ra
to_2: addi $sp, $sp, -8
sw $ra, 4($sp)
sw $a0, 0($sp)
addi $a0, $a0, -1
jal rt_2
bk_2: lw $a0, 0($sp)
lw $ra, 4($sp)
addi $sp, $sp, 8
jr $ra
----------------------------------------------------------------
compiling recursive procedure
fact: addi $sp, $sp, -8 #adjust stack pointer
sw $ra, 4($sp) #save return address
sw $a0, 0($sp) #save argument n
slti $t0, $a0, 1 #test for n < 1
beq $t0, $zero, L1 #if n >=1, go to L1
addi $v0, $zero, 1 #else return 1 in $v0
addi $sp, $sp, 8 #adjust stack pointer
jr $ra #return to caller (1st)
L1: addi $a0, $a0, -1 #n >=1, so decrement n
jal fact #call fact with (n-1)
#this is where fact returns
bk_f: lw $a0, 0($sp) #restore argument n
lw $ra, 4($sp) #restore return address
addi $sp, $sp, 8 #adjust stack pointer
mul $v0, $a0, $v0 #$v0 = n * fact(n-1)
jr $ra #return to caller (2nd)
---------------------------------------------------------------------


Organizasyon project :
-m1 ve m2 matris.
-m2 nin transpozunu al.
ve m1 le multiple et.
4 adım =



main ( ){
a = matrix_transpose(m2);
b = matrix_multiply(m1,a);
print(b);}


matrix_multiply(r1,c1,A,r2,c2,B,C){
inner_product(r,num_columns1,M,c,num_rows,num_columns2,N);};


add $t0, $s1, $s2
sub $t0, $s1, $s2
register file ($t0, $s1, $s2)
lw $t0, 4($s3) #load word from memory
sw $t0, 8($s3) #store word to memory
add $t1, $s3, $s3 #array index i is in $s3
add $t1, $t1, $t1 #temp reg $t1 holds 4*i
add $t1, $t1, $s4 #addr of A[i] now in $t1
sub $s2, $t1, $s1
addi $s3, $s3, 4 #$s3 = $s3 + 4
bne $s0, $s1, Lbl #go to Lbl if $s0≠$s1
beq $s0, $s1, Lbl #go to Lbl if $s0=$s1
j Lbl #go to Lbl
slt $t0, $s0, $s1 # if $s0 < $s1
slti $t0, $s0, 10 # if $s0 < 10
slt $at, $s1, $s2 #$at set to 1 if
bne $at, $zero, Lbl # $s1 < $s2
less than or equal to ble $s1, $s2, Lbl
greater than bgt $s1, $s2, Lbl
great than or equal to bge $s1, $s2, Lbl
jr $t1 #go to address in $t1
lb $t0, 1($s3) #load byte from memory
sb $t0, 6($s3) #store byte to memory
lh $t0, 1($s3) #load half word from memory
sh $t0, 6($s3) #store half word to memory
Shifts move all the bits in a word left or right
sll $t2, $s0, 8 #$t2 = $s0 << 8 bits
srl $t2, $s0, 8 #$t2 = $s0 >> 8 bit
sra $t2, $s0, 8 #$t2 = $s0 >> 8 bits arithmetic shift
and $t0, $t1, $t2 #$t0 = $t1 & $t2
or $t0, $t1, $t2 #$t0 = $t1 | $t2
nor $t0, $t1, $t2 #$t0 = not($t1 | $t2
andi $t0, $t1, 0xff00 #$t0 = $t1 & ff00
ori $t0, $t1, 0xff00 #$t0 = $t1 | ff00
lui $t0, 0xaaaa
jal gcd #jump to routine gcd
-----------------------------------------------------------
array kullanımı ve loop.
while (save[i] == k)
i + = 1;
Loop: sll $t1, $s3, 2 # t1 = s3 << 2 bits
add $t1, $t1, $s6 # t1 = t1 + s6
lw $t0, 0($t) # load word from memory # t0 =memory(0+t0)
bne $t0, $s5, Exit # not equal t0 != s5 jump Exit
addi $s3, $s3, 1 # else s3 = s3 + 1;
j Loop # jump Loop
Exit: . . .
--------------------------------------------------------------
int leaf_ex (int g, int h, int i, int j){
int f;
f = (g+h) – (i+j);
return f;
}
leaf_ex: addi $sp,$sp,-8 #make stack room (sp = sp - 8) (sp = stack pointer )
sw $t1,4($sp) #save $t1 on stack (memory(sp + 4) = t1)
sw $t0,0($sp) #save $t0 on stack (memory(sp +0) = t0)
add $t0,$a0,$a1 # t0 = a0 + a1;
add $t1,$a2,$a3 # t1 = a2 + a3; (a = arguments)
sub $v0,$t0,$t1 # v0 = t0 - t1; (t = temporaries v = function results)
lw $t0,0($sp) #restore $t0 ( t0 = memory(sp + 0))
lw $t1,4($sp) #restore $t1 (t1 = memory(sp + 4))
addi $sp,$sp,8 #adjust stack ptr (sp = sp + 8)
jr $ra # jump register return address
-----------------------------------------------------------------------------------------------------
int rt_1 (int i) {
if (i == 0) return 0;
else return rt_2(i-1);
}
caller: jal rt_1 #jump and link rt_1
next: . . .
rt_1: bne $a0, $zero, to_2 #branch not equal a0 != 0 => jump to_2
add $v0, $zero, $zero #else v0 = 0 + 0;
jr $ra # jump register return address
to_2: addi $a0, $a0, -1 # a0 = a0 - 1; arguments
jal rt_2 # jump and link rt_2
jr $ra # jump register return address
rt_2: . . .
-----------------------------------------------------------------------------------------
Nested procedures (i passed in $a0, return value in $v0)
rt_1: bne $a0, $zero,
add $v0, $zero, $zero
jr $ra
to_2: addi $sp, $sp, -8
sw $ra, 4($sp)
sw $a0, 0($sp)
addi $a0, $a0, -1
jal rt_2
bk_2: lw $a0, 0($sp)
lw $ra, 4($sp)
addi $sp, $sp, 8
jr $ra
----------------------------------------------------------------
compiling recursive procedure
fact: addi $sp, $sp, -8 #adjust stack pointer
sw $ra, 4($sp) #save return address
sw $a0, 0($sp) #save argument n
slti $t0, $a0, 1 #test for n < 1
beq $t0, $zero, L1 #if n >=1, go to L1
addi $v0, $zero, 1 #else return 1 in $v0
addi $sp, $sp, 8 #adjust stack pointer
jr $ra #return to caller (1st)
L1: addi $a0, $a0, -1 #n >=1, so decrement n
jal fact #call fact with (n-1)
#this is where fact returns
bk_f: lw $a0, 0($sp) #restore argument n
lw $ra, 4($sp) #restore return address
addi $sp, $sp, 8 #adjust stack pointer
mul $v0, $a0, $v0 #$v0 = n * fact(n-1)
jr $ra #return to caller (2nd)
---------------------------------------------------------------------


Organizasyon project :
-m1 ve m2 matris.
-m2 nin transpozunu al.
ve m1 le multiple et.
4 adım =



main ( ){
a = matrix_transpose(m2);
b = matrix_multiply(m1,a);
print(b);}


matrix_multiply(r1,c1,A,r2,c2,B,C){
inner_product(r,num_columns1,M,c,num_rows,num_columns2,N);};


add $t0, $s1, $s2
sub $t0, $s1, $s2
register file ($t0, $s1, $s2)
lw $t0, 4($s3) #load word from memory
sw $t0, 8($s3) #store word to memory
add $t1, $s3, $s3 #array index i is in $s3
add $t1, $t1, $t1 #temp reg $t1 holds 4*i
add $t1, $t1, $s4 #addr of A[i] now in $t1
sub $s2, $t1, $s1
addi $s3, $s3, 4 #$s3 = $s3 + 4
bne $s0, $s1, Lbl #go to Lbl if $s0≠$s1
beq $s0, $s1, Lbl #go to Lbl if $s0=$s1
j Lbl #go to Lbl
slt $t0, $s0, $s1 # if $s0 < $s1
slti $t0, $s0, 10 # if $s0 < 10
slt $at, $s1, $s2 #$at set to 1 if
bne $at, $zero, Lbl # $s1 < $s2
less than or equal to ble $s1, $s2, Lbl
greater than bgt $s1, $s2, Lbl
great than or equal to bge $s1, $s2, Lbl
jr $t1 #go to address in $t1
lb $t0, 1($s3) #load byte from memory
sb $t0, 6($s3) #store byte to memory
lh $t0, 1($s3) #load half word from memory
sh $t0, 6($s3) #store half word to memory
Shifts move all the bits in a word left or right
sll $t2, $s0, 8 #$t2 = $s0 << 8 bits
srl $t2, $s0, 8 #$t2 = $s0 >> 8 bit
sra $t2, $s0, 8 #$t2 = $s0 >> 8 bits arithmetic shift
and $t0, $t1, $t2 #$t0 = $t1 & $t2
or $t0, $t1, $t2 #$t0 = $t1 | $t2
nor $t0, $t1, $t2 #$t0 = not($t1 | $t2
andi $t0, $t1, 0xff00 #$t0 = $t1 & ff00
ori $t0, $t1, 0xff00 #$t0 = $t1 | ff00
lui $t0, 0xaaaa
jal gcd #jump to routine gcd
-----------------------------------------------------------
array kullanımı ve loop.
while (save[i] == k)
i + = 1;
Loop: sll $t1, $s3, 2 # t1 = s3 << 2 bits
add $t1, $t1, $s6 # t1 = t1 + s6
lw $t0, 0($t) # load word from memory # t0 =memory(0+t0)
bne $t0, $s5, Exit # not equal t0 != s5 jump Exit
addi $s3, $s3, 1 # else s3 = s3 + 1;
j Loop # jump Loop
Exit: . . .
--------------------------------------------------------------
int leaf_ex (int g, int h, int i, int j){
int f;
f = (g+h) – (i+j);
return f;
}
leaf_ex: addi $sp,$sp,-8 #make stack room (sp = sp - 8) (sp = stack pointer )
sw $t1,4($sp) #save $t1 on stack (memory(sp + 4) = t1)
sw $t0,0($sp) #save $t0 on stack (memory(sp +0) = t0)
add $t0,$a0,$a1 # t0 = a0 + a1;
add $t1,$a2,$a3 # t1 = a2 + a3; (a = arguments)
sub $v0,$t0,$t1 # v0 = t0 - t1; (t = temporaries v = function results)
lw $t0,0($sp) #restore $t0 ( t0 = memory(sp + 0))
lw $t1,4($sp) #restore $t1 (t1 = memory(sp + 4))
addi $sp,$sp,8 #adjust stack ptr (sp = sp + 8)
jr $ra # jump register return address
-----------------------------------------------------------------------------------------------------
int rt_1 (int i) {
if (i == 0) return 0;
else return rt_2(i-1);
}
caller: jal rt_1 #jump and link rt_1
next: . . .
rt_1: bne $a0, $zero, to_2 #branch not equal a0 != 0 => jump to_2
add $v0, $zero, $zero #else v0 = 0 + 0;
jr $ra # jump register return address
to_2: addi $a0, $a0, -1 # a0 = a0 - 1; arguments
jal rt_2 # jump and link rt_2
jr $ra # jump register return address
rt_2: . . .
-----------------------------------------------------------------------------------------
Nested procedures (i passed in $a0, return value in $v0)
rt_1: bne $a0, $zero,
add $v0, $zero, $zero
jr $ra
to_2: addi $sp, $sp, -8
sw $ra, 4($sp)
sw $a0, 0($sp)
addi $a0, $a0, -1
jal rt_2
bk_2: lw $a0, 0($sp)
lw $ra, 4($sp)
addi $sp, $sp, 8
jr $ra
----------------------------------------------------------------
compiling recursive procedure
fact: addi $sp, $sp, -8 #adjust stack pointer
sw $ra, 4($sp) #save return address
sw $a0, 0($sp) #save argument n
slti $t0, $a0, 1 #test for n < 1
beq $t0, $zero, L1 #if n >=1, go to L1
addi $v0, $zero, 1 #else return 1 in $v0
addi $sp, $sp, 8 #adjust stack pointer
jr $ra #return to caller (1st)
L1: addi $a0, $a0, -1 #n >=1, so decrement n
jal fact #call fact with (n-1)
#this is where fact returns
bk_f: lw $a0, 0($sp) #restore argument n
lw $ra, 4($sp) #restore return address
addi $sp, $sp, 8 #adjust stack pointer
mul $v0, $a0, $v0 #$v0 = n * fact(n-1)
jr $ra #return to caller (2nd)
---------------------------------------------------------------------


Organizasyon project :
-m1 ve m2 matris.
-m2 nin transpozunu al.
ve m1 le multiple et.
4 adım =



main ( ){
a = matrix_transpose(m2);
b = matrix_multiply(m1,a);
print(b);}


matrix_multiply(r1,c1,A,r2,c2,B,C){
inner_product(r,num_columns1,M,c,num_rows,num_columns2,N);};


add $t0, $s1, $s2
sub $t0, $s1, $s2
register file ($t0, $s1, $s2)
lw $t0, 4($s3) #load word from memory
sw $t0, 8($s3) #store word to memory
add $t1, $s3, $s3 #array index i is in $s3
add $t1, $t1, $t1 #temp reg $t1 holds 4*i
add $t1, $t1, $s4 #addr of A[i] now in $t1
sub $s2, $t1, $s1
addi $s3, $s3, 4 #$s3 = $s3 + 4
bne $s0, $s1, Lbl #go to Lbl if $s0≠$s1
beq $s0, $s1, Lbl #go to Lbl if $s0=$s1
j Lbl #go to Lbl
slt $t0, $s0, $s1 # if $s0 < $s1
slti $t0, $s0, 10 # if $s0 < 10
slt $at, $s1, $s2 #$at set to 1 if
bne $at, $zero, Lbl # $s1 < $s2
less than or equal to ble $s1, $s2, Lbl
greater than bgt $s1, $s2, Lbl
great than or equal to bge $s1, $s2, Lbl
jr $t1 #go to address in $t1
lb $t0, 1($s3) #load byte from memory
sb $t0, 6($s3) #store byte to memory
lh $t0, 1($s3) #load half word from memory
sh $t0, 6($s3) #store half word to memory
Shifts move all the bits in a word left or right
sll $t2, $s0, 8 #$t2 = $s0 << 8 bits
srl $t2, $s0, 8 #$t2 = $s0 >> 8 bit
sra $t2, $s0, 8 #$t2 = $s0 >> 8 bits arithmetic shift
and $t0, $t1, $t2 #$t0 = $t1 & $t2
or $t0, $t1, $t2 #$t0 = $t1 | $t2
nor $t0, $t1, $t2 #$t0 = not($t1 | $t2
andi $t0, $t1, 0xff00 #$t0 = $t1 & ff00
ori $t0, $t1, 0xff00 #$t0 = $t1 | ff00
lui $t0, 0xaaaa
jal gcd #jump to routine gcd
-----------------------------------------------------------
array kullanımı ve loop.
while (save[i] == k)
i + = 1;
Loop: sll $t1, $s3, 2 # t1 = s3 << 2 bits
add $t1, $t1, $s6 # t1 = t1 + s6
lw $t0, 0($t) # load word from memory # t0 =memory(0+t0)
bne $t0, $s5, Exit # not equal t0 != s5 jump Exit
addi $s3, $s3, 1 # else s3 = s3 + 1;
j Loop # jump Loop
Exit: . . .
--------------------------------------------------------------
int leaf_ex (int g, int h, int i, int j){
int f;
f = (g+h) – (i+j);
return f;
}
leaf_ex: addi $sp,$sp,-8 #make stack room (sp = sp - 8) (sp = stack pointer )
sw $t1,4($sp) #save $t1 on stack (memory(sp + 4) = t1)
sw $t0,0($sp) #save $t0 on stack (memory(sp +0) = t0)
add $t0,$a0,$a1 # t0 = a0 + a1;
add $t1,$a2,$a3 # t1 = a2 + a3; (a = arguments)
sub $v0,$t0,$t1 # v0 = t0 - t1; (t = temporaries v = function results)
lw $t0,0($sp) #restore $t0 ( t0 = memory(sp + 0))
lw $t1,4($sp) #restore $t1 (t1 = memory(sp + 4))
addi $sp,$sp,8 #adjust stack ptr (sp = sp + 8)
jr $ra # jump register return address
-----------------------------------------------------------------------------------------------------
int rt_1 (int i) {
if (i == 0) return 0;
else return rt_2(i-1);
}
caller: jal rt_1 #jump and link rt_1
next: . . .
rt_1: bne $a0, $zero, to_2 #branch not equal a0 != 0 => jump to_2
add $v0, $zero, $zero #else v0 = 0 + 0;
jr $ra # jump register return address
to_2: addi $a0, $a0, -1 # a0 = a0 - 1; arguments
jal rt_2 # jump and link rt_2
jr $ra # jump register return address
rt_2: . . .
-----------------------------------------------------------------------------------------
Nested procedures (i passed in $a0, return value in $v0)
rt_1: bne $a0, $zero,
add $v0, $zero, $zero
jr $ra
to_2: addi $sp, $sp, -8
sw $ra, 4($sp)
sw $a0, 0($sp)
addi $a0, $a0, -1
jal rt_2
bk_2: lw $a0, 0($sp)
lw $ra, 4($sp)
addi $sp, $sp, 8
jr $ra
----------------------------------------------------------------
compiling recursive procedure
fact: addi $sp, $sp, -8 #adjust stack pointer
sw $ra, 4($sp) #save return address
sw $a0, 0($sp) #save argument n
slti $t0, $a0, 1 #test for n < 1
beq $t0, $zero, L1 #if n >=1, go to L1
addi $v0, $zero, 1 #else return 1 in $v0
addi $sp, $sp, 8 #adjust stack pointer
jr $ra #return to caller (1st)
L1: addi $a0, $a0, -1 #n >=1, so decrement n
jal fact #call fact with (n-1)
#this is where fact returns
bk_f: lw $a0, 0($sp) #restore argument n
lw $ra, 4($sp) #restore return address
addi $sp, $sp, 8 #adjust stack pointer
mul $v0, $a0, $v0 #$v0 = n * fact(n-1)
jr $ra #return to caller (2nd)
---------------------------------------------------------------------


Organizasyon project :
-m1 ve m2 matris.
-m2 nin transpozunu al.
ve m1 le multiple et.
4 adım =



main ( ){
a = matrix_transpose(m2);
b = matrix_multiply(m1,a);
print(b);}


matrix_multiply(r1,c1,A,r2,c2,B,C){
inner_product(r,num_columns1,M,c,num_rows,num_columns2,N);};


add $t0, $s1, $s2
sub $t0, $s1, $s2
register file ($t0, $s1, $s2)
lw $t0, 4($s3) #load word from memory
sw $t0, 8($s3) #store word to memory
add $t1, $s3, $s3 #array index i is in $s3
add $t1, $t1, $t1 #temp reg $t1 holds 4*i
add $t1, $t1, $s4 #addr of A[i] now in $t1
sub $s2, $t1, $s1
addi $s3, $s3, 4 #$s3 = $s3 + 4
bne $s0, $s1, Lbl #go to Lbl if $s0≠$s1
beq $s0, $s1, Lbl #go to Lbl if $s0=$s1
j Lbl #go to Lbl
slt $t0, $s0, $s1 # if $s0 < $s1
slti $t0, $s0, 10 # if $s0 < 10
slt $at, $s1, $s2 #$at set to 1 if
bne $at, $zero, Lbl # $s1 < $s2
less than or equal to ble $s1, $s2, Lbl
greater than bgt $s1, $s2, Lbl
great than or equal to bge $s1, $s2, Lbl
jr $t1 #go to address in $t1
lb $t0, 1($s3) #load byte from memory
sb $t0, 6($s3) #store byte to memory
lh $t0, 1($s3) #load half word from memory
sh $t0, 6($s3) #store half word to memory
Shifts move all the bits in a word left or right
sll $t2, $s0, 8 #$t2 = $s0 << 8 bits
srl $t2, $s0, 8 #$t2 = $s0 >> 8 bit
sra $t2, $s0, 8 #$t2 = $s0 >> 8 bits arithmetic shift
and $t0, $t1, $t2 #$t0 = $t1 & $t2
or $t0, $t1, $t2 #$t0 = $t1 | $t2
nor $t0, $t1, $t2 #$t0 = not($t1 | $t2
andi $t0, $t1, 0xff00 #$t0 = $t1 & ff00
ori $t0, $t1, 0xff00 #$t0 = $t1 | ff00
lui $t0, 0xaaaa
jal gcd #jump to routine gcd
-----------------------------------------------------------
array kullanımı ve loop.
while (save[i] == k)
i + = 1;
Loop: sll $t1, $s3, 2 # t1 = s3 << 2 bits
add $t1, $t1, $s6 # t1 = t1 + s6
lw $t0, 0($t) # load word from memory # t0 =memory(0+t0)
bne $t0, $s5, Exit # not equal t0 != s5 jump Exit
addi $s3, $s3, 1 # else s3 = s3 + 1;
j Loop # jump Loop
Exit: . . .
--------------------------------------------------------------
int leaf_ex (int g, int h, int i, int j){
int f;
f = (g+h) – (i+j);
return f;
}
leaf_ex: addi $sp,$sp,-8 #make stack room (sp = sp - 8) (sp = stack pointer )
sw $t1,4($sp) #save $t1 on stack (memory(sp + 4) = t1)
sw $t0,0($sp) #save $t0 on stack (memory(sp +0) = t0)
add $t0,$a0,$a1 # t0 = a0 + a1;
add $t1,$a2,$a3 # t1 = a2 + a3; (a = arguments)
sub $v0,$t0,$t1 # v0 = t0 - t1; (t = temporaries v = function results)
lw $t0,0($sp) #restore $t0 ( t0 = memory(sp + 0))
lw $t1,4($sp) #restore $t1 (t1 = memory(sp + 4))
addi $sp,$sp,8 #adjust stack ptr (sp = sp + 8)
jr $ra # jump register return address
-----------------------------------------------------------------------------------------------------
int rt_1 (int i) {
if (i == 0) return 0;
else return rt_2(i-1);
}
caller: jal rt_1 #jump and link rt_1
next: . . .
rt_1: bne $a0, $zero, to_2 #branch not equal a0 != 0 => jump to_2
add $v0, $zero, $zero #else v0 = 0 + 0;
jr $ra # jump register return address
to_2: addi $a0, $a0, -1 # a0 = a0 - 1; arguments
jal rt_2 # jump and link rt_2
jr $ra # jump register return address
rt_2: . . .
-----------------------------------------------------------------------------------------
Nested procedures (i passed in $a0, return value in $v0)
rt_1: bne $a0, $zero,
add $v0, $zero, $zero
jr $ra
to_2: addi $sp, $sp, -8
sw $ra, 4($sp)
sw $a0, 0($sp)
addi $a0, $a0, -1
jal rt_2
bk_2: lw $a0, 0($sp)
lw $ra, 4($sp)
addi $sp, $sp, 8
jr $ra
----------------------------------------------------------------
compiling recursive procedure
fact: addi $sp, $sp, -8 #adjust stack pointer
sw $ra, 4($sp) #save return address
sw $a0, 0($sp) #save argument n
slti $t0, $a0, 1 #test for n < 1
beq $t0, $zero, L1 #if n >=1, go to L1
addi $v0, $zero, 1 #else return 1 in $v0
addi $sp, $sp, 8 #adjust stack pointer
jr $ra #return to caller (1st)
L1: addi $a0, $a0, -1 #n >=1, so decrement n
jal fact #call fact with (n-1)
#this is where fact returns
bk_f: lw $a0, 0($sp) #restore argument n
lw $ra, 4($sp) #restore return address
addi $sp, $sp, 8 #adjust stack pointer
mul $v0, $a0, $v0 #$v0 = n * fact(n-1)
jr $ra #return to caller (2nd)
---------------------------------------------------------------------


Organizasyon project :
-m1 ve m2 matris.
-m2 nin transpozunu al.
ve m1 le multiple et.
4 adım =



main ( ){
a = matrix_transpose(m2);
b = matrix_multiply(m1,a);
print(b);}


matrix_multiply(r1,c1,A,r2,c2,B,C){
inner_product(r,num_columns1,M,c,num_rows,num_columns2,N);};


add $t0, $s1, $s2
sub $t0, $s1, $s2
register file ($t0, $s1, $s2)
lw $t0, 4($s3) #load word from memory
sw $t0, 8($s3) #store word to memory
add $t1, $s3, $s3 #array index i is in $s3
add $t1, $t1, $t1 #temp reg $t1 holds 4*i
add $t1, $t1, $s4 #addr of A[i] now in $t1
sub $s2, $t1, $s1
addi $s3, $s3, 4 #$s3 = $s3 + 4
bne $s0, $s1, Lbl #go to Lbl if $s0≠$s1
beq $s0, $s1, Lbl #go to Lbl if $s0=$s1
j Lbl #go to Lbl
slt $t0, $s0, $s1 # if $s0 < $s1
slti $t0, $s0, 10 # if $s0 < 10
slt $at, $s1, $s2 #$at set to 1 if
bne $at, $zero, Lbl # $s1 < $s2
less than or equal to ble $s1, $s2, Lbl
greater than bgt $s1, $s2, Lbl
great than or equal to bge $s1, $s2, Lbl
jr $t1 #go to address in $t1
lb $t0, 1($s3) #load byte from memory
sb $t0, 6($s3) #store byte to memory
lh $t0, 1($s3) #load half word from memory
sh $t0, 6($s3) #store half word to memory
Shifts move all the bits in a word left or right
sll $t2, $s0, 8 #$t2 = $s0 << 8 bits
srl $t2, $s0, 8 #$t2 = $s0 >> 8 bit
sra $t2, $s0, 8 #$t2 = $s0 >> 8 bits arithmetic shift
and $t0, $t1, $t2 #$t0 = $t1 & $t2
or $t0, $t1, $t2 #$t0 = $t1 | $t2
nor $t0, $t1, $t2 #$t0 = not($t1 | $t2
andi $t0, $t1, 0xff00 #$t0 = $t1 & ff00
ori $t0, $t1, 0xff00 #$t0 = $t1 | ff00
lui $t0, 0xaaaa
jal gcd #jump to routine gcd
-----------------------------------------------------------
array kullanımı ve loop.
while (save[i] == k)
i + = 1;
Loop: sll $t1, $s3, 2 # t1 = s3 << 2 bits
add $t1, $t1, $s6 # t1 = t1 + s6
lw $t0, 0($t) # load word from memory # t0 =memory(0+t0)
bne $t0, $s5, Exit # not equal t0 != s5 jump Exit
addi $s3, $s3, 1 # else s3 = s3 + 1;
j Loop # jump Loop
Exit: . . .
--------------------------------------------------------------
int leaf_ex (int g, int h, int i, int j){
int f;
f = (g+h) – (i+j);
return f;
}
leaf_ex: addi $sp,$sp,-8 #make stack room (sp = sp - 8) (sp = stack pointer )
sw $t1,4($sp) #save $t1 on stack (memory(sp + 4) = t1)
sw $t0,0($sp) #save $t0 on stack (memory(sp +0) = t0)
add $t0,$a0,$a1 # t0 = a0 + a1;
add $t1,$a2,$a3 # t1 = a2 + a3; (a = arguments)
sub $v0,$t0,$t1 # v0 = t0 - t1; (t = temporaries v = function results)
lw $t0,0($sp) #restore $t0 ( t0 = memory(sp + 0))
lw $t1,4($sp) #restore $t1 (t1 = memory(sp + 4))
addi $sp,$sp,8 #adjust stack ptr (sp = sp + 8)
jr $ra # jump register return address
-----------------------------------------------------------------------------------------------------
int rt_1 (int i) {
if (i == 0) return 0;
else return rt_2(i-1);
}
caller: jal rt_1 #jump and link rt_1
next: . . .
rt_1: bne $a0, $zero, to_2 #branch not equal a0 != 0 => jump to_2
add $v0, $zero, $zero #else v0 = 0 + 0;
jr $ra # jump register return address
to_2: addi $a0, $a0, -1 # a0 = a0 - 1; arguments
jal rt_2 # jump and link rt_2
jr $ra # jump register return address
rt_2: . . .
-----------------------------------------------------------------------------------------
Nested procedures (i passed in $a0, return value in $v0)
rt_1: bne $a0, $zero,
add $v0, $zero, $zero
jr $ra
to_2: addi $sp, $sp, -8
sw $ra, 4($sp)
sw $a0, 0($sp)
addi $a0, $a0, -1
jal rt_2
bk_2: lw $a0, 0($sp)
lw $ra, 4($sp)
addi $sp, $sp, 8
jr $ra
----------------------------------------------------------------
compiling recursive procedure
fact: addi $sp, $sp, -8 #adjust stack pointer
sw $ra, 4($sp) #save return address
sw $a0, 0($sp) #save argument n
slti $t0, $a0, 1 #test for n < 1
beq $t0, $zero, L1 #if n >=1, go to L1
addi $v0, $zero, 1 #else return 1 in $v0
addi $sp, $sp, 8 #adjust stack pointer
jr $ra #return to caller (1st)
L1: addi $a0, $a0, -1 #n >=1, so decrement n
jal fact #call fact with (n-1)
#this is where fact returns
bk_f: lw $a0, 0($sp) #restore argument n
lw $ra, 4($sp) #restore return address
addi $sp, $sp, 8 #adjust stack pointer
mul $v0, $a0, $v0 #$v0 = n * fact(n-1)
jr $ra #return to caller (2nd)
------------------------------------------------------------------
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.