Method and apparatus for nor-flash analog fram storage

By using NOR-FLASH memory chips to replace FRAM in automotive devices, and designing the storage structure of system pages and data pages, the same read and write operations as FRAM are achieved, solving the problems of high cost and small capacity of FRAM, and improving storage efficiency and capacity utilization.

CN114220469BActive Publication Date: 2026-01-09HANGZHOU HOPECHART
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111440096.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-30
Publication Date
2026-01-09
Estimated Expiration
2041-11-30

AI Technical Summary

Technical Problem

In existing technologies, FRAM memory has high manufacturing costs, high prices, and small storage space, while NOR-FLASH memory chips have large capacity but slow write speed, which cannot meet the needs of automotive devices for fast read and write and efficient storage.

Method used

By designing a storage structure that replaces FRAM with NOR-FLASH memory chips and uses the configuration information of system pages and data pages, a simulated FRAM storage method for data storage is achieved. Data read and write operations are performed using offsets and dimensions, ensuring that the interface read and write operations are the same as those of FRAM.

Benefits of technology

It reduces application development costs, improves system storage utilization, expands storage capacity, and does not increase software development costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114220469B_ABST
    Figure CN114220469B_ABST
Patent Text Reader

Abstract

The application provides a NOR-FLASH analog FRAM storage method and device, the method comprises the following steps: formatting an analog FRAM storage partition according to a configuration parameter; initializing the analog FRAM storage partition; determining a write operation on the analog FRAM storage partition based on an offset of to-be-stored data. The application uses a NOR-FLASH storage chip to replace an FRAM memory, and designs a storage structure to map the read and write of offset position data, ensures that the new interface read and write operation of the NOR-FLASH is the same as the FRAM read and write operation, effectively reduces the development cost of the application, and improves the utilization rate of system storage.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data storage, and in particular to a NOR-FLASH simulated FRAM storage method and device. BACKGROUND

[0002] In a vehicle-mounted device, the demand for non-volatile memory is increasing, and the read-write speed requirement is faster and faster, and the power consumption requirement is smaller and smaller. Ferroelectric memory (FRAM, ferroelectric Random Access Memory) can be compatible with all functions of RAM, and is a non-volatile memory like ROM technology. Compared with traditional non-volatile memory, ferroelectric memory has the advantages of small power consumption, fast read-write speed, strong anti-radiation ability, etc., and therefore receives great attention. FRAM has been commercially verified in the semiconductor market, and FRAM memory products have been successfully applied in vehicles.

[0003] FRAM memory is now used in vehicle-mounted devices, but FRAM has high manufacturing cost and is more expensive than EEPROM and FLASH, and has smaller storage space. Vehicle-mounted devices themselves have NOR-FLASH storage chips with much larger capacity than FRAM, so it is inevitable to replace FRAM with existing NOR-FLASH. NOR-FLASH storage chips read and write data in pages, and page erasing is also a page operation. The page size is generally 4096 bytes. Due to the characteristics of NOR-FLASH medium, the bit value can only change from 1 to 0, and cannot change from 0 to 1. Therefore, when resetting the page data, the page erasing must be called to change each bit value in each byte of the page to 1. If storage is performed in pages, the entire page content must be copied to the memory and written after erasing the page, and erasing a page takes about 10 ms, and writing a page takes about 5 ms. Therefore, modifying a bit takes about 15 ms, which cannot be used in applications. In addition, the page life can be erased about 100,000 times, so the feasibility of this method is lower. SUMMARY

[0004] In view of the problems in the prior art, the present application provides a NOR-FLASH simulated FRAM storage method and device.

[0005] In a first aspect, the present application provides a NOR-FLASH simulated FRAM storage method, comprising:

[0006] formatting the simulated FRAM storage partition according to the configuration parameters;

[0007] initializing the simulated FRAM storage partition;

[0008] determining a write operation to the analog FRAM memory partition based on the offset of the data to be stored.

[0009] Optionally, the formatting the analog FRAM memory partition according to the configuration parameter comprises:

[0010] erasing all the data partitioned by pages;

[0011] reading configuration information of the system page and the data page;

[0012] creating a system page, and storing all the unused page numbers in a queue in the system page;

[0013] The system page configuration information comprises page header information and all the unused page numbers, the page header information comprises a number of bytes occupied by the page header information, the all the unused page numbers comprise a number of page numbers and a number of bytes occupied by each page number, and a highest bit of each page number is an allocation flag bit.

[0014] The data page configuration information comprises page header information, a cell number list and a cell data list, the page header information comprises a number of bytes occupied by the page header information, the cell number list and the cell data list are one-to-one corresponding, the cell number list comprises a maximum number of stored cells, a number of bytes occupied by each cell number, and a highest bit of each cell number is a valid flag bit, and the cell data list comprises a maximum number of stored cells, a number of bytes occupied by each cell storage space.

[0015] Optionally, the initializing the analog FRAM memory partition comprises:

[0016] determining whether an index of an established page exists in the memory;

[0017] if not, establishing the index of the page in the memory based on all the unused page numbers included in the system page;

[0018] determining whether an established cell index pair exists in the memory;

[0019] if not, establishing the cell index pair based on the cell number list in the data page.

[0020] Optionally, the method further comprises:

[0021] if the index of the established page exists in the memory, determining whether all the page numbers of the data page exist in the queue of all the unused page numbers of the system page;

[0022] if yes, deleting the corresponding page number from the queue of the unused page numbers, and re-establishing the index of the page.

[0023] Optionally, the method further comprises:

[0024] If the established cell index pair exists in the memory, it is determined whether all cell numbers in the current data page are included in the cell numbers corresponding to the in-page cell index of the established cell index pair;

[0025] If there is a non-inclusion, the cell index pair is re-established based on the cell numbers of the current data page.

[0026] Optionally, the determining of the write operation on the analog FRAM storage partition based on the offset of the to-be-stored data comprises:

[0027] The target cell number corresponding to the to-be-stored data is determined, and the stored data corresponding to the target cell number is read.

[0028] Based on the to-be-stored data and the stored data corresponding to the target cell number, it is determined whether there is a case that a bit changes from 0 to 1.

[0029] If there is no case that a bit changes from 0 to 1, the stored data corresponding to the target cell number is updated with the to-be-stored data.

[0030] Optionally, the method further comprises:

[0031] If there is a case that a bit changes from 0 to 1, a new cell number and a new cell storage space are allocated in the data page for storing the to-be-stored data.

[0032] Optionally, the determining of the target cell number corresponding to the to-be-stored data and the reading of the stored data corresponding to the target cell number comprises:

[0033] Based on the number of bytes occupied by the cell storage space of each cell in the data page configuration information, the corresponding offset is determined;

[0034] The to-be-stored data is right shifted by the offset number of bits to determine the corresponding cell number.

[0035] According to the cell number and the cell index pair, the index number of the specific in-page cell is determined, and the stored data corresponding to the index number is read.

