Chapter 2 Data Manipulation Dr. Farzana Rahman Assistant Professor Department of Computer Science James Madison University 1 Some sldes are adapted from.

Slides:



Advertisements
Similar presentations
RAM (cont.) 220 bytes of RAM (1 Mega-byte) 20 bits of address Address
Advertisements

Chapter 2: Data Manipulation
 Suppose for a moment that you were asked to perform a task and were given the following list of instructions to perform:
Computer Architecture and Data Manipulation Chapter 3.
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Computer Science: An Overview Tenth Edition by J. Glenn Brookshear Chapter.
Chapter 5: Computer Systems Organization Invitation to Computer Science, Java Version, Third Edition.
Chapter 5: Computer Systems Organization Invitation to Computer Science, C++ Version, Third Edition Added to by S. Steinfadt - Spring 2005 Additional source.
Data Manipulation Computer System consists of the following parts:
Chapter 4 Processor Technology and Architecture. Chapter goals Describe CPU instruction and execution cycles Explain how primitive CPU instructions are.
Chapter 2.2 Machine Language.
Computer Systems CS208. Major Components of a Computer System Processor (CPU) Runs program instructions Main Memory Storage for running programs and current.
Computer Organization Computer Organization & Assembly Language: Module 2.
Intro to CS Chapt 2 Data Manipualtion 1 Data Manipulation How is data manipulated inside a computer? –How is data input? –How is it stored? –How is it.
Computer Processing of Data
The Computer Systems By : Prabir Nandi Computer Instructor KV Lumding.
Invitation to Computer Science 5th Edition
CS 1308 Computer Literacy and the Internet Computer Systems Organization.
CPU Computer Hardware Organization (How does the computer look from inside?) Register file ALU PC System bus Memory bus Main memory Bus interface I/O bridge.
Chapter 5: Computer Systems Organization Invitation to Computer Science, Java Version, Third Edition.
Data Manipulation, Communication and Architecture Fall 2012.
Data manipulation, Part one Introduction to computer, 2nd semester, 2010/2011 Mr.Nael Aburas Faculty of Information.
Introduction to Computing Systems from bits & gates to C & beyond The Von Neumann Model Basic components Instruction processing.
Ch. 2 Data Manipulation 4 The central processing unit. 4 The stored-program concept. 4 Program execution. 4 Other architectures. 4 Arithmetic/logic instructions.
CS 111 – Sept. 15 Chapter 2 – Manipulating data by performing instructions “What is going on in the CPU?” Commitment: –Please read through section 2.3.
Chapter 2 Data Manipulation Yonsei University 1 st Semester, 2015 Sanghyun Park.
Important Concepts  Parts of the CPU  Arithmetic/Logic Unit  Control Unit  Registers  Program Counter  Instruction Register  Fetch/Decode/Execute.
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
Chapter 2 Data Manipulation. © 2005 Pearson Addison-Wesley. All rights reserved 2-2 Chapter 2: Data Manipulation 2.1 Computer Architecture 2.2 Machine.
Data Manipulation CSC Overview  Computer Architecture  Machine Language  Computer Architecture  Machine Language.
Copyright © 2015 Pearson Education, Inc. Chapter 2: Data Manipulation.
Computer Science/Ch.3 Data Manipulation 3-1 Chapter 3 Data Manipulation.
Computer Hardware A computer is made of internal components Central Processor Unit Internal External and external components.
CS 1308 Computer Literacy and the Internet. Objectives In this chapter, you will learn about:  The components of a computer system  Putting all the.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Data Manipulation Brookshear, J.G. (2012) Computer Science: an Overview.
20 October 2015Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
Data Manipulation, part two Introduction to computer, 2 nd semester, 2010/2011 Mr.Nael Aburas Faculty of Information.
Lecture on Central Process Unit (CPU)
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Overview von Neumann Architecture Computer component Computer function
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
Chapter 2: Data Manipulation
Simple ALU How to perform this C language integer operation in the computer C=A+B; ? The arithmetic/logic unit (ALU) of a processor performs integer arithmetic.
CMSC 104, Lecture 061 Stored Programs A look at how programs are executed.
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
The Processor & its components. The CPU The brain. Performs all major calculations. Controls and manages the operations of other components of the computer.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
CPIT Program Execution. Today, general-purpose computers use a set of instructions called a program to process data. A computer executes the.
1 Chapter 1 Basic Structures Of Computers. Computer : Introduction A computer is an electronic machine,devised for performing calculations and controlling.
© 2015 Pearson Education Limited 2015 Quiz in last 15 minutes Midterm 1 is next Sunday Assignment 1 due today at 4pm Assignment 2 will be up today; due.
Chapter 2: Data Manipulation
Chapter 2: Data Manipulation
Control Unit Lecture 6.
5 - How Computers Calculate - the ALU
CS149D Elements of Computer Science
Chapter 2: Data Manipulation
Chapter 5: Computer Systems Organization
Chapter 2: Data Manipulation
GCSE OCR 1 The CPU Computer Science J276 Unit 1
Objectives Describe common CPU components and their function: ALU Arithmetic Logic Unit), CU (Control Unit), Cache Explain the function of the CPU as.
Chapter 2: Data Manipulation
Presentation transcript:

