




已閱讀5頁(yè),還剩1頁(yè)未讀, 繼續(xù)免費(fèi)閱讀
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
MIPS32指令集MIPS指令可以分成以下各類: 空操作no-op; 寄存器寄存器傳輸:用得很廣,包括條件傳輸在內(nèi); 常數(shù)加載:作為數(shù)值和地址的整型立即數(shù); 算術(shù)邏輯指令; 整數(shù)乘法、除法和求余數(shù); 整數(shù)乘加; 加載和存儲(chǔ); 跳轉(zhuǎn)、子程序調(diào)用和分支; 斷點(diǎn)和自陷; CP0功能:CPU控制指令 浮點(diǎn); 用戶態(tài)的受限訪問:rdhwr和synci注:64位版本開頭以“d”表示,無(wú)符號(hào)數(shù)以“u”結(jié)尾,立即數(shù)通常以“i”結(jié)尾,字節(jié)操作以“b”結(jié)尾,雙字操作以“d”結(jié)尾,字操作以“w”結(jié)尾1、空操作:nop:相當(dāng)于 sll zero,zero,o, ssnop: equals sll zero,zero,1. 這個(gè)指令不得與其它指令同時(shí)發(fā)送,這樣就保證了其運(yùn)行要花費(fèi)至少一個(gè)時(shí)鐘周期。這在簡(jiǎn)單的流水線的CPU上無(wú)關(guān)緊要,但在復(fù)雜些的實(shí)現(xiàn)上對(duì)于實(shí)現(xiàn)強(qiáng)制的延時(shí)很有用。2、寄存器寄存器傳送: move: 通常用跟$zero寄存器的or來(lái)實(shí)現(xiàn),或者用addu。 movf, movt, movn, movz: 條件傳送。3、常數(shù)加載: dla、la: 用來(lái)加載程序中某些帶標(biāo)號(hào)的位置或者變量的地址的宏指令; dli、li: 裝入立即數(shù)常數(shù),這是一個(gè)宏指令; lui: 把立即數(shù)加載到寄存器高位。4、算術(shù)邏輯運(yùn)算: add、addi、dadd、daddi、addu、addiu、daddu、daddiu、dsub、sub、subu:加法指令和減法指令; abs,dabs:絕對(duì)值; dneg、neg、negu:取相反數(shù); and、andi、or、ori、xor、nor:逐位邏輯操作指令; drol、rol、ror:循環(huán)移位指令; sll、srl、sra:移位。5、條件設(shè)置指令: slt、slti、sltiu、sltu、seq、sge、sle、sne:條件設(shè)置。6、整數(shù)乘法、除法和求余數(shù): div、mul、rem等等。7、整數(shù)乘加(累加): mad等。8、加載和存儲(chǔ): lb、ld、ldl、ldr、sdl、sdr、lh、lhu、ll、sc、pref、sb等操作。9、浮點(diǎn)加載和存儲(chǔ): l.d、l.s、s.d、s.s等常用MIPS指令集及格式:MIPS 指令集(共31條)助記符指令格式示例示例含義操作及其解釋Bit #31.2625.2120.1615.1110.65.0R-typeoprsrtrdshamtfuncadd000000rsrtrd00000100000add $1,$2,$3$1=$2+$3rd - rs + rt;其中rs$2,rt=$3, rd=$1addu000000rsrtrd00000100001addu $1,$2,$3$1=$2+$3rd - rs + rt;其中rs$2,rt=$3, rd=$1,無(wú)符號(hào)數(shù)sub000000rsrtrd00000100010sub $1,$2,$3$1=$2-$3rd - rs - rt;其中rs$2,rt=$3, rd=$1subu000000rsrtrd00000100011subu $1,$2,$3$1=$2-$3rd - rs - rt;其中rs$2,rt=$3, rd=$1,無(wú)符號(hào)數(shù)and000000rsrtrd00000100100and $1,$2,$3$1=$2&$3rd - rs & rt;其中rs$2,rt=$3, rd=$1or000000rsrtrd00000100101or $1,$2,$3$1=$2|$3rd - rs | rt;其中rs$2,rt=$3, rd=$1xor000000rsrtrd00000100110xor $1,$2,$3$1=$2$3rd - rs xor rt;其中rs$2,rt=$3, rd=$1(異或)nor000000rsrtrd00000100111nor $1,$2,$3$1=($2|$3)rd - not(rs | rt);其中rs$2,rt=$3, rd=$1(或非)slt000000rsrtrd00000101010slt $1,$2,$3if($2$3)$1=1else$1=0if (rs rt) rd=1elserd=0 ;其中rs$2,rt=$3, rd=$1sltu000000rsrtrd00000101011sltu $1,$2,$3if($2$3)$1=1else$1=0if (rs rt) rd=1elserd=0 ;其中rs$2,rt=$3, rd=$1(無(wú)符號(hào)數(shù))sll00000000000rtrdshamt000000sll $1,$2,10$1=$210rd - rt 10rd shamt ;(logical) ,其中rt=$2, rd=$1sra00000000000rtrdshamt000011sra $1,$2,10$1=$210rd shamt ;(arithmetic)注意符號(hào)位保留其中rt=$2, rd=$1sllv000000rsrtrd00000000100sllv $1,$2,$3$1=$2$3rd - rt$3rd rs;(logical)其中rs$3,rt=$2, rd=$1srav000000rsrtrd00000000111srav $1,$2,$3$1=$2$3rd rs;(arithmetic)注意符號(hào)位保留其中rs$3,rt=$2, rd=$1jr000000rs000000000000000001000jr$31goto$31PC -rsI-typeoprsrtimmediateaddi001000rsrtimmediateaddi$1,$2,100$1=$2+100rt - rs + (sign-extend)immediate;其中rt=$1,rs=$2addiu001001rsrtimmediateaddiu$1,$2,100$1=$2+100rt - rs + (zero-extend)immediate;其中rt=$1,rs=$2andi001100rsrtimmediateandi$1,$2,10$1=$2 & 10rt - rs & (zero-extend)immediate;其中rt=$1,rs=$2ori001101rsrtimmediateandi$1,$2,10$1=$2 | 10rt - rs | (zero-extend)immediate;其中rt=$1,rs=$2xori001110rsrtimmediateandi$1,$2,10$1=$2 10rt - rs xor (zero-extend)immediate;其中rt=$1,rs=$2lui00111100000rtimmediatelui$1,100$1=100*65536rt - immediate*65536;將16位立即數(shù)放到目標(biāo)寄存器高16位,目標(biāo)寄存器的低16位填0lw100011rsrtimmediatelw$1,10($2)$1=memory$2+10rt - memoryrs + (sign-extend)immediate;rt=$1,rs=$2sw101011rsrtimmediatesw$1,10($2)memory$2+10=$1memoryrs + (sign-extend)immediate - rt;rt=$1,rs=$2beq000100rsrtimmediatebeq$1,$2,10if($1=$2) gotoPC+4+40if (rs = rt) PC - PC+4 + (sign-extend)immediate2bne000101rsrtimmediatebne$1,$2,10if($1!=$2)gotoPC+4+40if (rs != rt) PC - PC+4 + (sign-extend)immediate2slti001010rsrtimmediateslti $1,$2,10if($210)$1=1else$1=0if (rs (sign-extend)immediate) rt=1elsert=0 ; 其中rs$2,rt=$1sltiu001011rsrtimmediatesltiu $1,$2,10if($210)$1=1else$1=0if (rs (zero-extend)immediate) rt=1elsert=0 ; 其中rs$2,rt=$1J-typeopaddressj000010addressj10000goto10000PC - (PC+4)31.28,address,0,0;address=10000/4jal000011addressjal10000$31-PC+4;goto10000$31-PC+4;PC - (PC+4)31.28,address,0,0;address=10000/4更全的MIPS匯編指令A(yù)rithmetic Instructionsabs des, src1 # des gets the absolute value of src1.add(u) des, src1, src2 # des gets src1 + src2.addi $t2,$t3,5 # $t2 = $t3 + 5 加16位立即數(shù)addiu $t2,$t3,5 # $t2 = $t3 + 5 加16位無(wú)符號(hào)立即數(shù)sub(u) des, src1, src2 # des gets src1 - src2.div(u) src1, reg2 # Divide src1 by reg2, leaving the quotient in register# lo and the remainder in register hi.div(u) des, src1, src2 # des gets src1 / src2. mul des, src1, src2 # des gets src1 * src2.mulo des, src1, src2 # des gets src1 * src2, with overflow.mult(u) src1, reg2 # Multiply src1 and reg2, leaving the low-order word# in register lo and the high-order word in register hi.rem(u) des, src1, src2 # des gets the remainder of dividing src1 by src2.neg(u) des, src1 # des gets the negative of src1.and des, src1, src2 # des gets the bitwise and of src1 and src2.nor des, src1, src2 # des gets the bitwise logical nor of src1 and src2.not des, src1 # des gets the bitwise logical negation of src1.or des, src1, src2 # des gets the bitwise logical or of src1 and src2.xor des, src1, src2 # des gets the bitwise exclusive or of src1 and src2.rol des, src1, src2 # des gets the result of rotating left the contents of src1 by src2 bits.ror des, src1, src2 # des gets the result of rotating right the contents of src1 by src2 bits.sll des, src1, src2 # des gets src1 shifted left by src2 bits.sra des, src1, src2 # Right shift arithmetic.srl des, src1, src2 # Right shift logical.sllv des, src1, src2 # $t0 = $t1 $t3,shift right logicalsrav des, src1, src2 # $t0 = $t1 $t3,shift right arithm.Comparison Instructionsseq des, src1, src2 # des 1 if src1 = src2, 0 otherwise.sne des, src1, src2 # des 1 if src1 != src2, 0 otherwise.sge(u) des, src1, src2 # des 1 if src1 = src2, 0 otherwise.sgt(u) des, src1, src2 # des 1 if src1 src2, 0 otherwise.sle(u) des, src1, src2 # des 1 if src1 = src2, 0 otherwise.slt(u) des, src1, src2 # des 1 if src1 = src2 .bgt(u) src1, src2, lab # Branch to lab if src1 src2 .ble(u) src1, src2, lab # Branch to lab if src1 = src2 .blt(u) src1, src2, lab # Branch to lab if src1 = 0.bgtz src1, lab # Branch to lab if src1 0.blez src1, lab # Branch to lab if src1 = 0.bltz src1, lab # Branch to lab if src1 = 0, then put the address of the next instruction# into $ra and branch to lab.bgtzal src1, lab # If src1 0, then put the address of the next instruction# into $ra and branch to lab.bltzal src1, lab # If src1 0, then put the address of the next instruction# into $ra and branch to lab.j label # Jump to label lab.jr src1 # Jump to location src1.jal label # Jump to label lab, and store the address of the next instruction in $ra.jalr src1 # Jump to location src1, and store the address of the next instruction in $ra.Load, Store, and Data Movement(reg) $ Contents of reg.const $ A constant address.const(reg) $ const + contents of reg.symbol $ The address of symbol.symbol+const $ The address of symbol + const.symbol+const(reg) $ The address of symbol + const + contents of reg.la des, addr # Load the address of a label.lb(u) des, addr # Load the byte at addr into des.lh(u) des, addr # Load the halfword at addr into des.li des, const # Load the constant const into des.lui des, const # Load the constant const into the upper halfword of des,# and set the lower halfword of des to 0.lw des, addr # Load the word at addr into des.lwl des, addrlwr des, addrulh(u) des, addr # Load the halfword starting at the (possibly unaligned) address addr into des.ulw des, addr # Load the word starting at the (possibly unaligned) address addr into des.sb src1, addr # Store the lower byte of register src1 to addr.sh src1, addr # Store the lower halfword of register src1 to addr.sw src1, addr # Store the word in register src1 to addr.swl src1, addr # Stor
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 佳木斯市向陽(yáng)區(qū)2024-2025學(xué)年三年級(jí)數(shù)學(xué)第二學(xué)期期末質(zhì)量跟蹤監(jiān)視模擬試題含解析
- 江蘇省蘇州昆山市、太倉(cāng)市2025屆中考沖刺預(yù)測(cè)卷(六)語(yǔ)文試題含解析
- 昆明幼兒師范高等專科學(xué)校《藥用高分子材料》2023-2024學(xué)年第一學(xué)期期末試卷
- 華中科技大學(xué)《大學(xué)英語(yǔ)寫作》2023-2024學(xué)年第一學(xué)期期末試卷
- 山西科技學(xué)院《城市地理學(xué)》2023-2024學(xué)年第二學(xué)期期末試卷
- 江西生物科技職業(yè)學(xué)院《生物教材分析與應(yīng)用》2023-2024學(xué)年第二學(xué)期期末試卷
- 寧夏醫(yī)科大學(xué)《城市設(shè)計(jì)1》2023-2024學(xué)年第二學(xué)期期末試卷
- 烏海職業(yè)技術(shù)學(xué)院《工程制圖(Ⅱ)》2023-2024學(xué)年第二學(xué)期期末試卷
- 云南外事外語(yǔ)職業(yè)學(xué)院《英語(yǔ)國(guó)家社會(huì)與文化(1)》2023-2024學(xué)年第二學(xué)期期末試卷
- 上海師范大學(xué)天華學(xué)院《綠色建筑檢測(cè)與評(píng)價(jià)》2023-2024學(xué)年第一學(xué)期期末試卷
- 2025年人民保險(xiǎn)筆試題型及答案
- 2025-2030中國(guó)TPU膜行業(yè)市場(chǎng)現(xiàn)狀分析及競(jìng)爭(zhēng)格局與投資發(fā)展研究報(bào)告
- 2024年內(nèi)江市事業(yè)單位醫(yī)療崗招聘考試真題
- 中醫(yī)護(hù)理學(xué)(第5版)課件 第4章 病機(jī)
- 2025年泰語(yǔ)初級(jí)考試試題及答案
- 造瘺口還納護(hù)理
- 《尼爾斯騎鵝旅行記》讀書分享課件
- 浙江省溫州市瑞安市2023-2024學(xué)年六年級(jí)下學(xué)期數(shù)學(xué)期中分項(xiàng)評(píng)價(jià)試卷(含答案)
- 山東省德州市2024年中考化學(xué)試卷(含答案)
- Unit 2 Morals and Virtues Listening and Speaking教學(xué)設(shè)計(jì)-2024-2025學(xué)年人教版高中英語(yǔ)必修第三冊(cè)
- (統(tǒng)編2024版)語(yǔ)文一年級(jí)下冊(cè)第七單元解析+任務(wù)目標(biāo)+大單元教學(xué)設(shè)計(jì)
評(píng)論
0/150
提交評(píng)論