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.

Slides:



Advertisements
Similar presentations
Chapter 2: Data Manipulation
Advertisements

Microprocessors Typical microprocessor controlled devices: Camera, mobile phone, stereo, mp3 player, electronic toys… High-level microprocessor controlled.
Control path Recall that the control path is the physical entity in a processor which: fetches instructions, fetches operands, decodes instructions, schedules.
Chapter 2 Data Manipulation Dr. Farzana Rahman Assistant Professor Department of Computer Science James Madison University 1 Some sldes are adapted from.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 2: IT Students.
 Suppose for a moment that you were asked to perform a task and were given the following list of instructions to perform:
2.3) Example of program execution 1. instruction  B25 8 Op-code B means to change the value of the program counter if the contents of the indicated register.
Processor System Architecture
1 Lecture-2 CSIT-120 Spring 2001 Revision of Lecture-1 Introducing Computer Architecture The FOUR Main Elements Fetch-Execute Cycle A Look Under the Hood.
TK 2633 Microprocessor & Interfacing
Computer Systems. Computer System Components Computer Networks.
Midterm Wednesday Chapter 1-3: Number /character representation and conversion Number arithmetic Combinational logic elements and design (DeMorgan’s Law)
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Chapter 0 Introduction to Computing
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
1 Lecture-2 CS-120 Fall 2000 Revision of Lecture-1 Introducing Computer Architecture The FOUR Main Elements Fetch-Execute Cycle A Look Under the Hood.
Chapter 2.2 Machine Language.
Elements of the Computer (How a processor works)
The CPU The Central Presentation Unit Main Memory and Addresses Address bus and Address Space Data Bus Control Bus The Instructions set Mnemonics Opcodes.
Machine Instruction Characteristics
Information Representation: Machine Instructions
Data manipulation, Part one Introduction to computer, 2nd semester, 2010/2011 Mr.Nael Aburas Faculty of Information.
Week 2.  Understand what the processor is and what it does.  Execute basic LMC programs.  Understand how CPU characteristics affect performance.
Chapter 4 MARIE: An Introduction to a Simple Computer.
Assembly Language A Brief Introduction. Unit Learning Goals CPU architecture. Basic Assembler Commands High level Programming  Assembler  Machine Language.
Computer Organization - 1. INPUT PROCESS OUTPUT List different input devices Compare the use of voice recognition as opposed to the entry of data via.
Lecture 14 Today’s topics MARIE Architecture Registers Buses
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.
1 Purpose of This Chapter In this chapter we introduce a basic computer and show how its operation can be specified with register transfer statements.
Computer Architecture Memory, Math and Logic. Basic Building Blocks Seen: – Memory – Logic & Math.
Computer Science 101 Computer Systems Organization ALU, Control Unit, Instruction Set.
Chapter 2 Data Manipulation. © 2005 Pearson Addison-Wesley. All rights reserved 2-2 Chapter 2: Data Manipulation 2.1 Computer Architecture 2.2 Machine.
A summary of TOY. 4 Main Components Data Processor Control Processor Memory Input/Output Device.
Computer Structure & Architecture 7b - CPU & Buses.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI N305 Information Representation: Machine Instructions.
September 26, 2001Systems Architecture I1 Systems Architecture I (CS ) Lecture 2: Implementation of a Simplified Computer Jeremy R. Johnson Wednesday,
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
Electronic Analog Computer Dr. Amin Danial Asham by.
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Register Transfer Languages (RTL)
Question What technology differentiates the different stages a computer had gone through from generation 1 to present?
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.
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
27 October 2015 Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.
1 3 Computing System Fundamentals 3.2 Computer Architecture.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Basic Computer Organization and Design
Control Unit Lecture 6.
CPU Organisation & Operation
Edexcel GCSE Computer Science Topic 15 - The Processor (CPU)
Computer Architecture
CS/COE0447 Computer Organization & Assembly Language
Data Representation – Instructions
The Processor and Machine Language
Functional Units.
CS149D Elements of Computer Science
CSCE Fall 2013 Prof. Jennifer L. Welch.
MARIE: An Introduction to a Simple Computer
Systems Architecture I (CS ) Lecture 2: A Simplified Computer
CSCE Fall 2012 Prof. Jennifer L. Welch.
Basic components Instruction processing
A Top-Level View Of Computer Function And Interconnection
Information Representation: Machine Instructions
Instruction execution and ALU
CS 111 – Sept. 16 Machine language examples Instruction execution
Presentation transcript:

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 –Meet here tomorrow.

