0% found this document useful (0 votes)
52 views158 pages

COA Module 1

The document outlines a course on Computer Organization and Architecture, focusing on topics such as the 8086 microprocessor, assembly language programming, memory organization, and I/O mechanisms. It covers the evolution of computers from vacuum tubes to fifth-generation AI-based systems, detailing the characteristics and components of each generation. Learners will gain knowledge on computer architecture, organization, and performance measures, enabling them to understand and implement various computer systems effectively.

Uploaded by

praptigandhi14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views158 pages

COA Module 1

The document outlines a course on Computer Organization and Architecture, focusing on topics such as the 8086 microprocessor, assembly language programming, memory organization, and I/O mechanisms. It covers the evolution of computers from vacuum tubes to fifth-generation AI-based systems, detailing the characteristics and components of each generation. Learners will gain knowledge on computer architecture, organization, and performance measures, enabling them to understand and implement various computer systems effectively.

Uploaded by

praptigandhi14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 158

Module 1

Computer Organization and


Architecture
By
Mrs Sudeshna Baliarsingh
Mrs Bhagyashree Ingle
Dept. of IT
Upon completion of the course, the learners will be able to:

1. Describe basic organization of computer and the architecture of 8086 microprocessor

and implement assembly language programming for 8086 microprocessors.

2. Describe control unit design methods and conceptualize instruction level parallelism.

3. Apply fundamentals of digital logic design to solve problem & perform various
arithmetic operations using various algorithms.

4. Describe concept of memory organization and explain the function of each element of a
memory hierarchy.

5. Explain different methods for computer I/O mechanism.

6. Describe the architecture of 8051 microcontroller and implement C language


programming for 8051 microcontrollers.
Overview of Computer Architecture & Organization (5hrs)
1. Introduction of Computer Organization and Architecture
2. Basic Organization of Computer
3. Block Level Description of the Functional Units
4. Evolution of Computers
5. Von Neumann Model
6. Performance Measure of Computer Architecture.
7. Architecture of 8086 Family
Prerequisite :Digital
8. Instruction Set Logic Design
9. Addressing Modes.
1.Introduction
1.Introduction
So Designing is the attribute of Architecture and utilisation happens
to be the attribute of organisation
Reading paper punched tapes
● Intel core i7
● Intel 4004
● Moushik
● 8085
Microprocessor
Introduction of

Computer Organization

and Architecture
Computer: A computer is a combination of hardware and software resources which
integrate together and provides various functionalities to the user.

Computer Architecture

• Computer Architecture is concerned with the structure and behavior of the


computer system as seen by the user.

• computer Architecture is a functional description of requirements and design


implementation for the various parts of a computer.

• It deals with the functional behavior of computer systems. It comes before the
computer organization while designing a computer.

• Computer architecture refers to the design of the internal workings of a computer


system, including the CPU, memory, and other hardware components.
Computer Architecture

• Computer Architecture refers to those attributes of a system that


have a direct impact on the logical execution of a program.

• Architecture is those attributes visible to the programmer ,


Instruction set, number of bits used for data representation, I/O
mechanisms, addressing techniques.
So Designing is the attribute of Architecture and utilisation happens
to be the attribute of organisation
S.
N Computer Architecture Computer Organization
o.

1. Architecture describes what the computer does. The Organization describes how it does it.

Computer Architecture deals with the functional


2. Computer Organization deals with a structural relationship.
behavior of computer systems.

In the above figure, it’s clear that it deals with In the above figure, it’s also clear that it deals with low-level
3.
high-level design issues. design issues.

4. Architecture indicates its hardware. Whereas Organization indicates its performance.

As a programmer, you can view architecture as a series


5. The implementation of the architecture is called organization.
of instructions, addressing modes, and registers.

For designing a computer, an organization is decided after its


6. For designing a computer, its architecture is fixed first.
architecture.

Computer Architecture is also called Instruction Set Computer Organization is frequently called
7.
Architecture (ISA). microarchitecture.
Computer Architecture comprises logical functions
Computer Organization consists of physical units like
8. such as instruction sets, registers, data types, and
circuit designs, peripherals, and adders.
addressing modes.

