©UCB Fall 1997 1 CS/EE 362 Hardware Fundamentals Lecture 11 (Chapter 3: Hennessy and Patterson) Winter Quarter 1998 Chris Myers.

Slides:



Advertisements
Similar presentations
Chapter 3 Instruction Set Architecture Advanced Computer Architecture COE 501.
Advertisements

CEG3420 Lec2.1 ©UCB Fall 1997 ISA Review CEG3420 Computer Design Lecture 2.
CPE 631: Instruction Set Principles and Examples Electrical and Computer Engineering University of Alabama in Huntsville Aleksandar Milenkovic,
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.
Lecture 3: Instruction Set Principles Kai Bu
EECC551 - Shaaban #1 Lec # 2 Fall Instruction Set Architecture (ISA) “... the attributes of a [computing] system as seen by the programmer,
INSTRUCTION SET ARCHITECTURES
1 CENG 450 Computer Systems and Architecture Lecture 4 Amirali Baniasadi
CS1104: Computer Organisation
ECE 232 L3 InstructionSet.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 3.
COMP381 by M. Hamdi 1 Instruction Set Architectures.
Recap.
ECE C61 Computer Architecture Lecture 3 – Instruction Set Architecture
What is an instruction set?
1 RISC Machines l RISC system »instruction –standard, fixed instruction format –single-cycle execution of most instructions –memory access is available.
ECE 4436ECE 5367 ISA I. ECE 4436ECE 5367 CPU = Seconds= Instructions x Cycles x Seconds Time Program Program Instruction Cycle CPU = Seconds= Instructions.
CPE442 Lec 3 ISA.1 Intro to Computer Architectures Instruction Set Design instruction set software hardware.
Machine Instruction Characteristics
CPE442 Lec 3 ISA.1 Intro to Computer Architectures Instruction Set Design instruction set software hardware.
1 Copyright © 2011, Elsevier Inc. All rights Reserved. Appendix A Authors: John Hennessy & David Patterson.
1 Appendix B Classifying Instruction Set Architecture Memory addressing mode Operations in the instruction set Control flow instructions Instruction format.
Dr Mohamed Menacer College of Computer Science and Engineering Taibah University CS-334: Computer.
Homework Problems 1. M1 runs the program P in 1.4 * 9 * ns or ns M2 runs the program P in 1.6*9800*10ns or ns Hence M2 is faster by.
1  Modified from  1998 Morgan Kaufmann Publishers Chapter 2: Instructions: Language of the Machine citation and following credit line is included: 'Copyright.
Classifying GPR Machines TypeNumber of Operands Memory Operands Examples Register- Register 30 SPARC, MIPS, etc. Register- Memory 21 Intel 80x86, Motorola.
Computer architecture Lecture 11: Reduced Instruction Set Computers Piotr Bilski.
Chapter 5 A Closer Look at Instruction Set Architectures.
1 Computer Architecture COSC 3430 Lecture 3: Instructions.
Chapter 2-2 Assembly Instructions Number Systems Number Systems Assembly Instructions Assembly Instructions Branch Branch Next Lecture Next Lecture  Addressing.
Instruction Set Architecture The portion of the machine visible to the programmer Issues: Internal storage model Addressing modes Operations Operands Encoding.
CS2100 Computer Organisation
Computer Architecture and Organization
Computer Architecture EKT 422
Lecture 11: 10/1/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
Csci 136 Computer Architecture II – Summary of MIPS ISA Xiuzhen Cheng
Lecture 04: Instruction Set Principles Kai Bu
CS 211: Computer Architecture Lecture 2 Instructor: Morris Lancaster.
Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown.
Adapted from Computer Organization and Design, Patterson & Hennessy, UCB ECE232: Hardware Organization and Design Part 5: MIPS Instructions I
Lecture 5 A Closer Look at Instruction Set Architectures Lecture Duration: 2 Hours.
EEL5708/Bölöni Lec 3.1 Fall 2006 Sept 1, 2006 Lotzi Bölöni EEL 5708 High Performance Computer Architecture Lecture 3 Review: Instruction Sets.
What is a program? A sequence of steps
Group # 3 Jorge Chavez Henry Diaz Janty Ghazi German Montenegro.
명령어 세트 아키텍처 순천향대학교 정보기술공학부 이상정 컴퓨터구조특론 1 순천향대학교 정보기술공학부 이 상 정 2 소개  명령어 형식 기술 연산의 종류 (Operation) 오퍼랜드의 저장 위치 자료형 및 크기 분기 타겟 Instruction Fetch.
DR. SIMING LIU SPRING 2016 COMPUTER SCIENCE AND ENGINEERING UNIVERSITY OF NEVADA, RENO Session 7, 8 Instruction Set Architecture.
Instruction Sets. Instruction set It is a list of all instructions that a processor can execute. It is a list of all instructions that a processor can.
S.J.Lee 1 Chapter 2: Instruction Set Principles and Examples 순천향대학교 컴퓨터학부 이 상 정 Adapted from “
CSC 221 Computer Organization and Assembly Language Lecture 06: Machine Instruction Characteristics.
Lecture 12: 10/3/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
A Closer Look at Instruction Set Architectures
Chapter 2: Instruction Set Principles and Examples
A Closer Look at Instruction Set Architectures
A Closer Look at Instruction Set Architectures: Expanding Opcodes
The University of Adelaide, School of Computer Science
ECEG-3202 Computer Architecture and Organization
Chapter 9 Instruction Sets: Characteristics and Functions
A Closer Look at Instruction Set Architectures Chapter 5
Computer Instructions
Computer Architecture
ECEG-3202 Computer Architecture and Organization
Chapter 10 Instruction Sets: Characteristics and Functions
Presentation transcript:

