Introduction to common memory

memory type

     Memory is an important part of computer architecture. Memory is a component used to store program codes and data, and a computer has a memory function only with memory. The basic memory types are shown in Figure 1.1

     Memory is mainly divided into two categories: "volatile memory" and "non-volatile memory" according to the characteristics of its storage medium. "Volatile/non-volatile" refers to the characteristics of whether the data content stored in the memory will be lost after the power is turned off. Since generally volatile memory has fast access speed and non-volatile memory can store data for a long time, they both play an important role in computers. The most typical representative of volatile memory in computers is memory, and the representative of non-volatile memory is hard disk.

RAM memory

     RAM is the abbreviation of "Random Access Memory", which is translated as random access memory. The so-called "random access" refers to when a message in memory is read or written, the time required is independent of where the information is located. The origin of the word is because early computers used magnetic drums as memory, magnetic drums are sequential read and write devices, and RAM can read data at any address within it, and the time is the same, hence the name. In fact now RAM has been specifically used to refer to volatile semiconductor memory as computer memory. According to the storage mechanism of RAM, it is divided into dynamic random access memory DRAM (Dynamic RAM) and static random access memory SRAM (Static RAM).
              DRAM

      The storage unit of dynamic random access memory (DRAM) represents data by the charge of the capacitor, with charge representing 1 and no charge representing 0, see Figure 23-2. But over time, the capacitor representing 1 will discharge, and the capacitor representing 0 will absorb charge, so it needs regular refresh operation, which is the characteristic described by the term "Dynamic". The refresh operation will check the capacitor. If the power is greater than 1/2 of the full power, it is considered to represent 1, and the capacitor is fully charged; if the power is less than 1/2, it is considered to represent 0, and the capacitor is discharged. to ensure the correctness of the data.

2

            SDRAM

      According to the communication mode of DRAM, it is divided into synchronous and asynchronous. Figure 23-3 is a communication timing synchronized by a clock, which indicates valid data on the rising edge of the clock.

23

       Synchronous DRAM is more widely used because the communication speed using clock synchronization is faster, and this DRAM is called SDRAM (Synchronous DRAM).

          DDR SDRAM

      In order to further improve the communication speed of SDRAM, DDR SDRAM memory (Double Data Rate SDRAM) has been designed. Its storage characteristics are no different from SDRAM, but SDRAM only represents valid data on the rising edge, and can only represent one data in one clock cycle; while DDR SDRAM represents one data on the rising edge and falling edge of the clock. That is to say, 2 bits of data can be represented in 1 clock cycle, and the speed is doubled under the same clock frequency. As for DDRII and DDRIII, there is no difference in their communication methods, mainly because the frequency of the communication synchronization clock is increased. The memory module commonly used in current personal computers is the DDRIII SDRAM memory, which contains multiple DDRIII SDRAM chips on one memory module.

          SHAME

      The memory cells of static random access memory (SRAM) store data with latches, as shown in Figure 23-4. This circuit structure does not require periodic refresh and charging, and can maintain the state (of course, if the power is turned off, the data will still be lost), so this kind of memory is called "static (Static)" RAM.

23

     Similarly, SRAM is also divided into synchronous (SSRAM) and asynchronous SRAM according to its communication method. Relatively speaking, asynchronous SRAM is widely used.

        DRAM and SRAM applications

     Comparing the structure of DRAM and SRAM, it can be seen that the structure of DRAM is much simpler, so to produce the same capacity of memory, the cost of DRAM is lower and the integration is higher. The capacitance structure in DRAM determines that its access speed is not as good as that of SRAM. The characteristics comparison is shown in the table.

4

       Therefore, in practical applications, SRAM is generally only used for the internal cache (Cache) of the CPU, while the externally expanded memory generally uses DRAM. In the controller of the STM32 system, only the STM32F429 or higher chips support extended SDRAM, and other models such as STM32F1, STM32F2 and STM32F407 can only extend SRAM.

