Instruction Set Architecture (ISA)



Similar documents
Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

Instruction Set Architecture (ISA) Design. Classification Categories

Instruction Set Architecture. or How to talk to computers if you aren t in Star Trek

Instruction Set Design

Computer Architecture Lecture 3: ISA Tradeoffs. Prof. Onur Mutlu Carnegie Mellon University Spring 2013, 1/18/2013

CPU Organization and Assembly Language

İSTANBUL AYDIN UNIVERSITY

Computer Organization and Architecture

Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University

Overview. CISC Developments. RISC Designs. CISC Designs. VAX: Addressing Modes. Digital VAX

LSN 2 Computer Processors

CHAPTER 7: The CPU and Memory

Chapter 7D The Java Virtual Machine

1 Classical Universal Computer 3

Chapter 2 Topics. 2.1 Classification of Computers & Instructions 2.2 Classes of Instruction Sets 2.3 Informal Description of Simple RISC Computer, SRC

Property of ISA vs. Uarch?

MACHINE INSTRUCTIONS AND PROGRAMS

a storage location directly on the CPU, used for temporary storage of small amounts of data during processing.

Chapter 5 Instructor's Manual

Microprocessor and Microcontroller Architecture

Instruction Set Architecture

1 The Java Virtual Machine

2) Write in detail the issues in the design of code generator.

The AVR Microcontroller and C Compiler Co-Design Dr. Gaute Myklebust ATMEL Corporation ATMEL Development Center, Trondheim, Norway

EC 362 Problem Set #2

Intel 8086 architecture

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc

Computer Architectures

MACHINE ARCHITECTURE & LANGUAGE

PROBLEMS (Cap. 4 - Istruzioni macchina)

ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-12: ARM

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

(Refer Slide Time: 00:01:16 min)

Central Processing Unit (CPU)

Design Cycle for Microprocessors

An Introduction to Assembly Programming with the ARM 32-bit Processor Family

Pentium vs. Power PC Computer Architecture and PCI Bus Interface

Central Processing Unit Simulation Version v2.5 (July 2005) Charles André University Nice-Sophia Antipolis

MICROPROCESSOR AND MICROCOMPUTER BASICS

Figure 1: Graphical example of a mergesort 1.

Stack machines The MIPS assembly language A simple source language Stack-machine implementation of the simple language Readings:

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored?

Microprocessor & Assembly Language


Chapter 2 Assemblers

An Overview of Stack Architecture and the PSC 1000 Microprocessor

Summary of the MARIE Assembly Language

VLIW Processors. VLIW Processors

CPU Organisation and Operation

Computer System: User s View. Computer System Components: High Level View. Input. Output. Computer. Computer System: Motherboard Level

Administrative Issues

CHAPTER 4 MARIE: An Introduction to a Simple Computer

Comp 255Q - 1M: Computer Organization Lab #3 - Machine Language Programs for the PDP-8

Reduced Instruction Set Computer (RISC)

Computer Architecture TDTS10

How To Write Portable Programs In C

Week 1 out-of-class notes, discussions and sample problems

LC-3 Assembly Language

Interpreters and virtual machines. Interpreters. Interpreters. Why interpreters? Tree-based interpreters. Text-based interpreters

Computer Architecture Basics

ASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6)

CSE 141 Introduction to Computer Architecture Summer Session I, Lecture 1 Introduction. Pramod V. Argade June 27, 2005

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER

Notes on Assembly Language

ECE 0142 Computer Organization. Lecture 3 Floating Point Representations

PART B QUESTIONS AND ANSWERS UNIT I

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

X86-64 Architecture Guide

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)

Q. Consider a dynamic instruction execution (an execution trace, in other words) that consists of repeats of code in this pattern:

CS352H: Computer Systems Architecture

Computer organization

Chapter 2 Logic Gates and Introduction to Computer Architecture

Numbering Systems. InThisAppendix...

System i Architecture Part 1. Module 2

How It All Works. Other M68000 Updates. Basic Control Signals. Basic Control Signals

Motorola 8- and 16-bit Embedded Application Binary Interface (M8/16EABI)

What to do when I have a load/store instruction?

The programming language C. sws1 1

Compilers I - Chapter 4: Generating Better Code

The Design of the Inferno Virtual Machine. Introduction

Divide: Paper & Pencil. Computer Architecture ALU Design : Division and Floating Point. Divide algorithm. DIVIDE HARDWARE Version 1

Chapter 01: Introduction. Lesson 02 Evolution of Computers Part 2 First generation Computers

