Dispositivos de memória para sistemas digitais – DE Parte 21

Memory devices for digital systems – DE Part 21

In previous tutorials, we learned that sequential circuits require memory elements to retain previous states of a digital system. Flip-flops and registers were then introduced as memory building blocks in a sequential circuit. Registers are sufficient to store runtime data in small microcontrollers and ASICs. Complex computing systems require digital memory not only to store runtime information (as stored by registers in a microcontroller), but to store programs and data permanently within the digital system. Therefore, they require internal or external dedicated memory.

A memory is defined as a device that can store binary information to be accessed when needed for processing. After processing, the final results can be stored back into memory. Digital systems can be 8-bit, 16-bit, 32-bit, 64-bit, and so on. 8-bit, 16-bit, 32-bit, and 64-bit systems store data as 8-bit, 16-bit, 32-bit, and 64-bit words, respectively. Memory size is expressed in bytes, kilo bytes, mega bytes, giga bytes, and so on. Any memory is divided into building blocks called cells. Each cell is identified by a unique address that ranges from 0 to the number of cells minus one. Depending on the type of digital system, i.e. 8-bit, 16-bit, 32-bit or 64-bit, cells in memory can be 8-bit, 16-bit, 32-bit, 64-bit in length.

Memory in a digital system can be used to store programs and data permanently or to store a program's data and instructions temporarily during the runtime of a program or application. Most digital systems require memory resources for temporary and permanent storage of data and programs to run their intended applications. In some digital systems, memory may be used only to hold data while it is transferred from an input device to an output device.

The categorization of digital memory is usually done in the context of desktop and server computing systems. Based on the location and usage of memories (in desktop and server systems), there are three types of memories –

1) Cache Memory

2) Main Memory

3) Secondary Memory

Cache memory

Cache memory is high-speed semiconductor memory integrated into the processor chip or interconnected to the processor via a separate bus. The CPU or processor can access data from cache memory faster compared to main memory. The cache is usually a group of semiconductor registers or static random access memory. In microcontrollers and small microprocessors, a group of a few registers can serve in a similar way to cache memory.

The cache is used to store data and instructions that are used repeatedly by the processor in executing a program, or data and instructions that may be needed next by the processor. Since cache memory is high-speed memory that is integrated or closely interconnected with the processor, i.e., it is closer to the processor, it helps to increase the overall speed of program execution.

Cache memory is faster than main memory and can be accessed in less time compared to the main memory of any digital system. Since cache memory is very expensive and limited in size, it is only used for storing temporary data and runtime instructions that must be executed immediately in a short period of time.

Most desktop and server processors have multi-layer or multi-level cache memory. Depending on proximity and accessibility, these levels are categorized as follows –

1) L1 Cache – Level 1 or Primary Cache is the fastest cache and closest to the processor, always incorporated into the processor chip.

2) L2 cache – The level 2 or secondary cache is generally larger in size than the L1 cache. It is either embedded in the processor chip or connected to the processor via a dedicated interconnect bus. It is used when the L1 cache is consumed by runtime data.

3 )L3 Cache – Level 3 is a cache memory that is faster than RAM (primary memory), but significantly slower than L2 cache. It is designed to keep track of L1 and L2 cache memories when running large programs. In multi-core processors, each core usually has individual L1 and L2 cache and shares a common L3 cache. Nowadays, most processor chips have L1, L2 and L3 cache integrated into the processor chip itself.

4) Specialized caches – A digital computing system can have different specialized caches. As there can be disk captures to store and quickly access frequently used data. There may be specialized captures for specific applications such as browsers, network address binding, databases, etc.

Imagem típica de memória cache externa

Figure 1: Typical external cache image

Main memory

Main memory is external memory used to store data, programs, or the operating system that a computing system is currently running. It also has limited capacity, but significantly large compared to cache memories. Just like cache memories are usually a few kilobytes or megabytes, while main memory is usually in gigabytes. Main memory is again semiconductor memory but it is slower compared to registers. It is a volatile memory and the data stored/loaded in it is lost when the power is turned off. Main memory, also called primary memory, is classified as RAM (Random Access Memory) and ROM (Read Only Memory).

Imagem típica de Memórias Primárias – RAM e ROM

Figure 2: Typical image of primary memories – RAM and ROM

Secondary memory

Secondary memory is external memory used for permanent storage of data and programs. They are optical memories (CD, DVD or Blu-Ray Discs) or magnetic memories (Hard Disks) which are non-volatile memories and can retain the data stored in them even when they are not connected. Any processor accesses these memories through input and output routines. The data (operating system files, data and programs) stored in these memories are first read and loaded into primary memory (RAM) and then read by the processor from primary memory. Optical disks can store data up to a few gigabytes, while magnetic disks with terabyte capacities are available.