non-volatile memory

     There are many types of non-volatile memory, semiconductors include ROM and FLASH, while others include optical disks, floppy disks and mechanical hard disks.

         ROM memory

     ROM is the abbreviation of "Read Only Memory", which means read-only memory. Due to the development of technology, a ROM that can easily write data was designed, and the name "Read Only Memory" has been used, and now it is generally used to refer to non-volatile semiconductor memory, including the FLASH memory introduced later. , some people also put it in the ROM category.

     1. MASK ROM MASK (mask) ROM is the authentic "Read Only Memory". The data stored in it is solidified by a special process at the factory and cannot be modified after production. Its main advantage is the cost of mass production. Low. At present, there are applications where the production volume is large and the data does not need to be modified.

      2. OTPROM OTPROM (One Time Programable ROM) is a one-time programmable memory. This kind of memory has no data inside when it leaves the factory. Users can use a special programmer to write their own data, but it can only be written once. After being written, its content cannot be modified. OTPROM is often used in the controller chip produced by NXP to store the key or the unique mac address of the device.

      3. EPROM EPROM (Erasable Programmable ROM) is a rewritable memory, which solves the problem that the PROM chip can only be written once. This type of memory erases data by irradiating the inside of the chip with ultraviolet light, using dedicated equipment for both erasing and writing. Now this memory is basically obsolete and replaced by EEPROM.

      4. EEPROM EEPROM (Electrically Erasable Programmable ROM) is an electrically erasable memory. EEPROM can be repeatedly erased and written, and its erasing and writing are directly controlled by the circuit, and there is no need to use external devices to erase and write. And data can be modified byte-by-byte without the need for an entire chip erase. Now the main ROM chips used are EEPROM.

            FLASH memory

      FLASH memory, also known as flash memory, is also a rewritable memory. Some books will call FLASH memory FLASH ROM, but its capacity is generally much larger than that of EEPROM, and when erasing, it is usually written in multiple words. Section is the unit. If there is FLASH memory with 4096 bytes as a sector, the minimum erasing unit is one sector. According to the different memory cell circuits, FLASH memory is divided into NOR FLASH and NAND FLASH, see the table.

5

     The commonality between NOR and NAND is that an erase operation is required before data writing, and the erase operation is generally based on "sector/block" units. The difference between the characteristics of NOR and NAND is mainly caused by whether their internal "address/data lines" are separated.

     Since the address line of NOR is separated from the data line, it can read and write data in "bytes", which meets the CPU's instruction decoding and execution requirements. Therefore, if code instructions are stored on NOR, the CPU gives NOR an address, and NOR can write to the CPU. Returns a data for the CPU to execute without additional processing in the middle.

     Since the data and address lines of NAND are shared, data can only be read and written in "blocks". If code instructions are stored on NAND, after the CPU gives the NAND address, it cannot directly return the data of the address, so it does not meet the instruction decoding. Require. The last item in Table 23-2, "Whether XIP is supported" describes this immediate execution feature (eXecute In Place).

     If the code is stored on NAND, it can be loaded into RAM memory before being executed by the CPU. So functionally, it can be considered that NOR is a kind of RAM that does not lose data after a power failure, but its erasing unit is different from that of RAM, and its read and write speed is much slower than that of RAM.

     In addition, the number of erasing of FLASH is limited (now generally about 100,000 times), when its use is close to its life, the write operation may fail. Because NAND is usually erased and written in a whole block, if one bit in the block fails, the entire block will fail, which is called a bad block, and because of the complicated erasing and writing process, there are fewer NOR blocks as a whole and a longer life. Because of the possibility of bad blocks, FLASH memory requires "detection/error correction (EDC/ECC)" algorithms to ensure data correctness.

     Due to the difference in the characteristics of the two FLASH memories, NOR FLASH is generally used in code storage occasions, such as the program storage space inside the embedded controller. NAND FLASH is generally used in large data storage occasions, including SD cards, U disks and solid-state drives, etc., which are all NAND FLASH types.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325167756&siteId=291194637