My ELTR-314 Book
My ELTR-314 Book
COMPUTER ARCHITECTURE
ELTR-314
Page 1
COMPUTER ARCHITECTURE ELTR-314
PREFACE
The text book has been written to cover the syllabus of Computer
Architecture, 3rd year D.A.E (Electronics).
The aim of bringing out this book is to enable the students to have
sound knowledge of the subject. Every aspect has been discussed to present
the subject matter in the most concise, compact lucid & simple manner to help
the subject without any difficulty. Frequent use of illustrative figures has been
made for clarity. Short Questions and Self-tests have also been included at the
end of each chapter which will serve as a quick learning tool for students.
The author would like to thank the reviewers whose valuable
recommendations have made the book more readable and understandable.
Constructive criticisms and suggestions for the improvements in future are
welcome.
AUTHORS
Page 2
COMPUTER ARCHITECTURE ELTR-314
Page 3
COMPUTER ARCHITECTURE ELTR-314
COURSE CONTENTS.
1. Solve the digital problems related to computer.
2. Program an Intel 8086 microprocessor using assembly and machine
language.
3. Debug and program.
4. Differentiate a 16 bit and 32 microprocessor.
5. Identify the function of standard interfaces.
6. Explain the memory organization.
7. Desc1ibe the stored program concept.
8. Identify the units of digital computer.
9. Describe computer peripheral devices.
10. Describe microcontroller's role.
1. BASIC MICROPROCESSOR ARCHITECTURE. (16 Hours)
1.1 Introduction of Microprocessor
1.2 Basic Architecture of a 16 bit Microprocessor (8086/88)
1.1.1 Block Diagram
1.2.2 Function of each Block
1.2.3 Buses
1.2.3.l Data Bus
l.2.3.2 Address Bus
l.2.3.3 Control Bus
1.2.4 Bus Timing
1.2.5 Pin Configuration of 8086/88
Page 4
COMPUTER ARCHITECTURE ELTR-314
Page 5
COMPUTER ARCHITECTURE ELTR-314
Page 6
COMPUTER ARCHITECTURE ELTR-314
Page 7
COMPUTER ARCHITECTURE ELTR-314
Page 8
COMPUTER ARCHITECTURE ELTR-314
Page 9
COMPUTER ARCHITECTURE ELTR-314
Page 10
COMPUTER ARCHITECTURE ELTR-314
Page 11
COMPUTER ARCHITECTURE ELTR-314
CONTENTS
1. Basic Microprocessor Architecture 13
2. Assembly Language 41
4. Interrupts 96
Page 12
COMPUTER ARCHITECTURE ELTR-314
CHAPTER 01
Basic Microprocessor Architecture
1.1 Understand the term Microprocessor
“Microprocessor is a VLSI device which performs arithmetic and logic
operations under various instructions.” First microprocessor was 4004 (4-bit)
which was launched by Intel Corporation in 1971. Now a days Core i3, Core i5
and Core i7 are modern microprocessors.
Page 13
COMPUTER ARCHITECTURE ELTR-314
HISTORY OF MICROPROCESSOR
The 4004 Microprocessor:
The world’s first microprocessor, the Intel 4004, was a 4-bit
microprocessor introduced in 1971. It addressed a mere 4,096 4-bit wide
memory locations. The Intel 4004 instruction set contained only 45
instructions.
The 8008 Microprocessor:
In the same year, Intel Corporation released the 8008-an extended 8-bit
version of the Intel 4004 microprocessor. The 8008 addressed an expanded
memory size (16K bytes) and contained 48 instructions.
The 8080 Microprocessor:
In 1973, Intel introduced the 8080 microprocessor-the first of the
modern 8-bit microprocessors. Not only could the 8080 address more memory
and execute additional instructions, but it executed them 10 times faster than
the 8008. An instruction that took 20 µs on an 8008-based system required
only 2.0 µs.
The 8085 Microprocessor:
In 1977, Intel Corporation introduced an updated version of the 8080--the
8085.This was to be the last 8-bit general-purpose microprocessor developed
by Intel. 8085 required only 1.3 µs per instruction. The main advantages of the
8085 were its internal clock generator, internal system controller, and higher
clock frequency.
The 8086/8088 Microprocessors:
In 1978, Intel released the 8086 microprocessor, a year or so later, it
released the 8088. Both devices were 16-bit microprocessors, which executed
instructions in as little as 400 ns (2.5 MIPS). In addition, the 8086 and 8088
addressed 1M bytes of memory. One other feature found in the 8086/8088
was a small 4 or 6-byte instruction cache or queue that prefetches a few
instructions before they are executed.
The 80286 Microprocessor:
The 80286 microprocessor (also a 16-bit architecture microprocessor)
was almost identical to the 8086 and 8088 except it addressed a 16M byte
memory system. The instruction set of the 80286 was also almost identical to
Page 14
COMPUTER ARCHITECTURE ELTR-314
the 8086 and 8088 except for a few instructions. The clock speed of the 80286
was increased, so it executed some instructions in as little as 250 ns (4.0 MIPS).
The 80386 Microprocessor:
The 80386 was Intel's first practical 32-bit microprocessor that
contained a 32-bit data bus and a 32-bit memory address. Through these 32-
bit buses, the 80386 addressed up to 4G bytes of memory. The instruction set
of the 80386 microprocessor was upward compatible with the earlier 8086,
8088, and 80286 microprocessors.
The 80486 Microprocessor:
In 1989, Intel released the 80486 microprocessor, which incorporated
an 80386-like microprocessor, an 80387-like numeric coprocessor, and an 8K
byte cache memory system into one integrated package. The internal
structure of the 80486 was modified from the 80386 so about half of its
instructions executed in 25ns (50 MIPS).
The Pentium Microprocessor:
The Pentium, introduced in 1993, was similar to the 80386 and 80486
microprocessors. This microprocessor was originally labeled the P5 or 80586.
The two introductory versions of the Pentium operated with a clocking
frequency of 60 MHz and 66 MHz and a speed of 110 MIPS. Another difference
was that the cache size was increased to 16K bytes. The Pentium contains an
8K byte instruction cache and an 8K byte data cache. The memory system
contained up to 4G bytes, with the data bus width increased from the 32-bits
found in the 80386 and 80486 to full 64-bits.
Page 15
COMPUTER ARCHITECTURE ELTR-314
(8 bits in 8088)
(8 bytes in 8088)
Fig. 1.2
Bus Interface Unit
The purpose of bus interface unit is: -
i- To keep Instruction Queue filled with instructions.
ii- To generate and accept the system control signals.
iii- To provide the system with address or I/O port number.
iv- To act a window between EU (Execution Unit) and Memory for data.
Following are the parts of bus interface unit: -
i- Instruction Pointer
ii- Segment Registers
iii- Address Summing Unit
iv- Instruction Queue / Prefetch Queue
Instruction Pointer
It is a 16-bit pointer which points the next instruction to be executed. It
contains a 16-bit offset address of instruction that is to be executed next.
Segment Registers
There are four segment registers in 8086/88 microprocessor. The purpose of
segment registers is to store the base address of 64KB memory segment.
Page 16
COMPUTER ARCHITECTURE ELTR-314
EXECUTION UNIT
The purpose of execution unit is: -
i- To carry out the instructions from prefetch queue.
ii- To decode the instructions.
iii- To execute the instructions.
Following are the parts of execution unit: -
i- General purpose registers
ii- Pointer and Index Registers
iii- Flag Register
iv- Instruction Decoder
v- Arithmetic Logic Unit
vi- Control Unit
1.2.3 Buses
A bus is a group of wires which connects the parts of the CPU to one another.
It is also a connection between devices connected to a computer. For example,
a bus carries data between a CPU and the system memory or I/O devices.
There are three types of buses. Address, Data & Control bus.
Address Bus
The group of electrical wires through which a microprocessor sent addresses
signals to select different ports or memory is called address bus. It is a
unidirectional bus.
Page 17
COMPUTER ARCHITECTURE ELTR-314
Data Bus
The group of electrical wires through which a microprocessor sent or receives
data from one section to another section is called data bus. It is a bidirectional
bus.
Control Bus
The group of electrical wires through which a microprocessor generates timing
and control signals to control data flow between microprocessor and
peripheral devices. These signals are according to instructions.
Fig. 1.3
1.2.4 Bus Timings
The 8086/8088 microprocessors use the memory and I/O in periods called bus
cycles. Each bus cycle equals four system-clocking periods (T states). There are
two types of bus cycles.
Page 18
COMPUTER ARCHITECTURE ELTR-314
4. 8086 samples the READY signal and if it is HIGH, T3 & T4 are executed;
otherwise TW is inserted after T3.
Fig. 1.4
During T3 State of Clock Signal:
Data is put on the data bus.
1. Status signals will remain on the upper address line A19-A16
During T4 State of Clock Signal:
1. ����
RD goes HIGH to indicate the end of read operation.
2. DEN goes HIGH to disable the transceiver.
������
Summary of Read Cycle
When a read cycle is to be performed, during T1 microprocessor puts an
address on address bus, and then bus is put in high impedance state during T2
state. Data to be read must be out on bus during T3 and T4. During T3 bus is
made “reserved for data in” and finally data is read during T4.
Page 19
COMPUTER ARCHITECTURE ELTR-314
2. �����
WR goes LOW at the mid of T2 for memory write operation.
3. ������
DEN goes LOW for data reception.
4. 8086 samples the READY signal and if it is HIGH, T3 & T4 are executed;
otherwise TW is inserted after T3.
Fig. 1.5
During T3 State of Clock Signal:
1. Data is written to the memory through the data bus.
2. Status signals will remain on the upper address line A19-A16
During T4 State of Clock Signal:
����� goes HIGH to indicate the end of write operation.
WR
1. ������
DEN goes HIGH to disable the transceiver.
Page 20
COMPUTER ARCHITECTURE ELTR-314
Fig.1.6
There is, however, a minor difference in one of the control signals. The 8086
has an M/IO��� pin, and the 8088 has an IO/M � pin. The only other hardware
difference appears on Pin 34 of both chips: on the 8088, it is an SSO pin, while
on the 8086, it is a BHE
������/S7 pin.
There is a detail of pin configuration of 8086 microprocessor as under.
VCC and GND
It uses 5V DC supply at VCC pin 40, and uses ground at VSS pin 1 and 20 for its
operation.
Clock signal
It provides timing to the processor for operations. Its frequency is different for
different versions, i.e. 5MHz, 8MHz and 10MHz.
Address/Data bus
AD0-AD15. These are 16 address/data bus. AD0-AD7 carries low order byte
data and AD8-AD15 carries higher order byte data. During the first clock cycle,
it carries 16-bit address and after that it carries 16-bit data.
Address/Status bus
A16-A19 / S3-S6. These are the 4 address/status buses. During the first clock
cycle, it carries 4-bit address and later it carries status signals.
Page 21
COMPUTER ARCHITECTURE ELTR-314
������
𝐁𝐁𝐁𝐁𝐁𝐁/𝐒𝐒𝐒𝐒
BHE stands for Bus High Enable. It is used to indicate the transfer of data using
data bus D8-D15. This signal is low during the first clock cycle, thereafter it is
active.
����
𝐑𝐑𝐑𝐑
It is used to read signal for Read operation.
Ready
It is an acknowledgement signal from I/O devices that data is transferred.
When it is high, it indicates that the device is ready to transfer data. When it
is low, it indicates wait state.
RESET
It is used to restart the execution. It causes the processor to immediately
terminate its present activity. This signal is active high for the first 4 clock
cycles to RESET the microprocessor.
INTR
It is an interrupt request signal, which is sampled during the last clock cycle
of each instruction to determine if the processor considered this as an
interrupt or not.
NMI
It stands for non-maskable interrupt. It is an edge triggered input, which
causes an interrupt request to the microprocessor.
�������
𝐓𝐓𝐓𝐓𝐓𝐓𝐓𝐓
This signal is like wait state. When this signal is high, then the processor has
to wait for IDLE state, else the execution continues.
�����
𝐌𝐌𝐌𝐌/𝐌𝐌𝐌𝐌
It stands for Minimum/Maximum. It indicates what mode the processor is to
operate in; when it is high, it works in the minimum mode and vice-versa.
�������
𝐈𝐈𝐈𝐈𝐈𝐈𝐈𝐈
It is an interrupt acknowledgement signal. When the microprocessor receives
this signal, it acknowledges the interrupt.
ALE
It stands for address latch enable. This signal indicates the availability of a
valid address on the address/data lines.
DEN
It stands for data enable. It is used to enable transceiver 8286. The transceiver
is a device used to separate data from the address/data bus.
Page 22
COMPUTER ARCHITECTURE ELTR-314
�
𝐃𝐃𝐃𝐃/𝐑𝐑
It stands for Data transmit/receive signal. It decides the direction of data flow
through the transceiver. When it is high, data is transmitted out and vice
versa.
���
𝐌𝐌/𝐈𝐈𝐈𝐈
This signal is used to distinguish between memory and I/O operations. When
it is high, it indicates the memory operation and low indicates I/O operation.
�����
𝐖𝐖𝐖𝐖
It stands for write signal. It is used to write the data into the memory or the
output device depending on the status of M/IO ��� signal.
HLDA
It stands for Hold Acknowledgement signal. This signal acknowledges the
HOLD signal.
HOLD
This signal indicates to the processor that external devices are requesting to
access the address/data buses.
QS1 and QS0
These are queue status signals. These signals provide the status of instruction
queue.
S0, S1, S2
These are the status signals that provide the status of operation, which is used
by the Bus Controller 8288 to generate memory & I/O control signals.
LOCK
When this signal is active, it indicates to the other processors not to ask the
CPU to leave the system bus.
RQ/GT1 and RQ/GT0
These are the Request/Grant signals used by the other processors requesting
the CPU to release the system bus. When the signal is received by CPU, then
it sends acknowledgment. RQ/GT0 has a higher priority than RQ/GT1.
1.2.6 Clocking and Power Requirement of 8086/88
Microprocessor
Clocking Requirement
A special clock generator 8284A provides clock timing to the processor for
operations. Its frequency is different for different versions, i.e. 5MHz, 8MHz
and 10MHz.
Page 23
COMPUTER ARCHITECTURE ELTR-314
The clock signal must have a duty cycle of 33% (high for one-third of the
clocking period and low for two-thirds) to provide proper internal timing for
the 8086/8088.
Power Requirement
Both the 8086 and 8088 microprocessors require +5.0 V with a supply voltage
tolerance of ±10 percent. The 8086 draws a maximum supply current of 360
mA, and the 8088 draws a maximum of 340 mA. Both microprocessors
operate in ambient temperatures of between 32°F and about 180°F. The
80C88 and 80C86 are CMOS versions that require only 10 mA of power supply
current and function in temperature extremes of-40°F through +225°F.
1.2.7 Bus Buffering and Latching
All computer systems have three buses: an address bus, a data bus, and a
control bus. These buses must be present in order to interface to memory and
I/O. The address/data bus of 8086/88 is multiplexed to reduce no of pins.
Memory and I/O require that address remains valid and stable throughout a
read and write cycle. So, 8086/88 system requires separate address, data, and
control buses.
Latches are used to de-multiplex the address/data and address/status lines
and commonly have output buffers for driving external loads. Buffers are used
to drive external loads, and to isolate component when disabled.
Demultiplexing the 8086:
In 8086 A19/S6–A16/S3, AD15–AD0 and ������ BHE/S7 are multiplexed. Fig. 1.7
illustrates a demultiplexed 8086 with all three buses.
Fig. 1.7
Page 24
COMPUTER ARCHITECTURE ELTR-314
Three 74LS373 latches have been used to demultiplex the address/data bus
and address/status pins. Latches pass inputs to outputs whenever ALE become
HIGH. The memory and I/O system see the 8086 as a device with a 20-bit
address bus (A19– A0), a 16-bit data bus (D15–D0), and a three-line control
bus (M/IO
���, ���� WR).
RD, and �����
Fig. 1.8
Buffering
If more than 10 units loads are attached to any bus pin, the entire 8086 or
8088 system must be buffered using 74244. Demultiplexed pins are already
buffered by 74LS373 latch.
Page 25
COMPUTER ARCHITECTURE ELTR-314
While the EU is executing this instruction, the BIU proceeds to fetch a new
instruction. During the execution of an instruction, fetching of next instruction
of BIU is called pipelining. The BIU may fill the queue with several new
instructions before the EU is ready to draw its next instruction. The advantage
of this technique is that the EU can execute instructions continually instead of
having to wait for the BIU to fetch the new instruction.
Fig. 1.9
1.3.2 Multitasking
Multitasking is the running of multiple programs in one computer at
the same time. It is controlled by the operating system, which loads programs
into the computer for processing and oversees their execution until they are
finished. For example, when you open your Web browser and then open Word
at the same time, you are causing the operating system to do multitasking.
1.3.3 Parallel Processing
Parallel processing is a method in computing of running two or
more processors to handle separate parts of an overall task. This technique
helps to reduce the amount of time to run a program. Any system that has
more than one processor can perform parallel processing, as well as multi-
core processors which are commonly found on computers today.
Fig. 1.9
Typically, a computer scientist divides a task into multiple parts with a
software tool and assigns each part to a processor, then each processor will
solve its part, and the data is reassembled by a software tool to read the
solution or execute the task.
Page 26
COMPUTER ARCHITECTURE ELTR-314
Accumulator AH AL
Base BH BL
Count CH CL
Data DH DL
15 0
Code Segment CS
Data Segment DS
Stack Segment SS
Extra Segment ES
15 0
Instruction Pointer IP
Stack Pointer SP
Base Pointer BP
Source Index SI
Destination Index DI
15 0
Flag Register F
Fig. 1.10
Page 27
COMPUTER ARCHITECTURE ELTR-314
Fig. 1.11
Page 28
COMPUTER ARCHITECTURE ELTR-314
There are four portions in 8086/88 1MB memory. Each portion is called
memory segment and consists of 64K bytes.
i. Code Segment
ii. Data Segment
iii. Extra Segment and
iv. Stack Segment.
There are four segment registers in 8086/88 microprocessor.
i. CS
ii. DS
iii. ES
iv. SS
Each segment register contains most left 16-bits of starting address of a
related memory segment. For example, if starting address of Code Segment is
10000H, then 1000H is stored in CS register.
To generate 20-bit address, the contents of Pointer/Index/Base register is
added in segment register × 10H
For Example:
IP = A0B0H CS = 1000H
20-bit address CS × 10H = 10000H CS × 10H + IP = 1A0B0H
Fig. 1.12
The contents of Pointer/Index/Base register are called offset address
and the contents of Segment registers are called base address.
20-bit address generated by address summing block is called effective
address or physical address.
Effective address of CS = IP + CS × 10H
Effective address of DS = [BX, SI or DI] + DS × 10H
Effective address of SS = [SP or BP] + SS × 10H
Effective address of ES = [DI or SI] + ES × 10H
Page 29
COMPUTER ARCHITECTURE ELTR-314
Page 30
COMPUTER ARCHITECTURE ELTR-314
Zero Flag
Zero flag indicates if the result of arithmetic or logic operation is zero or non-
zero.
Z = 0 (If result is non-zero)
Z = 1 (If result is zero)
Sign Flag
Sign Flag indicates whether the result of the last mathematical operation is
positive or negative.
S = 0 (If result is positive)
S = 1 (If result is negative)
Overflow Flag
Overflow Flag indicates that the signed two's-complement result would not fit
in the ALU width.
O = 0 (If result is in the capacity of processor)
O = 1 (If result is not in the capacity of processor)
Trap Flag
Trap flag permits operation of a processor in single-step mode.
T = 0 (Processor is in normal mode)
T = 1 (Processor is in single step mode)
Interrupt Flag
Interrupt Flag determines whether or not the CPU will handle maskable
hardware interrupts.
I = 0 (Maskable hardware interrupts will be ignored.)
I = 1 (Maskable hardware interrupts will be handled.)
Direction Flag
Direction Flag controls the direction of string processing.
I = 0 (SI and DI are in auto-incrementing mode in string operations.)
I = 1 (SI and DI are in auto-decrementing mode in string operations.)
Trap, Interrupt and Direction flags are called control flags because
these flags can be controlled by the programmer.
1.5 Memory
1.5.1 Read Only Memory (ROM)
A ROM contains permanently or semi-permanently stored data, which
can be read from the memory but either cannot be changed at all or cannot
Page 31
COMPUTER ARCHITECTURE ELTR-314
be changed without specialized equipment. ROMs retain stored data when the
power is off and are therefore nonvolatile memories.
Semiconductor ROMs are categorized as shown in fig. 1.13.
Fig. 1.13
MASK ROM
The mask ROM is the type in which the data are permanently stored in
the memory during the manufacturing process. Once the memory is
programmed, it cannot be changed. Fig. 1.14 shows MOS ROM cells. The
presence of a connection from a row line to the gate of a transistor represents
a 1 and no gate connection to a row line represents a 0.
Fig. 1.14
PROM
The PROM, or programmable ROM, is the type in which the data are
electrically stored by the user with the aid of specialized equipment. In the
programming process, a sufficient current is injected through the fusible link
to burn it open to create a stored 0. The link is left intact for a stored 1. Both
the mask ROM and the PROM can be of either MOS or bipolar technology.
Fig. 1.15
Page 32
COMPUTER ARCHITECTURE ELTR-314
EPROM
An EPROM is an erasable PROM. It can be reprogrammed. The data bits
in this type of array are represented by the presence or absence of a stored
gate charge. Erasure of a data bit is a process that removes the gate charge.
Two basic types of erasable PROMs are the ultraviolet erasable PROM (UV
EPROM) and the electrically erasable PROM (EEPROM).
UV PROM
UV EPROM device is recognized by the transparent quartz lid on the
package, as shown in figure. Erasure is done by exposure of the chip to high-
intensity ultraviolet radiation through the quartz window on top of the
package. The positive charge stored on the gate is neutralized after several
minutes to an hour of exposure time.
Fig. 1.16
EEPROM
An electrically erasable PROM can be both erased and programmed
with electrical pulses. The EEPROM can be rapidly programmed and erased in-
circuit for reprogramming.
Applications of ROM
A ROM stores data that are used repeatedly in system applications,
such as tables, conversions, or programmed instructions for system
initialization and operation.
1.5.2 Random Access Memory (RAM)
RAMs are read/write memories in which data can be written into or read
from any selected address in any sequence. There are two types of RAM.
i- Static Random Access Memory
ii- Dynamic Random Access Memory
cell by placing it on the Data in line. A data bit is read by taking it off the Data
out line.
Fig. 1.17
Write operation in SRAM Cell
A HIGH on the row and column lines is applied to select the cell. To
write a data unit, a bit (1 or 0) is applied to data input line. A LOW on the R/W
�
line (WRITE mode) enables the input AND gate and disables the output AND
gate, which causes each data bit to be stored in a selected cell.
Read operation in SRAM Cell
A HIGH on the row and column lines is applied to select the cell. To
read a data unit, the Read line is taken to its active state by applying HIGH
on R/W� . This disables the input AND gate and enables the output AND gate.
This causes the data bit stored in the selected cell to appear on the output.
Fig. 1.18
Page 34
COMPUTER ARCHITECTURE ELTR-314
Input and output buffers are used for write and read operations. These buffers
are controlled by R/W
� signal. A refreshing buffer is also used for refreshing the
data. These buffers are not shown in the cell for simplicity.
Write operation in DRAM Cell
A LOW on the R/W � line (WRITE mode) enables the tristate input buffer
and disables the output buffer. A HIGH on the row line is applied to close the
transistor. When a voltage is applied on the bit line, this will transfer to
capacitor and store in it. When the row line is taken back LOW, the transistor
turns off and disconnects the capacitor from the bit line.
Read operation in DRAM Cell
To read from the cell, the R/W � (Read/Write) line is HIGH, enabling the
output buffer and disabling the input buffer. When the row line is taken HIGH,
the transistor turns on and connects the capacitor to the bit line and thus to
the output buffer (sense amplifier), so the data bit appears on the data-output
line.
Refreshing Process
For refreshing the memory cell, the R/W � line is HIGH, the row line is
HIGH, and the refresh line is HIGH. The transistor turns on, connecting the
capacitor to the bit line. The output buffer is enabled, and the stored data bit
is applied to the input of the refresh buffer, which is enabled by the HIGH on
the refresh input. This produces a voltage on the bit line corresponding to the
stored bit, thus refreshing the capacitor.
Fig. 1.19
Page 35
COMPUTER ARCHITECTURE ELTR-314
Flash Memory
Flash memory is a non-volatile memory chip used for storage and for
transferring data between a personal computer (PC) and digital devices. It has
the ability to be electronically reprogrammed and erased. It is often found in
USB flash drives, MP3 players, SD memory cards, digital cameras and solid-
state drives.
Flash memory, erases data in units called blocks and rewrites data at
the byte level. Flash is technically a variant of EEPROM, but the industry
reserves the term EEPROM for byte-level erasable memory and applies the
term flash memory to larger block-level erasable memory.
Fig. 1.20
STRUCTURE
A basic flash memory cell consists of a storage transistor like MOSFETs
only they have two gates on top instead of one as shown in fig. 1.20. It's an n-
p-n sandwich with two gates, one called a control gate and one called a
floating gate. The two gates are separated by oxide layers through which
current cannot normally pass.
WORKING
Flash memory incorporates the use of floating-gate transistors to store
data. The floating gate stores the electrical charge and controls the flow of the
electrical current. Electrons are added to or removed from the floating gate to
change the storage transistor's threshold voltage. Changing the voltage affects
whether a cell is programmed as a zero or a one.
Page 36
COMPUTER ARCHITECTURE ELTR-314
Page 37
COMPUTER ARCHITECTURE ELTR-314
EXERCISE
SECTION-I (MULTIPLE CHOICE QUESTIONS)
1. Which processor is a 4-bit processor?
(a) 4004 (b) 8008 (c) 8080 (d) 8085
2. The size of instruction queue in 8086-microprocessor is;
(a) 3 bytes (b) 4 bytes (c) 6 bytes (d) 8 bytes
3. If sign flag is set, then result of ALU operation is;
(a) Negative (b) Positive (c) Zero (d) None of these
4. Stack Pointer stores the offset address of;
(a) Stack Segment (b) Data Segment
(c) Code Segment (d) Extra Segment
5. If CS = 0200H and IP = 1234H, then physical address will be;
(a) 02000H (b) 01234H (c) 03234H (d) 02343H
6. Which is not a part of execution unit?
(a) General registers (b) ALU (c) Flag register (d) Instruction Pointer
7. BIU stands for;
(a) Bus Interrupt Unit (b) Bus Interface Unit
(c) Buffer Interface Unit (d) None of these
8. Flag which controls the single step mode of 8086-microprocessor is;
(a) Interrupt Flag (b) Trap Flag (c) Direction Flag (d) Sign Flag
9. Which of the following is a correct physical address formation technique?
(a) CS:DS (b) AX:BX (c) IP:AX (d) CS:IP
10. 8086 microprocessor can address memory;
(a) 1 MB (b) 2 MB (c) 4 MB (d) 8 MB
11. Offset address of Code segment is stored in;
(a) IP (b) BP (c) SP (d) SI
12. Flag register of 8086 microprocessor consists of;
(a) 5 Flags (b) 7 Flags (c) 9 Flags (d) 11 Flags
13. �
IO/M signal is a part of;
(a) Data Bus (b) Address Bus (c) Control Bus (d) None of these
14. Flash memory is a type of;
(a) EEPROM (b) UVPROM (c) SRAM (d) DRAM
15. Trap Flag is a type of flag;
(a) Base (b) Offset (c) Conditional (d) Control
ANSWER KEY
1. a 2. c 3. a 4. a 5. c
6. d 7. b 8. b 9. d 10. a
11. a 12. c 13. c 14. a 15. d
Page 38
COMPUTER ARCHITECTURE ELTR-314
Page 39
COMPUTER ARCHITECTURE ELTR-314
4. What is meant by bus buffering & latching? Explain the bus buffering
and latching of 8086 microprocessor.
5. Enlist types of RAM and explain each briefly.
Page 40
COMPUTER ARCHITECTURE ELTR-314
CHAPTER 02
Assembly Language
2.1 INSTRUCTION & INSTRUCTION SET
INSTRUCTION
An instruction is a binary pattern designed inside the microprocessor to
perform a specific function. In other words, it is actually a command to the
microprocessor to perform a given task on specified data.
INSTRUCTION FORMAT
Each instruction has two parts: one is the task to be performed called the
operation code (opcode) and the other is the data to be operated on called
the operand (data).
INSTRUCTION SET
The entire group of instructions that a microprocessor supports is called
Instruction Set. The instruction set determines what functions the
microprocessor can perform. 8085 has instruction set of 246 instructions.
There are 117 basic instructions in 8086/88 microprocessors.
Page 41
COMPUTER ARCHITECTURE ELTR-314
Page 42
COMPUTER ARCHITECTURE ELTR-314
Page 43
COMPUTER ARCHITECTURE ELTR-314
• ROR − Rotate bits of byte/word towards the right, i.e. LSB to MSB and
to Carry Flag [CF].
• RCR − Rotate bits of byte/word towards the right, i.e. LSB to CF and CF
to MSB.
• RCL − Rotate bits of byte/word towards the left, i.e. MSB to CF and CF
to LSB.
STRING INSTRUCTIONS
String is a group of bytes/words and their memory is always allocated in a
sequential order. Following is the list of instructions under this group −
• REP − Repeat the given instruction till CX ≠ 0.
• REPE/REPZ − Repeat the given instruction until CX = 0 or zero flag ZF =
1.
• REPNE/REPNZ − Repeat the given instruction until CX = 0 or zero flag
ZF = 1.
• MOVS/MOVSB/MOVSW − Move the byte/word from one string to
another.
• COMS/COMPSB/COMPSW − Compare two string bytes/words.
• INS/INSB/INSW − Input string/byte/word from the I/O port to the
provided memory location.
• OUTS/OUTSB/OUTSW − Output string/byte/word from the provided
memory location to the I/O port.
• SCAS/SCASB/SCASW − Scan a string and compare its byte with a byte
in AL or string word with a word in AX.
• LODS/LODSB/LODSW − Store the string byte into AL or string word into
AX.
PROGRAM TRANSFER INSTRUCTIONS
These instructions are used to transfer/branch the instructions during an
execution. It includes the following instructions −
Instructions to transfer the instruction without any condition −
• CALL − Call a procedure and save their return address to the stack.
• RET − Return from the procedure to the main program.
• JMP − Jump to the provided address to proceed to the next instruction.
Instructions to transfer the instruction with some conditions −
• JA/JNBE − Jump if above/not below/equal instruction satisfies.
• JAE/JNB − Jump if above/not below instruction satisfies.
• JBE/JNA − Jump if below/equal/ not above instruction satisfies.
• JC − Jump if carry flag CF = 1
Page 44
COMPUTER ARCHITECTURE ELTR-314
Page 45
COMPUTER ARCHITECTURE ELTR-314
MACHINE LANGUAGE
Machine language instructions typically use some binary codes to represent
operations, such as addition, and some bits to represent operands, or perhaps
the location of the next instruction. A computer language which is in the binary
form is called machine language.
Machine language is difficult to read and write, since it does not resemble
human language, and its codes vary from computer to computer. Programs
written in this way would tend to be error prone and would be very difficult to
debug. For this reason, programs are generally written in a language which is
easier for humans to understand and can also be translated into machine code
for the processor to understand.
Page 46
COMPUTER ARCHITECTURE ELTR-314
ASSEMBLY LANGUAGE
Assembly language is very close to machine language. The commands are
represented in assembly language by short names called mnemonics. For
example, LDA means Load Accumulator with a particular data value. Because
each type of processor has a different set of operations, different processors
use different assembly languages. Assembly language programming is
complex but it provides a much higher degree of control than high level
languages. Programs written in assembly language code are translated into
machine code by an assembler.
Page 47
COMPUTER ARCHITECTURE ELTR-314
ASSEMBLER
An assembler is a program that translates an assembly language program into
machine code. Assembly program is called source code and machine code is
called object code.
Fig. 2.1
COMPILER
A compiler is a program that translates a source program written in some high-
level programming language into machine language (or machine code). A
compiler first reads the whole program before executing it.
Fig. 2.2
Page 48
COMPUTER ARCHITECTURE ELTR-314
INTERPRETER
An interpreter is a program that transforms a high-level programming code
into code that can be understood by the machine (machine code). The
interpreter reads each statement of code and then converts or executes it
directly.
Fig. 2.3
LABEL FIELD:
It consists of symbols and used to represent the memory address. A label can
be placed at the beginning of a statement. During assembly, the label is
assigned the current value of instruction pointer and serves as an instruction
operand. Label is followed by a colon (:).
OPERATION CODE:
The part of program statement, that specifies the operation to be performed
is called operation code. It occurs after the label field.
OPERAND:
The part of program statement, that specifies the data on which the operation
is to be performed is called operand.
COMMENTS:
The last field of an Assembler source statement is the comment field. This field
is optional and personal remarks of programmer. It does not execute during
program running. A semi-colon (;) is used before comment field.
Page 49
COMPUTER ARCHITECTURE ELTR-314
Page 50
COMPUTER ARCHITECTURE ELTR-314
Fig. 2.5
Table shows many different variations of MOV instructions that apply
immediate data.
Page 51
COMPUTER ARCHITECTURE ELTR-314
Fig. 2.6
In the direct addressing instructions, only the AX and AL registers may be
moved to and from the memory.
MOV CL, [1234H] instruction is the example of displacement addressing. Both
basically perform the same operation except for the destination register (CL
verses AL). The MOV AL, [1234H] instruction is three bytes long and the MOV
CL, [1234H] instruction is four bytes long.
Page 52
COMPUTER ARCHITECTURE ELTR-314
transfers it into register AX as shown in fig. 2.7. The contents of 03000H are
moved into AL and the contents of 03001H are moved into AH.
Fig. 2.7
The data segment is used by default with addressing mode that uses BX, DI, or
SI to address memory. If register BP addresses memory, the stack segment is
used by default.
Fig. 2.8
Example: the MOV [BX+DI], CL instruction copies the byte sized contents of
register CL into the data segment memory location addressed by BX plus DI.
Page 53
COMPUTER ARCHITECTURE ELTR-314
In this example, BX = 1000H, DI= 00I0H, and DS = 0100H, which translate into
memory address 02010H. This instruction transfers a copy of the word from
location 02010H into the DX register as shown in fig. 2.8.
A major use of the base plus index addressing mode is to address elements in
a memory array. To accomplish this, load the BX register (base) with the
beginning address of the array and the DI register (index) with the element
number to be accessed. Fig. 2.9 shows the use of BX and DI to access an
element in an array of data.
Fig. 2.9
Fig. 2.10
Fig. 2.10 shows the operation of the MOV AX, [BX+l000H] instruction. In this
example, BX = 0100H and DS = 0200H, so the address generated is the sum of
Page 54
COMPUTER ARCHITECTURE ELTR-314
DS × 10H, BX, and the displacement of 1000H is 03100H. Remember that BX,
DI, or SI address the data segment and BP addresses the stack segment.
Fig. 2.11
Fig. 2.11 shows how data are referenced if the instruction executed by the
microprocessor is a MOV AX, [BX+SI+100H]. The displacement of 100H adds to
BX and SI to form the offset address within the data segment. Registers BX =
0020H, SI = 0010H, and DS = 1000H, so the effective address for this instruction
is 10130H, the sum of these registers plus a displacement of 100H. This
addressing mode is too complex for frequent use in a program.
Page 55
COMPUTER ARCHITECTURE ELTR-314
second (least significant) data byte moves into the stack segment memory
location addressed by SP-2 as shown in fig. 2.12.
Fig. 2.12
POP
POP instruction performs the inverse operation of a PUSH instruction. The POP
instruction removes data from stack and places it into the target 16-bit
register, segment register or, 16-bit memory location.
The least significant byte of data is removed from SP and most significant byte
is removed from stack segment memory location addressed by SP+1 as shown
in fig. 2.13.
Fig. 2.13
Example:
An assembly program is given below:
MOV AX, 7645H
MOV BX, 4477H
MOV CX, 8899H
MOV DX, BX
PUSH DX
PUSH AX
PUSH BX
PUSHF
POP CX
PUSH 1000H
Page 56
COMPUTER ARCHITECTURE ELTR-314
POP DX
POP AX
Assume that, SS = 2000H, SP = 2009H and F = FFCDH then, Find out
(a) The physical address.
(b) The value of SS and SP after the end of program.
(c) The value of AX, BX, CX, DX and Flag register after the end of the
program.
(d) Draw the memory map in detail.
Solution:
(a) Physical address = SS × 10H + SP = 2000 × 10H + 2009H = 22009H
(b) Final value of SS = 2000H and SP = Current SP – No. of PUSH × 2 + No.
of POP × 2
= 2009H – 5 × 2 + 3 × 2 = 2009H – 10 + 6 = 2009H – 4 = 2005H
(c) AX = 4477H; BX = 4477H; CX = FFCDH; DX = 1000H; F = FFCDH
(d)
Fig. 2.14
IN AND OUT INSTRUCTIONS
IN INSTRUCTION
IN instruction transfer data from an input device to the microprocessor's
accumulator register (AL, AX or EAX).
OUT INSTRUCTION
OUT instruction transfer data from the microprocessor's accumulator register
(AL, AX or EAX) to an output device.
IN and OUT instructions are basically two types.
• Fixed port instruction
• Variable port instruction
Page 57
COMPUTER ARCHITECTURE ELTR-314
Page 58
COMPUTER ARCHITECTURE ELTR-314
Syntax
The syntax for the MUL/IMUL instructions is as follows −
MUL/IMUL multiplier
Multiplicand in both cases will be in an accumulator, depending upon the size
of the multiplicand and the multiplier and the generated product is also stored
in two registers depending upon the size of the operands. Following section
explains MUL instructions with different cases –
When two bytes are multiplied -
The multiplicand is in the AL register, and the multiplier is a byte in the memory
or in another register. The product is in AX. High-order 8 bits of the product is
stored in AH and the low-order 8 bits are stored in AL.
When two one-word values are multiplied -
The multiplicand should be in the AX register, and the multiplier is a word in
memory or another register. For example, for an instruction like MUL DX, you
must store the multiplier in DX and the multiplicand in AX.
The resultant product is a double word, which will need two registers. The
high-order (leftmost) portion gets stored in DX and the lower-order
(rightmost) portion gets stored in AX.
Example:
MOV AL, 25H ; a byte is moved to AL
MOV BL, 65H ; immediate data must be in a register
MUL BL ; AL = 25H × 65H
MOV RESULT, AX ; the result is saved
Page 59
COMPUTER ARCHITECTURE ELTR-314
Fig. 2.15
If we want to shift more than one bit, then that value is first stored in CL
register. The instruction syntax is:
SHR destination, bits to be shifted
SHL INSTRUCTION
The SHR instruction is an abbreviation for ‘Shift Left’. This instruction simply
shifts all bits in the register to the left side one by one. The LSB is replaced by
a ZERO and MSB is stored in the Carry Flag (CF) as shown in fig. 2.16.
Page 61
COMPUTER ARCHITECTURE ELTR-314
Fig. 2.16
ROR INSTRUCTION
The ROR instruction stands for ‘Rotate Right’. This instruction rotates the
mentioned bits in the register to the right side one by one such that rightmost
bit that is being rotated is again stored as the MSB in the register, and it is also
stored in the Carry Flag (CF).
Fig. 2.17
Syntax: ROR Register, Bits to be shifted
Example: ROR AH, 4
ROL INSTRUCTION
The ROL instruction is an abbreviation for ‘Rotate Left’. This instruction rotates
the mentioned bits in the register to the left side one by one such that leftmost
bit that is being rotated is again stored as the rightmost bit in the register, and
it is also stored in the Carry Flag (CF).
Fig. 2.18
Syntax: ROL Register, Bits to be shifted
Example: ROL AH, 4
JUMP INSTRUCTIONS
Jump Instructions are used for changing the flow of execution of instructions
in the processor. We can jump to any instruction in between the program,
then this can be achieved by these instructions. There are two types of Jump
instructions:
Page 62
COMPUTER ARCHITECTURE ELTR-314
CALL INSTRUCTION
The CALL instruction is used whenever we need to make a call to some
procedure or a subprogram. A procedure is group of instructions that usually
performs one task. It is a reusable section of a software program which is
stored in memory once but can be used as often as necessary. Whenever
a CALL is made, the following process takes place inside the microprocessor:
• The address of the next instruction that exists in the caller program is
stored in the stack.
• The instruction queue is emptied for accommodating the instructions
of the procedure.
• Then, the contents of the instruction pointer (IP) are changed with the
address of the first instruction of the procedure.
• The subsequent instructions of the procedure are stored in the
instruction queue for execution.
The Syntax for the CALL instruction is as follows:
Page 63
COMPUTER ARCHITECTURE ELTR-314
CALL subprogram_name
CALL instruction can be of two types.
Near CALL: A procedure is known as NEAR procedure if is written in the same
code segment which is calling that procedure. Only Instruction Pointer
contents will be changed in NEAR procedure.
FAR CALL: A procedure is known as FAR procedure if it is written in the
different code segment than the calling segment. In this case both Instruction
Pointer and the Code Segment register content will be changed.
Fig. 2.19
Page 64
COMPUTER ARCHITECTURE ELTR-314
EXERCISE
SECTION-I (MULTIPLE CHOICE QUESTIONS)
1. The computer language in which 0's and 1's are used is called;
(a) Assembly (b) C ++ (c) Machine (d) None
2. The process of saving data in stack is done by the instruction;
(a) CALL (b) PUSH (c) POP (d) HLT
3. Instruction MOV AX, 10H uses the addressing mode;
(a) Register (b) Immediate (c) Direct (d) Indirect
4. The symbol used in assembly program after label field is
(a) Colon (b) Comma (c) Semi Colon (d) Asterisk
5. A microprocessor can directly understand the language;
(a) Machine (b) High Level (c) Assembly (d) All
6. Which of the following is an arithmetic instruction?
(a) ADD (b) JMP (c) XCHG (d) MOV
7. Which one of the following is an invalid instruction?
(a) MOV AX, BX (b) MOV CS, DS
(c) MOV AX, 1234H (d) MOV AX, (1234H)
8. The instruction used to enter the subroutine into the main program?
(a) PUSH (b) POP (c) IN (d) CALL
9. The part of the instruction that tells the processor what to do is called;
(a) Comment (b) Label (c) Opcode (d) Operand
10. The data on which the operation is to be performed is called
(a) Comment (b) Label (c) Opcode (d) Operand
11. If CX = 000EH, then result of INC CX instruction will be
(a) 000FH (b) 000DH (c) 000AH (d) 000BH
12. In JNZ instruction, jump is occurred when zero flag is
(a) High (b) Set (c) Reset (d) Undefined
13. The instruction in an assembly program is called
(a) Line (b) Comment (c) Label (d) Mnemonic
14. The result of MOV AL, 65 is to store…………. in AL register
(a) (0100 0010)2 (b) 65 H (c) (0100 0001)2 (d) 42 H
15. The result of instruction AND AX, 0 is always
(a) FFFFH (b) 000FH (c) FF00H (d) 0000H
ANSWER KEY
1. c 2. b 3. b 4. a 5. a
6. a 7. b 8. d 9. c 10. d
11. a 12. c 13. d 14. c 15. d
Page 65
COMPUTER ARCHITECTURE ELTR-314
Page 66
COMPUTER ARCHITECTURE ELTR-314
Page 67
COMPUTER ARCHITECTURE ELTR-314
CHAPTER 03
Memory & Basic I/O Interface
3.1 MEMORY DEVICES
Every microprocessor-based system has a memory system. There are two
basic types of memory.
• ROM: It stores system software and permanent system data.
• RAM: It stores temporary data and instructions.
Four commonly used memories are ROM, Flushable EEPROM, Static RAM, and
Dynamic RAM.
PIN CONNECTIONS
Address Pins: All memory devices have address inputs. They select a memory
location within the memory device. The number of address pins is related to
the number of memory locations. Address inputs are labeled from A0 to AN. N
is the total number of address pins minus 1. For example, the 2K memory has
11 address lines which are labelled as A0 - A10.
Data Pins: All memory devices have a set of data outputs or input/outputs.
They are used to enter the data for storage or extract the data for reading. The
data pins are typically bi-directional in read-write memories. The number of
data pins is related to the size of the memory location. For example, memory
device of 1K X 8 indicate a byte addressable memory with 10 address pins.
Fig. 3.1
Selection Pins: Each memory device has at least one chip select (𝐶𝐶𝐶𝐶) or chip
enable (𝐶𝐶𝐶𝐶) pin that enables the memory device. This enables read and write
operations. If more than one are present, then all must be 0 in order to
perform a read or write. If they are active (logic 0), the memory device
performs a read or write operation. If they are inactive (logic 1), the memory
is disabled and do not do any operation.
Page 68
COMPUTER ARCHITECTURE ELTR-314
Control Pins: Each memory device has at least one control pin. For ROMs, an
Output Enable (𝑂𝑂𝑂𝑂) or Gate (𝐺𝐺) is present. The 𝑂𝑂𝑂𝑂 pin enables and disables a
set of tristate buffers. For RAMs, a read-write (R/𝑊𝑊) or write enable (𝑊𝑊𝑊𝑊) and
read enable (𝑂𝑂𝑂𝑂) are present. For dual control pin devices, it must be hold true
that both are not 0 at the same time.
Fig. 3.2
Address Decoding Methods
There are two basic address decoding strategies.
• Full address decoding
• Partial address decoding
Full Address Decoding
All the address lines are used to specify a memory location. Each physical
memory location is identified by a unique address.
Page 69
COMPUTER ARCHITECTURE ELTR-314
Fig. 3.3
Partial Address Decoding
Since not all the address space is implemented, only a subset of the address
lines is needed to point to the physical memory locations. Each physical
memory location is identified by several possible addresses (using all
combinations of the address lines that were not used).
Example: Microprocessor with 10 address lines. We wish to address 512 bytes
of memory. We still must use 128-byte memory chips.
Fig. 3.3
3.3 8088 and 80188 (8-BIT) MEMORY INTERFACE
8088/80188 both microprocessors have an 8-bit data bus, which makes them
ideal to connect to common 8 bits memory devices available. For the
8088/80188 to function correctly with memory, however, the system must
decode the address to select a memory component.
Page 70
COMPUTER ARCHITECTURE ELTR-314
Fig. 3.4
The address range of 1MB memory is from 00000H to FFFFFH. 20 bits address
bus selects required memory location and 8 bits data on that location transfers
on data bus.
3.4 8086/80186 (16-BIT) MEMORY INTERFACE
16-bit memory interface is used in 8086, 80186, 80286, and 80386SX
microprocessors. The 8086, 80186, 80286, and 80386SX microprocessors
differ from the 8088/80188 in three ways:
• The data bus is 16 bits wide instead of 8 bits wide as on the 8088.
� pin of the 8088 is replaced with a 𝑀𝑀/𝐼𝐼𝐼𝐼
• The 𝐼𝐼𝐼𝐼/𝑀𝑀 ��� pin.
• There is a new control signal called bus high enable 𝐵𝐵𝐵𝐵𝐵𝐵 ������ .
The address bit A0 or ������
𝐵𝐵𝐵𝐵𝐵𝐵 is also used differently.
A few other differences exist between the 8086/80186 and the
80286/80386SX. The 80286/80386SX contains a 24-bit address bus (A23–A0)
instead of the 20-bit address bus (A19–A0) of the 8086/80186. The
8086/80186 contain an 𝑀𝑀/𝐼𝐼𝐼𝐼 ��� signal, while the 80286 system and 80386SX
microprocessor contain control signals ��������� ��������� . instead of ����
𝑀𝑀𝑀𝑀𝑀𝑀𝑀𝑀 and 𝑀𝑀𝑀𝑀𝑀𝑀𝑀𝑀 𝑅𝑅𝑅𝑅 and
�����
𝑊𝑊𝑊𝑊 .
The 8086 and 80186 must be able to write data to any 16-bit location—or any
8-bit location. This means that the 16-bit data bus must be divided into two
separate sections (or banks) that are 8 bits wide so that the microprocessor
can write to either half (8-bit) or both halves (16-bit). For this purpose, 1MB
Page 71
COMPUTER ARCHITECTURE ELTR-314
memory is divided into two banks which are called even (low) bank and odd
(high) bank.
Fig. 3.5 (a) illustrates the two banks of the memory. One bank (low bank) holds
all the even-numbered memory locations, and the other bank (high bank)
holds all the odd-numbered memory locations. Fig. 3.5 (b) shows the
generation of separate 8086 write strobes for the memory.
Table 3.1
3.5 32 and 64-BIT MEMORY INTERFACE
i. 32-Bit Memory Interface
32-bit memory interface is used in 80386DX, and 80486 microprocessors.
These processors have 32-bit data bus and therefore 4 banks of memory are
required. The 80386DX/80486 contains a 32-bit address bus (A31–A0) which
can address 4GB memory.
32-bit, 16-bit and 8-bit transfers are accomplished by different combinations
of the bank selection signals, BE3, BE2, BE1, BE0.
To write 8-bit data on a memory location, any bank can be selected.
To write 16-bit data on a memory location, two banks are selected which can
be Bank0 and Bank1 or Bank2 and Bank3.
Page 72
COMPUTER ARCHITECTURE ELTR-314
Fig. 3.6
To write 32-bit data on a memory location, all banks are selected
simultaneously using decoder shown in fig. 3.7.
Fig. 3.7
ii. 64-BIT Memory Interface
64-bit memory interface is used in Pentium, Pentium Pro, Pentium-II, and
Pentium-III microprocessors. These processors have 64-bit data bus and
therefore 8 banks of memory are required. These processors contain a 32-bit
address bus (A31–A0) which can address 4GB memory.
Fig. 3.8
Page 73
COMPUTER ARCHITECTURE ELTR-314
Fig. 3.9
• To write 8-bit data on a memory location, any bank can be selected.
• To write 16-bit data on a memory location, two banks are selected
which can be Bank0 and Bank1, Bank2 and Bank3, Bank4 and Bank5 or
Bank6 and Bank7.
• To write 32-bit data on a memory location, four banks are selected
which can be Bank0, Bank1, Bank2 and Bank3 or Bank4, Bank5, Bank6
and Bank7.
• To write 64-bit data on a memory location, all banks are selected
simultaneously using following decoder. The write strobes are
���������
obtained by combining the bank enable signals (𝐵𝐵𝐵𝐵𝐵𝐵) with the 𝑀𝑀𝑀𝑀𝑀𝑀𝑀𝑀
��������� is generated by combining the 𝑀𝑀/𝐼𝐼𝐼𝐼
signal. 𝑀𝑀𝑀𝑀𝑀𝑀𝑀𝑀 ��� and 𝑊𝑊𝑊𝑊
����� signals.
Fig. 3.11
Page 74
COMPUTER ARCHITECTURE ELTR-314
In this type of cell, the transistor acts as a switch. Input and output buffers are
used for write and read operations. These buffers are controlled by 𝑅𝑅/𝑊𝑊 �
signal. A refreshing buffer is also used for refreshing the data. These buffers
are not shown in the cell for simplicity.
Write operation in DRAM Cell
A LOW on the 𝑅𝑅/𝑊𝑊 � line (WRITE mode) enables the tristate input buffer and
disables the output buffer. A HIGH on the row line is applied to close the
transistor. When a voltage is applied on the bit line, this will transfer to
capacitor and store in it. When the row line is taken back LOW, the transistor
turns off and disconnects the capacitor from the bit line.
Read operation in DRAM Cell
To read from the cell, the 𝑅𝑅/𝑊𝑊 � (Read/Write) line is HIGH, enabling the output
buffer and disabling the input buffer. When the row line is taken HIGH, the
transistor turns on and connects the capacitor to the bit line and thus to the
output buffer (sense amplifier), so the data bit appears on the data-output
line.
REFRESHING PROCESS
For refreshing the memory cell, the 𝑅𝑅/𝑊𝑊 � line is HIGH, the row line is HIGH,
and the refresh line is HIGH. The transistor turns on, connecting the capacitor
to the bit line. The output buffer is enabled, and the stored data bit is applied
to the input of the refresh buffer, which is enabled by the HIGH on the refresh
input. This produces a voltage on the bit line corresponding to the stored bit,
thus refreshing the capacitor.
3.7 INTRODUCTION TO I/O INTERFACE
Input Interface
Input interface is a circuit arrangement which is used to enter data to
microprocessor. In this circuit arrangement, tristate buffers are used.
The basic input device (to the microprocessor) is a set of tri-state buffers as
shown in figure. The data received by toggle switches is applied to the input
of tristate buffers (74ALS244 IC). The output of buffers is connected to the data
bus of microprocessor.
When processor executes IN instruction then,
I/O port address is decoded and �����
𝑆𝑆𝑆𝑆𝑆𝑆=0 is generated to select desired
port.
This generated signal is applied to controlling signals 1𝐺𝐺̅ and 2𝐺𝐺̅ of
tristate buffer 74ALS244.
Page 75
COMPUTER ARCHITECTURE ELTR-314
Due to this signal, tristate buffer IC is enabled and the data available at
the input terminals “A” is transferred to its output terminals “Y”. This
data is delivered to processor via data bus.
After reading data, a high signal is applied to the controlling signals 1𝐺𝐺̅
and 2𝐺𝐺̅ of tristate buffer 74ALS244.
Due to high signal, buffer IC is disabled and acts an open switch and
isolates inputs from data bus until it reselects again.
Fig. 3.12
OUTPUT INTERFACE
Output interface is a circuit arrangement which is used to receive data from
microprocessor. In this circuit arrangement, data latches are used.
Fig. 3.13
The basic output device (from the microprocessor) is a set of latches as shown
in figure. The data received from data bus is applied to the input of tristate
latches (74ALS374 IC). The output of latches is connected to the LED’s.
When processor executes OUT instruction then,
Page 76
COMPUTER ARCHITECTURE ELTR-314
�����=0 is generated to select desired
I/O port address is decoded and 𝑆𝑆𝑆𝑆𝑆𝑆
port.
This generated signal is applied to the CLK terminal of latches 74ALS374.
After receiving CLK signal, the data available at the input terminals “D0-
D7” is transferred to its output terminals “Q0-Q7”.
This data is delivered to LED’s and LED’s become ON or OFF according to
processor data.
When instruction OUT is executed, then data remains on the data bus for less
than 1 micro second. Thus, to receive this processor data at output, latches
are used so that it can be stored until new data is received.
3.9 8254 PROGRAMMABLE INTERVAL TIMER
A clock signal is used in every microprocessor to synchronize all
peripherals with computer. Usually, the frequency of this clock signal is very
high. Computer has some functions in which low frequency is required. 8254
is a programmable interval timer designed to solve the timing control
problems in a microprocessor.
It has three independent 16-bit down counters. These counters can be
programmed for either binary or BCD count. It can handle inputs from DC to
10 MHz. It operates in +5V regulated power supply and has 24 pin signals.
BLOCK DIAGRAM OF INTEL 8254
The fig. 3.14 shows the functional block diagram of 8254 Timer: It has
3 counters each with two inputs (Clock and Gate) and one output. Gate is used
to enable or disable counting. When any value of count is loaded and value of
gate is set (1), after every step value of count is decremented by 1 until it
becomes zero.
Fig. 3.14
Each counter is programmed by writing a control word, followed by the initial
count. The control word allows the programmer to select the counter, mode
Page 77
COMPUTER ARCHITECTURE ELTR-314
2. Mode 1 (Programmable One Shot) – OUT will be initially high. OUT will
go low on the CLK pulse following a trigger to begin the one-shot pulse,
and will remain low until the counter reaches zero.
Page 78
COMPUTER ARCHITECTURE ELTR-314
Fig. 3.15
Page 79
COMPUTER ARCHITECTURE ELTR-314
The device used to perform the job of conversion from serial to parallel and
parallel to serial is called USART or programmable communications interface
(PCI).
The Intel 8251A is the industry standard USART, designed for data
communications with Intel microprocessor families such as 8080, 85, 86 and
88. The 8251A converts the parallel data received from the processor on the
D7-D0 data pins into serial data, and transmits it on TxD (transmit data) output
pin of 8251A. Similarly, it converts the serial data received on RxD (receive
data) input into parallel data, and the processor reads it using the data pins
D7-D0.
Features
• Compatible with extended range of Intel microprocessors.
• It provides both synchronous and asynchronous data transmission.
• Synchronous and Asynchronous 5-8 bit characters.
• It has full duplex, double buffered transmitter and receiver.
• Detects the errors-parity, overrun and framing errors.
• All inputs and outputs are TTL compatible.
• Available in 28-pin DIP package.
Transmitter Section
The transmitter section accepts parallel data from microprocessor and
converts them into serial data. The transmitter section is double buffered; i.e.,
it has a buffer register to hold an 8-bit parallel data and another register called
output register to convert the parallel data into serial bits. When output
register is empty, the data is transferred from buffer to output register. Now
the processor can again load another data in buffer register.
Receiver Section
The receiver section accepts serial data and converts them into parallel data.
The receiver section is double buffered, i.e., it has an input register to receive
serial data and convert to parallel, and a buffer register to hold the parallel
data. When the RxD line goes low, the control logic assumes it as a START bit,
waits for half a bit time and samples the line again. If the line is still low, then
the input register accepts the following bits, forms a character and loads it into
the buffer register. The microprocessor reads the parallel data from the buffer
register.
3.11 ANALOG TO DIGITAL & DIGITAL TO ANALOG
CONVERTER
ANALOG TO DIGITAL CONVERTER
Page 80
COMPUTER ARCHITECTURE ELTR-314
Table 3.2
ADC0804
Fig. 3.16 shows the pin-out of the ADC0804 converter. The ADC080X requires
up to 100 μs to convert an analog input voltage into a digital output code.
Fig. 3.16
Page 81
COMPUTER ARCHITECTURE ELTR-314
The ADC0804 requires a clock source for operation. The clock can be an
external clock applied to the CLK IN pin or it can be generated with an RC
circuit. The range of clock frequencies is between 100 KHz to 1460 KHz. If the
clock is generated with an RC circuit, we use the CLK IN and CLK R pins
connected to an RC circuit. Frequency is calculated by the following equation:
f = 1/(1.1RC)
There are two analog inputs to the ADC0804: VIN (+) and VIN (-). Often the VIN (-)
pin is connected to ground and the VIN (+) pin is used as the analog input to be
converted to digital.
Input voltage pin used for the reference voltage is pin 9. If this pin is open, the
analog input voltage for the ADC is ranged from 0 to 5 volts. This is optional
input pin. It is used only when the input signal range is small.
Where the VCC is the reference voltage of DAC with n-bit resolution.
Fig. 3.17
DAC0830
Fig. 3.18 shows the pin-out of the DAC0830 converter. This device is an 8-bit
converter. It requires up to 1 μs to convert a digital input code to an analog
output voltage.
Fig. 3.18
This device has a set of eight data bus connections for the application of the
digital input code, and a pair of analog outputs labeled IOUT1 and IOUT2 that are
designed as inputs to an external operational amplifier.
Because this is an 8-bit converter, its output step voltage is +0.0196 V, if the
reference voltage is -5.0 V. If an input of (10010010)2 is applied to the device,
the output voltage will be the step voltage times (10010010)2, or, in this case,
+2.862 V.
The converter has a reference input pin (VREF) that establishes the full-scale
output voltage.
3.13 COMPUTER PERIPHERALS
3.13.1 INTRODUCTION TO COMPUTER PERIPHERALS
Peripheral devices are those devices that are attached either internally or
externally to a computer. These devices are commonly used to transfer data.
Peripherals are commonly divided into three kinds: input devices, output
devices, and storage devices.
Page 83
COMPUTER ARCHITECTURE ELTR-314
Page 84
COMPUTER ARCHITECTURE ELTR-314
plate, which in turn touches the metallic portion of the circuit plate. This
overall process of completing a circuit result in a circuit flow, allowing the
transfer of the message to the central processing unit (CPU), which is further
transmitted to the software.
Fig. 3.19
Merits: These are simple and cheap. Any faulty key switch is replaceable.
Demerits: These are large in size. After some time, carbon layer is composed
on contacts. During switch operation some power is consumed, so it cannot
be used in laptops. The mechanical action of the switch causes some vibration,
called bounce, which the processor filters out.
Capacitive Key Board
In this type of keyboard, an insulating material is placed between two metal
plates. One plate is fixed on printed circuit board where other plate is
moveable which is coated on a foam pad of a plunger as shown in fig 3.20.
Fig. 3.20
When key is pressed, moveable plate is also pressed. The distance between
plates decreases, as a result, capacitance increases. Microcontroller detects
this pressed key during scanning process and generates equivalent ASCII code.
Merits: These switches are simple, durable and low cost. There is no
mechanical contact, so there is no risk of getting damaged due to dust or
oxidation.
Demerits: These switches are not repairable. A circuitry is needed to sense the
change in capacitance.
Membrane Key Board
This is the type of mechanical keyboard. The key switch consists of three layers
of plastic or rubber as shown in fig. 3.21.
The upper and bottom layers have row and column contacts respectively.
Middle layer has a hole under the key.
Page 85
COMPUTER ARCHITECTURE ELTR-314
When a key is pressed, both upper and bottom layers make a connection
through the hole.
Fig. 3.21
3.13.2 VIDEO DISPLAY UNIT
A video display unit (VDU) is an output computer peripheral device. The VDU
displays the information send by computer in the form of text or graphics
(pictures) using cathode ray tube or liquid crystal display.
A VDU or Monitor basically consists of two sections.
Display section
Control section.
Fig. 3.22
Display section includes picture tube, high voltage circuit and scanning system.
Control section is a circuit on mother board of a computer which tells the
monitor how to draw a character or graphic on display. This is also called video
card or video adapter. There are five important types of video adapter based
on resolution and color support of display. The resolution tells how many
pixels the monitor can display across and down the screen. The higher the
resolution, the better the definition and the more expensive the monitor.
• MDA (Monochrome Display Adapter): It was designed by IBM for
black and white monitors. It could only display text. The adapter
designed by Hercules company (HGC) could display both text and
graphics. The resolution of both adapters was 720 × 350.
• CGA (Color Graphic Adapter): It was also design by IBM for color
monitors. It could display text in better quality but graphics resolution
was 640 × 200 in four colors.
• VGA (Video Graphics Adapter): It was designed by IBM and used with
PS/2 port. This card had 256KB onboard video memory. It was able to
display sixteen colors with 640 × 480 resolution.
Page 86
COMPUTER ARCHITECTURE ELTR-314
Fig. 3.23
There is a read/write head for both sides of each disk since data are recorded
on both sides of the disk surface.
Basic Read /Write Head Principles
The read and write heads are usually combined in a single unit. The magnetic
field produced by the write head according to the direction of a current pulse
in the winding magnetizes a small spot on the disk surface in the direction of
the magnetic field. A magnetized spot of one polarity represents a binary 1,
and one of the opposite polarities represents a binary 0.
When the magnetic surface passes a read head, the magnetized spots produce
magnetic fields in the read head, which induce voltage pulses in the winding.
Page 87
COMPUTER ARCHITECTURE ELTR-314
Page 88
COMPUTER ARCHITECTURE ELTR-314
Circuit board: A circuit board is located inside of mouse chasses, which is used
to transmit all mouse signal information, clicks, and other information. This
board accepts input in the form of electronic signals when a user gives any
instruction by clicking the mouse buttons, scrolling, etc.
Mouse wheel: Nowadays, computer mouses also include a wheel that is used
to scroll the document page up and down direction.
Cable/Wireless Receiver: The corded mouse has a cable with a plug that
connects to the computer. If the mouse is wireless, it requires a USB receiver
to get the wireless signal and input it into the computer.
Microprocessor: It is a processor that is embedded on the circuit board of the
mouse. All components of the mouse are not able to work without a
microprocessor, as it is the brain of the mouse.
TYPES OF MOUSE
There are two main kinds of mice and they do this job in two different ways,
either using a rolling rubber ball (in a ball-type mouse) or by bouncing a light
off your desk (in an optical mouse).
Mechanical Mouse: It is a type of computer mouse, also called a ball mouse.
It consists of a rubber or metal ball on its underside. The ball is touched with
the two wheels that contain holes on its surface and it is covered with infrared
pairs from two sides which contains sensors.
Fig. 3.26
As user moves the mouse, the ball moves the rollers that turn one or both of
the wheels. If mouse moves the straight up or down, only the y-axis wheel
turns; if you move to the right or left, only the x-axis wheel turns. And if you
move the mouse at an angle, the ball turns both wheels at once.
Whenever a wheel moves the LED light goes through the holes and the sensor
detects the movement of the mouse and through the IC it converts the signal
into digital form and sends it to the CPU.
Page 89
COMPUTER ARCHITECTURE ELTR-314
There are three PCB switches inside the mouse used for the left, right, and for
the scrolling.
Optical Mouse: To detect the movement, an optical mouse uses a light source
(LED or Laser), a photodetector (typically a CMOS sensor) and a digital signal
processor (DSP). First, the light source produces light that shines onto the
surface. The light is reflected back and picked up by the CMOS sensor forming
an image of the local surface. Thousands of images are taken every second by
the CMOS sensor and these images are sent to the DSP for analysis. The DSP
compares these images to determine whether the mouse has moved, in what
direction and at what speed. This information is then sent to the computer
(through wire or wireless receiver), which updates the position of cursor on
the screen accordingly.
Fig. 3.27
3.13.6 PLOTTER
A plotter is a computer hardware device similar to a printer that is used to
print vector graphics. Plotters use a pen, pencil, marker, or another writing
instrument to draw multiple, continuous lines on paper instead of a toner.
Multicolor plotters use different colored pens to draw different colors. Color
plots are made by using four pens cyan, magenta, yellow and black. Plotters
differ from printers in that plotters use continuous lines to create images while
printers use a collection of dots. Plotters are much slower than printers
because of the mechanical motion necessary to draw detailed graphics using
continuous lines.
Architects and product designers use plotters for technical drawings and
computer-aided design purposes since plotters have the ability to create large
images on oversized sheets of paper. Additionally, many garment and sign
Page 90
COMPUTER ARCHITECTURE ELTR-314
manufacturers use cutting plotters in which the plotter's pen is replaced with
a sharp razorblade.
Working of Plotters
There are two main types of plotter for printing: Flatbed Plotter and Drum
Plotter.
A flatbed plotter is a mechanical drafting device used with many CAD programs
for designers. Paper remains stationary on a flat surface while a pen moves
horizontally and vertically. This plotter can use many different pen colors to
create graphics. The size of the picture is limited by the size of the flatbed
plotter's surface.
Fig. 3.28
The Drum Plotter moves the pen up and down, and the drum rotates the paper
left and right. This enables drum plotters to have a smaller footprint than the
final paper size. In addition, plotters can use more than one pen, allowing
different colors to be drawn.
Fig. 3.29
Applications of Plotters
Computer Aided Design, architectural blueprint, building plan, line art, chart,
electric circuit layout, banners and billboards, geographic layout and textile
printing.
Page 91
COMPUTER ARCHITECTURE ELTR-314
Fig. 3.30
SCANNER
A scanner is an input device that reads and converts documents such as photos
and pages of text into a digital signal that can be viewed and edited on a
computer. Scanner uses light as an input source to convert an image into an
electronic form that can be stored on the computer. Scanner accepts the
source paper document, scans the document and translates it into an image
to be stored on the computer. The quality of scan increases with the increase
in resolution. There are three main types of a scanner. Flatbed, Sheet-fed and
Handheld scanner.
Working of flatbed scanner
A scanner consists of a flat transparent glass bed under which the CCD sensors,
lamp, lenses, filters and mirrors are fixed. The document has to be placed on
the glass bed.
The scanner head consists of the mirrors, lens, CCD sensors and also the filter.
A stepper motor under the scanner moves the scanner head from one end to
Page 92
COMPUTER ARCHITECTURE ELTR-314
the other in a constant path. The movement is controlled by a belt. When head
has reached the other end the scanning of the document has been completed.
As the scan head moves under the glass bed, the light from the lamp hits the
document and is reflected by a series of mirrors. In the end, the light passes
through the scanner lens and reaches the CCD sensors. The CCD sensors
convert the light to analog voltage according to its intensity. The analog
voltage is changed to digital values by an ADC and sent to the logic board and
transmitted back to the computer.
Fig. 3.31
Colour scanners have three light sources, one for each primary color—red,
green, blue.
Sheet-fed scanners are similar to flatbed scanners except the document is
moved and the scan head is immobile. A sheet-fed scanner looks a lot like a
small portable printer.
Handheld scanners use the same basic technology as a flatbed scanner, but
rely on the user to move them instead of a motorized belt. This type of scanner
typically does not provide good image quality. However, it can be useful for
quickly capturing text.
Page 93
COMPUTER ARCHITECTURE ELTR-314
EXERCISE
SECTION-I (MULTIPLE CHOICE QUESTIONS)
1. 8086 microprocessor uses ……….. memory interface.
(a) 32 bit (b) 8 bit (c) 16 bit (d) 64 bit
2. A0 signal is used to enable …………. bank of memory in 8086 interface.
(a) Lower (b) Higher (c) Both (d) None of these
3. The number of horizontal and vertical pixels on a display screen is called
(a) Accuracy (b) Precision (c) Resolution (d) None of these
4. In 8086 microprocessor, the high bank of memory is enabled by signal.
(a) A0 ����
(b) RD ������
(c) BHE (d) HOLD
5. Number of function keys in a computer keyboard
(a) 10 (b) 12 (c) 14 (d) 16
6. A DRAM needs special external circuits to retain data;
(a) Decoding (b) Storing (c) Refreshing (d) Addressing
7. Simultaneous converter is a type of converter;
(a) Serial to Parallel (b) Parallel to Serial
(c) Analog to Digital (d) Digital to Analog
8. An 8 bit DAC can generate ………. different levels.
(a) 128 (b) 256 (c) 512 (d) 1024
9. A 64 K bit memory can be organized as
(a) 64K × 1 (b) 8K × 8 (c) 16K × 4 (d) All of these
10. The data in ………. memory can be erased electrically.
(a) Flash (b) Floppy (c) CD (d) Hard Disk
11. 8251 is an IC of;
(a) UART (b) USART (c) ADC (d) DAC
12. 32-bit memory interface is used for;
(a) 80186 (b) 80188 (c) 80286 (d) 80486
ANSWER KEY
1. c 2. a 3. c 4. c
5. b 6. c 7. c 8. b
9. d 10. a 11. b 12. d
SECTION-II (SHORT QUESTIONS)
1. Define partial address decoding.
2. Define absolute address decoding.
3. Name two microprocessors, which use 8-bit memory interface.
4. What is the function of ������
𝐵𝐵𝐵𝐵𝐵𝐵 signal in 16-bit memory interface?
Page 94
COMPUTER ARCHITECTURE ELTR-314
Page 95
COMPUTER ARCHITECTURE ELTR-314
CHAPTER 04
INTERRUPTS
INTERRUPT
An interrupt is a signal from a device attached to a computer or from a
program within the computer that creates a temporary halt during program
execution and allows peripheral devices to access the microprocessor.
Whenever an interrupt occurs the processor completes the execution
of the current instruction and starts the execution of an Interrupt Service
Routine (ISR) or Interrupt Handler. ISR is a short program that tells the
processor what to do when the interrupt occurs. After the execution of ISR,
control returns back to the main routine where it was interrupted.
Fig. 4.1
• Interrupt flag and trap flag are reset to 0. This disables the INTR pin
and the trap or single-step feature.
• IP is loaded from the contents of word location (Interrupt type). CS is
loaded from the contents of next word location, so that the next
Page 96
COMPUTER ARCHITECTURE ELTR-314
Fig. 4.2
Page 97
COMPUTER ARCHITECTURE ELTR-314
Page 98
COMPUTER ARCHITECTURE ELTR-314
Fig. 4.3
It has an 8-bit of data bus. As we have already discussed that 8259 never
services the interrupt, it simply forwards the interrupts to the microprocessor.
Thus, the above architecture has different units that combinedly functions to
increase the interrupts handled by the processor. 8259 can be connected to
8085/8086 as shown in fig. 4.4.
Page 99
COMPUTER ARCHITECTURE ELTR-314
Fig. 4.4
EXERCISE
SECTION-I (MULTIPLE CHOICE QUESTIONS)
1. A signal sent to the processor that disturbs the current process is called;
(a) Acknowledge (b) Test (c) Interrupt (d) Ready
2. An interrupt that can be disable by the programmer is called;
(a) Maskable (b) Non maskable (c) Both a & b (d) None of these
3. An interrupt type which has lowest priority is;
(a) Divide Error (b) Single Step (c) NMI (d) INTR
4. 8259A programmable interrupt controller can control hardware interrupts.
(a) 8 (b) 10 (c) 12 (d) 14
5. In 8086 microprocessor the following has the highest priority among all
type interrupts.
(a) Type 255 (b) DIV 0 (c) NMI (d) Overflow
6. Which interrupt represents division by zero situation.
(a) Type 0 (b) Type 1 (c) Type 2 (d) Type 3
7. INTR is a …………… interrupt.
(a) Maskable (b) Non-Maskable (c) Software (d) None of these
8. Which IC is programmable interrupt controller?
(a) 8259 (b) 8031 (c) 8086 (d) 8051
9. An interrupt signal which is applied to pin of microprocessor is called;
(a) Software Interrupt (b) Hardware Interrupt
(c) Both a & b (d) None of these
10. INT 00 is a type of interrupt;
(a) Software (b) Hardware (c) NMI (d) All of these
11. An interrupt signal which is applied in the form of an instruction is called;
(a) Software Interrupt (b) Hardware Interrupt
(c) Both a & b (d) None of these
12. NMI is a/an interrupt;
(a) Level triggered (b) Edge triggered (c) Both a & b (d) None
Page 100
COMPUTER ARCHITECTURE ELTR-314
ANSWER KEY
1. c 2. a 3. d 4. a
5. c 6. a 7. b 8. a
9. b 10. a 11. a 12. b
SECTION-II (SHORT QUESTIONS)
1. Define partial address decoding. Define the term interrupt.
2. Define absolute address decoding. What is an interrupt vector?
3. Define hardware interrupt.
4. Define maskable Interrupt.
5. Define non-maskable Interrupt.
6. Write the function of signals INTR and �������
INTA.
7. Define software interrupt.
8. List five interrupt instructions for microprocessor.
9. What is the function of INTO instruction?
10. What is the function of INT3 instruction?
11. Define error interrupt.
12. What is meant by programmable interrupt controller?
13. What is meant by Interrupt Structure?
14. Enlist the various hardware interrupts of 8086.
15. How many software interrupts are available for 8086?
Page 101
COMPUTER ARCHITECTURE ELTR-314
CHAPTER 05
DIRECT MEMORY ACCESS
5.1 DIRECT MEMORY ACCESS
Direct memory access (DMA) is a method that allows an input/output (I/O)
device to send or receive data directly to or from the main memory, bypassing
the CPU to speed up memory operations.
We have two other methods of data transfer, programmed I/O and Interrupt
driven I/O.
In programmed I/O, the processor keeps on scanning whether any device is
ready for data transfer. If an I/O device is ready, the processor fully dedicates
itself in transferring the data between I/O and memory and can’t get involved
in any other activity during data transfer. This is the major drawback of
programmed I/O.
In Interrupt driven I/O, whenever the device is ready for data transfer, then it
raises an interrupt to processor. Processor completes executing its ongoing
instruction and saves its current state. It then switches to data transfer which
causes a delay. So, it is also not an effective way of data transfer.
The above two modes of data transfer are not useful for transferring a large
block of data. The DMA controller completes this task at a faster rate and is
also effective for transfer of large data block.
Page 102
COMPUTER ARCHITECTURE ELTR-314
In the idle cycle of the system, initially when the system gets on, then the
processor has control over the system buses, as the switch are connected with
the X position.
Whenever an I/O device needs to transfer the data to or from the memory, it
sends a request (DRQ) to DMA controller. On receiving data transfer request,
the controller sends HOLD request to the CPU and waits for HLDA which is hold
acknowledge by the CPU.
CPU receives the Hold request (HRQ) from DMA controller and leaves the
control over all the buses (i.e., data, control and address bus) and sends the
Hold acknowledgement (HLDA) to DMA controller.
Hence now the processor gets free from any data transfer operation until an
interrupt is generated by the DMA controller about the completion of the
transfer. The fig. 5.1 represents a system having a DMA controller:
Fig. 5.1
On receiving HLDA signal, the control over the buses is given to the DMA
controller as the switch position now changes from X to Y.
After receiving the Hold acknowledgement (HLDA), DMA controller
acknowledges I/O device (DACK) that the data transfer can be performed and
DMA controller takes the charge of the system bus and transfers the data to
or from memory.
When the data transfer is accomplished, the DMA controller generates an
interrupt by varying switch position from Y to again X. This indicates the
microprocessor about the completion of the data transfer operation and the
Page 103
COMPUTER ARCHITECTURE ELTR-314
processor can take control over the bus again and start processing where it
has left.
Advantages:
• Transferring the data without the involvement of the processor will
speed up the read-write task.
• DMA reduces the clock cycle requires to read or write a block of data.
• Implementing DMA also reduces the overhead of the processor.
Disadvantages:
• As it is a hardware unit, it would cost to implement a DMA controller
in the system.
• Cache coherence problem can occur while using DMA controller.
Fig. 5.2
There is only one processor that can interact with the memory of another
processor. The processor that is in control of the bus at the time implements
transfer operations. Any processor that needs to start a transfer should first
check the availability condition of the bus.
As all processors share a common bus, the system may display some transfer
conflicts. The incorporation of a bus controller that creates priorities among
the requesting units helps in resolving the transfer conflicts.
There is a restriction of one transfer at a time for a single common-bus system.
This means that other processors are busy with internal operations or remain
useless waiting for the bus when one processor is interacting with the
memory.
Page 104
COMPUTER ARCHITECTURE ELTR-314
The system processors are kept busy by the execution of multiple separate
buses, to allow multiple bus transfers simultaneously. The fig. 5.3 shows a
more economical execution of a dual bus structure for multiprocessors.
Fig. 5.3
In a multiprocessing and multitasking environment, each microprocessor
accesses two buses: the local bus and the remote or shared bus as shown
in fig. 5.3.
The local bus is the bus that is immediately available to the
microprocessor. The local bus contains the local memory and I/O. The local
memory and local I/O are accessed by the microprocessor that is directly
connected to them without any special protocol or access rules.
The remote (shared) bus contains memory and I/O that are accessed by
any microprocessor in the system. It is connected to all microprocessors
in the system. The shared bus is used to exchange data between
microprocessors in the system. A shared bus may contain memory and
I/O devices that are accessed by all microprocessors in the system. Access
to the shared bus is controlled by some form or arbiter that allows only a
single microprocessor to access the system's shared bus space.
Access to the shared bus for the remote bus master is accomplished via a
bus arbiter. The bus arbiter functions to resolve priority between bus
masters and allows only one device at a time to access the shared bus.
The 8086 and 8088 microprocessors use the 8289-bus arbiter. The 80286
uses the 82289-bus arbiter and the 80386/80486 use the 82389. The
Pentium and Pentium Pro directly support a multiuser environment.
Page 105
COMPUTER ARCHITECTURE ELTR-314
EXERCISE
SECTION-I (MULTIPLE CHOICE QUESTIONS)
1. Following two signals are used in DMA operation.
(a) INTR & INTA (b) HOLD & HLDA
(c) WAIT & READY (d) HOLD & INTA
2. Following is a DMA controller IC
(a) 8086 (b) 8051 (c) 8237 (d) 8255
3. In a DMA read operation the data is transferred
(a) from I/O to memory (b) from memory to I/O
(c) from memory to memory (d) from I/O to I/O
4. In a DMA write operation the data is transferred
(a) from I/O to memory (b) from memory to I/O
(c) from memory to memory (d) from I/O to I/O
5. Which method bypasses the microprocessor for data transfer?
(a) DMA (b) Interrupt (c) Handshaking (d) Polling
6. DMA stands for
(a) Data Memory Access (b) Data Memory Allocation
(c) Direct Memory Allocation (d) Direct Memory Access
7. Which microprocessor pin is used to acknowledge a DMA operation?
(a) READY (b) HOLD (c) HLDA (d) WAIT
8. Number of channels available in 8237 DMA controller
(a) 2 (b) 4 (c) 3 (d) 5
9. The pin of microprocessor is used to request DMA process.
(a) WR (b) RD (c) ALE (d) HOLD
10. The bus that is immediately available to the microprocessor is called
(a) Remote bus (b) Local bus (c) Shared bus (d) All of these
ANSWER KEY
1. b 2. c 3. b 4. a 5. a
6. d 7. c 8. b 9. d 10. b
SECTION-II (SHORT QUESTIONS)
1. Define Direct Memory Access operation.
2. Describe need of DMA operation.
3. Which two signals are used in DMA operation?
4. What is the advantage of DMA operation?
5. What is the effect on buses of microprocessor during DMA operation?
6. What is the function of current address register in DMA controller?
7. Define shared bus system.
Page 106
COMPUTER ARCHITECTURE ELTR-314
Page 107
COMPUTER ARCHITECTURE ELTR-314
CHAPTER 06
BUS INTERFACES
INTRODUCTION TO BUS INTERFACES
A computer bus is a common pathway through which information is
connected from one component to another. A computer bus is a set of parallel
conductors, which may be conventional wires, copper tracks on a Printed
Circuit Board, or microscopic aluminum trails on the surface of a silicon chip.
Types of Computer Bus
A modern-day computer system can be viewed as comprising just two types
of buses. These are the System Bus and the I/O Bus or Expansion Bus.
System Bus
The system bus or internal bus is a pathway composed of cables and
connectors used to carry data between a computer microprocessor and the
main memory. The bus combines the functions of a data bus to carry
information, an address bus to determine where it should be sent, and a
control bus to determine its operation.
I/O Bus or Expansion Bus
This is a bus made up of the electronic pathways that connect the different
external devices, such as a printer, storage, monitors, keyboard, mouse, etc.
Thus I/O bus connects various peripheral devices to the CPU – these are
connected to the system bus via a ‘bridge’ implemented in the processor’s
chipset.
Other names for the I/O bus include expansion bus, external bus or host bus.
An expansion bus typically comprises a series of slots on the motherboard into
which cards are inserted. The common expansion bus types include:
Expansion Bus Types
• ISA – Industry Standard Architecture
• EISA – Extended Industry Standard Architecture
• MCA – Micro Channel Architecture
• VESA – Video Electronics Standards Association
• PCI – Peripheral Component Interconnect
• PCMCIA – Personal Computer Memory Card Industry Association
• AGP – Accelerated Graphics Port
• SCSI – Small Computer Systems Interface.
Page 108
COMPUTER ARCHITECTURE ELTR-314
Fig. 6.1 Five 16-bit and one 8-bit ISA slots on a motherboard
Page 109
COMPUTER ARCHITECTURE ELTR-314
Fig. 6.2
EISA provided much better performance than the ISA equivalent. Apart from
being able to transfer 4 bytes of data simultaneously, it offers bus mastering;
a technology that placed a mini-processor on each expansion card. These mini-
processors controlled much of the transfer allowing the CPU to perform other
tasks.
Video Electronics Standards Association (VESA Bus)
It is also known as the Local bus or the VESA-Local bus. VESA was invented to
solve the problem of proprietary technology where different manufacturers
were attempting to develop their own buses. It was developed with the main
aim of providing enhanced video performance on computers. It was thus
aimed at standardizing PC’s video specifications.
Fig. 6.3 Seven ISA slots. Six are 16-bit ISA (longer – with middle black sections),
three additionally have a VLB slot (leftmost brown sections)
The VL Computer bus provided a 32-bit data path and run at 25 or 33MHZ. It
ran at the same clock frequency as the host CPU. But this became a problem
as processor speeds increased. The faster the peripherals are required to run,
the more expensive they are to manufacture.
It was difficult to implement the VL-Bus on newer chips such as the 486s and
the new Pentiums and so eventually the VL-Bus was superseded by PCI.
Page 110
COMPUTER ARCHITECTURE ELTR-314
Unlike VESA, PCI supports bus mastering i.e. the bus has some processing
capability and therefore the CPU spends less time processing data. Most PCI
cards are designed for 5V, but there are also 3V and dual-voltage cards. Keying
slots are used to differentiate 3V and 5V cards and slots to ensure that a 3V
card is not slotted into a 5V socket and vice versa.
Page 111
COMPUTER ARCHITECTURE ELTR-314
4 times the peak throughput of AGP 8X ports. Because its manufacturing cost
is that similar to that of the AGP port, the PCI Express bus will progressively
replace the former.
Fig. 6.5
A type B USB connector is square with slanted exterior corners. It is connected
to an upstream port that uses a removable cable such as a printer. The type B
connector also transmits data and supplies power.
Fig. 6.6
Page 112
COMPUTER ARCHITECTURE ELTR-314
The basic USB pinouts for the connectors Type-A & B are given in the table
below.
PIN COLOUR SIGNAL
1 Red V BUS (4.75 – 5.25 V)
2 White Data -
3 Green Data +
4 Black Ground
Today, newer connectors have replaced old ones, such as the Mini-USB (or
Mini-B), that has been abandoned in favor of the Micro-USB and USB-C cables.
Micro-USB cables are usually used for charging and data transfer between
smartphones, video game controllers, and some computer peripherals. Micro-
USB are being slowly replaced by type-C connectors, which are becoming the
new standard for Android smartphones and tablets.
Various USB Data Transfer Rates
USB 1.0
• Low speed: 1.5 Mbps (Megabits per second)
• Full speed: 12 Mbps (Megabits per second)
USB 2.0
• High Speed
• Throughput up to 60 MB per second (480 Mbits per second)
• Support battery charging
USB 3.0
• Very High Speed
• 10 times faster than USB 2.0
• Supports data rate up to 512 MB per second (4 Gbit per second)
• Uses two unidirectional data paths one to receive and the other to
transmit data
USB 3.1
• USB 3.1 Gen 1 supports speeds of up to 5Gbit/s,
• USB 3.1 Gen 2 supports speeds of up to 10Gbit/s.
Page 113
COMPUTER ARCHITECTURE ELTR-314
The AGP uses the main PC memory to hold 3D images. In effect, this
gives the AGP video card an unlimited amount of video memory. To speed up
the data transfer, Intel designed the port as a direct path to the PC’s main
memory. The data transfer rate ranges from 264 Mbps to 528mbpn, 800 Mbps
up to 1.5 Gbps.
EXERCISE
SECTION-I (MULTIPLE CHOICE QUESTIONS)
1. ISA bus supports ……… bits data.
(a) 8 (b) 16 (c) 24 (d) 32
2. PCI bus operates at;
(a) 8 MHz (b) 16 MHz (c) 33 MHz (d) 128 MHz
3. ISA bus operates at;
(a) 4 MHz (b) 8 MHz (c) 12 MHz (d) 16 MHz
4. The speed of USB 3.0 is approximately greater than USB 2.0.
(a) 3 times (b) 5 times (c) 10 times (d) 15 times
5. PCI bus supports bits data;
(a) 16 (b) 32 (c) 64 (d) Both b & c
6. Data transfer speed of USB 3.0 is
(a) 3200 Mbps (b) 4800 Mbps (c) 6800 Mbps (d) 7560 Mbps
7. ISA card is not used for
(a) EPROM (b) Flash (c) RAM (d) None of these
8. EISA bus is used in bit standard;
(a) 8 (b) 16 (c) 32 (d) All of these
ANSWER KEY
1. b 2. c 3. b 4. c
5. d 6. b 7. c 8. c
Page 114
COMPUTER ARCHITECTURE ELTR-314
Page 115
COMPUTER ARCHITECTURE ELTR-314
CHAPTER 07
THE PENTIUM MICROPROCESSORS
7.1 SUMMARY OF GROWTH FROM 808186 TO 80486.
The 80186 Microprocessor
The Intel 80186 was an improved version of the 8086 microprocessor and
introduced in 1982. 80186 is a 16-bit microprocessor with a 16-bit data bus
and a 20-bit address bus. It has a programmable peripheral device integrated
into the same package. The instruction set of the 80186 is a superset of the
instruction set of the 8086. The term super-set means that all of the 8086
instructions will execute properly on an 80186, but the 80186 has 10 new
instruction types. The 80188 variant, with an 8-bit external data bus was also
available.
• 16-bit Microprocessor
• 1MB Main Memory
• Initially 6 MHz Clock Frequency
The 80286 Microprocessor
The 80286 microprocessor (also a 16-bit architecture microprocessor) was
introduced in 1983, almost identical to the 8086 and 8088 except it addressed
a 16M byte memory system. The instruction set of the 80286 was also almost
identical to the 8086 and 8088 except for a few instructions. The clock speed
of the 80286 was increased, so it executed some instructions in as little as 250
ns (4.0 MIPs).
• 16-bit Microprocessor
• 16MB Main Memory
• 4.0 MIPS (250nS / 8MHz)
The 80386 Microprocessor
In 1986, Intel released the 80386 microprocessor. It was Intel's first practical
32-bit microprocessor that contained a 32-bit data bus and a 32-bit memory
address. Through these 32-bit buses, the 80386 addressed up to 4G bytes of
memory. The instruction set of the 80386 microprocessor was upward
compatible with the earlier 8086, 8088, and 80286 microprocessors.
• 32-bit Microprocessor
Page 116
COMPUTER ARCHITECTURE ELTR-314
Fig. 7.1
Page 117
COMPUTER ARCHITECTURE ELTR-314
Fig. 7.2
• 32-bit Microprocessor, 64-bit data bus and 36-bit address bus
• 64GB Main Memory
• Starts at 150MHz
• 16 KB L1 cache; 256 KB L2 cache
• Three Integer processors
THE PENTIUM-II MICROPROCESSOR
After the Pentium Pro processor, Pentium II was developed by Intel in 1997.
Pentium II is manufactured based on P6 micro-architecture and it is a sixth-
generation x86 compatible microprocessors. This processor core contains 7.5
million transistors and it is an improved version of the first P6-generation core
of the Pentium Pro. All features of the Pentium Pro have been incorporated
with Pentium II. This processor has a larger cache. As this processor can
operate at 2.8 V, the power consumption is reduced significantly. Pentium II
Page 118
COMPUTER ARCHITECTURE ELTR-314
Fig. 7.3
• 32-bit Microprocessor, 64-bit data bus and 36-bit address bus
• 64GB Main Memory
• Starts at 266MHz
• 32 KB L1 cache; 512 KB L2 cache
• Three Integer processors
THE PENTIUM-III MICROPROCESSOR
After the Pentium II, the next version of the Pentium processor is Pentium III.
This processor was developed by Intel in 1999. Pentium III is a sixth-generation
x86-compatible microprocessor and it was manufactured based on P6 micro-
architecture. This processor core contains 9.5 to 28 million transistors. All
features of the Pentium II have been added with Pentium III. This processor is
used for high-performance desktop computers and servers which can operate
Windows NT, Unix and Windows 98 operating systems. This processor is
Page 119
COMPUTER ARCHITECTURE ELTR-314
suitable for audio and video processing, image processing, and Internet and
multimedia applications. The new features of the Pentium III processor are
given below:
Pentium III can operate in multiple branch prediction algorithms. 70 new
instructions are added to the Pentium III for multimedia and advanced image
processing.
Pentium III has eight 64-bit Intel MMX registers and 57 MMX instructions for
multimedia applications.
It has an on-die 512 Kbyte L2 cache. This processor is available at operating
frequencies of 450 MHz to 1.4 GHz with 100 MHz to 133 MHz front side bus.
Pentium III can operate at 2.0 V to 1.45 V.
Fig. 7.4
• 32-bit Microprocessor, 64-bit data bus and 36-bit address bus
• 64GB Main Memory
• Starts at 800MHz
• 32 KB L1 cache; On-chip 256 KB L2 cache
• Three Integer processors
THE PENTIUM-IV MICROPROCESSOR
Pentium 4 processor is the seventh generation processor. This processor was
developed in 2000 by Intel. This processor core contains 42 million transistors.
Pentium 4 operates at 1.40 V to 1.25 V. Clock speed of Pentium 4 varies from
1.3 GHz to 3.8 GHz.
It supports faster system bus at 400 MHz to 1066 MHz with 3.2 GB/s of
bandwidth. Pentium 4 has 12 Kb L1 cache for code and 8 Kb for data. It has on-
die 512 Kb L2 cache.
The instruction set of Pentium 4 processor is compatible with x86 (i386), x86-
64, MMX, SSE, SSE2, and SSE3 instructions. These instructions include 128-bit
Page 120
COMPUTER ARCHITECTURE ELTR-314
Fig. 7.5
Following is a description of the new control bits and the new control register
CR4:
CD – Cache disable controls the internal cache. If CD = 1, the cache will not fill
with new data for cache misses, but it will continue to function for cache hits.
If CD = 0, misses will cause the cache to fill with new data.
NW – Not write-through selects the mode of operation for the data cache. If
NW = 1, the data cache is inhibited from cache write-through.
AM – Alignment mask enables alignment checking when set. Note that
alignment checking occurs only for protected mode operation when the user
is at privilege level 3.
WP – Write protect protects user level pages against supervisor level write
operations. When WP = l, the supervisor can write to user level segments.
Page 121
COMPUTER ARCHITECTURE ELTR-314
PAGING UNIT
The paging mechanism functions with 4K-byte memory pages or with a new
extension available to the Pentium with 4M-byte memory pages. The size of
the paging table structure can become large in a system that contains a large
memory.
Page 122
COMPUTER ARCHITECTURE ELTR-314
In the Pentium, with the new 4M-byte paging feature, this is dramatically
reduced to just a single page table.
The main difference between 4K paging and 4M paging is that in the 4M paging
scheme there is no page table entry in the linear address.
Fig. 7.6
In Figure, the leftmost 10-bits of the linear address select an entry in the page
directory (just as with 4K pages). Unlike 4K pages, there are no page tables;
instead, the page directory ad dresses a 4M-byte memory page.
MEMORY-MANAGEMENT MODE
The system memory-management mode (SMM) is on the same level as
protected mode, real mode, and virtual mode.
Access to the SMM is accomplished via a new external hardware interrupt
applied to the SMI pin on the Pentium. When the SMM interrupt is activated,
the processor begins executing system level software in an area of memory
called the system management RAM or SMRAM.
The SMI interrupt disables all other interrupts normally handled by user
applications and the operating system. A return from the SMM interrupt is
accomplished with a new instruction. RSM re turns from the memory-
management mode interrupt and returns to the interrupted program at the
point of the interruption.
Page 123
COMPUTER ARCHITECTURE ELTR-314
EXERCISE
SECTION-I (MULTIPLE CHOICE QUESTIONS)
1. The clock speed of 80386 microprocessor is ……….
(a) 12-33 MHz (b) 66 MHz (c) 80 MHz (d) 100 MHz
2. The cache memory of Pentium processor is
(a) 2 KB (b) 4 KB (c) 8 KB (d) 16 KB
3. 80386 microprocessor can address …………… memory.
(a) 1MB (b) 2MB (c) 2GB (d) 4GB
4. The data bus of Pentium-II processor is ……….. bits.
(a) 16 (b) 32 (c) 64 (d) 128
5. 80486 has two versions. One is 486DX and other is
(a) 486SX (b) 486PX (c) 486BX (d) 486NX
6. Memory management was first introduced in ………….. microprocessor
(a) 80186 (b) 80286 (c) 80386 (d) 80486
7. Pentium-II processor has main memory
(a) 16 GB (b) 32 GB (c) 64 GB (d) 128 GB
8. 80186 microprocessor was initially designed for;
(a) 6 MHz (b) 12 MHz (c) 32 MHz (d) 66 MHz
ANSWER KEY
1. a 2. d 3. d 4. c
5. a 6. b 7. c 8. a
Page 124
COMPUTER ARCHITECTURE ELTR-314
Page 125
COMPUTER ARCHITECTURE ELTR-314
CHAPTER 08
THE MICROCONTROLLER
8.1 SINGLE CHIP MICROPROCESSOR
A single chip that contains the processor (CPU), non-volatile memory (flash
memory or ROM) for the program, volatile memory (RAM) for processing the
data, a clock and an I/O control unit is called Microcontroller. Microcontroller
units (MCUs) are available in numerous sizes and architectures. The MCU was
actually the first "system-on-chip" (SoC) but that term was coined later when
more components were added.
Putting a CPU, ROM, RAM, and data input/output
circuitry into a single IC will make a single-chip
microprocessor. Single-chip microprocessors
come compact and cheap, but do not allow users
to choose built-in functions at their option. Single-
chip microprocessors are also known as
"Microcontroller Units (MCUs)," because they are
made of a single IC.
Types of Microcontrollers Fig. 8.1
Microcontrollers are divided into various categories based on memory,
architecture, bits and instruction sets. Following is the list of their types –
1. Based on Bit Configuration
• 8-bit microcontroller − This type of microcontroller is used to execute
arithmetic and logical operations like addition, subtraction,
multiplication division, etc. For example, Intel 8031 and 8051 are 8 bits
microcontroller.
• 16-bit microcontroller − This type of microcontroller is used to perform
arithmetic and logical operations where higher accuracy and
performance is required. For example, Intel 8096 is a 16-bit
microcontroller.
• 32-bit microcontroller − This type of microcontroller is generally used
in automatically controlled appliances like automatic operational
machines, medical appliances, etc.
Page 126
COMPUTER ARCHITECTURE ELTR-314
• CISC − CISC stands for complex instruction set computer. It allows the
user to insert a single instruction as an alternative to many simple
instructions.
• RISC − RISC stands for Reduced Instruction Set Computers. It reduces
the operational time by shortening the clock cycle per instruction.
COMPARISON OF MICROCONTROLLER & MICROPROCESSOR
A microcontroller differs from a microprocessor in many ways. The first and
most important difference is its functionality. In order the microprocessor may
be used, other components such as memory or components for data transfer
must be added to it. Even though the microprocessor is considered to be a
powerful computer machine, the weak point is that it is not adjusted to
communication to peripheral environment. Simply, in order to communicate
with peripheral environment, the microprocessor must use specialized circuits
added as external chips. It means in short that microprocessors are the pure
heart of the computers. The comparison of microprocessor and
microcontroller is presented as follows:
MICROPROCESSORS MICROCONTROLLERS
Microprocessor performs the Microcontroller can be considered as
function of a central processing unit a small computer which has a
(CPU) on to a single integrated processor and some other
circuit (IC). components.
Microprocessors are mainly used in Microcontrollers are used in
designing general purpose systems. automatically controlled devices.
Microprocessors are basic Microcontrollers are generally used
components of personal computers. in embedded systems.
Page 127
COMPUTER ARCHITECTURE ELTR-314
Page 128
COMPUTER ARCHITECTURE ELTR-314
Page 129
COMPUTER ARCHITECTURE ELTR-314
Fig. 8.2
The core elements of a microcontroller are:
The Processor (CPU) -- A processor responds to various instructions that direct
the microcontroller's function. This involves performing basic arithmetic, logic,
I/O and data transfer operations.
Memory -- A microcontroller's memory is used to store the data that the
processor receives and uses to respond to instructions. A microcontroller has
two main memory types:
Program memory, which stores long-term information about the instructions
that the CPU carries out. Program memory is non-volatile memory.
Data memory, which is required for temporary data storage while the
instructions are being executed. Data memory is volatile.
I/O peripherals -- The input and output devices are the interface for the
processor to the outside world. The input ports receive information and send
it to the processor. The processor receives that data and sends the necessary
instructions to output devices that execute tasks external to the
microcontroller.
The processor, memory and I/O peripherals are the defining elements of the
microprocessor, there are other elements that are frequently included. Other
supporting elements of a microcontroller include:
Page 130
COMPUTER ARCHITECTURE ELTR-314
Fig. 8.3
WORKING REGISTERS
The first 32 bytes from addresses 00H to 1FH are organized as four banks as
shown in the fig. 8.4. Each bank has eight registers R0 to R7. Each Register can
be addressed in two ways: either by name or by address.
Only one bank can be accessed at a time. To address the register by name, first
the corresponding Bank must be selected. In order to select the bank, we have
to use the RS0 and RS1 bits of the Program Status Word (PSW) Register. RS0
and RS1 are 3rd and 4th bits in the PSW Register.
Page 131
COMPUTER ARCHITECTURE ELTR-314
Fig. 8.4
The RS1 and RS0 is used like this to select the register banks –
RS1 RS0 Register Bank
0 0 Register Bank 0
0 1 Register Bank 1
1 0 Register Bank 2
1 1 Register Bank 3
When RESET pin is activated, RS0 and RS1 will be cleared (i.e., RS0=0 and
RS1=0). So Bank0 is selected.
BIT ADDRESSABLE REGISTERS
Bit addressable area can store or remove one bit of data as well as one byte
data. The 8051 has the next 16 bytes of the RAM i.e., from 20H to 2FH are bit
addressable memory locations. There are totally 128 bits that can be
addressed individually using 00H to 7FH or the entire byte can be addressed
as 20H to 2FH.
Fig. 8.5
Page 132
COMPUTER ARCHITECTURE ELTR-314
A bit addressable area of 16 bytes from byte addresses 20H to 2FH in internal
RAM as shown in fig. 8.5, forming a total of 128 addressable bits (i.e., 16-byte
location × 8 bits). Each bit can be accessed by its bit addresses from 00H to
7FH for the byte address location 20H to 2FH in RAM. For example 32H is the
bit 2 of the internal RAM location 26H.
GENERAL PURPOSE REGISTERS
The final 80 bytes of the internal RAM area from 30H to 7FH location are used
for general purpose data storage. It is addressable by bytes. The advantage of
using this memory location is that their data access is faster compared to off-
chip RAM.
Note: These lower 128 bytes of RAM can be addressed directly or indirectly.
Page 133
COMPUTER ARCHITECTURE ELTR-314
Page 134
COMPUTER ARCHITECTURE ELTR-314
Based on the operation they perform, all the instructions in the 8051
Microcontroller Instruction Set are divided into five groups. They are:
• Data Transfer Instructions
• Arithmetic Instructions
• Logical Instructions
• Boolean or Bit Manipulation Instructions
• Program Branching Instructions
We will now see about these instructions briefly.
Page 135
COMPUTER ARCHITECTURE ELTR-314
Mnemonic Description
MOV Move Data
MOVC Move Code
MOCX Move External Data
PUSH Move Data to Stack
POP Copy Data from Stack
XCH Exchange Data between two Registers
XCHD Exchange Lower Order Data between two Registers
ARITHMETIC INSTRUCTIONS
Using Arithmetic Instructions, you can perform addition, subtraction,
multiplication and division. The arithmetic instructions also include increment
by one, decrement by one and a special instruction called Decimal Adjust
Accumulator. The Mnemonics associated with the Arithmetic Instructions of
the 8051 Microcontroller Instruction Set are:
Mnemonic Description
ADD Addition without Carry
ADDC Addition with Carry
SUBB Subtract with Carry
INC Increment by 1
DEC Decrement by 1
MUL Multiply
DIV Divide
DA A Decimal Adjust the Accumulator (A Register)
The arithmetic instructions have no knowledge about the data format i.e.,
signed, unsigned, ASCII, BCD, etc. Also, the operations performed by the
arithmetic instructions affect flags like carry, overflow, zero, etc. in the PSW
Register.
LOGICAL INSTRUCTIONS
The next group of instructions are the Logical Instructions, which perform
logical operations like AND, OR, XOR, NOT, Rotate, Clear and Swap. Logical
Instruction are performed on Bytes of data on a bit-by-bit basis.
Mnemonics associated with Logical Instructions are as follows:
Mnemonic Description
ANL Logical AND
ORL Logical OR
Page 136
COMPUTER ARCHITECTURE ELTR-314
XRL Ex-OR
CLR Clear Register
CPL Complement the Register
RL Rotate a Byte to Left
RLC Rotate a Byte and Carry Bit to Left
RR Rotate a Byte to Right
RRC Rotate a Byte and Carry Bit to Right
SWAP Exchange lower and higher nibbles in a Byte
Page 137
COMPUTER ARCHITECTURE ELTR-314
All these instructions, except the NOP (No Operation) affect the Program
Counter (PC) in one way or other. Some of these instructions has decision
making capability before transferring control to other part of the program.
Page 138
COMPUTER ARCHITECTURE ELTR-314
Number of Timer 2 3 2
Interrupt Sources 6 8 6
Serial Port 1 1 1
Number of I/O Ports 32 32 32
EXERCISE
SECTION-I (MULTIPLE CHOICE QUESTIONS)
1. The microcontrollers are used in;
a. Computers, laptops, televisions
b. Printers, Refrigerators
c. Microwave Ovens
d. All of the above
2. The speed of the microcontrollers is;
a. High
b. Slow
c. Very High
d. Better
3. The 8-bit microcontrollers are used to execute;
a. Arithmetic operations only
b. Logical operations only
c. Both a and b
d. None of the above
4. ____________ is an example of 16 bit microcontroller
a. 8031 microcontroller
b. 8051 microcontroller
c. 8096 microcontroller
d. None of the above
5. The type of microcontroller is designed in such a way that they don’t
have a program memory on the chip is called as __________
a. External memory microcontroller
b. Embedded memory microcontroller
c. Both a and b
Page 139
COMPUTER ARCHITECTURE ELTR-314
Page 140
COMPUTER ARCHITECTURE ELTR-314
Page 141
COMPUTER ARCHITECTURE ELTR-314
Page 142