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