Overview COMP2121: and Interfacing • Memory System Hierarchy Lecture 26: Memory Systems (I) • RAM, ROM, EPROM, EEPROM and FLASH

http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 1, 2006

COMP2121: Microprocessors and 1 COMP2121: Microprocessors and 2 Interfacing Interfacing

Memory System Hierarchy Memory System Hierarchy

Decreasing • Registers speed and  Fastest but most expensive. Increasing cost • Control size  Slower than registers but bigger size. Auxiliary  Managed by hardware and therefore typically invisible to storage Off-chip programmers. (hard disk, memory Datapath floppy • On-chip memory (RAM and ROM) (RAM, disk,  An alternative for cache. ROM) CDROM)  Managed by the . • External memory (RAM and ROM) Cache or Registers  Slower than on-chip memory but bigger size. Slowest On-chip • Auxiliary storage (Hard disk, , CDROM) Fastest but memory and most cheapest  Much slower than external memory but much bigger size. expensive 3  Non-volatile i.e. exists after the power is switched off. 4 Types and Memory Computer Types and Memory Maps Maps (Cont.) • General purpose computer systems  Programs and data (including OS) are stored on the auxiliary storage Low Memory Area of RAM (typically hard disk). Address reserved for OS  A large amount of RAM to store programs and data.  When executed, programs are loaded from disk to RAM by OS.  ROM to store boot-up code and low-level system I/O drivers. Application RAM • Embedded systems Programs  Typically no auxiliary storage.  Program and constants are stored in ROM or non- such as flash.  Data are stored in RAM. High Memory BIOS and boot- ROM  Program could be copied from ROM to RAM to increase the execution Address up code speed.  On-chip memory is preferred to cache due to its low power A general-purpose computer consumption. 5 6

Computer Types and Memory RAM Maps (Cont.)

Low Enough RAM for • Memories are semiconductor integrated circuits. RAM variables and stack • A RAM (Random Access Memory) chip consists of an array of memory cells, a decoder for addressing a particular , and signals to control the direction of data None flow.

ROM Enough ROM for High Memory application programs Address and possibly OS

An memory map 7 COMP2121: Microprocessors and 8 Interfacing An Example Semiconductor RAM An Example Semiconductor RAM

5-to-32 5- 5 Row 32 32×32-bit • The CE signal (chip enable, or sometimes CS, chip select) Row Address RAM Array is derived by decoding the rest of address . Address Decoder • R/W controls whether the is being read from 32 32 or written to.

•Di and D o are separate data-in and data-out pins. 5-Bit 5 32-1 Multiplexer CE  Some chip has a single data I/O pin. Column Address 32-1 Demultiplexer R/W

Di Do

COMP2121: Microprocessors and 9 COMP2121: Microprocessors and 10 Interfacing Interfacing

Static Memory Cells Static Memory Cells • A static memory cell is a flip-flop. • The could be bipolar or MOS devices. • The bipolar flip-flop works as follows  Assume the ROW_SELECT is high (2.5 volts) and that • The following figure shows a typical static memory cell. Q1 is on. Current flows through R1 and R2, which are chosen to make the voltage at point A higher than the column line . Q1 ′ is C3.5 V C´ off, making the voltage at point A ′ higher than the column line C ′. Thus, when the row is not selected, the D1 and D1 ′ isolate ′ D1 R1 R1´ D1´ the cell from from the column lines C and C . When the cell is read, ROW_SELECT is asserted (it now is 0 volt), point A becomes A A´ lower than C, and current flows in D1 from column line C. R2 R2´ This current could signify a logic one stored in the cell. A logic 2.5 V zero is stored by turning Q1 off and Q1 ′ on. Now, when 0 V ROW_SELECT is asserted , the C column line will not have Q1 Q1´ current flow while C ′ will. Writing into the cell involves asserting ROW_SELECT the ROW_SELECT and driving either C or C ′ to set Q1 or Q1 ′ depending on whether zero or one is to be stored. COLUMN LINES 11 12 Dynamic Memory Cells Dynamic Memory Cells (Cont.)

• A dynamic cell is a where absence or presence of charge denotes a stored one or zero. • The following figure shows a typical dynamic memory cell. • A problem with dynamic cell is that the charge stored on  The MOS capacitor can be written to by activating the row, or the capacitor leaks away through the substrate. word, line to turn the MOS transistor on and charge the capacitor  Thus, the dynamic memory must be refreshed at periodic intervals through the column, or bit, line. by activating ROW_SELECT line while holding all column lines at  The cell can be read by turning the transistor on and sensing a a particular voltage level. voltage on the column.  All cells in the row can have the capacitor’s charge (or lack of charge) refreshed at once. Row or Word Line MOS Transistor

MOS Column or Capacitor Bit Line 13 COMP2121: Microprocessors and 14 Interfacing

Static Memory Static Memory (Cont.)

• Static RAM, or SRAM, consists of array of flip-. • Has lower density and thus lower storage capability than dynamic RAM. • Simpler to use than dynamic RAM • Does not need to refreshed like DRAM.

COMP2121: Microprocessors and 15 Logic diagram of a typical SRAM 16 Interfacing Dynamic Memory Dynamic Memory (Cont.)

