ECE260: Fundamentals of Computer Engineering

Similar documents
ECE232: Hardware Organization and Design

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

CS3350B Computer Architecture

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

CSEE 3827: Fundamentals of Computer Systems

Chapter 1. Computer Abstractions and Technology

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

ECE232: Hardware Organization and Design

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

Computer Architecture. Lecture 2 : Instructions

CS3350B Computer Architecture MIPS Introduction

MIPS Instruction Set Architecture (1)

Architecture I. Computer Systems Laboratory Sungkyunkwan University

Instructions: Language of the Computer

Chapter 2A Instructions: Language of the Computer

ECE260: Fundamentals of Computer Engineering

CS 430 Computer Architecture. C/Assembler Arithmetic and Memory Access William J. Taffe. David Patterson

ECE260: Fundamentals of Computer Engineering

ECE260: Fundamentals of Computer Engineering

ECE260: Fundamentals of Computer Engineering. Supporting Procedures in Computer Hardware

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

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

IC220 SlideSet #2: Instructions (Chapter 2)

ECE260: Fundamentals of Computer Engineering

Lecture #6 Intro MIPS; Load & Store

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

Chapter 2: Instructions:

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

ECE 154A Introduction to. Fall 2012

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

Chapter 3. Instructions:

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

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

I ve been getting this a lot lately So, what are you teaching this term? Computer Organization. Do you mean, like keeping your computer in place?

ECE 486/586. Computer Architecture. Lecture # 7

Lecture 4: MIPS Instruction Set

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

Computer Systems and Networks. ECPE 170 Jeff Shafer University of the Pacific. MIPS Assembly

CSCI 402: Computer Architectures

Topic Notes: MIPS Instruction Set Architecture

UCB CS61C : Machine Structures

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

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

Programmable Machines

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

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

Programmable Machines

EC-801 Advanced Computer Architecture

Operations, Operands, and Instructions

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

LECTURE 2: INSTRUCTIONS

ECE260: Fundamentals of Computer Engineering

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

ISA and RISCV. CASS 2018 Lavanya Ramapantulu

ECE260: Fundamentals of Computer Engineering

Chapter 2. Instructions:

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

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

COMPUTER ORGANIZATION AND DESIGN

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

Chapter 2. Instructions: Language of the Computer

Instruction Set Architecture. "Speaking with the computer"

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

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

Chapter 4. The Processor Designing the datapath

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

Computer Architecture

Chapter 2. Instructions: Language of the Computer. Jiang Jiang

Chapter 2. Instruction Set Architecture (ISA)

Hardware Level Organization

Lecture 4: Instruction Set Architecture

A First Look at Microprocessors

Levels of Programming. Registers

Concocting an Instruction Set

Instructions: Language of the Computer

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

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

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

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

Introduction. Datapath Basics

ECE260: Fundamentals of Computer Engineering

ECE 30 Introduction to Computer Engineering

Chapter 2 Lecture 1 Computer Systems Organization

Course Administration

Instructions: Assembly Language

CS 61C: Great Ideas in Computer Architecture Introduction to Assembly Language and RISC-V Instruction Set Architecture

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

Chapter 2 Instruction: Language of the Computer

ECE260: Fundamentals of Computer Engineering

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

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

Digital System Design Using Verilog. - Processing Unit Design

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

Instruction encoding. MIPS Instruction encoding

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

A General-Purpose Computer The von Neumann Model. Concocting an Instruction Set. Meaning of an Instruction. Anatomy of an Instruction

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

BASIC COMPUTER ORGANIZATION. Operating System Concepts 8 th Edition

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

CPE300: Digital System Architecture and Design

Transcription:

Instructions & Instruction Sets James Moscola Dept. of Engineering & Computer Science York College of Pennsylvania Based on Computer Organization and Design, 5th Edition by Patterson & Hennessy

General-Purpose Computers Many models for a general-purpose computer have been explored Von Neumann architecture Includes a CPU, I/O devices, and a single memory unit that stores BOTH instructions and data Single bus between CPU and memory; cannot read instructions and data at the same time Harvard architecture von Neumann architecture Includes CPU, I/O devices, and separate memory units for instructions and data Separate buses for communicating with memory units Modified Harvard architecture Definition varies, depends who you ask Harvard architecture 2

Stored Program Concept The idea that instructions and data of many types can be stored in memory as numbers, leading to the stored program computer Distinct from Application-Specific Integrated Circuits (ASICs), ASICS are hardwired to perform some fixed-functions on inputs Enables programmable computers Can be programmed and re-programmed to perform different tasks Stored program computers utilize an instruction set architecture (ISA) as a specification for all stored programs Applications must conform to ISA specification for compatibility 3

