ECE 486/586. Computer Architecture. Lecture # 7

Similar documents
CSEE 3827: Fundamentals of Computer Systems

ECE 486/586. Computer Architecture. Lecture # 8

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

Lecture 4: MIPS Instruction Set

Instruction Set Architecture. "Speaking with the computer"

Reminder: tutorials start next week!

Chapter 4. The Processor

ISA: The Hardware Software Interface

EC 413 Computer Organization

Chapter 4. The Processor Designing the datapath

Instruction Set Architecture

Unsigned Binary Integers

Unsigned Binary Integers

The Processor: Datapath and Control. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Chapter 2A Instructions: Language of the Computer

EC-801 Advanced Computer Architecture

Introduction. Datapath Basics

Chapter 4. The Processor

Processor (I) - datapath & control. Hwansoo Han

Instructions: Language of the Computer

ECE232: Hardware Organization and Design

CS/COE1541: Introduction to Computer Architecture

CS3350B Computer Architecture MIPS Instruction Representation

Lecture 4: Instruction Set Architecture

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008

Computer Architecture

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

1 5. Addressing Modes COMP2611 Fall 2015 Instruction: Language of the Computer

The Processor (1) Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: MIPS Instruction Set Architecture

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

Instructions: Language of the Computer

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor

Chapter 4. The Processor

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

Chapter 4. Instruction Execution. Introduction. CPU Overview. Multiplexers. Chapter 4 The Processor 1. The Processor.

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor

COMPUTER ORGANIZATION AND DESIGN. The Hardware/Software Interface. Chapter 4. The Processor: A Based on P&H

Assembler. Lecture 8 CS301

Computer Architecture. Lecture 2 : Instructions

Introduction to the MIPS. Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University

Review of instruction set architectures

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

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

ECE 154A Introduction to. Fall 2012

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

CMSC Computer Architecture Lecture 2: ISA. Prof. Yanjing Li Department of Computer Science University of Chicago

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

Lecture 4: Instruction Set Design/Pipelining

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA MIPS ISA. In a CPU. (vonneumann) Processor Organization

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

Instructions: Language of the Computer

CS31001 COMPUTER ORGANIZATION AND ARCHITECTURE. Debdeep Mukhopadhyay, CSE, IIT Kharagpur. Instructions and Addressing

Chapter 3 MIPS Assembly Language. Ó1998 Morgan Kaufmann Publishers 1

Topic Notes: MIPS Instruction Set Architecture

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: MIPS Instruction Set Architecture

The Single Cycle Processor

Lecture Topics. Announcements. Today: The MIPS ISA (P&H ) Next: continued. Milestone #1 (due 1/26) Milestone #2 (due 2/2)

Instruction Set Architecture (ISA)


Chapter 4. The Processor. Instruction count Determined by ISA and compiler. We will examine two MIPS implementations

The Processor. Z. Jerry Shi Department of Computer Science and Engineering University of Connecticut. CSE3666: Introduction to Computer Architecture

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

EN164: Design of Computing Systems Lecture 09: Processor / ISA 2

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

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

CS222: MIPS Instruction Set

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

Stored Program Concept. Instructions: Characteristics of Instruction Set. Architecture Specification. Example of multiple operands

Overview of the MIPS Architecture: Part I. CS 161: Lecture 0 1/24/17

ISA and RISCV. CASS 2018 Lavanya Ramapantulu

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

Lecture 3: Instruction Set Architecture

Instructions: MIPS arithmetic. MIPS arithmetic. Chapter 3 : MIPS Downloaded from:

Instructions: MIPS ISA. Chapter 2 Instructions: Language of the Computer 1

CS3350B Computer Architecture

Instruction Set Principles. (Appendix B)

Chapter 2. Instruction Set Architecture (ISA)

Systems Architecture I

5/17/2012. Recap from Last Time. CSE 2021: Computer Organization. The RISC Philosophy. Levels of Programming. Stored Program Computers

Recap from Last Time. CSE 2021: Computer Organization. Levels of Programming. The RISC Philosophy 5/19/2011

CS3350B Computer Architecture MIPS Introduction

Computer Organization MIPS Architecture. Department of Computer Science Missouri University of Science & Technology

Lecture Topics. Announcements. Today: Single-Cycle Processors (P&H ) Next: continued. Milestone #3 (due 2/9) Milestone #4 (due 2/23)

Chapter 2: Instructions:

CENG3420 Lecture 03 Review

MIPS PROJECT INSTRUCTION SET and FORMAT

Chapter 2. lw $s1,100($s2) $s1 = Memory[$s2+100] sw $s1,100($s2) Memory[$s2+100] = $s1

ECE 15B Computer Organization Spring 2011

Chapter 4. The Processor

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

COMPSCI 313 S Computer Organization. 7 MIPS Instruction Set

Reduced Instruction Set Computer (RISC)

CS3350B Computer Architecture Winter 2015

Lecture 10: Simple Data Path

MIPS%Assembly% E155%

ECE232: Hardware Organization and Design. Computer Organization - Previously covered

Chapter 4. The Processor. Computer Architecture and IC Design Lab

Instruction Set Architectures

COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. 5 th. Edition. Chapter 4. The Processor

Transcription:

ECE 486/586 Computer Architecture Lecture # 7 Spring 2015 Portland State University

Lecture Topics Instruction Set Principles Instruction Encoding Role of Compilers The MIPS Architecture Reference: Appendix A: Sections A.6, A.7, A.8 and A.9

