COSC 6385 Computer Architecture - Instruction Set Principles

Similar documents
COSC 6385 Computer Architecture. Defining Computer Architecture

COSC 6385 Computer Architecture. Instruction Set Architectures

Page 1. Structure of von Nuemann machine. Instruction Set - the type of Instructions

Instruction Set Principles and Examples. Appendix B

CPU Architecture and Instruction Sets Chapter 1

CISC 662 Graduate Computer Architecture. Classifying ISA. Lecture 3 - ISA Michela Taufer. In a CPU. From Source to Assembly Code

CS4617 Computer Architecture

Lecture 4: Instruction Set Architecture

CSCE 5610: Computer Architecture

Chapter 2. Instruction Set Principles and Examples. In-Cheol Park Dept. of EE, KAIST

INSTITUTO SUPERIOR TÉCNICO. Architectures for Embedded Computing

Instruction Set Design

Chapter 2A Instructions: Language of the Computer

Computer Systems Architecture I. CSE 560M Lecture 3 Prof. Patrick Crowley

CSIS1120A. 10. Instruction Set & Addressing Mode. CSIS1120A 10. Instruction Set & Addressing Mode 1

Announcements HW1 is due on this Friday (Sept 12th) Appendix A is very helpful to HW1. Check out system calls

Instruction Set Architecture. "Speaking with the computer"

Instruction Set Architecture (ISA)

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008

Typical Processor Execution Cycle

CHAPTER 5 A Closer Look at Instruction Set Architectures

Topics Power tends to corrupt; absolute power corrupts absolutely. Computer Organization CS Data Representation

CPE300: Digital System Architecture and Design

Course Administration

EITF20: Computer Architecture Part2.1.1: Instruction Set Architecture

ISA and RISCV. CASS 2018 Lavanya Ramapantulu

Lecture 3 Machine Language. Instructions: Instruction Execution cycle. Speaking computer before voice recognition interfaces

55:132/22C:160, HPCA Spring 2011

CHAPTER 5 A Closer Look at Instruction Set Architectures

Chapter 2: Instructions How we talk to the computer

ENGN1640: Design of Computing Systems Topic 03: Instruction Set Architecture Design

INSTITUTO SUPERIOR TÉCNICO. Architectures for Embedded Computing

ECE232: Hardware Organization and Design

Understand the factors involved in instruction set

Instruction Set II. COMP 212 Computer Organization & Architecture. COMP 212 Fall Lecture 7. Instruction Set. Quiz. What is an Instruction Set?

Math 230 Assembly Programming (AKA Computer Organization) Spring MIPS Intro

Today s topics. MIPS operations and operands. MIPS arithmetic. CS/COE1541: Introduction to Computer Architecture. A Review of MIPS ISA.

Review Questions. 1 The DRAM problem [5 points] Suggest a solution. 2 Big versus Little Endian Addressing [5 points]

Chapter 5. A Closer Look at Instruction Set Architectures

CSE 141 Computer Architecture Spring Lecture 3 Instruction Set Architecute. Course Schedule. Announcements

Chapter 1. Computer Abstractions and Technology. Lesson 3: Understanding Performance

EITF20: Computer Architecture Part2.1.1: Instruction Set Architecture

COS 140: Foundations of Computer Science

Chapter 5. A Closer Look at Instruction Set Architectures

CA226 Advanced Computer Architecture

Lecture 3: The Instruction Set Architecture (cont.)

Lecture 3: The Instruction Set Architecture (cont.)

ELEC / Computer Architecture and Design Fall 2013 Instruction Set Architecture (Chapter 2)

The MIPS Instruction Set Architecture

Chapter 2. Instructions: Language of the Computer. Adapted by Paulo Lopes

CSCI 402: Computer Architectures. Instructions: Language of the Computer (1) Fengguang Song Department of Computer & Information Science IUPUI

Chapter 5. A Closer Look at Instruction Set Architectures. Chapter 5 Objectives. 5.1 Introduction. 5.2 Instruction Formats

Computer Organization CS 206 T Lec# 2: Instruction Sets