The different architectural categories found in our


computer systems are as follows: CPU organization is classified into three categories
based on the number of address fields:
1. Von-Neumann Architecture
9. 2. Harvard Architecture 1. Organization of a single Accumulator.
3. Instruction Set Architecture 2. Organization of general registers
4. Micro-architecture 3. Stack organization
5. System Design

10. It makes the computer’s hardware visible. It offers details on how well the computer performs.

Architecture coordinates the hardware and software Computer Organization handles the segments of the
11.
of the system. network in a system.

12. The software developer is aware of it. It escapes the software programmer’s detection.

Examples- Intel and AMD created the x86 Organizational qualities include hardware elements
processor. Sun Microsystems and others created the that are invisible to the programmer, such as interfacing
13.
SPARC processor. Apple, IBM, and Motorola created of computer and peripherals, memory technologies, and
the PowerPC. control signals.
Computer Architecture
Basic

Organization

of Computer
Block Level Description of the Functional Units

A computer is not a single unit but it consists of many


functional units:

• Input unit
• Central Processing Unit(ALU and Control Unit),
• Storage (Memory) Unit
• Output Unit
The CPU is the brain of the computer. Controls the
operation of the computer and performs its data processing
functions; often simply referred to as processor. The CPU is
made up of these main parts:
1.Instruction register − It holds the instruction to be
executed.
2.Decoder − It decodes (converts to machine level
language) the instruction and sends to the ALU
(Arithmetic Logic Unit).
3.ALU − It has necessary circuits to perform
arithmetic,logical, memory, register and program
sequencing operations.
4.Register − It holds intermediate results obtained during
program processing.
● Registers are used for holding such results rather than
RAM because accessing registers is almost 10 times
faster than accessing RAM.
Memory
Microprocessor has two types of memory
RAM − Random Access Memory is volatile memory that gets
erased when power is switched off. All data and instructions are
stored in RAM.

ROM − Read Only Memory is non-volatile memory whose data


remains intact even after power is switched off. Microprocessor
can read from it any time it wants but cannot write to it. It is pre
programmed with most essential data like booting sequence by the
manufacturer.

RAM is used for storage of data while ROM is used for storage of
programs especially to the start-up program that runs when the
microprocessor is powered on.
Input/output (I/O) devices

• I/O devices allow the computer to communicate with the


outside world.

• Input devices allow the user to enter data into the computer, such as a
keyboard, mouse, and scanner.

• Its aim is to supply data (Alphanumeric, image , audio, video, etc.) to


the computer for processing. The Input devices are keyboard, mouse,
scanner, mic, camera.
Output devices allow the computer to display information to the user,
such as a monitor and printer.

• I/O devices are connected to the computer through the system


bus.
Von Neumann Model
Von Neumann Model

Neumann architecture is a theoretical computer design based on the


concept of stored- program where
programs and data are stored in the same. memory.

The concept was designed by a


mathematician John Von Neumann in
1945 and currently serves as the
foundation of almost all modern
computers. Neumann machine consists of a central processor with an
arithmetic/logic unit and a control unit, a
memory, mass storage and input
and output.
Extra
In a Von Neumann architecture, instructions and data are
stored in a single memory system.

This memory is usually implemented as random access


memory(RAM) and is connected to the CPU and I/O devices
through a common bus.

The CPU executes instructions by fetching them from


memory, decoding them, and then executing them.

The Von Neumann architecture consists of four main


components:
CPU: The central processing unit is the brain of the computer. It performs
all the calculations and operations required to execute instructions.

Memory: The memory holds both instructions and data that the CPU needs
to execute. The memory is organized as a linear sequence of addressable
cells, each containing a fixed number of bits.

Input/output (I/O) devices: These devices are used to


communicate with the outside world. Examples include keyboards, displays,
and printers.

