香港理工大学:INSTRUCTION SETS 指令

2.INSTRUCTION SETS I Rocky K.C.Chang Version 0.3,14 September 2017
Rocky K. C. Chang Version 0.3, 14 September 2017

GOAIS OF THIS LECTURE Know how to write MIPS assembly language for Arithmetic operations logical operations Data transfer between registers and memory Control flow(branching and loops) Understand two different types of byte order
▪Know how to write MIPS assembly language for ▪ Arithmetic operations ▪ Logical operations ▪ Data transfer between registers and memory ▪ Control flow (branching and loops) ▪Understand two different types of byte order 2

LEVELS OF REPRESENTATION/ INTERPRETATION High Level language temp=vk; Program(e.g, c) k]=v[k+1] k+]=temp; Compiler Assembly Language lw Sto. 0(62) Anything can be represented lw: Stl, 4($2 Program(e. g, MIPS) sw $tl, 0($2 sa sW$t0,4(92) . e. data or instruction Assembler 00001001110001101010111101011000 Machine Language 10101111010110000000100111000110 Program(MIPS 11000110101011110101100000001001 01011000000010011100011010101111 Machine Interpretation Hardware Architecture Description ALU e.g., bloc diagrams Architecture Implementation Logic Circuit Description Circuit Schematic Diagrams
3 lw $t0, 0($2) lw $t1, 4($2) sw $t1, 0($2) sw $t0, 4($2) High Level Language Program (e.g., C) Assembly Language Program (e.g., MIPS) Machine Language Program (MIPS) Hardware Architecture Description (e.g., block diagrams) Compiler Assembler Machine Interpretation temp = v[k]; v[k] = v[k+1]; v[k+1] = temp; 0000 1001 1100 0110 1010 1111 0101 1000 1010 1111 0101 1000 0000 1001 1100 0110 1100 0110 1010 1111 0101 1000 0000 1001 0101 1000 0000 1001 1100 0110 1010 1111 Architecture Implementation Anything can be represented as a number, i.e., data or instructions 3 Logic Circuit Description (Circuit Schematic Diagrams)

ASSEMBLY LANGUAGS Basic job of a CPU: execute lots of instructions Instructions are the primitive operations that the cpu may execute Different CPUs implement different sets of instructions. The set of instructions a particular CPu implements is an Instruction Set Architecture(ISA) Examples: ARM, Intel x86, MIPS, RISC-V, IBM/Motorola PowerPC(old Mac) Intel IA64
▪Basic job of a CPU: execute lots of instructions. ▪ Instructions are the primitive operations that the CPU may execute. ▪Different CPUs implement different sets of instructions. The set of instructions a particular CPU implements is an Instruction Set Architecture (ISA). ▪ Examples: ARM, Intel x86, MIPS, RISC-V, IBM/Motorola PowerPC (old Mac), Intel IA64, ... 4

INSTRUCTION SET ARCHITECTURES Early trend was to add more and more instructions to new CPus to do elaborate operations VAX architecture had an instruction to multiply polynomials! RISC philosophy (Cocke IBM, Patterson, Hennessy, 1980s) Reduced Instruction Set Computing Keep the instruction set small and simple, makes it easier to build fast hardware Let software do complicated operations by composing simpler ones
▪Early trend was to add more and more instructions to new CPUs to do elaborate operations ▪ VAX architecture had an instruction to multiply polynomials! ▪RISC philosophy (Cocke IBM, Patterson, Hennessy, 1980s) – Reduced Instruction Set Computing ▪ Keep the instruction set small and simple, makes it easier to build fast hardware. ▪ Let software do complicated operations by composing simpler ones. 5

MIPS ARCHITECTURE MIPS-semiconductor company that built one of the first commercial RISC architectures We will study the mips architecture in some detail in this class Why mips instead of Intel x86? MIPS is simple, elegant. Dont want to get bogged down in gritty details MPS widely used in embedded apps, x86 lttle used in embedded, and more embedded computers than PCs
▪MIPS – semiconductor company that built one of the first commercial RISC architectures ▪ We will study the MIPS architecture in some detail in this class. ▪ Why MIPS instead of Intel x86? ▪ MIPS is simple, elegant. Don’t want to get bogged down in gritty details. ▪ MIPS widely used in embedded apps, x86 little used in embedded, and more embedded computers than PCs 6

MIPS32 (32-BIT INSTRUCTIONS) emory Program Bytes One mips instruction 32 bits Data
7 7 Memory Bytes Program Data One MIPS Instruction = 32 bits

HOW PROGRAM IS EXECUTED? Memory Processor struction Control n bits rogram Datapath Program Counter struction Bytes- Address Registers Arithmetic Logic Unit Data (ALU) The program counter (internal register inside processor) holds address of next instruction to be executed
8 Processor Control Datapath Program Counter Registers Arithmetic & Logic Unit (ALU) Memory Instruction Bytes Address Read Instructio n Bits Program Data The program counter (internal register inside processor) holds address of next instruction to be executed

ASSEMBIY VARIABIES REGISTERS Unlike HlL like C or java, assembly cannot use variables Why not? Keep hardware simple Assembly operands are registers Limited number of special locations built directly into the hardware Operations can only be performed on these registers. Benefit: Since registers are directly in hardware, they are very fast (faster than I ns-light travels 30cm in l ns!!!)
▪ Unlike HLL like C or Java, assembly cannot use variables ▪ Why not? Keep hardware simple ▪ Assembly operands are registers. ▪ Limited number of special locations built directly into the hardware ▪ Operations can only be performed on these registers! ▪Benefit: Since registers are directly in hardware, they are very fast (faster than 1 ns - light travels 30cm in 1 ns!!! ) 9

NUMBER OF MIPS REGISTERS Drawback: Since registers are in hardware there are a predetermined number of them Solution: MiPS code must be very carefully put together to eficiently use registers 32 registers in MPs Why 32? Smaller is faster, but too small is bad. Goldilocks problem Each MPS register is 32 bits wide Groups of 32 bits called a word in MPS
▪Drawback: Since registers are in hardware, there are a predetermined number of them. ▪ Solution: MIPS code must be very carefully put together to efficiently use registers. ▪32 registers in MIPS ▪ Why 32? Smaller is faster, but too small is bad. Goldilocks problem. ▪Each MIPS register is 32 bits wide ▪ Groups of 32 bits called a word in MIPS 10
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 《计算机网络原理》课程教学资源(PPT课件讲稿)第二章 网络实现模型.ppt
- 上海交通大学:《软件开发》课程教学资源(PPT课件)第一讲 概述.ppt
- 香港浸会大学:《Data Communications and Networking》课程教学资源(PPT讲稿)Socket Programming Part II:Design of Server Software.ppt
- 中国科学技术大学:《网络算法学》课程教学资源(PPT课件)第六章 传输控制.ppt
- 西安电子科技大学:《MATLAB程序设计语言》课程教学资源(PPT讲稿)Chapter1 Matlab系统概述.ppt
- 清华大学:Mandarin Pronunciation Variation Modeling.ppt
- 清华大学出版社:《C语言程序设计》课程教学资源(PPT课件讲稿)第7章 用户自定义函数.ppt
- 中国科学技术大学:《算法基础》课程教学资源(PPT课件讲稿)第七讲 顺序统计学(主讲人:吕敏).pptx
- 《Java语言程序设计》课程教学资源(PPT课件讲稿)第三章 面向对象特征.ppt
- Virtual Topologies - Faculty of Science, HKBU.ppt
- 《Adobe Photoshop CS》软件教程(PPT讲稿)第13章 使用路径.ppt
- 《软件开发》课程PPT教学课件:Chapter 16 异常处理 Exception Handling.ppt
- 西安电子科技大学:《计算机网络 Computer Networks》课程教学资源(PPT课件讲稿)基于CORBA的分布式平台(CORBA编程-Hello World例程).ppt
- 电子工业出版社:《计算机网络》课程教学资源(第五版,PPT课件讲稿)第七章 网络安全.ppt
- 北京大学:浅谈计算机研究的层次与境界(李振华).pptx
- 南京大学:《计算机图形学》课程教学资源(PPT课件讲稿)计算机图形学引言(主讲:路通).ppt
- 国家十一五规划教材:《电子商务案例分析》课程教学资源(PPT课件)第11章 网络社区模式案例分析.ppt
- 西安电子科技大学:《操作系统 Operating Systems》课程教学资源(PPT课件讲稿)Chapter 08 多处理器系统 Multiple Processor Systems.ppt
- 计算机问题求解(PPT讲稿)图论中的其它专题.pptx
- SIGCOMM 2002:New Directions in Traffic Measurement and Accounting.ppt
- 计算机问题求解(PPT讲稿)B树.pptx
- 北京大学远程教育:《计算机应用基础》课程PPT教学课件(专科)串讲(综合复习).pptx
- 《Microsoft Access 2003》教程PPT:第9章 报表设计.ppt
- 《编译原理和技术》课程PPT教学课件:第十三章 函数式语言的编译.ppt
- 四川大学:Object-Oriented Design and Programming(Java,PPT课件).ppt
- 安徽理工大学:《汇编语言》课程教学资源(PPT课件讲稿)第五章 循环与分支程序设计.ppt
- 《C程序设计》课程PPT教学课件(电子教案)第六章 函数.ppt
- 基于语义关联和信息增益的TFIDF改进算法研究.ppt
- Integrated analysis of regulatoryand metabolic networks revealsnovel regulatory mechanisms inSaccharomyces cerevisiae.ppt
- 山东大学:《计算机图形学》课程PPT教学课件(Programming with OpenGL)Part 3:Three Dimensions.ppt
- 《算法设计技巧与分析》课程教学资源(PPT讲稿)Lecture 8 贪婪法则 Greedy Approach.ppt
- 山西国际商务职业学院:《网页设计与制作》课程教学资源(PPT课件)第一章 网页设计基础知识.ppt
- 《多媒体教学软件设计》课程PPT教学课件:第13章 多媒体教学软件中脚本编程技巧.ppt
- 中国科学技术大学:《计算机体系结构》课程教学资源(PPT课件讲稿)动态调度(Cont)、推断执行和ILP.ppt
- 香港浸会大学:《Experiencing Cluster Computing》Class 8 Case Studies.ppt
- 香港理工大学:Building Robust Wireless LAN for Industrial Control with DSSS-CDMA Cell Phone Network Paradigm.ppt
- International Trade Forms.ppt
- 因特网多媒体技术(PPT讲稿).ppt
- 长春工业大学:《电子商务》课程教学资源(PPT课件)第9章 网络鞋城前台页面.ppt
- 数据传送类指令(PPT讲稿).ppt