mips32指令集(多来源,格式整齐)

上传人:第*** 文档编号:31079427 上传时间:2018-02-04 格式:DOC 页数:6 大小:99.50KB
返回 下载 相关 举报
mips32指令集(多来源,格式整齐)_第1页
第1页 / 共6页
mips32指令集(多来源,格式整齐)_第2页
第2页 / 共6页
mips32指令集(多来源,格式整齐)_第3页
第3页 / 共6页
mips32指令集(多来源,格式整齐)_第4页
第4页 / 共6页
mips32指令集(多来源,格式整齐)_第5页
第5页 / 共6页
点击查看更多>>
资源描述

《mips32指令集(多来源,格式整齐)》由会员分享,可在线阅读,更多相关《mips32指令集(多来源,格式整齐)(6页珍藏版)》请在金锄头文库上搜索。

1、MIPS32 指令集MIPS 指令可以分成以下各类:空操作 no-op;寄存器寄存器传输:用得很广,包括条件传输在内;常数加载:作为数值和地址的整型立即数;算术逻辑指令;整数乘法、除法和求余数;整数乘加;加载和存储;跳转、子程序调用和分支;断点和自陷;CP0 功能: CPU 控制指令浮点;用户态的受限访问:rdhwr 和 synci注:64 位版本开头以“d”表示,无符号数以“u”结尾,立即数通常以“i”结尾,字节操作以“b”结尾,双字操作以“d”结尾,字操作以“w” 结尾1、空操作:nop:相当于 sll zero,zero,o,ssnop: equals sll zero,zero,1.这

2、个指令不得与其它指令同时发送,这样就保证了其运行要花费至少一个时钟周期。这在简单的流水线的 CPU 上无关紧要,但在复杂些的实现上对于实现强制的延时很有用。2、寄存器寄存器传送:move: 通常用跟 $zero 寄存器的 or 来实现,或者用 addu。movf, movt, movn, movz: 条件传送。3、常数加载:dla、la: 用来加载程序中某些带标号的位置或者变量的地址的宏指令;dli、li: 装入立即数常数,这是一个宏指令;lui: 把立即数加载到寄存器高位。4、算术逻辑运算:add、addi、dadd 、daddi、addu、addiu、daddu 、daddiu、dsub、

3、sub、subu:加法指令和减法指令;abs,dabs :绝对值;dneg、neg、negu :取相反数;and、andi、or、ori、xor、nor :逐位逻辑操作指令;drol、rol 、ror:循环移位指令;sll、 srl、sra:移位。5、条件设置指令:slt、 slti、sltiu、sltu、seq、sge、sle、sne :条件设置。6、整数乘法、除法和求余数: div、mul、rem 等等。7、整数乘加(累加):mad 等。8、加载和存储:lb、ld、ldl、ldr、sdl、sdr、lh 、lhu 、ll、sc、pref、sb 等操作。9、浮点加载和存储:l.d、l.s、s.

4、d、s.s 等常用 MIPS 指令集及格式:MIPS 指令集(共 31 条)助记符 指令格式 示例 示例含义 操作及其解释Bit # 31.26 25.21 20.16 15.11 10.6 5.0 R-type op rs rt rdshamt func add 000000 rs rt rd 00000 100000 add $1,$2,$3 $1=$2+$3 rd 10 rd shamt ;(logical) ,其中 rt=$2, rd=$1sra 000000 00000 rt rd shamt 000011 sra $1,$2,10 $1=$210rd shamt ;(arithme

5、tic)注意符号位保留其中 rt=$2, rd=$1sllv 000000 rs rt rd 00000 000100 sllv $1,$2,$3 $1=$2$3 rd rs ;(logical) 其中rs$3,rt=$2, rd=$1srav 000000 rs rt rd 00000 000111 srav $1,$2,$3 $1=$2$3rd rs ;(arithmetic) 注意符号位保留其中 rs$3,rt=$2, rd=$1jr 000000 rs 00000 00000 00000 001000 jr $31 goto $31 PC $t3,shift right logical

6、srav 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 ot

7、herwise.sle(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 = 0.bgtz src1, lab # Branch to lab if src1 0.blez src1, lab # Branch to lab if src1 = 0, then put the address of the next instruction# into $ra a

8、nd 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

9、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 sym

10、bol.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 cons

11、t 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,

12、 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 # Store the upper ha

13、lfword in src to the (possibly unaligned) address addr.swr src1, addr # Store the lower halfword in src to the (possibly unaligned) address addr.ush src1, addr # Store the lower halfword in src to the (possibly unaligned) address addr.usw src1, addr # Store the word in src to the (possibly unaligned

14、) address addr.move des, src1 # Copy the contents of src1 to des.mfhi des # Copy the contents of the hi register to des.mflo des # Copy the contents of the lo register to des.mthi src1 # Copy the contents of the src1 to hi.mtlo src1 # Copy the contents of the src1 to lo.Exception Handlingrfe # Return from exception.syscall # Makes a system call. See 4.6.1 for a list of the SPIM system calls.break const # Used by the debugger.nop # An instruction which has no effect (other than taking a cycle to execute).

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 解决方案

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号