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

Similar documents
CS4617 Computer Architecture

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

COSC 6385 Computer Architecture. Instruction Set Architectures

Lecture 4: Instruction Set Design/Pipelining

Lecture 4: Instruction Set Architecture

ECE 486/586. Computer Architecture. Lecture # 7

Instruction Set Principles and Examples. Appendix B

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

CSCE 5610: Computer Architecture

EITF20: Computer Architecture Part2.1.1: Instruction Set Architecture

ECE 486/586. Computer Architecture. Lecture # 8

EITF20: Computer Architecture Part2.1.1: Instruction Set Architecture

Lecture Topics. Branch Condition Options. Branch Conditions ECE 486/586. Computer Architecture. Lecture # 8. Instruction Set Principles.

17. Instruction Sets: Characteristics and Functions

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008

COSC 6385 Computer Architecture - Instruction Set Principles

Instruction Set Architecture (ISA)

Instruction Set Design

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

CS/ECE/752 Chapter 2 Instruction Sets Instructor: Prof. Wood

CHAPTER 5 A Closer Look at Instruction Set Architectures

COSC 6385 Computer Architecture. Defining Computer Architecture

ISA and RISCV. CASS 2018 Lavanya Ramapantulu

CPU Architecture and Instruction Sets Chapter 1

Instruction Set Architecture

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

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

Chapter 13 Reduced Instruction Set Computers

COMPUTER ORGANIZATION & ARCHITECTURE

CHAPTER 5 A Closer Look at Instruction Set Architectures

INSTITUTO SUPERIOR TÉCNICO. Architectures for Embedded Computing

Instruction-set Design Issues: what is the ML instruction format(s) ML instruction Opcode Dest. Operand Source Operand 1...

Chapter 2A Instructions: Language of the Computer

EC 413 Computer Organization

Instruction Set Principles. (Appendix B)

CHAPTER 5 A Closer Look at Instruction Set Architectures

Real instruction set architectures. Part 2: a representative sample

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

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

Computer Organization CS 206 T Lec# 2: Instruction Sets

History of the Intel 80x86

General Purpose Processors

Review of instruction set architectures

ISA: The Hardware Software Interface

Chapter 11. Instruction Sets: Addressing Modes and Formats. Yonsei University

Reminder: tutorials start next week!

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

Instructions: Language of the Computer

Chapter 5. A Closer Look at Instruction Set Architectures

Instruction Sets: Characteristics and Functions Addressing Modes

Instruction-set Design Issues: what is the ML instruction format(s) ML instruction Opcode Dest. Operand Source Operand 1...

Instruction Sets: Characteristics and Functions

CENG3420 Lecture 03 Review

Lecture 4: RISC Computers

Multiple Choice Type Questions

Instruction Set Architecture

Concepts Introduced in Chapter 3

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

Instruction Sets Ch 9-10

Understand the factors involved in instruction set

Instruction Sets Ch 9-10

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

Computer Organization

Lecture 3: The Instruction Set Architecture (cont.)

Lecture 3: The Instruction Set Architecture (cont.)

Graduate Computer Architecture. Chapter 2. Instruction Set Principles

CPE 323 MSP430 INSTRUCTION SET ARCHITECTURE (ISA)

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

Course Administration

Chapter 5. A Closer Look at Instruction Set Architectures

CMSC 611: Advanced Computer Architecture

Chapter 2. Instructions: Language of the Computer. HW#1: 1.3 all, 1.4 all, 1.6.1, , , , , and Due date: one week.

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

Chapter 2. Instruction Set Design. Computer Architectures. software. hardware. Which is easier to change/design??? Tien-Fu Chen

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

Interfacing Compiler and Hardware. Computer Systems Architecture. Processor Types And Instruction Sets. What Instructions Should A Processor Offer?

3.0 Instruction Set. 3.1 Overview

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

Chapter 2: Instructions How we talk to the computer

Instruction Set Architectures

Instruction Set (ISA) Design and Addressing Modes

Instruction Set Architecture. "Speaking with the computer"

Typical Processor Execution Cycle

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

RISC Principles. Introduction

