ECE 232 L3 InstructionSet.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 3.

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.
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.
EECC551 - Shaaban #1 Lec # 2 Fall Instruction Set Architecture (ISA) “... the attributes of a [computing] system as seen by the programmer,
INSTRUCTION SET ARCHITECTURES
CpE442 Intro. To Computer Architecture CpE 442 Introduction To Computer Architecture Lecture 1 Instructor: H. H. Ammar These slides are based on the lecture.
1 CENG 450 Computer Systems and Architecture Lecture 4 Amirali Baniasadi
CMSC411/Computer Architecture These slides and all associated material are © 2003 by J. Six and are available only for students enrolled in CMSC411. Introduction.
COMP381 by M. Hamdi 1 Instruction Set Architectures.
Recap.
ECE 232 L2 Basics.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 2 Computer.
CS472 COMPUTER ARCHITECTURE AND ASSEMBLY LANGUAGE –Bruce D’Ambrosio Dearborn, –Text: Computer Organization and Design.
ECE C61 Computer Architecture Lecture 3 – Instruction Set Architecture
CS / Schlesinger Lec1.1 1/20/99©UCB Spring 1999 Computer Architecture Lecture 1 Introduction and Five Components of a Computer Spring, 1999 Arie Schlesinger.
1 CSE SUNY New Paltz Chapter 1 Introduction CSE-45432Introduction to Computer Architecture Dr. Izadi.
Classifying Instruction Set Architectures
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.
ECE 232 L5 Assembl.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 5 MIPS Assembly.
CPE442 Lec 3 ISA.1 Intro to Computer Architectures Instruction Set Design instruction set software hardware.
CENG311 Computer Architecture Kayhan Erciyes. CS231 Assembly language and Digital Circuits Instructor:Kayhan Erciyes Office:
CpE442 Intro. To Computer Architecture CpE 442 Introduction To Computer Architecture Lecture 1 Instructor: H. H. Ammar These slides are based on the lecture.
Summary: Computer System Components Proc Caches Busses Memory I/O Devices: Controllers adapters Disks Displays Keyboards Networks.
Digital Systems Design L01 Introduction.1 Digital Systems Design Lecture 01: Introduction Adapted from: Mary Jane Irwin ( )
Cs 152 L1 Intro.1 Patterson Fall 97 ©UCB What is “Computer Architecture” Computer Architecture = Instruction Set Architecture + Machine Organization.
Patterson Fall 97 ©UCB CS/EE 362 Hardware Fundamentals Lecture 8 (Chapter 1: Hennessy and Patterson) Winter Quarter 1998 Chris Myers.
Instruction Set Architecture
Machine Instruction Characteristics
CPE442 Lec 3 ISA.1 Intro to Computer Architectures Instruction Set Design instruction set software hardware.
International Technology University CEN 951 Computer Architecture Lecture 2 Five Components of a Computer.
Implementation of a Stored Program Computer ITCS 3181 Logic and Computer Systems 2014 B. Wilkinson Slides2.ppt Modification date: Oct 16,
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.
Lecture 4: MIPS Subroutines and x86 Architecture Professor Mike Schulte Computer Architecture ECE 201.
1 (Based on text: David A. Patterson & John L. Hennessy, Computer Organization and Design: The Hardware/Software Interface, 3 rd Ed., Morgan Kaufmann,
Computer Organization and Design Computer Abstractions and Technology
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
Lecture 11: 10/1/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
S.J.Lee 1 컴퓨터 구조 강좌개요 순천향대학교 컴퓨터학부 이 상 정. S.J.Lee 2 교 재교 재 J.L.Hennessy & D.A.Patterson Computer Architecture a Quantitative Approach, Second Edition.
Csci 136 Computer Architecture II – Summary of MIPS ISA Xiuzhen Cheng
©UCB Fall CS/EE 362 Hardware Fundamentals Lecture 11 (Chapter 3: Hennessy and Patterson) Winter Quarter 1998 Chris Myers.
CS 211: Computer Architecture Lecture 2 Instructor: Morris Lancaster.
1 chapter 1 Computer Architecture and Design ECE4480/5480 Computer Architecture and Design Department of Electrical and Computer Engineering University.
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 1: Computer Architecture and Technology Professor Mike Schulte Computer Architecture ECE 201.
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
DR. SIMING LIU SPRING 2016 COMPUTER SCIENCE AND ENGINEERING UNIVERSITY OF NEVADA, RENO Session 7, 8 Instruction Set Architecture.
CSIE30300 Computer Architecture Unit 01: Introduction Hsin-Chou Chi [Adapted from material by and
Lecture 2: Instruction Set Architecture part 1 (Introduction) Mehran Rezaei.
S.J.Lee 1 Chapter 2: Instruction Set Principles and Examples 순천향대학교 컴퓨터학부 이 상 정 Adapted from “
EEL5708/Bölöni Lec 3.1 Fall 2004 Sept 1, 2004 Lotzi Bölöni Fall 2004 EEL 5708 High Performance Computer Architecture Lecture 3 Review: Instruction Sets.
Cs 152 L1 Intro.1 Patterson Fall 97 ©UCB CS152 Computer Architecture and Engineering Lecture 1 August 27, 1997 Dave Patterson (http.cs.berkeley.edu/~patterson)
Lecture 12: 10/3/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
A Closer Look at Instruction Set Architectures
Chapter 2: Instruction Set Principles and Examples
Prof. Sirer CS 316 Cornell University
ECEG-3202 Computer Architecture and Organization
Welcome to Architectures of Digital Systems
Computer Architecture
ECEG-3202 Computer Architecture and Organization
Prof. Sirer CS 316 Cornell University
Presentation transcript:

ECE 232 L3 InstructionSet.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 3 Instruction format Maciej Ciesielski

ECE 232 L3 InstructionSet.2 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Outline °What is Computer Architecture °Five components of a Computer Stored-program concept Von Neumann vs Harvard architecture °Basic data and control flow °Instruction set architecture Addressing classes, modes Instruction formats Typical operations °Example organization

ECE 232 L3 InstructionSet.3 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Typical computer structure (stored-program) °von Neumann vs. Harvard architecture instruction data Memory Registers Controller shifter bus Abus B R0 R1 R31 ALU condition ALU control decoder bus C DP control Data Path (DP)

ECE 232 L3 InstructionSet.4 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Summary: Computer System Components Proc Caches Busses Memory I/O Devices: Controllers adapters Disks Displays Keyboards Networks °All have interfaces & organizations

ECE 232 L3 InstructionSet.5 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Execution Cycle Instruction Fetch Instruction Decode Operand Fetch Execute Result Store Next Instruction Obtain instruction from program storage Determine required actions and instruction size Locate and obtain operand data Compute result value or status Deposit results in storage for later use Determine successor instruction

ECE 232 L3 InstructionSet.6 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Instruction Set Architecture: What Must be Specified? ° 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 Instruction Fetch Instruction Decode Operand Fetch Execute Result Store Next Instruction

ECE 232 L3 InstructionSet.7 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers 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?

ECE 232 L3 InstructionSet.8 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Comparing Number of Instructions Code sequence for C = A + B for four classes of instruction sets: StackAccumulatorRegister (register-memory) Register (load-store) Load A Add B Store C Load R1,A Add R1,B Store C, R1 Push A Push B Add Pop C Load R1,A Load R2,B Add R3,R1,R2 Store C,R3

ECE 232 L3 InstructionSet.9 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers 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)

ECE 232 L3 InstructionSet.10 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers MIPS I Registers °Programmable storage 2^32 x bytes of memory 31 x 32-bit GPRs (R0 = 0) 32 x 32-bit FP regs (paired DP) HI, LO, PC

ECE 232 L3 InstructionSet.11 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers MIPS R3000 Instruction Set Architecture (Summary) °Instruction Categories Load/Store Computational Jump and Branch Floating Point -coprocessor Memory Management Special R0 - R31 PC HI LO OP rs rt rdsafunct rs rt immediate jump target 3 Instruction Formats: all 32 bits wide Registers

ECE 232 L3 InstructionSet.12 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Memory Addressing ° Since 1980 almost every machine uses addresses to level of 8-bits (byte-addressable) ° 2 questions for design of ISA: Since one 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 ? (alignment issue) xx+1x+2x+3x+4 byte address word

ECE 232 L3 InstructionSet.13 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Addressing Objects: Endianess and Alignment °Big Endian: address of most significant byte = word address (xx00 = Big End of word) IBM 360/370, Motorola 68k, MIPS, Sparc, HP PA °Little Endian: address of least significant byte = word address ( 00xx = Little End of word) Intel 80x86, DEC Vax, DEC Alpha (Windows NT ) msblsb little endian byte # big endian byte # Alignment: require that objects fall on address that is multiple of their size Aligned Not Aligned

ECE 232 L3 InstructionSet.14 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Addressing Modes Addressing modeExampleMeaning RegisterAdd R4,R3 R4  R4+R3 ImmediateAdd R4,#3 R4  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  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?

ECE 232 L3 InstructionSet.15 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Addressing Mode Usage? (ignore register mode) 3 programs measured on machine with all address modes (VAX) Displacement: 42% avg, 32% to 55% 75% Immediate: 33% avg, 17% to 43% 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 85%

ECE 232 L3 InstructionSet.16 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers 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

ECE 232 L3 InstructionSet.17 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Addressing summary Immediate Size? 50% to 60% fit within 8 bits 75% to 80% fit within 16 bits Need mechanism to fit 32+ bits 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

ECE 232 L3 InstructionSet.18 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Generic Examples of Instruction Format Widths Variable: Fixed: Hybrid: … …

ECE 232 L3 InstructionSet.19 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers 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

ECE 232 L3 InstructionSet.20 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers MIPS Addressing Modes/Instruction Formats oprsrtrd register Register (direct ) Base+index immedoprsrt Immediate PC-relative All instructions are 32-bit wide immedoprsrt register + Memory Register Indirect? immedoprsrt PC Memory +

ECE 232 L3 InstructionSet.21 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Typical Operations (little change since 1960) Data Movement Load (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) Arithmetic integer (binary + decimal) or FP Add, Subtract, Multiply, Divide Logical not, and, or, set, clear Shift shift left/right, rotate left/right Control (Jump/Branch) unconditional, conditional Subroutine Linkage call, return Interrupt trap, return Synchronization test & set (atomic r-m-w) String search, translate Graphics (MMX) parallel subword ops (4 16bit add)

ECE 232 L3 InstructionSet.22 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Top 10 80x86 Instructions Rank InstructionInteger average % total executed Simple instructions dominate instruction frequency 1load22% 2conditional branch20% 3compare16% 4store12% 5add8% 6and6% 7sub5% 8move register-register4% 9call1% 10 return1% Total96%

ECE 232 L3 InstructionSet.23 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers 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;

ECE 232 L3 InstructionSet.24 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers 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

ECE 232 L3 InstructionSet.25 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers 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

ECE 232 L3 InstructionSet.26 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Example Organization °TI SuperSPARC tm TMS390Z50 in Sun SPARCstation20 Floating-point Unit Integer Unit Inst Cache Ref MMU Data Cache Store Buffer Bus Interface SuperSPARC L2 $ CC MBus Module MBus L64852 MBus control M-S Adapter SBus DRAM Controller SBus DMA SCSI Ethernet STDIO serial kbd mouse audio RTC Boot PROM Floppy SBus Cards

ECE 232 L3 InstructionSet.27 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers The SPARCstation 20 Memory Controller SIMM Bus Memory SIMMs Slot 1MBu s Slot 0MBu s MSBI Slot 1SBusSlot 0SBusSlot 3SBusSlot 2SBus MBus SECMACIO Disk Tape SCSI Bus SBus Keyboard & Mouse Floppy Disk External Bus SPARCstation 20

ECE 232 L3 InstructionSet.28 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers The Underlying Interconnect SPARCstation 20 Memory Controller SIMM Bus MSBI Processor/Mem Bus: MBus SECMACIO Standard I/O Bus: Sun’s High Speed I/O Bus: SBus Low Speed I/O Bus: External Bus SCSI Bus

ECE 232 L3 InstructionSet.29 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Processor and Caches SPARCstation 20 Slot 1MBu s Slot 0MBu s MBus Module External Cache DatapathRegisters Internal Cache Control Processor

ECE 232 L3 InstructionSet.30 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Memory SPARCstation 20 Memory Controller Memory SIMM Bus SIMM Slot 0SIMM Slot 1SIMM Slot 2SIMM Slot 3SIMM Slot 4SIMM Slot 5SIMM Slot 6SIMM Slot 7 DRAM SIMM DRAM

ECE 232 L3 InstructionSet.31 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Input and Output (I/O) Devices SPARCstation 20 Slot 1SBusSlot 0SBusSlot 3SBusSlot 2SBus SECMACIO Disk Tape SCSI Bus SBus Keyboard & Mouse Floppy Disk External Bus °SCSI Bus: Standard I/O Devices °SBus: High Speed I/O Devices °External Bus: Low Speed I/O Device