CN101286136B - Method and device storing data in electrically erasable programmable read only memory - Google Patents

Method and device storing data in electrically erasable programmable read only memory Download PDF

Info

Publication number
CN101286136B
CN101286136B CN2008101048676A CN200810104867A CN101286136B CN 101286136 B CN101286136 B CN 101286136B CN 2008101048676 A CN2008101048676 A CN 2008101048676A CN 200810104867 A CN200810104867 A CN 200810104867A CN 101286136 B CN101286136 B CN 101286136B
Authority
CN
China
Prior art keywords
data
length
module
subset
cell
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN2008101048676A
Other languages
Chinese (zh)
Other versions
CN101286136A (en
Inventor
冯备战
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Vimicro Corp
Original Assignee
Vimicro Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Vimicro Corp filed Critical Vimicro Corp
Priority to CN2008101048676A priority Critical patent/CN101286136B/en
Publication of CN101286136A publication Critical patent/CN101286136A/en
Application granted granted Critical
Publication of CN101286136B publication Critical patent/CN101286136B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The embodiment of the invention discloses a method for memorizing data in EEPROM. The method comprises the steps that: A. a data sub-set with the longest length in a data set required to be memorized is distributed to at least a continuous data unit and the data unit finally distributed is taken as a current data unit; B. when the length of at least one data sub-set not distributed is less than or equal to the residual length of the current data unit, the data sub-set which is not distributed and is provided with the length less than or equal to the residual length of the current data unit and with the longest residual length is distributed to the current data unit, the residual length of the current data unit is calculated, and the step B is returned to; C. according to the distribution situation, the distributed data sub-set is memorized in the distributed data unit. The embodiment of the invention also discloses a device used for memorizing the data in the EEPROM. By the method andthe device of the invention, the memory space of the EEPROM is saved and the utilization ratio of the EEPROM is improved.

Description

Data storing method and device in EEPROM (Electrically Erasable Programmable Read Only Memo)
Technical field
The present invention relates to data storage technology, refer in particular to a kind of in EEPROM (Electrically Erasable Programmable Read Only Memo) data storing method and device.
Background technology
In the prior art, EEPROM (Electrically Erasable Programmable Read Only Memo) (EEPROM, Electrically ErasableProgrammable Read-Only Memory) is a kind of have electricity programming and electric storer of ability of wiping.Use this storer, even also can keep the data of being stored during power down, so EEPROM has obtained application more and more widely.
In EEPROM, array data can be kept in each data cell.But, in existing technical scheme, when storage array data in EEPROM, if a data unit is taken (promptly having stored some array datas in this data cell) by some array datas, even then still have remaining storage space in this data cell, this remaining storage space is not used further to store other array data yet, thereby has wasted the storage space of EEPROM significantly, cause the utilization factor of EEPROM not high, increased the cost that uses EEPROM.
Summary of the invention
In view of this, the fundamental purpose of the embodiment of the invention be to provide a kind of in EEPROM data storing method and device, thereby saved the storage space of EEPROM, improved the utilization factor of EEPROM.
For achieving the above object, the technical scheme in the embodiment of the invention is achieved in that
A kind of in EEPROM (Electrically Erasable Programmable Read Only Memo) data storing method, this method comprises:
A, the longest data subset of length in the data acquisition of required preservation is distributed at least one continuous data cell in the EEPROM (Electrically Erasable Programmable Read Only Memo), with last data cell that is assigned with as the current data unit;
B0, judge whether the data subset that all are not assigned with length all greater than the residue length of current data unit; If, execution in step C then; Otherwise, execution in step B;
B, residue length and the longest data subset that is not assigned with of length that length is less than or equal to the current data unit are distributed to the current data unit, calculate the residue length of current data unit, return execution in step B0;
C, the data subset that will be assigned with according to distribution condition store in the data cell of being distributed.
A kind of device of storing data in EEPROM (Electrically Erasable Programmable Read Only Memo) also is provided in the embodiments of the invention, and this device comprises: cache module, length detection module, data sorting module, data allocations module and data are preserved module;
Described cache module is used for the data that buffer memory need store EEPROM (Electrically Erasable Programmable Read Only Memo) into, and institute's data in buffer is divided at least one data subset;
Described length detection module is used for detecting the length of each data subset that described cache module stores, and testing result is sent to described data sorting module;
Described data sorting module is used for according to received testing result above-mentioned each data subset being sorted, and ranking results is sent to described data allocations module;
Described data allocations module is used for according to received ranking results, and the longest data subset of length in the data acquisition of required preservation is distributed at least one continuous data cell, with last data cell that is assigned with as the current data unit; The length and the longest data subset that is not assigned with of length that are not more than the residue length of current data unit are distributed to the current data unit, until the length of all data subsets that are not assigned with all greater than the residue length of current data unit; Distribution condition is sent to described data preserve module;
Described data are preserved module, are used for storing the data cell of being distributed into according to the data subset that received distribution condition will be assigned with.
In summary, provide in the embodiments of the invention a kind of in EEPROM data storing method and device.By above-mentioned method and apparatus, the data of required storage can be stored in as far as possible in the remaining space of data cell among the EEPROM, thereby solve the waste problem of data cell remaining space when in EEPROM, preserving data, saved the storage space of EEPROM, improve the utilization factor of EEPROM, reduced the cost that uses EEPROM.
Description of drawings
Fig. 1 be in the embodiment of the invention in EEPROM the general flow chart of data storing method.
Fig. 2 be in the embodiment of the invention in EEPROM the particular flow sheet of data storing method.
Fig. 3 is the synoptic diagram of the data storage device in the embodiment of the invention.
Embodiment
For making the purpose, technical solutions and advantages of the present invention express clearlyer, the present invention is further described in more detail below in conjunction with drawings and the specific embodiments.
In an embodiment of the present invention, in order to utilize the storage space of EEPROM more fully, proposed a kind of in EEPROM data storing method and device.Fig. 1 be in the embodiment of the invention in EEPROM the general flow chart of data storing method.As shown in Figure 1, in the embodiment of the invention in EEPROM data storing method comprise step as described below:
Step 101 is distributed at least one continuous data cell with the longest data subset of length in the data acquisition of required preservation, with last data cell that is assigned with as the current data unit.
Specifically, when the length of the longest data subset of above-mentioned length is less than or equal to the length of first data cell, the longest data subset of above-mentioned length can be distributed to above-mentioned first data cell, and with above-mentioned first data cell as the current data unit; And when the length of the longest data subset of above-mentioned length during greater than the length of above-mentioned first data cell, the longest data subset of above-mentioned length can be distributed to a plurality of continuous data cell that comprises above-mentioned first data cell, and with last data cells of above-mentioned a plurality of continuous data cells as the current data unit;
Step 102, the length that judges whether the data subset that all are not assigned with are all greater than the residue length of current data unit.If then execution in step 104; Otherwise, execution in step 103.
The size that can compare specifically, the residue length of the length of each data subset that is not assigned with and current data unit earlier; If all greater than the residue length of current data unit, then execution in step 104 for the length of the data subset that all are not assigned with; And if the length that at least one data subset that is not assigned with is arranged is less than or equal to the residue length of current data unit, then execution in step 103.
Step 103, the residue length and the longest data subset that is not assigned with of length that length are less than or equal to the current data unit are distributed to the current data unit, calculate the residue length of current data unit, return execution in step 102;
Step 104, the data subset that will be assigned with according to distribution condition stores in the data cell of being distributed.
After step 104, the start address of the data cell that the next one can also be used is as the initial address of current data unit, according to above-mentioned method other received not stored data are stored into respectively in the corresponding data cell then, all be stored in the corresponding data cell up to all data.
For clearer, at length technical scheme of the present invention is introduced, below will provide the embodiment more concrete than said method.
Fig. 2 be in the embodiment of the invention in EEPROM the particular flow sheet of data storing method.As shown in Figure 2, in the embodiment of the invention in EEPROM data storing method specifically comprise step as described below:
Step 201 is provided with the length of initial address and data cell.
Specifically, EEPROM is made of a plurality of equal-sized data cells, system can be provided with the size (being the length of each data cell) of the data cell among the EEPROM, also can the initial address of the data cell that is used to store following first data or array among the EEPROM be provided with.
In addition, this step can be carried out before any step in step 202~205, so does not have the ordinal relation of execution between step 201 and step 202~205.
Step 202 receives the data of required preservation.
Specifically, the data that received can be formed a data set, and the data in will gathering are divided into a plurality of data subsets, the size of each data subset can equate, also can be unequal.Therefore, described data subset can be array or file, and for the convenience of narrating, in an embodiment of the present invention, the set that will be unit with the array to data is divided into example and describes, and at this moment, above-mentioned data subset is an array.
Step 203 detects the length of each array.
Specifically, system will detect the length of each array in the above-mentioned data acquisition, generates testing result.
Step 204 sorts to each array according to testing result.
Specifically, after detection finishes, system will sort to each array in the data set according to testing result, generate ranking results.When each array is sorted, can sort according to the length of array, for example, sort, or sort from being short to long order according to array length according to the order of array length from growing to lacking; In addition, also can use any sort method to carry out above-mentioned ordering, for example, rank order method, bubble sort method, quicksort method etc.
Step 205 is determined current array and current data unit.
Specifically, system will determine current array according to ranking results according to above-mentioned, be about to length is the longest in the array of each required storage array as current array, and will be used to store first data cell of above-mentioned array as the current data unit.
Step 206 is judged the length L of current array dWhether greater than the length L of current data unit uPromptly judge whether L d>L u, if then execution in step 207; Otherwise, execution in step 210.
Step 207 calculates the number n that stores the required data cell of current array.
Specifically, can be by calculating L dWith L uThe merchant know and the number of the required minimum data cell of the current array of storage for example, can get: Div (L by calculating d, L u)=m, then when the remainder of Ld and Lu was not 0, the number of required data cell was n=m+1; Otherwise the number of required data cell is n=m.Wherein, the Div function representation is to L dWith L uThe operation that rounds of merchant, for example, Div (5,2)=2.
Step 208 is given a said n continuous data cell with current data allocation, redefines current array and current data unit.
Specifically, give n the continuous data cell that comprises the current data unit with the current number set of dispense, described n data unit is continuous n the data unit that begins from the current data unit; Then, according to above-mentioned according to ranking results with length is the longest in all arrays that are not assigned with array as current array, and with last data cell in the said n data unit as the current data unit.
Step 209, the residue length L of calculating current data unit r, execution in step 212.
Specifically, in this step, described residue length L rBe the residue length of current data unit, i.e. L r=(n*L u-L d).
Step 210 is given the current data unit with the current number set of dispense, redefines current array.
In this step, describedly redefine current array and be: according to above-mentioned according to ranking results with length is the longest in all arrays that are not assigned with array as current array.
Step 211, the residue length L of calculating current data unit r
Specifically, in this step, described residue length L rBe the residue length of current data unit, i.e. L r=(L u-L d).
Step 212 is judged residue length L rWhether equal zero.If then execution in step 216; Otherwise, execution in step 213.
Step 213, whether the length of judging current array is greater than residue length L rIf then execution in step 214; Otherwise, return execution in step 210.
Step 214 judges whether current array is last array that is not assigned with.If then execution in step 216; Otherwise, execution in step 215.
Step 215 as current array, returns the array of the next length maximum in the ranking results to execution in step 213.
Specifically, in this step, with the array of length maximum in the array that is not assigned with and is not compared in the above-mentioned ranking results as current array.
Step 216, according to above-mentioned distribution condition, with the storage of array that has been assigned with in corresponding data cell.
Step 217, the start address of the data cell that the next one is not used is as initial address.
Specifically, the start address of the data cell that exactly next one is not used is as the initial address of first data cell that is used to store the next group array.This address also can be referred to as to adjust the address.
By above-mentioned steps 202~217, the storage of array that first can be assigned with is in corresponding data cell.In like manner, can be by using the step identical with above-mentioned steps 205~217, the storage of array of the required storage of next group in corresponding data cell, all is stored in the corresponding data cell up to all arrays; After all arrays of this reception all are stored, can also receive the data of the required preservation of extraneous input once more, and according to the method described above with the data storage of required preservation in corresponding data cell, concrete storage means does not repeat them here.
Fig. 3 is the synoptic diagram of data storage device in the embodiment of the invention.As shown in Figure 3, the data storage device in the embodiment of the invention comprises: cache module, length detection module, data sorting module, data allocations module and data are preserved module.
Described cache module is used for the data that buffer memory need store EEPROM into, and institute's data in buffer is divided into a plurality of data subsets.Described data subset can be array or file.
Described length detection module is used for detecting the length of each data subset that cache module stores, and testing result is sent to the data sorting module;
Described data sorting module is used for according to received testing result above-mentioned each data subset being sorted, and ranking results is sent to the data allocations module;
Described data allocations module is used for according to received ranking results, and the longest data subset of length in the data acquisition of required preservation is distributed at least one data cell, with last data cell that is assigned with as the current data unit; The length and the longest data subset that is not assigned with of length that are not more than the residue length of current data unit are distributed to the current data unit, until the length of all data subsets that are not assigned with all greater than the residue length of current data unit; Distribution condition is sent to the preservation execution module;
Described data are preserved module, are used for storing the data cell of being distributed into according to the data subset that received distribution condition will be assigned with.
Described data storage device also comprises: parameter is provided with module and address adjusting module.
Described parameter is provided with module, is used to be provided with the initial address that the length of data cell and first are used to store the data cell of data; The length and the described initial address of set data cell are sent to described data allocations module.
Described address adjusting module, the start address that is used for data cell that the next one is not used is as the initial address of first data cell that is used to store the next group data subset; Set initial address is sent to described data allocations module.
Described data allocations module is used for length and initial address according to received ranking results, data cell, and the data subset of required storage is distributed to corresponding data cell.
The said method and the device that are provided among the application of the invention embodiment, the data of required storage can be stored in as far as possible in the remaining space of data cell among the EEPROM, thereby solve the waste problem of data cell remaining space when in EEPROM, preserving data, saved the storage space of EEPROM, improve the utilization factor of EEPROM, reduced the cost that uses EEPROM.
The above is preferred embodiment of the present invention only, is not to be used to limit protection scope of the present invention.Within the spirit and principles in the present invention all, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (7)

1. a data storing method in EEPROM (Electrically Erasable Programmable Read Only Memo) is characterized in that, this method comprises:
A, the longest data subset of length in the data acquisition of required preservation is distributed at least one continuous data cell in the EEPROM (Electrically Erasable Programmable Read Only Memo), with last data cell that is assigned with as the current data unit;
B0, judge whether the data subset that all are not assigned with length all greater than the residue length of current data unit; If, execution in step C then; Otherwise, execution in step B;
B, residue length and the longest data subset that is not assigned with of length that length is less than or equal to the current data unit are distributed to the current data unit, calculate the residue length of current data unit, return execution in step B0;
C, the data subset that will be assigned with according to distribution condition store in the data cell of being distributed.
2. method according to claim 1 is characterized in that, comprises before the described steps A:.
The length of each data subset in the data acquisition of A1, the required preservation of detection;
A2, the length of each data subset by data subset is sorted according to testing result.
3. method according to claim 1 is characterized in that, described steps A comprises:
When the length of the longest data subset of described length is less than or equal to the length of data cell, the longest data subset of described length is distributed to first data cell that is used to store data, with described first data cell as the current data unit;
When the length of the longest data subset of described length during, calculate the number n of the required minimum data cell of the longest data subset of the described length of storage greater than the length of data cell; The longest data subset of described length is distributed to continuous n the data unit that comprises first data cell that is used to store data, with n data unit as the current data unit.
4. method according to claim 1 is characterized in that, also comprises after the described step C:
The start address of the data cell that the next one is not used is as the initial address of current data unit.
5. according to claim 1,2,3 or 4 described methods, it is characterized in that described data subset is array or file.
6. the device of storage data in EEPROM (Electrically Erasable Programmable Read Only Memo) is characterized in that this device comprises: cache module, length detection module, data sorting module, data allocations module and data preservation module;
Described cache module is used for the data that buffer memory need store EEPROM (Electrically Erasable Programmable Read Only Memo) into, and institute's data in buffer is divided at least one data subset;
Described length detection module is used for detecting the length of each data subset that described cache module stores, and testing result is sent to described data sorting module;
Described data sorting module is used for according to received testing result above-mentioned each data subset being sorted, and ranking results is sent to described data allocations module;
Described data allocations module is used for according to received ranking results, and the longest data subset of length in the data acquisition of required preservation is distributed at least one continuous data cell, with last data cell that is assigned with as the current data unit; The length and the longest data subset that is not assigned with of length that are not more than the residue length of current data unit are distributed to the current data unit, until the length of all data subsets that are not assigned with all greater than the residue length of current data unit; Distribution condition is sent to described data preserve module;
Described data are preserved module, are used for storing the data cell of being distributed into according to the data subset that received distribution condition will be assigned with.
7. device according to claim 6 is characterized in that, described data storage device also comprises: parameter is provided with module and address adjusting module;
Described parameter is provided with module, is used to be provided with the initial address that the length of data cell and first are used to store the data cell of data; The length and the described initial address of set data cell are sent to described data allocations module;
Described address adjusting module, the start address that is used for data cell that the next one is not used is as the initial address of first data cell that is used to store the next group data subset; Set initial address is sent to described data allocations module;
Described data allocations module is used for length and initial address according to received ranking results, data cell, and the data subset of required storage is distributed to corresponding data cell.
CN2008101048676A 2008-04-24 2008-04-24 Method and device storing data in electrically erasable programmable read only memory Expired - Fee Related CN101286136B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2008101048676A CN101286136B (en) 2008-04-24 2008-04-24 Method and device storing data in electrically erasable programmable read only memory

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2008101048676A CN101286136B (en) 2008-04-24 2008-04-24 Method and device storing data in electrically erasable programmable read only memory

Publications (2)

Publication Number Publication Date
CN101286136A CN101286136A (en) 2008-10-15
CN101286136B true CN101286136B (en) 2011-12-28

Family

ID=40058352

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2008101048676A Expired - Fee Related CN101286136B (en) 2008-04-24 2008-04-24 Method and device storing data in electrically erasable programmable read only memory

Country Status (1)

Country Link
CN (1) CN101286136B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102402486B (en) * 2010-09-17 2014-07-23 腾讯科技(深圳)有限公司 Method and device for reading data
CN106604111A (en) * 2016-12-16 2017-04-26 深圳市九洲电器有限公司 Set-top box Flash data storage method and set-top box Flash data storage system

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1124378A (en) * 1994-04-19 1996-06-12 株式会社日立制作所 Data processor
US5784698A (en) * 1995-12-05 1998-07-21 International Business Machines Corporation Dynamic memory allocation that enalbes efficient use of buffer pool memory segments

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1124378A (en) * 1994-04-19 1996-06-12 株式会社日立制作所 Data processor
US5784698A (en) * 1995-12-05 1998-07-21 International Business Machines Corporation Dynamic memory allocation that enalbes efficient use of buffer pool memory segments

Also Published As

Publication number Publication date
CN101286136A (en) 2008-10-15

Similar Documents

Publication Publication Date Title
CN103327072A (en) Method for cluster load balance and system thereof
EP2648011A1 (en) System for predicting lifetime of battery
CN102124360A (en) Storage battery device, storage battery state of charge evaluation device and method
CN100578469C (en) Storage and polling method and storage controller and polling system
CN102821164B (en) Efficient parallel-distribution type data processing system
CN103914392A (en) Blank block recycling method and device for flash memory
CN101593321A (en) A kind of vehicle cargo stowage and cargo loading scheme are determined device
CN109962969A (en) The method and apparatus of adaptive cache load balancing for cloud computing storage system
CN102568569B (en) Nonvolatile semiconductor memory member and cache program method thereof
WO2011028695A3 (en) Large scale battery systems and method of assembly
CN101286136B (en) Method and device storing data in electrically erasable programmable read only memory
CN102590755A (en) Method and device for acquiring lithium ion battery capacity
CN112035058B (en) Cloud platform storage system
CN102420016A (en) Built-in repair analysis method of embedded memory for integration of error-checking codes
CN111208445A (en) Power battery abnormal monomer identification method and system
CN101419841A (en) Erasing and writing method for FLASH memory
CN104281664A (en) Data segmenting method and system of distributed graph calculating system
CN102722455A (en) Method and device for storing data in flash memory equipment
CN103902384A (en) Method and device for allocating physical machines for virtual machines
CN108388490A (en) A kind of method and system of test high-end server memory
EP3208625A1 (en) Identification code allocating device for battery management categories, sequencing device for battery management categories, and battery management method using same
CN116476691A (en) New energy automobile endurance mileage management method and system
CN1228655A (en) Data distribution system and data distribution method
CN101207467A (en) Generation of cyclic redundancy check code as well as method and apparatus for sending and testing data sequence
US7821226B2 (en) Method for the allocation of addresses in the memory cells of a rechargeable energy accumulator

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20111228

Termination date: 20120424