Imagem típica de memórias secundárias, como discos rígidos

Figure 3: Typical image of secondary memories such as hard drives

Semiconductor, optical and magnetic memories

Based on construction, memories can be classified as semiconductor, optical, and magnetic memories. Semiconductor memories are built on silicon wafers using LSI, VLSI or ULSI technologies. They are similar to digital ICs that have logic gates used in their construction, except that they are built explicitly just to store data. Cache memory, Flash memories and primary memories (RAM and ROM) are semiconductor memories.

Optical memories store data on an optically readable medium. CD, DVD and Blu-Ray Discs are popular examples of optical memories. Data is written to and read from optical memories with the help of optical disk drives by focusing laser light onto a rotating optical disk. Compact discs (CDs) can store data up to 700 MB. Single-layer DVDs can store 4.7GB of data, while dual-layer DVDs can store 8.5GB of data. HD DVDs can store 15 GB of data on a single layer and 30 GB on a dual layer. Single-layer Blu-ray discs can store 25GB of data, while dual-layer Blu-ray discs can store 50GB of data. Four-layer Blu-rays can store 128GB of data.

Magnetic memories store data in a magnetized medium. Data is stored and read from the magnetic memory using the read/write head, where the data is stored permanently on the disk as magnetic patterns. The most commonly used magnetic memory is hard drives. Its capacity can vary from gigabytes to terabytes. Other examples of magnetic memories are floppy disks, magnetic strips and magnetic recording tapes (audio tapes) which are no longer obsolete.

Volatile and non-volatile memory

Volatile memory is a type of memory that loses stored data when power to the memory circuit is cut. Cache memory and RAM are volatile memories. Non-volatile memory retains stored data permanently even after the power supply is turned off. ROM, Flash memories and secondary memory devices, whether optical or magnetic, are all non-volatile memories.

Static and Dynamic (Volatile) Memories

In volatile memories like RAM, data is retained by the memory device until power is available to the memory device. Volatile memory can again be of static or dynamic type. In volatile static memory, data remains stored in memory until power is available, without any need to refresh or rewrite data periodically. Registers, static RAM, and punched cards are volatile static memories.

In volatile dynamic memory, data does not remain stored permanently; instead, they need to be rewritten periodically despite continuous power supply. Dynamic memory uses the capacitance of a transistor as a storage device. Only one transistor is needed to store one bit of information. The capacitor must be refreshed periodically without being discharged to avoid loss of information. Dynamic RAM and circulating registers using CCD (Charge Coupled Devices) are examples of dynamic volatile memories.

Sequential access and random access memories

Memory devices can also be classified based on access method. Based on the access method, memory devices can be classified as sequential access memories and random access memories. In a sequential access memory, a given memory location is accessed sequentially, i.e., any memory location is accessed only after sequencing the previous memory locations. Therefore, the access time of a sequential memory varies depending on the location to be accessed. ROM and secondary storage devices such as hard drives and optical disks are sequential access memories.

On the other hand, in random access memory, any memory location can be accessed randomly and therefore always has equal access time for all memory locations. Cache and RAM (Random Access Memory) are examples of random access memories.

Virtual memory

Virtual memory is a memory management technique that allows the temporary transfer of runtime data from RAM to secondary storage (hard disk) to make up for a shortage of primary memory (RAM) when running large programs. In this way, an extremely large virtual memory is available to the programmer, despite the smaller size of the available physical memory. This technique is implemented by the operating system where the operating system forms contiguous addresses between RAM and virtual memory allocated on the hard disk to store active runtime data in RAM and inactive runtime data on the hard disk. In the following situations, it is not necessary for the entire program to be fully loaded into main memory (RAM) and hence virtual memory can be used –

  • User-written error handling routines are used only when an error occurs in the data or computation.
  • Certain options and features of a program may be used rarely.
  • Many tables are assigned a fixed amount of address space, even though only a small portion of the table is actually used.
  • The ability to run a program that is only partially in memory would counter many benefits.
  • Less I/O would be required to load or swap each user program into memory.
  • A program would no longer be limited by the amount of physical memory available.
  • Each user program can take up less physical memory; More programs could be run at the same time, with a corresponding increase in CPU utilization and throughput.

Computing systems (microcontrollers, daughterboards and motherboards) depend mainly on semiconductor memories (cache, RAM and ROM) to execute programs. In the next tutorial, RAM and ROM will be discussed in detail.

Related Content

Back to blog

Leave a comment

Please note, comments need to be approved before they are published.