Lecture 3. Diff b/w RAM and Registers Registers are used to hold data immediately applicable to the operation at hand Registers are used to hold data.

Slides:



Advertisements
Similar presentations
Chapter 2: Data Manipulation
Advertisements

The Fetch – Execute Cycle
Central Processing Unit
Chapter 2 Data Manipulation Dr. Farzana Rahman Assistant Professor Department of Computer Science James Madison University 1 Some sldes are adapted from.
Damian BrowneLuis PabonPedro Tovar The operation of a computer in executing a program consists of a sequence of Instruction Cycles, with one machine.
 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.
Computer Systems. Computer System Components Computer Networks.
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
Computer Processing CSCE 110 J. Michael Moore.
Stored Program Concept: The Hardware View
LAB 9 Simulator Chap 14 REED. Datapath Simulator accompanying the text is a datapath simulator a.k.a. the Knob & Switch Computer developed by Grant Braught.
Chapter 2.2 Machine Language.
Basic Computer Organization, CPU L1 Prof. Sin-Min Lee Department of Computer Science.
1 Sec (2.3) Program Execution. 2 In the CPU we have CU and ALU, in CU there are two special purpose registers: 1. Instruction Register 2. Program Counter.
J. Michael Moore Computer Processing CSCE 110. J. Michael Moore ProcessorInputOutput Memory Storage.
Introduction to computer: executes instructions. Overview Topics discussed in this webnote: –Structure and operation of the CPU –Program flow –Types of.
Lecture 13 - Introduction to the Central Processing Unit (CPU)
Computer Science 210 Computer Organization The Instruction Execution Cycle.
Data manipulation, Part one Introduction to computer, 2nd semester, 2010/2011 Mr.Nael Aburas Faculty of Information.
CPU Design. Introduction – The CPU must perform three main tasks: Communication with memory – Fetching Instructions – Fetching and storing data Interpretation.
Model Computer CPU Arithmetic Logic Unit Control Unit Memory Unit
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.
Computer Science 101 Computer Systems Organization ALU, Control Unit, Instruction Set.
Fetch-execute cycle.
Lecture 7: 9/17/2002CS149D Fall CS149D Elements of Computer Science Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture.
D75P 34 – HNC Computer Architecture
Computer Systems Organization
Data Manipulation, part two Introduction to computer, 2 nd semester, 2010/2011 Mr.Nael Aburas Faculty of Information.
Question What technology differentiates the different stages a computer had gone through from generation 1 to present?
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.
Control units In the last lecture, we introduced the basic structure of a control unit, and translated our assembly instructions into a binary representation.
27 October 2015 Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Lec 4-2 Five operations of the machine cycle Fetch- fetch the next program instruction from memory. (PC+1); instruction to IR Decode- decode the instruction.
Chapter 5 Computer Organization TIT 304/TCS 303. Purpose of This Chapter In this chapter we introduce a basic computer and show how its operation can.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Lecture 13 - Introduction to the Central Processing Unit (CPU)
Edexcel GCSE Computer Science Topic 15 - The Processor (CPU)
Chapter 4 The Von Neumann Model
Instruction Format MIPS Instruction Set.
Chapter 4 The Von Neumann Model
Computer Science 210 Computer Organization
The fetch-execute cycle
The Processor and Machine Language
Chapter 4 The Von Neumann Model
Computer Science 210 Computer Organization
Functional Units.
CS149D Elements of Computer Science
Computer Organization and ASSEMBLY LANGUAGE
CSCE Fall 2013 Prof. Jennifer L. Welch.
CSCE 121: Simple Computer Model Spring 2015
MARIE: An Introduction to a Simple Computer
Sequencing, Selection, and Loops in Machine Language
Branch instructions We’ll implement branch instructions for the eight different conditions shown here. Bits 11-9 of the opcode field will indicate the.
MARIE: An Introduction to a Simple Computer
CSCE Fall 2012 Prof. Jennifer L. Welch.
Instruction Format MIPS Instruction Set.
Control units In the last lecture, we introduced the basic structure of a control unit, and translated our assembly instructions into a binary representation.
The Stored Program Computer
Program Execution.
Instruction execution and ALU
Computer Architecture
COMPUTER ARCHITECTURE
Sec (2.3) Program Execution.
Little Man Computer.
Presentation transcript:

Lecture 3

Diff b/w RAM and Registers Registers are used to hold data immediately applicable to the operation at hand Registers are used to hold data immediately applicable to the operation at hand Main Memory is used to hold data that would be needed in near future Main Memory is used to hold data that would be needed in near future A bus is a collection of wires. Through bus the CPU is able to extract or read data from main memory by supplying the address. A bus is a collection of wires. Through bus the CPU is able to extract or read data from main memory by supplying the address. Also CPU can write data into memory by providing the address or destination of the cell Also CPU can write data into memory by providing the address or destination of the cell

