Semiconductor device and wear leveling method

The semiconductor device uses flags to relocate data in NOR/NAND flash memory based on error frequency, addressing complex configurations and data errors, ensuring reliable storage by moving data to error-free sectors.

JP7550895B2Active Publication Date: 2024-09-13WINBOND ELECTRONICS CORP
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
JP2023014436
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Filing Date
2023-02-02
Publication Date
2024-09-13
Estimated Expiration
2043-02-02

AI Technical Summary

Technical Problem

Conventional wear leveling methods for NOR/NAND flash memory require counters to equalize access frequencies, leading to complex configurations and inability to accurately determine memory cell deterioration, resulting in potential data errors, especially for critical data like boot data.

Method used

A semiconductor device with flags indicating bit correction and data storage status in each sector, moving data to sectors without errors to maintain reliability, using algorithms to select replacement sectors based on error frequency and availability.

Benefits of technology

This approach minimizes errors in critical data by relocating it to error-free sectors, enhancing data reliability and extending the lifespan of flash memory.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007550895000005
    Figure 0007550895000005
  • Figure 0007550895000011
    Figure 0007550895000011
  • Figure 0007550895000003
    Figure 0007550895000003
Patent Text Reader

Abstract

To provide a semiconductor device which improves reliability of data stored in a memory cell array.SOLUTION: A wear-leveling method of a flash memory includes setting areas for storing, in each of a plurality of sectors of a memory cell array, an ECC flag indicating whether bit correction due to ECC has occurred or not, and a boot flag indicating whether boot data has been stored or not, and when bit correction due to ECC has occurred during reading of boot data from a sector to which a boot flag has been set, setting the ECC of the sector, writes the read boot data to another sector where the ECC flag has not been set, and setting the boot flag of another sector.SELECTED DRAWING: Figure 1
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present invention relates to a semiconductor memory device such as a NOR type flash memory or a NAND type flash memory, and more particularly to wear leveling of a memory cell array. [Background technology]

[0002] In NAND / NOR flash memories, when the number of program / erase cycles increases, Gm (transconductance) deteriorates, eventually degrading the endurance characteristics (number of times data can be rewritten) and data retention characteristics. One countermeasure is wear leveling, which equalizes the number of rewrites of memory cells and extends their lifespan. For example, a host system monitors the usage of a specific block or sector, and dynamically adjusts the blocks or sectors to be used so that program / erase is not concentrated on a specific block or sector, or counts the number of accesses to each block or sector, and selects the blocks or sectors to be used so that the number of accesses is equalized (e.g., Patent Documents 1 and 2). [Prior art documents] [Patent documents]

[0003] [Patent Document 1] Special table number 2014-524609 [Patent Document 2] Special table number 2017-538206 Summary of the Invention [Problem to be solved by the invention]

[0004] Conventional wear leveling in NOR / NAND flash memories involves the host system or a controller in the flash memory using a counter or other device to count the number of times a block or sector is accessed, and then equalizing the number of rewrites based on the count results. However, this method requires the inclusion of a counter, making the configuration complicated.

[0005] Furthermore, even if the number of accesses is equalized, the deterioration state of the memory cells cannot be determined from the number of accesses. Even blocks or sectors with a low number of accesses may have deteriorated memory cells, and the use of such blocks or sectors may cause data errors when reading or programming. In particular, when reading boot data for system operation, it is necessary to avoid errors as much as possible. Therefore, a wear leveling method that replaces the conventional monitoring of blocks or sectors based on the number of accesses is desired.

[0006] The present invention has been made to solve the above-mentioned problems in the prior art, and has an object to provide a semiconductor device and a wear leveling method that improve the reliability of data stored in a memory cell array. [Means for solving the problem]

[0007] A wear leveling method according to the present invention is for a semiconductor device including a memory cell array, and includes setting an area in each of a plurality of sectors of the memory cell array for storing a first flag indicating whether a bit correction has occurred and a second flag indicating whether specific data is stored, and when a bit correction occurs while reading the specific data from a sector in which the second flag is set, setting the first flag of that sector, writing the specific data that has been read to another sector in which the first flag is not set, and setting the second flag of the other sector.

[0008] The wear leveling method of the present invention is for a semiconductor device including a memory cell array, and includes setting an area for storing a first flag indicating whether a bit correction has occurred and a second flag indicating whether specific data is stored in each of a plurality of sectors of the memory cell array, and when updating the specific data in a sector in which the second flag is set, writing the specific data for update to another sector in which the first flag is not set, and setting the second flag of the other sector.

[0009] In one embodiment, the other sector is a sector in which the second flag is not set. In one embodiment, the other sector is a sector in the same column as the sector in which the bit correction occurred. In one embodiment, one sector is selected as the other sector from among a plurality of sectors in which the first flag is not set according to a predetermined algorithm. In one embodiment, the other sector is a sector in which data has not been written by a user. In one embodiment, when the first flags of all other sectors in the same column are set, the first flag of the sector selected according to a predetermined algorithm is reset. In one embodiment, the predetermined algorithm is the sector in which the first flag is set first among all the other sectors. In one embodiment, the specific data is boot data. In one aspect, each of the plurality of sectors further includes a third flag for selecting the first algorithm or the second algorithm, the first algorithm precluding selection of the other sector from among sectors with a high frequency of bit corrections and the second algorithm enabling selection of the other sector from among sectors with a low frequency of bit corrections, the first algorithm being selected when the third flag is set or reset, and the second algorithm being selected when the third flag is reset or set. In one aspect, the first algorithm and the second algorithm are selectively enabled or disabled by a register setting.