RAS CONTROL & DATA IN D CAS BUFFER CLOCKS FRESH CONTROL & • The DRAM chip has 10 , separate data-in and data-out W ADDRESS COUNTER pins, a write enable (w), and two other control signals: RAS

COLUMN DECODER DATA OUT Q (row address strobe) and CAS (column address strobe). BUFFER  RAS and CAS control the multiplexing of the two 10-bit address SENSE AMPS & I/O GATINGS fields that make up the full 20-bit address required for 1M bits. REFRESH REFRESH CONTROL& ADDRESS ADDRESS COUNTER

MEMORY ARRAY 1,048,567 CELLS Vcc

Vss

Intel 1M×1-bit DRAM 17 COMP2121: Microprocessors and 18 Interfacing

DRAM Refresh Pseudostatic RAM

• A memory that combines the high storage capability of The DRAM memory cell requires periodic refresh operation. DRAM and ease of use of SRAM is pheudostatic RAM. There are several refresh methods. • It uses DRAM cells and includes on-chip refresh circuitry so • RAS-only refresh : This is the most common method of refresh. The that it appears to the user as SRAM. row addresses are strobed by asserting RAS while CAS is held high. The cycle must be repeated for every row address. • Some care must be taken to avoid a conflict when the system • CAS-before-RAS refresh : CAS-before-RAS eliminates the need attempts to access the memory while an internal refresh is for external refresh addresses. If CAS is held low, a specified time being done. Two approaches may be included in the design of before RAS is asserted, on-chip refresh circuitry automatically the chip to solve this problem: furnishes the refresh address. This method takes slightly longer  In the first approach, a separate pin may be included to tell the RAM time than RAS-only method. when it can execute a refresh cycle without conflicting with an • Hidden refresh :This refresh is done while maintaining the latest external access request. External logic can pusle this input to refresh valid data at the output and extending CAS and cycling RAS. the chip.  In the second approach, a “ready” or “wait” output from the RAM may be used for handshaking in a system where “wait ” can be COMP2121: Microprocessors and 19 generated. 20 Interfacing ROM Memory ROM Memory Cells

• There are various types of ROM memory chips.  Mask programmable ROM are programmed during the Bit Line Bit Line Bit Line manufacturing stage and cannot be programmed by user.  Other ROM devices are field programmable and may be programmed by the user. These care called programmable read only Word memories., and include UV-erasable PROMs (), one-time Line GateNo Gate Gate programmable (OTP) EPROMs, and fusible-link PROMs.  EPROMs are electrically programmable are erased by irradiating the chip through a quartz window with (UV) light.  An OTP EPROM is an EPROM without the window so that once programmed, it cannot be erased.  Another type of programmable read only memory is the electrically erasable PROM (EEPROM), which can be programmed and erased while in use. ROM cell

COMP2121: Microprocessors and 21 COMP2121: Microprocessors and 22 Interfacing Interfacing

ROM Memory Cells (Cont.) EPROM Memory Cells

• The ROM memory cell is simply a or connection made or not made in the programming process. UV Light to Erase Quartz Window • The binary information is represented by the presence or absence of the gate on the MOS transistor. Source Drain

• Activating the word line puts a one or zero on the bit line. SiO 2 Filed Field Oxide n+ n+ Electrons injected Si Floating Gate to program p-Substrate

EPROM Cell

COMP2121: Microprocessors and 23 COMP2121: Microprocessors and 24 Interfacing Interfacing EPROM Memory Cells (Cont.) EEPROM Memory Cells

• The EPROM cell is a MOS transistor without a connection to the gate. • To program the EPROM, the chip is placed into a PROM and during the programming cycle, the address Control Gate and data are sent to the chip and the programming voltage is Source Drain applied. To change the state of the gate, electrons are either injected by an avalanche mechanism into the floating SiO 2 gate or not. After the programming, the channel between the Filed Oxide Field Oxide n+ n+ source and and the drain either conducts or does not. Electrons injected Si Floating Gate • If the chip needs to be erased, it must be placed into the to program p-Substrate PROM eraser. The ultraviolet light irradiated from the PROM eraser disperses any charge stored in the floating gate back into the substrate and erases the memory. EEPROM Cell

25 COMP2121: Microprocessors and 26 Interfacing

EEPROM Memory

• The EEPROM is a further development of the EPROM. • A second polysilicon gate, called the control gate, is added • Similar to the EEPROM. above the floating gate. • Its drawback is that the entire memory or page must be erased • A control voltage may be applied to the gate to program and where single locations can be erased and reprogrammed in erase the cell by injecting or disperse electrons in the floating the EEPROM devices. gate. • EEPROM can be programmed and erased without removing the chip from the circuit in use. • The time required to write is longer than a comparable RAM chip. • There is a maximum number of times it can be programmed (the industry as of 1993 is 10,000 program/erase cycles). 27 COMP2121: Microprocessors and 28 Interfacing

1. Chapter 9: Computer Memories. and by Fredrick M. Cady 2. http://computer.howstuffworks.com/computer-memory.htm

COMP2121: Microprocessors and 29 Interfacing