2013-03-31 48 views
0

我試圖在「計算機組織與設計」一書中解決問題。這些MIPS指令有可能嗎?

我遇到了書本解決方案中的一系列指令。 但是,mips彙編程序Qtspim無法解釋它們。 這裏是說明。 (書第4版,問題2.14.4 a)

add $t2, $t0, $0 
srl $t2, $t2, 11 
and $t2, $t2, 0x0000003f 
and $t1, $t1, 0xffffffc0 
ori $t1, $t1, $t2 

爲什麼ori有3個寄存器? (我認爲這不是r型指令) 爲什麼要有32bit立即? (我認爲指令本身有32位明智的。)

謝謝你提前。

回答

1

前兩條指令看起來不錯,但以下三條指令看起來不錯。這可能是錯別字,或者是本書的作者正在使用不同的MIPS彙編程序來接受這些指令並將其轉換爲有效的指令。

例如:

and $t2,$t2,0x0000003f 

=>
lui $t2,0 ; ANDing the upper halfword with 0x0000 would set it to 0
andi $t2,$t2,0x003f


and $t1,$t1,0xffffffc0 

=>
andi $t1,$t1,0xffc0 ; ANDing the upper halfword with 0xffff would not change it


ori $t1,$t1,$t2 

=>
or $t1,$t1,$t2

+0

謝謝各位大大的回答,並給了我相當的指令。!!!!!好。 – inherithandle

+0

我認爲它們也是僞造的。 – inherithandle