Chapter 5. A Closer Look at Instruction Set Architectures

CHAPTER 5 A Closer Look at Instruction Set Architectures

Graduate Computer Architecture. Chapter 2. Instruction Set Principles

COMPUTER ORGANIZATION & ARCHITECTURE

Computer Architecture

Computer Organization MIPS ISA

ECE331: Hardware Organization and Design

CENG3420 Lecture 03 Review

Instruction Set Architectures Part I: From C to MIPS. Readings:

Machine Language Instructions Introduction. Instructions Words of a language understood by machine. Instruction set Vocabulary of the machine

2. ADDRESSING METHODS

Computer Organization and Structure. Bing-Yu Chen National Taiwan University

Lecture 4: Instruction Set Design/Pipelining

EC-801 Advanced Computer Architecture

CPE 631 Lecture 08: Virtual Memory

CSCI 402: Computer Architectures. Instructions: Language of the Computer (3) Fengguang Song Department of Computer & Information Science IUPUI.

Systems Architecture I

Computer Architecture and Organization. Instruction Sets: Addressing Modes and Formats

Lecture 2. Instructions: Language of the Computer (Chapter 2 of the textbook)

ECE232: Hardware Organization and Design

Central Processing Unit

Lecture 5: Instruction Set Architectures II. Take QUIZ 2 before 11:59pm today over Chapter 1 Quiz 1: 100% - 29; 80% - 25; 60% - 17; 40% - 3

COMPUTER ORGANIZATION AND DESIGN

Instruction Sets: Characteristics and Functions Addressing Modes

MIPS History. ISA MIPS Registers

EC 413 Computer Organization

COMP2121: Microprocessors and Interfacing. Instruction Set Architecture (ISA)

SPARC Architecture. SPARC Registers

Computer Organization and Structure. Bing-Yu Chen National Taiwan University

CSE Lecture In Class Example Handout

CHAPTER 2: INSTRUCTION SET PRINCIPLES. Prepared by Mdm Rohaya binti Abu Hassan

EEC 581 Computer Architecture Lecture 1 Review MIPS

ECE 154A Introduction to. Fall 2012

Instructions: Language of the Computer

Lectures 3-4: MIPS instructions

Lecture 4: Instruction Set Architectures. Review: latency vs. throughput

Computer Science and Engineering 331. Midterm Examination #1. Fall Name: Solutions S.S.#:

Overview. EE 4504 Computer Organization. Much of the computer s architecture / organization is hidden from a HLL programmer

Chapter 2 Instruction: Language of the Computer

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

Instruction Sets Ch 9-10

Instruction Sets Ch 9-10

William Stallings Computer Organization and Architecture 8 th Edition. Chapter 11 Instruction Sets: Addressing Modes and Formats

Instruction Set. Instruction Sets Ch Instruction Representation. Machine Instruction. Instruction Set Design (5) Operation types

M1 Computers and Data

17. Instruction Sets: Characteristics and Functions

CSCI 402: Computer Architectures. Instructions: Language of the Computer (1) Fengguang Song Department of Computer & Information Science IUPUI

Transcription:

COSC 6385 Computer rchitecture - Instruction Set Principles Fall 2006

Organizational Issues September 4th: no class (labor day holiday) Classes of onday Sept. 11 th and Wednesday Sept. 13 th have to be rescheduled: 1 st lecture on Friday, Sept. 15 th? How many people have classes directly after the Computer rchitecture class? New online book about computer architecture: http://www.ourebook.org Please handle with caution Hennessy/Patterson still considered more reliable.

mdahl s Law revisited (I) 6 Speedup overall = (1 Fraction enh 1 ) + Fraction Speedup enh enh 5 Speedup total 4 3 2 Fraction enhanced: 20% Fraction enhanced: 40% Fraction enhanced: 60% Fraction enhanced: 80% 1 0 0 20 40 60 80 100 Speedup enhanced

mdahl s Law revisited (II) Speedup according to mdahl's Law 12 10 Speedup total 8 6 4 Speedup enhanced: 2 Speedup enhanced: 4 Speedup enhanced: 10 2 0 0 0.2 0.4 0.6 0.8 1 Fraction enhanced