Sec 2.3 Program Execution Cycle A computer follows a program stored in Main memory by copying one instruction at a time from memory to control unit A computer follows a program stored in Main memory by copying one instruction at a time from memory to control unit Once in the Control Unit each instruction is decoded and obeyed Once in the Control Unit each instruction is decoded and obeyed The order in which the instructions are fetched from memory correspond to the order in which they are stored in memory unless specified by JUMP The order in which the instructions are fetched from memory correspond to the order in which they are stored in memory unless specified by JUMP

Machine Cycle Control Unit continually repeat a set of steps known as Machine Cycle that are: Control Unit continually repeat a set of steps known as Machine Cycle that are: Fetch Fetch Decode Decode Execute Execute

What is Fetch ?? During the Fetch the Control Unit requests the Main Memory to provide it with the instruction next to be executed. During the Fetch the Control Unit requests the Main Memory to provide it with the instruction next to be executed. The Control Unit knows the instruction address because it is kept in the Program Counter The Control Unit knows the instruction address because it is kept in the Program Counter The Control Unit places the instruction received from memory in its Instruction Register and then increments the PC The Control Unit places the instruction received from memory in its Instruction Register and then increments the PC

What is Decode ?? With the instruction now in the IR the control unit decodes the instruction, which involves breaking it up into Op-code and Operands. With the instruction now in the IR the control unit decodes the instruction, which involves breaking it up into Op-code and Operands. Op-code is the number that indicates the machine instruction that needs to be executed. Op-code is the number that indicates the machine instruction that needs to be executed. Operands are those that would be manipulated by the execution of the instruction Operands are those that would be manipulated by the execution of the instruction

Figure 2.5 The composition of an instruction for the machine in Appendix C

Figure 2.6 Decoding the instruction 35A7

Figure 2.7 An encoded version of the instructions in Figure 2.2

What is Execute ?? The Control Unit then executes the instruction by activating the proper circuitry to perform the requested task The Control Unit then executes the instruction by activating the proper circuitry to perform the requested task Example: Example: If the instruction is LOAD from memory the CU causes the load to occur If the instruction is LOAD from memory the CU causes the load to occur When the Execute is over the Control Unit begins the cycle again

What About the JUMP Instruction ?? There are two kinds of Jump Conditional and Unconditional Jumps There are two kinds of Jump Conditional and Unconditional Jumps Conditional Jump would be executed only if certain condition is met Conditional Jump would be executed only if certain condition is met Example Example If I have instruction B43C then B is the opcode for jump, 4 stands for Register R4, 3C is the memory address If I have instruction B43C then B is the opcode for jump, 4 stands for Register R4, 3C is the memory address ???????????????????????????????? ????????????????????????????????

This means that the Control Unit would first compare the contents of Register 4 with Register 0 if both are equal then the Control would put the address 3C into PC. This means that the Control Unit would first compare the contents of Register 4 with Register 0 if both are equal then the Control would put the address 3C into PC. Thus Program Execution would be altered and the instructions in between would be skipped. Thus Program Execution would be altered and the instructions in between would be skipped. However if R0 and R4 are not equal then normal execution would be continued. However if R0 and R4 are not equal then normal execution would be continued.

Figure 2.9 Decoding the instruction B258

An Example of Program Execution Suppose I have written the following High Level Language Instuction Suppose I have written the following High Level Language Instuction a:= b+c a:= b+c Now a, b, c are names given to some cells of memory Now a, b, c are names given to some cells of memory Suppose the address of Suppose the address of a is B2 a is B2 b is C3 b is C3 c is AA c is AA Simplified : Load the value stored in address C3 in some register Load the value stored in address C3 in some register Load the value stored in address AA in some registers Load the value stored in address AA in some registers Add both the registers and store their answer in the third register Add both the registers and store their answer in the third register Put Back / Store the answer in the main memory at address B2 Put Back / Store the answer in the main memory at address B2 Stop/ Halt the instruction Stop/ Halt the instruction

Machine Instructions Single High Level instructions gets translated into one or more Machine Level Instructions Single High Level instructions gets translated into one or more Machine Level Instructions Thus Machine Instructions would be: Thus Machine Instructions would be: 15C3 : Load R5 with the contents of b 15C3 : Load R5 with the contents of b 16AA : Load R6 with the content of c 16AA : Load R6 with the content of c 5056 : Add R5, R6 and store their result in R : Add R5, R6 and store their result in R0 30B2 : Store the result saved in R0 to address B2 30B2 : Store the result saved in R0 to address B2 C000: Halt C000: Halt

An Example of Program Execution (cont….) AddressContent A015 A1C3.A216.A3AA A450 A556 A630 A7B2 A8C0 A900.? AA09AddressContentB0?.? B2?.?.?.?.?.? C302.?..?

At first PC would be A0 IR would be empty PC : A2 IR: 15C3 Step 1: R5 would contain PC: A4 IR : 16AA Step 2: R6 would contain PC: A6 IR: 5056 Step 3: R0 would contain B PC : A8 IR: 30B2 Step 4: Next value B would be copied to location B PC: AA IR: C000 Step 5: Halt In the end B2 i.e memory a would be containing the result