[0036] Optionally, the method further comprises:

[0037] The flag bit of the target cell number is updated to be invalid.

[0038] The cell index pair is updated so that the cell index pair indicates the allocated new cell number.

[0039] Optionally, the method further comprises:

[0040] If the valid flag of all the cell numbers in the data page is set as invalid, it is determined again whether the queue of all the unused page numbers of the system page is full;

[0041] If the queue of all the unused page numbers of the system page is not full, the page number of the data page is added to the queue of all the unused page numbers of the system page.

[0042] Optionally, the method further comprises:

[0043] If the queue of all the unused page numbers of the system page is full, a new system page is created based on the queue of all the unused page numbers of the system page according to the first-in first-out principle, and the page number of the data page is added to the queue of all the unused page numbers of the new system page.

[0044] In a second aspect, the present application provides an electronic device for NOR-FLASH emulating FRAM storage, comprising a memory, a transceiver and a processor.

[0045] The memory is configured to store a computer program; the transceiver is configured to transceive data under the control of the processor; and the processor is configured to read the computer program in the memory and implement the steps of the method for NOR-FLASH emulating FRAM storage according to the first aspect.

[0046] In a third aspect, the present application provides a device for NOR-FLASH emulating FRAM storage, the device comprising:

[0047] A configuration module is configured to format the NOR-FLASH emulating FRAM storage partition according to a configuration parameter.

[0048] An initialization module is configured to initialize the emulating FRAM storage partition.

[0049] A determination module is configured to determine a write operation on the emulating FRAM storage partition based on an offset of the data to be stored.

[0050] In a fourth aspect, the present application provides a non-transitory computer readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the steps of the method for NOR-FLASH emulating FRAM storage according to the first aspect.

[0051] In a fifth aspect, the present application provides a computer program product comprising a computer program, the computer program being executed by a processor to implement the steps of the method for NOR-FLASH emulating FRAM storage according to the first aspect.

[0052] The application provides a NOR-FLASH analog FRAM storage method and device, which uses a NOR-FLASH storage chip to replace an FRAM memory, and designs a storage structure to map the read and write of offset position data, ensures that the new interface read and write operation of the NOR-FLASH is the same as the FRAM read and write operation, effectively reduces the development cost of application, and improves the utilization rate of system storage. BRIEF DESCRIPTION OF DRAWINGS

[0053] In order to more clearly illustrate the technical solutions in the present application or prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort on the basis of these drawings.

[0054] Figure 1 Fig. 1 is one of the flow diagrams of the NOR-FLASH analog FRAM storage method provided by the present application;

[0055] Figure 2 Fig. 2 is a structural diagram of the electronic device for NOR-FLASH analog FRAM storage provided by the present application;

[0056] Figure 3 Fig. 3 is a structural diagram of the device for NOR-FLASH analog FRAM storage provided by the present application. DETAILED DESCRIPTION

[0057] In order to make the objects, technical solutions and advantages of the present application clearer, the following will combine the drawings in the present application to clearly and completely describe the technical solutions in the present application. Obviously, the described embodiments are some of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative effort fall within the protection scope of the present application.

[0058] The following will combine Figures 1-3 to describe the NOR-FLASH analog FRAM storage method and device of the present application.

[0059] Ferroelectric memory technology was proposed as early as 1921, until 1993, an international company in the United States successfully developed the first 4K bit ferroelectric memory FRAM product, all FRAM products are manufactured or authorized by the company. FRAM has new development, using 0.35 um process, 3V product is launched, and the "single tube single capacity" storage unit FRAM is developed, and the maximum density can reach 256K bits (i.e. 32KB). However, the manufacturing cost of FRAM is high, and the price is more expensive than EEPROM and FLASH, and the storage space is smaller. The vehicle-mounted device itself has a NOR-FLASH storage chip, and the capacity is much larger than FRAM, so it is inevitable to replace FRAM with the existing NOR-FLASH.

[0060] Due to the physical structure characteristics of NOR-FLASH, the page is erased and the bit can only change from 1 to 0, so a storage algorithm needs to be designed to store data in the FRAM storage mode. If storage is performed in page units, as long as a bit in the page needs to be changed from 0 to 1, the entire page content must be copied to the memory, and the page is erased and written, and it takes about 10ms to erase a page, and it takes about 5ms to write a page, which is equivalent to modifying a bit. It takes 15ms to spend time, which cannot be used in applications, and the page life can be erased about 100,000 times, so this method is even more impractical.

[0061] In order to solve the above problems existing in the prior art, the application replaces FRAM memory with NOR-FLASH storage chip, and designs a storage structure to map the read and write of offset position data, ensures that the new interface read and write operation of NOR-FLASH is the same as the read and write operation of FRAM, so that the development cost of the application can be reduced.

[0062] The application is a method for replacing ferroelectric memory in vehicle-mounted device, which replaces FRAM memory read and write operation by different storage medium, reduces hardware cost of vehicle-mounted device, uses NOR-FLASH to share original storage chip in device, and can also use larger capacity than original FRAM memory, assuming that the FRAM capacity of original device is 8KB, we can use capacity expansion to 16KB or even larger capacity, thereby improving the utilization rate of system storage.

[0063] Figure 1 It is a flowchart of the method for simulating FRAM storage of NOR-FLASH provided by the application. As shown in Figure 1 The method comprises:

[0064] Step 101, format the simulated FRAM storage partition according to the configuration parameters;

[0065] Step 102, initializing the simulated FRAM memory partition;

[0066] Step 103, determining the write operation to the simulated FRAM memory partition based on the offset of the data to be stored.

[0067] Specifically, the NOR-FLASH memory chip is operated by reading and writing data by page, and the page erasing is also operated by page. The page size is generally 4096 bytes. Due to the characteristics of the NOR-FLASH medium, the bit value can only be changed from 1 to 0, and cannot be changed from 0 to 1. Therefore, when resetting the page data, the page erasing must be called to change each bit value of each byte in the page to 1. In addition, the application also designs a data structure to process data storage, otherwise it is impossible to distinguish which data is valid data. That is, the storage space of the NOR-FLASH is divided into system pages and data pages. By different configurations of the system pages and the data pages, the storage area of the NOR-FLASH is divided to simulate the FRAM memory area. The configuration information of the system pages can include which unused page resources, and the corresponding system pages or data pages can be generated according to the requirements. The configuration of the data pages can include the size of each storage data unit, the range of the number of storage data units, etc.

[0068] According to the above configuration parameters, the storage area of the NOR-FLASH is formatted to simulate the FRAM memory partition.

[0069] Optionally, in the embodiment of the application, the formatting of the simulated FRAM memory partition according to the configuration parameters comprises:

[0070] erasing all the data partitioned by page;

[0071] reading the configuration information of the system pages and the data pages;

[0072] creating a new system page, and storing all the unused page numbers in the system page in a queue;

