3.1 Hardware The CPU Architecture

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

The CPU & Microprocessor

Understand the role of the central processing unit (CPU) in a computer

 A computer system consists of hardware and software


 The main hardware components of a computer system are input devices, the
central processing unit, primary memory, secondary storage and output
devices
 Examples of input devices - keyboard, mouse, game controller, sensors,
microphone and webcam
 Examples of output devices - monitor, phone screen, speakers, printer, and
motors
 Data and commands are inputted by the user using an input device, the central
processing unit (CPU) processes data by executing instructions and the results
are outputted to an output device

A diagram showing the input, process, output sequence followed by


computer systems

 Below is an example of data being inputted, processed and the results being
outputted

Example
Step

Input  A keyboard is used to input a number

Process  If the instruction being executed is ADD, the


inputted value is added to an existing value

Output  The result of the calculation is outputted to the


user via the monitor
Understand what is meant by a microprocessor

 A microprocessor is a type of integrated circuit on a single chip


 An integrated circuit is a small electronic circuit made up of transistors,
capacitors, resistors and other electronic components
 The integrated circuit contains a central processor designed to
perform arithmetic and logic operations, which include adding, subtracting,
transferring numbers from one memory location to another, and comparing two
numbers
 The single chip also contains input/output interfaces, and memory
 Microprocessors are a compact way of processing data and can be used in a wide
range of electronic devices, including general-purpose computer system 
and Embedded system

Worked Example
What is the purpose of a microprocessor? 

A   It is the brain of the computer


B   It processes data [1 mark]
C   It executes instructions [1 mark]
D   It is where data is stored permanently

 Answer - B or C
o The microprocessor is sometimes described as the brain of the computer
system but this is not an acceptable exam answer. The purpose of a
microprocessor is to process data and execute instructions 

Von Neumann Architecture


The components in a CPU, in a computer that has a Von Neumann architecture

 John Von Neumann developed the concept of the stored program computer in


the 1940s

 The Von Neumann computer architecture which most modern day computers
use, is based upon this concept
o The key feature of the stored program concept, and Von Neumann
architecture, is data and instructions are stored in the same memory
( RAM ) as  binary
o Another feature of Von Neumann architecture is a central processing unit
(CPU) fetches instructions from memory and executes them one at a
time (serially)
o The CPU then stores the results back into memory

Components of the Central Processing Unit

A diagram showing the main components of the CPU

 The main purpose of the CPU is to execute instructions and process data

 The CPU has two main components - the Control Unit (CU) and the Arithmetic
Logic Unit ALU)
o The Control Unit controls the flow of data around the CPU
o The Control Unit also sends control signals to the different components
instructing them what to do e.g. read, write, add, subtract
o The Control Unit decodes instructions (into an  opcode and operand )
o The Control Unit controls the timings of operations (the clock speed) 
o The Arithmetic Logic Unit(ALU)  performs the calculations required to
execute the instructions, these include ADD and SUBTRACT
o The ALU also carries out logical operations such as COMPARE
 The CPU also contains a number of registers which are small memory locations
within the CPU, which temporarily store data needed to execute an instruction
 Special purpose registers have specific roles to play in the execution of an
instruction

Special purpose register Definition

Program Counter (PC)  stores the address of the next instruction to be fetched
from memory

Memory  stores the address of the instruction or data to be fetched


Address  Registers (MAR) from or written to memory

Memory Data Register  stores the data that has been fetched from memory or
(MDR) being written to memory

Current Instruction Register  stores the instruction the CPU is currently decoding or
(CIR) executing

Accumulator  Temporarily stores the results of the calculations


performed by the arithmetic and logic unit

Exam Tip
If asked to describe the purpose of the PC, the MAR or the MDR make sure you explain
how the data is being fetched or written to memory.

Buses 

 Components within the CPU and wider computer system are connected by buses.
These are wires down which electronic signals and data travel. The different buses
are collectively called the system bus
 The system bus is made up of three different buses - the data bus, the control
bus and the address bus
o The data bus transmits data from the CPU to memory or input/output
controllers. It is bidirectional which means data can travel in both
directions
o The address bus transfers addresses from the CPU to memory. It
is unidirectional which mean addresses only go from the CPU to
memory
o The control bus transfers control signals from the control unit to other
components in the computer system such as memory or input/output
controllers. The control bus is bidirectional
http://www.edwardbosworth.com/My5155_Slides/Chapter12/SystemBusFundamentals.htm

A diagram showing how the different buses connect the components in a computer
system

Worked Example
Which bus is unidirectional?
 [1 mark]

A   Address bus [1 mark]


B   Data bus
C   Control bus
D   System bus
The Fetch, Decode, Execute cycle

 The Central Processing Unit (CPU) executes instructions by performing the Fetch
Decode Execute cycle
o The CPU fetches an instruction from memory
o The instruction is then decoded ( by the Control Unit) into
an opcode and an operand
o The instruction is executed and the whole cycle is repeated with the next
instruction in the process

A diagram depicting the Fetch Decode Execute cycle

Step
Detailed Explanation

Fetch  The memory address of the instruction to be fetched is sent down the address bus. 
 The data/instruction at the memory address is transferred back to the CPU, via the
data bus, where it is stored in the Memory Data Register
 The instruction is copied into the Current Instruction Register and the Program
Counter increments

 The instruction in the Current Instruction Register is decoded, by the  Control


Decode unit , into an opcode and an operand

Execut  The instruction is executed by the Arithmetic Logic Unit and the opcode is performed
e upon the operand. 

 The result is stored in the accumulator or written to a memory location within


