0% found this document useful (0 votes)
18 views

Fetch Execute Cycle

Uploaded by

bennie
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Fetch Execute Cycle

Uploaded by

bennie
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

The role of the CPU

• The CPU (central processing unit) is one of the fundamental parts of a computer.
• Many people say it is the most important part, as it is where all the data and
• instructions are processed. This means it is a little bit like your brain, as that is where
• you process all the data and instructions that you sense on a daily basis.
Microprocessor.

• All computers have a form of CPU. In devices such as personal computers (PC) and
laptops, this is normally a separate component in the computer. In devices such as
those found in our houses, e.g. our washing machine, a similar type of component
exists called a microprocessor.

• This performs a similar role to a CPU, but on a smaller scale.


• Whereas a CPU can process thousands of complex instructions, a microprocessor will
process a much more limited set of instructions.
Embedded system
• A general purpose computer, such as a PC or a laptop, has a CPU and is able to perform
a wide variety of
tasks.
• A microprocessor is often built into a system that is designed to perform a very specific
task. This type of system is called an embedded system
• There are examples of embedded systems in many different areas of our lives, for
example, a traffic light,
a washing machine and a digital alarm clock.
Fetch-decode-execute cycle
• When an instruction is processed by a computer, the method that is used to do this is
called the fetch-decode-execute cycle.
• fetch-decode execute cycle : the cycle through which data and instructions are
processed.
• To carry out a set of instructions, the CPU first of all fetches some data and
instructions from memory and stores them in suitable registers. Both the address bus
and data bus are used in this process.
• Once this is done, each instruction needs to be decoded before finally being
executed.
Basic representation of the
fetch-decode-execute cycle:
program counter (PC):
• a component in the CPU that stores the address of the next instruction to be processed.

• An address: is a memory location in RAM.


The fetch stage
• Data and instructions are given to the computer through the use of input devices.
• When the data and instructions are input, they are stored in RAM (random access memory).
• If a user wants to open a file that is stored on the hard drive, this data will be brought from the
hard drive into the RAM,
• In order for the data and instructions to be processed, they need to be brought
from the RAM into the CPU.
• This is what happens at the fetch stage of the cycle. A component within the CPU, called the
program counter (PC), stores an address.
• This component is an example of a register.
• The address stored by the PC is the address of the next instruction that needs to be processed.
• The details of this address will be a location within the RAM.
• The PC is then incremented (increased by 1) so that the next instruction can be then be
processed.
Memory address register (MAR
• This address stored in the PC needs to be sent to another component in the CPU called
the memory address register (MAR).
• This is another example of a register in the CPU.
• The address is transported from the PC to the MAR using the address bus.

• Address bus: wires used for the transmission of addresses between components in a
computer.
Memory data register (MDR
• Once the MAR has received the address it now knows where to find the instruction in
the RAM.
• To retrieve the instruction the MAR needs to send the address to the location in RAM. It
uses the address bus again to do this.
• Once the address is received at the location in RAM, the data stored in this location,
e.g. the instruction, is sent to a component within the CPU called the memory data
register (MDR).
• This is also an example of a register in the CPU.
• The instruction is sent to the MDR using the data bus.
Current instruction register (CIR
• When the MDR has received the instruction, it sends it to the current instruction
register (CIR).
• This is another example of a register in the CPU.
• The MDR uses the data bus to send the instruction to the CIR.
• This register is part of a component within the CPU called the control unit (CU).
• It is the CU that is responsible for the next stage of the cycle, the decode stage.
The decode stage

• The decode stage of the cycle begins when the instruction is received by the CU.
• The CU is the unit in the CPU that decodes the instruction.
• The instruction needs to be decoded so that the CPU can understand what is required
to execute the instruction.
Instruction set.
• The instruction is then decoded so that it can be interpreted in the next part of the
cycle.
• To decode an instruction the CU uses an instruction set.
• This is a set of all the commands that are understood and can be processed by the
CPU.
• These commands are in machine code.
• Once the instruction is decoded using the instruction set, it can now be executed.
The execute stage
• The CPU passes the decoded instruction as a set of control signals to the appropriate
components within the computer system.
• The execute stage is when any actions that are required for the instruction are carried
out.
• This is likely to involve some mathematical and logical calculations.
• If these kinds calculations are required, the data used in the process is sent to the
arithmetic logic
unit (ALU).
Arithmetic logic unit (ALU):
• The component in the CPU that performs all the mathematical and logical operations
required when processing data and instructions.
• This is a component within the CPU that is responsible for any calculations.
• Interim values may be created whilst these calculations are being performed, the ALU
has a special register built into it called the accumulator (ACC).
Accumulator (ACC):
• A register that is built into the ALU that stores the result of any interim calculations.
• It is this special register that will store the interim values that are created in any
calculations.
• Once any calculations have been performed, the actions for the instruction can be
performed,
e.g. the file can be opened or the letter typed can be displayed.
Control unit (CU):

• The component in the CPU that controls all the operations in the CPU.
• How do all the different components know what they are doing in the fetch-decode
execute cycle?
• They have a conductor! This conductor is the CU.
• It sends signals to all the components within the CPU to tell them when they need to
perform their different roles.
• The CU uses the control bus to send these signals.
Questions

1. Where is data stored before it is fetched into the CPU?


2. Which component in the CPU is responsible for making sure the fetch-decode execute
3. cycle is performed correctly?
4. What is the role of a bus?
5. Why does the ALU need the ACC? What would have to happen if it didn't have this
special register?
Copy the table below and fill in a description
for each component in the CPU:
Fetch–Decode–Execute cycle
flowchart

You might also like