Professional Documents
Culture Documents
Lecture 2
can view the entire microprocessor-based system system microprocessor, ROM, RWM, and I/O ports as a collection of addressable registers. Registers in the microprocessor are internal registers, Those exist in the ROM, RWM (RAM), and I/O ports are external registers. we will start from basic Register concepts and Memory Devices
So
Memory Devices
Before attempting to interface memory to the microprocessor, it is essential to understand the operation of memory components. In this lecture, we explain functions of the 2 common types of memory: Random Access Memory (RAM) (SRAM, DRAM, NV-DRAM) Read-Only Memory (ROM) (PROM, EPROM, EEPROM, Flash EPROM, mask ROM)
OBJECTIVES
this lecture enables to:
Define the terms capacity, organization, and speed as used in semiconductor memories. Calculate the chip capacity and organization of semiconductor memory chips. Compare and contrast the variations of ROM
PROM, EPROM, EEPROM, Flash EPROM, mask ROM.
Design address decoding methods for memory chips. Design a memory system for an 8085 based systems in terms of RAM and ROM allocation.
5
Lecture Outline
1. Memory Basics
2. Memory Design with D Flip Flops 3. Random Access Memory 4. DRAM 5. Read Only Memory 6. Memory Decoding 7. Memory System Design for Microprocessors 8. Designing Larger Memories
Memories
To store a single bit, we can use
Flip Flops or Latches
Dynamic RAMs use a tiny capacitor to store a bit Design concepts are mostly independent of the actual technique used to store a bit of data
Qn+1 = Dn D: Senkron veri girii CLK: Saat girii Q: k Q: kn tersi SET: Asenkron 1'leme girii CLR: Asenkron 0'lama girii
10
Clock Pulse
ndeki Kenar
D CLK
D CLK
D CLK
D CLK
0 (a) t
(a)
(b)
(c)
(d)
(a) Positive edge triggered, (b) negative edge triggered, (c) positive level triggered, (d) negative level triggered
11
12
m-bit Register
1. Memory Basics
Giri Veri Yolu CLK Dm-1 D CLK CLK Dm-2 D CLK D0 D
Lecture Outline
2. Memory Design with D Flip Flops
3. Random Access Memory 4. DRAM 5. Read Only Memory 6. Memory Decoding
k Veri Yolu Q
Two address lines are needed to select one of four words of 3 bits each
15 16
Q Qm-1
Q Qm-2
Q0
13
14
(a) Logic diagram of a standard TTL inverter with totem pole output and its internal structure (b). (c) logic diagram of improper connection.
(a)
Vcc
(b)
Vcc
A B
ON A OFF
OFF Q1 B ON
Q2
(c)
(d)
18
19
20
21
22
Tri-State Buffer
Dm-2 D CLK
D0 D
E Y = X, E = 1 ise (a)
E Y = X, E = 0 ise (b)
E Y = X, E = 1 ise (c)
E Y = X, E = 0 ise (d)
Q Qm-1 E
Q Qm-2
3-state buffers with noninverting (a), (b) and inverting (c), (d) outputs.
23
24
25
26
8-bit (octal) Registers having 3-state outputs Building a Memory Block with 3-state Buffers
D 8-bit D
D 8-bit 8-bit D
8-bit
7
Q OE
Q OE
CLK
CLK
27
28
29
30
Memory
Organization
Memory chips are organized into a number of locations within the IC.
Each can hold 1, 4, 8, or even 16 bits.
Depending on internal design.
The number of bits each location can hold is always equal to the number of data pins on the chip. The number of locations in a memory chip depends on the number of address pins.
Always 2x, where x is the number of address pins.
The entire chip contains 2x x y bits, where x is the number of address pins and y the number of data pins.
The 2x x y is referred to as the organization of the memory chip, with x expressed as the number of address pins, and y the number of data pins.
1. Memory Basics
Memory Capacity 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M 16M 1G 4G 1T Number of Words 1024 2048 4096 8192 16384 32768 65536 2 64K 4 64K 8 64K 1024 1024 (16 64K) 16 1M 1024 1024 1024 4 1G 1024 1024 1024 1024 Bits 10-bit 11-bit 12-bit 13-bit 14-bit 15-bit 16-bit 17-bit 18-bit 19-bit 20-bit 24-bit 30-bit 32-bit 40-bit
33 34
RAM: Random Access Memory RAM memory is called volatile memory since cutting off the power to the IC will mean the loss of data.
Sometimes referred to as RWM (Read & Write Memory).
SRAM Storage cells in static RAM memory are made of flip-flops & do not require refreshing to keep data. Each cell requires at least 6 transistors to build.
Each cell holds only 1 bit of data.
Recently 4-transistor cells have been made, still too many.
4-transistor cells, plus use of CMOS technology has given led to a high-capacity SRAM.
Still far below DRAM capacity.
35
36
6116 Pinouts
WE (write enable) is for writing data into SRAM. (active low) OE (output enable) is for reading data out of SRAM. (active low)
6116 2K x 8 SRAM
37
n-1
Adres n CS RD WR CS OE WE
Veri m
m-1
SRAM 6116 diagram The functional block diagram for the 6116 SRAM
Memory Speed: Access Time A most important characteristic of a memory chip is the speed at which data can be accessed from it.
To access the data, the address is presented to the address pins, and after a certain amount of time has elapsed, the data shows up at the data pins.
The shorter this elapsed time, the better, (and more expensive) the memory chip.
The speed of the memory chip is commonly referred to as its access time.
Varies from a few nanoseconds to hundreds of nanoseconds.
Memory Read Timing for SRAM 6116 Functional Diagram
41 42
100 ns - 15 ns
Memory Read Timing for SRAM Memory Read Timing for SRAM
43
44
Read Cycle
CS Veri k Geerli Veri
tA
Write Cycle
tw
100 ns
Memory Read Timing for SRAM
Veri Kararl
Veri Deiebilir
45 46
1. Memory Basics
2. Memory Design with D Flip Flops 3. Random Access Memory
4. DRAM
5. Read Only Memory 6. Memory Decoding 7. Memory Decoding 8. Memory System Design for Microprocessors 9. Designing Larger Memories
Using a capacitor to store data reduces the total number of transistors needed to build the cell.
Use of capacitors as storage cells in DRAM results in a much smaller memory cell size.
They require constant refreshing due to leakage.
48 47
DRAM Packaging Issues It is difficult to pack large numbers of cells into single DRAM chips, with normal numbers of address pins.
A 64K-bit chip (64K x 1) must have 16 address lines and one data line, requiring 16 pins to send in the address.
In addition to VCC power, ground & read/write control pins.
Disadvantages:
It must be refreshed periodically, as the capacitor cell loses its charge. While it is being refreshed, the data cannot be accessed.
Internally, the DRAM structure is divided into a square of rows and columns.
The first half of the address is called the row. The second half is called the column.
50
DRAM Packaging Issues In a 64K x 1 organization, the first half of the address is sent through pins A0A7.
Internal latches grab the first half.
Using RAS (row address strobe)
DRAM Packaging Issues There must be a 2-by-1 multiplexer outside the DRAM chip, which has its own internal demultiplexer.
To access a bit of data from, both row & column address must be provided.
256K 1 DRAM
52
DRAM, SRAM, ROM Organizations Organizations for SRAMs & ROMs are always x 8.
DRAM can have x 1, x 4, x 8, or x 16 organizations.
NV-RAM: Nonvolatile RAM Nonvolatile RAM allows the CPU to read & write to it & when power is turned off, contents are not lost. NV-RAM chip internal components:
1. Extremely power-efficient (low power consumption) SRAM cells, built out of CMOS. 2. Internal lithium battery as a backup energy source. 3. Intelligent control circuitry.
To monitor the VCC pin, and automatically switch to the lithium battery on for loss of external power.
In some memory chips (notably SRAM), the data pins are called I/O.
In some DRAMs, there are separate pins Din and Dout.
DRAMs with x1 organization are widely used for parity bit.
53
54
ROM is a type of memory that does not lose its contents when the power is turned off.
Also called nonvolatile memory.
56
PROM programmable ROM or OTP ROM PROM refers to the kind of ROM that the user can burn information into.
A user-programmable memory.
EPROM: Erasable Programmable ROM EPROM was invented to allow changes in the contents of PROM after it is burned.
One can program/erase the memory chip many times.
The programming process is called burning, using special equipment. (A ROM burner or programmer) For every bit of the PROM, there exists a fuse.
PROM is programmed by blowing the fuses. If information burned into PROM is wrong, it must be discarded, as the internal fuses are blown permanently. For this reason, PROM is also referred to as OTP. (one-time programmable)
57
All EPROM chips have a window, to shine ultraviolet (UV) radiation to erase the chip's contents.
EPROM is also referred to as UV-erasable EPROM or simply UV-EPROM. Erasing EPROM contents can take up to 20 minutes. It cannot be programmed while in the system board (motherboard).
58
CS RD
0V 5V
Note the A0A12 address pins and O0O7 (output) for D0D7 data pins.
OE (out enable) is for the read signal.
I/O Type Common Common Common Common Common Common 60
EPROM Examples Memory 2716 2732A 2764A 27128A 27256 27512 Capacity 2K 8 4K 8 8K 8 16K 8 32K 8 64K 8 Pin Number 24 24 28 28 28 28 Control Lines CE, OE CE, OE CE, OE CE, OE CE, OE CE, OE
Flash Memory Since the early 1990s, Flash ROM has become a popular user-programmable memory chip.
The process of erasure of the entire contents takes only a few seconds. (In a flash, hence the name) Electrical erasure lends the nickname Flash EEPROM.
To avoid confusion, it is commonly called Flash ROM.
Flash Memory Because Flash ROM can be programmed while in its system board socket, it is widely used to upgrade PC BIOS ROM, or Cisco router operating systems.
Some designers believe that Flash memory will replace the hard disk as a mass storage medium.
When Flash memory's contents are erased the entire device is erased.
In contrast to EEPROM, where one sections or bytes. Some Flash memories recently available are divided into blocks, and erasure can be done by block.
No byte erasure option is yet available.
63
The program/erase cycle is 500,000 for Flash and EEPROM; 2000 for UV-EPROM; infinite for RAM & disks.
Program/erase cycle is the number of times a chip can be erased and programmed before it becomes unusable.
64
Memory Identification
Memory Identification Capacity of the memory chip is indicated in the part number, with access time given with a zero dropped.
27128-20 refers to UV-EPROM that has a capacity of 128K bits and access time of 200 nanoseconds.
Mask ROM Mask ROM refers to a kind of ROM whose contents are programmed by the IC manufacturer.
Not a user-programmable ROM. The terminology mask is used in IC fabrication.
Mask ROM is used when needed volume is high & it is absolutely certain the contents will not change.
Since the process is costly.
The cost is significantly cheaper than other kinds of ROM, but if an error in the data is found, the entire batch must be discarded.
See the entire table on page 259 of your textbook.
67 68
6. Memory Decoding
7. Memory System Design for Microprocessors 8. Designing Larger Memories
70 69
Simple Logic Gate as Address Decoder In connecting a memory chip to the CPU, the data bus is connected directly to the data pins of the memory.
Control signals MEMR & MEMW are connected to the OE & WR pins.
MEMORY ADDRESS DECODING simple logic gate as address decoder On the address buses, the lower bits of the address go directly to memory chip address pins.
The upper ones activate the CS pin of the memory chip.
CS pin, with RD/WR allows data flow in/out of the chip.
No data can be written into or read from the memory chip unless CS is activated.
CS input is active-low and can be activated using simple logic gates, such as NAND and inverters.
For every block of memory, we need a NAND gate.
See Figs. 10-9 & 10-10 on page 266.
Fig. 10-8 Using Simple Logic Gate as Decoder
71 72
MEMORY ADDRESS DECODING simple logic gate as address decoder Example 10-6 shows the address range calculation for Fig. 10-10 on page 266.
Note the output of the NAND gate is active-low.
The CS pin is also active-low .
Using the 74LS138 as Decoder In the absence of CPLD or FPGA as address decoders, the 74LS138 chip is an excellent choice.
Three inputs: A, B & C, generate eight active-low outputs: Y0Y7.
74LS138 Decoder
73 74
MEMORY ADDRESS DECODING using the 74LS138 as decoder The need for NAND and inverter gates is eliminated when using 74SL138.
Three inputs: A, B & C, generate eight active-low outputs: Y0Y7.
Each Y output connects to the CS of a memory chip, allowing control of 8 memory blocks by a single 74LS138.
Note that all three Enables (G2A, G2B, and G1) must be active, e.g. low, low and high, respectively. Each output of the decoder can be attached directly to CS or CE pin of an EPROM or RAM chip.
74LS138 Decoder
76
MEMORY ADDRESS DECODING using the 74LS138 as decoder To enable 74SL138: G2A = 0, G2B = 0, G1 = 1.
G2A & G2B are grounded; G1 = 1 selects this 74LS138.
Three inputs: A, B & C, generate eight active-low outputs: Y0Y7.
1. Memory Basics 2. Memory Design with D Flip Flops 3. Random Access Memory 4. DRAM
Each Y output connects to the CS of a memory chip, allowing control of 8 memory blocks by a single 74LS138. Inputs G2A, G2B & G1, can be used for address or control signal selection
74LS138 Decoder
77 78
80
To design a memory system for a microprocessor based system: The lengths of memory bus and address bus of the microprocessor used. The starting address of microprocessor reset where the program execution starts. The control lines that the microprocessor uses in memory access. ..
79
Hedef Saklayclar
D CLK M Q
kinci evrim
D CLK X
Q WRN
D CLK WDX
D CLK Y
B
Q
D CLK WRO
Yazma Adresi B
RDY
D CLK Z
Q WRP
D CLK RDZ P
RD
0 1
WR
0 1
2x4 Decoder A 1 A
0
1B 1A 1G
2B 2A 2G
WRP
0 1
RD
WR
WRO
0 1 0
Adres A A
1
Seilen Saklayc W X Y Z
Adres B B
1
Yksek empedans
Seilen Saklayc M N O P
VER
0 0 1 1
0 1 0 1
0 0 1 1
0 1 0 1
1 veya 0
(Y)
(P)
(X)
(O)
81
82
Intel control signals for basic microprocessor data transfers: RD: Read (active low) WR: Write (active low) IO / M: Input Output / Memory
Data transfers between a microprocessor and memory and I/O devices Data Transfer I M I M I IO I IO RD 0 1 0 1 WR 1 0 1 0 IO/M 0 0 1 1 Cycle MEMR MEMW IOR IOW Comment Memory read Memory write I/O read I/O write
84
4K8 EPROM ve 2K8 RWM EPROM starts from 0000h, after EPROM RWM starts.
A15 A 12 A11 A8 A7 A4 A3 A0
8085 signals which will be used in the memory system design: 16-bit Address Bus, A15-A0, 8-bit Data Bus, D7-D0, 3 control lines, IO.H/M.L , RD.L and WR.L
0 0 0 0 0 0 0 0
lk 4K'lk blou seer
0 0 0 0 1 1 1 1
0 0 0 0 1 1 1 1
4K ROM iinde bir hafza hcresini seer
0 0 0 0 1 1 1 1
RWM
2K
1000h 17FFh
0 0 0 1 0 0 0 1
0 0 0 0 0 1 1 1
0 0 0 0 1 1 1 1
2K RWM iinde bir hafza hcresini seer
0 0 0 0 1 1 1 1
FFFFh
Bo
58K
Memory map
85 86
2732 4K x 8 EPROM CE OE
RD
A10 - A0 11
A11 - A0
D7 - D0
6116 2K x 8 RWM CS OE WE
87 88
RD WR
1. Memory Basics 2. Memory Design with D Flip Flops 3. Random Access Memory 4. DRAM 5. Read Only Memory 6. Memory Decoding
91
92
Memory Mapping
Full mapping
93
94
Alignment of Data
Soft alignment
Can handle aligned as well as unaligned data
Hard alignment
Handles only aligned data (enforces alignment)
96
95
Interleaved Memory
In our memory designs
Block of contiguous memory addresses is mapped to a module
One advantage Incremental expansion Disadvantage Successive accesses take more time Not possible to hide memory latency
Interleaved memories
Improve access performance
Allow overlapped memory access Use multiple banks and access all banks simultaneously Addresses are spread over banks Not mapped to a single memory module
Interleaved memory
Lower order r bits identify a module Higher order m bits identify a location in the module
Called low-order interleaving
97
98
101
102
Reduced fault-tolerance
One bank failure leads to failure of the whole memory
103
104
Acknowledgement
The slides have been based in-part upon original slides of a number of books including: The x86 PC: Assembly Language, Design, and Interfacing, 5/E, M. A. Mazidi, J. G. Mazidi, D. Causey, Prentice Hall, 2010. Fundamentals of Computer Organization and Design, S. P. Dandamudi, Springer, 1060 pages, 2003. Mikroilemciler ve Bilgisayarlar, 6. Basm, H. Gmkaya, ALFA, 2011.
105