1/11/02CSE ISA's part 2 Instruction Set Architectures Part 2 I/O systemInstr. Set Proc. Compiler Operating System Application Digital Design Circuit.

Slides:



Advertisements
Similar presentations
Goal: Write Programs in Assembly
Advertisements

ISA Issues; Performance Considerations. Testing / System Verilog: ECE385.
1 Lecture 3: Instruction Set Architecture ISA types, register usage, memory addressing, endian and alignment, quantitative evaluation.
INSTRUCTION SET ARCHITECTURES
1 ECE462/562 ISA and Datapath Review Ali Akoglu. 2 Instruction Set Architecture A very important abstraction –interface between hardware and low-level.
1 ECE369 ECE369 Chapter 2. 2 ECE369 Instruction Set Architecture A very important abstraction –interface between hardware and low-level software –standardizes.
CS1104 – Computer Organization PART 2: Computer Architecture Lecture 5 MIPS ISA & Assembly Language Programming.
ELEN 468 Advanced Logic Design
Chapter 2 Instructions: Language of the Computer
Chapter 2.
331 W08.1Spring :332:331 Computer Architecture and Assembly Language Spring 2006 Week 8: Datapath Design [Adapted from Dave Patterson’s UCB CS152.
Chapter 2 Instructions: Language of the Computer Part III.
CSE378 ISA evolution1 Evolution of ISA’s ISA’s have changed over computer “generations”. A traditional way to look at ISA complexity encompasses: –Number.
S. Barua – CPSC 440 CHAPTER 2 INSTRUCTIONS: LANGUAGE OF THE COMPUTER Goals – To get familiar with.
Lecture 5 Sept 14 Goals: Chapter 2 continued MIPS assembly language instruction formats translating c into MIPS - examples.
©UCB CPSC 161 Lecture 5 Prof. L.N. Bhuyan
1  2004 Morgan Kaufmann Publishers Instructions: bne $t4,$t5,Label Next instruction is at Label if $t4≠$t5 beq $t4,$t5,Label Next instruction is at Label.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
1/9/02CSE ISA's Instruction Set Architectures Part 1 I/O systemInstr. Set Proc. Compiler Operating System Application Digital Design Circuit Design.
Instruction Set Architecture The portion of the machine visible to the programmer Issues: Internal storage model Addressing modes Operations Operands Encoding.
Oct. 25, 2000Systems Architecture I1 Systems Architecture I (CS ) Lecture 9: Alternative Instruction Sets * Jeremy R. Johnson Wed. Oct. 25, 2000.
Small constants are used quite frequently (50% of operands) e.g., A = A + 5; B = B + 1; C = C - 18; Solutions? Why not? put 'typical constants' in memory.
CHAPTER 6 Instruction Set Architecture 12/7/
 1998 Morgan Kaufmann Publishers MIPS arithmetic All instructions have 3 operands Operand order is fixed (destination first) Example: C code: A = B +
Chapter 2 CSF 2009 The MIPS Assembly Language. Stored Program Computers Instructions represented in binary, just like data Instructions and data stored.
Computer Organization Rabie A. Ramadan Lecture 3.
EET 4250 Instruction Representation & Formats Acknowledgements: Some slides and lecture notes for this course adapted from Prof. Mary Jane Penn.
Chapter 2 — Instructions: Language of the Computer — 1 Memory Operands Main memory used for composite data – Arrays, structures, dynamic data To apply.
DR. SIMING LIU SPRING 2016 COMPUTER SCIENCE AND ENGINEERING UNIVERSITY OF NEVADA, RENO Session 7, 8 Instruction Set Architecture.
COM181 Computer Hardware Lecture 6: The MIPs CPU.
Instruction Set Architecture Chapter 3 – P & H. Introduction Instruction set architecture interface between programmer and CPU Good ISA makes program.
CHAPTER 2 Instruction Set Architecture 3/21/
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
MIPS Assembly.
Displacement (Indexed) Stack
A Closer Look at Instruction Set Architectures
COMPUTER ARCHITECTURE & OPERATIONS I
Instruction Set Architecture
MIPS Coding Continued.
ELEN 468 Advanced Logic Design
William Stallings Computer Organization and Architecture 8th Edition
Computer Architecture (CS 207 D) Instruction Set Architecture ISA
Instructions - Type and Format
Lecture 4: MIPS Instruction Set
CS170 Computer Organization and Architecture I
Systems Architecture I (CS ) Lecture 5: MIPS Instruction Set*
Henk Corporaal TUEindhoven 2010
Computer Architecture & Operations I
The University of Adelaide, School of Computer Science
ECE232: Hardware Organization and Design
Chapter 2 Instructions: Language of the Computer
Instruction encoding The ISA defines Format = Encoding
Computer Instructions
Computer Architecture
Instruction encoding The ISA defines Format = Encoding
Evolution of ISA’s ISA’s have changed over computer “generations”.
COMS 361 Computer Organization
UCSD ECE 111 Prof. Farinaz Koushanfar Fall 2018
COMS 361 Computer Organization
Instruction encoding The ISA defines Format = Encoding
Instruction Set Principles
COMS 361 Computer Organization
Evolution of ISA’s ISA’s have changed over computer “generations”.
Instruction encoding The ISA defines Format = Encoding
Evolution of ISA’s ISA’s have changed over computer “generations”.
CPU Structure CPU must:
Systems Architecture I (CS ) Lecture 5: MIPS Instruction Set*
Evolution of ISA’s ISA’s have changed over computer “generations”.
Instruction Set Architecture
Presentation transcript:

1/11/02CSE ISA's part 2 Instruction Set Architectures Part 2 I/O systemInstr. Set Proc. Compiler Operating System Application Digital Design Circuit Design Instruction Set Architecture

CSE ISA's part 22 Key ISA decisions instruction length  are all instructions the same length? how many registers? where do operands reside?  e.g., can you add contents of memory to a register? instruction format  which bits designate what?? operands  how many? how big?  how are memory addresses computed? operations  what operations are provided??   

CSE ISA's part 23 Instruction formats -what does each bit mean? Having many different instruction formats... complicates decoding uses instruction bits (to specify the format) Machine needs to determine quickly, “This is a 6-byte instruction” “Bits 7-11 specify a register”...

CSE ISA's part 24 MIPS Instruction Formats for instance, “ add r1, r2, r3” has –OP=0, rs=2, rt=3, rd=1, sa=0, funct=32 – opcode (OP) tells the machine which format OP rs rt rdsafunct rs rt immediate target 6 bits5 bits 6 bits r format i format j format

CSE ISA's part 25 VAX Instruction Formats 1 Byte OP code specifies number, type and length of operands Each operand is 1 to many bytes first byte specifies addressing mode “move” can be load, store, mem copy, jump,... depending on operands

CSE ISA's part 26 How Many Operands? Two-address code: target is same as one operand –E.g., x = x + y Three-address code: target can be different –E.g. x = y + z –x86 doesn’t have three-address instructions; others do Some operands are also specified implicitly –“condition code” setting shows if result was +, 0, or – –PowerPC’s “ Branch on count ” uses special “count register” Well-known ISA’s have 0-4 (explicit) operands –PowerPC has “ float multiply add ”, r = x + y * z –It also has fancy bit-manipulation instructions

CSE ISA's part 27 Addressing Modes how do we specify the operand we want? Immediate #25 The operand (25) is part of the instruction RegisterR3 (sometimes written $3) The operand is the contents of register 3 Register indirect M[R3] Use contents of R3 as address into memory; find the operand there. This is a special case of... Base+DisplacementM[R ] Add the displacement (160) to contents of R3, look in that memory location for the operand -If register is PC, this is “PC-relative addressing” All our example ISA’s have the above modes

CSE ISA's part 28 More Addressing Modes (not included in MIPS ISA) Base+IndexM[R3 + R4] Add contents of R3 and R4 to get memory address AutoincrementM[R3++] (or M[R3+=d]) Find value in memory location designated by R3, but also increment R3 -Useful for accessing array elements -Autodecrement is similar Scaled IndexM[R3 + R4*d] (VAX and x86) Multiply R4 by d (d is typically 1,2,4, or 8), then add R3 to get memory address Memory IndirectM[ M[R3] ] (only VAX) Find number in memory location R3, use THAT as address into memory to find

CSE ISA's part 29 VAX addressing mode usage Half of all references were register-mode Remaining half distributed as follows: ProgramBase + Dis- placement ImmediateScaled Index Memory Indirect All Others TEX 56%43%01%0 Spice 58%17%16%6%3% GCC 51%39%6%1%3% similar measurements show that 16 bits is enough for the immediate field 75% to 80% of the time. and 16 bits is enough for displacement 99% of the time.

CSE ISA's part 210 MIPS addressing modes register add $1, $2, $3 immediate addi $1, $2, #35 base + displacement lw $1, 24($2) OPrs rt rdsafunctOPrs rt immediate rt rs immediate value register indirect  disp = 0 absolute  (rs) = 0 rd displacement

CSE ISA's part 211 MIPS ISA decisions instruction length  all instructions are 32 bits long. how many registers?  32 general purpose registers (R0 always 0). where do operands reside?  load-store architecture. instruction formats  three (r-, i-, and j-format). operands  3-address code.  immediate, register, and base+displacement modes.

CSE ISA's part 212 MIPS operations arithmetic –add, subtract, multiply, divide,... logical –and, or, shift left, shift right,... data transfer –load word, store word conditional branch –beq & bne are PC-relative, since most targets are nearby unconditional jump –jump, jump register, branch and link (we’ll study later)

CSE ISA's part 213 Details in choosing operations How do you boot initial program? –Suppose an assembly language program wants to load a register. The only addressing mode is base+displacement. So you need to have a useful value in the base register. How do you get it there?? How can you jump to an arbitrary memory location? –The “jump” instruction needs some of the 32 bits to say “jump”, so there are fewer than 32 bits left to specify which address.

CSE ISA's part 214 Let’s revisit addressing mode... VAX memory references distributed as follows: ProgramBase + Dis- placement ImmediateScaled Index Memory Indirect All Others TEX 56%43%010 Spice 58%17%16%6%3% GCC 51%39%6%1%3% MIPS decided to provide only B+D and Immed formats. Often, Scaled Index and Autoincrement instructions are used for stepping through elements of an array.

CSE ISA's part 215 A[i] in a loop Base-displacement code: –Unoptimized: sll r3 r1 2 add r3 r2 r3 load r4 0(r3) –Optimized: Autoincrement code: VAX scaled index code: Assumptions: r1 is index i r2 holds address of A[0] use r3 for address of A[i] we want to load A[i] into r4

CSE ISA's part 216 PowerPC’s solution Limitation of autoincrement: what if i is increased by something other than one? “load update” – enhanced autoincrement –“ldu r4 16(r3)” increments contents of r3 by 16, then loads r4 with that memory location. –r3 is ready for next iteration of loop

CSE ISA's part 217 MIPS vs PowerPC PowerPC has powerful instructions, e.g. –Load Update –Float Multiply-Add –Branch on Count Example – Dot product – S a[i] * b[i] – Very important - core of Linpack benchmark, used for “Top500” list (see

CSE ISA's part VAX re-implementation Digital team discovered: –20% of VAX instructions were responsible for –60% of microcode –0.2% of executed instructions New design didn’t implement them in HW –“Illegal instruction” caused HW interrupt, then software would execute instructions. –Result (along with some other changes): reduced amount of silicon by factor of 5 reduced performance by only 10% Moral: Smaller can be better!

CSE ISA's part 219 Intel x86 evolution 1978: Intel 8086 announced (16 bit architecture) 1980: The 8087 floating point coprocessor added 1982: The more ops, 24-bit address space 1985: The bit address space + new modes : The 80486, Pentium, and Pentium Pro add a few instructions 1997: MMX is added (Pentium II is P. Pro + MMX) 1999 Pentium III (same architecture) 2000 Pentium 4 (144 new multimedia instructions) 2001 Itanium – new ISA (still can execute x86 code)

CSE ISA's part 220 Anthropology of ISA’s VAX design goal was small code size and simple compilation (since all combinations of adressing modes were possible). –Met goals, but cheap & fast memories and better compilers made goals less important. –But couldn’t pipeline well. Replaced by Alpha (a RISC). x86’s goal was to get to market quickly. –Ugly, but most common instructions can be implemented relatively efficiently. MIPS’ goal: simplicity. Reflects university heritage. PowerPC: super-RISC. Compiler group influence.

CSE ISA's part 221 MIPS ISA Tradeoffs What if? –64 registers –20-bit immediates –4 operand instruction (e.g. Y = X + AB) OP rs rt rdsafunct rs rt immediate target 6 bits5 bits 6 bits

CSE ISA's part 222 Key Points MIPS is a general-purpose register, load-store, fixed-instruction-length architecture. MIPS is optimized for fast pipelined performance, not for low instruction count Four principles of IS architecture –regularity produces simplicity –smaller is faster –good design demands compromise –make the common case fast

CSE ISA's part 223 Recent developments VLIW – Very Long Instruction Word –1 “packet” has multiple instructions –Tera MTA has 26, 21, and 14 bit-long RISC operations (plus 3 “lookahead” bits) in 64 bits –Intel Itanium has three 41-bit RISC ops (plus 5 “type” bits) in 128-bit packet JVM (Java Virtual Machine) –a new level of abstraction between Java language and ISA –stack based – is this a good choice??