System bus: The system bus is a collection of wires that connect the CPU,
memory, and I/O devices. It is used to transmit data, instructions, and
control signals between these components.
Bus
Connection lines used to connect the internal parts of the
microprocessor chip is called bus.
There are three types of buses
Data Bus − Lines that carry data to and from memory are called data
bus. It is a bidirectional bus with width equal to word length of the
microprocessor.
Address Bus − It is a unidirectional responsible for carrying address
of a memory location or I/O port from CPU to memory or I/O port.
Control Bus − Lines that carry control signals like clock signals,
interrupt signal or ready signal are called control bus. They are
bidirectional. Signal that denotes that a device is ready for processing
is called ready signal. Signal that indicates to a device to interrupt its
process is called an interrupt signal.
Advantages Of Von Neumann Architecture
• The Von Neumann architecture has several advantages,including
simplicity, flexibility, and efficiency.
• Because instructions and data are stored in the same memory
system, the CPU can easily access both of them without having
to switch between different memory systems. This makes it
easier to write programs and reduces the complexity of the system
as a whole.
Disadvantages Of Von Neumann Architecture
• One of the main limitations is that the shared bus can become a
bottleneck if too many devices are connected to it. This can lead
to slow performance and reduced scalability.
• Additionally, the CPU can only execute one instruction at a time,
which can limit the overall speed of the system.
Computer System
Evolution of Computers
Basic Terms Related to Computers
The basic terms related to generations of computers are listed below.

Vacuum Tube: Vacuum tubes have the functionality of controlling the flow of
electronics in a vacuum. Generally, it is used in switches, amplifiers, radios,
televisions, etc.
Transistor: A transistor helps in controlling the flow of electricity in devices, it works
as an amplifier or a switch.
Integrated Circuit (IC): Integrated circuits are silicon chips that contain their circuit
elements like transistors, resistors, etc.

There was a time when a computer used to take up an entire room’s


space, and only a few of them existed in this world.
Evolution of Computers
Phases of Computer Generations
Before the generation of computers, we used calculators,
spreadsheets, and computer algebra systems,
mathematicians and inventors searched for solutions to ease
the burden of calculation.

Below are the 8 Mechanical Calculators before modern


computers were invented.
5. Comptometer (1887)
1. Abacus (ca. 2700 BC)
&Comptograph (1889)
2. Pascal’s Calculator (1652)
6.The Difference Engine
3. Stepped Reckoner (1694)
(1822)
4. Arithmometer (1820)
7.Analytical Engine (1834)
8.The Millionaire (1893)
First Generation Computers
The technology behind the primary generation computers was a fragile glass device,
which was called a vacuum tube. These computers were very heavy and really large.
These weren’t very reliable and programming on them was a tedious task as they used
low-level programming language and used no OS. First-generation computers were
used for calculation, storage, and control purpose. They were too bulky and large that
they needed a full room and consume a lot of electricity. Punch cards were used for
improving the information for external storage. Magnetic card used . Machine and
assembly language is developed.

Examples of some main first-generation computers are mentioned below.


● ENIAC: Electronic Numerical Integrator and Computer, general-purpose computer.
It had been cumbersome, and large, and contained 18,000 vacuum tubes.
● EDVAC: Electronic Discrete Variable Automatic Computer was designed by von
Neumann. It could store data also as instruction and thus the speed was enhanced.
● UNIVAC: Universal Automatic Computer was developed in 1952 .
Second Generation Computers
● Second-generation computers used the technology of transistors rather than bulky
vacuum tubes. Another feature was the core storage. A transistor may be a device
composed of semiconductor material that amplifies a sign or opens or closes a circuit.
● Transistors were invented in Bell Labs. The use of transistors made it possible to
perform powerfully and with due speed. It reduced the dimensions and price and
thankfully the warmth too, which was generated by vacuum tubes. Central Processing
Unit (CPU), memory, programming language, and input, and output units also came
into the force within the second generation.
● The programming language was shifted from high level to programming language
and made programming comparatively a simple task for programmers. Languages
used for programming during this era were FORTRAN (1956), ALGOL (1958), and
COBOL (1959).
Third Generation Computers

