Mic Unit 1. Self
Mic Unit 1. Self
Mic Unit 1. Self
An address line usually refers to a physical connection between a CPU and memory. It specifies
which address to access in the memory. For an 'n' bit address line, we can access 2 n memory
locations.
The control bus manages the communication between the computer's CPU and its other
components. It specializes in transferring control signals that coordinate and regulate the
hardware's actions. The signals ensure operations are carried out in the correct sequence and at
the right time
]
3. The 8086 is a 16-bit microprocessor:
The term “16-bit” means that its arithmetic logic unit, internal registers and most of its
instructions are designed to work with 16-bit binary words.
4. The 8086 provides fourteen 16-bit registers.
What is a register in microprocessor?
A processor register (CPU register) is one of a small set of data holding places that are part of
the computer processor. A register may hold an instruction, a storage address, or any kind of
data
5. The 8086 has multiplexed address and data bus which reduces the number of pins needed, but
does slow down the transfer of data (drawback).
6. The Features of 8086 Microprocessor is possible to perform bit, byte, and word in 8086. It
performs the arithmetic and logical operations on bit, byte, word and decimal numbers
including multiply and divide.
7. The Intel 8086 is designed to operate in two modes, namely the minimum mode and the
maximum mode. When only one 8086 CPU is to be used in a microcomputer system, the 8086
is used in the minimum mode of operation. In this mode the CPU issues the control signals
required by memory and I/O. In multiprocessor (more than one processor in the system) system
8086 operates in maximum mode. In maximum mode, control signals are generated with the
help of external bus controller (8288).
8. The Intel 8086 supports multiprogramming. In multiprogramming, the code for two or more
processes is in memory at the same time and is executed in a time-multiplexed fashion.
9. An interesting feature of the 8086 is that it fetches up to six instruction bytes (4 instruction
bytes for 8088) from memory and queue stores them in order to speed up instruction execution.
10. The Features of 8086 Microprocessor provides powerful instruction set[An instruction set is a group of
commands for a central processing unit (CPU) in machine language. ] with the following addressing modes:
Register, immediate, direct, indirect through an index or base, indirect through the sum of a
base and an index register, relative and implied
S2, S1, S0: Status pins. These pins are active during T4, T1 and T2 states and is returned to passive state 1,1,1 during
T3 or Tw (when ready is inactive). These are used by the 8288 bus controller for generating all the memory and I/O
operation) access control signals. Any change in S2, S1, S0 during T4 indicates the beginning of a bus cycle.
S2 S1 S0 Characteristics
0 0 0 Interrupt acknowledge
0 1 1 Halt
1 0 0 Code access
1 0 1 Read memory
1 1 0 Write memory
1 1 1 Passive state
A16/S3, A17/S4, A18/S5, A19/S6 : The specified address lines are multiplexed with corresponding status signals.
BHE’/S7: Bus High Enable/Status. During T1 it is low. It is used to enable data onto the most significant half of data
bus, D8-D15. 8-bit device connected to upper half of the data bus use BHE (Active Low) signal. It is multiplexed with
status signal S7. S7 signal is available during T2, T3 and T4.
RD’: This is used for read operation. It is an output signal. It is active when low.
READY: This is the acknowledgement from the memory or slow device that they have completed the data transfer.
The signal made available by the devices is synchronized by the 8284A clock generator to provide ready input to the
microprocessor. The signal is active high (1).
INTR : Interrupt Request. This is triggered input. This is sampled during the last clock cycles of each instruction for
determining the availability of the request. If any interrupt request is found pending, the processor enters the interrupt
acknowledge cycle. This signal is active high(1).
NMI : Non maskable interrupt. This is an edge triggered input which results in a type II interrupt. NMI is non-
maskable internally by software. A transition made from low(0) to high(1) initiates the interrupt at the end of the
current instruction. This input has been synchronized internally.
MN/MX’ : Minimum/Maximum. This pin signal indicates what mode the processor will operate in.
RQ’/GT1′, RQ’/GT0′ : Request/Grant. These are bidirectional pins. These pins are used by local bus masters used
to force the microprocessor to release the local bus at the end of the microprocessor’s current bus cycle. RQ’/GT0′
have higher priority than RQ’/GT1′.
LOCK’: Its an active low pin. It indicates that other system bus masters have not been allowed to gain control of the
system bus while LOCK’ is active low (0). The LOCK signal will be active until the completion of the next
instruction.
TEST’ : This examined by a ‘WAIT’ instruction. If the TEST pin goes low(0), execution will continue, else the
processor remains in an idle state.
CLK : Clock Input. The clock input provides the basic timing for processing operation and bus control activity.
RESET : This pin requires the microprocessor to terminate its present activity immediately. The signal must be active
high(1) for at least four clock cycles.
GND : Ground
QS1,QS0 : Queue Status. These signals indicate the status of the internal 8086 instruction queue according to the table
shown below:
QS1 QS0 Status
0 0 No operation
M/IO’: This signal is used to distinguish between memory and I/O operations. The M Signal is Active high whereas
the IO’ Signal is Active Low. When this Pin is High, the memory operations take place. On the other hand, when the
Pin is low, the Input/output operations takes place.
DT/R: Data Transmit/Receive. This pin is required in minimum systems that want to use an 8286 or 8287 data bus
transceiver.( A transceiver is a bidirectional buffer ( is a region of a memory used to store data temporarily while
it is being moved from one place to another.). With a transceiver, a microprocessor can receive data from an I/O
device or can send data out to an I/O device over the same set of common lines (data bus).) The direction of data
flow is controlled through the transceiver.
DEN: Data enable. This pin is provided as an output enable for the 8286/8287 in a minimum system which uses
transceiver. DEN is active low(0) during each memory and input-output access and for INTA cycles.
HOLD/HLDA: HOLD indicates that another master has been requesting a local bus .This is an active high(1). The
microprocessor receiving the HOLD request will issue HLDA (high) as an acknowledgement in the middle of a T4 or
T1 clock cycle.
ALE : Address Latch Enable. (latch: flip-flop used to remember digital data. Used to interface the output of
microprocessor to other device )ALE is provided by the microprocessor to latch the address into the 8282 or 8283
address latch. It is an active high(1) pulse during T1 of any bus cycle. ALE signal is never floated, is always integer.
Architecture of 8086
The general-purpose registers can be used to store data and perform arithmetic and logical
operations, while the segment registers are used to address memory segments.
The special registers include the flags register, which stores status information about the result of
the previous operation, and the instruction pointer (IP), which points to the next instruction to be
executed.
general-purpose registers =🡺 store data and perform arithmetic and logical operations
segment registers==🡺 address memory segments.
special registers =🡺 stores status information about the result of the previous operation
instruction pointer (IP) =🡺 points to the next instruction to be executed.
it has no memory or peripherals.
8086 does not have a RAM or ROM inside it.
However, it has internal registers for storing intermediate and final results and interfaces with
memory located outside it through the System Bus.
The main advantage of the 8086 microprocessor is that it supports Pipelining.
Memory segmentation:
● In order to increase execution speed and fetching speed, 8086 segments the memory.
● Its 20-bit address bus can address 1MB of memory;
● 8086 works only with four 64KB segments within the whole 1MB memory.
The internal architecture of Intel 8086 is divided into 2 units: The Bus Interface Unit (BIU),
and The Execution Unit (EU). These are explained as following below.
It provides the interface of 8086 to external memory and I/O devices via the System Bus (The system
bus can be viewed as an internal transportation system for the computer. The system bus carries address, data and control information. It is
). It performs various
comprised of three types of buses to do this function, the Address Bus, the Data Bus, and Control Bus.
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 4 Segment registers, the Instruction Pointer, a pre-fetch queue, and
an Address Generation Circuit.
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 CS x 10H + IP
Code Segment register: (16 Bit register): CS holds the base address for the Code Segment. All
programs are stored in the Code Segment and accessed via the IP.
Data Segment register: (16 Bit register): DS holds the base address for the Data Segment.
Stack Segment register: (16 Bit register): SS holds the base address for the Stack Segment.
Extra Segment register: (16 Bit register): ES holds the base address for the Extra Segment.
The main components of the EU are General purpose registers, the ALU, Special purpose registers,
the Instruction Register and Instruction Decoder, and the Flag/Status Register.
1. Fetches instructions from the Queue in BIU, decodes, and executes arithmetic and logic
operations using the ALU.
2. Sends control signals for internal data transfer operations within the microprocessor.(Control
Unit)
3. Sends request signals to the BIU to access the external module.
4. It operates with respect to T-states (clock cycles) and not machine cycles.
8086 has four 16-bit general purpose registers AX, BX, CX, and DX which store intermediate
values during execution. Each of these has two 8-bit parts (higher and lower).
● AX register: (Combination of AL and AH Registers)
It holds operands and results during multiplication and division operations. Also an
accumulator during String operations.
Arithmetic Logic Unit (16-bit): Performs 8 and 16-bit arithmetic and logic operations.
Special purpose registers (16-bit): Special purpose registers are called Offset registers also.
Which points to specific memory locations under each segment.
● Stack Pointer: Points to Stack top. Stack is in Stack Segment, used during instructions
like PUSH, POP, CALL, RET etc.
● Base Pointer: BP can hold the offset addresses of any location in the stack segment. It is
used to access random locations of the stack.
● Source Index: It holds offset address in Data Segment during string operations.
● Destination Index: It holds offset address in Extra Segment during string operations.
Flag/Status register (16 bits): It has 9 flags that help change or recognize the state of the
microprocessor.
6 Status flags:
1. Carry flag(CF)
2. Parity flag(PF)
3. Auxiliary carry flag(AF)
4. Zero flag(Z)
5. Sign flag(S)
6. Overflow flag (O)
Status flags are updated after every arithmetic and logic operation.
3 Control flags:
1. Trap flag(TF)
2. Interrupt flag(IF)
3. Direction flag(DF)
These flags can be set or reset using control instructions like CLC, STC, CLD, STD, CLI, STI,
etc. The Control flags are used to control certain operations.
Control unit :The Control Unit in the 8086 microprocessor is a component that manages the
overall operation of the microprocessor. The control unit is responsible for controlling the flow of
instructions through the microprocessor and coordinating the activities of the other components,
including the Decode Unit, Execution Unit, and Prefetch Unit.
The Control Unit acts as the central coordinator for the microprocessor, directing the flow of data
and instructions and ensuring that the microprocessor operates correctly. It also monitors the state
of the microprocessor, ensuring that the correct sequence of operations is followed.
In the 8086 Microprocessor, the registers are categorized into mainly four types:
IP
CS
DS
SS
ES
AH 8 AL
BH 8 BL
CH 8 CL
DH 8 DL
SP
BP
SI
DI
Flag
i. AX = [AH:AL]
ii. BX = [BH:BL]
iii. CX = [CH:CL]
iv. DX = [DH:DL]
2) Segment Registers
There are 4 segment registers in 8086 Microprocessor and each of them is of 16 bit. The code and
instructions are stored inside these different segments.
1. Code Segment (CS) Register: is used for addressing memory location in the code
segment of the memory, where the executable program is stored.
The user cannot modify the content of these registers. Only the microprocessor's compiler
can do this.
2. Data Segment (DS) Register: points to the data segment of the memory where the data is
stored.
The user can modify the content of the data segment.
3. Stack Segment (SS) Registers: is used for addressing stack segment of the memory.
The SS is used to store the information about the memory segment. The operations of the SS
are mainly Push and Pop.
4. Extra Segment (ES) Register:
By default, the control of the compiler remains in the DS where the user can add and modify
the instructions. If there is less space in that segment, then ES is used. ES is also used for
copying purpose.
3) Pointers and Index Registers
The pointers will always store some address or memory location. In 8086 Microprocessor, they
usually store the offset through which the actual address is calculated.
16-bit AX,BX,CX,DX
1 General purpose Registers(4)
8-bit AL,AH,BL,BH,CL,CH,DL,DH
Stack Pointer(SP)
2 Pointer Registers 16-bit
Base Pointer(BP)
Code Segment(CS)
Data Segment(DS)
4 Segment Registers
16-bit Stack Segment(SS)
Extra Segment(ES)
Flag register of 8086 is a 16-bit register where status of the latest Arithmetic operation
performed.
Status flags:
CF:
It stands for carry flag.
If CF = 1 ; it means carry is generated from the MSB.
PF:
It stands for parity flag.
If PF = 1 ; it means it is even parity in the result ( there are even numbers of 1’s ).
In example 1, there are 4 ones’ which is even , in the second example there are 5 ones’ which is
odd in count.
AF:
AF stands for auxiliary flag. As 8-bits form a byte, similarly 4 bits form a nibble. So in 16 bit
operations there are 4 nibbles.
OF:
OF stands for overflow flag.
● Signed
● Unsigned
Unsigned:
This is a 8 bit positive number which ranges from 0 to 255. In hexadecimal it’s range is from 00
to FF. In the OF flag, it has nothing to do with unsigned numbers. Only signed numbers are
considered in the OF flag.
Signed:
This is also a 8-bit number( can be 16-bit too ) which is equally distributed among +ve and -ve
numbers. By considering MSB , it is decided whether it is a positive or negative number. If
MSB=1 , it is a negative number or else negative number.
So it’s positive range is from 0 to 127 [ 00 to 7F (in hexadecimal ) ], it consists of 128 +ve
values.
It also has 128 negative numbers ranging from -1 to -128 [ -01 to -80 ( in hexadecimal ) ].
Whenever a negative number is saved, it is saved as it’s 2’s complement. To access the number
we have to make its 2’s complement again. A number is considered as negative whenever its
MSB is 1, and its 2’s complement is the actual negative number.
It is a negative number and its 2’s complement is 0100 1101, which is equivalent
to 4D ( hexadecimal ) . so it is -4DH.
So there is a well defined limit for signed numbers ( 00 to 7F and -01 to 80 ). If the result or
operands exceeds the limit, it is known as overflow. If there is overflow, then the MSB would
show incorrect values, if there is overflow then
MSB = 0 , then it is -ve number. This is the reverse with the original case.
SF:
This stands for sign flag. In short it copies the value of MSB. It shows wrong notation in the case
of overflow.
CF, AF, PF, ZF, OF, SF , these were status flags, and these keep changing after every arithmetic
operation. And these flags are not controlled by the user, these are controlled by the ALU.
Control flag:
There are three types of control flags, and by default all are zero.
TF:
This stands for trap flag. Generally processors give output after the complete program, but when
TF = 1, output is given after every instruction.
This is useful to check logical errors, when the program is too long.
IF:
This is interrupt flag.
IF = 1, then enable interrupts
DF:
This stands for direction flag. In the case string operation, by default address keeps incrementing
for instruction execution. It means after execution of an instruction, whether the processor should
execute next instruction or previous instruction.
IfPipelining inis8086
DF = 0 ; address auto incrementing ( processor executes next instruction ).
Pipelining is the feature of fetching the next instruction while executing the current instruction.
Instructions are stored in memory, therefore, it has to be fetched, decoded and then executed. Pipelining boost
performance as fetching and executing is done alongside at the same time.
In 8085, which has a non-pipelined processor for fetching and executing 5 instructions, 10-time cycles are
required. While in 8086, for fetching and executing 5 instructions 6 times cycle is required. You can see the
immense impact pipelining makes. In the pipeline, while one instruction is being executed side by side
next instruction is being fetched.
Pipelining has become possible because of 6 bytes pre-fetch queue. It is a 6 byte FIFO RAM used to
implement pipelining. BIU (Bus Interface Unit) fetches the 6 instruction byte from the code segment and stores
them into the queue. 8086 has a 16-bit data bus thus code is refilled in the queue when at least 2 bytes are
empty.
Drawbacks:
1. Data dependency- A situation where instruction depends on a result of a sequentially previous instruction
before it can complete execution.
2. Branching- Sometimes it may happen that the program is not executing sequentially because of loops and
conditional statements. But with the help of the pipeline, we have fetched the next instruction. In that case, we
discard that instruction and jump. It creates a waste of effort.
Advantages:
3. Saves time.
Memory Segmentation
4. Fewer instruction cycles are required.
Segmentation involves logically dividing the computer’s main memory into distinct segments,
each with its own base address.
This technique aims to optimize the speed of computer system execution, enabling the processor
to efficiently retrieve and process data from memory. In the context of the Memory Segmentation
in 8086 Microprocessor, is a mechanism used to manage and organize the memory space.
The 8086 microprocessor employs a segmented memory model, where the entire 1 MB memory
space is divided into segments, and each segment is 64 KB in size. The combination of a segment
and an offset within that segment forms a physical address.
Memory Segmentation:
The Bus Interface Unit (BIU) contains four 16 bit special purpose registers (mentioned below)
called as Segment Registers.
● Code segment register (CS): is used for addressing memory location in the code segment of
the memory, where the executable program is stored.
● Data segment register (DS): points to the data segment of the memory where the data is stored.
● Extra Segment Register (ES): also refers to a segment in the memory which is another data
segment in the memory.
● 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.
The number of address lines in 8086 is 20, 8086 BIU will send 20bit address, so as to access one
of the 1MB memory locations. The four segment registers actually contain the upper 16 bits of the
starting addresses of the four memory segments of 64 KB each with which the 8086 is working at
that instant of time. A segment is a logical unit of memory that may be up to 64 kilobytes long.
Each segment is made up of contiguous memory locations. It is an independent, separately
addressable unit. Starting address will always be changing. It will not be fixed.
Note that the 8086 does not work the whole 1MB memory at any given time. However, it works
only with four 64KB segments within the whole 1MB memory.
A logical address:
is the address at which an item (memory cell, storage element) appears to reside from the perspective of an
executing application program. A logical address may be different from the physical address due to the operation of
an address translator or mapping function.
Effective Address or Offset Address: The offset for a memory operand is called the operand's effective address or
EA. It is an unassigned 16 bit number that expresses the operand's distance in bytes from the beginning of the
segment in which it resides. In 8086 we have base registers and index registers.
1. Segment registers carry 16 bit data, which is also known as base address.
2. BIU appends four 0 bits to LSB of the base address. This address becomes 20-bit address.
4. Offset address is added into 20-bit base address which finally forms 20 bit physical address of memory location
Decimal Hexadecimal
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 A
11 B
12 C
13 D
14 E
15 F
16 10
17 11
18 12
19 13
20 14
21 15
22 16
23 17
24 18
= 345A0+13DC
= 3597CH
Question 1
The value of Code Segment (CS) Register is 4042H and the value of different offsets is as follows:
BX: 2025H , IP: 0580H , DI: 4247H
Calculate the effective address of the memory location pointed by the CS register.
Question 2
Calculate the effective address for the following register:
SS: 3860H, SP: 1735H, BP: 4826H
Question 3
The value of the DS register is 3032H. And the BX register contains a 16 bit value which is equal to
3032H. 0008H is added to BX.
ADD BX, 0008H
The register AX contains some value which needs to be stored at a location as follows:
MOV [BX], AX
Calculate the address at which the value of the AX will be stored.
Question 4
You are provided the following values:
DS: 3056H, IP: 1023H, BP: 2322H and SP: 3029H
Can you calculate the effective address of the memory location as per the DS register?