作者Lewis2000 (黑)
看板Electronics
標題[問題] 用C語言表達MIPS語言
時間Fri Jan 30 04:31:37 2009
白算盤有一些不懂的東西,想請教一個有關計算機組織的問題。
請教一個題目:
Let us give the following MIPS assembly code
Loop: add $t1, $s3, $s3
add $t1, $t1, $t1
add $t1, $t1, $s5
lw $t0, 0($t1)
add $s1, $s1, $t0
add $s3, $s3, $s4
bne $s3, $s2, Loop
暫存器$s1,$s2,$s3,$s4分別為g,h,i,j
A為array且$s5存放指向A之基底位址
(A is an array of 100 elements and the base of the array A is in $s5)
解答:
Loop: g=g+a[i]
i=i+j ;
if(i!=h) go to Loop;
我想請教的是為什麼是用g=g+a[i]來表示
MIPS語言$s1 <-- M[4i+$s5] 的部份。
對於陣列的觀念跟使用不太清楚,麻煩
各位大大能替我解答 <(_._)>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.160.70.163
1F:推 TroyLee:word alignment? 01/30 04:41
2F:推 arclitetank:4 bytes 湊成一個word 01/30 14:19
3F:推 promagicman:書上不是有圖嗎?說明的很清楚了阿! 02/07 21:36