[0073] The system page configuration information includes page header information and all the unused page numbers. The page header information includes the number of bytes occupied by the page header information, the number of page numbers contained by all the unused page numbers, and the number of bytes occupied by each page number. The highest bit of each page number is an allocation flag bit.

[0074] The data page configuration information includes page header information, a unit number list, and a unit data list. The page header information includes the number of bytes occupied by the page header information. The unit number list and the unit data list correspond to each other. The unit number list includes the maximum number of stored units, the number of bytes occupied by each unit, and the highest bit of each unit number is a valid flag bit. The unit data list includes the maximum number of stored units, and the number of bytes occupied by each unit storage space.

[0075] Specifically, the storage space of the NOR-FLASH is erased, and all the data partitioned by pages is erased, i.e. all the bit values of the NOR-FLASH are 1 after erasing, which is equivalent to the previous reset.

[0076] Then, according to the present application, all the pages are divided into system pages and data pages, and configuration information of the data pages and the system pages is provided, so that the formatting of the FRAM storage partition is completed. The NOR-FLASH is used to simulate the FRAM to store data through a specific program. For the FRAM, the data is read and written through an offset and a size. For example, for a memory with a capacity of 8 KB, the storage offset interval is [0, 8191], and assuming that the offset is offset, the maximum size of the data read and written is 8192 - offset.

[0077] The C language function for reading the FRAM data is assumed to be:

[0078] int fram_read(int fd, int offset, void* data, int size);

[0079] Parameters:

[0080] fd: FRAM or NOR-FLASH device handle, indicating whether the data is actually stored in the FRAM or the NOR-FLASH;

[0081] offset: storage offset, indicating the specific position of the data storage;

[0082] data: buffer pointer of the read data, indicating the memory position for storing the read data;

[0083] size: size of the read storage data, indicating the size of the read data;

[0084] The C language function for writing the FRAM data is assumed to be:

[0085] int fram_write(int fd, int offset, const void* data, int size);

[0086] Parameters:

[0087] fd: FRAM or NOR-FLASH device handle, indicating whether the data is actually stored in the FRAM or the NOR-FLASH;

[0088] offset: offset of the storage area, indicating the specific location of data storage;

[0089] data: buffer pointer of the written data, indicating the memory location of the stored data to be written;

[0090] size: size of the data written in the storage area, indicating the size of the stored data to be written.

[0091] When using a NOR-FLASH memory chip to replace FRAM storage, only two functions, fram_read and fram_write, need to be rewritten, and the application code can be seamlessly switched without changing the application code, and the development cost of the application code change is zero. Of course, for the driver layer, the original FRAM capacity needs to be configured, and how many pages of NOR-FLASH starting from which page number are used to store the replaced FRAM storage. Generally speaking, the number of pages is at least: original FRAM capacity / 1024 + 2.

[0092] Due to the physical structure characteristics of NOR-FLASH, which is erased by page and bit can only change from 1 to 0, a storage algorithm needs to be designed to store data in FRAM storage mode. If storage is performed in page units, the entire page content must be copied to the memory and the page is erased and written after the entire page is written, which takes about 10 ms to erase a page and about 5 ms to write a page. It takes about 15 ms to modify a bit, which is too slow to use in applications. In addition, the page life can be erased about 100,000 times, so this method is even more impractical.

[0093] After probability statistical analysis of read-write frequency and data size, the storage unit size is set to 32 bytes, which is an ideal size. First, too small unit size will increase the management cost of unit number and increase the additional storage overhead, which is not conducive to the speed of data reading. Second, too large unit size is the problem mentioned above, which will reduce the writing speed and page life.

[0094] The present application can use 32 bytes or an integer multiple thereof as the unit size of stored data. The following embodiments take 32 bytes as the unit size of stored data as an example.

[0095] The pages of NOR-FLASH are divided into system pages and data pages, and the system pages are used to record unused page numbers, including page header information and unused page number queue. Among them:

[0096] Page header information: is used to distinguish system pages and data pages, and occupies 16 bytes;

[0097] Unused page number queue: including all unused page number information, which can be stored in various forms such as array, queue, etc., each page number occupies 2 bytes, the value range of the page number is: [0, 0x7FFE], and the highest bit is the allocation flag, 1 represents unallocated, 0 represents allocated, an unused page number is taken from the queue each time the page needs to be allocated, and the highest bit of the page number is set to 0 to represent that the page has been allocated. Each page number directly points to the physical location of the specific storage unit of the NOR-FLASH page. For NOR-FLASH, the physical location of each storage unit is relatively fixed, so the page number of each page is relatively fixed. Regardless of indexing or other methods, ultimately, data access must point to a specific physical location.

[0098] The data page is divided into three parts: page header information, unit number list and unit data list, wherein:

[0099] Page header information: is used to distinguish system page and data page and page flow number (automatic growth), occupies 16 bytes;

[0100] Unit number list: the value range of the unit number is: [0, 0x7FFE], each unit number occupies 2 bytes, and the highest bit is the valid flag bit, 1 represents valid, 0 represents invalid. 120 unit numbers can be stored, so it occupies 240 bytes;

[0101] Unit data list: since the size of each unit is 32 bytes, and 120 units can be stored, it occupies 3840 bytes.

[0102] The total size of the three parts is 4096 bytes, which is exactly the size of a page.

[0103] Among them, the page flow number automatically increases with the increase of the stored data. It is mainly used to distinguish the order of data page establishment. The data page with a larger page flow number is closer to the current time than the data page with a smaller page flow number. The page number taken from the unused page number included in the system page cannot distinguish the order of data page establishment. The page flow number and the unused page number included in the system page have no direct relationship.

[0104] After reading the configuration parameters of the above system page and data page, the formatting of the simulated FRAM storage partition is completed. It is necessary to load the simulated FRAM to remove the partition after the system starts.

[0105] Optionally, in the embodiment of the application, the initialization of the simulated FRAM storage partition comprises:

[0106] Determine whether there is an established page index in the memory;

[0107] If not, establish the index of the page in the memory based on all unused page numbers included in the system page;

[0108] Determine whether the established cell index pair exists in the memory;

[0109] If not, establish the cell index pair based on the cell number list in the data page.

[0110] Specifically, the system startup loading time is slightly longer, and the related configuration file needs to be checked, and the corresponding relationship between different pages and cells is generated. If the FRAM storage partition is just formatted, the loading time of the first system startup will be slightly longer, and the index of the page is established in the memory according to the number of system pages and the related configuration. The index of the page indicates the order of establishment of all system pages, and the unused page number is first stored in the earliest established system page, which can ensure the order of storing the unused page number in the system page, and balance the number of NOR-FLASH page erasures, so that the service life of each page is maximized. Because it is the first startup, the data information has not been stored temporarily, so only the configuration information of the data page needs to be read. After the data page is stored with data, the initialization process, that is, the startup loading process, will be more complex. First, the system page is read to determine whether the established page index exists in the memory. If not, the page index is established according to all unused page numbers included in the system page, so as to find the related information of the unused page through the page index. At the same time, the cell number list stored in the data page memory is also read to determine whether the established cell index pair exists in the memory. If not, the cell index pair is constructed according to the cell number list stored in the data page. For example, the current page number of the data page and the cell number of each data storage establish a cell index pair (page number, page cell index). The page number in the cell index pair is one of all unused page numbers included in the system page, and the page number points to the specific storage cell physical position in the NOR-FLASH. Because the physical position of each storage cell is relatively fixed, the page number pointing to the position is also relatively fixed.

