Chapter 3-CPU
Chapter 3-CPU
Types of CPU :
The major types of CPU are classified as : single-core, dual-core, Quad-core(4 processors) , Hexa core(6 processors),
Octa-core (8 processors), and Deca core (10 processors ) .
Single-core CPU
It is the oldest type of CPU which is available and employed in most of the personal and official computers.
The single-core CPU can execute only one command at a time and its not efficient in multi-tasking.
• Very early computers were fed data whilst the machines were actually running. They weren’t able to store
programs; consequently, they weren’t able to run without human intervention.
• In about 1945, John von Neumann developed the idea of a stored program computer, often referred to as the
VON NEUMANN ARCHITECTURE concept.How ?
• Instructions and data stored in the same/main memory (RAM/IAS)
• − Instructions fetched and executed in order (one after another )
• His idea was to hold programs and data in a memory. Data would then move between the memory unit and
the processor(CPU)
Von Neumann architecture
• In most computer systems, the CPU receives instructions and data from an input or memory.
• The instructions and data are processed by the CPU and the results are either sent to an output or transferred
to secondary storage.
• 'Architecture' is the design that enables the instructions and data to reach and be processed by the CPU
Von Neumann Architecture has three basic units:
1.The Central Processing Unit (CPU)
2.The Main Memory Unit
3.The Input/Output Device
CPU performs operations on data. It has 3 parts:
• Arithmetic Logic UNIT (ALU) : performs arithmetic (addition , subtraction,……)and logical operations.
• Control Unit : handles all processor control signals . It governs the flow (the transmission) of information (data and
instructions)through the system by issuing control signals to different components.
• Set of registers: are fast stand-alone storage locations that hold data temporarily. All data must
be represented in a register before it can be processed.
The Input/Output Device :It allows a computer to communicate/interact with the outside world
and store programs and data.
Connecting CPU ,memory , and I/O devices using BUSES
• A Bus is a subsystem that is used to connect computer components and transfer data
between them.
• Bus is made of several wires, each having a bit at a time
Types of buses :
Type of bus Description of bus Data/signal direction
Address bus carries signals relating to addresses between the processor and unidirectional(signals travel in
the memory one direction only)
Data bus sends data between the processor, the bi-directional (data can travel
memory unit and the input/output devices in both directions)
Control bus carries signals relating to the control and coordination of all Unidirectional and bi-directional;
activities within the computer (examples include: the read and it transmits command signals
write functions(bidirectional) , and interrupt from the CPU and response
signals(unidirectional)) signals from the hardware.
Control bus consist of various lines : read line , write line,
clock line(s) for timing/synchronizing , interrupts, resets etc.
Registers (are fast stand-alone storage locations that hold data temporarily) :
1.Accumulator: Stores temporarily the results of calculations made by ALU.
2.Program Counter (PC): Keeps track of the memory location of the next instructions to be
fetched /processed/executed . The PC then passes this next address to Memory Address
Register (MAR).
3.Memory Address Register (MAR): It stores the memory locations of instructions (that is
in use )that need to be fetched from memory or stored into memory.
4.Memory Data Register (MDR): It stores instructions (that is in use )fetched from memory
or any data that is to be transferred to, and stored in, memory.
5.Current Instruction Register (CIR): It stores the most recently fetched instructions while
it is waiting to be coded and executed.
Memory unit : The computer memory unit is made up of a number of partitions. Each partition consists of an ADDRESS and its
CONTENTS.
RAM/(immediate access store IAS): is the place where programs and data that is needed by processor are held; ready to be
fetched and decoded and executed by the CPU using data bus.
Example A word processing document that is being edited will be loaded into IAS.
Register : used to temporarily hold data and instruction during processing (example saves only the edited in the word processing
document).
The stages of the processing an instruction that are done by the CPU are :
• Fetch means : To load an instruction or piece of data from memory into a CPU register. All instructions must be
fetched before they can be executed.
• Decode means : a translation of the instruction to a form that will be understood by CPU, this stage will be
done by CU(control unit)
• Execute and execution are terms that describe the process of running a computer software, application or
program . For example, each time you open your Internet explorer , you are executing the program.
The fetch–decode- execute cycle
Fetch Stage :
1. The PC contains the address of the memory location of the next instruction which has to be fetched
2. This address is then copied from the PC to the MAR using address bus
3. The contents (instruction) at the memory(RAM) location (address) contained in MAR are then
copied temporarily into the MDR using data bus
4. The contents (instruction) of the MDR are then copied and placed into the CIR using data bus
5. The value in the PC is then incremented by 1 so that it now points to the next instruction which has
to be fetched
The fetch–decode- execute cycle
Decode Stage :
1. The instruction is finally decoded (translated ) by control unit
2. The CU has an Instruction set that contains all the commands in machine language (binary) that are
understood and can be processed by CPU
Execute stage :
3. The decoded instruction will be executed ( by control unit) by sending out signals (via the control
bus) to the various components of the computer system.
4. If mathematical and logical calculations are required the data will be sent to ALU unit , any interim
values (calculation results)will be saved in Accumulator(ACC)register
The Von Neumann model for a computer system uses several components in the fetch-execute cycle.
Embedded systems can have advantages over general purpose computers in that:
CPU performance
There are factors about CPU architecture that affect its performance:
• cores
• clock speed
• cache size
1. Cores
• A CPU can contain one or more processing units. Each unit is called a core.
• A core contains an ALU, control unit and registers to perform fetch-decode-execute cycle and process an
instruction .
• It is common for computers to have two (dual), four (quad) or even more cores.
• So the CPU performs multiple Fetch-decode-execute cycle per time .
• CPUs with multiple cores have more power to run multiple programs and multitasking at the same time so
increase the performance of the CPU.
However, doubling the number of cores will not simply double a computer's speed. CPU cores have to communicate
with each other through channels and this uses up some of the extra speed.
CPU performance
2. Clock speed
• The clock speed - also known as clock rate - indicates how fast the CPU can run.
• This is measured in megahertz (MHz) or gigahertz (gHz)
• Corresponds with how many instruction cycles the CPU can deal with in a second.
• Ex. 2 gHz CPU performs two billion cycles a second.
• Disadv : A faster CPU uses more energy and creates more heat.
• Quad core doesn’t have double speed of dual core, because some time will be lost for coordinate between the
processors
3. Cache
• Cache is a small amount of memory which is a part of the CPU - closer to the CPU than RAM.
• It is used to temporarily hold instructions and data that the CPU is likely to reuse(used mostly).
• The CPU control unit automatically checks cache for instructions before requesting data from RAM(which is
faster .
• This saves fetching the instructions and data repeatedly from RAM .
• Transfers to and from cache take less time than transfers to and from RAM.
• The more cache there is, the more data can be stored closer to the CPU.