What are RAM vs ROM vs Flash Memory?

ROM and RAM belong to the semiconductor memory. ROM is the abbreviation of read only memory, and RAM is the abbreviation of random access memory. ROM can keep data when the system powers off, and RAM is in the opposite, a typical RAM is the computer memory. But sometimes we are not clear: what is the difference between Flash Memory and ROM and RAM?

How much do you really know about memory, or RAM, ROM, and flash memory specifically? Here we will tell them in different aspects, this article will act as a guide to basic memories.

I What are types of RAM?

1.1 Static RAM (SRAM)

SRAM is very fast and the fastest storage device to read and write currently, but it is also very expensive, so it is only used in demanding places, such as the first and second level buffer of CPU.

1.2 Dynamic RAM (DRAM)

DRAM keeps data for a short time and its operation is slower than the SRAM, but it's still faster than the ROM. In addition, it's much cheaper than SRAM. The computer memory is DRAM. DRAM is divided into many kinds, the most common ones are FPRAM / FastPage, EDORAM, SDRAM, DDR, RAM, RDRAM, SGRAM, WRAM and so on. DDR RAM, one of which is introduced here.

DDR RAM (Double-Date-Rate RAM), also known as DDR SDRAM, the improved RAM and SDRAM, are essentially the same, except that they can read and write data twice in one clock, doubling the speed of data transmission.

This is the most used memory in a computer today, and it has a cost advantage, which in fact defeats another Intel memory~ Rambus DRAM.

Many high-end graphics cards are also equipped with high-speed DDR RAM to increase bandwidth, which can greatly improve the pixel rendering capability of 3D accelerator cards.


II What are types of ROM?

  1. PROM (programmable ROM), is programmed once that can not be modified, this is an early product, now it is gone.

  2. EPROM (erasable and programmable ROM), is a kind of universal memory which erases the original program by ultraviolet radiation.

  3. EEPROM, is electronically erased, very expensive, long writing time. For example, mobile phone software is generally placed in the EEPROM, when we call, some of the last numbers that are dialed are temporarily in the SRAM, but not immediately written in the call log (the call record is stored in the EEPROM).


Memory is used to storage data and programs that are currently in use (that is in execution), and the memory of the computer we normally used refers to dynamic memory (that is DRAM).

The so-called "dynamic" in dynamic memory refers to when we write data to the DRAM, after a period of time, the data will be lost, so we need an extra circuit to refresh the memory.

It works like this: whether a DRAM's memory cell stores 0 or 1 depends on whether the capacitor has a charge. 1 represents a charge, 0 represents no charge.

But over time, the capacitance of 1 will discharge, and the capacitance of 0 will absorb the charge, which is why the data is lost.

Taking refresh operation regularly checks the capacitor, if the charge is greater than 1/2 of the full charge, it is considered to represent 1, charging the capacitor fully; If the quantity of electricity is less than 1/2, it is considered to represent 0, and the capacitor is discharged to maintain the continuity of the data.


III What is Flash Memory?

Flash memory combines the advantages of ROM and RAM. It not only has the electrically erasable and programmable capability (EEPROM), but also can read data quickly without power loss (the advantage of NVRAM). This memory is used in USB  and MP3. For the past 20 years, embedded systems have been using ROM (EPROM) as their storage device. However, in recent years, FLASH has completely replaced the position of ROM (EPROM) in embedded systems to store Bootloader and operating systems, or Program code or directly as the hard disk (U disk).

At present, there are two kinds of NOR Flash and NAND Flash. NOR Flash reading is the same as the common SDRAM reading. Users can run the code loaded in NOR FLASH directly, which reduces the capacity of the SRAM and saves cost. NAND Flash doesn’t have memory random read technique, which reads in the form of a block at a time, usually 512 bytes at a time, thus it is cheaper. Users cannot run program code on NAND directly, so many developers using NAND have to use a small NOR Flash to startup and run code. NOR Flash, is generally used in small capacity because of its fast reading speed, and it is used to store important information such as operating system. The most common NAND FLASH used for large capacity, combines with embedded system DOC (Disk On Chip) and common "flash disk", which can be erased online.