[0111] If the FRAM size is 8KB, it is divided into 256 storage cells, and each cell is 32 bytes. In order to quickly locate the page number and position of the storage cell, an index needs to be established in the memory. The index is composed of a pair (page number, page cell index), and the page number occupies 2 bytes, and the page cell index takes the value range: [0, 119] occupies 1 byte. Therefore, the total memory size occupied by the index is: 3 x 256 = 768 bytes.

[0112] Optionally, in the embodiment of the application, the method further comprises:

[0113] If the index of the established page exists in the memory, it is determined whether the page numbers of all data pages are in the queue of all unused page numbers of the system page;

[0114] If the corresponding page number exists, it is deleted from the queue of unused page numbers, and the index of the page is re-established.

[0115] Specifically, the system page is read first to determine whether the index of the established page exists in the memory. If the index of the established page exists in the memory, it is determined whether the page numbers in the index of the page are the latest records. That is, the data page may perform a write operation on some data, the corresponding page number is changed, that is, a data page is added, and the system is powered off before the updated data page is synchronized to the system page. Thus, the data of the data page and the system page is not synchronized. In the process of starting the system, the corresponding parameters are checked. If the latest data page information is not synchronized to the system page, the page number of the data page is deleted from the queue of unused page numbers of the system page. The deletion can be understood as setting the allocation flag of the page number to allocated. Then, the index of the page is re-established according to the updated queue of unused page numbers, so that the data page and the system page are synchronized.

[0116] Optionally, in the embodiment of the present application, the method further comprises:

[0117] If the index of the established unit exists in the memory, it is determined whether all unit numbers in the current data page are included in the unit numbers corresponding to the in-page unit index in the established unit index pair.

[0118] If the inclusion does not exist, the unit index pair is re-established based on the unit numbers of the current data page.

[0119] Specifically, the list of unit numbers stored in the data page is read to determine whether the index of the established unit exists in the memory. That is, when the data is written, the corresponding data unit is added in the data page, and the power is suddenly lost or other abnormal conditions occur, and the corresponding data is not synchronized to the unit index pair in the memory, so that the information of the two is not synchronized, and the data information may be seriously sent in disorder. Therefore, when the system is started, it is determined whether all unit numbers in the current data page are included in the unit numbers corresponding to the in-page unit index in the established unit index pair. If the inclusion does not exist, the data may be lost, and the unit index pair is re-established based on the unit numbers of the current data page.

[0120] Through the above steps, the formatting of the analog FRAM memory partition and the loading, checking and other operations of the system startup process are completed, and the data can be read or written, wherein the writing operation includes the reading operation because the writing process needs to determine whether the bit of the written data and the stored data changes from 0 to 1.

[0121] Optionally, in the embodiment of the present application, the writing operation on the analog FRAM memory partition based on the offset of the to-be-stored data comprises:

[0122] determining the target cell number corresponding to the to-be-stored data and reading the stored data corresponding to the target cell number;

[0123] determining whether there is a bit from 0 to 1 in the to-be-stored data and the stored data corresponding to the target cell number;

[0124] if there is no bit from 0 to 1, updating the stored data corresponding to the target cell number with the to-be-stored data.

[0125] Specifically, the to-be-stored data is obtained, and according to the characteristics that the reading and writing of the FRAM data are operated through the offset and the size, the offset corresponding to the to-be-stored data is determined, and then the target cell number for storing the to-be-stored data is determined, the stored data in the cell number is read, and it is determined whether there is a bit from 0 to 1 in the to-be-stored data and the stored data. If there is no bit from 0 to 1, the corresponding data can be directly written, that is, the stored data in the target cell number is updated with the to-be-stored data.

[0126] Optionally, in the embodiment of the present application, if there is a bit from 0 to 1, a new cell number and a new cell storage space are allocated in the data page for storing the to-be-stored data.

[0127] That is, if there is a bit from 0 to 1 in the to-be-stored data and the stored data, according to the storage characteristics of the NOR-FLASH, the corresponding data cannot be directly written, but the entire page of data needs to be erased first, and then the corresponding data is written, which is time-consuming and low in efficiency. Therefore, in the present application, a cell number and the storage space corresponding to the cell number are newly allocated for the to-be-stored data, and the to-be-stored data is stored in the storage space.

[0128] It is to be noted that if the storage space of the current data page is enough, a unit number is allocated to the data to be stored in the data page, if the storage space of the current data page is full or not enough, a new data page needs to be created, and a unit number and corresponding unit storage space are allocated to the data to be stored in the newly created data page for storing the data to be stored. Moreover, if the data to be stored is relatively large and may need storage space of multiple units, then the mode of adding unit numbers and corresponding storage spaces one by one is adopted to ensure that the data to be stored is normally saved.

[0129] Optionally, in the embodiment of the application, the method further comprises:

[0130] determining the offset corresponding to the unit storage space occupied by each unit in the data page configuration information;

[0131] determining the unit number corresponding to the data to be stored by right shifting the data to be stored by the offset;

[0132] determining the index number of the specific unit in the page according to the unit number and the unit index two-tuple, and reading the stored data corresponding to the index number.

[0133] Specifically, the offset corresponding to the unit storage space occupied by each unit in the data page configuration information is determined, for example, the unit storage space occupied by each unit is 32 bytes, and the corresponding offset is 5 bits. The unit number corresponding to the data to be stored can be determined by right shifting the data to be stored by 5 bits or dividing the data to be stored by 32, and then the index number of the specific unit in the page is determined according to the unit number and the unit index two-tuple in the memory, and the stored data corresponding to the index number is read, that is, the operation of reading the data in the simulated FRAM storage partition is completed.

[0134] Optionally, in the embodiment of the application, the method further comprises:

[0135] updating the flag bit of the target unit number to be invalid;

[0136] updating the unit index two-tuple so that the unit index two-tuple indicates the newly allocated unit number.

[0137] Optionally, after the data to be stored is written, the flag bit of the unit number of the target unit in the data page needs to be set to be invalid, that is, the data stored in the unit number is invalid. At the same time, the unit index two-tuple needs to be updated so that the unit index two-tuple no longer indicates the unit number of the target unit, but indicates the newly allocated unit number. That is, the page number and the unit index in the page of the unit index two-tuple indicate the newly allocated unit number.