During the third generation, technology envisaged a shift from huge transistors to integrated
circuits, also referred to as IC. Here a variety of transistors were placed on silicon chips,
called semiconductors. The most feature of this era’s computer was speed and reliability. IC
was made from silicon and also called silicon chips.
The computer programs was designed to make the machine work. Operating system was a
program designed to handle a machine completely. Because of the operating system machine
could execute multiple jobs simultaneously. Integrated circuits were used to replace many
transistors used in the second generation.
A single IC has many transistors, registers, and capacitors built on one thin slice of
silicon. The value size was reduced and memory space and dealing efficiency were increased
during this generation. Programming was now wiped out Higher level languages like BASIC
(Beginners All-purpose Symbolic Instruction Code). Minicomputers find their shape during
this era.
Fourth Generation Computers
In 1971 First microprocessors were used, the large-scale
of integration LSI circuits built on one chip called
microprocessors. The advantage of this technology
is that one microprocessor can contain all the circuits
required to perform arithmetic, logic, and control functions
on one chip. LSI placed thousands of transistors onto
a single chip.

The computers using microchips were called microcomputers. This generation provided even smaller
size of computers, with larger capacities. That’s not enough, then Very Large Scale Integrated
(VLSI) circuits replaced LSI circuits. T

The Intel 4004 chip, developed in 1971, located all the components of the pc from the central
processing unit and memory to input/ output controls on one chip and allowed the dimensions to reduce
drastically. VLSI placed several hundred thousand transistors on a single silicon chip. This silicon chip is
known as the micro processor.

Technologies like multiprocessing, multiprogramming, time-sharing, operating speed, and virtual


memory made it a more user-friendly and customary device. The concept of private computers and
computer networks came into being within the fourth generation.
Fifth Generation Computers

The technology behind the fifth generation


of computers is AI. It allows computers to
behave like humans. It is often seen in programs like voice recognition, area of
medicine, and entertainment. The Ministry of International Trade and Industry
of Japan began developing the 5th Generation of Computer system in 1982.
The speed is the highest, size is the smallest and area of use has remarkably
increased within the fifth generation computers..
The technology of the fifth generation of computers are More potent, portable
computers ,Cheaper and more dependable and easier to create for the market.
The use of desktop computers is simple which are extremely productive mainframe
computers.
Characteristics of Fifth-Generation Computers
Characteristics Components

Based on artificial intelligence, uses the Ultra


Large-Scale Integration (ULSI) technology and
parallel processing method (ULSI has millions of
Main electronic component
transistors on a single microchip and the Parallel
processing method use two or more
microprocessors to run tasks simultaneously).

Language Understand natural language (human language).

Size Portable and small in size.

Trackpad (or touchpad), touchscreen, pen, speech


Input/output device input (recognize voice/speech), light scanner,
printer, keyboard, monitor, mouse, etc.

Example of the fifth generation Desktops, laptops, tablets, smartphones, etc.


Performance Measure of Computer
Architecture.
In computer organization, performance refers to the speed and efficiency at which a computer
system can execute tasks and process data. A high-performing computer system is one that can
perform tasks quickly and efficiently while minimizing the amount of time and resources required to
complete these tasks.

Performance of a computer depends on the constituent subsystems of the system including software.
Each of the subsystems can be measured and tuned for performance. Thus performance can be
measured for:

● CPU performance for Scientific application, Vector processing, Business application, etc –

Instructions per Second

● Graphics performance – Rendering - Pixels per second

● I/O Performance – Transactions Per Second

● Internet performance and more – bandwidth utilization in Mbps or Gbps


There are three metrics for any system performance measure and these are
● Performance or Response Time
● Execution Time
● Throughput.

Response time is the time from the start to completion of a task.


This also includes:

● Operating system overhead.


● Waiting for I/O and other processes
● Accessing disk and memory
● Time spent executing on the CPU or execution time.

Throughput is the total amount of work done in a given time. Or the measure
of work done in a unit of time.

