What is the Difference Between RAM and ROM?

RAM and ROM are both types of computer memory used to store data, code, and other information that is used by the CPU to operate in real time. Embedded systems include both of these types of memory to perform certain tasks, each with their own individual purpose, advantages, and disadvantages. In this article, we’ll provide background into RAM and ROM and discuss their main differences.

What is RAM

RAM, or random access memory, is a type of storage for computer systems that is used to store data and programs that can be quickly accessed at any time by the device’s processor. It is considered the main memory in a computer and is often much faster to read and write to than other kinds of storage, like a hard drive.

RAM chips

RAM is a type of volatile memory, which means that the data stored in its memory is lost when power is removed. Because of this, RAM is essentially used as a computer’s short-term memory. RAM temporarily stores data and other information and allows for quick data access as the computer is up and running.

Different Types of RAM

Two types of RAM that are used most often in embedded systems include Static RAM (SRAM) and Dynamic RAM (DRAM).

DRAM

With DRAM, data is stored in capacitors. Even if the supply voltage is maintained, capacitors that store data gradually discharge energy due to leakage, which causes loss of data. In order to prevent this, a power refresh is performed periodically. Its need for constant change or a refresh is why this type of RAM is considered “dynamic”. DRAM is often implemented as a main memory.

SDRAM, or synchronous DRAM, is type of DRAM that is synchronized with the clock speed that the microprocessor is optimized for. This does increase the quantity of instructions that a processor can perform in a given time.

Advantages of DRAM include low costs of manufacturing and greater memory capacities, while disadvantages include slow access speed and high-power consumption.

SRAM

With SRAM, on the other hand, data is stored in transistors in a cross-coupled flip-flop configuration that does not incur any leakage in energy. It requires constant power to operate, but it require refreshing to keep the data intact. This alludes to its name, where its “static” nature doesn’t require change or refreshes, unlike DRAM. SRAM is often used as a cache memory for processors.

The advantages of SRAM include low power consumption and faster access speeds. Disadvantages include less memory capacities and high costs of manufacturing.

What is ROM

ROM, or ready-only memory, is a non-volatile storage medium that permanently stores data and does not need constant power to retain the data on the device. ROM is often used during the startup process of computer, and is used for software (code and data) that will not be changed, such as in embedded control programs.

Different Types of ROM

There are various different types of ROM, including PROM, EPROM, and EEPROM.

PROM

PROM, or programmable read-only memory, can be programmed by the user once after creation. The process of programming a PROM is often called burning the PROM where users "blow" the fuses, which is an irreversible process. Therefore, the information programmed is permanent and cannot be erased. Users would need to replace the entire chip if new code or data is needed.

EPROM

EPROM, or erasable programmable read-only memory, can be erased and programmed by exposing the chip to ultra-violet light. To reprogram the device, it is necessary to erase all the previous data then rewrite the data.

EEPROM

EEPROM, or electrically erasable programmable read-only memory, is a memory that can be erased and programmed using electrical charge. It is possible to erase selected portions of the chip one byte as a time, instead of needing to erase the entire chip. This allows for flexibility, but can be a slower process.

EEPROM chip

Flash memory is a type of EEPROM that can be erased and rewritten more quickly than a regular EEPROM device. This is because Flash devices support large-block erasures. Newer Flash memory designs also support greater write cycles exceeding 1,000,000 cycles.

Differences Between RAM and ROM

Data Retention

Like mentioned earlier, RAM and ROM differ significantly in their data retention capabilities. ROM is non-volatile, so it is able to retain data without power, while RAM is volatile, which means it retains data as long as the computer is powered. Essentially, ROM is used for permanent storage and RAM is used for temporary storage.

Storage Capacity

A ROM chip can store several megabytes (MB) of data, ranging from 4 to 8 MB per chip. A RAM chip, however, can store much more data, ranging from 1 to 256 gigabytes (GB) per chip. Computers these days often use around 16 GB to 32 GB of RAM.

Speed

Data accessing speeds and writing speeds are both superior in RAM. In terms of storage read speeds, ROM does this at a rate of a few MBs/second, whereas the read speed of RAM is a few GBs/second. With faster data access/read speeds, RAM boosts the processing speed of the computer. RAM is also faster and easier to write to than ROM. This is because ROM typically stores limited but long-lasting information and is more difficult to alter, with the exception of EEPROMs.

Programming EEPROM and Flash Memory using Total Phase Tools

Total Phase offers a selection of host adapter tools that allow engineers to easily and quickly program data onto I2C and SPI EEPROM and Flash memory devices that are used within their own embedded developments.

The Aardvark I2C/SPI Host Adapter is Total Phase’s general-purpose host adapter that can be used as an I2C or SPI master or slave device. As an I2C master and slave, it can support up to 800 kHz, as an SPI master it can support up to 8 MHz, and 4 MHz as an SPI slave.

The Cheetah SPI Host Adapter was designed as a high-speed programming device. It can quickly program SPI-based EEPROMs and Flash memory. As an SPI master, it can signal up to 40 MHz.

The Promira Serial Platform is Total Phase’s most advanced serial device. With its FPGA-based platform, users can select from a range of I2C and SPI applications that provide varying levels of speeds and other functionalities to fit a variety of project requirements. As an I2C device, users can signal up to 3.4 MHz as a master or slave; as an SPI device, users can signal up to 80 MHz as a master and 20 MHz as a slave.

If you have any questions on which host adapter is best for your programming requirements, please email us at sales@totalphase.com.