In this Chapter you ll learn:

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

CS101 Lecture 26: Low Level Programming. John Magee 30 July 2013 Some material copyright Jones and Bartlett. Overview/Questions

Today. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real- Time Systems: Binary Arithmetic

In the Beginning The first ISA appears on the IBM System 360 In the good old days

Habanero Extreme Scale Software Research Project

8085 INSTRUCTION SET

1 Description of The Simpletron

Guide to RISC Processors

Basic Computer Organization

l C-Programming l A real computer language l Data Representation l Everything goes down to bits and bytes l Machine representation Language

RISC AND CISC. Computer Architecture. Farhat Masood BE Electrical (NUST) COLLEGE OF ELECTRICAL AND MECHANICAL ENGINEERING

VB.NET Programming Fundamentals

CHAPTER 6: Computer System Organisation 1. The Computer System's Primary Functions

on an system with an infinite number of processors. Calculate the speedup of

Transcription:

Instruction Set Architecture (ISA) * Instruction set architecture of a machine fills the semantic gap between the user and the machine. * ISA serves as the starting point for the design of a new machine or modification of an existing one. * We will look at the main features of an instruction set architecture and learn how to design one. Huang - Spring 2008 CSE 340 1

Topics for Discussions * Classifications of ISA * Memory Addressing * Operations in the Instruction Set * Type and Size of Operands * Encoding an Instruction Set * Role of Compilers * An Example ISA -- MIPS (in particular, MIPS64) Huang - Spring 2008 CSE 340 2

Assumed Prior Knowledge * Instruction: Label Operator Operands * Example: LOOP: MOVZ R1, R2 * Interpretation: Move the contents of register R1 (source operand) to R2 (destination operand) when the test flag is 0. * Operands can be registers, memory address, or absolute values (immediate). * Instruction cycle: Fetch, Decode, Execute, Store * Basic memory and register addressing * Registers Program Counter (PC) and Instruction Register (IR). Huang - Spring 2008 CSE 340 3

Classifying ISA Stack Architecture: Operands are implicit. They are on the top of the stack. For example, a binary operation pops the top two elements of the stack, applies the operation and pushes the result back on the stack. Accumulator Architecture: One of the operands is implicitly the accumulator. Usually one of the source operand and the destination operand is assumed to be the accumulator. Huang - Spring 2008 CSE 340 4

Classifying ISA (contd.) General Purpose Register Architecture: Operands are explicit: either memory operands or register operands. Any instruction can access memory. ISA design is orthogonal. Load/Store Architecture: Only load/store instructions can access memory. All other instructions use registers. Also referred to as registerregister architecture. Huang - Spring 2008 CSE 340 5

Classifying ISA (contd.) - Sample Code Stack Accumulator GP Register Load/Store Push A Load A Load R1, A Load R1, A Push B Add B Add R1, B Load R2, B Add Store C Store C, R1 Add R3,R1,R2 Pop C Store C, R3 Huang - Spring 2008 CSE 340 6

Memory Addressing * ISA design must define how memory addresses are interpreted and specified in the instructions. * Most machines (ISAs) are byte addressed. That is, a byte (8 bits) is the smallest memory size that has a unique address. Other sizes are: half word, word, double word... * There are two different conventions for ordering bytes within a word: Little Endian and Big Endian. * Little Endian: The byte with address XXX...00 is the least significant byte in the word. Big Endian: The byte with address XXX...00 is the most significant byte in the word. Huang - Spring 2008 CSE 340 7