[0010] The semiconductor device of the present invention comprises a memory cell array that stores, in each of a plurality of sectors, a first flag indicating whether a bit correction has occurred and a second flag indicating whether specific data is stored, and memory management means that, when a bit correction occurs while reading the specific data from a sector in which the second flag is set, sets the first flag of the sector, writes the read specific data to another sector in which the first flag is not set, and sets the second flag of the other sector.

[0011] The semiconductor device of the present invention has a memory cell array that stores, in each of a plurality of sectors, a first flag indicating whether or not a bit correction has occurred and a second flag indicating whether or not specific data is stored, and memory management means that, when updating the specific data in a sector in which the second flag is set, writes the specific data for update to another sector in which the first flag is not set and sets the second flag of the other sector.

[0012] In one embodiment, the memory management means selects, as the other sector, a sector in the same column as the sector in which the bit correction occurred. In one embodiment, the memory management means selects, as the other sector, one sector from among a plurality of sectors in which the first flag is not set according to a predetermined algorithm. In one embodiment, the memory management means selects, as the other sector, a sector in which data has not been written by a user. In one embodiment, the memory management means resets the first flag of the sector selected according to a predetermined algorithm when the first flags of all other sectors in the same column are set. In one embodiment, the predetermined algorithm is the sector in which the first flag is set first among all the other sectors. In an aspect, each of the plurality of sectors further includes a third flag for selecting a first algorithm or a second algorithm, the first algorithm excluding the selection of the other sector from among sectors with a high frequency of bit corrections and the second algorithm enabling the selection of the other sector from among sectors with a low frequency of bit corrections; The memory management means selects the first algorithm when a third flag is set or reset, and selects the second algorithm when the third flag is reset or set. In one embodiment, the memory management means selectively enables or disables the first algorithm and the second algorithm by register settings. In one embodiment, the memory cell array is a memory cell array of a NAND type or NOR type flash memory. Effect of the Invention

[0013] According to the present invention, when a bit correction occurs while reading specific data or when updating the specific data, the specific data is moved to another sector in which the first flag is not set, and the specific data is prevented from being stored in a specific area, thereby suppressing the occurrence of errors in the specific data and improving the reliability of the specific data. [Brief description of the drawings]

[0014] [Figure 1] 1 is a block diagram showing a configuration of a flash memory according to an embodiment of the present invention; [Diagram 2] FIG. 4 is a diagram showing the relationship between sectors and ECC flags / boot flags according to the first embodiment of the present invention. [Diagram 3] 4 is an operation flow when programming boot data according to the first embodiment of the present invention. [Figure 4] 4 is an operational flow when moving boot data according to the first embodiment of the present invention. [Diagram 5] 13 is another operational flow when migrating boot data according to the first embodiment of the present invention. [Figure 6] FIG. 2 is a diagram illustrating an example of wear leveling according to the first embodiment of the present invention. [Figure 7] FIG. 2 is a diagram illustrating an example of wear leveling according to the first embodiment of the present invention. [Figure 8] FIG. 11 is a diagram showing another operation flow when moving boot data according to the first embodiment of the present invention. [Figure 9] 13 is another operational flow when migrating boot data according to the first embodiment of the present invention. [Figure 10] 13 is another operational flow when migrating boot data according to the first embodiment of the present invention. [Figure 11] FIG. 11 is a diagram for explaining an example in which an ECC flag / boot flag / EX flag are used in a sector according to a second embodiment of the present invention. [Figure 12] FIG. 11 is a diagram showing the flow of a read operation and a write operation according to a second embodiment of the present invention. [Figure 13A] 11 is a flow chart showing a sector selection operation according to a second embodiment of the present invention. [Figure 13B] 11 is a flow chart showing a sector selection operation according to a second embodiment of the present invention. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0015] The semiconductor device according to the present invention is, for example, a NAND type / NOR type flash memory, or a microprocessor, microcontroller, logic, ASIC, a processor for processing images or audio, a processor for processing signals such as radio signals, etc., that embeds such a flash memory.

[0016] In a preferred embodiment, the flash memory of the present invention extends the life of the flash memory by managing the memory cell array through wear leveling, and optimizes the storage location of the boot data read from the memory cell array at startup, thereby minimizing the occurrence of errors in the boot data and improving the reliability of the flash memory. EXAMPLES

[0017] Next, an embodiment of the present invention will be described in detail with reference to the drawings. Fig. 1 is a block diagram showing the configuration of a flash memory according to an embodiment of the present invention. The flash memory 100 of this embodiment may be either a NOR type or a NAND type, but the following description will be given taking a NOR type flash memory as an example.