[0138] Optionally, the method further comprises:

[0139] If the valid flag of all cell numbers in the data page is set to invalid, it is further determined whether the queue of all unused page numbers of the system page is full;

[0140] If the queue of all unused page numbers of the system page is not full, the page number of the data page is added to the queue of all unused page numbers of the system page.

[0141] Specifically, when the valid flag of all cell numbers in the data page is set to invalid, i.e., the resource of the data page can be recycled because all data of the data page is invalid data, the data page needs to be updated to the system page, and before being updated to the system page, it is further determined whether the queue of all unused page numbers of the system page is full; if the queue of unused page numbers in the system page is not full, for example, the system page can store up to 7FFF page numbers, and the page number value range in the system page is [0, 0x7FFE], and the latest page number is any value between 0 and 0x7FFD, a new page number is added to save the recycled data page.

[0142] If the queue of unused page numbers in the system page is full, for example, the system page can store up to 7FFF page numbers, and the page number value range in the system page is [0, 0x7FFE], and the latest page number is 0x7FFE, a new system page needs to be added to store the recycled data page. The first stored page number in the queue of unused page numbers of the system page is taken out, a new system page of the page number is created, and the recycled data page is stored.

[0143] The method for simulating FRAM storage by NOR-FLASH provided by the application replaces FRAM memory with NOR-FLASH storage chips, and designs a storage structure to map the read and write of offset position data, ensures that the new interface read and write operation of NOR-FLASH is the same as the FRAM read and write operation, effectively reduces the development cost of application, and thus improves the utilization rate of system storage.

[0144] The application mainly replaces FRAM memory chips with NOR-FLASH storage chips, and uses the original NOR-FLASH in the vehicle-mounted device, without additional hardware cost, and the hardware cost can be reduced after removing the FRAM memory chip, so as to realize the price competitiveness brought by the reduction of hardware cost of the vehicle-mounted device. The NOR-FLASH storage chip can flexibly expand the capacity according to business needs, without increasing the development cost of software application.

[0145] Figure 2 The structure schematic diagram of the electronic device for simulating FRAM storage by NOR-FLASH provided by the application; as shown inFigure 2 As shown, the electronic device includes a memory 220, a transceiver 210 and a processor 200; wherein the processor 200 and the memory 220 can also be arranged physically separately.

[0146] The memory 220 is configured to store a computer program; and the transceiver 210 is configured to transceive data under the control of the processor 200.

[0147] In particular, the transceiver 210 is configured to receive and send data under the control of the processor 200.

[0148] In particular, the transceiver 210 is configured to receive and send data under the control of the processor 200. Figure 2 In particular, the transceiver 210 is configured to receive and send data under the control of the processor 200. The bus architecture can include any number of interconnecting buses and bridges, depending on the specific application of the processor 200 and the memory 220 represented by various circuitry. The bus architecture can also link various other circuits such as peripheral devices, voltage regulators and power management circuits, which are well known in the art, and therefore, will not be described further. The bus interface provides an interface to the transceiver 210. The transceiver 210 can be a plurality of elements, including a transmitter and a receiver, which provides the means for communicating with various other apparatus over a transmission medium, including a wireless channel, a wired channel, optical cable, and the like.

[0149] The processor 200 is responsible for managing the bus architecture and general processing, and the memory 220 can store data used by the processor 200 in the execution of operations.

[0150] The processor 200 can be a CPU, an ASIC, an FPGA or a CPLD, and the processor can also adopt a multi-core architecture.

[0151] The processor 200 is configured to execute any of the methods provided by the embodiments of the present application according to the executable instructions obtained by invoking the computer program stored in the memory 220, for example:

[0152] formatting the simulated FRAM memory partition according to the configuration parameters;

[0153] initializing the simulated FRAM memory partition;

[0154] determining the write operation on the simulated FRAM memory partition based on the offset of the data to be stored.

[0155] Optionally, the formatting the simulated FRAM memory partition according to the configuration parameters comprises:

[0156] erasing all the data partitioned by pages;

[0157] reading the configuration information of the system page and the data page;

[0158] A new system page is created, and all unused page numbers are stored in a queue in the system page;

[0159] The system page configuration information includes page header information and all unused page numbers; the page header information includes the number of bytes occupied by the page header information, the number of page numbers contained by the all unused page numbers, and the number of bytes occupied by each page number, and the highest bit of each page number is an allocation flag bit;

[0160] The data page configuration information includes page header information, a unit number list, and a unit data list; the page header information includes the number of bytes occupied by the page header information; the unit number list and the unit data list correspond to each other; the unit number list includes the maximum number of stored units, the number of bytes occupied by each unit number, and the highest bit of each unit number is a valid flag bit; and the unit data list includes the maximum number of stored units, the number of bytes occupied by each unit storage space.

[0161] Optionally, the initialization simulates the FRAM memory partition, and includes:

[0162] It is determined whether an established page index exists in the memory;

[0163] If not, an index of a page is established in the memory based on all unused page numbers included in the system page;

[0164] It is determined whether an established unit index pair exists in the memory;

[0165] If not, a unit index pair is established based on the unit number list in the data page.

[0166] Optionally, the steps further include:

[0167] If the established page index exists in the memory, it is determined whether all page numbers of all data pages exist in the queue of all unused page numbers of the system page;

[0168] If so, the corresponding page number is deleted from the queue of unused page numbers, and the index of the page is re-established.

[0169] Optionally, the steps further include:

[0170] If the established unit index pair exists in the memory, it is determined whether all unit numbers in the current data page exist in the unit numbers corresponding to the intra-page unit index of the established unit index pair;

[0171] If there is a case that does not exist, the unit index pair is re-established based on the unit numbers of the current data page.

[0172] Optionally, the write operation to the analog FRAM memory partition is determined based on the offset of the data to be stored, comprising:

[0173] determining a target cell number corresponding to the data to be stored, and reading stored data corresponding to the target cell number;

[0174] judging whether there is a bit from 0 to 1 based on the data to be stored and the stored data corresponding to the target cell number;

[0175] if there is no bit from 0 to 1, updating the stored data corresponding to the target cell number with the data to be stored.

[0176] Optionally, the step further comprises:

[0177] if there is a bit from 0 to 1, allocating a new cell number and a new cell storage space in the data page for storing the data to be stored.

[0178] Optionally, the step of determining a target cell number corresponding to the data to be stored, and reading stored data corresponding to the target cell number, comprises:

[0179] determining a corresponding offset based on the number of bytes occupied by the cell storage space of each cell in the data page configuration information;

[0180] determining a corresponding cell number by right shifting the data to be stored by the offset number of bits;

[0181] determining an index number of a specific cell within the page according to the cell number and cell index two-tuple, and reading stored data corresponding to the index number.

[0182] Optionally, the step further comprises:

[0183] updating the invalid flag of the target cell number;

