Microprocessor Architecture
Microprocessor Architecture
Table of Contents
1. INTEL 8085 MICROPROCESSOR INTERNAL ARCHITECTURE ........................................................... 2
1.1 The 8085 CPU ....................................................................................................................................... 2
1.1.1 Address, Data and Control Buses. .................................................................................................... 2
1.1.2 Timing and Control Units ................................................................................................................. 4
1.1.3 Interrupt control ................................................................................................................................ 5
1.1.4 Serial I/O Control ............................................................................................................................. 5
1.2 Register Section of 8085 CPU (8-Bit) Microprocessor ................................................................................ 5
1.2.1 The Instruction Register (IR). ........................................................................................................... 6
1.2.2 The Program Counter (PC) ............................................................................................................... 6
1.2.3 Accumulator (A). .............................................................................................................................. 7
1.2.4 The Status (Flag) Register. .............................................................................................................. 7
1.2.5. Temporary Registers. ........................................................................................................................ 8
1.2.6. General Purpose Registers (GPRs). ................................................................................................ 10
1.2.7. Stack Pointer (SP). ......................................................................................................................... 11
1.2.8 Index Register. ................................................................................................................................ 11
1.2.9 The Memory Address Register (MAR). ......................................................................................... 11
1.2.10 The Incrementer /Decrementer Address Latch. .......................................................................... 12
2.0 PIN DIAGRAM AND PIN DESCRIPTION OF 8085 ............................................................................ 13
2.1 Microprocessor Pin Description .......................................................................................................... 14
2.1.1 Tri state devices .............................................................................................................................. 14
2.1.2 Classification of Signals ................................................................................................................. 15
3.0 OPERATION OF MACHINE CYCLES ................................................................................................. 21
3.1 Machine Cycle and Instruction Cycle ................................................................................................. 21
3.2 Types of Machine cycles ..................................................................................................................... 22
3.3 Microprocessor-based systems Memory addressing capability ......................................................... 23
4.0 MCS-85 FAMILY ................................................................................................................................... 24
Recommended Simulators ................................................................................................................................ 25
YouTube resources ........................................................................................................................................... 26
References ........................................................................................................................................................ 26
1
Derrick H.O.Osiro. Technical University of Kenya
Microprocessor Architecture
The collection of registers that constitutes a particular system and the data transfers
that are possible among them make up the system architecture. The types of the registers in
the microprocessor and the possible data transfers among them determine the
microprocessors architecture.
A microprocessor system implements its functions by transferring and transforming
data in the registers of the system. The microprocessor controls and synchronizes the data
transfers and transformation according to the instructions read into it from the application
program in the systems ROM
A block diagram of the internal architecture of the 8085 is shown in figure 1. The
8085 contains a register array with both dedicated and general purpose registers;
1. A 16-bit program counter (PC)
2. A 16-bit stack pointer (SP)
3. Six 8-bit general purpose registers arranged in pairs BC,DE,HL
4. A temporary register pair: WZ
Intels 8085 is a 40-pin chip that is an enhancement of the 8080. It is a general purpose
microprocessor that is made up of functional units capable of clock generation, system bus
control and interrupts priority selection, in addition to execution of instructions.
An 8-bit internal data bus carries instructions and data between the CPU registers. The
external buses are the ones connected to other chips like memory, I/O and so on. The 8085
transfers data on an 8-bit bi-directional 3-state bus (AD0-7) which is time-multiplexed so as
to also transmit the eight lower-order address bits. The main reason for multiplexing the
AD0-7 buses was to retain the number of pin on the chip to 40.
An additional eight lines (A8-15) expand the 8085 family system memory addressing
2
Derrick H.O.Osiro. Technical University of Kenya
Microprocessor Architecture
capability to 16 bits, thereby allowing 64K bytes of memory to be addressed directly by the
CPU.
There are two buffer registers called the address buffer and the address-data buffer.
The contents of the stack pointer or program counter registers can be loaded into the address
buffer and address-data buffer. The output of these buffers then drives the external address
bus and address-data bus. Memory and I/O chips are connected to these buses. The 8-bit
internal data bus is also connected to the address-data buffer.
The 8085 can address up to 256 different I/O locations. The designer/programmer
may also choose to address I/O ports as memory locations using memorymapped I/O
techniques.
Control bus is used to carry various control and status signals like , , ALE, READY,
3
Derrick H.O.Osiro. Technical University of Kenya
Microprocessor Architecture
HLDA etc.
The 8085 timing and control unit generates control signals that can be used to select
appropriate external devices and functions to perform READ and WRITE operations and also
to select memory or I/O port. It includes an oscillator and a control-sequencer that produces
the control signals needed for internal and external control.
4
Derrick H.O.Osiro. Technical University of Kenya
Microprocessor Architecture
The SID and SOD pins help to minimize chip count in small systems by providing for
easy interface to a serial port using software for timing and for coding and decoding of the
state.
Each time a RIM instruction is executed, the status of the SID pin is read into bit 7 of
the accumulator. Likewise, SIM is used to latch bit 7 of the accumulator out to the SOD
output via an internal flip flop, providing that bit 6 of the accumulator is set to 1. SID can
also be used as general purpose TEST input and SOD can serve as a one-bit control output.
This is used to store the opcode of the current instruction that is being fetched from
the memory before execution. When the microprocessor fetches the opcode from memory, it
stores it in the IR while the decoding circuitry determines the operation is to be performed.
(From the IR, the opcode is taken to the Instruction Decoder which generates the control
signals to activate the action specified by the opcode).
The IR is automatically used by the CPU during each Instruction cycle and the programmer
cannot access it. The size of the IR is the same as the word size of the CPU e.g. 8-bits for
8085 CPU.
The output of the instruction decoder and the internal clock generator generates the state and
machine cycle timing signals.
The Program counter is used to contain the address in memory of the next instruction
to be fetched (or executed) by the CPU. The CPU places the contents of the PC on the
address bus and fetches the first byte of the instruction from that memory location.
The microprocessor automatically increments the PC after each use and in this way executes
the stored program sequentially unless the program contains an instruction which alters the
sequence (e.g. a JUMP Instruction).
The size of the PC depends on the number of address bits the microprocessor uses
(e.g. 16-bits for the 8085 CPU).
6
Derrick H.O.Osiro. Technical University of Kenya
Microprocessor Architecture
The Accumulator is a register that takes part in most of the operations performed by
the ALU. It is also the register in which the results are placed after most ALU operations. In
many ALU instructions; the Accumulator is the source of one of the operands and the
destination of the result. (The contents of the accumulator serve as one input to the ALU, and
the accumulator receives the output from the ALU).
In addition to its use in ALU instructions, the Accumulator can be used as a storage
register for data that are being sent to an output or as a receiving register for data that are
being read from an input device.
Some microprocessors have more than one Accumulator; more accumulators mean
that more data can be held in the register section of the CPU thereby speeding up the program
execution and data manipulation. The Accumulator generally has the same number of bits as
the microprocessor word size (e.g. 8-bit for 8085 CPU).
Also called the process status register, the flag register consists of individual bit with
different meanings assigned by the microprocessor manufacturer. These bits are called flags,
and each flag is used to indicate the status of ALU/Accumulator operations. The various flags
store status information, which is critical for microprocessor decision making. The value of
the flags can be examined under program control to determine what sequence of instruction is
to follow. The contents of the status register is also called the Program Status Word (PSW),
of which must be known by the CPU to determine the operating conditions that may affect
future operations.
The 8085 CPU flag register contains the following FIVE Flags:
(a). Carry flag, CY.
This flag is SET if the ALU operation has resulted in a carry and RESET if otherwise.
It is used to indicate whether the sum exceeds the microprocessor word size.
(b). Zero flag, Z .
The microprocessor control signals SETS Z (to 1) when the result of an Arithmetic or
7
Derrick H.O.Osiro. Technical University of Kenya
Microprocessor Architecture
Logical operations has resulted into a zero and RESETS Z (to 0) when the result of the ALU
operation is not zero.
A result that has a carry but has a zero answer byte in the accumulator will set both
the carry flag and the zero flag.
(c). Sign flag, S.
This flag is SET if the ALU operation has resulted to a NEGATIVE answer and is
RESET if the result is POSITIVE. The flag is set to the condition of the most significant bit
of the accumulator following the execution of arithmetic or logic instruction. These
instructions use bit 7 of the data to represent the sign of the number contained in the
accumulator. This permits the manipulation of numbers in the range from -128 to +127.
S Z X Ac X P X CY
8
Derrick H.O.Osiro. Technical University of Kenya
Microprocessor Architecture
The 8085 also has little-known hidden registers that are invisible/not accessible to the
programmer but used internally: the WZ register pair (Each of these is an 8-bit register), and
two 8-bit registers for the ALU: ACT and TMP. These temporary registers are used by the
control unit to hold operands or addresses that are part of an instruction, until they are
transferred to another register in the microprocessor or used as operands in a computation.
(a) ACT: The Accumulator Temporary register (ACT) holds the accumulator value while
an ALU operation is performed. This allows the results from the ALU to be written
back to the accumulator without disturbing the input, which would cause instability. It
also holds constant values (e.g. for incrementing or decrementing, or decimal
adjustment) without affecting the accumulator. Finally, the ACT allows ALU
operations that don't use the accumulator.
(b) TMP: The second temporary register (TMP) holds the other argument for the ALU
operation. The TMP register typically holds a value from memory or another register
and feed the Accumulator. It may also be used as a temporary storage by the ALU.
9
Derrick H.O.Osiro. Technical University of Kenya
Microprocessor Architecture
These registers are used for many of the temporary functions required inside the CPU.
They can be used to store data that are currently used during a program execution, thereby
speeding up the program execution; since the CPU does not have to perform a memory read
operation each time that data is needed. They give the programmer a great deal of flexibility
in dealing with a programming task.
These registers are often used as counters to keep track of the number of times a
particular instruction sequence in a program has been executed. The number of the general
purpose registers varies from microprocessor to microprocessor. The 8085 has SIX, which
are labelled B, C, D, E, H, and L.
They can be used individually, such as when operating on an 8-bit data or in pairs
such as when operating on 16-bit data or address. When used in pairs, only the following
combinations are permitted for the 8085 CPU; B-C, D-E, and H-L.
10
Derrick H.O.Osiro. Technical University of Kenya
Microprocessor Architecture
The Stack is a portion of RAM reserved for the temporary storage and retrieval of
information, typically the contents of the microprocessors internal registers. The data is
stored and retrieved from the stack on a Last-In-First-Out (LIFO) or First-In-Last-Out (FILO)
basis.
The Stack pointer, SP acts as a special memory address register used only for the
stack portion of the RAM .Whenever a word is to be written /stored on or read from the stack,
it is stored at or read from the address specified by the Stack pointer. Thus at all times, the SP
holds the address of the TOP OF THE STACK.
The contents of the SP are automatically decremented after a word is stored on to the
Stack and incremented before a word is read from the Stack. The incrementing and
decrementing is done automatically by the CPUs control unit.
There are some registers which are common in 8-bit processors but are not specifically
incorporated for the 8085 CPU. These are
The Index register is an internal register within the microprocessor unit whose
contents is modified (subtracted from or added to) during the execution of an instruction to
determine the memory location which will be accessed by the CPU. The byte that is added to
or subtracted from the Index register contents is called the Displacement.
Special instructions are provided which automatically adds this displacement to the
register contents. Index Registers are used to access data from any sequential block of data
(data tables).
Therefore there are TWO sources of address for the microprocessor address, the PC
and the MAR. The PC is used for the opcode address while the MAR is used for data/operand
address. A multiplexer is used to switch either the PC or the MAR onto the address bus,
depending on whether the CPU is in opcode fetch cycle or memory read/write cycle.
12
Derrick H.O.Osiro. Technical University of Kenya
Microprocessor Architecture
13
Derrick H.O.Osiro. Technical University of Kenya
Microprocessor Architecture
A trisate (3-state) device is a digital device which can have 3 output states, namely high, low
and a high impedance state.
Example
When enable E is high the gate is enabled and the output Q can be 1 or 0 (if A is 0, Q is 1,
otherwise Q is 0). However, when E is low the gate is disabled and the output Q enters into a
high impedance state.
Enable (E) A Q State
1 0 1 High
1 1 0 Low
0 0 High-Z Floating (high impendence)
0 1 High-Z Floating (high impendence)
When 2 or more devices are connected to a common bus, to prevent the devices from
interfering with each other, the tristate gates are used to disconnect all devices except the one
that is communicating at a given instant.
14
Derrick H.O.Osiro. Technical University of Kenya
Microprocessor Architecture
15
Derrick H.O.Osiro. Technical University of Kenya
Microprocessor Architecture
Pin 30: ALE stands for address latch enable. The falling edge of the ALE signal Strobes
(loads) the address on the address bus.
Normally each memory chip connected to the 8085 CPU has its own MAR, usually called
address latch. This latch stores the incoming address from the address bus and address-data
bus. The ALE signal comes out of pin 30 and goes to peripheral ships such as memory chips.
It (ALE signal) occurs during the first clock state of a machine cycle and enables the address
to get latched into the on-chip latch of peripheral. The falling edge of ALE is set to guarantee
setup and hold times for the address information. The falling edge of ALE can also be used to
strobe the status information. ALE is never 3-stated.
16
Derrick H.O.Osiro. Technical University of Kenya
Microprocessor Architecture
17
Derrick H.O.Osiro. Technical University of Kenya
Microprocessor Architecture
SO, S1 (Output)
Pins : 29 and 33
They carry output signals known as status signals showing the data bus status.
S1 S0 Status
0 0 HALT
0 1 WRITE
1 0 READ
Opcode
1 1
FETCH
These signals (and the IO/ signal) indicate whether an instruction fetch, memory read,
memory writ, IO read, IO write or other operation is taking place
interrupt requests.
A priority exists among the interrupt pins: some are more important than others. In order of
their importance, the five interrupts signals are designated TRAP, RST 7.5, RST 6.5, RST 5.5
and INTR. If two or more interrupts go high at the same time, the 8085 will service them in
order of their importance (TRAP first, RST 7.5 second and so on).
Pin 6 to 10 are inputs for the interrupt signals. Pin 11 is an output pin with a signal called the
interrupt acknowledge (). This particular signal is used to response to an INTR
interrupt.
On receipt of an interrupt, the microprocessor acknowledges the interrupt by the active low
() (Interrupt Acknowledge) signal.
READY (input)
Pin 35.
The main function of this pin is to synchronize slower peripheral to faster microprocessor. If
ready pin is high during a read/write cycle, it indicates that memory or peripheral is ready to
send/receive data the microprocessor will complete the operation and proceeds for the next
operation. If ready pin is low the 8085 will wait for READY to go high before completing the
read/write cycle. The READY signal is generated by the external memory or peripheral.
The microprocessor enters into WAIT state while the READY pin is disabled.
19
Derrick H.O.Osiro. Technical University of Kenya
Microprocessor Architecture
20
Derrick H.O.Osiro. Technical University of Kenya
Microprocessor Architecture
During normal operation, the microprocessor sequentially fetches and executes one
instruction after another. Timing is provided by the clock. One clock period is called a timing
state, or T-state. The number of timing T-states needed to fetch and execute an instruction is
called Instruction cycle. The instruction cycle can also be referred to as the fetching and
execution of a single instruction.
A machine cycle is a complete fetch-execute operation. The execution of each instruction by
the 8085 consists of a sequence of from one to five machine cycles, and each machine cycle
consists of a minimum of from three to six clock cycles.
21
Derrick H.O.Osiro. Technical University of Kenya
Microprocessor Architecture
There are seven different types of machine cycles in the 8085 CPU
i. Opcode FETCH
ii. Memory READ
iii. Memory WRITE
iv. I/O READ
v. I/O WRITE
vi. Interrupt Acknowledge
vii. Bus Idle
Three status signals, IO/, S1, and S0, generated at the beginning of each machine cycle
identify each type and remain valid for the duration of the cycle.
The first machine in an instruction cycle is always an opcode fetch, and the 8-bit obtained
during an opcode fetch are always interpreted as the opcode of an instruction. The number of
machine cycles required to execute an instruction depends on that particular instruction.
More on this topic shall be discussed at the timing diagrams topic
22
Derrick H.O.Osiro. Technical University of Kenya
Microprocessor Architecture
Assuming that a digital system uses one bit memory address, the number of addresses
that can be generated is 2 (i.e. 0 and 1).
If the address bits are two, the number of addresses generated is 4 (i.e. 00, 01, 10, and 11).
If the bits are three, the number of addresses generated is 8 (i.e. 000,001,010,011,100,101,
110,111),
Therefore if the number of address bits is n, the number of addresses generated by the digital
system is 2n.
The 8085 CPU uses 16-bit address, hence the number of addresses generated by the 8085 is :
216 = 26 X 210
= 64K
If each memory location stores 8-bits in the 8085 Microprocessor based system, the memory
capacity that can be addressed by the 8085 CPU is
64K X 8 bits = 64Kbytes (KB)
The 8085 processor uses 8-bits addressing for I/O devices. The total number of I/O devices
that can be addressed by the CPU is
28 = 256 I/O devices
23
Derrick H.O.Osiro. Technical University of Kenya
Microprocessor Architecture
Recommended Simulators
1. GNUSim8085
This consists of a simulator, assembler and a debugger. It is available for both
Windows and Linux operating systems.
25
Derrick H.O.Osiro. Technical University of Kenya
Microprocessor Architecture
YouTube resources
https://www.youtube.com/watch?v=I78iyzXQrP4
References
26
Derrick H.O.Osiro. Technical University of Kenya