[0018] The flash memory 100 comprises a memory cell array 110 in which a plurality of memory cells are formed, an input / output circuit 120 which outputs read data to the outside in synchronization with a clock signal ExCLK and takes in data input from the outside, an ECC circuit 130 which generates codes for data to be programmed and detects and corrects errors in the read data, an address register 140 which receives address data via the input / output circuit 120, a controller 150 which controls each section based on command data received via the input / output circuit 120 and control signals applied to terminals, and a controller 150 which receives row address information Ax from the address register 140, decodes the row address information Ax, and The internal voltage generating circuit 190 generates various voltages (such as a program voltage Vpgm, a read voltage Vread, and an erase voltage Vers) required for reading, programming, erasing, etc. data.

[0019] A memory cell includes, for example, a charge storage layer (e.g., oxide film-nitride film-oxide film (ONO)) that stores electric charges, and includes a conductive gate of polysilicon or metal or the like thereon, and the gate is connected to a word line. The memory cell array may be a two-dimensional structure formed on the surface of a substrate such as silicon, or a three-dimensional structure formed in a vertical direction from the substrate surface. The memory cell may be an SLC that stores binary data, or an MLC that stores multi-level data.

[0020] When reading from a memory cell, a certain positive voltage is applied to the selected word line by the row selection circuit 160, and the current or voltage flowing between the selected bit line and the selected source line is sensed by the sense / write circuit 170. When programming (writing) to a memory cell, a program voltage is applied to the selected word line by the row selection circuit 160, a voltage according to the data to be programmed is applied to the selected bit line by the sense / write circuit 170, and hot electrons flowing from the selected bit line to the selected source line are accumulated in the charge storage layer. However, the writing method may be other than this, and charges may be trapped in the charge storage layer by FN tunneling. When erasing a memory cell, a certain voltage is applied to the selected word line, and, for example, hot holes are injected into the charge storage layer, or an erase voltage is applied to the substrate to discharge the charges accumulated in the charge storage layer by FN tunneling. Erasing of memory cells is performed in units of sectors including multiple memory cells, but it can also be performed in units of memory cells. For example, the memory cell array is 256 Mb and the sector size is 4 Kbytes.

[0021] One characteristic feature of the flash memory of the first embodiment of the present invention is that each sector of the memory cell array 110 has an area for storing at least two-bit flags used in a wear leveling algorithm. One is an ECC flag indicating whether a bit correction has occurred during reading of the boot data, and the other is a boot flag indicating whether the sector stores the boot data. For example, a set ECC flag indicates that the boot data read from the sector has been bit-corrected by the ECC circuit 130, and a set boot flag indicates that the boot data is stored in the sector. The memory area for storing the two-bit flags assigned to each sector can be accessed only by the controller 150, and cannot be accessed by a user.

[0022] The boot data (boot code) includes data including important programs necessary for system operation, configuration data and trimming data (for example, voltage settings for programming, erasing, etc.) for ensuring the operation of the flash memory, and is read from the memory cell array when the system is operating or when the flash memory is powered on, and is output to an external host system or provided to the controller 150 in the flash memory. If such boot data is lost or partially rewritten, it will cause problems in the operation of the system or the flash memory. Therefore, boot data is data that should be protected as highly reliable data.

[0023] In one embodiment, the memory cell array 110 includes a plurality of sectors arranged in m rows and n columns, as shown in FIG. 2, and one sector is composed of a plurality of memory cells in P rows and Q columns. One sector includes a main area that can be accessed by a user and a spare area that cannot be accessed by a user. The main area stores boot data and data used by the user, and the spare area stores attribute information of data written in the main area. The spare area stores, for example, parity data of data stored in the main area, ECC flags / boot flags, etc. The ECC flags and boot flags are not provided corresponding to each row, but are stored on a sector-by-sector basis, that is, in one sector.

[0024] The input / output circuit 120 receives commands, addresses, data, etc. from the host system in synchronization with the clock signal ExCLK, and provides the received commands, addresses, and data to the controller 150, the address register 140, the column selection circuit 180, and the sense / write circuit 170. The input / output circuit 120 also receives data read from the memory cell array 110 from the sense / write circuit 170, and provides this to the host system.

[0025] During a program operation, the ECC circuit 130 generates parity data required for detecting and correcting errors in the input data by performing an operation on the data input via the input / output circuit 120. The ECC circuit 130 generates the parity data by, but is not limited to, a Hamming code or a Reed-Solomon code.

[0026] The controller 150 is configured by hardware and / or software resources, for example, a microcontroller or a state machine including ROM / RAM. The controller 150 receives commands from a host system and controls the overall operations such as reading, programming, erasing, etc. based on the commands.

[0027] In addition, the controller 150 sets / resets the ECC flag and the boot flag according to the usage status of the memory cell array, and performs wear leveling of the boot data stored in each sector by referring to the ECC flag and the boot flag, thereby further improving the reliability of the boot data.

[0028] Next, wear leveling of the boot data of the flash memory according to this embodiment will be described. Figure 3 shows the operation flow when programming the boot data. When the controller 150 receives a program command, address and boot data of the boot data from the host system via the input / output circuit 120, the controller 150 controls the programming of the boot data based on the received command.

[0029] The row selection circuit 160 and the column selection circuit 180 select a sector and a memory cell within the sector to program the boot data based on the address from the address register 140 (S100). However, if the location to store the boot data is predetermined, it is not necessary to receive the address from the host system. In this case, when the controller 150 receives a program command for the boot data, it reads the address stored in the ROM and provides the address to the address register 140. The boot data is data that is protected in distinction from normal data used by the user, and therefore the boot data may be programmed in an area designated by a specific address.

