L-2
Overview of microprocessor
1 Introduction
- Microprocessor is a controlling unit of a micro-computer,
fabricated on a small chip capable of performing ALU
(Arithmetic Logical Unit) operations and communicating with
the other devices connected to it.
- Microprocessor consists of an ALU, register array, and a control
unit. ALU performs arithmetical and logical operations on the
data received from the memory or an input device. Register
array consists of registers identified by letters like B, C, D, E, H,
L and accumulator. The control unit controls the flow of data
and instructions within the computer.
2 The internal Architecture of Microprocessor
Internally, the microprocessor as depicted in Fig.1 includes 3 main
units.
1. The Arithmetic/Logic Unit (ALU)
2. An array of registers for holding data while it is being
manpulated.
3. The Control Unit.
Fig.2.1 The internal Architectural of the 8085 Microprocessor
3 The Arithmetic/Logic Unit (ALU)
• In addition to the arithmetic & logic circuits, the ALU
includes the accumulator, which is part of every arithmetic &
logic operation.
• Also, the ALU includes a temporary register used for holding
data temporarily during the execution of the operation. This
temporary register is not accessible by the programmer
3.1 The roles of the ALU unit
The function of the arithmetic and logic unit (ALU) in any
microprocessor is to perform the following arithmetic
operations:
1) Addition/Subtraction
2) Multiplication/division
3) Mathematical operators as Absolute values (Modulus), ABS
4) Floating point and fixed numbers of operations
5) Logarithmic functions
6) Complex arithmetic
7) Logical operation
• The Addition and subtraction
Each microprocessor chip irrespective of its type includes an
essential module called the Accumulator. The accumulator is
known as a programmable register or a maskable register
which can be accessed and programmed by user. Each
accumulator includes a built in Full Adder module. The
instruction set includes some instructions (operation codes)
that mange the operation of the accumulator executes the
mathematical operations as:
• ADD/Sub
The addition/subtraction functions are executed by the
accumulator. • The assigned numbers are read by the
accumulator instructions , ADD/SUB. The result is stored in
the accumulator register. The output of the accumulator can be
stored in the memory location or the internal registers or
outputting the assigned output ports. The accumulator can
perform the sum of the mathematical series. The word length
of the accumulator storage register is doubling the word length
of micro-processor word.
• MUL/DIV.
The ALU in the advanced series of the microprocessor may
include a built-in programmable hardware multiplier which
executes the multiplication/divisions using certain instructions
as MUL/DIV.
The multiplier or divisor includes storage register to deal with
the resulting values.
Moreover, the multiplier can execute the Mul/Add operations
which are useful in computing the digital signal processing
algorithms. The advanced architectures of the microprocessors
can perform the following arithmetic operations:
1. Mathematical operators as Absolute values (Modulus) ,ABS
2. Floating point and fixed numbers of operations
3. Logarithmic functions
4. Complex arithmetic
3.2 The Logic Arithmetic operations
The Microprocessor module can do the logical functions
(Boolean algebra) Logical operators as:
• NOT, OR, NOR, AND, NAND, EXOR, EXNOR.
• Logical shifting left or right.
• Logical rotation left or right.
Examples:
The accumulator size is double the length of the data register
and data bus. It is divided into two parts High and Low. AL or
AH of 8 bits each.
The stack register can hold a number of words compatible with
length of the interrupt vector. The word size is the same of the
PC word. The stack pointer length can cover the number of
interrupts. It may one-byte length.
4 The array registers
Each Microprocessor architecture includes groups of
specialized registers. The storage size of each register depends
on the type and the purpose of that registers. The specialized
registers are classified as maskable or non-maskable.
The function of maskable registers is controlled using certain
programmable instructions and can be accessed during the
running of the assigned programs in machine codes.
The function of non-maskable registers is not accessed directly
by the programmer. They are non-programmable registers. It
helps by initial design the other registers inside the
microprocessor to perform its functions.
4.1 The Maskable registers (Programmed registers)
The Maskable registers in each Micro- Processor are accessed
and possess some instructions (operation codes). The
followings are the famous types of the programmable registers.
They are:
1-The Accumulator
2- The multiplier
3- The program counter
4- The Status register (Flags)
5- The timer register
The size of each register (word length in bits) depends on the
type of the microprocessor and its purpose.
- The Program Counter (PC)
This is a register that is used to control the sequencing of the
execution of instructions. This register always holds the
address of the next instruction. Since it holds an address, it
must be the same length of the address lines (16 or 32 bits
wide).
- The Status register (Flags)
The status register manages and explain the status of the results
of the accumulator/the multiplier operations. Also, the interrupt
operation and other registers.
They are called Zero(Z), Carry (CY), Sign (S), Parity (P), and
Auxiliary Carry (AC) flags; The most used flags are Zero,
Carry, and Sign. The microprocessor uses these flags to test
data conditions.
For example, after an addition of two numbers, if the sum in
the accumulator id larger than eight bits, the flip-flop uses to
indicate a carry called the Carry flag (CY) is set to one. When
an arithmetic operation results in zero, the flip-flop called the
Zero(Z) flag is set to one. These flags have critical importance
in the decision-making process of the micro- processor. The
conditions (set or reset) of the flags are tested through the
software instructions. For example, the instruction JC (Jump on
Carry) is implemented to change the sequence of a program
when CY flag is set. The thorough understanding of flag is
essential in writing assembly language programs. This will be
explained in detail in the next sections.
The Timer registers are useful in synchronizing of the timing
and delay programming for special applications.
-The Timer registers:
The Timer registers are useful in synchronizing of the timing
and delay programming for special applications.
4.2 The Non-Maskable registers
1- Memory address register
2- The instruction registers/Decoder
3- The stack pointer registers.
4- The Stack Register
- Memory address register
The memory address register, MAR is used to store the address
generated by the PC. It writes the captured address on the
address bus during the execution of the Fitch operation cycle
to fetch the required address of the executed instruction.
- Instruction Register & Decoder Registers
The instruction and decoder register stores the fetched
instruction from the program memory to be decoded in the
decoder register to identify the required operation.
The instruction registers/Decoder are responsible to store the
executed instructions from the program memory. It interprets
and decodes the required operations.
- The stack pointer registers.
It points out the address of the current interrupt and controls
the execution of interrupts and its return. The stack is usually
accessed in a Last In First Out (LIFO) fashion.
- The Stack Register
It stores the addresses of the interrupted instructions and
returns it as the interrupt subroutine is ended.
- The timer registers.
The Timer registers are useful in synchronizing of the timing
and delay programming for special applications.
2.5 The control unit (CU)
The CU is responsible to synchronize and manage the whole
operation of the microprocessor. It includes:
1. The timing circuits and clock generator
2. The reading and writing from and to the attached memories
and
input/output peripherals.
3. It executes the enabled interrupts
4. There is number of control lines that differ according to the
type and the generation of the Microprocessor.
6 The operation Cycle
Each instruction of the Microprocessor can be executed
performing three cycles:
1- Fetch
2- Decode.
3- Execute
- Fetch operation
The microprocessor during fetch cycle send the assigned
address determined by the program counter to the memory
address register, (MAR). The MAR write the dedicated address
related to location of the instruction in the program memory to
the external address bus. The assigned instruction is read by the
microprocessor through the data bus. The instruction registers,
IR store the captured instruction.
- Decode operation
The IR register interprets the type of the instruction according
to the type of the microprocessor. The required operation is
determined.
If the assigned instruction belongs to the arithmetic operations
and its types and it may need operands or single instruction.
Execute operation
The interpreted instruction is executed according to its types of
arithmetic or logical or decision control. Each operation cycle
is executing through the timing of clocks of the Microprocessor
type.
The clock time is equivalent to the periodical time of the clock
1
generator. The clock time =
𝑓𝑐
7 The system Buses
Each Microprocessor design includes system of busses or lines
to enable read/write and control operations.
The system busses lines are:
1) The external Address Bus
2) The internal and the external Data Busses
3) The control Bus.
The Address Bus differs according to the type of the
microprocessor.
1- The Address Bus
The Address Bus lines (Unidirectional) is out of the
Microprocessor chip.
The number of the address bus lines, N determines the size of
the memory map locations that are directly attached and
accessed by the Microprocessor chip. Identifying peripheral or
memory location
Some Microprocessor types assigns number of address lines as
input/output ports.
The advanced Microprocessor includes separate input/output
ports to interface with the input/output peripherals.
2- Data Bus
The function of the data bus is:
1. Bidirectional
2. Transferring data
The size of the word length inside the Microprocessor
determines the width or the number of lines assigned to the data
Bus. In some Microprocessor especially in the first generation
combines the data Bus line with the dedicated address lines to
form the requited Address Bus size.
The advanced generation of the Microprocessor isolates the
Address bus from the Data Bus lines.
3- Control Bus
The control Bus lines, carry out:
1. Synchronization signals
2. Timing signals.
3. Control signals
8 The Types of the Microprocessors
The Microprocessor Architecture as depicted in Fig.2 includes
two main types:
1- The Von Neumann Machine
2- The Harvard Machine
• The Von Neumann Machine executes the instructions
sequentially.
• The program counter starts initially by the address 00 and
ending by FF for 8 bits machine.
• The program counter starts initially by the address 0000 and
ending by FFFF for 16 bits machine.
Fig. 2 A Comparison between Types of Microprocessors
The address bus and the data bus are not separate inside the
Microprocessor. It means, the memory location inside memory
is accessed first and the data is read/write next.
• The Von Neumann Architecture represents the core of the
CPU of the desktop and mini-computers series.
• The Harvard Architecture
• includes two separate address bus and data bus inside the
Microprocessor.
• The Harvard Architecture can execute the instruction
concurrently
• The Harvard Architecture can access the data memory and the
program memory simultaneously.
• The Harvard Architecture represents the core the special
purpose and digital signal processors.
This course is concerned with the Von Neumann Machine 8 bits
and 16 bits Architecture and programming.
• 8- and 16-bits Microprocessor will be handled in the next
lectures.
• Fig.3 explains the internal /external structures of the 8 bits
Microprocessor.
• This 8-bit structure and its instruction sets will be explained
through the next chapters.
Exercise-2
1- What are the main internal components of the
microprocessor? 2- Explain the function of the ALU unit.
3- Illustrate the main task of the accumulator inside the ALU unit.
4- Demonstrate the types of the arithmetic operations done by the
advanced micro processors.
5- Compare between the maskable and non-maskable special
registers.
6- Clarify the main task of the Program counter special register.
7-List the types of the microprocessor architecture and clarify
the difference between them.