[0184] updating the cell index two-tuple so that the cell index two-tuple indicates the allocated new cell number.

[0185] Optionally, the step further comprises:

[0186] if the valid flags of all cell numbers in the data page are set to invalid, determining whether the queue of all unused page numbers of the system page is full;

[0187] if the queue of all unused page numbers of the system page is not full, adding the page number of the data page to the queue of all unused page numbers of the system page.

[0188] Optionally, the step further comprises:

[0189] If the queue of all unused page numbers of the system page is full, a new system page is created based on the queue of all unused page numbers of the system page according to the first-in-first-out principle, and the page number of the data page is added to the queue of all unused page numbers of the new system page.

[0190] It should be noted that the electronic device for simulating NOR-FLASH as FRAM storage provided by the embodiment of the present application can realize all the method steps achieved by the method embodiment and achieve the same technical effects. Therefore, the same parts and beneficial effects of the method embodiment will not be described in detail.

[0191] Figure 3 is a structural schematic diagram of the device for simulating NOR-FLASH as FRAM storage provided by the present application. As shown in the figure, Figure 3 The device comprises:

[0192] The configuration module 301 is configured to format the NOR-FLASH simulation FRAM storage partition according to the configuration parameter.

[0193] The initialization module 302 is configured to initialize the simulation FRAM storage partition.

[0194] The determination module 303 is configured to determine the write operation on the simulation FRAM storage partition based on the offset of the data to be stored.

[0195] Optionally, the configuration module 301 is further configured to:

[0196] erase all the data partitioned by pages;

[0197] read the configuration information of the system page and the data page;

[0198] create a system page, and store all unused page numbers in the system page in a queue;

[0199] The system page configuration information comprises page header information and all unused page numbers. The page header information comprises the number of bytes occupied by the page header information, the number of page numbers contained by the all unused page numbers, and the number of bytes occupied by each page number. The highest bit of each page number is an allocation flag bit.

[0200] The data page configuration information comprises page header information, a unit number list, and a unit data list. The page header information comprises the number of bytes occupied by the page header information. The unit number list and the unit data list are one-to-one corresponding. The unit number list comprises the maximum number of stored units, the number of bytes occupied by each unit number, and the highest bit of each unit number is a valid flag bit. The unit data list comprises the maximum number of stored units, and the number of bytes occupied by each unit storage space.

[0201] Optionally, the initialization module 302 is further configured to determine whether the index of the established page exists in the memory.

[0202] If not, the index of the page is established in the memory based on all the unused page numbers included in the system page.

[0203] Determine whether the established cell index pair exists in the memory.

[0204] If not, establish the cell index pair based on the cell number list in the data page.

[0205] Optionally, the initialization module 302 is further configured to:

[0206] If the index of the established page exists in the memory, determine whether all the page numbers of the data page are in the queue of all the unused page numbers of the system page.

[0207] If so, delete the corresponding page number from the queue of the unused page numbers and re-establish the index of the page.

[0208] Optionally, the initialization module 302 is further configured to:

[0209] If the index of the established cell exists in the memory, determine whether all the cell numbers in the current data page are included in the cell numbers corresponding to the intra-page cell index of the established cell index pair.

[0210] If there is a case of not including, re-establish the cell index pair based on the cell numbers of the current data page.

[0211] Optionally, the determination module 303 is further configured to:

[0212] Determine the target cell number corresponding to the data to be stored, and read the stored data corresponding to the target cell number.

[0213] Based on the data to be stored and the stored data corresponding to the target cell number, determine whether there is a case of bit changing from 0 to 1.

[0214] If there is no case of bit changing from 0 to 1, update the stored data corresponding to the target cell number with the data to be stored.

[0215] Optionally, the determination module 303 is further configured to:

[0216] If there is a case of bit changing from 0 to 1, allocate a new cell number and a new cell storage space in the data page for storing the data to be stored.

[0217] Optionally, the determination module 303 is further configured to:

[0218] Determine the corresponding offset based on the number of bytes occupied by the unit storage space of each unit in the data page configuration information;

[0219] Determine the corresponding unit number by right shifting the to-be-stored data by the number of bits of the offset;

[0220] Determine the index number of the specific unit in the page according to the unit number and the unit index pair, and read the stored data corresponding to the index number.

[0221] Optionally, the determining module 303 is further configured to:

[0222] Update the flag bit of the target unit number to be invalid;

[0223] Update the unit index pair so that the unit index pair indicates the allocated new unit number.

[0224] Optionally, the determining module 303 is further configured to:

[0225] If the valid flag bits of all unit numbers in the data page are set to be invalid, then determine whether the queue of all unused page numbers of the system page is full;

[0226] If the queue of all unused page numbers of the system page is not full, then add the page number of the data page to the queue of all unused page numbers of the system page.

[0227] Optionally, the determining module 303 is further configured to:

[0228] If the queue of all unused page numbers of the system page is full, then create a new system page based on the queue of all unused page numbers of the system page according to the first-in first-out principle, and add the page number of the data page to the queue of all unused page numbers of the newly created system page.

[0229] It should be noted that the division of the unit in the embodiments of the present application is illustrative, and is only a logical functional division. In actual implementation, another division manner can be used. In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present alone, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0230] The integrated unit, if realized in the form of a software function unit and sold or used as an independent product, can be stored in a processor-readable storage medium. Based on such an understanding, the technical solutions of the present application essentially or the part of the prior art that contributes to the present application or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and 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 all or part of the steps of the method described in the various embodiments of the present application. The aforementioned storage medium includes a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.

[0231] It should be noted that the above-mentioned device provided by the embodiments of the present application can realize all the method steps realized by the method embodiments and achieve the same technical effects. Therefore, the same parts and beneficial effects of the method embodiments will not be described in detail.

[0232] In another aspect, the present application also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the steps of the method for simulating NOR-FLASH memory as a FRAM memory, for example, including:

[0233] formatting the simulated FRAM memory partition according to the configuration parameters;

[0234] initializing the simulated FRAM memory partition;

[0235] determining a write operation on the simulated FRAM memory partition based on an offset of the data to be stored.

[0236] Optionally, the formatting the simulated FRAM memory partition according to the configuration parameters includes:

[0237] erasing all data partitioned by pages;

[0238] reading configuration information of the system page and the data page;

[0239] creating a new system page, and storing all unused page numbers in the system page in a queue;

[0240] The system page configuration information includes page header information and all unused page numbers; the page header information includes the number of bytes occupied by the page header information, the number of page numbers contained by the all unused page numbers, and the number of bytes occupied by each page number, and the highest bit of each page number is an allocation flag bit;

[0241] The data page configuration information includes page header information, a unit number list, and a unit data list; the page header information includes the number of bytes occupied by the page header information; the unit number list and the unit data list correspond to each other; the unit number list includes the maximum number of stored units, the number of bytes occupied by each unit number, and the highest bit of each unit number is a valid flag bit; and the unit data list includes the maximum number of stored units, the number of bytes occupied by each unit storage space.