Addressing Modes * Addressing modes was one of the ways designers attempted to close the gap between HLL and the machine language. (By providing modes that a compiler can directly use to map many of the HLL features such as array indexing, base register addressing, position independent coding (PCrelative.) * Examples: Indexed mode array access, auto increment and auto decrement to allow processing of array elements in sequence and so on. * Some popular addressing modes: Register, Immediate, Displacement, register-indirect, indexed, absolute, memory-indirect, auto increment and auto decrement. Huang - Spring 2008 CSE 340 8

Choice of Addressing Modes * Study the measurements related to the usage of the various addressing modes. * For example, if the displacement mode is used, you may further study the distribution of how far the displacement is. * Then, select the modes depending on their usage, and the specific attributes of the mode depending on experimental results with a select set of benchmarks. Huang - Spring 2008 CSE 340 9

Operations in the Instruction Set * Data transfer instructions. * Arithmetic and logic instructions. * Instructions for control flow: conditional and unconditional branches, jumps, procedure calls and procedure returns. * System calls. * Floating point instructions. * Decimal instructions. * String instructions. * Graphics instructions. Huang - Spring 2008 CSE 340 10

Behind the Scenes Operations * Condition codes and condition register: Should this be set after every instruction or only when specified? * For procedure calls, does the caller or called save the state of computation? * Position independence: Most common way to specify branch destination is to supply a displacement that is added to the Program Counter (PC). Using PC-relative addressing permits the code to run independently of where it is loaded. Huang - Spring 2008 CSE 340 11

Type and Size of Operands * Type: Integer, floating point, single precision float, double precision float, character. * Floating point: IEEE 754 format. * Support for decimal data: Direct decimal operations, packed decimal. * byte, word, double word, quad word, etc. * With SPEC92 suite of benchmarks, on 32-bit address machines, word is the size commonly used for integer computation and 64-bit (double) is common for floating point computation. Huang - Spring 2008 CSE 340 12

Encoding an Instruction Set * Operator of the instruction is encoded into opcode. * When there are large number of addressing modes and more than one memory operands are allowed in an instruction, each operand must have an address specifier. * Otherwise if it is like the load/store machine, the operands can be encoded along with the opcode itself. * The number of addressing modes and number of registers have a significant effect on instruction length. Huang - Spring 2008 CSE 340 13

Variations in Instruction Encoding * Variable: Can support any number of operands. Number of operands is a part of the opcode. Each operand has an address specifier. (e.g. VAX, 1-53 bytes) * Fixed: Fixed format always has the same number of operands. How they are decoded may differ with opcode. (e.g. SPARC (4 bytes), MIPS, PowerPC) * Hybrid: Multiple formats of fixed length. Format specified as a part of the opcode. (e.g. IBM 370, Intel 80X86 series (7 different formats of 1-5 bytes) Huang - Spring 2008 CSE 340 14

The Role of Compilers Front-End Transform HLL to common intermediate form High-Level Optimization Procedure inlining & loop transformations Global Optimizer Global and local opt. & register allocation Code Generator Machine dependent opt. Huang - Spring 2008 CSE 340 15

The Role of Compilers (contd.) * Front-end: One per language. Once the source code is transformed into a common intermediate code, the rest of the phases are the same for any HLL. * High-level optimization: Involves working on the source code. Example: online expansion of functions. * Local optimization: Within a sequence of code. The straight line section of the code. Huang - Spring 2008 CSE 340 16

The Role of Compilers (contd.) * Global optimization: External local optimization across branches and introduce a set of transformations aimed at optimizing loops (Loop Optimization). * Register allocation is a very important function. Recent register allocation techniques are based on graph coloring. * Machine-dependent optimizations exploit some architectural features. Huang - Spring 2008 CSE 340 17

Compiler Technology and ISA * Today s compiler technology (in the form of optimization and others) helps in making such architectures as load/store a viable solution. * As an ISA designer, one may help the compiler writer generate efficient code. What are the features in ISA that can help compilation? Huang - Spring 2008 CSE 340 18

ISA Features to Support Efficient Compilation * Regularity: Three components of instruction set: operation, data types and addressing modes should be orthogonal. (independent) e.g. VAX s arithmetic operations are equally applicable to register or memory operands. * Provide primitives and not solutions: Features that match a particular HLL feature are often not usable by other HLL or other statements. e.g. Index register to support arrays. Instead a general purpose register would serve the purpose and other situations well. Huang - Spring 2008 CSE 340 19

ISA Features... (contd.) * Simplify trade-off among alternatives: An HLL statement may be translated into several different equivalent sets of instructions. -- Which is better? The longer or shorter sequence? With cache and pipelining this tradeoff becomes complex. -- Example: In register-memory architecture, how many times a memory variable has been referenced before it can be moved into a register? Huang - Spring 2008 CSE 340 20

ISA Features... (contd.) * Provide instructions that bind quantities known at compile time as constants -- if something is known at compile time, resolve it at compile time. * Counter Example -- CALLS of VAX ISA CALLS is a procedure call in VAX s ISA. Even though the list of registers to be saved on transfer control to the procedure is known at compile-time, the register saving process is included in the semantics of CALLS! So cannot be substituted with instructions at compile time. Huang - Spring 2008 CSE 340 21

Summarizing the ISA Features * How to decide the general class of ISA? * How is the memory going to be addressed? * What are the addressing modes? * What are the allowed operations? * The types of operands? * How are instructions encoded? * How to add features that help compiler generate efficient code? Huang - Spring 2008 CSE 340 22