DH2T 34 – HNC Computer Architecture 1 Lecture 14 The Fetch-Decode-Execute Cycle [1]. © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College.

Slides:



Advertisements
Similar presentations
The CPU The Central Presentation Unit What is the CPU?
Advertisements

Fetch-Execute cycle. Memory Read operation Read from memory.
The Fetch – Execute Cycle
Computer Architecture and the Fetch-Execute Cycle
Central Processing Unit
ARITHMETIC LOGIC SHIFT UNIT
Computer Organization and Architecture
Processor Function Topic 3.
Computer Organization and Architecture
DH2T 34 Computer Architecture 1 LO2 Lesson Two CPU and Buses.
The CPU. Parts of the CPU Control Unit Arithmetic & Logic Unit Registers.
Computer Systems. Computer System Components Computer Networks.
The processor and main memory chapter 4, Exploring the Digital Domain The Development and Basic Organization of Computers.
Basic Computer Organization, CPU L1 Prof. Sin-Min Lee Department of Computer Science.
Dale & Lewis Chapter 5 Computing components. Let’s design a computer Generic CPU with registers −Program counter (PC) – 5 bits (size of addresses) −Instruction.
A-Level Computing#BristolMet Session Objectives#4 MUST describe the differences between the main types of primary memory SHOULD describe the function and.
Inside The CPU. Buses There are 3 Types of Buses There are 3 Types of Buses Address bus Address bus –between CPU and Main Memory –Carries address of where.
The Computer Processor
Lecture 13 - Introduction to the Central Processing Unit (CPU)
Computer Science 210 Computer Organization The Instruction Execution Cycle.
Processor Structure & Operations of an Accumulator Machine
A-Level Computing#BristolMet Session Objectives#5 MUST identify different buses and registers used in a CPU SHOULD describe the use of buses to send information.
SAP1 (Simple-As-Possible) Computer
D75P 34R HNC Computer Architecture 1 Week 9 The Processor, Busses and Peripherals © C Nyssen/Aberdeen College 2003 All images © C Nyssen /Aberdeen College.
Computer Architecture and the Fetch-Execute Cycle
Computer Architecture and the Fetch-Execute Cycle
Microcode Source: Digital Computer Electronics (Malvino and Brown)
The CPU Central Processing Unit. 2 Reminder - how it fits together processor (CPU) memory I/O devices bus.
Von Neumann Machine Objectives: Explain Von Neumann architecture:  Memory –Organization –Decoding memory addresses, MAR & MDR  ALU and Control Unit –Executing.
Model Computer CPU Arithmetic Logic Unit Control Unit Memory Unit
Lecture 14 Today’s topics MARIE Architecture Registers Buses
D75P 34 – HNC Computer Architecture Week 1 Main Components Of A Processor © C Nyssen/Aberdeen College 2003 All images © C Nyssen /Aberdeen College unless.
Fetch-execute cycle.
D75P 34 – HNC Computer Architecture
Computer Architecture Lecture 03 Fasih ur Rehman.
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
COMPILERS CLASS 22/7,23/7. Introduction Compiler: A Compiler is a program that can read a program in one language (Source) and translate it into an equivalent.
Computer Organization 1 Instruction Fetch and Execute.
Assessment Covering… Von Neuman architecture Registers – purpose and use, the fetch execute cycle.
Dale & Lewis Chapter 5 Computing components
Von Neumann Model Computer Organization I 1 September 2009 © McQuain, Feng & Ribbens The Stored Program Computer 1945: John von Neumann –
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
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.
Structure and Role of a Processor
CMSC 104, Lecture 061 Stored Programs A look at how programs are executed.
Designing a CPU –Reading a programs instruction from memory –Decoding the instruction –Executing the instruction –Transferring Data to/From memory / IO.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
8085 INTERNAL ARCHITECTURE.  Upon completing this topic, you should be able to: State all the register available in the 8085 microprocessor and explain.
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.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
CPU Lesson 2.
Systems Architecture Keywords Fetch Execute Cycle
SAP1 (Simple-As-Possible) Computer
Lecture 13 - Introduction to the Central Processing Unit (CPU)
Edexcel GCSE Computer Science Topic 15 - The Processor (CPU)
Lesson Objectives A note about notes: Aims
Chapter 4 The Von Neumann Model
The Processor and Machine Language
Functional Units.
Computer Organization and ASSEMBLY LANGUAGE
The Little Man Computer
GCSE OCR 1 The CPU Computer Science J276 Unit 1
Information Representation: Machine Instructions
Objectives Describe common CPU components and their function: ALU Arithmetic Logic Unit), CU (Control Unit), Cache Explain the function of the CPU as.
Computer Operation 6/22/2019.
Computer Architecture
Presentation transcript:

