Block Diagram of Digital Computer:: Microprocessor
Block Diagram of Digital Computer:: Microprocessor
CU
Bit: A bit is the abbreviation for the term binary digit. A binary digit can have only
two values represented by the symbols 0 & 1.
Bit Size: the bit size of microprocessor refers to the number of bits that can be
processed simultaneously by the basic arithmetic circuit.
ALU: An ALU is a digital circuit that performs arithmetic & logic operation on
two n (n=4,8,16,32,64) bit digit words. Typical operations performed by the ALU are
addition, subtraction, ANDing, ORing, & comparison of two n-bit words.
1
Address: An address is a pattern of 0’s & 1’s that represent a specific location in
memory or a particular I/O device. Typical 8-bit microprocessor has a 16 address line.
ROM: Read only memory (ROM) is storage medium for the groups of bit called
words & its content can not normally be altered once programmed.
A typical ROM is fabricated on an LSI (large scale integration). A ROM is a Non-
Volatile. Which means that’s contents are retained in the event of a loss of power to the
ROM chip. ROMs are used to store instructions or data tables that must always be
available to the microprocessor.
RAM: Random access memory (RAM) is a storage device whose content not
only be read but also dynamically altered at specific address. A RAM is a volatile
memory.
Which means that’s contents is loss in the event of a power failure. A RAM is
normally used as scratchpad memory for the storage of temporary data & intermediate
results as well as programs that can be reloaded from a backup non-volatile source.
Memory or RAM
Cache memory
Register Register
ALU
Register Register
BUS: The term bus refers a number of conductors organized to provide a means
of communication. The microcomputer contains three Buses which carry all the address,
data & control information. These Buses connect the CPU to each of the ROM, RAM &
I/O elements.
Types of BUS –
Memory
In this Bus information transfer takes place in only on direction from the
microprocessor to the memory or I/O elements. This is called a unidirectional Bus.
The address bits to memory or external device are sent out on the address bus.
For 8- bit microprocessors, this Bus is typically 16 bit long. A memory location or an I/O
element can be represented by each one of these address. For an 8-bit data word can
be stored in address 200016.
Data Bus:
In this Bus, data can flow in both directions to or from the microprocessor.
Therefore this is a bi-directional bus. In some microprocessor the data pins are used to
send other information such as address bits in addition to data.
Control Bus:
This Bus consists of a number of signals that are used to synchronize the
operation of the individual microcomputer elements.
The microprocessor sends some of these control signals to the other elements to
indicate the type of operation being performed. Each microcomputer has a unique set
of control signals.
Instruction Set:
The instruction set of a microprocessor is the list of commands that
microprocessor is designed to execute. Example – ADD, SUB, STORE, AND, OR.
Clock:
A micro – computer requires synchronization among its components & this is
provided by the clock or timing circuit. The signals provided by the clock circuits are
either single phase or multiphase.
A2B2 A1B1 A0B0
Cin
C3 C2 C1
FA FA FA
Y Y Y
CLK
3
Language: Expression of medium which the computer can be clearly understands
what to do by user.
Compiler:
It is a program translator that translates the instruction of a higher level
language to machine language (Binary Code).It is called compiler because it compiles
machine language instructions for every program instructions of higher language. While
compiler scans the entire program first & then translates it into machine language
(Binary Code).
Interpreter:
Microprocessor (CPU)
RAM ROM I/O
Memory unit
The CPU executes all the instructions & performs arithmetic & logic operation on
data. The CPU of the micro-computer is called the micro processor. The MOS
microprocessor is typically a signal LSI chip that contents all of the control, Arithmetic,
& Logic circuits of the microcomputer.
Memory unit:
I/O:
An I/O unit transfers data between the micro computer & the external devices.
The transfer involves data status, address & control signal. The I/O logic is
typically contained in the ROM or RAM chips. A single chip microcomputer has all three
of the basic elements on one chip (there are three main ways of data transferring
between the microcomputer system & the external devices. Such as – Programmed I/O,
Interrupt I/O, DMA). Whereas a single –chip microprocessor has separate chips for
memory & I/O.
When the memory is receiving data from a microcomputer element it is called a WRITE operation.
When the memory is sending data to another microcomputer element it is called a READ operation.
5
Basic microcomputer Registers:
PC:
The PC containing the address of the instruction or operation (op) code. PC is often
called IP (Instruction pointer)
1. Upon activating the microprocessor’s the RESET input, the address of the first
instruction to be executed is loaded into the program counter.
2. The size of the program counter is determined by that of the address bus. The
program counter is typically 32 bits wide for 32 bit microprocessors.
MAR:
The MAR or data counter containing the address of data. The microprocessor
uses the address, which is stored in the memory address register.
6
Accumulator:
It stores the result after most ALU operation; and the accumulator is typically
used for inputting a byte to an external device into the accumulator or outputting a
byte to an external device from the accumulator.
The 8-bit microprocessors are accumulator based machines & the accumulator is
typically an 8 bit register.
Memory word
Program Memory
Address Result
2000 21
2001 05 A
2002
2025 MAR
21 IR
2000 PC
Data Memory
2025 05
Index register:
Status registers:
Also known as a processor status word or condition code register, the status
register contains individual bits with each bit having special significance. The bits in the
status register are called flags. The status flags are used in conditional JUMP
instructions
3. Zero flag C A Z P S O
Carry flag:
The carry flag is used to reflect the condition of whether or not the results
generate by an arithmetic operation is greater than the microprocessor word size. The
addition of two 8 bit numbers produce a carry. The carry flag will be zero if no carry is
generated from the addition.
BCD digit is represented by 4 bits any carry out of the low 4 bits must be
propagated into the high 4 bits for BCD arithmetic.
The carry flag is known as the auxiliary carry flag. It is set to 1 if the carry out of
the low 4 bits is 1; otherwise it is 0.
Zero flag:
8
A zero flag is used to show whether the result of an operation is zero. It is set to 1 if the
result is zero & it is set to 0 if the result is no-zero.
Parity flag:
A parity flag is set to 1 to indicate whether the result of the last operation
contains either an even number of 1’s (even parity) or an odd number of 1’s (odd parity).
The parity flag used to determine internal structure of the microprocessor.
Sign flag:
The sign flag have to another name that’s the name is negative flag. It is used to
indicate whether the result of the last operation is positive or negative. This flag is set to
1 indicate that the result is negative & flag is set to 0 that the result is positive.
Overflow flag:
The overflow flag arises from the representation of the sign flag. The overflow flag is
set to 1 if the result of an arithmetic operation is too large or big for the
microprocessor’s maximum word size. Otherwise it is reset to 0.
Stack pointer:
A stack is a last –In- first –Out (LIFO) memory in the sense that items that go in
last will come out first.
The stack can be implemented in hardware or software. A hardware stack is
often designed by using a set of high speed registers in order to provide a fast
response. A software stack can be implemented by using a number of RAM locations.
The address of the stack is contained in a register called the stack pointer.
The PUSH operation is defined as writing to the top or bottom of the stack, whereas the POP
or PULL operation means reading from the top or bottom of the stack
Control Unit:
i) Reset:
The input is common to all micro processors when this input pin is driven
HIGH or LOW the program counter is reset to 0 in many micro processors
(Intel 8085). The instruction stored at memory location 0000 16 is first execute.
DIP=Dual in pin
1 40
2 39
Reset out 3 38
37
36 Reset in (if 0)
Micro-processor
8085
18 23
19 22
20 21
ii) Read / Write: This output line is common to all micro processor. The status of
this line tells the other micro computer elements whether the micro
processors is performing a READ or WRITE operation. A HIGH signal on this
line indicates a READ operations & a LOW indicate a WRITE operation.
10
RAM
1 40
2 39
Output 3 38
Register
MD. Arshad Ali , (TE-07049) 37
36
Micro-processor (0)
32
18 23
19 22
20 21
Microprocessor
iii) ´ :
Ready
This is an input to the micro processor Slow devices (Memory & I/O)
use. This signal to gain extra time to transfer data to or receive data from a
micro processor.
´ signal is usually a negative logic signal i.e. LOW means it is Ready.
The Ready
1 40
2 39
3 38
37
36 if 0)
Micro-processor
8085
18 23
19 22
20 21
ALU:
INTR
INTA
10
11
µP 11
The ALU performs all the data manipulations such as arithmetic & logic operations
inside the microprocessor. Typically the ALU performs the following operations –
MD. Arshad Ali , (TE-07049)
Microprocessor
Data Bus
Status register Accumulator
Program Counter
Complementer
Instruction Register
Addition & Boolean Logic
Buffer register
CU
i. Register section
ii. Arithmetic & logic unit (ALU)
iii. Timing & control section (CU)
Memory cell
0 Word
1
2
3
Short note: Here Address line =4, so Word line is 24
4
Word line
5
6
7
88
98
10
11
12
13
14
15
DMA performs data transfer between memory & an external device without
involving the microprocessor. The interface or controller chip must be able to perform
memory READ & WIRTE operations in a similar way as the microprocessor.
Address Bus
Data Bus
HOLD
HLDA
R/
Decoding logic
RAM
Micro-processor
CS
DMA
CS I/O
DMA Request
RS
DMA Acknowledgement
A= Accumulator
A
B C
Secondary accumulator data counter
D E
The accumulator (A) is an 8-bit register, most of the arithmetic & logic operations are
performed using the accumulator. All I/O data transfer between the 8085 & the I/O
devices are performed via the accumulator
The B, C, D, E, H & L registers are each 8-bits long. H & L are the memory address
register or data counter. Combine two 8-bit register to form 16-bit register pair.
15
PSW & A
B & C
D & E
H & L
The 16-bit register pair obtained by combing the accumulator & the PSW is used only for
stack operations. Arithmetic operations Use B & C, or D &E, or H & L as 16-bit data
register.
The PSW consist five status flag –
Carry flag:
The carry flag reflect the final carry out of the most significant bit of any
arithmetic operation.
Parity flag:
Auxiliary carry:
The ‘AC’ flag reflects any carry from bit 3 to bit 4 due to arithmetic operation. This
flag is useful for BCD operations.
Zero flag:
The ‘Z’ flag is set to 1 whenever an arithmetic or logic operation produces a result
of zero. The zero flag is cleared to 0 for a nonzero result due to arithmetic or a logic
operation.
Stack pointer:
The stack pointer is 16 bits long. All stack operations with the 8085 use 16-bit
register pairs. The stack pointer contains the address of the last data byte written into
the stack.
(It is decremented by 2 each time 2 bytes of data are written or pushed onto the
stack & is incremented by 2 each time 2 bytes of data are read from or pulled off the
stack, i.e. the top of the stack has the lowest address in the stack that grows
downward).
PC:
17
Direct addressing mode:
Instruction using this mode specifies the effective address as part of instruction.
Instructions using this mode contain 3 bytes, with the first byte as the opcode followed
by 2 bytes of address of data. EX:- Instruction LDA 2035H(Load Accumulator). This mode
is also called the absolute mode.
Opcode
For an 8 bit data, this mode use 2 bytes with first byte as the opcode followed by
1 byte of data. On the other hand for 16 bit data, this instruction contains 3 bytes, with
the first byte as the Op code followed by 2 bytes of data.
Example: MVI B, 05 loads register B with 5
18
Internal architecture of the 8086 microprocessor:
Microprocessor CH CL CX CS
DH DL DX DS
SP SS
General register
BP ES
DI IP
Temporary Register
Instruction queue
ALU Q bus
I/O Control system
(8bit) 1 2 3 4 5 6
19
Addressing mode of 8086 microprocessor:
The EU has direct access to all registers & data for register & immediate modes.
However the EU can not directly access the memory operands.
It must use the BIU in order to access memory operand. Every memory
addressing mode has a standard default segment register.
In this mode the effective address is taken directly from the displacement field of
the instruction. No registers are involved. E.g. MOV BX, START moves the contents of
the 20-bit address from DS & START to BX.
The effective address of a memory operand may be taken directly from one of
the base or index registers (BX, BP, SI, DI). E.g MOV CX, [BX]
20
Based addressing mode:
In this mode the effective address is the sum of a displacement value & contents
of BX register. E.g. MOV AX, 4[BX] moves the contents of the 20-bit address computed
from a segment register & [BX +4] into AX.
In this mode the effective address is calculated from the sum of a displacement
value & the contents of register SI or DI. E.g. MOV AX, VALUE [SI] moves the contents of
the 20-bit address computed from VALUE, SI & the segment register into AX.
In this mode the effective address is computed from the sum of a base register
(BX or BP) an index register (SI or DI) and a displacement. E.g MOV AX, 4[BX][SI] moves
the content of the 20-bit address computed from the segment register & [BX] + [SI] + 4
into AX.
This mode uses Index registers.SI is assumed to point the first byte or word of
the source string. & DI is assumed to point to the first byte or word of the destination
when a string instruction is executed. Example MOVS WORD.
Two I/O port addressing modes can be used; the direct & indirect port modes. In
case of 8- or 16-bit I/O transfers must taken place via AL or AX respectively.
In direct port mode the port number is an 8-bit immediate operand to access 256
ports. E.g. IN AL, 02 moves the contents of port 02 to AL.
In indirect mode the port number is taken from DX Allowing 64K bytes or 32K
words of ports.
21
Relative addressing mode:
In this mode using instruction specify the operand as a signed 8-bit displacement
relative to PC. E.g. JNC START. This instruction means that is carry =0 then PC is loaded
with current PC contents plus the 8-bit signed value of START; otherwise the next
instructions is executed.
In this mode using instruction have no operands. An example is CLC which clears the
carry flag to zero.
The 8086 has approximately 117 different instructions with about 300 OP codes.
The 8086 instruction set contains no-operand, single operand, two-operand, string
(array) instruction.8086 instructions do not permit memory to memory operations.
5. Conditional Instructions:
All 8086 conditional branch instructions use 8-bit singed displacement. i.e.
the displacement covers a branch range of -128 10 to +12710 with 0 being positive.
8086 Input/output:
Programmed I/O:
The standard I/O uses the instructions IN & OUT is capable of providing up to 64K
bytes of I/O locations. The standard I/O can transfer either 8-bi data or 16-bit data to or
from a peripheral device.
The 64K 8-byte I/O locations configured as 64K 8-bit ports or 32K 32-bit ports. All
I/O transfers between the 8086 & peripheral devices take place via AL for 8-bit ports
(AH is not involved) & AX for 16-bit ports. The I/O port addressing can be done either
directly or indirectly.
Direct:
IN AX, PORTA or IN AL, PORTA inputs 16-bit contents of port A into AX or 8-bit
contents of port A into AL respectively.
23
Indirect:
A, B, & C are the Ports. Ports A & B are latched 8-bit I/O ports for both input &
output. Port C is also an 8-bit port with latched output only.
8086 Interrupts:
1. Predefined interrupts.
2. User-define software interrupts.
3. User-defined hardware interrupts.
24
Predefined interrupts:
MD. Arshad Ali , (TE-07049)
Microprocessor
25