Chapter 2 Data Manipulation

Similar documents
Chapter 2: Data Manipulation

Chapter 2: Data Manipulation

Chapter 2: Data Manipulation. Copyright 2015 Pearson Education, Inc.

Chapter 2: Data Manipulation

Figure 2.1 CPU and main memory connected via a bus. Computer Architecture 2014/10/12. Chapter 2: Data Manipulation

Computer Architecture and Data Manipulation. Von Neumann Architecture

Chapter 2: Data Manipulation

Introduction to Computer Science. William Hsu Department of Computer Science and Engineering National Taiwan Ocean University

Data Manipulation. Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan

Introduction to Computer Science. William Hsu Department of Computer Science and Engineering National Taiwan Ocean University

Introduction to Computer Science Lecture 2: Data Manipulation

The von Neumann Architecture. IT 3123 Hardware and Software Concepts. The Instruction Cycle. Registers. LMC Executes a Store.

A Review of Chapter 5 and. CSc 2010 Spring 2012 Instructor: Qian Hu

Computer Organization

Computer Architecture (part 2)

Introduction to Computer Science. Homework 1

Full file at

Latches. IT 3123 Hardware and Software Concepts. Registers. The Little Man has Registers. Data Registers. Program Counter

The CPU and Memory. How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram:

Computer Organization

COMPUTER ORGANIZATION & ARCHITECTURE

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

Dec Hex Bin ORG ; ZERO. Introduction To Computing

5 Computer Organization

COS 140: Foundations of Computer Science

Machine Architecture. or what s in the box? Lectures 2 & 3. Prof Leslie Smith. ITNP23 - Autumn 2014 Lectures 2&3, Slide 1

Chapter 5: Computer Systems Organization

Chapter 5: Computer Systems Organization. Invitation to Computer Science, C++ Version, Third Edition

Data Manipulation. *2.4 Arithmetic/Logic. Instructions. Logic Operations Rotation and Shift Operations Arithmetic Operations. *2.5 Communicating with

The Von Neumann Architecture Odds and Ends. Designing Computers. The Von Neumann Architecture. CMPUT101 Introduction to Computing - Spring 2001

THE MICROPROCESSOR Von Neumann s Architecture Model

5 Computer Organization

COSC 122 Computer Fluency. Computer Organization. Dr. Ramon Lawrence University of British Columbia Okanagan

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

The Von Neumann Architecture. Designing Computers. The Von Neumann Architecture. CMPUT101 Introduction to Computing - Spring 2001

Designing Computers. The Von Neumann Architecture. The Von Neumann Architecture. The Von Neumann Architecture

CMPUT101 Introduction to Computing - Summer 2002

Introduction to Computers & Programming

Segment 1A. Introduction to Microcomputer and Microprocessor

Computer Architecture and Assembly Language. Spring

Computer Organization and Programming

CMPUT101 Introduction to Computing - Summer 2002

Computer and Hardware Architecture I. Benny Thörnberg Associate Professor in Electronics

Typical Processor Execution Cycle

EE 3170 Microcontroller Applications

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

CS1004: Intro to CS in Java, Spring 2005

Computer Architecture Dr. Charles Kim Howard University

Memory General R0 Registers R1 R2. Input Register 1. Input Register 2. Program Counter. Instruction Register

Running Applications

CS 31: Intro to Systems Digital Logic. Kevin Webb Swarthmore College February 2, 2016

Computer Systems. Binary Representation. Binary Representation. Logical Computation: Boolean Algebra

Chapter One. Introduction to Computer System

Computer Architecture

Chapter 3 - Top Level View of Computer Function

CPU ARCHITECTURE. QUESTION 1 Explain how the width of the data bus and system clock speed affect the performance of a computer system.

The Stored Program Computer

Computer Organization CS 206 T Lec# 2: Instruction Sets

Chapter 5 12/2/2013. Objectives. Computer Systems Organization. Objectives. Objectives (continued) Introduction. INVITATION TO Computer Science 1

CC411: Introduction To Microprocessors

ELEG3923 Microprocessor Ch.0 & Ch.1 Introduction to Microcontroller

ECE 486/586. Computer Architecture. Lecture # 7

Hardware Level Organization

Basic Computer Architecture

Microprocessors and Microcontrollers. Assignment 1:

ASSEMBLY LANGUAGE MACHINE ORGANIZATION

CS 31: Intro to Systems Digital Logic. Kevin Webb Swarthmore College February 3, 2015

