Method of logic partitioning of a nonvolatile memory array

Abstract: An architecture of a FLASH memory organized in a plurality of physical sectors wherein read, write and erase operations of data occupying a fractional memory space of any one of said physical sectors are carried out, may include splitting a physical sector in a plurality of singularly addressable logic sectors. Each logic sector (j) is defined by a memory space of pre-established size (PAYLOAD j ), a chain pointer (CHAIN_PTR j ) assuming a neutral value (NULL) or a value pointing directly or indirectly to a second logic sector associated to a respective chain pointer (CHAIN_PTR 2 ) at neutral value (NULL), a status indicator (STATUS j ) assuming a first value (FREE) if the logic sector is empty, a second value (OD) if the data contained in it belongs to the logic sector, a third value (NOD) if the data do not belong to the logic sector, or a fourth value (DEL) if the data has been erased, and a remap pointer (REMAP_PTR j ) assuming the neutral value (NULL) or a value pointing directly or indirectly to the chain pointer (CHAIN_PTR 3 ) of a third logic sector. A further improvement consists in attributing to each physical sector a logical address (LOGICAL_ADDRESS) permitting to destine to the function of temporary buffer, for partly erasing the content of a physical sector, in rotation all the physical sectors, not to repeatedly stressing the same sector.

Description: FIELD OF THE INVENTION The present invention concerns a nonvolatile memory and in particular a method of managing a memory organized in a plurality of physical sectors. BACKGROUND OF THE INVENTION Nonvolatile memory are characterized by a data organization in physical sectors. The physical sector represents the minimum amount of data that can be erased, even if it is possible to read and write amounts of data smaller than a physical sector (often the term page is used to indicate such minimum amounts). Because of technology improvements, physical sectors become greater and greater, affecting the managing of blocks of data of relatively small dimensions on which carrying out reading, writing and erasing operations independently from the rest of stored data. Because of the great importance assumed by FLASH memories, in the following description we shall refer to this type of memories though the object of the invention can be usefully implemented mutatis mutandis in any kind of nonvolatile memory. The problem of managing large physical sectors is particularly important in PC environment wherein almost all the applications for managing mass storage devices memories (floppy, hard disk, memory card), use data units of 512 bytes instead of tens or hundreds of Kbytes typical of a sector of a FLASH memory. Therefore, an internal organization of single physical sectors is needed in order to singularly manage each data portion. A further problem related to the managing of physical sectors of large dimensions is tied to the need of eliminating only a few data of a sector while retaining the remaining data This is a problem because in FLASH memories it is possible only to erase a whole physical sector, and not only a portion of it. The easiest solution would consist in having a memory sector (BUFFER) unaccessible by the user on which to copy data to save before erasing the sector and restore them when the erasing has taken place. To avoid adding a memory device, said BUFFER can be a dedicated sector of the FLASH unaccessible by the user. Nevertheless, the sector dedicated to such a function will be subject to repeated programming and erasing cycles with a consequent accelerated degradation compared to all the other sectors. The document US-A-5 627 783, discloses a flash memory comprising multiple erase blocks, each erase block comprising a physical-logical block number and multiple data areas for storing payload information. Each data area comprising a storage area, a status indicator and a chain pointer. Data areas are addressed by splitting a logical request address into physical-logical block address and an offset. The requested block is found through an associative search. If a data area has been updated with new data, the valid data area is found by following the chain pointer. Valid data of full blocks are copied to an empty block and a new block is signed the physical-logical address of the old block which is then erased. OBJECT AND SUMMARY OF THE INVENTION It has been found and is the object of the invention a method of managing a nonvolatile memory device and a relative memory organization in physical sectors such to permit reading and writing operations on portions of the memory of reduced dimensions by splitting a physical sector in a plurality of independently addressable logic sectors. The method of the invention makes the user "see" a physical sector as if constituted by a number of blocks of data whose pre-established dimension does not depend from the dimension of the physical sector of the memory, allowing reading, writing and erasing operations even on a single block. The method of the invention is particularly easy and can be implemented without great difficulties by the on board controller/finite state machine of the memory device. In a memory device where a sector may be erased only as a whole, a further object of the invention is to provide a method of erasing only a portion of data stored in a physical sector, by using a dedicated unaccessible buffer sector of the memory, while overcoming the known problems of an excessively fast degradation of such a buffer sector. The invention is clearly defined in the attached independent claims. BRIEF DESCRIPTION OF THE DRAWINGS The different aspects and advantages of the invention will become clear through the following detailed description of the invention and by referring to the attached drawings, wherein: Figure 1 depicts the structure of a logic sector of the invention; Figure 2 is an example of management of the logic sectors of a physical sector; Figure 3 shows the organization of the physical sectors of a memory of the invention; Figures 4a, 4b describe in a detailed manner the steps of erasing a physical sector of a memory of the invention; Figure 5 is a flow chart of the preliminary erasing procedure of the invention; Figure 6 is a flow chart of the procedure of formatting a memory of the invention. DESCRIPTION OF AN EMBODIMENT OF THE INVENTION The gist of the invention consists in dividing each physical sector of the memory in blocks called logic sectors, such as the one depicted in Fig. 1. Each logic sector is a structure of data comprising a chain pointer CHAIN_PTR, a remap pointer REMAP_PTR and a state indicator STATUS, besides a payload space reserved for data storage. The state of a logic sector indicates the condition of the respective PAYLOAD: STATUS=OD (owner of data) indicates that data relative to a certain sector are in its payload, STATUS=NOD (not owner of data) indicates that the payload of a sector is used to store updated data of another logic sector, STATUS=DEL (deleted) indicates that the logic sector being examined has been logically erased and that data in its payload are no longer valid, STATUS=FREE indicates a logic sector that has not yet been used. Because of this memory organization, the memory does not appear to the user as composed of physical sectors of large dimensions, but as composed of logic sectors of relatively small dimensions that are individually addressable, and whose content can be updated independently from the other logic sectors. As matter of fact, when the user stores new data in a certain logic sector that already contains other data, the new data are written in a free logic sector, the respective state is set to the value NOD and the chain pointer CHAIN_PTR of the sector in which they should have been written is set equal to the address of the sector in which data have been effectively written. If the user stores data in a logic sector that contains data belonging to another sector, the new data are written in a free sector, the relative state is set to NOD and the remap pointer REMAP_PTR of the sector in which such data should have been written in is set equal to the address of the sector in which the data have been effectively written. In order to understand better the method of the invention, let us consider an example of management of a physical sector composed by eight logic sectors, as illustrated in Fig. 2. Let us suppose that a user must carry out the following sequence of operations: I. storing data in the logic sector 3; II. updating data stored in the logic sector 3; III. second updating of data stored in the logic sector 3; IV. third updating of data in the logic sector 3; V. storing data in the logic sector 2; VI. storing data in the logic sector 5; VII. updating data in the logic sector 5; VIII. erasing data stored in the logic sector 5. At the end of the following operations, the configuration is that depicted in Fig. 2, obtained by the respective operations: I. writing the data to be stored in the PAYLOAD of the sector 3 and setting its STATUS to the value OD; II. writing the data to be stored in a free sector, for example sector 5, because sector 3 is already engaged by its own data, setting the STATUS of sector 5 to the value NOD and setting the chain pointer CHAIN_PTR of sector 3 equal to the address of sector 5; III. writing the data to be stored in a free sector, for example sector 2, because sector 3 is already engaged by its own data, setting the STATUS of sector 2 to the value NOD and making the CHAIN_PTR of sector 3 indirectly address sector 2. This last operation is carried out by setting the chain pointer of sector 5 equal to the address of sector 2, because the chain pointer of sector 3 is already engaged and addresses sector 5; IV. writing the data to be stored in a free sector, for example sector 6, because sector 3 is already engaged by its own data, setting the STATUS of sector 6 to the value NOD and making the CHAIN_PTR of sector 3 indirectly address sector 6. This last operation is carried out by setting the chain pointer of sector 2 equal to the address of sector 6, because the chain pointer of sector 3 directly addresses sector 5, whose CHAIN_PTR directly addresses sector 2; V. writing the data to be stored in a free sector, for example sector 8, because sector 2 is already engaged by data that are not its own data, setting the STATUS of sector 8 to the value NOD and setting the remap pointer REMAP_PTR of sector 2 equal to the address of sector 8; VI. writing the data to be stored in a free sector, for example sector 7, because sector 5 is already engaged, setting the STATUS of sector 7 to the value NOD. The status of sector 5 is equal to NOD so its remap pointer REMAP_PTR must be considered and is set equal to the address of sector 7; VII. writing the data to be stored in a free sector, for example sector 4, because sector 5 is already engaged, setting the STATUS of sector 4 to the value NOD. The STATUS of sector 5 is equal to NOD so its remap pointer REMAP_PTR must be considered, which addresses to sector 7, so the CHAIN_PTR of sector 7 is set equal to the address of sector 4; VIII. the remap pointer REMAP_PTR of sector 5 must be considered, because the STATUS of sector 5 is equal to NOD. The erasing of data stored in sector 5 is carried out setting the status of sector 4 equal to DEL because the REMAP_PTR of sector 5 addresses to sector 7, whose CHAIN_PTR addresses to sector 4. When the above operations are completed, the situation is as follows: the logic sector 3 has been rewritten three times, successively storing new data in sectors 5, 2 and 6. Valid data are stored in sector 6 and can be reached following the chain of pointers CHAIN_PTR starting from sector 3; the logic sector 2 has been remapped to sector 8 because it was used to store data of sector 3; the logic sector 5 has been rewritten twice using the sectors 7 and 4 and successively it has been erased: the erasing operation of a logic sector consists in making invalid the end of the chain, starting from the sector to be erased, by marking it with the status DEL; the logic sector 1 has not been used and remains free. By resuming, when the payload of a logic sector must be modified, a free logic sector of the same physical sector is linked to the first one and used to store the new payload without actually invoking a physical erasing of the sector. By means of the CHAIN_PTR a relation is established between the original sector and the one in which the updated data have been written. On the contrary when data must be written in a PAYLOAD of a logic sector already used in a previously organized chain (i.e. used to store the content of the PAYLOAD of another logic sector), a remapping of the sector is done. The pointer REMAP_PRT is used in this case to indicate where the chain of data, related to a logic sector already used, starts. The above described procedure can be repeated until there are no more free logic sectors in the considered physical sector, thus constructing a data chain wherein only the last linked sector contains valid data. When access to a logic sector is requested, it is sufficient to follow the chain of the CHAIN_PTR, originating from the sector to be examined, till its end. Only when there are no more free logic sectors in a certain physical sector, or upon an explicit command, a physical erasing of the sector may be commanded. In practice this consists in saving the valid data related to logic sectors that do not have to be erased, in erasing the whole physical sector and in rewriting the saved valid data in the logic sectors of origin, thus simplifying the chain. The invention offers the following advantages: the read/write operations of the pointer areas are equally distributed in time and in physical memory space because each physical sector has its own local table of pointers to logic sectors; this minimize burdening of the area containing the pointers to data structures; the invention is outstandingly efficient when managing of data involves relatively small logic sectors, i.e. when it is necessary to manage the memory with a finer granularity of the data structures. The invention can be implemented in a way as to prevent overutilization of dedicated physical sector by managing the memory as follows. As previously stated, the commonly used technique for erasing a portion of a physical sector consists in using a BUFFER sector unaccessible by the user. Before erasing a physical sector, the data to be saved are temporary saved in this prearranged buffer space. Once the sector is erased, the saved data are copied back into the erased sector. A drawback of this procedure consists in exposing the same BUFFER sector to relatively frequent writing and reading operations which leads to a premature degradation of this sector. The present invention provides a method for overcoming this problem, by allowing the user of a memory composed of k physical sectors, to manage partial erasings of no more than k-1 physical sectors, without using at least the same sector, unaccessible by the user, as BUFFER. In the followings, the case in which there is only one BUFFER sector is considered, because in this way the memory is used at its maximum capacity; nevertheless the method of the invention can be implemented even arranging for more than one BUFFER sector. The way in which the k-1 sectors and the BUFFER sector are defined is such to: be transparent to the user, that sees a memory with k-1 independently erasable sectors, not degrade the sector used as buffer by distributing in time the erasing operations substantially on all physical sectors, be easily implemented by the onboard controller of the memory. The algorithm is particularly tolerant of interruptions of write/erase processes (for . example because of a supply failure), which could leave the content of the memory in a inconsistent state: a boot routine that the on board controller carries out at the start up sets the content in a consistent condition. Substantially, each physical sector is constituted by a payload and by a header containing information on data stored in payload. The header is composed of the following field: 1) LOGICAL_ADDRESS: indicates the logical address to which the physical sector is associated; 2) STATUS: indicates the status of the physical sector that can assume the following values: EMPTY: indicates that the physical sector has been erased; BUSY: indicates that the payload contains data that have not been validated yet; GOOD: indicates that the payload contains validated data; OLD: indicates that the physical sector must be erased. Given that the effectiveness of the algorithm of the invention rests on the reliability of data present in the header, the flags indicating the status of a sector can be stored on several bits: the presence of a determined bit configuration will indicate if the corresponding flag is set or not. In any case the memory amount necessary to store the header remains extremely limited if compared to the size of the payload (few bytes Vs several tens of Kbytes). A possible organization of a memory constituted by four physical sectors is schematically depicted in Fig. 3. When the user requires a read or write access to a certain logical address, the internal controller of the memory redirect the access to the payload of the corresponding physical sector. This can be done in two ways: 1) the controller scans all headers until it finds a physical sector whose LOGICAL_ADDRESS is equal to the desired logical address; 2) at the start-up of the memory device, the controller builds a look up table in which it stores the relations physical sector/logical address. When the user requires a partial erasing of data stored in a physical sector, the algorithm described in Figs. 4a, 4b is carried out. A free sector is identified and the data to be saved are copied in it, attributing to it the same logical address (3) of the physical sector to be erased 4 . Successively, a neutral address (###) is assigned to the physical sector to be erased 4 and the erasing operation is carried out. Lastly, the look up table is updated. The final result is to have a memory in which only the desired data are contained at the respective logical addresses, but they are stored in different physical sectors. In order to erase in this way a physical sector, it is necessary the presence of at least a free physical sector, in which to copy the data to be saved that are currently stored in the sector to be erased. In other words, the method of the invention can be implemented by carrying out the following steps: 1) locating the physical sector PHY_ADDR to be partially erased by its respective logical address; 2) locating the free sector BUF_ADDR, i.e. the one characterized by an EMPTY status in its header; 3) setting STATUS=BUSY in the located free sector at the address BUF_ADDR to indicate that on such a sector a data transfer is going to start and so it should no longer be considered free; 4) copying the logical address of the sector to be erased partially in the LOGICAL_ADDRESS of the sector addressed by BUF_ADDR; 5) copying the data that must be preserved by the partial erasing from the payload of the sector addressed by PHY_ADDR in the payload of the sector addressed by BUF_ADDR; 6) setting STATUS=GOOD in the sector addressed by BUF_ADDR indicating that its payload contains data to be saved belonging to the physical sector that must be partially erased; 7) setting STATUS=OLD in the sector addressed by PHY_ADDR indicating that its payload no longer contains valid data; 8) erasing the whole sector addressed by PHY_ADDR; 9) setting STATUS=EMPTY in the sector addressed by PHY_ADDR indicating that its payload is empty. The result of this algorithm is to locate the sector that had to be partially erased in the sector that initially was free, saving the data were not to be erased, and to free the erased physical sector, making it available as a buffer space for future erasing operations. Even if the method of this invention requires a free physical sector of the memory as the known methods of memory management, the mechanism of dynamic allocation of the sectors that are visible by the user guarantees a distribution of the erasing operations on all the physical sectors of the memory. The steps of the algorithm are such to make it tolerant to interruptions (for example because of a supply failure). The boot routine described hereinbelow, carried out by the internal controller of the memory at the start-up of the device, is able to reset the headers of the physical sectors in a coherent condition by analyzing the status of the various flags. To be sure that all logical addresses are associated to respective physical sectors and that there is at least a physical sector available for the partial erasing algorithm, the method of the invention contemplates an initializing procedure, BOOT_ROUTINE. It must be run whenever a supply failure has set the header of a physical sector in an invalid condition and when the memory device is used for the first time, i.e. when there is not organization of data inside the memory. The BOOT_ROUTINE includes a first routine, BOOT_ERASE, followed by a second routine, BOOT_FORMAT. BOOT ERASE This routine erases all physical sectors whose STATUS is invalid, i.e. different from EMPTY or GOOD, as illustrated in Fig. 5. In particular are erased all physical sectors that: have a STATUS=BUSY, indicating that on the sector being examined a partial erasing (that was interrupted between steps 3) or 4) of the algorithm) was in progress; have a STATUS=OLD, indicating that the sector had to be erased but the erasing algorithm was interrupted after step 7); have a STATUS=GOOD but have a LOGICAL_ADDRESS already present in the HEADER of an already analyzed physical sector, indicating that in the memory a same logical address LOGICAL_ADDRESS is present on two distinct physical sectors: this happens when the partial erasing algorithm is stopped at step 6); have an invalid status, because a physical erasing operation (step 8 of the algorithm) was in progress on the sector when it was interrupted or because the memory was new. At the end of each erasing operation, the STATUS of the sector is set equal to EMPTY. It is important to note that whichever is the reason that makes the controller invoke a physical erasing of a sector, from the point of view of the user there is no data loss. Moreover the BOOT_ERASE routine is tolerant to interruptions, and does not induce unrecoverable states in the data structure of the memory or jeopardize the user's data. BOOT FORMAT The BOOT_FORMAT routine, carried out at the end of the BOOT_ERASE routine, controls that to each physical sector is associated a logical address. The object of the BOOT_FORMAT routine, illustrated in Fig. 6, consists in making the memory ready for normal operation, by controlling that all logical addresses have been assigned to as many physical sectors and that there is at least a free physical sector for the partial erasing algorithm. As may be noticed, the BOOT_FORMAT routine tolerates interruptions without inducing unrecoverable states in the data structures of the memory or jeopardize the user's data.

Claims: An architecture of a FLASH memory organized in a plurality of physical sectors wherein read, write and erase operations of data occupying a fractional memory space of any one of said physical sectors are carried out, whereby each physical sector is split in a plurality of singularly addressable logic sectors, each logic sector (j) corresponding to a memory space of a pre-established dimension including a storage space (PAYLOAD j ) and a header space containing: a chain pointer (CHAIN_PTR j ) assuming a neutral value (NULL) or a value pointing directly or indirectly to a second logic sector associated with to a respective chain pointer (CHAIN_PTR 2 ) equal to said neutral value (NULL); a status indicator (STATUS j ) assuming a first value (FREE) if the logic sector is empty, a second value (OD) if the data stored in the storage space belong to said logic sector, a third value (NOD) if said data do not belong to said logic sector, or a fourth value (DEL) if said data have been erased; a remap pointer (REMAP_PTR j ) assuming said neutral value (NULL) or a value pointing directly or indirectly to a respective chain pointer (CHAIN_PTR 3 ) of a third logic sector. A method of managing a FLASH memory organized in a plurality of physical sectors organized according to claim 1 and wherein read, write and erase operations of data occupying a fractional memory space of any one of said physical sectors are carried out, comprising initializing the memory by setting all chain pointers (CHAIN_PTR) and all remap pointers of all the logic sectors into which the physical sectors are split equal to said neutral value (NULL) and setting all status indicators (STATUS) of said logic sectors at said first value (FREE); virtually erasing a certain logic sector (j) whose respective chain pointer (CHAIN_PTR j ) has said neutral value (NULL) by setting the respective status indicator (STATUS j ) of said logic sector (j) at said fourth value (DEL); reading data relative to any one of said logic sectors according to the following procedure: if the respective status indicator (STATUS j ) of said logic sector has one of said values first (FREE) or fourth (DEL), reading a null value; if said status indicator (STATUS j ) differs from said value first (FREE) or fourth (DEL) then if the respective remap pointer (REMAP_PTR j ) of said logic sector has a neutral value (NULL), reading the data stored in said logic sector if the respective chain pointer (CHAIN_PTR j ) of said logic sector has a neutral value (NULL) or reading the data stored in another logic sector directly or indirectly addressed by said chain pointer (CHAIN_PTR j ); if said remap pointer (REMAP_PTR j ) points to a chain pointer (CHAIN_PTR n≠j ) of a certain logic sector (n≠j), reading data stored in said certain logic sector (n≠j) if the respective chain pointer (CHAIN_PTR n≠j ) has a neutral value (NULL) or reading data stored in a different logic sector directly or indirectly addressed by said chain pointer (CHAIN_PTR n≠j ); writing data in any logic sector according to the following procedure: a) if the respective status indicator (STATUS j ) of said logic sector has said first value (FREE), writing said set of data in the respective storage space of said logic sector and assigning to said status indicator (STATUS j ) one of said values second (OD) or third (NOD); b) if said status indicator (STATUS j ) has said second value (OD), repeating step a) on another empty logic sector (n≠j) setting the respective status indicator (STATUS n≠j ) of said other logic sector (n≠j) equal to said third value (NOD) and setting the chain pointer (CHAIN_PTR i ) of the logic sector (i) directly or indirectly addressed by said chain pointer (CHAIN_PTR j ) of said logic sector (j) equal to the address of said other logic sector (n≠j); c) if said status indicator (STATUS j ) has said third value (NOD) or said fourth value (DEL) and if the respective remap pointer (REMAP_PTR j ) of said logic sector (j) has a neutral (NULL) value, repeating step a) on another empty logic sector (n≠j) setting the respective status indicator (STATUS n≠j ) equal to said third value (NOD) and setting said remap pointer (REMAP_PTR j ) equal to the address of said other logic sector (n≠j); d) if said remap pointer (REMAP_PTR j ) is not neutral (NULL), repeating step a) on another empty logic sector (n≠j) setting the respective status indicator (STATUS n≠j ) equal to said third value (NOD), setting a respective chain pointer (CHAIN_PTR j ) of a further logic sector directly or indirectly addressed by said remap pointer (REMAP_PTR j ) equal to the address of said other logic sector (n≠j); rewriting data stored in any physical sector according to the following procedure: saving valid data contained in logic sectors whose respective chain pointers (CHAIN_PTR) have said neutral value (NULL) and the respective status indicator (STATUS) differs from said fourth value (DEL); for any valid data, saving the address of the respective logic sector; physically erasing said physical sector of the memory; writing said saved data in the respective logic sectors and setting the respective status indicators (STATUS) at said second value (OD).

Inventors: BISIO MARCO, PASOTTI MARCO, ROCCHI ALESSANDRO, ROLANDI PIER LUIGI, BISIO, MARCO, PASOTTI, MARCO, ROCCHI, ALESSANDRO, ROLANDI, PIER LUIGI
Applicants: ST MICROELECTRONICS SRL, STMICROELECTRONICS S.R.L.
Application year: 2000
Main classification: G06F3
IPC codes: G06F12