Do-While Example. In C++ In assembly language. do { z--; while (a == b); z = b; loop: addi $s2, $s2, -1 beq $s0, $s1, loop or $s2, $s1, $zero

Computer Architecture. MIPS Instruction Set Architecture

Chapter 5. A Closer Look at Instruction Set Architectures

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

CS222: MIPS Instruction Set

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

Instruction Set Architecture

Course Administration

Evolution of ISAs. Instruction set architectures have changed over computer generations with changes in the

Unsigned Binary Integers

Unsigned Binary Integers

Reduced Instruction Set Computer (RISC)

Chapter 17. Microprogrammed Control. Yonsei University

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

Instructions: Language of the Computer

Transcription:

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

Stack architecture( 0-address ) operands are on the top of the stack Accumulator architecture( 1-address ) one operand is implicitly the accumulator General purpose register architecture( 2- or 3- address ) either registers or memory locations register-register (load-store): virtually every machine since 1980 faster than memory easier for a compiler to use register-memory access memory as part of any instruction memory-memory keeps all operands in memory How many registers are needed to allocate variables? How are variables allocated and addressed?

How to interpret memory addresses? Length:8/16/32/64 bits A byte or half word needs to sign/zero-extend its value On some machines, the upper portion is not affected(x86) To support smaller sizes, an alignment network is required in the hardware Byte ordering within a word Little endian (Intel) Big endian (Motorola, IBM) Aligned or misaligned Aligned memory accesses run faster even in machines allowing the misaligned access

Effective address actual memory address specified by the addressing mode Addressing Modes Register Memory immediate (specified in an instruction) register indirect (deferred) direct (absolute) displacement memory indirect (deferred) auto-increment/auto-decrement scaled PC-relative (for control instructions)

Ability to reduce instruction counts Add to the complexity of building a machine How to choose what to include? Based on the usage of various addressing modes Displacement size on data accesses Directly effect the instruction length Widely distributed Immediate size 50% to 75% of ALU operations have an immediate operand 75% to 85% of integer compare instructions have an immediate operand Size: 50% to 70% fit within 8 bits 75% to 80 % fit within 16bits

Operations supported by most ISAs Arithmetic and logical Data transfer Control branches (conditional) jumps (unconditional) procedure calls procedure returns System Floating point Decimal String Graphics Widely executed are simple operations

The destination is specified explicitly in the instruction except procedure returns A common way to specify the destination a displacement to be added to PC PC-relative often near the current PC results in a short displacement position independence displacement size signed value (75% are in the forward direction) short displace fields often suffice Indirect jump/procedure return indirect jump case/switch, dynamically shared library, virtual function dynamic addressing

Primary method condition code (cc) condition register compare and branch instruction A large amount of comparisons are == or!= tests Over 50% of integer comparisons are simple tests for equality with zero.

At a minimum, the return address must be saved Caller saving Save the register that it wants preserved after the call Callee saving Save the registers it wants to use What is better is dependent on the situation

Type designation Encode it in the opcode most often Annotate with tags that are interpreted by the hardware rare Size Character (1byte), half word (2 bytes) Word (4 bytes), double word (8 bytes) Single precision floating point (32 bits) Double precision floating point(64 bits) Extended floating point (80 points) 2 s complement for integer representation IEEE standard 754, 854 for floating-point operands Character strings Decimal format (packed decimal, unpacked decimal)

The word data type dominates Word>>half word>byte

How important is it to support byte accesses? Infrequent, but it requires an alignment network in hardware. The Alpha processor removed small-sized data transfers, but decided to include them later.

Operation is specified in a field, opcode How to encode the addressing modes with operands A large number of addressing modes and many operands Address specifier is needed for each operand One operand and one or two addressing modes Specified as part of the opcode Balancing competing forces As many registers and addressing modes as possible Impact on the instruction length, thus increasing the program size Lengthy encoding makes the implementation easy

Choices for encoding the instruction sets Variable --best for many addressing modes and operations Fixed -- best for a few addressing modes and operations Hybrid -- IBM 360,x86

Optimizations High-level optimization: on the source code Local optimizations: within a basic block Global optimizations: across branches transformations, optimizing loops Register allocation The same as graph coloring problem Graph coloring works well if there are at least 16 registers Machine dependent optimizations

Phase ordering problem Assume the ability of later steps to deal with certain problems For example, common sub-expression elimination The temporary must be allocated to a register

Type of variables Local variables The stack is used Addressed relative to the stack pointer Usually scalar variables Most effective when allocated in registers Global variables Global data area Arrays or other aggregate data structures Dynamic objects The heap is used Addressed with pointers and typically not scalars Register allocation is impossible, because they are accessed with pointers

Regularity The operations, data types, and addressing modes should be orthogonal Provide primitives, not solutions Approaches to make up the semantic gap have failed HLLCA (high-level language computer architecture)

Simplify trade-offs among alternatives Figuring out what instruction sequence will be best is tough Instruction counts and total code size are no longer good metrics With caches and pipelining, the trade-offs become complex Provide instructions that bind the quantities known at compile time as constants

Designing a high-level instruction set feature specifically oriented to supporting a high-level language structure. Semantic gap -- > semantic clash Too general for the most frequent case There is such a thing as a typical program. An architecture with flaws cannot be successful X86 : luck + investment You can design a flawless architecture. All architecture design involves trade-offs Technologies are likely to change over time

Innovating at the instruction set architecture to reduce code size without accounting for the compiler

Expecting to get good performance from a compiler for DSPs

MIPS Simple load-store instruction set Design for pipeline efficiency, including a fixed instruction set encoding Efficiency as a compiler target Registers 32 32-bit GPRs, 32 32-bit FPRs 32 single-precision registers 16 double-precision registers (F0,F2,,F30) R0 is always 0

Data types For integer operation:8-bit byte, 16-bit half word,32-bit word Bytes and half words are sign/zero extended for operations For floating point:32-bit single precision, 64-bit double precision Memory Byte addressable in Big Endian mode with a 32 bit address Addressing Modes Immediate Displacement Register indirect is accomplished by placing 0 in the disp.field Absolute addressing is accomplished by using R0 as the base register

Load Store instructions

Arithmetic/logical instructions LHI : loads the top half, while setting the low half to 0 32 bit immediate load: LHI + OR immediate R0 is always 0 loading a constant: add immediate with R0 (L1) register-register move: add where one source is R0 (MOV)

Control instructions Plain jump / jump and link Conditional branch : tests for zero or non-zero