Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
730 B
1
Indexable
Never
// TODO : 
"li t3, 0\n\t" // i for loop 
"li t4, 16\n\t" // arr_size

// lw counter
"addi %[lw_cnt], %[lw_cnt], 2\n\t" 

"loop_label:\n\t" 
// other counter
"addi %[others_cnt], %[others_cnt], 1\n\t"
// loop starts here
"beq t3, t4, end_of_loop\n\t" 

"addi t3, t3, 1\n\t" // i++ 
"lh t0, 0(%[h])\n\t"
"lh t1, 0(%[x])\n\t"
"add t2, t0, t1\n\t" // y = h + x
"sh t2, 0(%[y])\n\t"
"addi %[h], %[h], 2\n\t"
"addi %[x], %[x], 2\n\t"
"addi %[y], %[y], 2\n\t"
// adder counter
"addi %[arith_cnt], %[arith_cnt], 5\n\t"
// lw counter
"addi %[lw_cnt], %[lw_cnt], 2\n\t" 
// other counter
"addi %[others_cnt], %[others_cnt], 1\n\t"
"addi %[sw_cnt], %[sw_cnt], 1\n\t"
"j loop_label\n\t"


"end_of_loop:\n\t"