At present, the FLASH on the market mainly comes from Intel, AMD, Fujitsu and Toshiba, and the main manufacturers of NAND Flash are Samsung and Toshiba.

NOR and NAND are the two main non-volatile flash memory technologies in the market.

Memory IC

Intel first developed NOR flash technology in 1988, which completely changed the situation in which EPROM and EEPROM dominated the world. Then, in 1989, Toshiba published its NAND flash architecture, emphasizing lower cost per bit, higher performance, and easy upgrades via interfaces like disks. But after more than a decade, a considerable number of hardware engineers still can not distinguish between NOR and NAND flash memory.

Flash memory is often used interchangeably with phase NOR memory.

Many in the industry are also confused about the advantages of NAND flash over NOR, because in most cases flash memory is only used to store a small amount of code, and NOR flash memory may be more appropriate, while NAND is an ideal solution for data needed high storage density.

NOR is the main non-volatile flash memory technology in the market. NOR is generally used to store a small amount of code, especially in code storage media. NOR is characterized by simple application, no special interface circuit, high transmission efficiency, it belongs to the in-chip execution(XIP, eXecute In Place), so that applications can run directly in (NOR) flash memory. No longer need to read the code into the system RAM. Low write and erase speed can be very cost-effective but affect its performance for small capacity when it is 1~4MB.

NOR flash comes with an SRAM interface and has enough address pins to access, it is convenient to storage and use each byte. NOR flash accounts for the majority of the 1~16MB flash market. NAND structure can provide extremely high cell density and high storage density, and fast write and erase speed. The difficulty of applying NAND lies in the management of flash and the need of special system interface.

3.1 Performance Comparison

Flash memory is non-volatile memory and can be erased and reprogrammed on memory cell block.

The write operation of any flash device can only be done in an empty or erased cell, so in most cases, the erasure must be performed before the writing. In general, the NAND devices perform the erasure operation easily. But NOR requires that all bits in the target block be written as 1 before erasing.

Since the NOR device is erased as a block of 64~128KB, the time to perform a write / erase operation is 5s. In contrast, the erasure NAND device is performed as a block of 8~32KB, and the same operation only needs 4 ms at most.

The performance gap between NOR and NADN is further widened by the difference of block size in the execution of erasure. It is shown that for a given set of write operations (especially when updating small files), more erasure operations must be performed in NOR based cells. Therefore, when choosing a storage solution, the designer must weigh the following factors:

  1. The read speed of NOR is a little faster than NAND, but the writing speed is on the opposite.

  2. The 4ms erasure speed of NAND is much faster than that of NOR. Most writing operation need running erasure.

  3. The NAND erasure unit is smaller and the corresponding erasure circuit is less.

3.2 Interface Difference

NOR flash has a SRAM interface, and enough address pins to address, and easy storage and program to every byte inside. NAND devices use complex I/O ports to serially access data, which may vary from product to product or from manufacturer to manufacturer. Eight pins are used to transmit and control address and data information.

NAND read and write operations use 512-byte blocks, which is similar to the hard disk management. Naturally, NAND based memory can replace hard drives or other block devices.

3.3 Capacity and Cost

The cell size of NAND flash is almost half that of NOR devices. Because of the simpler manufacturing process, the NAND structure can provide higher capacity within a given die size, thus lowering the price accordingly.

NOR flash accounts for most of the 1~16MB flash market, while NAND flash is only used in 8~128MB products, which means that NOR is mainly used in code storage, and NAND is suitable for data storage, mainly used in CompactFlash, Secure Digital, PC Cards and MMC memory cards.

3.4 Reliability and Durability

One of the key issues needed to consider is reliability when using flahs media. For systems that need to extend MTBF, Flash is a very suitable storage solution. So the reliability of NOR and NAND can be compared between bit switching, lifetime (durability) and bad block processing.

- Service Life

The maximum number of erasures per block in NAND flash memory is one million times, while that of NOR is 100,000 times. In addition, NAND memory has the advantage of 10: 1 erasure speed, 8 times smaller than that of the NOR device, and each NAND memory block has fewer deletions at a given time.

- Bit Switching