DH2T 34 – HNC Computer Architecture 1 Lecture 14 The Fetch-Decode-Execute Cycle [1]. © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College except where stated Prepared 8/12/03

We saw last time that low-level programs are run in Assembly Language. No matter what type of processor is used, each assembly code instruction usually comes in two parts – an OPCODE and an OPERAND. #assembly code program 0000 LDA-24 #loads 0001 ADD-25 #adds 0002 HLT #stops #end of program To start, look at the instruction set for the processor, to get an idea of what the program does, before doing an assembly code trace. All the examples shown here will use the “beginners” set in the pink workbook. Opcodes are sometimes called “mnemonics” because they do what they sound like!

To begin, all the instructions are loaded into the RAM. In a CISC processor, the instructions will be different sizes. In a RISC, they will all be 32-bits wide. For the moment, however, we will assume that they are all the same size.

The CPU now fetches each instruction in turn, decodes and executes it. This is called the FETCH-DECODE- EXECUTE cycle.

The FDE Cycle has 3 distinct phases – FETCH - the CPU collects the instruction from RAM DECODE - the Control Unit figures out what to do with it EXECUTE - the instruction is carried out. The FETCH and DECODE phases never vary. The EXECUTE phase may be different each time, because it depends on what the instruction was! For this example we will assume a “cold boot” to start – i.e. all the internal registers are set at zero.

Whenever a new value enters the MAR, this is the signal for it to point to the matching RAM address using the Address Bus. So in this case we are pointing at location FETCH First the Program Counter copies its’ contents to the MAR.

When the pointer hits the RAM cell, this is a trigger for it to dump its’ contents on the Data Bus and send them back to the MDR. The MDR will now contain the value LDA-24.

The contents of the MDR now get transferred to the Instruction Register, ready to be decoded. This is the end of the FETCH part of the instruction.

DECODE The Decoder in the Control Unit takes the instruction and splits it into the two parts – the opcode and the operand. opcodeoperand In this example the opcode LDA tells us to load the accumulator with data. The Operand 24 tells us where the data will come from. At this point the PC also increments itself by 1.

To bring the data back, we first have to set up the MAR again so it is pointing at the correct cell. The 24 is put in the MAR, triggering it to point to RAM address 24. EXECUTE This will vary between instructions. In this case we are loading the accumulator with a value taken from a RAM location.

When the pointer hits address 24, this is the signal for it to dump the contents onto the Data Bus. So the value 6 is sent back to the MDR.

The whole instruction was to load the accumulator with the value, so we copy in the 6. This is the whole instruction completed and we are now ready to begin the next one. Note that the values in the registers do not change until a new value arrives to overwrite them.

FETCH The PC copies its’ contents to the MAR. This signals it to point to RAM location The contents of 0001 (ADD-25) are dumped on the Data Bus and brought back to the MDR.

The ADD-25 is copied to the Instruction Register, where the decoder splits it into ADD and 25. Remember to increment the Program Counter!

EXECUTE In this case we are ADDing whatever is in RAM address 25, to the value already in the Accumulator. Because we have to retrieve the contents of 25 first, we have to set up the MAR again.

The address bus points to the correct RAM address, which dumps the contents on the Data Bus and returns them to the MDR. This value is then passed to the Accumulator and added on to what is already there.

FETCH The PC copies its’ contents to the MAR, which is triggered to point to RAM location The contents of 0002 are brought back along the Data Bus and transferred to the MDR.

DECODE The MDR contents are taken to the IR to be decoded. The PC increments by 1.

EXECUTE In this case there is no operand, just the Opcode, so the MAR does not change. The instruction HLT means “stop the program” so nothing else will happen from here on. The space that the program occupied in RAM will be overwritten by the next program to be loaded and run.

In some books the Fetch-Decode phases are shown as just a Fetch phase, and the cycle is just called the Fetch- Execute Cycle. The point at which the PC increments can also vary depending on processor models. For your first assessment question you will be required to trace several instructions through the processor, showing the different values in the registers at each stage.

Summary [1] F To run the program, first the instructions are loaded into RAM. F The CPU then fetches, decodes and executes each instruction in turn. F The Fetch and Decode phases are always the same but the Execute phase will vary.

Summary [2] FETCH – 2 PC -> MAR. MAR points to correct RAM address. 2 Contents of address are brought back to MDR. 2 Contents are passed to the IR for decoding. DECODE 2 Instruction is split into an Opcode and Operand. 2 PC is incremented by 1. EXECUTE 2 This may involve setting up the MAR again, loading or moving values, or performing arithmetic or logic operations.