Instruction Sets Instructions are the words of a computer s language Instruction set consists of a computer s complete vocabulary Different computers have different instruction sets (i.e. they speak different languages) But with many aspects in common (like Spanish and Portuguese) Early computers had very simple instruction sets Made for simplified hardware implementation Many modern computers also have simple instruction sets RISC processors (RISC = Reduced Instruction Set Computing) 4

The MIPS Instruction Set Used as the example throughout your textbook Stanford MIPS commercialized by MIPS Technologies (www.mips.com) Large share of embedded core market Applications in consumer electronics, network/storage equipment, cameras, printers, etc. 5

Anatomy of an Instruction An instruction is a primitive operation Specifies an operation and its operands (e.g. the variables on which to perform the operation) Types of operands include: immediate, source, and destination operands Operation Operands add $t0, $t1, $t2 Source Operands Destination Operand Immediate Operand addi $t0, $t1, 4 6

Arithmetic Operations on MIPS Each instruction performs only a single operation Arithmetic instructions must always have 3 operands Two sources operands and one destination operand All arithmetic operations have the same form with 3 operands Simplifies hardware design add $t0, $t1, $t2 Example: $t0 = $t1 + $t2 The values stored in registers $t1 and $t2 are added together The result is stored in register $t0 7

Register Operands Arithmetic instructions use register operands MIPS architecture has a 32 32-bit register file (e.g. it has 32 32-bit registers) Use for frequently accessed data Registers are numbered 0 to 31 32-bit architecture (32-bit data value called a word ) Side Note: a byte is ALWAYS 8-bits; a word size depends on the architecture Assembler names $t0, $t1,, $t9 for temporary values $s0, $s1,, $s7 for saved variables 8

Register Operand Example C code: f = (g + h) - (i + j); Compiled MIPS code: Assume: f is stored in register $s0 g is stored in register $s1 h is stored in register $s2 i is stored in register $s3 j is stored in register $s4 add $t0, $s1, $s2 # register $t0 contains g + h add $t1, $s3, $s4 # register $t1 contains i + j sub $s0, $t0, $t1 # f contains $t0 $t1 9

Memory Operands and Addressing Main memory used for larger data structures Arrays, structs, dynamic data, etc. Not enough registers to store all program data To apply arithmetic operations Must bring data values into CPU registers, cannot operate on values while they are in memory Memory is byte addressed Each address identifies an 8-bit byte Words are aligned in memory Addresses must be a multiple of 4 If you want a byte that is stored, read the entire word and extract the byte you want Load values from memory into registers Store result from register to memory (decimal) 10

Memory Operand Example #1 C code: g = h + A[8]; A[8] indicates an offset of 8 words from base address of A Given 4 bytes per word, offset is 8 * 4 = 32 bytes Compiled MIPS code: Assume: g is stored in register $s1 h is stored in register $s2 base address of A (i.e. A[0]) $s3 Offset from base register Base register lw $t0, 32($s3) # load word 32 bytes from A[0] add $s1, $s2, $t0 # register $s1 contains h + A[8] 11

Memory Operand Example #2 C code: A[12] = h + A[8]; Read operand from memory and store result in memory Compiled MIPS code: Assume: h is stored in register $s2 base address of A (i.e. A[0]) $s3 Offset from base register Base register lw $t0, 32($s3) # load word 32 bytes from A[0] add $t0, $s2, $t0 # register $t0 contains h + A[8] sw $t0, 48($s3) # store word 48 bytes from A[0] Source Data 12

Registers vs. Memory Registers are faster to access than memory Operating on memory data requires loads and stores More instructions to be executed Compiler prefers to use registers for variables as much as possible If program has more variables than registers, variables spill into main memory Only spill to memory for less frequently used variables Spilled variables must be loaded back into CPU register when needed Register optimization is important 13

Immediate Operands Constant data can be specified directly in an instruction (MIPS permits 16-bit immediate values) Immediate operand avoids a load instruction, saves a trip to memory Incrementing by small constants is very common Think increment operations: x = x + 4 addi $s3, $s3, 4 Add immediate: increment the value stored in register $s3 by 4. No subtract immediate instruction in most ISAs Just add a negative constant (hooray for signed numbers!) addi $s2, $s1, -1 Add immediate: decrement the value stored in register $s1 by 1. Store the result in register $s2 14

MIPS Constant Zero Register MIPS has a dedicated register that represents the constant 0 Register 0 ($zero) is the constant 0 Cannot be overwritten Always available, useful for common operations For example, moving data between registers since MIPS has no move instruction Adding $zero to a register and storing the result in another registers behaves like a move add $t2, $s1, $zero Move data from $s1 to $t2 15