[問題] 用C語言表達MIPS語言

看板Electronics作者 (黑)時間17年前 (2009/01/30 04:31), 編輯推噓3(300)
留言3則, 3人參與, 最新討論串1/1
白算盤有一些不懂的東西,想請教一個有關計算機組織的問題。 請教一個題目: 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

01/30 04:41, , 1F
word alignment?
01/30 04:41, 1F

01/30 14:19, , 2F
4 bytes 湊成一個word
01/30 14:19, 2F

02/07 21:36, , 3F
書上不是有圖嗎?說明的很清楚了阿!
02/07 21:36, 3F
文章代碼(AID): #19WX8ggZ (Electronics)