All flash devices are plagued by bit switching. In some cases (rarely, NAND occurs more often than NOR), a bit reverses or its reversion is reported. One changing bit may not be obvious, but if it happens on a critical file, this minor failure could cause the system to shut down. If existing wrong report, it may be solved by reading it a few more times. Of course, if the bit really changes, the error detection / error correction (EDC/ECC) algorithm must be used.

The problem of bit inversion is more common in NAND flash memory, therefore, it is  recommended that using NAND flash memory and EDC/ECC algorithm at the same time. But this problem is not fatal when storing multimedia information in NAND. Of course, if you use a local storage device to store an operating system, configuration file, or other sensitive information, you must use the EDC/ECC system to ensure reliability.

- Bad Block Processing

The bad blocks in NAND devices are randomly distributed. There have been previous efforts to eliminate bad blocks, but they found that the yield is too low and the cost is too high.

The NAND device needs to initialize the medium to detect the bad block and mark it. In the fabricated devices, the failure rate will be high if this treatment cannot be carried out by a reliable method.

3.5 Simple Operation

NOR-based flash memory can be used very directly, can be connected as other memory, and can run code directly on it.

NAND is much more complex because of the need for an I / O interface. Access methods for various NAND devices vary from manufacturer to manufacturer. When using NAND devices, you must write to the driver before doing anything else. Writing information to NAND devices requires that designers don’t write to bad blocks, which means virtual mapping is necessary all the time on NAND devices.

3.6 Software Support

When discussing software support, a distinction should be made between basic read / write / erasing operations and higher-level software for disk emulation and algorithms of flash management, also including the performance optimization.

Running code on a NOR device doesn't require any software support. But using a NAND device, you usually need a driver, that is MTD(Memory Technology Driver). Both NAND and NOR devices need MTD when writing and erasing operations.

NOR devices requires less MTD, because many vendors offer more advanced software for NOR devices, including M-System 's TrueFFS driver, which is used by manufacturers such as Wind River System, Microsoft, QNX Software System, Symbian and Intel.

It also used to simulate DiskOnChip products and manage the NAND flash memory, including error correction, bad block handling, and loss balancing.

The main manufacturers of NOR FLASH is INTEL and MICRO, used to be the mainstream of FLASH products, but its market share now squeezed by NAND FLASH. Its advantage is that it can run programs directly from FLASH, but the process is complex, thus it is expensive.

NAND FLASH's main suppliers are SAMSUNG and Toshiba, and it widely used in USB drives, memory cards, and MP3 players. With different processes, it has larger storage capacity and is cheaper than the NOR FLASH. But also has the drawback, is unable to address runs the program directly, only used to store the data. In addition, NAND FLASH is very prone to bad blocks, so it is necessary to detect it by the related algorithm. 

NAND FLASH is used to store data and programs in laptops, but it must be started with NOR FLASH. In addition to SAMSUNG processors, other mainstream processors for laptops do not support NAND FLASH startup directly. Therefore, you must start the machine with a small piece of NOR FLASH, and run OS and other software through the NAND FLASH load into SDRAM.

IV Conclusion

The DRAM uses the charge on the gate capacitor of the MOS transistor to store the information. Once the power is down, all the information will be lost. Because the grid will leak, it needs refresh operation to replenish the charge on these gate capacitors regularly. And every time the data is read out, it requires running the same work. This is called dynamic refresh, so it is called dynamic RAM. Because it uses only one MOS to store information, it can be highly integrated and can do a lot of work.

SRAM uses registers to store information, so once the power is down, the data will be lost. But when the power supply, its data will always exist without the need for dynamic refresh, thus it is called static RAM. The above is mainly used in the system with large capacity, do not need to recover data through refresh operation.

Flash ROM uses the capacitor on the floating gate to store the charge to store the information, because the floating gate does not leak, so the information can still be saved after the power is off. Also because of its simple mechanism, it can be integrated highly, and the capacity can be very large.

Flash rom needs to be erased by electricity before writing, but in different approach of erasure, EEPROM can be erased in bytes, and flash rom can only be done in sector. However, it can be written in byte units, mainly used for bios, U disk and Mp3 devices that require large capacity and data storage when power is down.