Chapter 2 Data Manipulation Dr. Farzana Rahman Assistant Professor Department of Computer Science James Madison University 1 Some sldes are adapted from Pearson Education

About you Why are you attending? What do you understand by Computer Architecture – (In 1 sentence)? Some sldes are adapted from Pearson Education 2

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 3 Some sldes are adapted from Pearson Education

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 4 Some sldes are adapted from Pearson Education

Computer Architecture Central Processing Unit (CPU) or processor Bus Motherboard RAM Peripheral devices 5 Some sldes are adapted from Pearson Education

Computer Architecture Bus CPU RAM Keyboard Hard Disk Display CD-ROM 6 Some sldes are adapted from Pearson Education

The Bus 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 7 Some sldes are adapted from Pearson Education

The Bus Bus CPU RAM Display 8 Some sldes are adapted from Pearson Education

The Bus Bus Suppose CPU needs to check to see if the user typed anything. CPU Keyboard Display 9 Some sldes are adapted from Pearson Education

The Bus Bus CPU puts “Keyboard, did the user type anything?” (represented in some way) on the Bus. CPU Keyboard Display “Keyboard, did the user type anything?” 10 Some sldes are adapted from Pearson Education

The Bus Bus Each device (except CPU) is a State Machine that constantly checks to see what’s on the Bus. CPU Keyboard Display “Keyboard, did the user type anything?” 11 Some sldes are adapted from Pearson Education

The Bus Bus Keyboard notices that its name is on the Bus, and reads info. Other devices ignore the info. CPU Keyboard Display “Keyboard, did the user type anything?” 12 Some sldes are adapted from Pearson Education

The Bus Bus Keyboard then writes “CPU: Yes, user typed ‘a’.” to Bus. CPU Keyboard Display “CPU: Yes, user typed ‘a’.” 13 Some sldes are adapted from Pearson Education

The Bus Bus At some point, CPU reads the Bus, and gets the Keyboard’s response. CPU Keyboard Display “CPU: Yes, user typed ‘a’.” 14 Some sldes are adapted from Pearson Education

Computer Architecture Bus CPU RAM Keyboard Hard Disk Display CD-ROM 15 Some sldes are adapted from Pearson Education

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. 16 Some sldes are adapted from Pearson Education

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

Inside the CPU (cont.) Memory Registers Register 0Register 1Register 2Register 3Instruction RegisterProgram counter Arithmetic / Logic Unit To hold the address of the current instruction in RAM 18 Some sldes are adapted from Pearson Education To hold the current instruction Control Unit (State Machine)

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. 19 Some sldes are adapted from Pearson Education

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 20 Some sldes are adapted from Pearson Education

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 21 Some sldes are adapted from Pearson Education

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 22 Some sldes are adapted from Pearson Education

Adding values stored in memory 23 Some sldes are adapted from Pearson Education