©UCB Fall CS/EE 362 Hardware Fundamentals Lecture 11 (Chapter 3: Hennessy and Patterson) Winter Quarter 1998 Chris Myers

©UCB Fall Instruction Set Architecture: What Must be Specified? Instruction Fetch Instruction Decode Operand Fetch Execute Result Store Next Instruction ° Instruction Format or Encoding – how is it decoded? ° Location of operands and result – where other than memory? – how many explicit operands? – how are memory operands located? – which can or cannot be in memory? ° Data type and Size ° Operations – what are supported ° Successor instruction – jumps, conditions, branches - fetch-decode-execute is implicit!

©UCB Fall Basic ISA Classes Accumulator (1 register): 1 addressadd Aacc  acc + mem[A] 1+x addressaddx Aacc  acc + mem[A + x] Stack: 0 addressaddtos  tos + next General Purpose Register: 2 addressadd A BEA(A)  EA(A) + EA(B) 3 addressadd A B CEA(A)  EA(B) + EA(C) Load/Store: 3 addressadd Ra Rb RcRa  Rb + Rc load Ra RbRa  mem[Rb] store Ra Rbmem[Rb]  Ra Comparison: Bytes per instruction? Number of Instructions? Cycles per instruction?

©UCB Fall Comparing Number of Instructions ° Code sequence for C = A + B for four classes of instruction sets: StackAccumulatorRegister (register-memory)(load-store) Push ALoad ALoad R1,A Push BAdd BAdd R1,BLoad R2,B AddStore CStore C, R1Add R3,R1,R2 Pop CStore C,R3

©UCB Fall General Purpose Registers Dominate ° all machines use general purpose registers °Advantages of registers registers are faster than memory registers are easier for a compiler to use -e.g., (A*B) – (C*D) – (E*F) can do multiplies in any order vs. stack registers can hold variables -memory traffic is reduced, so program is sped up (since registers are faster than memory) -code density improves (since register named with fewer bits than memory location)

©UCB Fall Memory Addressing °Since 1980 almost every machine uses addresses to level of 8-bits (byte) °2 questions for design of ISA: Since could read a 32-bit word as four loads of bytes from sequential byte addresses or as one load word from a single byte address, how do byte addresses map onto words? Can a word be placed on any byte boundary?

©UCB Fall Addressing Objects: Endianess and Alignment °Big Endian: address of most significant IBM 360/370, Motorola 68k, MIPS, Sparc, HP PA °Little Endian:address of least significant Intel 80x86, DEC Vax, DEC Alpha (Windows NT) msblsb little endian byte big endian byte 0 Alignment: require that objects fall on address that is multiple of their size Aligned Not Aligned

©UCB Fall Addressing Modes Addressing modeExampleMeaning RegisterAdd R4,R3R4  R4+R3 ImmediateAdd R4,#3R4  R4+3 DisplacementAdd R4,100(R1)R4  R4+Mem[100+R1] Register indirectAdd R4,(R1)R4  R4+Mem[R1] Indexed / BaseAdd R3,(R1+R2)R3  R3+Mem[R1+R2] Direct or absoluteAdd R1,(1001)R1  R1+Mem[1001] Memory indirectAdd  R1+Mem[Mem[R3]] Auto-incrementAdd R1,(R2)+R1  R1+Mem[R2]; R2  R2+d Auto-decrementAdd R1,–(R2)R2  R2–d; R1  R1+Mem[R2] Scaled Add R1,100(R2)[R3]R1  R1+Mem[100+R2+R3*d] Why Auto-increment/decrement? Scaled?

©UCB Fall Addressing Mode Usage? (ignore register mode) 3 programs --- Displacement 42% avg --- Immediate: 33% avg, 17% to 43% 75% 88% --- Register deferred (indirect): 13% avg, 3% to 24% --- Scaled: 7% avg, 0% to 16% --- Memory indirect: 3% avg, 1% to 6% --- Misc:2% avg, 0% to 3% 75% displacement & immediate 88% displacement, immediate & register indirect