CHETTINAD COLLEGE OF ENGINEERING AND TECHNOLOGY COMPUTER ARCHITECURE- III YEAR EEE-6 TH SEMESTER 16 MARKS QUESTION BANK UNIT-1

CS Computer Architecture

3.1 Description of Microprocessor. 3.2 History of Microprocessor

Chapter. Computer Architecture

Chapter 4 The Von Neumann Model

Computer Architecture and Organization (CS-507)

Chapter 2 Instruction Set Architecture

Computer Architecture

COSC 243. Computer Architecture 1. COSC 243 (Computer Architecture) Lecture 6 - Computer Architecture 1 1

Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Computing Layers

COMPUTER SYSTEM. COMPUTER SYSTEM IB DP Computer science Standard Level ICS3U. COMPUTER SYSTEM IB DP Computer science Standard Level ICS3U

Computer Architecture 2/26/01 Lecture #

EC-801 Advanced Computer Architecture

Information Science 1

Computer Architecture, RISC vs. CISC, and MIPS Processor

Chapter 2 Logic Gates and Introduction to Computer Architecture

COA. Prepared By: Dhaval R. Patel Page 1. Q.1 Define MBR.

COMPUTER ORGANIZATION AND ARCHITECTURE

Introduction to Computer Engineering. CS/ECE 252 Prof. Mark D. Hill Computer Sciences Department University of Wisconsin Madison

PART A (22 Marks) 2. a) Briefly write about r's complement and (r-1)'s complement. [8] b) Explain any two ways of adding decimal numbers.

LC-3 Architecture. (Ch4 ish material)

Lecture Objectives. Introduction to Computing Chapter 0. Topics. Numbering Systems 04/09/2017

Chapter 4 The Von Neumann Model

Wednesday, February 4, Chapter 4

PESIT Bangalore South Campus

A First Look at Microprocessors

C.P.U Organization. Memory Unit. Central Processing Unit (C.P.U) Input-Output Processor (IOP) Figure (1) Digital Computer Block Diagram

Introduction to Computers - Chapter 4

Chapter 2 Lecture 1 Computer Systems Organization

Chapter 3 : Control Unit

Course Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation

BASIC COMPUTER ORGANIZATION. Operating System Concepts 8 th Edition

Computer Organization + DIGITAL DESIGN

Transcription:

Chapter 2 Data Manipulation Dr. Farzana Rahman Assistant Professor Department of Computer Science James Madison University 1

What the chapter is about? 2.1 Computer Architecture 2.2 Machine Language 2.3 Program Execution 2.4 Arithmetic/Logic Instructions 2.5 Communicating with Other Devices 2

Big ideas How computer manipulates data What is the basic architecture of computer How computer is programmed by means of encoded instructions, i.e. machine language 3

Computer Architecture Central Processing Unit (CPU) or processor Bus Motherboard RAM Peripheral devices 4

Computer Architecture CPU Keyboard Display Bus RAM Hard Disk CD-ROM 5

The Bus What is a bus? It is a simplified way for many devices to communicate to each other. Looks like a highway for information. Actually, more like a basket that they all share. CPU RAM Display Bus 6

The Bus CPU RAM Display Bus 7

The Bus Suppose CPU needs to check to see if the user typed anything. CPU Keyboard Display Bus 8

The Bus CPU puts Keyboard, did the user type anything? (represented in some way) on the Bus. CPU Keyboard Display Bus Keyboard, did the user type anything? 9

The Bus Each device (except CPU) is a State Machine that constantly checks to see what s on the Bus. CPU Keyboard Display Bus Keyboard, did the user type anything? 10

The Bus Keyboard notices that its name is on the Bus, and reads info. Other devices ignore the info. CPU Keyboard Display Bus Keyboard, did the user type anything? 11

The Bus Keyboard then writes CPU: Yes, user typed a. to Bus. CPU Keyboard Display Bus CPU: Yes, user typed a. 12

The Bus At some point, CPU reads the Bus, and gets the Keyboard s response. CPU Keyboard Display Bus CPU: Yes, user typed a. 13

Computer Architecture CPU Keyboard Display Bus RAM Hard Disk CD-ROM 14

Inside the CPU The CPU is the brain of the computer. It is the part that actually executes the instructions. Let s take a look inside. 15

CPU and main memory connected via a bus General purpose register Special purpose register Some slides are adapted from Pearson 16

Inside the CPU (cont.) Memory Registers Register 0 Register 1 Register 2 Register 3 Arithmetic / Logic Unit Control Unit (State Machine) Instruction Register Program counter To hold the current instruction To hold the address of the current instruction in RAM 17