[0030] Here, when the memory cell array 110 is in a fresh state (the number of program / erase cycles is zero) or immediately after erasure, the data in all memory cells is "1." The ECC flag and the boot flag in the spare area of ​​each sector are also "1." Therefore, in the following explanation, data "1" is referred to as resetting the flag, and data "0" is referred to as setting the flag.

[0031] Next, the ECC circuit 130 generates parity data for the input boot data, and the controller 150 programs the boot data and the parity data into the selected sector (S110). The boot data is programmed into the main area of ​​the sector, and the parity data is programmed into the spare area.

[0032] The controller 150 further sets the boot flag of the sector that stores the boot data (S120). That is, data "0" is programmed into the boot flag in the spare area of ​​the selected sector. If the boot data is programmed into multiple sectors, the boot flag of each of the multiple sectors is set. The setting of the boot flag indicates that the boot data is stored in that sector.

[0033] Next, the operation flow when moving the boot data is shown in Fig. 4. When a read command and address of the boot data are received from the host system via the input / output circuit 120, the controller 150 controls the reading of the boot data based on the received command. In another aspect, the controller 150 controls the reading of the boot data when power is applied to the flash memory (S200).

[0034] The row selection circuit 160 and the column selection circuit 180 select a sector and a memory cell within the sector for reading the boot data based on the address from the address register 140. However, if the location for storing the boot data is predetermined, an address for reading the boot data from the host system is not necessarily required. In this case, upon receiving a read command, the controller 150 reads the address stored in the ROM and provides the address to the address register 140. Also, if the address for storing the boot data is changed, the controller 150 refers to the lookup table, reads the changed address, and provides it to the address register 140.

[0035] Next, the ECC circuit 130 performs error detection and correction based on the boot data read from the main area of ​​the selected sector and the parity data read from the spare area. At this time, the controller 150 judges whether or not the error bit of the boot data has been corrected by the ECC circuit 130 (S210). The presence or absence of bit correction is judged on a sector-by-sector basis.

[0036] If the controller 150 determines that a bit correction has been made, it sets the ECC flag for that sector (i.e., programs data "0" into the ECC flag) (S220). The occurrence of an error correction indicates a precursor to failure of that sector, and the setting of the ECC flag indicates the possibility of failure of that sector (e.g., a deterioration in retention characteristics).

[0037] Therefore, when an error correction occurs during reading of the boot data, the controller 150 moves the boot data to a highly reliable sector other than the sector in question, thereby suppressing the occurrence of errors in the boot data as much as possible. The movement of the boot data can be performed at any timing after the boot data is read from the sector, and for example, the boot data may be moved to another sector after the read boot data is output to the host system, or when the next program command is input from the host system.

[0038] In one embodiment, the controller 150 selects another sector in the same column as the sector in which the error correction occurred, in which the ECC flag is not set. If there are multiple sectors in which the ECC flag is not set, one sector is selected according to a predetermined algorithm (e.g., giving priority to the sector with the lower row address).

[0039] The controller 150 moves the boot data to another sector by programming the boot data in another selected sector on the same column using the same address as that used to read the boot data in the sector where the error correction occurred. Furthermore, when the controller 150 moves the boot data, it sets the boot flag of the destination sector (S230).

[0040] In one embodiment, the controller 150 registers the positional relationship between the original sector where the error correction occurred and the destination sector in a lookup table, and when the controller 150 reads the boot data, it refers to the lookup table to convert the address from the host system or the address read from the ROM.

[0041] In one embodiment, the boot data stored in the original sector where the error correction occurred can be left as it is for backup. In this case, the boot flag of the sector remains set. When the backup boot data is left in the original sector, the controller 150 selects a sector where neither the ECC flag nor the boot flag is set. The fact that both the ECC flag and the boot flag are set indicates that the sector stores the boot data before the movement (before the error correction).

[0042] 5 shows another operation flow when boot data is moved. Boot data is often updated. When the controller 150 receives a boot data update command, boot data for update, and an address if necessary from the host system (S300), it selects another sector for replacement (S310), programs the boot data for update in the selected sector, and sets the boot flag of the selected sector (S320). The method of selecting another sector is the same as that of the boot data movement in FIG. 4.

[0043] When the update boot data is programmed in another sector, it is possible to leave the pre-update boot data in the original sector as it is. In this case, the boot flag of the original sector is set, and the ECC flag is also reset. The positional relationship between the sector storing the pre-update boot data and the sector storing the update boot data is registered, for example, in a lookup table. Alternatively, version information indicating that the version of the boot data is old may be programmed in the spare area of ​​the sector storing the pre-update boot data. When reading the boot data, the controller 150 can refer to the lookup table to convert the address from the host system or the address read from the ROM, and read the update boot data or the pre-update boot data. However, if the pre-update boot data is not necessary, the sector may be erased. When erasing a sector, if data used by the user other than the boot data is stored, the erasure is performed after the data used by the user is moved to another sector.