memory
Worked Example
Explain how an instruction is fetched using Von Neumann architecture[6 marks]

  The Program Counter (PC) holds address/location of the next instruction to be


fetched [1 mark]
 The address held in PC is sent to Memory Address Register (MAR) [1 mark]
 The memory address is sent using address bus [1 mark]
 The Program Counter is incremented [1 mark]
 The instruction is sent from the address in memory to the Memory Data Register
(MDR) [1 mark]
 The instruction is transferred using the data bus [1 mark]
 The instruction is sent to Current Instruction register (CIR) [1 mark]

Exam Tip
Make sure you read the question carefully and look at the numbers of marks allocated
to judge the level of detail required. Often questions on the fetch-decode-execute cycle
only require you to describe the steps rather than explain how the registers and buses
are used during each step (as shown in the table above)

CPU Performance

 Central Processing Units can have multiple cores


o A dual-core processor has two cores
o A quad-core processor has four cores
o Each core runs separate fetch, decode,
execute cycles, independently from one another and at the same
time (simultaneously) meaning parallel processing can take place
o Multiple cores enables multitasking (running more than one program at
the same time)
o Some programs cannot be split between cores
o The more cores a computer has the more instructions that can be
executed per second resulting in better performance
 Each core has a clock speed
o The clock speed is how many instructions the core can execute each
second
o The clock speed is measured in Hertz
o Modern cores can execute billions of instructions per second 
o A gigahertz (GHz) is a billion instructions per second
o A megahertz (MHz) is a million instructions per second
o A CPU core with a clock speed of 3.4GHz can execute 3.4 billion
instructions per second
 Cache is a small amount of memory situated within or close to the CPU with
very fast read/write speeds
o It is used for storing frequently used instructions/data, recently used
instructions, and instructions that are to be fetched and executed next in a
process. 
o The impact of increasing the amount of cache is that more data can be
stored there and accessed faster than if it was in  RAM …which improves
the performance of the CPU. 
 Double the number of cores does not necessarily mean double the number of
instructions executed a second. The cores might have different clock speeds and
cache sizes

Worked Example
One computer has a single core processor and the other has a dual core processor.
Explain why having a dual core processor might improve the performance of the
computer [2 marks]
The computer with the dual core processor has two cores/double the amount of cores
[1 mark]

Parallel processing can take place

Each core can execute a separate instruction at the same time [1 mark]

Each core can process instructions independently of each other [1 mark]

Exam Tip
There are three key factors that affect CPU performance - the number of cores in your
CPU, the cache size and clock speed. You need to able to identify these factors and
explain how they affect the computer’s performance.

Instruction Sets

 An instruction set is a list of all the commands that can be processed by a CPU
 Each command has a unique binary code
 The table below shows an example instruction set. Each instruction has
a mnemonic that indicates what the instruction does alongside a corresponding
binary code


Instruction Set

ADD 10100001

SUB (subtract) 00100010

LDA (load) 10111111

STR (store) 01100000

BRA (branch) 01011010

 After an instruction is decoded into an opcode and an operand, the CPU finds the
opcode in the processor’s instruction set. It then knows what operation to
perform when executing the instruction

Worked Example
Using the instruction set in the table above what would be the operation if the
instruction was 00100010 00000010?
[1 mark]

 The operation would be SUB [1 mark]


 If the operand was raw data the complete instruction would be to subtract 2 from
the value in the accumulator

 Instruction lists are machine-specific


o This means a program created using one computer’s instruction set would
not run on a computer containing a processor made by a different
manufacturer
o For example, a computer program created using Intel’s instruction set
would not run on a device containing an ARM processor

Embedded Systems

 An embedded system is a computer systems with a either one function or


limited specific functions built within a larger mechanical device
 Its purpose is to control the device and allow a user to interact with it
 An embedded system is different to a general purpose computer system like a
laptop or desktop computer which can be used to perform many different tasks
 The vast majority of microprocessors manufactured are for use as embedded
systems
 Some embedded systems are microcontrollers meaning they are part of an
integrated circuit with built in memory

Type of embedded system Description

Integrated circuit containing a CPU and memory (RAM or ROM)


Microcontrollers
built in to the same chip
Integrated circuit containing only a CPU on the chip
Microprocessor
RAM , ROM , peripherals need to be added

 The microprocessor used in an embedded system is often custom designed


 Embedded systems often have firmware which is software built into the system
which cannot be reprogrammed by the user. The software may be able to be
updated e.g. GPS software in a car navigation system
 Embedded systems usually have some form of analog or digital input

Diagram of an embedded system

Embedded system Possible input devices Possible Output


Screen showing the time
Digital clock Buttons to set the time/mode/alarm
Alarm
Pedestrian button

Traffic Lights Timer Lights

Movement sensor
Lighting system Movement sensor Lights
Keypad to enter alarm code

Security system Camera Alarm

Movement sensor
Actuator controlling movement of
Vending machine Keypad to make choice
choice
Keypad to set temperature
Central Heating system Heat
Temperature sensor

 There are many advantages of embedded systems


o low power consumption
o small physical size
o low cost to manufacturer
o they can be controlled remotely
o can operate in real time and respond to inputs very quickly

Worked Example
Describe how an embedded system controls a washing machine [3 marks]

 The user selects the wash cycle they require using a keypad [1 mark]
 The microprocessor will process the inputs and begin to heat the water and move
the drum to begin the wash. The actuator controlling the drum and the heating
mechanism are the output devices [1 mark]
 Sensors will monitor the water level and temperature [1 mark]

You might also like