ECE232: Hardware Organization and Design

Similar documents
ECE232: Hardware Organization and Design

CS3350B Computer Architecture

EECS Computer Organization Fall Based on slides by the author and prof. Mary Jane Irwin of PSU.

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

ECE331: Hardware Organization and Design

Chapter 2A Instructions: Language of the Computer

ECE260: Fundamentals of Computer Engineering

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

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

Chapter 1. Computer Abstractions and Technology

MIPS Instruction Set Architecture (1)

Chapter 2 Instruction: Language of the Computer

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008

CS3350B Computer Architecture MIPS Introduction

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

CSEE 3827: Fundamentals of Computer Systems

Instructions: Language of the Computer

Architecture I. Computer Systems Laboratory Sungkyunkwan University

Instructions: Language of the Computer

Chapter 2. Instruction Set. RISC vs. CISC Instruction set. The University of Adelaide, School of Computer Science 18 September 2017

Chapter 3. Instructions:

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

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

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

Chapter 2. Instructions:

Computer Organization MIPS ISA

ECE 154A Introduction to. Fall 2012

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

Computer Architecture. Lecture 2 : Instructions

Course Administration

Chapter 2: Instructions:

Instruction Set Principles and Examples. Appendix B

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

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

מבנה מחשבים Amar Lior Based on lectures notes from Arie Schlesinger

MIPS Memory Access Instructions

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

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

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

EC 413 Computer Organization

Review of instruction set architectures

COMPUTER ORGANIZATION AND DESIGN

CS 61C: Great Ideas in Computer Architecture Intro to Assembly Language, MIPS Intro

Lecture 4: Instruction Set Architecture

Typical Processor Execution Cycle

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

CS222: MIPS Instruction Set

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

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

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

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

COMP3221: Microprocessors and. and Embedded Systems. Instruction Set Architecture (ISA) What makes an ISA? #1: Memory Models. What makes an ISA?

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

CENG3420 Lecture 03 Review

ADD R Operation : ACC = ACC + R SIZE : 1 byte, 8 bit Time : 3 T Cycle Work : Read R, Read ACC, Add, Write Result to ACC

ECE 486/586. Computer Architecture. Lecture # 6

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

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

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

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

EE108B Lecture 2 MIPS Assembly Language I. Christos Kozyrakis Stanford University

INSTITUTO SUPERIOR TÉCNICO. Architectures for Embedded Computing

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

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

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

Operations, Operands, and Instructions

IC220 SlideSet #2: Instructions (Chapter 2)

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

Lecture 4: MIPS Instruction Set

ISA and RISCV. CASS 2018 Lavanya Ramapantulu

Computer Architecture

ECE232: Hardware Organization and Design

Instruction Set Architecture. "Speaking with the computer"

ECE232: Hardware Organization and Design

Alternate definition: Instruction Set Architecture (ISA) What is Computer Architecture? Computer Organization. Computer structure: Von Neumann model

CS 61C: Great Ideas in Computer Architecture Intro to Assembly Language, MIPS Intro

LECTURE 2: INSTRUCTIONS

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

Part II Instruction-Set Architecture. Jan Computer Architecture, Instruction-Set Architecture Slide 1

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

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

Rechnerstrukturen. Chapter 2. Instructions: Language of the Computer

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

Topic Notes: MIPS Instruction Set Architecture

CENG3420 L03: Instruction Set Architecture

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

Computer Systems Laboratory Sungkyunkwan University

Hakim Weatherspoon CS 3410 Computer Science Cornell University

COSC 6385 Computer Architecture. Instruction Set Architectures

Chapter 2. Instruction Set Architecture (ISA)

Prof. Hakim Weatherspoon CS 3410, Spring 2015 Computer Science Cornell University. See P&H Appendix , and 2.21

Instruction Set Architecture part 1 (Introduction) Mehran Rezaei

Lecture #6 Intro MIPS; Load & Store

Computer Architecture, RISC vs. CISC, and MIPS Processor

EEC 581 Computer Architecture Lecture 1 Review MIPS

Computer Model. What s in a computer? Processor Memory I/O devices (keyboard, mouse, LCD, video camera, speaker, disk, CD drive, )