[0044] Next, a specific example of wear leveling of the flash memory of this embodiment will be described. Fig. 6(A) shows a fresh memory cell array, and shows an example of sectors arranged in 5 rows x 4 columns.

[0045] As shown in FIG. 6(B), for example, boot data is programmed in boot area B of four fresh sectors (row 0: columns 0, 1, 2, 3). The addresses for programming the boot data may be provided by the host system or may be predetermined in the flash memory 100. The boot data is programmed in one or more rows of each sector (row 0: columns 0-3), and at the same time, the boot flag of each sector (row 0: columns 0, 1, 2, 3) is set. It should be noted that in this example, the flag is set by "1" and reset by "0".

[0046] Fig. 6(C) shows an example in which a bit correction occurs in the boot data read from the sector (row 0: column 1) during reading of the boot data. In this case, as shown in Fig. 6(D), the boot data read from the sector (row 0: column 1) is moved to, for example, the sector (row 4: column 1) on the same column of the replacement area R.

[0047] A sector in the same column with both the ECC flag and the boot flag reset is selected as the other sector to be replaced. If there are multiple sector candidates, one sector is selected from them. Any algorithm can be used for the selection, but if the algorithm is to program data in order from the lowest row address, for example, the sector with the furthest row address, which is the latest to be programmed, is selected. In the example shown in the figure, sector (row 4: column 1) is shown as the sector to be replaced.

[0048] In one embodiment, the sector to which the boot data is moved is selected to be a sector not used by the user (i.e., a sector to which data from the user has not been programmed).Whether or not a sector is being used by the user is confirmed, for example, by checking the presence or absence of parity data related to the user data in the spare area, or by setting a flag indicating whether or not the sector is being used by the user of the spare area.

[0049] When the boot data is moved, the address relationship between the original sector (row 0: column 1) and the destination sector (row 4: column 1) is registered, for example, in a look-up table (LUT). Also, the ECC flag of the original sector (row 0: column 1) is set to "1", and the original sector (row 0: column 1) is marked as a failure precursor. If the boot flag of the original sector (row 0: column 1) remains "1", the two flags of the sector (row 0: column 1) become "11", and this code combination indicates that the original sector (row 0: column 1) stores the boot data before it was moved.

[0050] FIG. 6(E) shows an example of moving the update boot data to another sector when the boot data is updated. For example, when the boot data stored in the sector (row 0: column 1) is updated (i.e., when a command for the update program is input), another sector in the same column with a reset ECC flag is selected using the same algorithm as in FIG. 6(D), the update boot data is programmed in the selected sector, and the boot flag is set to "1". The address relationship between the sector (row 0: column 1) storing the boot data before the update and the sector (row 4: column 1) storing the update boot data is registered in, for example, a hookup table (LUT). The ECC flag of the sector (row 0: column 1) storing the boot data before the update remains reset to "0".

[0051] 6(F) shows the reading of the boot data after it has been moved. When reading, the controller 150 converts the address for reading by referring to the lookup table, and reads the boot data stored in sector (row 0: column 0), sector (row 4: column 1), sector (row 0: column 2), and sector (row 0: column 3) based on the converted address.

[0052] 7A shows a state where the ECC flags of all sectors in the same column except the sector storing the boot data are set. The sector (row 1, column 1) stores the boot data and has its ECC flag reset, but all other sectors in column 1 have their ECC flags set.

[0053] In this case, in order to prepare another sector to which the boot data is moved, the controller 150 erases the oldest sector (row 0: column 1) in the same column that originally stored the boot data, and resets the ECC flag and boot flag, as shown in FIG. 7(B). The deterioration of memory cells may improve over time, and by allocating the oldest sector as the next replacement sector, the occurrence of errors in the boot data is minimized and the reliability of the boot data is maintained.

[0054] If user data used by a user is stored in sector (row 0: column 1), the user data is moved to another sector (row 4: column 1) in the same column as the sector (row 0: column 1) as shown in FIG. 7(B1), and then the sector (row 0: column 1) is erased. The address relationship between the source sector and the destination sector for the user data movement is registered in, for example, a lookup table, and the controller 150 converts the address by referring to the lookup table when reading the user data. After the user data is moved, the sector (row 0: column 1) is erased, and the ECC flag and the boot flag are reset.

[0055] FIG. 7(C) shows an example when a bit correction occurs when reading the boot data in sector (row 1: column 1). In this case, the boot data is moved to sector (row 0: column 1), its boot flag is set to "1", and the ECC flag of the original sector (row 1: column 1) is set to "1".

[0056] Since all the ECC flags of the remaining sectors on column 1 are again "1", the oldest sector on column 1 is erased and the ECC flag and boot flag are reset to "0" as shown in Fig. 7(D). If user data is stored in sector (row 4: column 1), the user data is moved to another sector on the same column as above, and then sector (row 4: column 1) is deleted.

[0057] Then, if a bit correction occurs while reading the sector (row 0: column 1), the boot data is moved to the sector on the same column (row 4: column 1), its boot flag is set to "1", and the ECC flag of the original sector (row 0: column 1) is set to "1", as shown in FIG. 7(E).

