THE CPU
CENTRAL PROCESSING UNIT (CPU)
The microprocessor central processing unit (CPU) forms
the heart of any microprocessor or microcomputer
system computer and, consequently, its operation is
crucial to the entire system.
CENTRAL PROCESSING UNIT (CPU)
The primary function of the microprocessor is that of
fetching,
decoding and
executing instructions resident in memory.
The main parts of a microprocessor CPU are:
(a) registers for temporary storage of addresses and data;
(b) an arithmetic logic unit (ALU) that is capable of
performing arithmetic and logical operations;
(c) a unit that receives and decodes instructions;
(d) a means of controlling and timing operations within the
system.
INTERNAL
ARCHITECT
URE OF A
BASIC 8-BIT
MICROPRO
CESSOR
CPU
REGISTERS
ACCUMULATOR
Functions both as a source and as a destination register.
Source Register Destination Register
contains the data that will used to hold the result of
be used in a particular a particular operation
operation
INSTRUCTION REGISTER
The instruction register provides a temporary storage
location in which the current microprocessor instruction
is held whilst it is being decoded.
On the first part of each machine cycle, the instruction
is fetched and decoded.
If the frequency of the clock is 1 MHz how long will
one cycle take?
f=1/T
T= 1/f
T= 1/1*106 = 1*10-6/1 = 1µs
DATA BUS
The external data bus provides a highway for data that
links all of the system components (such as random
access memory, read-only memory, and input/output
devices) together.
DATA BUS BUFFER
The data bus buffer is a temporary register through which
bytes of data pass on their way into, and out of, the
microprocessor.
The buffer is referred to as bi-directional. Read and write.
INTERNAL DATA BUS
A high-speed data highway that links all of the
microprocessor’s internal elements together
GENERAL PURPOSE REGISTERS
Microprocessor operations and temporarily storing the
partial result of an operation whilst other operations
take place are done by general purpose registers.
STACK POINTER
The stack pointer is simply a register containing the address of
the last used stack location.
Most microprocessors make use of a region of external random
access memory (RAM) known as a stack when they need to
suspend a particular task in order to briefly attend to
something else.
INSTRUCTION POINTER
the instruction pointer (or program counter) stores the
address of the next instruction to be executed thus ) allowing
the microprocessor to keep track of where it is within the
program.
The program counter is automatically incremented when
each instruction is executed.
ADDRESS BUS BUFFER
The address bus buffer is a temporary register through which
addresses pass on their way out of the microprocessor.
The address buffer is unidirectional.
ADDRESS BUS BUFFER
Note
A 16-bit address bus can be used to communicate with 65,536
individual memory locations. At each location a single byte of
data is stored.
CONTROL BUS
The control bus is a collection of signal lines that are
both used to control the transfer of data around the
system and also to interact with external devices.
CONTROL BUS
an interrupt request from an
external device non-maskable
attempting to gain
an output
an output signal fromsignal
interrupt (i.e. from the
the
the attention ofan theinterrupt
CPU (thesignal that cannot
READ
request CPU
may eitherWRITEthat
be CPU
obeyedRESET
orthat
indicates indicates
that the
IRQ that the
NMI
be ignored
current by the is
current
operation operation
a read is a write
ignored according to the state
microprocessor). of
a signal operation
that
the microprocessor resets operation
thetime
at the internal registers and initialises
thatthe
theinstruction pointer is
interrupt request program counter so that the
program can be re-started from the beginning
received)
ADDRESS BUS
The address bus provides a highway for addresses
that links with all of the system components.
Components inclusive of:
random
read-only input/output
access
memory devices
memory
INSTRUCTION DECODER
The instruction decoder is an arrangement of logic
gates.
It acts on the bits stored in the instruction register and
determines which instruction is currently being
referenced.
The instruction decoder provides output signals for the
microprocessor’s control unit.
organising the orderly flow of
data within the
microprocessor.
CONTROL generating, and responding
to, signals on the control
UNIT bus.
The control unit is the timing of all data
transfers.
responsible for:
ARITHMETIC LOGIC UNIT (ALU)
The ALU performs arithmetic and logic operations.
ARITHMETIC LOGIC UNIT (ALU)
The ALU has two inputs :
One of these inputs is derived from the Accumulator
the other is taken from the internal data bus via a
temporary register.
ARITHMETIC LOGIC UNIT (ALU)
The operations provided by the ALU usually include
Addition Logical exclusive-OR
Subtraction Shift left
Logical AND
Shift right
Logical OR
STATUS REGISTER
The status register (flag register or condition code
register) contains a number of individual bits that are
set or reset according to the outcome of an ALU
operation.
These bits are referred to as flags.
ZERO
the interrupt flag indicates
STATUS whether external interrupts
are currently enabled or
REGISTER CARRY
the zero flag is set when the
disabled.
result of an ALU operation is zero
the carry flag is set whenever the
Some typical examples result of an ALU operation (such as
of flags that are INTERRUPT
addition) generates a carry bit (in
provided by most other words, when the result cannot
microprocessors
be contained within an 8-bit register
CLOCKS
The clock used in a computer system is simply an
accurate and stable square wave generator.
The frequency of the square wave generator is usually
determined by a quartz crystal.
CLOCKS
A typical microprocessor clock circuit
CLOCKS
waveform produced by the clock circuit
CLOCKS
Note
One complete clock cycle is sometimes
referred to as a T-state.
CLOCKS
An external CPU clock
CLOCKS
an internal CPU clock
MICROPROCESSOR OPERATION
The majority of operations performed by a microprocessor
involve the movement of data.
The microprocessor performs a continuous sequence of
instruction, fetch and execute cycles.
MICROPROCESSOR OPERATION
Read operation Write operation
MICROPROCESSOR OPERATION
A typical timing diagram for a microprocessor CPU’s fetch-execute cycle
MICROPROCESSOR OPERATION
Z80 CPU (showing some of its more important control signals)
MICROPROCESSOR OPERATION
Z80 CPU (showing its register model)
ALU OPERATION
The ALU can perform arithmetic operations and logic.
The ALU operates on two inputs and it provides one
output.
The ALU status is preserved in the flag register so that,
for example, an overflow, zero or negative result can be
detected and the necessary action can then be taken to
deal with this eventuality.
INTEL X86 FAMILY
The original member of the x86 family was Intel’s first true 16-bit
processor which had 20 address lines that could directly address up to
1 MB of RAM.
INTEL X86 FAMILY
INTEL X86
FAMILY
INTEL X86
FAMILY
INTEL X86 FAMILY
The x86 CPU showing some of its register model
ADDRESSING
ADDRESSING
Process of forming a 20-bit address
ADDRESSING
Contents of the 8086 registers after a reset
INTERRUPT HANDLING
Interrupt service routines are subprograms stored away from
the main body of code that are available for execution
whenever the relevant interrupt occurs.
The response must be automatic.
INTERNAL
ARCHITECTURE OF
THE ORIGINAL INTEL
PENTIUM
PROCESSOR.
NOTE THE USE OF A
SEPARATE BUS
INTERFACE UNIT
(BIU)
MICROPROCESSOR
BLOCK DIAGRAM
BASIC CORE
PROCESSOR
MODULE USED IN
THE BOEING 777
HONEYWELL AIMS
THREE BUS ARCHITECTURE OF A HIGH-END 29K SYSTEM
DATA
VALIDITY
CONVERSION
TIMING
WRAP AROUND SELF CHECK