[問題] MIPS轉c語言

作者: sonichog (跑得快)   2014-09-19 05:23:22
f,g,h,i,j代表$s0,$s1,$s3,$s4,
然後base address of the arrays A and B分別存在$s6,$s7
求下面方程式,用c語言來表示的話是什麼樣子?
sll $t0, $s0, 2 #$t0=f*4
add $t0, $s6, $t0 #$t0=&A[f] 1.這個"&"是什麼意思啊?
sll $t1, $s1, 2 #t1=g*4
add $t1, $s7, $t1 #t1=&B[g]
lw $s0, 0($t0) #f=A[f]
addi $t2, $t0, 4 # 2.請問這邊的意思是t2=A[f+1]嗎?
lw $t0, 0($t2) # 3.請問0($t2)的那個0是什麼意思?
add $t0, $t0, $s0
sw $t0, 0($t1)
就這3個問題,然後我的答案是B[g]=A[f+1]+A[f]
麻煩板上各位帥哥大大指點迷津了!!

Links booklink

Contact Us: admin [ a t ] ucptt.com