[0058] In this way, according to this embodiment, if a bit correction occurs when the boot data is read, the boot data is moved to another sector where no bit correction has occurred, so that the boot data is protected so that errors in the boot data are minimized and the reliability is improved.Furthermore, if the boot data is updated, the boot data is moved to another sector where no bit correction has occurred, so that the boot data is protected so that errors in the boot data are minimized and the reliability is improved.Furthermore, by moving the boot data according to a certain algorithm, the frequency of use of the sectors storing the boot data can be equalized.

[0059] Next, another operation flow for moving boot data in the flash memory of this embodiment is shown in Fig. 8. The flow shown in Fig. 4 above shows an example of moving boot data when an error occurs in the boot data during a read operation of the boot data, but the flow in Fig. 8 shows a movement of boot data that may occur during a write operation.

[0060] The controller 150 programs the boot data received via the input / output circuit 120 into the selected sector (S400) as described in the operation flow of Fig. 3. The program uses an ISPP (Incremental Step Pulse Program) method to apply a program pulse to the selected memory cell, and if the program verify fails, applies a program pulse that is one step higher in voltage than the previous time.

[0061] When the number of times or duration of program pulse application reaches a certain value and a timeout occurs (S410), the controller 150 does not terminate the program operation midway, but continues the program operation, completes the program to the sector, and sets the boot flag of the sector (S420). In this case, the ECC flag remains reset. The controller 150 manages the sector as a pseudo-pass.

[0062] After the boot program is completed, the controller 150 moves the boot data written in the sector managed as pseudo-passed to another sector for replacement by copyback (S430), and updates the relationship between the pseudo-passed sector and the sector for replacement in the lookup table (S440). The other sector for replacement is a sector in an erased state. Thus, the boot data is written in the other sector for replacement, and the boot flag is set, but the ECC flag remains reset.

[0063] Fig. 9 shows yet another operation flow for moving boot data. Steps S400 and S410 are the same as those in Fig. 8, but the controller 150 sets both the boot flag and the ECC flag when the program of the pseudo-passed boot data ends (S440).

[0064] Thereafter, when reading the boot data (S450), the controller 150 checks whether the ECC flag is set (S460), and if the ECC flag is set, copies the boot data of the pseudo-passed sector back to another sector for replacement (S470), and updates the relationship between the pseudo-passed sector and the replacement sector in the lookup table (S480).

[0065] A pseudo-passed sector represents a precursor to failure of that sector, and the reliability of the boot data can be maintained by copying the boot data programmed in the pseudo-passed sector back to another sector as a replacement.

[0066] Next, an example of using the boot flag for write protection is shown in the flow of Fig. 10. When the controller 150 performs a boot program to a sector (S500), if the boot flag of that sector is set (S510), it cancels the program to that sector and programs the boot data to another sector (for example, another sector for replacement) (S520). At this time, the boot flag of that other sector is set.

[0067] After the controller 150 has finished programming the boot data into another sector, it sets the ECC flag of the original sector to enable erasure of the old boot data (S530). When erasing a sector, the controller 150 checks the boot flag and the ECC flag, and if both flags are set (S540), it erases the sector (S550).

[0068] Next, a second embodiment of the present invention will be described. The second embodiment relates to an algorithm for selecting a destination sector when the ECC flag is set, and includes a pattern A algorithm used at the beginning of operation and a pattern B algorithm used when the sector changes over time. The pattern B algorithm prevents sectors with a high frequency of ECC errors from being selected as replacement sectors. In the second embodiment, another EX flag is used to select the pattern A or B algorithm.

[0069] In this embodiment, as shown in FIG. 11(A), three flags are used: an ECC flag, a boot flag, and an EX flag, and these 3-bit flags are provided in each sector.

[0070] Fig. 11(B) shows an example of a memory cell array configuration, in which m sectors are arranged in the row direction and n sectors are arranged in the column direction. If one sector is 2048 bytes, one column including m sectors has a storage capacity shown in Fig. 11(C).

[0071] The sector selection algorithm for pattern A is constructed as follows. 1. If the ECC flag and the boot flag for the column / sector are both set, increment the sector number and progress to the right (first priority). This is indicated by arrow P1. 2. If the last sector number on the same column has been reached (that is, when the sector number = m), the column number is incremented and progressed downward (second priority). This is indicated by arrow P2. In one embodiment, the controller 150 includes a counter that holds a sector number and a column number, and increments the value of the counter to select or identify a sector and column.

[0072] The sector selection algorithm of pattern B, for example, sets the EX flag ("1") to prevent the sector from being selected as a replacement sector. In other words, a sector with the EX flag set indicates that it has a high frequency of ECC errors and is prone to failure. In one aspect, the controller 150 counts the number of ECC errors (error corrections) for each sector, and sets the EX flag when the count value reaches a certain value. In another aspect, when the controller 150 receives a command to set the EX flag from the host system, it sets the EX flag in response.

[0073] Furthermore, in this embodiment, the algorithms of patterns A and B make it possible to enable / disable them by register settings. For example, pattern A is enabled and pattern B is disabled, or pattern A is disabled and pattern B is enabled, or patterns A and B are enabled. For register settings, for example, a command for writing to a register is input from the host system, and this makes it possible to change the register settings.