CPU execution time is the total time a CPU spends computing on a given
task.
Total time taken for execution of a program = CPU Time + I/O Time + Others
(like Queuing time etc.)

Performance = 1/Execution Time

CPU Time in seconds (TCPU)=


=(Instruction Count (IP) X Cycle per Instruction(CPI)) X
Time/Cycle
Or
=N X CPI X Tclk
Example 1:

A program ABCD has 15000 instructions is executed on


a system whose clock frequency is 3.3Ghz and the
design facilitates average Cycles per instruction of 12.
Calculate the CPU time utilized to execute Program
ABCD.
Here, N = 1500, CPI = 12, Tclk = 1/3.3Ghz
Tclk = 1/3.3Ghz
= 1/(3.3 x 10^9)
= 0.3 x 10^-9

Therefore,
CPU Execution Time TCPU = N x CPI x Tclk
= 15000 x 12 x 0.3 x 10^-9 seconds
= 54000 x 10^-9 seconds
= 54 x 10^-6 seconds
= 54 micro seconds=54 μs
2
3
4
HW
There are several factors that can impact the performance of a
computer system, including:

Processor speed: The speed of the processor, measured in GHz (gigahertz),


determines how quickly the computer can execute instructions and process data.
Memory: The amount and speed of the memory, including RAM (random access
memory) and cache memory, can impact how quickly data can be accessed and
processed by the computer.
Storage: The speed and capacity of the storage devices, including hard drives and
solid-state drives (SSDs), can impact the speed at which data can be stored and
retrieved.
I/O devices: The speed and efficiency of input/output devices, such as keyboards,
mice, and displays, can impact the overall performance of the system.
Software optimization: The efficiency of the software running on the system,
including operating systems and applications, can impact how quickly tasks can be
completed.
How to Improve Performance?
To improve performance you can either:
● Decrease the CPI (clock cycles per instruction) by using new
Hardware.
● Decrease the clock time or Increase clock rate by reducing
propagation delays or by use pipelining.
● Decrease the number of required cycles or improve ISA or
Compiler.
Architecture of 8086 Family
Instruction Set
Addressing Modes.
Architecture of 8086
Features of 8086
1. It is a 16-bit Microprocessor (μp). It’s ALU, internal registers works with 16bit binaryword.
2. A 40 pin dual in line package.Have 29000Transistors.
3. 8086 has a 20 bit address bus can access up to 2^20= 1 MB memory locations. It
segments it into 16, 64kB segments.
4. 8086 has a 16bit data bus. It can read or write data to a memory/port either 16bits or 8 bit
at a time.
5. It can support up to 64K I/O ports.
6. It provides 14, 16 -bit registers.
7. Frequency range of 8086 is 6-10 MHz .(The Intel 8086 microprocessor operates at a
frequency of 5 MHz.)
8. It has multiplexed address and data bus AD0- AD15 and A16 – A19.
9. It requires single phase clock with 33% duty cycle to provide internal timing.
10. It can prefetch upto 6 instruction bytes from memory and queues them in order to
speedup instruction execution.
11. It requires +5V power supply.
12. 8086 is designed to operate in two modes, Minimum mode and Maximum mode.
13. Address ranges from 00000H to FFFFFH
Internal architecture of 8086
As shown in the below figure, the 8086 CPU is divided into two independent functional parts
1. Bus Interface Unit(BIU)
2. Execution Unit(EU)

1. The Bus Interface Unit (BIU):

