MemorySeg and Banking
MemorySeg and Banking
64 KB each.
at a 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
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 – Memory Segmentation
Eg:
if [CS] = 348A16 & [IP] = 421416, then the 20-bit physical address
generated by the BIU is as follows:
The BIU always inserts four Zeros for the lowest 4-bits of the 20-bit
starting address (physical) of a segment.
16
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
20 bit Physical 3 8 A B 4 348A0
Start of the Code segment
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
8086 – Memory Banks
22
Microprocessor Dr. Gauri Shukla
8086 – Memory Banks
8086 has a 16-bit data bus it can access 16- bit data in one
operation.
23
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.
24
Microprocessor Dr. Gauri Shukla
8086 – Memory Banks
The other bank contains all odd addresses called “Odd Bank”.
25
Microprocessor Dr. Gauri Shukla
8086 – Memory Banks
1 MB
512 KB 512 KB
FFFFFH FFFFEH
• Selected when BHE = 0 • Selected when A0 =0
26
Microprocessor Dr. Gauri Shukla
8086 – Memory Banks
27
Microprocessor Dr. Gauri Shukla
Microprocessor Dr. Gauri Shukla 28
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
29
Microprocessor Dr. Gauri Shukla