Basic anatomy Inside a computer are 2 parts –CPU –Memory –These are connected by a data bus: an “HOV lane” where traffic can go either way. CPU contains: –ALU: arithmetic and logic unit –Control unit: figures out what to do next –Registers to hold values needed for calculation Memory (RAM) contains: –Software: list of instructions the CPU needs to perform –Data: Input and output values need to be stored while program runs

Stored program idea Program = software = list of instructions for CPU to do Programs reside in memory CPU will do 1 instruction at a time For each instruction, we do the following: –Fetch it from memory –Decode – figure out what it means –Execute – do it –And then we continue with the next instruction… until the program is finished.

Simple example A program to add two numbers. This program may reside at bytes in RAM. The two numbers we wish to add are located at bytes 200 and 204 in RAM. We want the result to go into memory at byte 208. Program may go something like this: –Load the value at Memory[200] into register 1. –Load the value at Memory[204] into register 2. –Add registers 1 and 2, and put result in register 3. –Store the value from register 3 into Memory[208]. Note that the bus is communicating instructions (RAM to CPU) as well as data (both ways).

Machine language Unfortunately, instructions for CPU can’t be in English, French, etc. Machine language = binary (or hex) representation of our instructions. –Each type of computer has its own machine language. This is the oldest form of “computer programming”. Later we’ll look at much more intuitive ways to convey instructions. Verbs: Instruction set. e.g. Add, subtract, load, store… Nouns: Operands such as: registers, memory locations, constants, other instructions

Verbs 3 kinds of instructions (instruction set) Data transfer, using the bus –Load a value from memory into a CPU register Very similar to fetching an instruction! –Store a value from a CPU register into memory ALU –Bit manipulation: AND, OR, XOR, NOT, shift left, shift right, … –Arithmetic: add, sub, mul, div, remainder, =,, , , ≠, … Control –“Go to” another instruction in program. In other words, interrupt normal sequence of instructions. –Can be conditional or unconditional

Example language Our book illustrates with an example HW. 256 bytes of RAM: addressable by 8 bits CPU contains –Instruction register –Program counter –16 general purpose registers: addressable by 4 bits Each register is 1 byte Each instruction is 2 bytes = 16 bits = 4 hex digits long Instruction format: –First 4 bits are the opcode = specify which instruction type –Other 12 bits are operand(s) What do instructions mean? See pp

Example instructions Note: 16 possible opcodes: 4 bit opcode Note: 16 possible registers: register number also 4 bits Opcode 5 is used for adding –Expects 3 register operands –5RST means R = S + T, where R, S and T are register numbers –Ex means Add registers 2 and 3 and put result in register 1. Opcode 2 is for putting a constant in a register –Expects a register operand, and an 8-bit constant operand –2RXX means R = XX, where XX is some 8-bit pattern –Ex. 27c9 means Put the hexidecimal “c9” into register 7. Try an example using both types of instructions.

More instructions Opcode 1 is for loading a memory value into a register –Expects a register operand (4 bits), and a memory address from which to load (8 bits). –Ex means to go out to memory at address [20], grab the contents and load it into register 8. (It does not mean put the number 20 in register 8.) Opcode 3 is a store = opposite of load –Ex means to take the value in register 9, and put it into memory at location [21]. (It does not mean put the number 9 into memory location 21.) Opcode C (hex code for 12) is for telling CPU it’s done. –Expects operand to be 12 zero-bits.