CPE300: Digital System Architecture and Design

Computer Architecture. Chapter 2-2. Instructions: Language of the Computer

Programmable Machines

Programmable Machines

Transcription:

ECE232: Hardware Organization and Design Lecture 2: Hardware/Software Interface Adapted from Computer Organization and Design, Patterson & Hennessy, UCB

Overview Basic computer components How does a microprocessor view memory? Basic microprocessor components ALU, register file, registers Microprocessor instructions Logic operations (AND, OR, etc) Memory operations MIPs instruction format Control implemented as a series of instructions ECE232: MIPS Instructions-I 2

Computer Organization 5 classic components of any computer Processor (CPU) (active) Control ( brain ) Datapath Computer Memory (passive) (where programs, & data live when running) Devices Input Output Keyboard, Mouse Disk (where programs, & data live when not running) Display, Printer Fits in closely with datapath ECE232: MIPS Instructions-I 3

Program View of Memory Processor (CPU) Control Datapath Computer Memory Devices Input Output Memory viewed as a large, single -dimension array, with an address A memory address is an index into array The index points to a byte of memory - "Byte addressing" A 32-bit machine addresses memory by a 32-bit address Access bytes (8 bits), words (32 bits) or half-words 0 1 2 3 4 5 6...? 8 bits of data 8 bits of data 8 bits of data 8 bits of data 8 bits of data 8 bits of data 8 bits of data 8 bits of data ECE232: MIPS Instructions-I 4

Memory word addressing CPU Address Bus Memory Every word in memory has an address Today machines address memory as bytes, hence word addresses differ by 4 Memory[0], Memory[4], Memory[8], Word 0 (bytes 0 to 3) Word 1 (bytes 4 to 7) 0x00000000 0x00000004 0x00000008 0x0000000C 0x00000010 0x00000014 0x00000018 0x0000001C 0xfffffff4 0xfffffffc 0xfffffffc Called the address of a word Memory 4GB Max (Typically 512MB-2GB) ECE232: MIPS Instructions-I 5

Addressing words: Big or Small Endian 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 (xx00 = Little End of word) Intel 80x86, DEC Vax, DEC Alpha 3 2 1 0 little endian byte 0 msb lsb 0 1 2 3 big endian byte 0 ECE232: MIPS Instructions-I 6

Registers Computer Processor (CPU) Control Memory Devices Input Datapath Registers Output Once a memory is fetched, the data must be placed somewhere in CPU Advantages of registers registers are faster than memory registers can hold variables and intermediate results memory traffic is reduced, so program runs faster code density improves (later) ECE232: MIPS Instructions-I 7

Registers code for A = B + C (This is not MIPS code, It is in English) load R1,B load R2,C add R3,R1,R2 store R3,A # R1 = B # R2 = C # R3 = R1+R2 # A = R3 Many current processors support 32 registers (MIPS) The more registers available, the fewer memory accesses will be necessary Registers can hold lots of intermediate values Instructions must include bits to specify which registers to operate on register address ECE232: MIPS Instructions-I 8

Instruction Set Architecture (ISA) Application (FireFox) Software Hardware Compiler Assembler Processor Operating System Memory (Unix; Windows) Datapath & Control Digital Design Circuit Design transistors, IC layout I/O system Instruction Set Architecture Key Idea: abstraction hide unnecessary implementation details helps us cope with enormous complexity of real systems ECE232: MIPS Instructions-I 9

The MIPS Instruction Set Used as the example throughout the book Stanford MIPS commercialized by MIPS Technologies (www.mips.com) Large share of embedded core market Applications in consumer electronics, network/storage equipment, cameras, printers, Typical of many modern ISAs See MIPS Reference Data tear-out card, and Appendices B and E ECE232: MIPS Instructions-I 10

Arithmetic Operations Add and subtract, three operands Two sources and one destination add a, b, c # a gets b + c All arithmetic operations have this form Design Principle 1: Simplicity favors regularity Regularity makes implementation simpler Simplicity enables higher performance at lower cost ECE232: MIPS Instructions-I 11

