MemorySeg and Banking
MemorySeg and Banking
each.
time.
4
Microprocessor Dr. Gauri Shukla
Memory Map for 8086
Dedicated Locations
Used for processing specific system interrupts and reset
function
Within the 1 MB of memory space the 8086/88 defines four 64K-byte memory
blocks called
1. Code segment,
2. Stack segment,
3. Data segment,
4. Extra segment.
6
Microprocessor Dr. Gauri Shukla
8086 – Memory Segmentation
Extra Segemnt
Stack Segment
Code Segment
Data Segment
7
Microprocessor Dr. Gauri Shukla
8086 – Memory Segmentation
8
Microprocessor Dr. Gauri Shukla
8086 – Memory Segmentation
9
Microprocessor Dr. Gauri Shukla
8086 – Memory Segmentation
• Code Segment
10
Microprocessor Dr. Gauri Shukla
8086 – Memory Segmentation
• Data Segment.
11
Microprocessor Dr. Gauri Shukla
8086 – Memory Segmentation
• Stack Segment.
i. This segment is used to store interrupt and subroutine return
addresses.
ii. It holds the stack memory, which operates in LIFO manner.
iii. SS reg holds the 16- bit base address
iv. SP reg holds the 16 bit offset address of the Top of the Stack
v. BP reg holds the16 bit offset address during Random Access.
12
Microprocessor Dr. Gauri Shukla
8086 – Memory Segmentation
• Extra Segment
i. This segment is an extra data segment (often used for
shared data).
13
Microprocessor Dr. Gauri Shukla
8086 – Memory Segmentation
Programs obtain access to code & data in the code segment & data segment
by changing the segment register contents to point to the desired segments.
a 16-bit offset in the segment contained in the 16-bit instruction pointer (IP).
14
Microprocessor Dr. Gauri Shukla
8086 – Memory Segmentation
• The BIU computes the 20-bit physical address internally by the provided
logical address (16-bit contents of CS and IP)
• It is done by logically shifting the contents of CS four bits to left and then
adding the 16-bit contents of IP.
15
Microprocessor Dr. Gauri Shukla
8086- Compuation of Address
IP Reg contains 16
bit offset
Offset
4214 H
+
CS 3 4 8 A 0
IP + 4 2 1 4
Start of the Code segment
20 bit Physical 3 8 A B 4 348A0
address in DS H
MEMORY
17
Microprocessor Dr. Gauri Shukla
8086 – Memory Segmentation
CS 3 4 8 A 0
IP + 4 2 1 4
20 bit Physical 3 8 A B 4
address in DS
18
Microprocessor Dr. Gauri Shukla
Segment Register Assignment
20
Microprocessor Dr. Gauri Shukla
8086 – Memory Segmentation
Disadvantages:
21
Microprocessor Dr. Gauri Shukla
Memory Interface
BIU
Instruction
Stream Byte
QUEUE
Control System
EU
ALU
23
Microprocessor Dr. Gauri Shukla
8086 – Memory Banks
8086 has a 16-bit data bus it can access 16- bit data in one
operation.
24
Microprocessor Dr. Gauri Shukla
8086 – Memory Banks
If both memory locations are consecutive in the same memory chip then
the address bus has to contain 2 addresses at the same time and hence
require double time. This is impossible.
25
Microprocessor Dr. Gauri Shukla
8086 – Memory Banks
The other bank contains all odd addresses called “Odd Bank”.
26
Microprocessor Dr. Gauri Shukla
8086 – Memory Banks
1 MB
512 KB 512 KB
FFFFFH FFFFEH
• Selected when BHE = 0 • Selected when A0 =0
27
Microprocessor Dr. Gauri Shukla
8086 – Memory Banks
28
Microprocessor Dr. Gauri Shukla
Microprocessor Dr. Gauri Shukla 29
8086 – Memory Banks
8086 Upper bank odd Lower bank even
Latches addressed byte addressed byte
A19
FFFFFH FFFFEH
–
A0
A1-A19 A1-A19
BHE
A0 A1
BHE
ALE 00005 00004
ALE
00003 00002
00001 CS 00000
CS
D15
.
D8 Higher Data Byte
D7
. Lower Data Byte
D0
30
Microprocessor Dr. Gauri Shukla