It provides the interface of 8086 to external memory and I/O devices via the System Bus. It performs
various machine cycles such as memory read, I/O read, etc. to transfer data between memory and I/O
devices.
BIU performs the following functions are as follows:
● It generates the 20-bit physical address for memory access.
● It fetches instructions from the memory.
● It transfers data to and from the memory and I/O.
● Maintains the 6-byte pre-fetch instruction queue(supports pipelining).
BIU mainly contains the
1. 4 Segment registers,
2. the Instruction Pointer,
3. a pre-fetch queue,
4. and an Address Generation Circuit.
● The BIU sends out addresses, fetches instructions from memory, reads data from ports
and memory, and writes data to ports and memory. Or we can say it reads the operational
codes from memory and stores them in the instruction queue registers
● While the EU is decoding an instruction or executing an instruction, which does not
require use of the buses,the BIU fetches up to six instruction bytes.
● The BIU stores these pre-fetched bytes in a first-in-first-out register set called a queue.
● Except in the case of JMP and CALL instructions, where the queue must be dumped
and then reloaded Starting from a new address, this pre-fetch and queue scheme greatly
speeds up processing.
● Fetching the next instruction while the current instruction executes is called pipelining.
● BIU contains Instruction queue, Segment registers, Instruction pointer, and Address
adder.
● It provides a full 16 bit bidirectional data bus and 20 bit address bus. The bus interface
unit is responsible for performing all external bus operations.
● In simple words, the BIU handles all transfers of data and addresses on the buses for
the execution unit.
Segment Registers:
Most of the registers contain data/instruction offsets within 64 KB memory segment.
There are four different 64 KB segments for instructions, stack, data and extra
data. To specify where in 1 MB of processor memory these 4 segments are located
the processor uses four Segment registers.
There are 4 segment registers.
They are:
Code Segment Register(CS)
Data Segment Register(DS)
Extra Segment Register(ES)
Stack Segment Register(SS)

The 8086 architecture uses the concept of segmented memory. Since 8086 has 20
address lines A0 to A19 So maximum memory location are 220 i.e 1MB. This 1 Mb is
divided into 16 sections or segments each containing 64KB of memory . At one time we
can work with any 4 sections or segments each containing 64KB memory locations.
Physical address= segment address x 10H + offset address
The first is segment address, the segment registers contain 16-bit segment base addresses, related
to different segment.
The second part is the offset value in that segment.
Code segment register (CS): is used for addressing memory location in the code segment
of the memory, where the executable program is stored. Code segment (CS) is a 16- bit
register containing address of 64 KB segment with processor instructions. The
processor uses CS segment for all accesses to instructions referenced by instruction
pointer (IP) register.
Data segment register (DS): points to the data segment of the memory where the data is
stored. Data segment (DS) is a 16-bit register containing address of 64KB segment with
program data. By default, the processor assumes that all data referenced by general
registers (AX, BX, CX, DX) and index register (SI, DI) is located in the data segment. DS
register can be changed directly using POP and LDS instructions.
Extra Segment Register (ES) : also refers to a segment in the memory which is another
data segment in the memory. Extra segment (ES) used to hold the starting address of
Extra segment. Extra segment is provided for programs that need to access a second
data segment. Segment registers cannot be used in arithmetic operations.
Stack Segment Register (SS): is used for addressing stack segment of the memory. The
stack segment is that segment of memory which is used to store stack data. Stack
segment (SS) is a 16-bit register containing address of 64KB segment with program stack.
By default, the processor assumes that all data referenced by the stack pointer (SP)
and base pointer (BP) registers is located in the stack segment.
Instruction Pointer (IP):
● It is a 16-bit register. It holds offset of the next instructions in the Code
Segment.
● IP is incremented after every instruction byte is fetched.
● IP gets a new value whenever a branch instruction occurs.
● CS is multiplied by 10H to give the 20-bit physical address of the Code
Segment.
● The address of the next instruction is calculated by using the formula

PA= CS x 10H + IP.

Assume Cs=1000h

IP=2345h

PA= 1000 X 10h + 2345= 12345H


EXECUTION UNIT :
● The main parts are:

● Control Circuitry
● Instruction decoder
● ALU
EXECUTION UNIT :
● The Execution unit is responsible for decoding and executing all
instructions.
● The EU extracts instructions from the top of the queue in the BIU, decodes
them, generates operands if necessary, passes them to the BIU and requests
it to perform the read or write cycles to memory or I/O and perform the
operation specified by the instruction on the operands.
● During the execution of the instruction, the EU tests the status and control
flags and updates them based on the results of executing the instruction.
● If the queue is empty, the EU waits for the next instruction byte to be
fetched and shifted to top of the queue.
● When the EU executes a branch or jump instruction, it transfers control to a
location corresponding to another set of sequential instructions. Whenever this
happens, the BIU automatically resets the queue and then begins to fetch
instructions from this new location to refill the queue.
EXECUTION UNIT :

● The execution unit of the 8086 tells the BIU where to fetch instructions or
data from, decodes instructions,and executes instructions.
● The EU contains control circuitry, which directs internal operations.
● The EU has a 16-bit arithmetic logic unit (ALU) which can add, subtract,
AND, OR, XOR, increment, decrement,complement or shift binary
numbers.
Steps
● EU extracts instructions from top of queue in BIU
● Decode the instructions
● Generates operands if necessary
● Passes operands to BIU & requests it to perform read or write bus cycles to
memory or I/O
● Perform the operation specified by the instruction on operands
Register Organization:
The 8086 microprocessor has a total of fourteen registers that are accessible to the
programmer. All of them are 16-bit registers. It is divided into two groups. They are:

1. General purpose registers:


These registers can be used as either 8-bit registers or 16-bit registers.
They may be either used for holding data, variables and intermediate results temporarily or for
other purposes like a counter or for storing offset address for some particular addressing
modes etc.
2. Special purpose registers:
These registers are used as segment registers, pointers, index registers or as offset storage
registers for particular addressing modes.
The 8086 registers are classified into the following types:

1. General Purpose Registers


2. Segment Registers
3. Pointers and Index Registers
4. Flag Register
Register Organization:
1. General Purpose Registers
1.General Purpose Registers

● The registers AX, BX, CX and DX are the general purpose 16-bit registers.
● AX is used as 16-bit accumulator. The lower 8-bit is designated as AL and
higher 8-bit is designated as AH.
● AL can be used as an 8-bit accumulator for 8-bit operation.
● All data register can be used as either 16 bit or 8 bit. BX is a 16 bit register, but
BL indicates the lower 8-bit of BX and BH indicates the higher 8-bit of BX.
● The register BX is used as offset storage for forming physical address in
case of certain addressing modes.
● The register CX is used default counter in case of string and loop
instructions.
● DX register is a general purpose register which may be used as an implicit
operand or destination in case of a few instructions.
General Purpose Registers
Accumulator register consists of two 8-bit registers AL and AH, which can be combined
together and used as a 16-bit register AX. AL in this case contains the low order byte of the
word, and AH contains the high-order byte. Accumulator can be used for I/O operations
and string manipulation.
Base register consists of two 8-bit registers BL and BH, which can be combined together
and used as a 16-bit register BX. BL in this case contains the low-order byte of the word, and
BH contains the high-order byte. BX register usually contains a data pointer used for
based, based indexed or register indirect addressing.
Count register consists of two 8-bit registers CL and CH, which can be combined together
and used as a 16-bit register CX. When combined, CL register contains the low order byte of
the word, and CH contains the high-order byte. Count register can be used in Loop,
shift/rotate instructions and as a counter in string manipulation
Data register consists of two 8-bit registers DL and DH, which can be combined together
and used as a 16-bit register DX. When combined, DL register contains the low order byte of
the word, and DH contains the high-order byte. Data register can be used as a port number
in I/O operations.
AX= 1234H here 12 is the higher Byte 34 is the lower byte

MOV CL, 34H


MOV CH, 12H

MOV CX, 1234H

MOV BL,CL
MOV BH,CH

MOV BX,CX
Program To ADD

MOV BL,04H
MOV CL,05H
ADD BL, CL

MOV BL,04H
ADD BL,05H
Pointers and Index Registers:
The index and pointer registers are given below:
IP—Instruction pointer-store memory location of next instruction to be executed
BP—Base pointer
SP—Stack pointer
SI—Source index
DI—Destination index