Arithmetic Example C or Java code: f = (g + h) - (i + j); Compiled MIPS code: add t0, g, h # temp t0 = g + h add t1, i, j # temp t1 = i + j sub f, t0, t1 # f = t0 - t1 ECE232: MIPS Instructions-I 12

Register Operands Arithmetic instructions use register operands MIPS has a 32 32-bit register file Use for frequently accessed data Numbered 0 to 31 32-bit data called a word Assembler names $t0, $t1,, $t9 for temporary values $s0, $s1,, $s7 for saved variables Design Principle 2: Smaller is faster c.f. main memory: millions of locations ECE232: MIPS Instructions-I 13

Register Operand Example C or Java code: f = (g + h) - (i + j); f,, j in $s0,, $s4 Compiled MIPS code: add $t0, $s1, $s2 add $t1, $s3, $s4 sub $s0, $t0, $t1 ECE232: MIPS Instructions-I 14

Simplified Datapath Two register fetches in one cycle Load from memory Store to memory Registers A L U Data Memory From Register for SW To register for LW ECE232: MIPS Instructions-I 15

Memory Operands Main memory used for composite data Arrays, structures, dynamic data To apply arithmetic operations Load values from memory into registers Store result from register to memory Memory is byte addressed Each address identifies an 8-bit byte Words are aligned in memory Address must be a multiple of 4 MIPS is Big Endian Most-significant byte at least address of a word c.f. Little Endian: least-significant byte at least address ECE232: MIPS Instructions-I 16

Memory Operand Example 1 C code: g = h + A[8]; g in $s1, h in $s2, base address of A in $s3 Compiled MIPS code: Index 8 requires offset of 32 4 bytes per word lw $t0, 32($s3) # load word add $s1, $s2, $t0 offset base register ECE232: MIPS Instructions-I 17

Memory Operand Example 2 C code: A[12] = h + A[8]; h in $s2, base address of A in $s3 Compiled MIPS code: Index 8 requires offset of 32 lw $t0, 32($s3) # load word add $t0, $s2, $t0 sw $t0, 48($s3) # store word ECE232: MIPS Instructions-I 18

Registers vs. Memory Registers in a register file are faster to access than memory Operating on memory data requires loads and stores More instructions to be executed Compiler must use registers for variables as much as possible Only spill to memory for less frequently used variables Register optimization is important! Registers are a fixed resources ECE232: MIPS Instructions-I 19

Immediate Operands Constant data specified in an instruction addi $s3, $s3, 4 No subtract immediate instruction Just use a negative constant addi $s2, $s1, -1 Design Principle 3: Make the common case fast Small constants are common Immediate operand avoids a load instruction ECE232: MIPS Instructions-I 20

The Constant Zero MIPS register 0 ($zero) is the constant 0 Cannot be overwritten Zero is used a lot for arithmetic operations Useful for common operations E.g., move between registers add $t2, $s1, $zero ECE232: MIPS Instructions-I 21

MIPS Registers Fast access to program data Register R0/$0/$zero: hardwired to constant zero Register names: $0-$31 or R0-R31 Specialized names based on usage convention $zero ($0) - always zero $s0-$s7 ($16-$23) - saved registers $t0-$t7 ($8-$15) - temporary registers $sp - stack pointer Other special-purpose registers ECE232: MIPS Instructions-I 22

MIPS Registers and Usage Name Register number Usage $zero 0 the constant value 0 $at 1 reserved for assembler $v0-$v1 2-3 values for results and expression evaluation $a0-$a3 4-7 arguments $t0-$t7 8-15 temporary registers $s0-$s7 16-23 saved registers $t8-$t9 24-25 more temporary registers $k0-$k1 26-27 reserved for Operating System kernel $gp 28 global pointer $sp 29 stack pointer $fp 30 frame pointer $ra 31 return address ECE232: MIPS Instructions-I 23

Summary Basic microprocessor includes a register file, an ALU, and control circuitry Microprocessors interact with memory Memory access is slow and (when possible) should be avoided Load and store instructions used to access memory Microprocessors operate using primitive instructions Logic operations Arithmetic operations Load and stores More to come Next time: More instructions, instruction implementation ECE232: MIPS Instructions-I 24