©UCB Fall Displacement Address Size? °Avg. of 5 SPECint92 programs v. avg. 5 SPECfp92 programs °X-axis is in powers of 2: 4 => addresses > 2 3 (8) and Š 2 4 (16) °1% of addresses > 16-bits ° bits of displacement needed Address Bits

©UCB Fall Immediate Size? 50% to 60% fit within 8 bits 75% to 80% fit within 16 bits

©UCB Fall Addressing Summary Data Addressing modes that are important: Displacement, Immediate, Register Indirect Displacement size should be 12 to 16 bits Immediate size should be 8 to 16 bits

©UCB Fall Generic Examples of Instruction Format Widths Variable: Fixed: Hybrid: … …

©UCB Fall Summary of Instruction Formats If code size is most important, use variable length instructions If performance is over is most important, use fixed length instructions Recent embedded machines (ARM, MIPS) added optional mode to execute subset of 16-bit wide instructions (Thumb, MIPS16); per procedure decide performance or density

©UCB Fall Instruction Format If have many memory operands per instructions and many addressing modes, =>Address Specifier per operand If have load-store machine with 1 address per instr. and one or two addressing modes, => encode addressing mode in the opcode

©UCB Fall Typical Operations (little change since 1960) Data MovementLoad (from memory) Store (to memory) memory-to-memory move register-to-register move input (from I/O device) output (to I/O device) push, pop (to/from stack) Arithmeticinteger (binary + decimal) or FP Add, Subtract, Multiply, Divide Logicalnot, and, or, set, clear Shiftshift left/right, rotate left/right Control (Jump/Branch)unconditional, conditional Subroutine Linkagecall, return Interrupttrap, return Synchronizationtest & set (atomic r-m-w) Stringsearch, translate Graphics (MMX)parallel subword ops (4 16bit add)

©UCB Fall Top 10 80x86 Instructions

©UCB Fall Operation Summary Support these simple instructions, since they will dominate the number of instructions executed: load, store, add, subtract, move register-register, and, shift, compare equal, compare not equal, branch, jump, call, return;

©UCB Fall Compilers and Instruction Set Architectures Ease of compilation ° orthogonality: no special registers, few special cases, all operand modes available with any data type or instruction type ° completeness: support for a wide range of operations and target applications ° regularity: no overloading for the meanings of instruction fields ° streamlined: resource needs easily determined Register Assignment is critical too ° Easier if lots of registers

©UCB Fall Summary of Compiler Considerations Provide at least 16 general purpose registers plus separate floating-point registers, Be sure all addressing modes apply to all data transfer instructions, Aim for a minimalist instruction set.

©UCB Fall Data Types Bit: 0, 1 Bit String: sequence of bits of a particular length 4 bits is a nibble 8 bits is a byte 16 bits is a half-word 32 bits is a word 64 bits is a double-word Character: ASCII 7 bit code Decimal: digits 0-9 encoded as 0000b thru 1001b two decimal digits packed per 8 bit byte Integers: 2's Complement Floating Point: Single Precision Double Precision Extended Precision M x R E How many +/- #'s? Where is decimal pt? How are +/- exponents represented? exponent base mantissa

©UCB Fall Operand Size Usage Support these data sizes and types: 8-bit, 16-bit, 32-bit integers and 32-bit and 64-bit IEEE 754 floating point numbers

©UCB Fall Methods of Testing Condition ° Condition Codes Processor status bits are set as a side-effect of arithmetic instructions (possibly on Moves) or explicitly by compare or test instructions. ex:add r1, r2, r3 bz label ° Condition Register Ex:cmp r1, r2, r3 bgt r1, label ° Compare and Branch Ex:bgt r1, r2, label

©UCB Fall Conditional Branch Distance Distance from branch in instructions 2i => Š ±2 i-1 & > 2 i-2 25% of integer branches are > 2 to Š 4 or -2 to -4 instructions

©UCB Fall Conditional Branch Addressing PC-relative since most branches short distance At least 8 bits suggested (± 128 instructions) Compare Equal/Not Equal most important for integer programs (86%)

©UCB Fall Summary: Instruction set design (MIPS) °Use general purpose registers with a load-store architecture: YES °Provide at least 16 general purpose registers plus separate floating- point registers: 31 GPR & 32 FPR °Support basic addressing modes: displacement (with an offset size of 12 to 16 bits), immediate (size 8 to 16 bits), and register deferred: YES: 16 bits for imm., displacement (disp=0 => register deferred) ° All addressing modes apply to all data transfer instructions : YES °Use fixed instruction encoding if interested in performance and use variable instruction encoding if interested in code size : Fixed °Support these data sizes and types: 8-bit, 16-bit, 32-bit integers and 32-bit and 64-bit IEEE 754 floating point numbers: YES °Support simple instructions, since they are dominate: 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, and return: YES, 16b ° Aim for a minimalist instruction set: YES