[0074] Next, the read operation and the write operation of the second embodiment will be described. Figure 12(A) shows the flow of the read operation of the second embodiment, and Figure 12(B) shows the flow of the write operation of the second embodiment, where it is assumed that patterns A and B are enabled by register settings. The second embodiment differs from the first embodiment in that it includes algorithms (S440, S540) that implement patterns A and B.

[0075] In a read operation, when the controller 150 receives a read command from the host system (S400), it starts the read operation and determines whether an ECC error has occurred in the data read from the selected memory cell (S410). If an ECC error has not occurred, the read operation continues (S420). On the other hand, if an ECC error has occurred, the controller 150 sets an ECC flag in the sector (S430), then selects a new destination sector (S440), copies the data of the original sector to the selected sector (S450), and updates the relationship between the original sector and the destination sector in the LUT (S460).

[0076] In a write operation, when the controller 150 receives a write command from the host system (S500), it starts a write operation by ISPP and judges whether or not a verify error has occurred (S510). A verify error is, for example, the occurrence of a timeout in FIG. 8. If a verify error has not occurred, writing continues (S520). On the other hand, if a verify error has occurred, the controller 150 sets an ECC flag in the sector (S530), then selects a new destination sector (S540), copies the data of the original sector to the selected sector (S550), and updates the relationship between the original sector and the destination sector in the LUT (S560).

[0077] Next, the sector selection operation in steps S440 and S540 will be described with reference to the flow charts in Figures 13A and 13B. This sector selection operation follows the algorithms of patterns A and B.

[0078] 13A, it is assumed that the controller 150 identifies column number a, sector number b with ECC flag=1 (set) (S600). The controller 150 determines whether the EX flag=1 (set) (S610) and selects the algorithm of pattern A or pattern B. If the EX flag is set, the controller 150 determines that the sector has a high frequency of ECC errors according to the algorithm of pattern B, and removes column number a, sector b from the LUT (S620) so that it is not selected as a destination sector.

[0079] If the EX flag is not 1, the controller 150 determines whether the sector number b matches the final number m according to the first priority of the algorithm of pattern A (S630), and if it does not match the final number m, increments the sector number b (S640). Here, the sector number is incremented by b'=b+1. The controller 150 determines whether the ECC flag of the incremented sector number b' is 0 and the boot flag is 0 (S650), and if both flags are not reset, increments the sector number again (S652), and finally selects the sector with both flags reset.

[0080] When the selection of the sector is determined, the controller 150 copies the data of the original sector with column number a and sector number b to the selected sector with column number a and sector number b' (S660). The timing of copying the data is not particularly limited, and may be after the read / write is completed, at the time of the next read / write operation, or during standby, for example. When the data is copied, the LUT is updated (S670).

[0081] On the other hand, in step S630, if sector number b matches final number m, controller 150 determines whether column number a matches final number n according to the second priority (S680), and if it does not match final number n, increments the column number (S690). Here, the increment of the column number is a'=a+1. At this time, sector number b may be changed to the first sector number 0. Controller 150 determines whether the incremented column number a', sector number b's ECC flag=0 and boot flag=0 (700), and if both flags are not reset, increments the column number (S710), and finally selects the sector with both flags reset (S700).

[0082] Once the sector selection is determined, the controller 150 copies the original data in column number a, sector number b to the selected sector with column number a', sector number 0 (S720). Next, the controller 150 erases the sector with column number a, sector number b (S730), clears the ECC flag and boot flag of the sector (S740), and updates the LUT (S670). In this case, the data in the original sector is erased.

[0083] In step S680, if the column number a matches the final number n, as shown in Fig. 13B, the controller 150 scans the columns / sectors, extracts a sector with ECC flag = 0 and boot flag = 0 (S750), copies the data of the original sector with column number a and sector number b to the extracted sector (S760), erases the data of the original sector (S770), and updates the LUT (S670). In this case, the original data is erased.

[0084] The above example shows the case where patterns A and B are enabled, and if pattern B is disabled by register settings, the processes of steps S610 and S620 are not performed. Also, if pattern A is disabled, steps S630 to S770 are not performed. In this case, for example, a sector for replacement is selected in the same way as in the first embodiment.

[0085] 13A and 13B show one processing example for implementing the algorithms of patterns A and B, and the algorithms of patterns A and B may be implemented by other processing or steps. Furthermore, although the first and second embodiments have been described separately, it is also possible to combine the first and second embodiments without departing from the scope of the present invention.

[0086] In the above embodiment, a NOR type flash memory is exemplified, but the present invention can also be applied to a NAND type flash memory. For example, in a NAND type flash memory, each block has an area for storing an ECC flag and a boot flag, and a set ECC flag indicates that a bit correction has occurred during reading of boot data from the block, and a set boot flag indicates that boot data is stored in the block.

[0087] In the above embodiment, the boot data (boot code) is shown as the data to be protected stored in the memory cell array, but the data to be protected is not limited to the boot data and may be other specific data to be protected similar to the boot data. In this case, the boot flag is replaced with a flag indicating whether the specific data is stored or not.

[0088] In the above embodiment, the ECC flag and the boot flag are stored in the spare area, but this is only an example, and the ECC flag and the boot flag may be stored in any area of ​​the sector or block. Also, the size of the sector or block in which the ECC flag and the boot flag are stored is not particularly limited.

