没有合适的资源?快使用搜索试试~ 我知道了~
chx03_org05_MIPS_4b.pdf
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 49 浏览量
2022-06-12
02:37:23
上传
评论
收藏 274KB PDF 举报
温馨提示
试读
16页
chx03_org05_MIPS_4b
资源推荐
资源详情
资源评论
北京大学计算机科学技术系 北京大学微处理器研究开发中心
MIPS指令系统体系结构
MIPS Instruction Set Architecture
计算机组织与系统结构
计算机组织与系统结构
(第五讲 )
2003.10.9
程旭
北京大学计算机科学技术系 北京大学微处理器研究开发中心
本讲概况
上讲复习
MIPS指令系统体系结构
MIPS的其他情况
MIPS (PowerPC、VAX、80x86)
北京大学计算机科学技术系 北京大学微处理器研究开发中心
指令系统设计
指令系统
软件
硬件
北京大学计算机科学技术系 北京大学微处理器研究开发中心
执行周期
Instruction
Fetch
Instruction
Decode
Operand
Fetch
Execute
Result
Store
Next
Instruction
从程序存储系统中获得指令
确定所需的动作和指令大小
定位并获得操作数数据
计算结果数值或状态
在存储系统中存放结果,以备后用
确定后续指令
北京大学计算机科学技术系 北京大学微处理器研究开发中心
• 使用通用寄存器的load-store 结构;
• 支持如下寻址方式:displacement (with an address offset size of 12 to
16 bits)、 immediate (size 8 to 16 bits), 以及 register deferred;
• 支持如下简单指令(因为它们决定执行的指令总数):load、store、add、
subtract、move register-register、and、shift、compare equal、
compare not equal、 branch (with a PC-relative address at least 8-bits
long)、 jump、 call, 以及return;
• 支持如下数据大小和类型:8位、16位、32位整数; 以及
32位和 64位 IEEE 754 浮点数
• 如果看重性能,就使用 固定指令编码方案
如果看重代码大小,就使用 可变指令编码方案
• 提供至少16个通用寄存器,以及单独的浮点寄存器;
• 确信所有的寻址方式都可以用于所有的数据传输指令;
• 瞄准最低限要求的指令系统
上讲总结: ISA
北京大学计算机科学技术系 北京大学微处理器研究开发中心
指令(Instructions):
°机器语言的字词
°比高级语言更加简单、原始
例如,没有复杂的控制流
°限制性非常强
例如:MIPS算术运算指令
°更课程我们将基于MIPS指令系统体系结构
• 与二十世纪八十年代后的许多结构都很类似:NEC, Nintendo,
Silicon Graphics, Sony
设计目标
:
更高性能、更低成本、更少设计周期
北京大学计算机科学技术系 北京大学微处理器研究开发中心
MIPS 算术指令
°所有算术指令都有 3 个操作数
°操作数的次序是固定的(目标操作数领先)
示例:
C代码: A = B + C
MIPS代码: add $s0, $s1, $s2
(编译器完成寄存器与变量的关联)
北京大学计算机科学技术系 北京大学微处理器研究开发中心
MIPS arithmetic
°Design Principle: simplicity favors regularity. Why?
°Of course this complicates some things...
C code: A = B + C + D;
E = F - A;
MIPS code: add $t0, $s1, $s2
add $s0, $t0, $s3
sub $s4, $s5, $s0
°Operands must be registers, only 32 registers provided
°Design Principle: smaller is faster. Why?
北京大学计算机科学技术系 北京大学微处理器研究开发中心
Registers vs. Memory
Processor I/O
Control
Datapath
Memory
Input
Output
°Arithmetic instructions operands must be registers,
• only 32 registers provided
°Compiler associates variables with registers
°What about programs with lots of variables
北京大学计算机科学技术系 北京大学微处理器研究开发中心
Memory Organization
° Viewed as a large, single-dimension array, with an address.
° A memory address is an index into the array
° "
Byte addressing" means that the index points to
a byte of memory.
0
1
2
3
4
5
6
...
8 bits of data
8 bits of data
8 bits of data
8 bits of data
8 bits of data
8 bits of data
8 bits of data
北京大学计算机科学技术系 北京大学微处理器研究开发中心
Memory Organization
°Bytes are nice, but most data items use larger "words"
°For MIPS, a word is 32 bits or 4 bytes.
°2
32
bytes with byte addresses from 0 to 2
32
-1
°2
30
words with byte addresses 0, 4, 8, ... 2
32
-4
°Words are aligned
i.e., what are the least 2 significant bits of a word address?
...
0
4
8
12
32 bits of data
32 bits of data
32 bits of data
32 bits of data
Registers hold 32 bits of data
北京大学计算机科学技术系 北京大学微处理器研究开发中心
Instructions
°Load and store instructions
°Example:
C code: A[8] = h + A[8];
MIPS code: lw $t0, 32($s3)
add $t0, $s2, $t0
sw $t0, 32($s3)
°Store word has destination last
°Remember arithmetic operands are registers, not memory!
北京大学计算机科学技术系 北京大学微处理器研究开发中心
Our First Example
°Can we figure out the code?
swap(int v[], int k);
{ int temp;
temp = v[k]
v[k] = v[k+1];
v[k+1] = temp;
}
swap:
muli $2, $5, 4
add $2, $4, $2
lw $15, 0($2)
lw $16, 4($2)
sw $16, 0($2)
sw $15, 4($2)
jr $31
Assume: k->$5
v[0]->$4
北京大学计算机科学技术系 北京大学微处理器研究开发中心
So far we have learned:
°MIPS
- loading words but addressing bytes
- arithmetic on registers only
°Instruction
Meaning
add $s1, $s2, $s3 $s1 = $s2 + $s3
sub $s1, $s2, $s3 $s1 = $s2 - $s3
lw $s1, 100($s2) $s1 = Memory[$s2+100]
sw $s1, 100($s2) Memory[$s2+100] = $s1
北京大学计算机科学技术系 北京大学微处理器研究开发中心
°Instructions, like registers and words of data, are also 32 bits long
• Example: add $t0, $s1, $s2
• registers have numbers, $t0=9, $s1=17, $s2=18
°Instruction Format:
000000 10001 10010 01000 00000 100000
op rs rt rd shamt funct
°Can you guess what the field names stand for?
Machine Language
北京大学计算机科学技术系 北京大学微处理器研究开发中心
°Consider the load-word and store-word instructions,
• What would the regularity principle have us do?
• New principle: Good design demands a compromise
°Introduce a new type of instruction format
• I-type for data transfer instructions
• other format was R-type for register
°Example: lw $t0, 32($s2)
35 18 9 32
op rs rt 16 bit number
Where's the compromise?
Machine Language
剩余15页未读,继续阅读
资源评论
卷积神经网络
- 粉丝: 338
- 资源: 8460
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- uniapp中tab切换,底部内容跟着移动,相反,底部移动,tab也跟着切换-组件
- 基于JS+TS实现跨平台3D相机控制器-附项目源码-优质项目分享.zip
- 跨相机-基于Rust实现的跨平台相机捕获-附项目源码-优质项目分享.zip
- odise 14离线安装包 大众斯柯达奥迪 5054 6153
- 网页设计期末作业-纯html加css+少量js-盗墓笔记旅游导航网站.rar
- 算法笔记模拟退火.rar
- MATLAB大数据仿真案例-蚁群算法(ACO)用于求解旅行商(TSP)问题.rar
- 基于yolov5的吸烟行为检测源码+模型.zip
- MySQL基础知识-个人笔记.rar
- Project8.ipynb
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功