chapter 8 Memory Interface
chapter 8 Memory Interface
Memory Interface
❖ Memory Devices
❖ Address Decoding
❖ 8088 and 80188 (8-Bit) Memory Interface
❖ 8086, 80186, 80286, and 80386SX (16-Bit)
Memory Interface
Chapter 8
CLO5
Microprocessors 503431-3
1 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Objectives of Chapter 8
By the end of this chapter, the student will be able to:
❖ Decode the memory address and use the outputs
of the decoder to select various memory
components.
❖ Explain how to interface both RAM and ROM to a
microprocessor.
❖ Interface memory to an 8-, 16-, 32-, and 64-bit
CLO5
Microprocessors 503431-3
2 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Introduction
❖ Simple or complex, every microprocessor-based
system has a memory system.
Microprocessors 503431-3
3 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Memory Devices
❖ Before attempting to interface memory to the microprocessor, it is
essential to understand the operation of memory components.
❖ In this section, we explain functions of the four common types of
memory:
▪ ROM: Read Only Memory
▪ OTP ROM: One-time programmable ROM (PROM: Programmable ROM
▪ EPROM: Erasable programmable ROM
▪ EEPROM: Electrically erasable programmable ROM
▪ Flash Memory: Extension of EEPROM
▪ SRAM: Static Random Access Memory
▪ DRAM: Dynamic Random Access Memory
Microprocessors 503431-3
4 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
5 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
6 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Write Ability
o Ranges of write ability
➢ High end
o processor writes to memory simply and quickly
o e.g., RAM
➢ Middle range
o processor writes to memory, but slower
o e.g., FLASH, EEPROM
➢ Lower range
o special equipment, “programmer”, must be used to write to memory
o e.g., EPROM, OTP ROM
➢ Low end
o bits stored only during fabrication
o e.g., Mask-programmed ROM
o In-system programmable memory
➢ Can be written to by a processor in the embedded system using the memory
➢ Memories in high end and middle range of write ability
Microprocessors 503431-3
7 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Storage Permanence
❖ Range of storage permanence
➢ High end
o essentially never loses bits
o e.g., mask-programmed ROM
➢ Middle range
o holds bits days, months, or years after memory’s power source turned off
o e.g., NVRAM
➢ Lower range
o holds bits as long as power supplied to memory
o e.g., SRAM
➢ Low end
o begins to lose bits almost immediately after written
o e.g., DRAM
❖ Nonvolatile memory
➢ Holds bits after power is no longer supplied
➢ High end and middle range of storage permanence
Microprocessors 503431-3
8 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
9 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Example: 8 x 4 ROM
▪ Horizontal lines = words
▪ Vertical lines = data Internal view
▪ Lines connected only at circles
8 × 4 ROM
▪ Decoder sets word 2’s line to 1 if
address input is 010 enable
word 0
word 1
▪ Data lines Q3 and Q1 are set to 1 3×8 word 2
Q3 Q2 Q1 Q0
Microprocessors 503431-3
10 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Mask-programmed ROM
Microprocessors 503431-3
11 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
12 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
13 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
14 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Flash Memory
• Extension of EEPROM
– Same floating gate principle
– Same write ability and storage permanence
• Fast erase
– Large blocks of memory erased at once, rather than one word at a
time
– Blocks typically several thousand bytes large
• Writes to single words may be slower
– Entire block must be read, word updated, then entire block written
back
• Used with embedded systems storing large data items in
nonvolatile memory
– e.g., digital cameras, TV set-top boxes, cell phones
Microprocessors 503431-3
15 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
– each input and output data line connects to each 4×4 RAM
Microprocessors 503431-3
17 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Example:
HM6264 & 27C256 RAM/ROM devices
• Low-cost low-capacity
memory devices 11-13, 15-19 data<7…0>
11-13, 15-19 data<7…0>
2,23,21,24, addr<15...0> 27,26,2,23,21, addr<15...0>
• Commonly used in 8-bit 25, 3-10
22 /OE
24,25, 3-10
22 /OE
microcontroller-based 27 /WE /CS
20
embedded systems 20 /CS1
Microprocessors 503431-3
18 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Composing Memory
• Memory size needed often differs from size of readily
available memories
• When available memory is larger, simply ignore
unneeded high-order address bits and higher data lines
• When available memory is smaller, compose several
smaller memories into one larger memory
– Connect side-by-side to increase width of words 2x1
Dec
– Connect top to bottom to increase number of words
• added high-order address line selects smaller memory
containing desired word using a decoder
– Combine techniques to increase number and width of words
Microprocessors 503431-3
19 Dr. Mohamed Abdelaziz19
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
▪ address inputs
▪ data outputs or
input/outputs
▪ some type of selection
input
▪ at least one control input
to select a read or write
operation
Microprocessors 503431-3
20 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Address Connections
❖ Memory devices have address inputs to select a
memory location within the device.
❖ Almost always labeled from A0 , the least significant
address input, to An
▪ where subscript n can be any value
▪ always labeled as one less than total number of address pins
❖ A memory device with 10 address pins has its address
pins labeled from A0 to A9.
Microprocessors 503431-3
21 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Address Connections
❖ Memory devices have address inputs to select a
memory location within the device.
❖ The number of address pins on a memory device is
determined by the number of memory locations found
within it.
❖ Today, common memory devices have between 1K
(1024) to 1G (1,073,741,824) memory locations.
❖ A 1K memory device has 10 address pins.
▪ therefore, 10 address inputs are required to select any of its
1024 memory locations
Microprocessors 503431-3
22 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Address Connections
❖ It takes a 10-bit binary number to select any single
location on a 1024-location device.
▪ 1024 different combinations
▪ if a device has 11 address connections, it has 2048 (2K)
internal memory locations
❖ The number of memory locations can be extrapolated
from the number of pins.
Microprocessors 503431-3
23 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Data Connections
❖ All memory devices have a set of data outputs or
input/outputs.
▪ today, many devices have bidirectional common I/O pins
▪ data connections are points at which data are entered for
storage or extracted for reading
❖ Data pins on memory devices are labeled D0 through
D7 for an 8-bit-wide memory device.
Microprocessors 503431-3
24 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Data Connections
❖ An 8-bit-wide memory device is often called a byte-
wide memory.
▪ most devices are currently 8 bits wide,
▪ some are 16 bits, 4 bits, or just 1 bit wide
❖ Catalog listings of memory devices often refer to
memory locations times bits per location.
▪ a memory device with 1K memory locations and 8 bits in each
location is often listed as a 1K x 8 by the manufacturer
❖ Memory devices are often classified according to total
bit capacity.
Microprocessors 503431-3
25 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Selection Connections
❖ Each memory device has an input that selects or
enables the memory device.
▪ sometimes more than one
❖ This type of input is most often called a chip select
(𝑮𝟐𝑨) chip enable (𝑪𝑬) or simply select (ഥ𝑺) input.
❖ RAM memory generally has at least one or input, and
ROM has at least one
❖ If more than one 𝑪𝑬 connection is present, all must be
activated to read or write data
Microprocessors 503431-3
26 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Control Connections
❖ All memory devices have some form of control input or
inputs.
▪ ROM usually has one control input, while RAM often has one
or two control inputs
❖ Control input often found on ROM is the output enable
or gate connection, which allows data flow from
output data pins.
❖ The 𝑶𝑬 connection enables and disables a set of three-
state buffers located in the device and must be active
to read data.
Microprocessors 503431-3
27 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Control Connections
❖ RAM has either one or two control inputs.
▪ if one control input, it is often called R/W
❖ If the RAM has two control inputs, they are usually
labeled 𝑾𝑬 (or 𝑾 ), and 𝑶𝑬 (or 𝑮
ഥ ).
▪ write enable 𝑾𝑬 must be active to perform memory write, and
𝑶𝑬 active to perform a memory read
▪ when the two controls are present, they must never both be
active at the same time
❖ If both inputs are inactive, data are neither written
nor read.
▪ the connections are at their high-impedance state
Microprocessors 503431-3
28 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
ROM Memory
❖ Read-only memory(ROM) permanently stores
programs/data resident to the system.
▪ and must not change when power disconnected
❖ Often called nonvolatile memory, because its contents
do not change even if power is disconnected.
❖ A device we call a ROM is purchased in mass
quantities from a manufacturer.
▪ programmed during fabrication at the factory
Microprocessors 503431-3
29 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
ROM Memory
❖ The EPROM (erasable programmable read-only
memory) is commonly used when software must be
changed often.
❖ An EPROM is programmed in the field on a device
called an EPROM programmer.
❖ Also erasable if exposed to high-intensity ultraviolet
light.
▪ depending on the type of EPROM
Microprocessors 503431-3
30 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
ROM Memory
❖ PROM memory devices are also available, although
they are not as common today.
❖ The PROM (programmable read-only memory) is also
programmed in the field by burning open tiny NI-
chrome or silicon oxide fuses.
❖ Once it is programmed, it cannot be erased.
Microprocessors 503431-3
31 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
ROM Memory
❖ The Figure illustrates the 2716 EPROM, which is
representative of most common EPROMs.
❖ This device contains 11 address inputs and eight data
outputs. The 2716 is a 2K x 8 read-only memory device.
❖ The 27XXX series of the EPROMs includes the following pan
numbers: 2704 (512 x 8), 2708 (1K x 8), 2716 (2K x 8),
2732 (4K x 8), 2764 (8K x 8), 27128 (16K x 8), 27256 (32K
x 8), 27512 (64K x 8), and 271024 (128K x 8).
❖ Each of these parts contains address pins, eight data
connections, one or more chip selection inputs (𝑪𝑬 ), and
an output enable pin (𝑶𝑬 ).
Microprocessors 503431-3
32 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
ROM Memory
Microprocessors 503431-3
34 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
35 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
36 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
37 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
38 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
39 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Address Decoding
❖ In order to attach a memory device to the
microprocessor, it is necessary to decode the address
sent from the microprocessor.
❖ Decoding makes the memory function at a unique
section or partition of the memory map.
❖ Without an address decoder, only one memory device
can be connected to a microprocessor, which would
make it virtually useless.
Microprocessors 503431-3
40 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
41 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
42 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
44 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
45 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
46 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
47 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
48 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
51 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
A circuit that uses eight 2764 EPROMs for a 64K x 8 section of memory in an 8088
microprocessor-based system. The addresses selected in this circuit are F0000H-FFFFFH
Microprocessors 503431-3
52 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
53 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
54 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
55 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
57 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
58 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Data D0 - D7
Address A0 - A14
32 K x 8
SRAM
32 K x 8
WR WR SRAM
32 K x 8
RD OE SRAM
32 K x 8
Y0 CS
A15 A SRAM
32 K x 8
Y1 CS
A16 B SRAM
32 K x 8
Y2 CS SRAM
A17 C 32 K x 8
74138 Y3 CS
3 x 8 SRAM
32 K x 8
Decoder Y4 CS SRAM
G1
Y5 CS
G2A
Y6 CS
G2B
Y7 CS
Y0
A18 A
Y1
A19 B
Y2
C 74138 Y3
3 x 8
Decoder Y4
Vcc G1
Y5
G2A
Y6 32 K x 8
G2B SRAM
Y7 32 K x 8
WR SRAM
32 K x 8
OE SRAM
32 K x 8
Y0 CS
A15 A SRAM
32 K x 8
Y1 CS
A16 B SRAM
32 K x 8
Y2 CS SRAM
A17 C 32 K x 8
74138 Y3 CS
3 x 8 SRAM
32 K x 8
Decoder Y4 CS SRAM
IO/M G1
Y5 CS
G2A
Y6 CS
G2B
Y7 CS
Microprocessors 503431-3
60 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
The high (odd) and low (even) 8-bit memory banks of the
8086/80286/80386SX microprocessors.
Microprocessors 503431-3
62 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
63 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
The high (odd) and low (even) 8-bit memory banks of the
8086 microprocessors.
Microprocessors 503431-3
64 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
65 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات
Microprocessors 503431-3
67 Dr. Mohamed Abdelaziz
College of Computers and Information Technology كلية الحاسبات وتقنية المعلومات