[0242] Optionally, the initialization of the simulated FRAM memory partition includes:

[0243] determining whether an established page index exists in the memory;

[0244] if not, establishing the page index in the memory based on all unused page numbers included in the system page;

[0245] determining whether an established unit index pair exists in the memory;

[0246] if not, establishing the unit index pair based on the unit number list in the data page.

[0247] Optionally, the steps further include:

[0248] if the established page index exists in the memory, determining whether all page numbers of the data page exist in the queue of all unused page numbers of the system page;

[0249] if yes, deleting the corresponding page number from the queue of unused page numbers, and re-establishing the page index.

[0250] Optionally, the steps further include:

[0251] if the established unit index pair exists in the memory, determining whether all unit numbers in the current data page exist in the unit numbers corresponding to the intra-page unit index of the established unit index pair;

[0252] if not, re-establishing the unit index pair based on the unit numbers of the current data page.

[0253] Optionally, the determination of the write operation on the simulated FRAM memory partition based on the offset of the data to be stored includes:

[0254] determining a target unit number corresponding to the data to be stored, and reading stored data corresponding to the target unit number;

[0255] judging whether there is a case that a bit changes from 0 to 1 based on the data to be stored and the stored data corresponding to the target unit number;

[0256] if there is no case that a bit changes from 0 to 1, updating the stored data corresponding to the target unit number with the data to be stored.

[0257] Optionally, the steps further comprise:

[0258] if there is a case that a bit changes from 0 to 1, allocating a new unit number and a new unit storage space in the data page for storing the data to be stored.

[0259] Optionally, the step of determining a target unit number corresponding to the data to be stored, and reading stored data corresponding to the target unit number comprises:

[0260] determining a corresponding offset based on the number of bytes occupied by the unit storage space of each unit in the data page configuration information;

[0261] determining a corresponding unit number by right shifting the data to be stored by the offset number of bits;

[0262] determining an index number of a specific unit within the page according to the unit number and unit index two-tuple, and reading stored data corresponding to the index number.

[0263] Optionally, the steps further comprise:

[0264] updating a flag bit of the target unit number to be invalid;

[0265] updating the unit index two-tuple so that the unit index two-tuple indicates the allocated new unit number.

[0266] Optionally, the steps further comprise:

[0267] if all valid flag bits of the unit numbers in the data page are set to be invalid, determining whether a queue of all unused page numbers of the system page is stored full;

[0268] if the queue of all unused page numbers of the system page is not stored full, adding the page number of the data page to the queue of all unused page numbers of the system page.

[0269] Optionally, the steps further comprise:

[0270] If all the queues of all the unused page numbers of the system page are full, a new system page is created based on all the queues of all the unused page numbers of the system page according to the first-in-first-out principle, and the page number of the data page is added to the queue of all the unused page numbers of the new system page.

[0271] In another aspect, an embodiment of the present application also provides a processor-readable storage medium storing a computer program for causing a processor to perform the method for emulating NOR-FLASH memory as a FRAM memory provided by any of the above embodiments, for example comprising:

[0272] formatting the emulated FRAM memory partition according to configuration parameters;

[0273] initializing the emulated FRAM memory partition;

[0274] determining a write operation on the emulated FRAM memory partition based on an offset of the data to be stored.

[0275] Optionally, the formatting the emulated FRAM memory partition according to configuration parameters comprises:

[0276] erasing all the data partitioned by pages;

[0277] reading configuration information of the system page and the data page;

[0278] creating a system page, and storing all the unused page numbers in the system page in a queue;

[0279] The configuration information of the system page comprises page header information and all the unused page numbers, the page header information comprises a number of bytes occupied by the page header information, the all the unused page numbers comprise a number of page numbers and a number of bytes occupied by each page number, and the highest bit of each page number is an allocation flag bit.

[0280] The configuration information of the data page comprises page header information, a cell number list and a cell data list, the page header information comprises a number of bytes occupied by the page header information, the cell number list and the cell data list are one-to-one corresponding, the cell number list comprises a maximum number of stored cells, a number of bytes occupied by each cell number, and the highest bit of each cell number is a valid flag bit, and the cell data list comprises a maximum number of stored cells, a number of bytes occupied by each cell storage space.

[0281] Optionally, the initializing the emulated FRAM memory partition comprises:

[0282] determining whether an index of an established page exists in the memory;

[0283] If not, establishing an index of a page in the memory based on all the unused page numbers included in the system page;

[0284] determining whether an established cell index pair exists in the memory;

[0285] if not, establishing the cell index pair based on the list of cell numbers in the data page.

[0286] Optionally, the steps further comprise:

[0287] if the index of the page exists in the memory, determining whether all page numbers of the data page exist in the queue of all unused page numbers of the system page;

[0288] if so, deleting the corresponding page number from the queue of unused page numbers and re-establishing the index of the page.

[0289] Optionally, the steps further comprise:

[0290] if the cell index pair exists in the memory, determining whether all cell numbers in the current data page are included in the cell numbers corresponding to the intra-page cell index of the established cell index pair;

[0291] if there is a case of non-inclusion, re-establishing the cell index pair based on the cell numbers of the current data page.

[0292] Optionally, the determining of the write operation on the simulated FRAM storage partition based on the offset of the data to be stored comprises:

[0293] determining a target cell number corresponding to the data to be stored, and reading the stored data corresponding to the target cell number;

[0294] judging whether there is a case of a bit changing from 0 to 1 based on the data to be stored and the stored data corresponding to the target cell number;

[0295] if there is no case of a bit changing from 0 to 1, updating the stored data corresponding to the target cell number with the data to be stored.

[0296] Optionally, the steps further comprise:

[0297] if there is a case of a bit changing from 0 to 1, allocating a new cell number and a new cell storage space in the data page for storing the data to be stored.

[0298] Optionally, the determining of the target cell number corresponding to the data to be stored and the reading of the stored data corresponding to the target cell number comprises:

[0299] determining the corresponding offset based on the number of bytes occupied by the cell storage space of each cell in the data page configuration information;

[0300] Right shift the to-be-stored data by the offset number of bits to determine a corresponding unit number;

[0301] According to the unit number and the unit index pair, determine an index number of a specific unit within the page, and read the stored data corresponding to the index number.

[0302] Optionally, the steps further comprise:

[0303] Updating the invalid flag of the target unit number;

[0304] Updating the unit index pair so that the unit index pair indicates the newly allocated unit number.

[0305] Optionally, the steps further comprise:

[0306] If the valid flags of all unit numbers in the data page are set to invalid, then determine whether the queue of all unused page numbers of the system page is full;

[0307] If the queue of all unused page numbers of the system page is not full, then add the page number of the data page to the queue of all unused page numbers of the system page.

[0308] Optionally, the steps further comprise:

[0309] If the queue of all unused page numbers of the system page is full, then create a new system page based on the queue of all unused page numbers of the system page according to the first-in-first-out principle, and add the page number of the data page to the queue of all unused page numbers of the newly created system page.

[0310] The processor-readable storage medium can be any available medium or data storage device that the processor can access, including but not limited to a magnetic storage (e.g., floppy disk, hard disk, magnetic tape, MO, etc.), an optical storage (e.g., CD, DVD, BD, HVD, etc.), and a semiconductor storage (e.g., ROM, EPROM, EEPROM, NAND FLASH, SSD, etc.), etc.

[0311] The apparatus embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., can be located in one place or distributed on multiple network units. Some or all of the modules can be selected to achieve the purposes of the embodiments according to actual needs, and those of ordinary skill in the art can understand and implement without creative labor.

[0312] Those skilled in the art can clearly understand the technical solutions of the various embodiments from the above description of the embodiments, and the various embodiments can be implemented by means of software with the necessary general hardware platforms, and of course, can also be implemented by hardware. Based on such understanding, the above technical solutions, essentially or in other words, the part of the prior art that makes a contribution, can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, and the like, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0313] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for some technical features therein; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method of NOR-FLASH analog FRAM storage, characterized by, The method comprises the following steps: formatting the simulated FRAM memory partition according to configuration parameters; initializing the simulated FRAM memory partition; determining a write operation on the simulated FRAM memory partition based on an offset of to-be-stored data; the step of determining the write operation on the simulated FRAM memory partition based on the offset of to-be-stored data comprises the following steps: determining a target cell number corresponding to the to-be-stored data, and reading stored data corresponding to the target cell number; judging whether there is a case that a bit changes from 0 to 1 based on the to-be-stored data and the stored data corresponding to the target cell number; if there is no case that a bit changes from 0 to 1, updating the stored data corresponding to the target cell number with the to-be-stored data; if there is a case that a bit changes from 0 to 1, allocating a new cell number and a new cell storage space in a data page for storing the to-be-stored data.

2. The method of claim 1, wherein the NOR-FLASH analog FRAM memory is a 2T memory cell. The step of formatting the simulated FRAM memory partition according to configuration parameters comprises the following steps: erasing all page-partitioned data; reading configuration information of a system page and a data page; newly creating a system page, and storing all unused page numbers in the system page in a queue; the system page configuration information comprises page header information and all unused page numbers; the page header information comprises a number of bytes occupied by the page header information, a number of page numbers contained by the all unused page numbers, and a number of bytes occupied by each page number, and a highest bit of each page number is an allocation flag bit; the data page configuration information comprises page header information, a cell number list and a cell data list; the page header information comprises a number of bytes occupied by the page header information; the cell number list and the cell data list correspond to each other; the cell number list comprises a maximum number of stored cells, a number of bytes occupied by each cell, and a highest bit of each cell number is a valid flag bit; and the cell data list comprises a maximum number of stored cells, a number of bytes occupied by each cell storage space.

3. The method of claim 1, wherein the NOR-FLASH analog FRAM memory is a 3D NOR-FLASH analog FRAM memory. The step of initializing the simulated FRAM memory partition comprises the following steps: determining whether an index of a page established in the memory exists; if not, establishing the index of the page in the memory based on all unused page numbers included in the system page; determining whether a cell index pair established in the memory exists; if not, establishing the cell index pair based on the cell number list in the data page.

4. The method of claim 3, wherein, The method further comprises the following steps: if the index of the page established in the memory exists, determining whether all page numbers of data pages are in the queue of all unused page numbers of the system page; if yes, deleting the corresponding page number from the queue of the unused page numbers, and re-establishing the index of the page.

5. The method of claim 3, wherein the NOR-FLASH analog FRAM memory is a 2T memory cell. The method further comprises the following steps: if the cell index pair established in the memory exists, determining whether all cell numbers in the current data page are included in the cell numbers corresponding to the page-in-cell index of the established cell index pair; if not, re-establishing the cell index pair based on the cell numbers of the current data page.

6. The method of claim 1, wherein the NOR-FLASH analog FRAM memory is a 2T memory cell. The step of determining the target cell number corresponding to the to-be-stored data, and reading the stored data corresponding to the target cell number comprises the following steps: determining a corresponding offset based on a number of bytes occupied by the cell storage space of each cell in the data page configuration information; determining a corresponding cell number by right shifting the to-be-stored data by the offset number of bits; determining an index number of a specific cell within the page according to the cell number and the cell index pair, and reading the stored data corresponding to the index number.

7. The method of claim 3, wherein the NOR-FLASH analog FRAM memory is a 2T memory cell. The method further comprises: updating the invalid flag bit of the target cell number to be invalid; updating the cell index pair so that the cell index pair indicates the newly allocated cell number.

8. The method of claim 1 to 7, wherein, The method further comprises: if all valid flag bits of all cell numbers in the data page are set to be invalid, then determining whether a queue of all unused page numbers of the system page is full; if the queue of all unused page numbers of the system page is not full, then adding the page number of the data page to the queue of all unused page numbers of the system page.

9. The method of claim 8, wherein, The method further comprises: if the queue of all unused page numbers of the system page is full, then creating a new system page based on the queue of all unused page numbers of the system page according to the first-in-first-out principle, and adding the page number of the data page to the queue of all unused page numbers of the newly created system page. 10.An electronic device for NOR-FLASH emulating FRAM storage, comprising a memory, a transceiver, and a processor; The memory is configured to store a computer program; The transceiver is configured to transceive data under the control of the processor; The processor is configured to execute the computer program in the memory and implement the steps of the method for NOR-FLASH emulating FRAM storage according to any one of claims 1 to 9.

11. An apparatus for NOR-FLASH analog FRAM storage, the apparatus comprising: The apparatus comprises: a configuration module configured to format a NOR-FLASH emulating FRAM storage partition according to a configuration parameter; an initialization module configured to initialize the emulating FRAM storage partition; a determination module configured to determine a write operation on the emulating FRAM storage partition based on an offset of to-be-stored data; the determination of the write operation on the emulating FRAM storage partition based on the offset of the to-be-stored data comprises: determining a target cell number corresponding to the to-be-stored data, and reading stored data corresponding to the target cell number; judging whether there is a bit position changing from 0 to 1 based on the to-be-stored data and the stored data corresponding to the target cell number; if there is no bit position changing from 0 to 1, then updating the stored data corresponding to the target cell number with the to-be-stored data; if there is a bit position changing from 0 to 1, then allocating a new cell number and a new cell storage space in a data page for storing the to-be-stored data.

12. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is configured to make the processor execute the method for NOR-FLASH emulating FRAM storage according to any one of claims 1 to 9.

13. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method for NOR-FLASH emulating FRAM storage according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Data storage method based on NOR FLASH

    CN103399826A

  • Method for simulating eeprom by using norflash

    CN111176579A