Instruction Set rchitecture (IS) Definition on Wikipedia: Part of the Computer rchitecture related to programming Defines set of operations, instruction format, hardware supported data types, named storage, addressing modes, sequencing Includes a specification of the set of opcodes (machine language) - native commands implemented by a particular CPU design

Instruction Set rchitecture (II) IS to be distinguished from the micro-architecture set of processor design techniques used to implement an IS Example: Intel Pentium and D thlon support a nearly identical IS, but have completely different microarchitecture

IS Specification Relevant features for distinguishing IS s Internal storage emory addressing Type and size of operands Operations Instructions for Flow Control Encoding of the IS

Internal storage Stack architecture: operands are implicitly on the top of the stack ccumulator architecture: one operand is implicitly the accumulator General purpose register architectures: operands have to be made available by explicit load operations Dominant form in today s systems

Internal storage (II) Example: C= +B Stack: Push Push B dd Pop C ccumulator: Load dd B Store C Load-Store: Load R1, Load R2,B dd R3,R1,R2 Store R3,C

Internal storage (III) dvantage of general purpose register architectures vs. stack architectures: Registers are fast Easier and faster to evaluate complex expressions, e.g. (*B)-(B*C)-(*D) Registers can hold temporary variables Reduces memory traffic register can be named with fewer bits than main memory

ddressing modes How does an IS specify the address an object will access? ddressing mode Register Immediate Register indirect Displacement emory indirect Example instruction dd R4,R3 dd R4,#3 dd R4,(R1) dd R4,100(R1) dd R4, @R3 eaning Regs[R4] Regs[R4]+Regs[R3] Regs[R4] Regs[R4]+3 Regs[R4] Regs[R4]+ em[regs[r1]] Regs[R4] Regs[R4]+ em[100+regs[r1]] Regs[R4 ] em[em[regs[r3]]]

ddressing modes (II) ddressing modes must match bility of compilers to use them Hardware characteristics Which modes are most commonly used? Displacement Immediate Register indirect Size of address for displacement mode? Typically 12-16 bits Size of the immediate field? 8-16 bits

Internal storage (IV) Two major GPR architectures: 2 or 3 operands for LU instructions 3 operands: 2 source, 1 result 2 operands: 1 operand is both source and result How many operands can be memory addresses? No. of memory addresses 0 1 2 ax. no. of operands 3 2 2 rchitecture Register-register (load-store arch.) Register-memory emory-memory 3 3 emory-memory

Byte order (I) 2 different conventions for ordering bytes within an integer/floating point number Big endian (IB Power PC, SUN Sparc, SGI IPS, etc.) 3 2 1 0 Little endian (Intel Pentium, D thlon, etc.) 0 1 2 3 Example: representation of the number 1 : Big endian Little endian 00000000 00000000 00000000 00000001 00000001 00000000 00000000 00000000 little end big end

Byte order (II) For communication between unknown architectures over the internet: Internet Protocol (IP) defines a network byte order: big endian #include <netinet/in.h> uint16_t htons (uint16_t val); uint32_t htonl (uint32_t val); uint16_t ntohs (uint16_t val); uint32_t ntohl (uin32_t val); htons/htonl (host to net short/long) converts a 16bit /32bit integer from the host byte order into network byte order ntohs/ntohl (net to host short/long) converts a 16bit /32bit integer from network byte order into host byte order No such functions exist for floating point numbers

Byte order (III) Implementation for byte-swapping operations manually void convert_32_big_little(uint32_t *data, int cnt) { uint32_t value; int i; } for(i=0; i<cnt; i++) { value = data[i]; data[i] = 0; data[i] = ( value & 0xff000000 ) >> 24; data[i] = ( value & 0x00ff0000 ) >> 8; data[i] = ( value & 0x0000ff00 ) << 8; data[i] = ( value & 0x000000ff ) << 24; }

emory alignment (I) emory is typically aligned on a multiple of word boundaries Best case: accessing misaligned address leads to performance problems since it requires accessing multiple words Worst case: hardware does not allow misaligned access