Dividing values stored in memory 24 Some sldes are adapted from Pearson Education

The architecture of the machine described in Appendix C 25 Some sldes are adapted from Pearson Education

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 op- code 26 Some sldes are adapted from Pearson Education

Typical Assembly Instructions Some common assembly instructions include: 1) “Load” – Load a value from RAM into one of the registers 2) “Load Direct” – Put a fixed value in one of the registers (as specified) 3) “Store” -Store the value in a specified register to the RAM 4) “Add” - Add the contents of two registers and put the result in a third register 27 Some sldes are adapted from Pearson Education

Typical Assembly Instructions Some common instructions include: 5) “Compare” - If the value in a specified register is larger than the value in a second register, put a “0” in Register r0 6) “Jump” -If the value in Register r0 is “0”, change Instruction Pointer to the value in a given register 7) “Branch” -If the value in a specified register is larger than that in another register, change IP to a specified value 28 Some sldes are adapted from Pearson Education

Figure 2.5 The composition of an instruction for the machine in Appendix C 29 Some sldes are adapted from Pearson Education

Figure 2.6 Decoding the instruction 35A7 30 Some sldes are adapted from Pearson Education

31

Program Execution Controlled by two special-purpose registers – Program counter: address of next instruction – Instruction register: current instruction Machine Cycle – Fetch – Decode – Execute 32 Some sldes are adapted from Pearson Education

Figure 2.8 The machine cycle 33 Some sldes are adapted from Pearson Education

Figure 2.10 The program from Figure 2.7 stored in main memory ready for execution 34 Some sldes are adapted from Pearson Education

Figure 2.11 Performing the fetch step of the machine cycle 35 Some sldes are adapted from Pearson Education

Figure 2.11 Performing the fetch step of the machine cycle (cont’d) 36 Some sldes are adapted from Pearson Education

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 37 Some sldes are adapted from Pearson Education

Running the Program a c Memory Load a into r1 Load b into r3 r2  r1 + r3 Store r2 into c Load a into r1 r1 r2 r3 r4 IR IP Logic CPU 2 b 38 Some sldes are adapted from Pearson Education

Running the Program a c Memory Load a into r1 Load b into r3 r2  r1 + r3 Store r2 into c Load b into r3 r1 r2 r3 r4 IR IP Logic CPU 3 b 2 39 Some sldes are adapted from Pearson Education

Running the Program a c Memory Load a into r1 Load b into r3 r2  r1 + r3 Store r2 into c r2  r1 + r3 r1 r2 r3 r4 IR IP Logic CPU 3 b Some sldes are adapted from Pearson Education

Running the Program a c Memory Load a into r1 Load b into r3 r2  r1 + r3 Store r2 into c Store r2 into c r1 r2 r3 r4 IR IP Logic CPU 3 b Some sldes are adapted from Pearson Education

Running the Program a c Memory Load a into r1 Load b into r3 r2  r1 + r3 Store r2 into c Store r2 into c r1 r2 r3 r4 IR IP Logic CPU 3 b Some sldes are adapted from Pearson Education

Arithmetic/Logic Operations Logic: AND, OR, XOR – Masking Rotate and Shift Arithmetic: add, subtract, multiply, divide 43 Some sldes are adapted from Pearson Education

Rotating the bit pattern 65 (hexadecimal) one bit to the right 44 Some sldes are adapted from Pearson Education

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 45 Some sldes are adapted from Pearson Education

Figure 2.13 Controllers attached to a machine’s bus 46 Some sldes are adapted from Pearson Education

Figure 2.14 A conceptual representation of memory-mapped I/O 47 Some sldes are adapted from Pearson Education

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 48 Some sldes are adapted from Pearson Education

Communicating with Other Devices (continued) Parallel Communication: Several communication paths transfer bits simultaneously. Serial Communication: Bits are transferred one after the other over a single communication path. – USB 49 Some sldes are adapted from Pearson Education

Putting it all together 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 50 Some sldes are adapted from Pearson Education

Question Direct to 51 Some sldes are adapted from Pearson Education