Stack Pointer (SP) is a 16-bit register pointing to program stack, i.e. it is used to hold the address of the top of
stack. The stack is maintained as a LIFO with its bottom at the start of the stack segment (specified by the
SS segment register).Unlike the SP register, the BP can be used to specify the offset of other program
segments.
Base Pointer (BP) is a 16-bit register pointing to data in stack segment. It is usually used by subroutines to
locate variables that were passed on the stack by a calling program. BP register is usually used for based,
based indexed or register indirect addressing.
Source Index (SI) is a 16-bit register. SI is used for indexed, based indexed and register indirect
addressing, as well as a source data address in string manipulation instructions. Used in conjunction with
the DS register to point to data locations in the data segment.
Destination Index (DI) is a 16-bit register. Used in conjunction with the ES register in string operations. DI is
used for indexed, based indexed and register indirect addressing, as well as a destination data address in
string manipulation instructions. In short, Destination Index and SI Source Index registers are used to hold
address.
OPERAND Registers
It is a temporary Register which is not available to the
programmer.
It is used by the processor to store temporary values
Every processor hs temporary register used by only processor

Example:

XCHG BX,CX
Flag Register
Flag Register contains a group of status bits called flags that indicate the status of the
CPU or the result of arithmetic operations. There are two types of flags:

1. The status flags which reflect the result of executing an instruction. The
programmer cannot set/reset these flags directly.
2. The control flags enable or disable certain CPU operations. The programmer can
set/reset these bits to control the CPU's operation.

Nine individual bits of the status register are used as control flags (3 of them) and
status flags (6 of them).The remaining 7 are not used.

A flag can only take on the values 0 and 1. We say a flag is set if it has the value 1.

The status flags are used to record specific characteristics of arithmetic and of
logical instructions.
Flag Register
Flag Register
Pin Diagram of 8086 Microprocessor

Extra
Instruction Set
Why study instruction set?

► Study of instruction set is required to write instructions in machine code


that can be recognized and executed by a central processing unit.

► The knowledge will help you write lines of code or program by which you
will be able to tell the processor, the sequence of operations to be
performed.

What are we going to study?


Instruction Set
► Different types of instructions with examples
► How to use instructions in assembly language programming
Instruction Set
8086 Instruction Set
The Intel 8086 is a 16-bit microprocessor that was introduced in 1978. It is the
first processor of the x86 family. The instruction set architecture of the 8086 CPU
consists of instructions that a processor can execute. The 8086 instruction set is
characterized by its versatility and efficiency, allowing programmers to write
code for a wide range of applications. Instructions are encoded in binary
format and organized into different categories based on their functionality.
These instructions encompass various operations, including data movement,
arithmetic and logic operations, control flow instructions, and input/output
operations.
Below is an overview of the 8086 instruction set.
Instruction Set
There will be transfer of data from source to destination.
MOV Destination, Source
⚫ Source can be register, memory location or immediate data.
⚫ Destination can be register or memory operand.
⚫ Both Source and Destination cannot be memory location or segment registers at the same time.
Pushing operation decrements stack
pointer stack pointer.
⚫ Stack pointer is a 16-bit register,
contains the address of the data item
currently on top of the stack.

Popping operation increments stack


pointer stack pointer.
0002 is in
square
bracket
so its a
memory
5AF0 & 00F0=00F0
Since instruction is SHR AL, 2 i.e. 2 times shift . so ans is :
MOV BL,05
SHL ,BL,1 Logical left shift
JMP Instruction (Jump)
Branching of instructions refer to the act of switching execution to a different
instruction sequence.
1. Unconditional : Transfers the program sequence to the described memory
address.

2. Conditional: Transfers the program sequence to the described memory


address only if the condition in satisfied.
Ports are buffer.
DX is the only register is allowed to carry
port address.

IN AX, DX
Process Control Instructions

● Process Control Instructions are used to control the order execution in a


program and in processes. They comprise of instruction for branching, looping,
and calling functions or subroutines.
● In other words, the instruction set changes the sequence of instruction executing,
therefore, it allows to change the program flow. Include commands for
conditional jump, unconditional jump, subroutine calls among others.
Process Control Instructions
Addressing Modes
of 8086

You might also like