emory alignment (II) Width of object 0 1 2 3 4 5 6 7 1 byte 2 bytes (half word) 2 bytes (half word) 4 bytes (word) 4 bytes (word) 4 bytes (word) 4 bytes (word) 8 bytes ( double word) 8 bytes ( double word) 8 bytes ( double word) 8 bytes ( double word) 8 bytes ( double word) 8 bytes ( double word) 8 bytes ( double word) 8 bytes ( double word)

Type and size of operands (I) How is the type of an operand designated? Encoded in the opcode nnotated by tags Common operand types: Character - 8bits Half word - 16 bits, 2 bytes Word - 32 bits, 4 bytes Single precision floating point - 32 bits, 4 bytes Double precision floating point - 64 bits, 8 bytes

Type and size of operands (II) Encoding of characters: SCII UNICODE Encoding of integers: Two s complement binary numbers Encoding of floating point numbers: IEEE standard 754 No uniform representation of the data type long double

Operations in the Instruction Set Operator type rithmetic and logical Data transfer Control System Floating point Decimal String Graphics Examples Integer arithmetic: add, subtract, and, or, multiple, divide Load, store, move Branch, jump, procedure call, return, traps OS call, virtual memory management Floating point arithmetic: add, multiply, divide, compare Decimal add, multiply String move, string compare, string search Pixel and vertex operations, compression

Flow Control instructions Four types of different control flow changes Conditional branches Jumps Procedure calls Procedure returns How to specify the destination address of a flow control instruction? PC-relative: Displacement to the program counter (PC) Register indirect: name a register containing the target address

Flow Control instructions (II) Register indirect jumps also required for Case/switch statements Virtual functions in C++ Function pointers in C Dynamic shared libraries ( dll in Windows,.so in UNIX) Procedure invocation: global variables could be accessed by multiple routines location of the variable needs to be known Options for saving registers: Caller saving Callee saving due to the possibility of separate compilation, many compilers store any global variable that may be accessed during a call

Encoding an Instruction Set How are instructions encoded into a binary representation ffects size of compiled program ffects implementation of the processor Decision depends on range of addressing modes supported Operation and ddress ddress Variable encoding no. of operands specifier 1 field 1 Individual instructions can vary widely in size and amount of work to be performed Operation ddress ddress Fixed encoding field 1 field 2 Easy to decode ddress specifier 2 ddress field 2

Example rchitecture: IPS64 (I) Load-store architecture 32 64bit GPR registers (R0,R1, R31) R0 contains always 0 32 64bit floating point registers (F0,F1, F31) When using 32bit floating point numbers the other 32 bits of the FP registers are not used or Instructions available for operating 2 32bit FP operations on a single 64bit register Data types: 8 bit bytes, 16bit half-words, 32bit words, 64 bit double words 32bit and 64bit floating point data types

Example architecture: IPS64 (II) ddressing modes: Immediate Displacement Displacement field and immediate field are both 16bit wide Register indirect addressing accomplished by using 0 in the displacement field bsolute addressing accomplished by using R0 as the base register

Example architecture: IPS64(III) ll instructions are 32bit wide (fixed encoding): 6bit opcode ddressing modes are encoded in the opcode LD R1,30(R2) load double word Regs[R1] 64 em[30+regs[r2]] with n load n bits LW R1,60(R2) load word Regs[R1] 64 em[60+regs[r2] 0 ] 32 ## em[60+regs[r2]] with Regs[R2] 0 indicating a bit-field selection, e.g. Regs[R2] 0 is the sign bit of R2 e.g. Regs[R2] 53 63 last byte of of R2 with X n replicate a bit field e.g. Regs[R2] 0 23 0 24 set high order three bytes to 0 with ## concatenate two fields

Example architecture: IPS64(IV) Thus Regs[R1] 64 em[60+regs[r2] 0 ] 32 ## em[60+regs[r2]] Replicate the sign bit of memory address [60+Regs[R2]] on the first 32 bits of Regs[1]