[0089] Although a preferred embodiment of the present invention has been described in detail, the present invention is not limited to the specific embodiment, and various modifications and variations are possible within the scope of the gist of the invention described in the claims. [Explanation of symbols]

[0090] 100: Flash memory 110: memory cell array 120: Input / output circuit 130:ECC circuit 140: Address register 150: Controller 160: Row selection circuit 170: Sense / write circuit 180: Column selection circuit 190: Internal voltage generation circuit

Claims

1. A wear leveling method performed by a semiconductor device including a memory cell array, the wear leveling method comprising: setting an area for storing a first flag indicating whether or not a bit correction has occurred and a second flag indicating whether or not specific data is stored in each of a plurality of sectors of the memory cell array; A wear leveling method comprising: if a bit correction occurs during reading of the specific data from a sector in which a second flag is set, setting a first flag in the sector, writing the read specific data to another sector in which the first flag is not set, and setting a second flag in the other sector.

2. A wear leveling method performed by a semiconductor device including a memory cell array, the wear leveling method comprising: setting an area for storing a first flag indicating whether or not a bit correction has occurred and a second flag indicating whether or not specific data is stored in each of a plurality of sectors of the memory cell array; A wear leveling method including, when updating specific data in a sector in which a second flag is set, writing the specific data for update to another sector in which the first flag is not set, and setting a second flag in the other sector.

3. 3. The wear leveling method according to claim 1, wherein the other sector is a sector in which a second flag is not set.

4. 3. The wear leveling method according to claim 1, wherein the other sector is a sector in the same column as a sector in which a bit correction has occurred or a sector in which specific data to be updated is held.

5. 3. The wear leveling method according to claim 1, further comprising the step of selecting, as said another sector, one sector from among a plurality of sectors in which the first flag is not set according to a predetermined algorithm.

6. 3. The wear leveling method according to claim 1, wherein the other sector is a sector to which no data has been written by a user.

7. 3. The wear leveling method according to claim 1, further comprising the step of resetting the first flag of a sector selected according to a predetermined algorithm when the first flag of all other sectors in the same column as a sector in which a bit correction has occurred or a sector in which specific data to be updated is held is set.

8. 8. The wear leveling method according to claim 7, wherein the predetermined algorithm selects the sector with the first flag set first from among all the other sectors.

9. 3. The wear leveling method according to claim 1, wherein the specific data is boot data.

10. Each of the plurality of sectors further includes a third flag; 3. The wear leveling method according to claim 1, wherein the third flag in the reset state is set when the third flag provided in a sector in which the frequency of bit correction has reached a certain level or more is set, or when a command is received from the host system, and the sector in which the third flag is set is excluded from being selected as the other sector.

11. 11. The wear leveling method according to claim 10, wherein the sector selection algorithm using the third flag is selectively enabled or disabled by a register setting.

12. a memory cell array for storing, in each of a plurality of sectors, a first flag indicating whether a bit correction has occurred and a second flag indicating whether specific data is stored; a memory management means for, when a bit correction occurs during reading of the specific data from a sector in which a second flag is set, setting a first flag of the sector, writing the specific data that has been read to another sector in which the first flag is not set, and setting a second flag of the other sector; A semiconductor device having the above structure.

13. a memory cell array for storing, in each of a plurality of sectors, a first flag indicating whether a bit correction has occurred and a second flag indicating whether specific data is stored; a memory management means for, when updating the specific data in the sector in which the second flag is set, writing the specific data for update to another sector in which the first flag is not set, and setting a second flag in the other sector; A semiconductor device having the above structure.

14. 14. The semiconductor device according to claim 12, wherein said memory management means selects, as said another sector, a sector in which a second flag is not set.

15. 14. The semiconductor device according to claim 12, wherein said memory management means selects, as said another sector, a sector on the same column as the sector in which the bit correction has occurred.

16. 14. The semiconductor device according to claim 12, wherein said memory management means selects, as said another sector, one sector from among a plurality of sectors in which the first flag is not set, in accordance with a predetermined algorithm.

17. 14. The semiconductor device according to claim 12, wherein the memory management means resets the first flag of a sector selected according to a predetermined algorithm when the first flags of all other sectors in the same column as a sector in which a bit correction has occurred or a sector in which specific data to be updated is held are set.

18. 18. The semiconductor device according to claim 17, wherein said predetermined algorithm selects the sector in which a first flag is set first from among all of said other sectors.

19. Each of the plurality of sectors further includes a third flag; 14. The semiconductor device according to claim 12, wherein the memory management means is configured to set a third flag in a reset state provided in a sector where the frequency of bit correction has reached a certain level or more, or to set the third flag in the reset state when a command is received from a host system, and to exclude a sector in which the third flag is set from being selected as the other sector.

20. 20. The semiconductor device according to claim 19, wherein said memory management means selectively enables or disables a sector selection algorithm using said third flag by setting a register.

Citation Information

Patent Citations

  • Storage device

    JP2002108722A

  • Wear leveling for memory devices

    JP2014524609A

  • memory wear leveling

    JP2017538206A

  • Nonvolatile memory device and method of operating the same

    US20100162081A1

  • Method to Extend Data Retention for Flash Based Storage in a Real Time Device Processed on Generic Semiconductor Technology

    US20140143632A1