Stored Program Concept A program can be encoded as bit patterns and stored in main memory. From there, the CPU can then extract the instructions and execute them. In turn, the program to be executed can be altered easily. 18

Terminology Machine instruction: An instruction (or command) encoded as a bit pattern recognizable by the CPU Machine language: The set of all instructions recognized by a machine 19

Machine Language Philosophies Reduced Instruction Set Computing (RISC) Few, simple, efficient, and fast instructions Examples: PowerPC from Apple/IBM/Motorola and ARM Complex Instruction Set Computing (CISC) Many, convenient, and powerful instructions Example: Intel 20

Machine Instruction Types Data Transfer: copy data from one location to another Arithmetic/Logic: use existing bit patterns to compute a new bit patterns Control: direct the execution of the program 21

Adding values stored in memory 22

Dividing values stored in memory 23

The architecture of the machine described in Appendix C 24

Parts of a Machine Instruction Op-code: Specifies which operation to execute Operand: Gives more detailed information about the operation Interpretation of operand varies depending on opcode 25

Typical Assembly Instructions 1. LOAD 2. LOAD directly 3. STORE 4. MOVE 5. ADD 6. ADD (floating point) 7. OR 8. AND 9. XOR 10. ROTATE 11. JMUP 12. HALT 26

The composition of an instruction for the machine in Appendix C 27

Decoding the instruction 35A7 28

29

Program Execution Controlled by two special-purpose registers Program counter: address of next instruction Instruction register: current instruction Machine Cycle Fetch Decode Execute 30

The machine cycle 31

The program stored in main memory ready for execution 32

Performing the fetch step of the machine cycle 33

Performing the fetch step of the machine cycle (cont d) 34

A Simple Program Want to add values of variables a and b (assumed to be in memory), and put the result in variable c in memory, I.e. c a+b Instructions in program Load a into register r1 Load b into register r3 r2 r1 + r3 Store r2 in c 35

Running the Program 2 a 1 c 3 b r1 r2 2 r3 r4 Logic Memory IR IP Load a into r1 2005 CPU Load a into r1 Load b into r3 r2 r1 + r3 Store r2 into c 2005 2006 2007 2008 36

Running the Program 2 a 1 c 3 b r1 r2 2 r3 r4 3 Logic Memory IR IP Load b into r3 2006 CPU Load a into r1 Load b into r3 r2 r1 + r3 Store r2 into c 2005 2006 2007 2008 37

Running the Program 2 a 1 c 3 b r1 r2 2 5 r3 r4 3 Logic Memory IR IP r2 r1 + r3 2007 CPU Load a into r1 Load b into r3 r2 r1 + r3 Store r2 into c 2005 2006 2007 2008 38

Running the Program 2 a 1 c 3 b r1 r2 2 5 r3 r4 3 Logic Memory IR IP Store r2 into c 2008 CPU Load a into r1 Load b into r3 r2 r1 + r3 Store r2 into c 2005 2006 2007 2008 39

Running the Program 2 a 5 c 3 b r1 r2 2 5 r3 r4 3 Logic Memory IR IP Store r2 into c 2008 CPU Load a into r1 Load b into r3 r2 r1 + r3 Store r2 into c 2005 2006 2007 2008 40

Arithmetic/Logic Operations Logic: AND, OR, XOR Masking Rotate and Shift Arithmetic: add, subtract, multiply, divide 41

Rotating the bit pattern 65 (hexadecimal) one bit to the right 42

Communicating with Other Devices Controller: An intermediary apparatus that handles communication between the computer and a device Specialized controllers for each type of device General purpose controllers (USB and FireWire) Port: The point at which a device connects to a computer Memory-mapped I/O: CPU communicates with peripheral devices as though they were memory cells 43

Figure 2.13 Controllers attached to a machine s bus 44

A conceptual representation of memorymapped I/O 45

Communicating with Other Devices (continued) Direct memory access (DMA): Controller access main memory directly over the bus Von Neumann Bottleneck: Insufficient bus speed impedes performance CPU and controller compete the bus Handshaking: The process of coordinating the transfer of data between components Computer and device exchange information about the device s status and coordinate their activities 46

Putting it all together We learned about o o o o o o o Architecture of computer Components of CPU Program counter and instruction register Machine language using encoded bit patterns Machine cycle Op code and operand info Communication with other peripherals 47

Question Direct to rahma2fx@jmu.edu 48