[理工] 99,100 成大資工 計組

看板Grad-ProbAsk作者 (大飛)時間11年前 (2012/12/12 19:38), 編輯推噓2(203)
留言5則, 4人參與, 最新討論串1/1
100計組第一題 1.Translate the beq instruction shown in the following code into an 32-bit instruction,provided that the opcode of beq is 0x04. L1: add $8,$9,$10 add $8,$9,$10 beq $0,$9,L2 add $8,$9,$10 add $6,$9,$10 L2: add $9,$0,$9 答案是給 OP Rs Rt 16-bit address 000100 00000 01001 0000000000000010 99計組第一題 1.Translate the beq instruction shown in the following code into an 32-bit instruction,provided that the opcode of beq is 0x04. LOOP: add $8,$9,$10 add $8,$9,$10 add $8,$9,$10 add $8,$9,$10 add $8,$9,$10 add $8,$9,$10 beq $0,$9,LOOP End: add $9,$0,$9 答案是給 OP Rs Rt 16-bit address 000100 00000 01001 1111111111111001 想問一下這2題後面那一串16-bit address是怎麼來的 麻煩板上的神手大大了 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 111.240.109.247

12/12 19:59, , 1F
就2跟-7的二補數
12/12 19:59, 1F

12/12 20:22, , 2F
beq是PC relative
12/12 20:22, 2F

12/13 00:22, , 3F
第一題,往下跳三格,所以address是2(PC會自動+4)
12/13 00:22, 3F

12/13 00:23, , 4F
第二題同第一題,向上6格,但要算PC+4,所以是-7
12/13 00:23, 4F

12/13 15:38, , 5F
我懂了 謝謝解答^^
12/13 15:38, 5F
文章代碼(AID): #1Go6oqA3 (Grad-ProbAsk)