MPMC Assignment-2
MPMC Assignment-2
CSE-2(M)
ASSIGNMENT-2 06915002718
Memory segmentation:
• To increase execution speed and fetching speed, 8086 segments the
memory.
• It’s 20-bit address bus can address 1MB of memory, it segments it
into 4 64kB segments.
• 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. 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-
• 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 prefetch instruction queue (supports pipelining).
BIU mainly contains the 4 Segment registers, the Instruction Pointer, a
prefetch 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.
• Address of the next instruction is calculated as CS x 10H + IP.
Example:
CS = 4321H IP = 1000H
then CS x 10H = 43210H + offset = 44210H
This is the address of the instruction.
Code Segment 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:
DS holds the base address for the Data Segment.
Stack Segment register:
SS holds the base address for the Stack Segment.
Extra Segment register:
ES holds the base address for the Extra Segment.
Address Generation Circuit:
• The BIU has a Physical Address Generation Circuit.
• It generates the 20-bit physical address using Segment and Offset
addresses using the formula:
• Physical Address
= Segment Address x 10H + Offset Address
6 Byte Pre-fetch Queue:
• It is a 6-byte queue (FIFO).
• Fetching the next instruction (by BIU from CS) while executing the
current instruction is called pipelining.
• Gets flushed whenever a branch instruction occurs.
The main components of the EU are General purpose registers, the ALU,
Special purpose registers, Instruction Register and Instruction Decoder and the
Flag/Status Register.
Q3. What are the steps followed by 8086 when an interrupt comes? How
much memory is required to store the interrupt vector table?
In 8086 microprocessor following tasks are performed when microprocessor
encounters an interrupt:
1. The value of flag register is pushed into the stack. It means that first
the value of SP (Stack Pointer) is decremented by 2 then the value of
flag register is pushed to the memory address of stack segment.
2. The value of starting memory address of CS (Code Segment) is
pushed into the stack.
3. The value of IP (Instruction Pointer) is pushed into the stack.
4. IP is loaded from word location (Interrupt type) * 04.
5. CS is loaded from the next word location.
6. Interrupt and Trap flag are reset to 0.
For every interrupt, there must be an interrupt service routine (ISR), or interrupt
handler. When an interrupt occurs, the microcontroller runs the interrupt service
routine. For every interrupt, there is a fixed location in memory that holds the
address of its interrupt service routine, ISR. The table of memory locations set
aside to hold the addresses of ISRs is called as the Interrupt Vector Table.
Interrupt Vector Table
Reset 0000 9
• When the reset pin is activated, the 8051 jumps to the address location
0000. This is power-up reset.
• Two interrupts are set aside for the timers: one for timer 0 and one for
timer 1. Memory locations are 000BH and 001BH respectively in the
interrupt vector table.
• Two interrupts are set aside for hardware external interrupts. Pin no. 12
and Pin no. 13 in Port 3 are for the external hardware interrupts INT0 and
INT1, respectively. Memory locations are 0003H and 0013H respectively
in the interrupt vector table.
• Serial communication has a single interrupt that belongs to both receive
and transmit. Memory location 0023H belongs to this interrupt.
Q5. What is the difference between physical address and effective address?
Obtain the physical address for the offset address 07EA:0103.
Effective address:
Physical address: