(Part1)
(Part1)
4
Integrated Circuits (IC)
Integrated circuits consist of logic and electronic circuits built on a single small
block or chip of semiconductor that all work together to perform a specific task.
The IC is easily breakable, so to be attached to a circuit board, it is often housed in
a plastic package with metal pins.
5
Figure 2: Main Component of Microprocessor Central processing
unit (CPU).
The CPU supervises and controls all other computer units, transfers data to
and from these units, and performs the arithmetic and logical operations necessary to
transform data into meaningful information. It called “Processor” or
“Microprocessor” in personal computer. It is divided into three parts:
1- Arithmetic and Logic unit (ALU).
2- Control unit (CU).
3- Register.
7
Instructions Fetch-Execute Cycle
The microprocessor follows the following sequence to execute instructions. 1- Initially:
the microprocessor loads the program instructions into main
memory.
2- Fetch: The microprocessor fetches those instructions from the memory.
3- Decode: Separate the operation from the operands and replace the variables with
their real values stored in main memory in preparation for execution.
4- Execute: Executes these instructions until the end of the program (until all
instructions are performed).
5- Later: it sends the result in binary to the output device.
Between these processes the register stores the temporarily data and ALU performs the
computing functions.
Features of 8086
The most prominent features of an 8086 microprocessor are as follows −
• It has an instruction queue, which is capable of storing six instruction bytes
from the memory resulting in faster processing.
• It was the first processor having 16-bit ALU, 16-bit registers, 16-bit internal
data bus, and 16-bit external data bus resulting in faster processing.
• It is available in 3 versions based on the frequency of operation
9
o 8086 → 5MHz
o 8086-2 → 8MHz
o (c)8086-1 → 10 MHz
• It uses two stages of pipelining, i.e. Fetch Stage and Execute Stage, which
improves performance.
• Fetch stage can prefetch up to 6 bytes of instructions and stores them in the
queue.
• Execute stage executes these instructions.
• It has 256 vectored interrupts.
• It consists of 29,000 transistors.
10
Microprocessor 8086 - Pin Configuration
8086 was the first 16-bit microprocessor available in 40-pin Dual Inline Package (DIP)
chip. Let us now discuss in detail the pin configuration of an 8086 Microprocessor.
8086 Pin Diagram
Here is the pin diagram of 8086 microprocessors
Microprocessor
Pin
11
12
13
14
15
Differentiate between minimum and maximum mode of operation of 8086
microprocessor
16
What is Timing diagram, State, Machine cycle, and Instruction Cycle: 8086
Microprocessor
Timing diagram:
Timing Diagram shows the behavior of the object(s) in a given period of time. It is
a graphical method of showing the exact output behavior of a logic circuit for
every possible set of input conditions. It is often used in digital devices to describe
the operation. Its visual characteristics are easy to understand the operation.
T-state:
One sub-division of an operation performed in one clock cycle is called a T-state.
T1, T2, T3, T4 are called states.
Machine cycle:
A group of state come together to perform one operation is called machine
cycle. The basic operation of reading/writing a byte from/to a memory location/a
port is called a machine cycle. The time taken to complete a machine cycle is
represented as Tcy. A machine cycle is made up of many states.
Instruction cycle:
The total time for fetching and executing an instruction is called instruction cycle.
An instruction cycle consists of one or more machine cycle.
In 8086, the concept of a machine cycle is not so relevant. The Execution Unit
(EU) executes instruction in certain clock periods. These clock cycles do not
constitute any form of machine cycles. The Bus Interface Unit (BIU) fetches
instructions and operands from the memory. Any external access either to the
memory or I/O device requires four clock periods.
17
Bus cycle:
This group of four clock cycles is called the bus cycle. There is memory or I/O
read bus cycle; memory or I/O write bus cycle. One bus cycle consists of four
clock periods.
Memory/IO (M/IO). The 8086 does not output separate memory and I/O read and
write signals. Instead, the M/IO signal is output early in the T1 state and identifies
the current bus cycle as a (memory M) (M/IO = 1) or (input/output I/O) (M/ IO =
0) operation.
Read (RD). This active-low output signal indicates that the direction of data flow
on the bus is from memory or I/O into the processor. It can be combined with
M/IO to form MEMR and IOR control signals. It is output during the T2 state and
removed during the T4 state. The memory or I/O device is assumed to have placed
the addressed byte or word onto the data lines by the time RD returns high.
Write (WR). This signal is the counterpart of RD and indicates that data is to flow
from the CPU to memory or to an I/O device. In either case, the data is output
during the T2 state. This gives the memory or I/O plenty of time to latch the data
byte or word before WR is removed during
18 T4.
Consider the sequence of events that occur during a memory read bus cycle.
T1. The processor outputs the 20-bit memory address. The data lines are open
circuited and all control lines disabled.
T2. The MEMR control line is driven low. The memory unit recognizes this bus
cycle as a memory read and prepares to place the addressed byte or word onto the
data lines.
T3. The microprocessor configures its data bus lines for input but takes no further
action. This
state is provided primarily to give the memory time to “look up” the data byte or word.
T4. The microprocessor now expects the data to be on the data bus lines. Therefore
it latches the contents of these lines and releases the memory read control signal.
This marks the end of the bus cycle.
The most important point to note is that the microprocessor controls all the bus
timing. The memory must be able to supply the selected data byte or word by the
time MEMR goes high during the T4 state. If it cannot do so, the CPU will read
random information on the data bus lines. This will lead to unpredictable results.
➢ The microprocessor needs time to change the signals during each bus cycle.
➢ Memory devices need time to decipher the address value and then read/write the
data
19
BUS CYCLE OPERATION
Memory read in minimum mode which shown in Figure () can describe as:
During period T1,
• The 8086 outputs the 20-bit address of the memory location to be
accessed on its multiplexed address/data bus. BHE is also output along with
the address during T1.
• At the same time a pulse is also produced at ALE. The trailing edge or the
high level of this pulse is used to latch the address in external circuitry.
• Signal M/IO is set to logic 1 and signal DT/R is set to the 0 logic level
and both are maintained throughout all four periods of the bus cycle.
o On the other hand, address/data bus lines AD0 through AD7 are put in
21
memory write cycle in minimum mode which shown in Figure () can describe as:
• The 8086 switches WR to the inactive 1 logic level to terminate the write
operation. DEN returns to its inactive logic level late during T4 to disable
the external circuitry.
22
23
Maximum-mode Memory-Read bus-cycle of 8086 system
24
Maximum-mode Memory-Read cycle of 8086
The timing diagram for 8086 maximum mode memory read operation is shown
below using logic ‘0’ and ‘1’ wave forms. To complete the maximum-mode
memory-write buscycle, the required control signals with appropriate active logic
levels are:
• IO/M = ‘logic 0’, to select memory interface
• MN/MX = ‘logic 0’, to select maximum-mode of operation
• DT/R = ‘logic 1’, to activate the data-transmit mode of ‘Data-bus-buffer’
• Valid Physical-address (A0 to A19) and BHE signal is generated by CPU
• ALE-pulse, to latch the valid Physical-address.
• Proper status code S0 to S2 (as shown in table of slide 8) is generated by
• CPU to initiate data writing (MRTC) from the desired memory bank
• DEN = ‘1’, enables the ‘Data-Bus-transceiver-buffer’ to let data pass
8086 requires one phase clock with a 33% duty cycle to provide optimized internal timing.
– Range of clock:
Execution Unit
27
Instruction Decoder
Translates instructions fetched from memory into a series of actions which EU
carries out Control System
Generates timing and control signals to perform the internal operations of the
microprocessor
Arithmetic Logic Unit
EU has a 16-bit ALU which can ADD, SUBTRACT, AND, OR, increment,
decrement,
complement or shift binary numbers
28
Flag Register:8086 has a 16-bit flag register
29
30
Bus Interface Unit
Main Components are
• Instruction Queue
• Segment Registers
• Instruction Pointer
Instruction Queue
8086 employs parallel processing
When EU is busy decoding or executing current instruction, the buses of 8086
may not be in use.
At that time, BIU can use buses to fetch up to six instruction bytes for the
following instructions
BIU stores these pre-fetched bytes in a FIFO register called Instruction Queue
When EU is ready for its next instruction; it simply reads the instruction from
the queue in BIU
Pipelining:EU of 8086 does not have to wait in between for BIU to fetch next
instruction byte from memory
a 16-bit register
Holds 16-bit offset, of the next instruction byte in the code segment
BIU uses IP and CS registers to generate the 20-bit address of the instruction to
be fetched from memory
7. Based & Indexed Addressing Mode 8. Based & Indexed with displacement Addressing
• Opcode:- It stands for operational code. It specifies the type of operation to be performed
by CPU. It is the first field in the machine language instruction format.
• Operand:- We can also say it as data on which operation should act. Operands may be
register values or memory values. The CPU executes the instructions using information
present in this field. It may be 8-bit data or 16-bit
33
data.
Assembler:- it converts the instruction into sequence of binary bits, so that this bits can be
read by the processor.
• Mnemonics:- these are the symbolic codes for either instructions or commands to perform
a particular function.
34
Stack Pointer
It is a 16-bit register, contains the address of the data item currently on top of the stack.
Stack operation includes pushing (providing) data on to the stack and popping (taking)data
from the stack.
Pushing operation decrements stack pointer and Popping operation increments stack pointer.
i.e. there is a last in first out (LIFO) operation
E.g.: (1). PUSH AX; (2). PUSH DS; (3). PUSH [5000H];
36
(4). XCHG Destination, source;
➢ This instruction adds the contents of source operand with the contents of destination
operand.
➢ The source may be immediate data, memory location or register.
➢ The destination may be memory location or register.
➢ The result is stored in destination operand.
37
➢ AX is the default destination register.
E.g. (1). ADD AX,2020H; (2). ADD AX,BX;
SHL Instruction
The SHL (shift left) instruction performs a logical left shift on the destination operand,
filling the lowest bit with 0.
SHR Instruction
✓ The SHR (shift right) instruction performs a logical right shift on the destination
operand. The highest bit position is filled with a zero.
SAR Instruction
SAR (shift arithmetic right) performs a right arithmetic shift on the destination operand.
38
Shifting left n bits multiplies the operand by 2n.
For example, 5 * 22 = 20
For example, 80 / 23 = 10
ROL Instruction
ROR Instruction
✓ ROR (rotate right) shifts each bit to the right
✓ The lowest bit is copied into both the Carry flag and into the highest bit
✓ No bits are lost
RCL Instruction
39
✓ RCL (rotate carry left) shifts each bit to the left
✓ Copies the Carry flag to the least significant bit
✓ Copies the most significant bit to the Carry flag
RCR Instruction
40
41
42