Encoding Instructions OpCode Operation Code The instruction (e.g., add, load ) Possible variants (e.g., load byte, load word ) Source and Destination Register or memory address Addressing Modes Impacts code size Two options: Encode as part of opcode (common in load-store architectures which use a few number of addressing modes) Address specifier for each operand (common in architectures which support may different addressing modes)

Encoding Instructions Tradeoff between size of program versus ease of decoding Must balance the following competing requirements: Support as many registers and addressing modes as possible Impact of size of the register and addressing mode fields on the average instruction size Desire to have instructions encoded into lengths that will be easy to handle in a pipelined implementation

Encoding Instructions

Fixed vs. Variable Length Encoding Fixed Length Simple, easily decoded Larger code size Variable Length More complex, harder to decode More compact, efficient use of memory Fewer memory references Advantage possibly mitigated by RISC use of cache Complex pipeline: instructions vary greatly in both size and amount of work to be performed

Structure of Compilers

Compiler Optimizations High-level optimizations done on source Procedure in-lining Replace expensive procedure calls with in-line code Local optimizations within a basic block Common sub-expression elimination (CSE) Don t re-evaluate the same sub-expression; save result and reuse Constant propagation Replace all instances of variable containing a constant with the constant Reduces memory accesses (immediate mode)

Compiler Optimizations (cont.) Global optimizations done across branches Copy propagation Replace all instances of variable assignments A = X with X Code motion Remove invariant code from loop Register Allocation Allocate registers to expression evaluation, parameter passing, variables etc.

Compiler Optimizations (cont.) Processor dependent optimizations Strength reduction Replace/choose instructions with less expensive alternatives Example: * 2 and / 2 by left shift or right shift Pipeline scheduling Re-order instructions to improve pipeline performance

How the Computer Architect can help the Compiler Writer Provide regularity Make operations, data types, addressing modes orthogonal Example: For every operation to which one addressing mode can be applied, all addressing modes are applicable Provide primitives, not solutions Special instructions that match a high-level language construct are often unusable Simplify trade-offs among alternatives Make it easy for the compiler writer to determine the most effective implementation for a particular instruction sequence

RISC vs CISC Debate CISC (VAX) Attempts to create instructions to support high-level languages Procedure calls String processing Loops, array accesses Complex architecture, harder to pipeline RISC (MIPS, ARM) Use simpler architecture Simpler implementation faster clock cycle Regularity of instruction format Easier to pipeline Make the common case fast, combination of instructions for less frequent cases

Introduction to MIPS Overview of MIPS instruction set architecture (ISA) Assembly language Machine code Why study MIPS? Easy architecture to understand Understand and create assembly language examples for rest of course Provides a framework to understand ISA tradeoffs No need to become a MIPS assembly language expert

The MIPS Architecture Use general-purpose registers with a load-store architecture Support most common addressing modes Register, immediate, displacement Support 8-, 16-, 32- and 64-bit integers and 32- and 64-bit IEEE 754 floating point numbers Focus on most commonly executed instructions Load, store, add, subtract, move, shift Use small number of control instructions compare {equal, not equal} branch PC-relative jump, jump and link (JAL), jump register (JR) Use fixed length instruction encoding

MIPS Registers Arithmetic instruction operands must be registers 32 integer general-purpose registers: R0, R1,., R31 Value of R0 is always 0 32 floating point registers: F0, F1,., F31 Compiler associates variables with registers What about a program with lots of variables?

Memory Organization Viewed as a large, single-dimensional array, with addresses A memory address is an index into the array Byte addressing means that the index points to a byte of memory 0 1 2 3 8 bits of data 8 bits of data 8 bits of data 8 bits of data..

Memory Organization Data items in typical programs need more than one byte => support needed for larger words For MIPS, a word is 32 bits or 4 bytes 0 4 8 12 32 bits of data 32 bits of data 32 bits of data 32 bits of data. 2 32 bytes with byte addresses from 0 to 2 32-1 2 30 words with byte addresses 0, 4, 8,., 2 32-4 Words are aligned What are the least 2 significant bits of a word address?

MIPS Instruction Encoding All instructions are 32-bits (fixed size) with a 6-bit opcode Easy to decode and pipeline Basic instruction types Arithmetic/Logic Loads/Stores Control Three instruction formats I-type R-type J-type

MIPS Instruction Encoding (cont.)

ALU Instructions All ALU instructions have three operands Operand order is fixed: destination, source1, source2 a = b + c; => add r17, r18, r19 Keep instruction results in registers if possible a = b + c; => add r17, r18, r19 f = a + e; add r17, r17, r20 Machine code representation of first add instruction: R op rs rt rd shamt funct 000000 10010 10011 10001 00000 100000 opcode = 0; funct determines specific ALU operation

ALU Instructions (cont.) Immediate operands a = b + 16; => addi r17, r18, 16 Immediate mode form of ALU operations Opcode encodes specific operation (and indicates immediate) 16-bit immediate value in low-order 16-bits I op rs rt Immediate op 10010 10001 0000000000010000

Load/Store Instructions Only instructions which access memory Displacement mode addressing count[4] = x + count[2]; => lw r8, 8(r20) add r8, r19, r8 sw r8, 16(r20) r20: base address of count array r19: value of x Machine code representation of lw instruction I op rs rt Immediate op 10100 01000 0000000000001000

Control Flow Instructions Conditional Branches Jumps Unconditional Procedure calls Procedure returns