Data processing method for analog electrically erasable memory, analog electrically erasable memory, and microprocessor chip
By selecting sectors with the fewest erase cycles and the fewest valid records for compression and active sector management, the low durability of analog electrically erasable memory systems is solved, improving system durability and memory lifespan.
Patent Information
- Application Number
- PCT/CN2025/088219
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-04-17
- Filing Date
- 2025-04-10
- Publication Date
- 2025-10-23
AI Technical Summary
When compressing sectors, the existing analog electrically erasable memory selects the earliest filled sector for compression, which results in unnecessary effective record transfer and reduces the durability of the system.
By selecting the full sector with the least number of erases and the least valid records as the compressed sector, and selecting the empty sector with the least number of erases as the active sector when the number of empty sectors reaches a threshold, the transfer of valid data is delayed to ensure that the active sector has more space to write new data.
The durability of the analog electrically erasable memory is improved, the erasure times and transfer of invalid data are reduced, and the service life of the non-volatile memory is extended.
Smart Images

Figure CN2025088219_23102025_PF_FP_ABST
Abstract
Description
Method for processing data of analog electric erasable memory, memory and micro-processing chip
[0001] The present application claims priority from the Chinese patent application No. 202410464811.0 filed on April 17, 2024, and entitled "Method for processing data of analog electric erasable memory, memory and micro-processing chip", the content of which is incorporated herein by reference in its entirety. TECHNICAL FIELD
[0002] The present application relates to the technical field of digital circuits, in particular to a method for processing data of an analog electric erasable memory, a memory and a micro-processing chip. BACKGROUND
[0003] Analog electric erasable memories generally include volatile random access memories, such as random access memories (RAMs, or ERAMs), and non-volatile memories, such as electrically erasable non-volatile memories (such as FLASH or EFLASH), wherein the storage capacity of the non-volatile memories is much larger than that of the random access memories. Compared with conventional non-volatile memories, analog electric erasable memories have higher durability and flexibility, and thus are suitable for automotive applications where data needs to be frequently updated and must be stored in a non-volatile manner.
[0004] When the number of empty sectors in the electrically erasable non-volatile memory (FLASH) is less than a set threshold, sector compression is performed, i.e., valid records in a full sector are copied to a currently filled sector, and the full sector is erased to obtain space, thereby increasing the durability of the system. When performing sector compression, the sector that is filled earliest is usually selected for compression.
[0005] However, the valid records in the sector that is filled earliest are likely to be the least, which results in more valid records being transferred to the currently filled active sector, and these valid records can become invalid records at a later time as data continues to be written, without the need to be transferred to the current sector and thus without occupying an address, thereby reducing the durability of the analog electric erasable memory system. SUMMARY
[0006] Embodiments of the present application provide a method for processing data of an analog electric erasable memory, a memory and a micro-processing chip, to solve the problem of low durability of the analog electric erasable memory system caused by inappropriate selection of a compression sector in the prior art.
[0007] In a first aspect, embodiments of the present application provide a method for processing data of an analog electric erasable memory, the method comprising:
[0008] in response to the access request, determining whether there is an active sector in all sectors when the access request is a write request;
[0009] when there is the active sector, writing data records carried in the write request to empty addresses of the active sector;
[0010] when there is no active sector, selecting an empty sector with the least number of erasures as an active sector; when it is determined that the number of empty sectors reaches a preset threshold, selecting a full sector with the least number of valid records in full sectors with the least number of erasures as a compression sector;
[0011] writing valid records in the compression sector to the active sector, erasing the data records in the compression sector, updating erasure times information of the compression sector, and updating a state of the compression sector to an empty sector;
[0012] wherein the information recorded by the data records includes address information and data information, and is characterized by flag information as to whether the data records are valid records or invalid records.
[0013] Optionally, the selecting a full sector with the least number of valid records in full sectors with the least number of erasures as a compression sector comprises:
[0014] determining a full sector with the least number of erasures in all full sectors as the compression sector;
[0015] when there are at least two full sectors with the least number of erasures, determining a full sector with the least number of valid records as the compression sector.
[0016] Optionally, the method further comprises: when there are at least two full sectors with the least number of valid records in the full sector with the least number of erasures, determining the compression sector therefrom according to sizes of sector serial numbers.
[0017] Optionally, the selecting an empty sector with the least number of erasures as an active sector comprises:
[0018] determining an empty sector with the least number of erasures in all empty sectors as the active sector;
[0019] when there are at least two empty sectors with the least number of erasures, determining the active sector therefrom according to sizes of sector serial numbers.
[0020] Optionally, after the writing of the data records carried in the write request to empty addresses of the active sector, the method further comprises: updating the number of valid records in each sector.
[0021] When the data record is written as a valid record, the number of valid records of the active sector is counted by 1;
[0022] If there is an old data record corresponding to the same access address in the active sector and / or other sectors, the flag information of the old data record is changed to flag information representing that the data record is an invalid record, and the number of valid records of the corresponding sector is counted by 1.
[0023] Optionally, the sector includes: sector information and sector record.
[0024] The sector information is used for marking the number of times of erasing the corresponding sector and the state of the corresponding sector, and the state includes an empty sector, a full sector and an active sector.
[0025] The sector record includes the flag information and the data record.
[0026] In a second aspect, an embodiment of the present application provides a simulation electric erasable memory, including: a memory controller, a volatile random memory and a non-volatile memory.
[0027] The memory controller is used for receiving an access request sent by a processor, when the access request is a read request, the memory controller accesses the volatile random memory, and returns data information of a corresponding address in the volatile random memory to the processor.
[0028] When the access request is a write request, it is determined whether there is an active sector in all sectors of the non-volatile memory.
[0029] When the active sector exists, a data record carried in the write request is written into an empty address of the active sector.
[0030] When the active sector does not exist, an empty sector with the least number of times of erasing is selected as an active sector, when it is determined that the number of empty sectors reaches a preset threshold, a full sector with the least number of valid records in full sectors with the least number of times of erasing is selected as a compression sector.
[0031] The valid records in the compression sector are written into the active sector, the data records in the compression sector are erased, the number of times of erasing of the compression sector is updated, and the state of the compression sector is updated to an empty sector.
[0032] The information recorded in the data record includes address information and data information, and is characterized by flag information indicating whether the data record is a valid record or an invalid record.
[0033] Optionally, the full sector with the least number of valid records in the full sectors with the least number of erasures is selected as the compression sector, including:
[0034] The full sector with the least number of erasures in all the full sectors is determined as the compression sector.
[0035] When there are at least two full sectors with the least number of erasures, the full sector with the least number of valid records is determined as the compression sector.
[0036] Optionally, the method further includes:
[0037] When there are at least two full sectors with the least number of valid records in the full sector with the least number of erasures, the compression sector is determined according to the size of the sector serial number.
[0038] Optionally, the empty sector with the least number of erasures is selected as the active sector, including:
[0039] The empty sector with the least number of erasures in all the empty sectors is determined as the active sector.
[0040] When there are at least two empty sectors with the least number of erasures, the active sector is determined according to the size of the sector serial number.
[0041] Optionally, the method further includes:
[0042] The valid record number storage is used to count the number of valid records in each sector according to the control instruction of the memory controller.
[0043] Optionally, the memory controller is further used to update the number of valid records in each sector after writing the data record carried in the write request to the empty address of the active sector.
[0044] When the data record is written as a valid record, the number of valid records in the active sector is counted by one through the valid record number storage.
[0045] If the active sector and / or other sectors have the same old data record corresponding to the access address, the flag information of the old data record is changed to flag information representing that the data record is an invalid record, and the valid record number storage is used to count down 1 for the valid record number of the corresponding sector.
[0046] Optionally, if the data information of the write request is consistent with the data information of the corresponding address in the volatile random memory, the volatile random memory and the non-volatile memory do not need to be updated; when the data information of the write request is different from the data information of the corresponding address in the volatile random memory, the data information of the corresponding address in the volatile random memory is updated, and the data record is written into the non-volatile memory.
[0047] In a third aspect, an embodiment of the present application provides a micro-processing chip, comprising a processor and the analog electric erasable memory according to any one of the second aspect.
[0048] The micro-processing chip is configured to send an access request to a memory controller in the analog electric erasable memory by the processor, and the access request comprises a read request and a write request.
[0049] The embodiment of the present application selects an active sector and a compression sector for erasing according to specific rules, selects an empty sector with the least number of erasing times as the active sector, and selects a compression sector with the least number of erasing times and the least amount of effective data when the number of empty sectors reaches a preset threshold, thereby delaying the transfer of effective data, and there is more space in the active sector to write new data records. With the writing of new data records, more data in the data records to be transferred is invalidated without being transferred, thereby improving the proportion of effective data in the non-volatile memory and improving the durability. BRIEF DESCRIPTION OF DRAWINGS
[0050] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0051] FIG. 1 shows a schematic diagram of a micro-processing chip according to an embodiment of the present application;
[0052] FIG. 2 shows a schematic diagram of an analog electric erasable memory according to an embodiment of the present application;
[0053] FIG. 3 shows a flowchart of a data processing method of an analog electric erasable memory according to an embodiment of the present application;
[0054] FIG. 4 shows a schematic diagram of a method for processing data of an analog EEPROM according to an embodiment of the present application. DETAILED DESCRIPTION
[0055] For better understanding of the technical solutions of the present application, the embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0056] It should be clear that the described embodiments are only some of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the present application.
[0057] An analog EEPROM (Electrically-Erasable Programmable Read-Only Memory) is generally composed of a random access memory (RAM) and an electrically-erasable non-volatile memory (FLASH). The durability of such a memory is higher than that of a conventional non-volatile memory, and the size is equivalent to that of a volatile random access memory (also referred to as a volatile random memory). This is achieved by using a non-volatile memory that is much larger than a volatile random access memory, but the analog EEPROM operates as if it were only the size of a volatile random access memory.
[0058] Therefore, the analog EEPROM simulates an electrically-erasable memory that is smaller in size than the memory used by the analog EEPROM, but has increased durability. This is of great importance in cases where durability is very important, such as automotive and industrial applications, where data is frequently updated and must be stored in a non-volatile manner.
[0059] The cost of increasing durability is to increase the memory size of the non-volatile memory, which increases the cost of the device and makes it more expensive. Therefore, it is very meaningful to improve durability without increasing the size of the non-volatile memory.
[0060] In the related art, when the number of empty sectors is less than a set threshold, sector compression is performed, i.e., by copying valid records in a full sector to a currently filled sector and erasing the full sector to obtain space, thereby increasing the durability of the system. When performing sector compression, the sector that is filled earliest is usually selected for compression.
[0061] However, the valid records in the earliest filled sector are likely to be the least, which results in more valid records being transferred to the current active sector, which can become invalid records at a later time as data continues to be written, without being transferred to the current sector and occupying an address, thus reducing the endurance of the analog EEPROM system.
[0062] As shown in Fig. 1, a micro-processing chip is provided according to an embodiment of the present application. Referring to Fig. 1, the micro-processing chip comprises a processor 110, an analog EEPROM 120, and possibly other modules 130. The analog EEPROM 120 comprises a memory controller 121, a volatile random memory ERAM 122 for analog EEPROM, a non-volatile memory EFLASH 123 for backing up EEPROM data, and a valid record number memory 124. The processor 110, the analog EEPROM 120, and the other modules 130 are coupled bidirectionally through a system bus.
[0063] The processor can be any type of processor, such as a microprocessor, a digital signal processor, or any other type of interconnect master that can access a memory system. The ERAM is a volatile random memory with fast read and write speed, and the EFLASH is a non-volatile random memory with relatively slow read and write speed. The valid record number memory is used to count the valid records in each sector under the control of the memory controller, to store the valid record number of each sector. The valid record number memory 124 can be a separate memory independent of the EFLASH 123, or a region of the EFLASH 123 can be partitioned as the valid record number memory 124. The present application preferably uses a separate valid record number memory 124, which does not change the original partition structure and manner of the EFLASH 123, and makes the control more simple. The reset signal is used to reset the processor, the valid record number memory, and the memory controller.
[0064] The processor is used to send an access request to the memory controller in the memory system. The access request can be a read request or a write request. When the access request is a read request, the read request sent needs to include the corresponding access address; when the access request is a write request, the write request sent needs to carry a data record. The data record specifically includes address information of the access address and actual data information to be written.
[0065] The memory controller is used to determine the type of the access request after receiving the access request. In case of read access, the memory controller accesses the ERAM and returns the data corresponding to the address to the processor. In case of write access, the memory controller first detects whether the ERAM needs to be updated. If the data needs to be written into the ERAM corresponding address, the data and the access address are written into the next available address of the EFLASH, and the number of valid records of the current sector is updated. If the data of the write request is consistent with the data of the ERAM corresponding address, the ERAM does not need to be updated. If the data of the write request is not consistent with the data of the ERAM corresponding address, the ERAM needs to be updated and written into the EFLASH. In this way, the time of the entire writing process can be saved, the writing speed is improved, and no additional EFLASH space is occupied, thereby prolonging the period available for writing of the EFLASH, and reducing the number of erasing invalid data and transferring valid data in the later period, and improving the durability.
[0066] When writing the data record into the EFLASH, the data information and the address information need to be written into the active sector of the EFLASH.
[0067] The EFLASH is divided into multiple sectors, and each sector is used to store data. The active sector is the sector currently writing data. In addition to the active sector, there are empty sectors and full sectors. The empty sector is a sector that does not write data records at any empty address, and the full sector is a sector that has written full data records and does not have an empty address for writing new data records. When the active sector is full of data, it becomes a full sector.
[0068] As shown in FIG. 2, an analog electrically erasable memory is provided according to an embodiment of the present application, and the correspondence and structure of the EFLASH and the ERAM are specifically shown.
[0069] Referring to FIG. 2, in a sector of the EFLASH, sector information and sector records are included.
[0070] Each sector or several sectors are allocated a region for storing the sector information of the corresponding sector. The sector information includes the number of times of erasing the corresponding sector and the state of the corresponding sector. The state of the sector generally includes an empty sector, a full sector, and an active sector. When the number of times of erasing the corresponding sector and the state of the sector change, the sector information is updated.
[0071] The sector record contains the actual stored content in the sector. Each sector record includes address information for recording the access address of the corresponding ERAM, data information in the access address, and flag information for indicating whether the data record is a valid record or an invalid record. That is, the sector record specifically contains the written data record and flag information for indicating whether the data record is valid. Optionally, the data information also includes check information, such as ECC check bits or parity check bits of the address and data.
[0072] The valid record number storage is used to count the valid records in the sector after the data record is written.
[0073] Referring to FIG. 2, in the sector provided by the embodiment of the present application, the first row is sector information, used to record the sector state and the number of times of erasing of the sector. The second row to the last row are sector records. In each sector record, the first column is flag information, used to record whether the data record is a valid record or an invalid record, and when there is no address information and data information written in the sector record, the flag information corresponding to the sector record is empty; the second column is address information, used to store the corresponding ERAM access address; and the third column is data information, used to actually store the written data, i.e., the corresponding data of the ERAM access address.
[0074] Referring to FIG. 2, when writing 0x1111 to ERAM address 0x000, the memory controller records the corresponding ERAM address 0x000 and data content 0x1111 in the first empty address of the sector, modifies the flag to valid, and updates the valid record number of the sector to 1 through the valid record number storage (note that the update of the valid record number can be real-time, or after a certain time or a certain amount, or after all the valid records of the sector are processed, the present application does not limit the specific update time).
[0075] Then, when writing 0x2222 to ERAM address 0x000, the memory controller records the corresponding ERAM address 0x000 and data content 0x2222 in the second empty address of the sector, modifies the flag to valid, and updates the valid record number of the sector to 2 through the valid record number storage. The first data record becomes an invalid record, the flag of the first data record is modified to invalid, and the valid record number of the sector is updated to 1.
[0076] When writing 0x3333 to ERAM address 0x002, the corresponding ERAM address 0x002 and data content 0x3333 are recorded in the third empty address of the sector, the flag is modified to valid, and the valid record number of the sector is updated to 2 through the valid record number storage.
[0077] After that, the situation is similar, 0x1111 of ERAM address 0x003 and 0x4444 of ERAM address 0x1FE are written into the active sector respectively, until all empty addresses of the active sector are written with data information, the sector will become a full sector. Of course, if these address information can not be written into the same sector, but maybe written into two or more sectors, but the principle is the same.
[0078] When all empty addresses in the active sector are filled with data records, the active sector becomes a full sector. At this time, it is necessary to select a sector from the empty sector as the active sector for continuing to perform the write of data.
[0079] In order to ensure that there is a certain storage space, so as to maintain the durability of the system, it is necessary to ensure that there is a certain number of empty sectors. Therefore, when the number of empty sectors is lower than the preset threshold, the memory controller is also used to erase the current full sector, and re-compress it into an empty sector, so as to ensure the number of empty sectors.
[0080] Specifically, when the memory controller erases the full sector, it needs to select one full sector from several full sectors as a compression sector for erasing. When selecting the compression sector, the compression sector is selected based on the number of erasures and the number of valid records contained in turn.
[0081] Among them, since EFLASH has an erase life, when the number of erasures exceeds the life value, EFLASH will be damaged. Therefore, in order to ensure the overall life of EFLASH, it is not allowed to continuously erase one or several sectors, and each sector needs to be uniformly erased. The number of sector erasures is recorded in the sector information, which is used to ensure that each sector is uniformly erased. Therefore, when selecting the compression sector, in order to prolong the service life, based on the number of times each sector has been erased, the full sector with the least number of erasures is selected as the compression sector, so that after performing multiple erasures, the number of erasures of each sector can be ensured to be similar.
[0082] At the same time, in order to improve the erasing efficiency, that is, to erase as many invalid records as possible through one erasing to release more space, when selecting the compression sector, based on the number of valid records contained in each sector, the full sector with the least number of valid records is selected as the compression sector, so as to erase more invalid records and release more space.
[0083] When the memory controller performs one erasing of the compression sector, the number of valid records is stored in the memory to update the number of times the sector is erased.
[0084] With reference to the micro-processing chip and the analog electric erasable memory shown in FIG. 1-2, the embodiment of the present application further provides an analog electric erasable memory data processing method. As shown in FIG. 3, a flow chart of the analog electric erasable memory data processing method provided by the embodiment of the present application is shown, which is applied to the memory controller shown in FIG. 1. As shown in FIG. 3, the specific steps of the method include:
[0085] S301, in response to the access request, determining whether there is an active sector in all sectors when the access request is a write request.
[0086] Specifically, the memory controller in the analog electric erasable memory responds to the access request issued by the processor and determines the type of the access request. When the access request is a read request, the corresponding access address is accessed and the corresponding data is read back to the processor, without writing in the active sector and triggering the determination of whether there is an active sector. When the access request is a write request, the data is written into the ERAM and it is determined whether there is an active sector.
[0087] Further, in the case of read access, the memory controller accesses the ERAM and returns the data of the corresponding address to the processor. In the case of write access, the memory controller first detects whether the ERAM needs to be updated. If the data needs to be written into the corresponding address of the ERAM, the data and the access address are written into the next available address of the EFLASH, and the number of valid records of the current sector is updated. If the data of the write request is consistent with the data of the corresponding address of the ERAM, the ERAM does not need to be updated. If the data of the write request is different from the data of the corresponding address, the ERAM needs to be updated and written into the EFLASH. In this way, the time of the entire writing process can be saved, the writing speed can be improved, and no additional EFLASH space is occupied, thereby prolonging the period available for writing in the EFLASH, reducing the number of erasure times of invalid data and the number of transfer times of valid data in the later period, and improving the durability.
[0088] S302, when there is an active sector, writing the data record carried in the write request into the empty address of the active sector.
[0089] Specifically, a data record includes address information and data information.
[0090] S303, when there is no active sector, selecting an empty sector with the least number of erasures as the active sector; wherein when the number of empty sectors reaches a preset threshold, selecting a full sector with the least number of erasures and the least number of valid records in the full sector as the compression sector.
[0091] Specifically, when it is determined that there is no active sector, it is required to determine an active sector from the empty sectors, and after the active sector is determined, the data record carried in the write request is written into the active sector.
[0092] When the active sector is determined from the empty sectors, it is required to determine the active sector based on the number of times each empty sector is erased, and the empty sector with the least number of times of erasure is determined as the active sector from all the empty sectors. When there are at least two empty sectors with the least number of times of erasure (i.e., there are at least two sectors with the same number of times of erasure), the active sector is determined from them according to the size order of the sector numbers (e.g., in the case of the same number of times of erasure, the sector with the smaller sector number is selected as the active sector, and of course, the sector with the larger sector number can also be selected as the active sector), or the active sector is determined from them randomly.
[0093] The empty sector is a sector in which no data record is written at any empty address.
[0094] Optionally, in some embodiments, after a certain empty sector is determined as an active sector, because the number of empty sectors is reduced, it is required to determine whether the number of empty sectors reaches a preset threshold. When it is determined that the number of empty sectors reaches the preset threshold, it is determined to trigger the execution of sector compression.
[0095] Specifically, the full sector with the least number of times of erasure is selected as the compression sector according to the number of times of erasure of each full sector and the number of valid records contained in each full sector, and the full sector with the least number of valid records in the full sector with the least number of times of erasure is determined as the compression sector.
[0096] The full sector with the least number of times of erasure is selected as the compression sector from each full sector. When there are two or more full sectors with the least number of times of erasure, the full sector with the least number of valid records is determined as the compression sector from the full sectors with the least number of times of erasure.
[0097] Optionally, when there are still multiple full sectors with the same number of valid records and the same least number of valid records in the multiple full sectors with the least number of times of erasure, the compression sector is determined from them according to the size order of the sector numbers, or the compression sector is determined from them randomly.
[0098] The full sector is a sector in which there is no sector available for writing a data record.
[0099] S304, the valid records in the compression sector are written into the active sector, the data records in the compression sector are erased, the number of times of erasure of the compression sector is updated, and the state of the compression sector is updated to an empty sector.
[0100] Specifically, as mentioned above, the latest data written is valid data, and the old data is likely to be no longer used, so the type of data record written includes valid records and invalid records. The valid records are newly written data records, and the invalid records are old data records that are overwritten by newly written data records and thus become invalid.
[0101] The address information and data information of all valid records in the compressed sector are written into the empty address of the active sector, and all the flag information in the active sector is marked as valid records. After writing the data record, the number of valid records in the active sector is updated by the valid record number storage, that is, the number is counted by 1 each time a data record is stored.
[0102] All data records in the compressed sector are erased, that is, all valid records and invalid records are erased. The state of the compressed sector is updated to an empty sector, written in the sector information of the sector, and the number of erasures of the sector is updated, that is, the number of erasures of the sector is counted by 1, written in the sector information of the sector. The valid record number storage can also update the valid record information of the empty sector, and the number of valid data is 0 at this time.
[0103] The embodiment of the application selects the active sector by a specific rule, selects the empty sector with the least number of erasures as the active sector, selects the sector with the least valid data in the empty sector with the least number of erasures for erasure when the compressed sector is selected, delays the transfer of valid data, and there is more space in the active sector to write new data records. With the writing of new data records, more data in the data records to be transferred is invalidated and does not need to be transferred, improving the proportion of valid data in the EFLASH and improving the durability.
[0104] Optionally, after writing the data record carried in the write request into the empty address of the active sector in S302, the number of valid records in each sector needs to be updated and counted.
[0105] Specifically, when the data is written as a valid record, the number of valid records in the active sector is counted by 1 by the valid record number memory. At the same time, it is determined whether the old data with the same access address is invalidated by the newly written data in the active sector and other sectors. When it is determined that there is old data with the same access address, the valid record number of the corresponding sector is counted by -1. For example, in the active sector, sector 1 is written with DATAB at address A, and the flag information is modified to valid, and the valid record number of sector 1 is counted by 1. The flag information of the data DATAA at address A stored in sector 2 is modified to invalid, and the valid record number of sector 2 is counted by -1. Note that the counting by 1 and -1 here not only represents the number 1, but also can be a value agreed upon, such as increasing the valid record number by 2, 3, 4, … for each valid record. This should not be a limitation on the present application.
[0106] As shown in FIG. 4, it is a schematic diagram of a specific sector compression method provided by an embodiment of the present application. In this specific embodiment, the capacity of the EFLASH is 8 KB, the capacity of each sector is 1 KB, and the bit width is 32 bits; the capacity of the ERAM is 1 KB, and the bit width is 16 bits; each data record contains 16-bit data, 9-bit address, and 7-bit flag. In addition, 32 bits are required for each sector to store sector information. In addition to this, each sector can store 255 data records.
[0107] Referring to FIG. 4, based on the time sequence, the sector information of the eight sectors in the EFLASH is shown. Among them, the numbers in the parentheses () represent the order in which the corresponding sectors are filled, the numbers in the square brackets [ ] represent the number of times the corresponding sectors are erased, and the numbers on the underscores _ represent the number of valid records in the corresponding sectors. (As described above, the valid record number can be set in the sector information or in a separate valid record number memory)
[0108] Specifically, at T0 moment, the memory controller receives the write request issued by the processor, and determines that there is no active sector, and needs to select one from the two empty sectors as the active sector. In determining the active sector, the empty sector is determined based on the number of erasures. In the example, two empty sectors, sector 4 and sector 8, are shown. If the number of erasures of one of the sectors is less than that of the other sector, the sector with fewer erasures is selected, such as sector 4 with 11 sector erasures and sector 8 with 12 sector erasures. Sector 4 is selected as the active sector. In this example, since the number of erasures of sector 4 and sector 8 is the same, sector 4 is selected as the active sector based on the sector number (of course, sector 8 can also be selected, and in the case of the same number of sector erasures, the sector with the larger number is selected as the active sector). At this time, the number of valid records in the active sector is 0, and the number of empty addresses is 255.
[0109] At T1, the state of sector 4 changes from empty sector to active sector, and the number of empty sectors is 1, which is less than the preset threshold 2, triggering sector compression. In the sector compression, the compression sector is determined from the full sectors based on the number of valid records and the number of erasures of each full sector, rather than directly selecting the earliest filled sector 5 as the active sector. Since sectors 1, 2, 5, 6, and 7 have the same number of erasures, the sector 1 with the least number of valid records is selected as the compression sector based on the number of valid records. If sector 2 has the least number of erasures among sectors 1, 2, 5, 6, and 7, sector 2 is selected as the compression sector. In the case of the same number of erasures in full sectors, the full sector with the least number of valid records is selected as the compression sector.
[0110] At T2, the valid records in the compression sector 1 (for example, sector 1 is selected as the compression sector at T1) are all written into the active sector, the number of valid records in the active sector becomes 30, the valid records in the compression sector are invalidated, and the number of valid records in the compression sector becomes 0.
[0111] At T3, the records in the compression sector are erased. The state of sector 1 is updated to empty sector, and the number of erasures is updated to 12.
[0112] At T4, the active sector is filled with new data, and more and more old data records are invalidated due to the same address information as the new data records. The number of valid records in the active sector reaches 180, and the state of the active sector is updated to full sector. For example, in the example, part of the valid records in sectors 2 and 5 are invalidated and become invalid records. The number of valid records in sectors 2 and 5 is 20 and 9, respectively.
[0113] At T5, there is no active sector, and the active sector is re-determined. Since sectors 1 and 8 have the same number of erasures, sector 1 is selected as the active sector based on the sector number.
[0114] The above describes specific embodiments of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different than the order in the embodiments and still achieve the desired result. In addition, the processes depicted in the figures do not necessarily require the particular order shown or sequential order to achieve the desired results. In certain implementations, multitasking and parallel processing can be advantageous or possible.
[0115] In addition, the terms "first", "second", etc. are used herein only to describe different instances, and do not imply or suggest relative importance or a number of the technical features indicated. Thus, the features defined as "first", "second", etc. can explicitly or implicitly include at least one of the features. In the description of the specification, the meaning of "a plurality of" is at least two, such as two, three, etc., unless otherwise explicitly specified.
[0116] Any process or method descriptions or descriptions of the flow diagrams described herein or otherwise described in this specification can be understood as representing modules, segments, or portions of code that include one or more executable instructions for implementing specific logical functions or steps in the process, and the preferred embodiments of the specification include additional implementations in which the order of steps can be different from those shown or discussed, including a substantially simultaneous performance of the functions according to the functionality involved, or in reverse order, which should be understood by those skilled in the art to which the embodiments of the specification belong.
[0117] Depending on the context, the word "if" as used herein can be interpreted to mean "when" or "while" or "in response to determining" or "in response to detecting". Similarly, the phrase "if it is determined" or "if (a stated condition or event) is detected" can be interpreted to mean "when it is determined" or "in response to determining" or "when (a stated condition or event) is detected" or "in response to detecting (a stated condition or event)".
[0118] It should be noted that the terminal involved in the embodiments of the specification can include, but is not limited to, a personal computer (Personal Computer; hereinafter referred to as PC), a personal digital assistant (Personal Digital Assistant; hereinafter referred to as PDA), a wireless handheld device, a tablet computer, a mobile phone, an MP3 player, an MP4 player, etc.
[0119] In the embodiments provided in the specification, it should be understood that the disclosed system, device and method can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division, and actual implementation can have another division manner. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units or components shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, and can be electrical, mechanical or other forms.
[0120] In addition, the various functional units in the various embodiments of the present specification can be integrated into one processing unit, or each unit can exist physically, or two or more units can be integrated into one unit. The integrated unit can be implemented in the form of hardware, or in the form of hardware plus software function units.
[0121] The integrated unit implemented in the form of software function units can be stored in a computer readable storage medium. The software function unit stored in the storage medium includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute part of the steps of the method described in the various embodiments of the present specification.
[0122] The above only describes the preferred embodiments of the present specification and is not intended to limit the present specification. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the protection scope of the present specification.
Claims
1. A method of processing data in an analog electrically erasable memory, characterized by, The method comprises: in response to an access request, when the access request is a write request, determining whether there is an active sector in all sectors; when there is the active sector, writing the data record carried in the write request to the empty address of the active sector; when there is no active sector, selecting an empty sector with the least number of erasures as an active sector; when it is determined that the number of empty sectors reaches a preset threshold, selecting a full sector with the least number of valid records in the full sector with the least number of erasures as a compression sector; writing the valid record in the compression sector to the active sector, erasing the data record in the compression sector, updating the erasure number information of the compression sector, and updating the state of the compression sector to an empty sector; wherein the information recorded by the data record includes address information and data information, and the flag information is used to represent whether the corresponding data record is a valid record or an invalid record.
2. The method of claim 1, wherein, The selection of the full sector with the least number of valid records in the full sector with the least number of erasures as the compression sector comprises: determining the full sector with the least number of erasures in all full sectors as the compression sector; when there are at least two full sectors with the least number of erasures, determining the full sector with the least number of valid records as the compression sector.
3. The method of claim 2, wherein, The method further comprises: when there are at least two full sectors with the least number of valid records in the full sector with the least number of erasures, determining the compression sector according to the size of the sector serial number.
4. The method of claim 1, wherein, The selection of the empty sector with the least number of erasures as the active sector comprises: determining the empty sector with the least number of erasures in all empty sectors as the active sector; when there are at least two empty sectors with the least number of erasures, determining the active sector according to the size of the sector serial number.
5. The method of claim 4, wherein, After writing the data record carried in the write request to the empty address of the active sector, the method further comprises updating the number of valid records in each sector; when the data record is written as a valid record, the number of valid records in the active sector is counted by 1; if there are the same access address corresponding to the old data record in the active sector and / or other sectors, the flag information of the old data record is changed to the flag information representing that the data record is an invalid record, and the number of valid records in the corresponding sector is counted by -1.
6. The method according to any one of claims 1 to 5, characterized in that, The sector comprises sector information and sector record; The sector information is used to mark the number of erasures of the corresponding sector and the state of the corresponding sector, and the state comprises an empty sector, a full sector and an active sector; The sector record comprises the flag information and the data record.
7. An analog electrically erasable memory characterized by, It comprises: a memory controller, a volatile random memory and a non-volatile memory; The memory controller is used to receive the access request sent by the processor, when the access request is a read request, the memory controller accesses the volatile random memory, and the data information of the corresponding address in the volatile random memory is transmitted back to the processor; when the access request is a write request, it is determined whether there is an active sector in all sectors in the non-volatile memory; writing data records carried in the write request into empty addresses of the active sector when the active sector exists; selecting an empty sector with the least number of erasures as the active sector when the active sector does not exist; and selecting a full sector with the least number of valid records from full sectors with the least number of erasures as a compression sector when it is determined that the number of empty sectors reaches a preset threshold; writing valid records in the compression sector into the active sector, erasing the data records in the compression sector, updating the number of erasures of the compression sector, and updating the state of the compression sector as an empty sector; wherein the information recorded in the data records includes address information and data information, and flag information is used to represent whether the data records are valid records or invalid records; and each sector of the non-volatile memory includes sector information, which is used to mark the number of erasures of the corresponding sector and the state of the corresponding sector, the state including an empty sector, a full sector, and an active sector.
8. The memory controller of claim 7, wherein, The selecting of the full sector with the least number of valid records from the full sectors with the least number of erasures as the compression sector includes: determining the full sector with the least number of erasures from all the full sectors as the compression sector; when there are at least two full sectors with the least number of erasures, determining the full sector with the least number of valid records as the compression sector.
9. The memory controller of claim 8, wherein, The selecting of the full sector with the least number of valid records from the full sectors with the least number of erasures as the compression sector includes: determining the full sector with the least number of erasures from all the full sectors as the compression sector; 10. The storage controller of claim 7, wherein, when there are at least two full sectors with the least number of erasures, determining the full sector with the least number of valid records as the compression sector. The selecting of the full sector with the least number of valid records from the full sectors with the least number of erasures as the compression sector includes: determining the full sector with the least number of erasures from all the full sectors as the compression sector; 11. The analog electrically-erasable memory of claim 7, wherein, when there are at least two full sectors with the least number of erasures, determining the full sector with the least number of valid records as the compression sector. The selecting of the full sector with the least number of valid records from the full sectors with the least number of erasures as the compression sector includes: determining the full sector with the least number of erasures from all the full sectors as the compression sector; 12. The valid recording count memory of claim 11, wherein, when there are at least two full sectors with the least number of erasures, determining the full sector with the least number of valid records as the compression sector. The selecting of the full sector with the least number of valid records from the full sectors with the least number of erasures as the compression sector includes: determining the full sector with the least number of erasures from all the full sectors as the compression sector; 13. An analog electrically erasable memory as claimed in any of claims 7-12, characterized in that, when there are at least two full sectors with the least number of erasures, determining the full sector with the least number of valid records as the compression sector. The selecting of the full sector with the least number of valid records from the full sectors with the least number of erasures as the compression sector includes: determining the full sector with the least number of erasures from all the full sectors as the compression sector; when there are at least two full sectors with the least number of erasures, determining the full sector with the least number of valid records as the compression sector. The selecting of the full sector with the least number of valid records from the full sectors with the least number of erasures as the compression sector includes: determining the full sector with the least number of erasures from all the full sectors as the compression sector; when there are at least two full sectors with the least number of erasures, determining the full sector with the least number of valid records as the compression sector. The selecting of the full sector with the least number of valid records from the full sectors with the least number of erasures as the compression sector includes: determining the full sector with the least number of erasures from all the full sectors as the compression sector; when there are at least two full sectors with the least number of erasures, determining the full sector with the least number of valid records as the compression sector. The selecting of the full sector with the least number of valid records from the full sectors with the least number of erasures as the compression sector includes: determining the full sector with the least number of erasures from all the full sectors as the compression sector; when there are at least two full sectors with the least number of erasures, determining the full sector with the least number of valid records as the compression sector. The selecting of the full sector with the least number of valid records from the full sectors with the least number of erasures as the compression sector includes: determining the full sector with the least number of erasures from all the full sectors as the compression sector; when there are at least two full sectors with the least number of erasures, determining the full sector with the least number of valid records as the compression sector. The selecting of the full sector with the least number of valid records from the full sectors with the least number of erasures as the compression sector includes: determining the full sector with the least number of erasures from all the full sectors as the compression sector; when there are at least two full sectors with the least number of erasures, determining the full sector with the least number of valid records as the compression sector. The selecting of the full sector with the least number of valid records from the full sectors with the least number of erasures as the compression sector includes: determining the full sector with the least number of erasures from all the full sectors as the compression sector; when there are at least two full sectors with the least number of erasures, determining the full sector with the least number of valid records as the compression sector. The selecting of the full sector with the least number of valid records from the full sectors with the least number of erasures as the compression sector includes: determining the full sector with the least number of erasures from all the full sectors as the compression sector; when there are at least two full sectors with the least number of erasures, determining the full sector with the least number of valid records as the compression sector. The selecting of the full sector with the least number of valid records from the full sectors with the least number of erasures as the compression sector includes: determining the full sector with the least number of erasures from all the full sectors as the compression sector; when there are at least two full sectors with the least number of erasures, determining the full sector with the least number of valid records as the compression sector. The selecting of the full sector with the least number of valid records from the full sectors with the least number of erasures as the compression sector includes: determining the full sector with the least number of erasures from all the full sectors as the compression sector; when there are at least two full sectors with the least number of erasures, determining the full sector with the least number of valid records as the compression sector. The selecting of the full sector with the least number of valid records from the full sectors with the least number of erasures as the compression sector includes: determining the full sector with the least number of erasures from all the full sectors as the compression sector; when there are at least two full sectors with the least number of erasures, determining the full sector with the least number of valid records as the compression sector. The selecting of the full sector with the least number of valid records from the full sectors with the least number of erasures as the compression sector includes: determining the full sector with the least number of erasures from all the full sectors as the compression sector; when there are at least two full sectors with the least number of erasures, determining the full sector with the least number of valid records as the compression sector. The selecting of the full sector with the least number of valid records from the full sectors with the least number of erasures as the compression sector includes: determining the full sector with the least number of erasures from all the full sectors as the compression sector; when there are at least two full sectors with the least number of erasures, determining the full sector with the least number of valid records as the compression sector. The selecting of the full sector with the least number of valid records from the full sectors with the least number of erasures as the compression sector includes: determining the full sector with the least number of erasures from all the full sectors as the compression sector; when there are at least two full sectors with the least number of erasures, determining the full sector with the least number of valid records as the compression sector. The selecting of the full sector with the least number of valid records from the full sectors with the least number of erasures as the compression sector includes: determining the full sector with the least number of erasures from all the full sectors as the compression sector; when there are at least two full sectors with the least number of erasures, determining the full sector with the least number of valid records as the compression sector. The selecting of the full sector with the least number of valid records from the full sectors with the least number of erasures as the compression sector includes: determining the full sector with the least number of erasures from all the full sectors as the compression sector; when there are at least two full sectors with the least number of erasures, determining the full sector with the least number of valid records as the compression sector. The selecting of the full sector with the least number of valid records from the full sectors with the least number of erasures as the compression sector includes: determining the full sector with the least number of erasures from all the When the data information of the write request is different from the data information of the volatile random memory corresponding address, the data information of the volatile random memory corresponding address is updated and the data record is written into the non-volatile memory.
14. A micro-processing chip comprising a processor and the analog electrically erasable memory of any one of claims 7 to 13. The micro-processing chip is configured to issue an access request to a memory controller in the analog electrically erasable memory by the processor, the access request comprising a read request and a write request.
Citation Information
Patent Citations
Emulated electrically erasable (EEE) memory and method of operation
CN102870099A
Dynamic compression in an electrically erasable programmble read only memory (eeprom) emulation system
CN109754839A
Memory load balancing method, device and equipment
CN114281242A
Analog electrically erasable memory data processing method, memory and micro-processing chip
CN118471299A
Operating an emulated electrically erasable (EEE) memory
US20110078362A1