DIGITAL MEMORIES
Digital memories are semiconductor circuits that store binary data. You have probably heard of the terms RAM and ROM as they apply to personal computers. These are the two main types of memory, random access memory (RAM), and read-only memory (ROM).
RAM
The random access memory is one in which you can access hundreds, thou- sands, or millions of binary storage locations. You can store one binary number or word in each location or read the data out of the location. Each location is referred to by a unique binary number called the address. You send the memory an address and activate the selected location. Then you can read data from the location or write data into that location. RAMs therefore are what we call read-write memories.
Figure 5.22 shows the concept of a RAM. It has eight locations for 4-bit words. To address eight locations you need a 3-bit address (23 = 8). When you apply the address to the address decoder, the decoder activates the desired location. In the figure you see that the binary number 1001 stored in location 011 is being accessed and read out.
Most memories are large today. We talk about megabytes (MB) or millions of bytes of data or gigabytes (GB) or billions of bytes of data in a modern PC. Embedded controllers will have fewer locations, usually in the thousands of bytes (KB) or perhaps more in the larger systems. Storage word sizes are usually 8 (bytes), 16, 32, or 64 bits.
There are two ways to make a RAM. The first way is just to build one FF for each bit to be stored. The basic set-reset FF described earlier is the basic storage circuit (see Figure 5.23A ). Memories using this type of circuit are called static RAM or SRAM. They are called static because once you store the bit in the FF, it stays there as long as power is applied to the circuit.
The other form of RAM is called dynamic RAM or DRAM. The basic storage circuit is a capacitor as shown in Figure 5.23B. If you charge the capacitor, it is storing a binary 1. If the capacitor is discharged, a binary 0 is being stored. A MOSFET is used as a switch to access the capacitor. If the MOSFET is turned on by an input address on the gate, it connects the capacitor to the data line, where it may be read out or where a new bit may be stored. When the MOSFET is turned off, the capacitor is isolated and just stores the bit.
The reason why the termdynamic is used for this type of RAM is that the charge on the capacitor will leak off very quickly. The capacitor is very small and millions of them are made on a tiny chip of silicon. For this reason, the capacitor has to be recharged every so often so that the data is retained. This is called a refresh operation and it usually occurs every 2 milliseconds or so.
Comparing SRAM and DRAM, you should know that SRAM is the faster of the two in that you can store data or read data out faster than you can with a
DRAM. The downside is that the SRAM is more complex and takes up more space on the chip, and thus costs more. The DRAM is slower but not much. Its advantage is that you can put more storage cells on a chip, making them cheaper. The need to refresh is a downside but easy to live with, as all the refresh circuitry is on the chip and the process is transparent to the user.
Just keep in mind a key fact. RAM is fast and reliable, but it loses all data if the DC power to the memory circuit is removed. All data is erased. RAMs are therefore said to be volatile.
ROM
Read-only memories are nonvolatile memories. Once you store data in them, they retain the data when power is removed. In some ROMs, you can change the data stored there. Incidentally, all ROMs are random access in that you can go to any desired location to read or maybe write data.
There are several categories of ROM. The older types are called masked ROM, where the mask refers to the actual wiring of the ROM to permanently fix the data in the circuitry when it is made. The storage cells are essentially a MOSFET matrix where each MOSFET is permanently turned on or off to store 1 or 0. No changes are possible. Later a programmable ROM or PROM was developed. It used a special MOSFET that could be programmed on or off. You could then erase the programming by shining ultraviolet (UV) light Address line (used to select the bit)
on the chip for a short time. Then the PROM could be reprogrammed. These are no longer used.
Most ROMs today are what we call electrically erasable programmable ROMs or EEPROMs or E2 PROMs. The storage element is a MOSFET that you turn off or on with a programmable voltage (see Figure 5.24 ). The MOSFET retains that state until it is electrically changed.
The main problem with EEPROMs is that they are slow to erase and repro- gram. But today we have a special version of EEPROMs called flash memories. These are also EEPROMs, but they actually are almost as fast as RAMs for reading and writing data. Yet they are nonvolatile.
You will hear of two types of flash memory—NOR and NAND. NOR flash is used to store programs for microcontrollers. It can only be erased on large block sizes and not individual cells. NAND flash is faster and you can erase individual memory locations. The NAND flash is gradually replacing the NOR flash in many applications.
Flash memory has become so popular it is used in almost every electronic product today. MP3 players and iPods store music in flash memory. Cell phones store phone numbers, digital cameras store photos, and in embedded controllers, the flash usually stores the program that tells the processor what to do. And, let’s not forget the flash drive or “thumb” drive as it is called. These devices with a USB connector can store many gigabytes of data and are very inexpensive. Flash memory is also used to make solid-state drives (SSDs) that are the equivalent of the hard disk drives used in PCs and laptops. They are still expensive, but as prices decline, you can look for more SSDs to replace conventional mechanical/magnetic hard drives