Data storage method, device, apparatus, and storage medium

By using row-based or column-based storage methods, combined with multi-bit storage granularity and calculation of the logical block start word, data storage is optimized, solving the problem of slow data reading speed and improving system performance.

CN120540582BActive Publication Date: 2026-02-24SHANGHAI SMARTLOGIC TECHNOLOGY LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510573413.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-30
Publication Date
2026-02-24
Estimated Expiration
2045-04-30

AI Technical Summary

Technical Problem

In computer systems, the speed of data retrieval is much slower than the speed of data processing, becoming a bottleneck for improving system performance. Existing methods, such as improving instruction parallelism, have failed to effectively solve the gap in data retrieval speed.

Method used

By adopting either row-based or column-based storage, determining the multi-bit storage granularity, and calculating the starting storage word of the logical block using the offset value and the number of reset blocks, the data storage and retrieval methods are optimized to achieve fast storage.

Benefits of technology

By optimizing storage methods and granularity, rapid data storage was achieved, narrowing the gap between data retrieval and processing speeds and improving system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120540582B_ABST
    Figure CN120540582B_ABST
Patent Text Reader

Abstract

The application provides a data storage method, device, equipment and storage medium. The method comprises the following steps: determining a storage granularity and a storage mode; the storage mode is row storage or column storage; the storage granularity is a multi-bit numerical value; determining an offset value according to the storage granularity; determining a reset block number according to the storage granularity; determining a starting storage word of each logical block according to the offset value and the reset block number; and storing data according to the storage mode based on the starting storage word of each logical block. According to the method, the starting storage word of each logical block can be determined according to the storage granularity, data is stored according to the storage mode based on the starting storage word of each logical block, and the fast storage of data is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a data storage method, apparatus, device, and storage medium. Background Technology

[0002] With the development of Internet technology, in the current computer system architecture, data processing is often faster than data reading. Therefore, data reading and writing are often the bottleneck for performance improvement in the entire system, and this is further exacerbated by the development of computer computing performance.

[0003] Currently, processor performance is typically enhanced by increasing the parallelism of instruction or data processing. This allows the processor to perform operations on multiple data sets within a single cycle, significantly increasing its data processing capabilities.

[0004] Therefore, the gap between data extraction speed and computer processing speed continues to widen, making data extraction speed a crucial parameter in current data extraction processes. Summary of the Invention

[0005] To address one of the aforementioned technical deficiencies, this application provides a data storage method, apparatus, device, and storage medium.

[0006] A first aspect of this application provides a data storage method, the method comprising:

[0007] Determine the storage granularity and storage method. The storage method can be row-based or column-based. The storage granularity is a multi-bit value.

[0008] The offset value is determined based on the storage granularity.

[0009] The number of reset blocks is determined based on the storage granularity.

[0010] The starting storage word for each logical block is determined based on the offset value and the number of reset blocks.

[0011] Data is stored according to the storage method based on the starting storage word of each logical block.

[0012] Optionally, the offset value is determined based on the storage granularity, including:

[0013] Determine the offset value N=2 1ran +b. Where Gran is the storage granularity, b is a pre-set perturbation parameter, and 0 ≤ b < the total number of words in a logical block.

[0014] Optionally, the number of reset blocks is determined based on the storage granularity, including:

[0015] Determine the reset value based on the storage granularity.

[0016] Determine the number of reset blocks S = 2 Swap ×2.

[0017] Optionally, the starting storage word of each logical block is determined based on the offset value and the number of reset blocks, including:

[0018] The starting memory word for each logic block is determined using the following formula:

[0019] a i = (i mod S) × N + 1.

[0020] Where i is the logical block identifier, a i Let S be the starting storage word of the i-th logical block, S be the number of reset blocks, N be the offset value, and i mod S be the remainder of i / S.

[0021] Optionally, the size of the logical block is x times y, where x is the storage width and y is the multiple. The logical block corresponds to y rows and x columns of storage space. The storage method is row storage.

[0022] Based on the starting storage word of each logical block, data is stored according to the storage method, including:

[0023] Starting with the first logical block, the data of each logical block is stored sequentially.

[0024] For any logical block i, the data is stored according to the following steps:

[0025] Initial storage word a i The i-th logical block is determined as the starting storage word in the storage space.

[0026] From the a i The data in logical block i is stored sequentially starting from word a, up to word a. i The last character in the line containing the character.

[0027] If the storage space is not full, and the a-th i If the line containing the character is not full, then start from line a. i The characters are stored sequentially starting from the first character of the row containing the character, up to the ath character. i The line containing the character is full.

[0028] If the storage space is not full, but the a-th... i If the line containing the character is full, then in line a... i If there are incomplete rows in the target direction of the row containing the character, update 'a'. i =a i +k1×k2×x, re-execute from the a-th... i The data in logical block i is stored sequentially starting from word a, up to word a. i The steps for the last character in the line containing the character and subsequent steps. In the a... iIf there are no unfilled rows in the target direction of the row containing the character, update 'a'. i =a i -k1×k3×x, re-execute from the a-th node i The data in logical block i is stored sequentially starting from word a, up to word a. i The steps for the last character in the line containing the character, and subsequent steps, continue until the storage space is full.

[0029] Where k1 is the target direction value; if the target direction is backward, then k1 = 1; if the target direction is forward, then k1 = -1. k2 is the multiple of the first row value; k2 = the first row not yet full in the target direction and the a-th row. i The absolute value of the difference in row numbers between the rows containing the characters, where k3 is a multiple of the second row, k3 = the first not-full row and the a-th row in the opposite direction of the target direction. i The absolute value of the difference in line numbers between the lines containing the characters.

[0030] Optionally, the size of the logical block is x times y, where x is the storage width and y is the multiple. The storage method is column storage.

[0031] Based on the starting storage word of each logical block, data is stored according to the storage method, including:

[0032] Retrieve S contiguous storage spaces from the storage and group them into a storage space group. Each storage space consists of y rows and x columns.

[0033] Starting with the first logical block group, the logical block groups corresponding to each storage space group are determined. Each logical block group consists of multiple consecutive logical blocks.

[0034] Starting with the first logical block group, the data of the logical block group is stored into the corresponding storage space group in sequence.

[0035] For any logical block group j, the data of logical block group j is stored into the corresponding storage space group j according to the following steps:

[0036] The initial storage word of each storage space in storage space group j is determined as the starting storage word of each logical block.

[0037] According to the storage space order, the data of each logical block in logical block group j is stored into the initial storage word of each storage space in turn.

[0038] Update the initial storage word of each storage space, and repeat the steps of storing the data of each logical block in logical block group j into the initial storage word of each storage space in the order of storage space, and the subsequent steps, until storage space group j is full.

[0039] For any storage space v, its initial storage word a is updated through the following steps. u(v), where u is the logical block identifier in the logical block group corresponding to storage space v:

[0040] If a u (v) is not the last word of its line, and a u If (v)+1 is not stored, then update a. u (v)=a u (v)+1.

[0041] If a u (v) is not the last word of its line, but a u (v)+1 has already stored data. If the storage space v is not full, then at the a-th... u (v) If there are incomplete rows in the target direction of the row containing the character, update a. u (v)=a u (v) + k1 × k2 × x. At the a-th... u (v) If there are no incomplete rows in the target direction of the row containing the word, update a. u (v)=a u (v)-k1×k3×x. Where k1 is the target direction value; if the target direction is backward, then k1 = 1; if the target direction is forward, then k1 = -1. k2 is the multiple of the first row, k2 = the sum of the first unfilled row and the a-th row in the target direction. u (v) The absolute value of the difference in row numbers between the rows containing the character, k3 is a multiple of the second row, k3 = the first row that is not full in the opposite direction of the target direction and the a-th row. u (v) The absolute value of the difference in line numbers between the lines containing the character.

[0042] If a u (v) is the last word of its line, then in a u (v) Update a if the current row is not full. u (v) is a u (v) The first character of the line. In a u If the row containing (v) is full, and if the storage space v is not full, then in the a-th row... u (v) If there are incomplete rows in the target direction of the row containing the character, update a. u (v)=a u (v)+k1×k2×x. At the a-th... i If there are no unfilled rows in the target direction of the row containing the character, update 'a'. u (v)=a u (v)-k1×k3×x.

[0043] Optionally, after storing the data according to the storage method based on the starting storage location of each logical block, the method further includes:

[0044] Determine the reading method. The reading method can be either row-based or column-based.

[0045] Data is read according to the starting storage location of each logical block and the read method.

[0046] A second aspect of this application provides a data storage device, the device comprising:

[0047] The first determining unit is used to determine the storage granularity and storage method; wherein the storage method is row storage or column storage; and the storage granularity is a multi-bit value.

[0048] The second determining unit is used to determine the offset value based on the storage granularity determined by the first determining unit;

[0049] The third determining unit is used to determine the number of reset blocks based on the storage granularity determined by the first determining unit;

[0050] The fourth determining unit is used to determine the starting storage word of each logical block based on the offset value determined by the second determining unit and the number of blocks reset by the third determining unit;

[0051] The storage unit is used to store data according to the storage method determined by the first determining unit, based on the starting storage word of each logic block determined by the fourth determining unit.

[0052] A third aspect of this application provides an electronic device, comprising:

[0053] Memory;

[0054] Processor; and

[0055] Computer programs;

[0056] The computer program is stored in the memory and configured to be executed by the processor to implement the method described in the first aspect above.

[0057] In a fourth aspect, this application provides a computer-readable storage medium having a computer program stored thereon; the computer program is executed by a processor to implement the method described in the first aspect above.

[0058] This application provides a data storage method, apparatus, device, and storage medium. The method involves determining the storage granularity and storage mode; wherein the storage mode is row storage or column storage; the storage granularity is a multi-bit value; determining an offset value based on the storage granularity; determining the number of reset blocks based on the storage granularity; determining the starting storage word of each logical block based on the offset value and the number of reset blocks; and storing data according to the storage mode based on the starting storage word of each logical block. The method provided by this application can determine the starting storage word of each logical block based on the storage granularity and store data according to the storage mode based on the starting storage word of each logical block, thus achieving fast data storage. Attached Figure Description

[0059] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0060] Figure 1 A flowchart illustrating a data storage method provided in an embodiment of this application;

[0061] Figure 2 This is a schematic diagram of the structure of a data storage device provided in an embodiment of this application;

[0062] Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0063] To make the technical solutions and advantages of the embodiments of this application clearer, the exemplary embodiments of this application will be described in further detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not an exhaustive list of all embodiments. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of this application can be combined with each other.

[0064] In developing this application, the inventors discovered that with the development of internet technology, in current computer system architectures, data processing is often faster than data retrieval. Therefore, data reading and writing are often the bottleneck for performance improvement in the entire system, and with the development of computer computing power, current methods typically enhance processor performance by increasing instruction or data processing parallelism. This allows the processor to perform operations on multiple data sets within a single cycle, greatly enhancing its data processing capabilities. Consequently, the gap between data retrieval speed and computer processing speed continues to widen, making data retrieval speed a crucial parameter in current data extraction processes.

[0065] To address the aforementioned problems, this application provides a data storage method, apparatus, device, and storage medium. The method involves determining the storage granularity and storage mode; wherein the storage mode is row storage or column storage; the storage granularity is a multi-bit value; determining an offset value based on the storage granularity; determining the number of reset blocks based on the storage granularity; determining the starting storage word of each logical block based on the offset value and the number of reset blocks; and storing data according to the storage mode based on the starting storage word of each logical block. The method provided in this application can determine the starting storage word of each logical block based on the storage granularity and store data according to the storage mode based on the starting storage word of each logical block, thus achieving fast data storage.

[0066] See Figure 1 This embodiment provides a data storage method, the implementation process of which is as follows:

[0067] 101. Determine the storage granularity and storage method.

[0068] The storage method can be either row storage or column storage.

[0069] The storage granularity is a multi-bit value. For example, if the storage granularity is 2 bits, then there are 4 different values ​​for the storage granularity: 00 (decimal 0), 01 (decimal 1), 10 (decimal 2), and 11 (decimal 3).

[0070] 102. Determine the offset value based on the storage granularity.

[0071] Determine the offset value N=2 Gran +b.

[0072] Where b is a pre-set perturbation parameter, 0≤b<the total number of words in a logic block.

[0073] If the total number of words in a logic block is 32, then 0 ≤ b < 32.

[0074] Where Gran represents the storage granularity.

[0075] Specifically, if the smallest unit of memory access is greater than a word (32 bits), the corresponding formula needs to be adjusted so that the starting word of each logical block is aligned to the smallest unit. For example, if the smallest unit of memory access is a double word (64 bits), the offset formula when Gran=0 can be adjusted to N=2+b.

[0076] Taking a value with a storage granularity of 2 bits as an example, and using decimal as the value, there are 4 different values ​​for the storage granularity: 0, 1, 2, and 3.

[0077] If b = 16, then when Gran = 0, the offset value N = 2. Gran +b=20 +16 = 17. When Gran = 1, the offset N = 2. Gran +b=2 1 +16 = 18. When Gran = 2, the offset N = 2. Gran +b=2 2 +16 = 20. When Gran = 3, the offset N = 2. Gran +b=2 3 +16 = 24.

[0078] 103. Determine the number of reset blocks based on the storage granularity.

[0079] In step 103, the reset value is first determined based on the storage granularity. Then determine the number of reset blocks S = 2 Swap ×2.

[0080] Taking a value with a storage granularity of 2 bits as an example, and using decimal as the value, there are 4 different values ​​for the storage granularity: 0, 1, 2, and 3.

[0081] If b = 16, then when Gran = 0, the reset value is... Number of reset blocks S = 2 Swap ×2=2 3 ×2=16. If b=16, then when Gran=1, the reset value is... Number of reset blocks S = 2 Swap ×2=2 2 ×2=8. If b=16, then when Gran=2, the reset value is... Number of reset blocks S = 2 Swap ×2=2 1 ×2=4. When Gran=3, the reset value is... Number of reset blocks S = 2 Swap ×2=2 0 ×2=2.

[0082] 104. Determine the starting storage word of each logical block based on the offset value and the number of reset blocks.

[0083] The starting memory word for each logic block is determined using the following formula:

[0084] a i = (i mod S) × N + 1.

[0085] Where i is the logical block identifier, a i Let S be the starting storage word of the i-th logical block, S be the number of reset blocks, N be the offset value, and i mod S be the remainder of i / S.

[0086] Taking a storage granularity of 2 bits as an example, with decimal values, if b = 16, the values ​​of each parameter are shown in Table 1.

[0087] Table 1

[0088] Storage granularity (Gran) Offset value (N) Reset value (Swap) Reset block count (S) 0 17 3 16 1 18 2 8 2 20 1 4 3 24 0 2

[0089] When Gran = 0, the offset value is reset after 16 logic blocks. Logic blocks are identified by a starting value of 0, and the starting storage word a of any logic block i is... i = (i mod S) × N + 1, that is, a i = (i mod 16) × 17 + 1. For example, the starting storage word of the 0th logic block is 1, the starting storage word of the 1st logic block is 18, the starting storage word of the 2nd logic block is 35 (which is larger than the maximum number of words in a logic block (e.g., 32), so after offsetting by 32, you can continue to offset from the first word of the logic block, that is, the final initial storage word is 5, that is, rotating within the logic block), ..., the starting storage word of the 16th logic block is 1, ...

[0090] When Gran=1, the offset value is reset after 8 logic blocks. Logic blocks are identified by a starting value of 0, and the starting storage word a of any logic block i is... i = (i mod S) × N + 1, that is, a i = (i mod 6) × 18 + 1. For example, the starting storage word of the 0th logic block is 1, the starting storage word of the 1st logic block is 19, the starting storage word of the 2nd logic block is 37, ..., the starting storage word of the 8th logic block is 1, ...

[0091] When Gran=2, the offset value is reset after 4 logic blocks. Logic blocks are identified by a starting value of 0, and the starting storage word a of any logic block i is... i = (i mod S) × N + 1, that is, a i = (i mod 4) × 20 + 1. For example, the starting storage word of the 0th logic block is 1, the starting storage word of the 1st logic block is 21, the starting storage word of the 2nd logic block is 41, the starting storage word of the 3rd logic block is 61, the starting storage word of the 4th logic block is 1, the starting storage word of the 5th logic block is 21, ...

[0092] When Gran=3, the offset value is reset after 2 logic blocks. Logic blocks are identified by a starting value of 0, and the starting storage word a of any logic block i is... i = (i mod S) × N + 1, that is, a i= (i mod 2) × 24 + 1. For example, the starting storage word of the 0th logic block is 1, the starting storage word of the 1st logic block is 25, the starting storage word of the 2nd logic block is 1, the starting storage word of the 3rd logic block is 25, and so on.

[0093] 105. Based on the starting storage word of each logical block, data is stored according to the storage method.

[0094] The size of the logic block is x times y, where x is the storage width and y is the multiple; the logic block corresponds to y×x words in storage.

[0095] For example, if the storage width is 16 words, then x = 16. If the logical block is twice the storage width, then the size of a logical block is twice the size of 16 words, that is, 32 words.

[0096] For example, if x = 16, then a logic block has 32 words. As shown in Table 2, each cell in a logic block represents a word, and the number in each cell represents the sequence number of that word.

[0097] Table 2

[0098] 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

[0099] If the storage method is row storage, the data in each logical block will be stored in the y-row x-column storage space. The data storage process is as follows: starting from the first logical block, the data of each logical block is stored in sequence (that is, the data in logical block 1 is stored first. When its corresponding storage space is full, it means that the data in logical block 1 has been stored. At this time, the data in logical block 2 is stored, and so on, until the data in all logical blocks has been stored).

[0100] For any logical block i, the data is stored according to the following steps:

[0101] A.1 Set the initial storage word a i The i-th logical block is determined as the starting storage word in the storage space.

[0102] A.2 From the a-th i The data in logical block i is stored sequentially starting from word a, up to word a. i The last character in the line containing the character.

[0103] It should be noted that if a i If the total number of words in the i-th logic block is greater than the total number of words in the i-th logic block, then the excess can be accumulated again starting from the first word of the i-th logic block. For example, if the total number of words in the i-th logic block is 32 (i.e., the i-th logic block has a total of 32 words), and a... i=34, then after reaching 32 words, the base number will continue from the first word. The 34th word is actually the second word of the i-th logic block. In fact, the data will be stored sequentially starting from the second word of the i-th logic block.

[0104] A.3 If the storage space is not full, and the a-th... i If the line containing the character is not full, then start from line a. i The characters are stored sequentially starting from the first character of the row containing the character, up to the ath character. i The line containing the character is full.

[0105] That is, rotating within the row.

[0106] A.4 If the storage space is not full, but the a-th... i If the line containing the character is full, then in line a... i If there are incomplete rows in the target direction of the row containing the character, update 'a'. i =a i +k1×k2×x, re-execute from the a-th... i The data in logical block i is stored sequentially starting from word a, up to word a. i The steps for the last character in the line containing the character and subsequent steps. In the a... i If there are no unfilled rows in the target direction of the row containing the character, update 'a'. i =a i -k1×k3×x, re-execute from the a-th node i The data in logical block i is stored sequentially starting from word a, up to word a. i The steps for the last character in the line containing the character, and subsequent steps, continue until the storage space is full.

[0107] Where k1 is the target direction value; if the target direction is backward, then k1 = 1; if the target direction is forward, then k1 = -1. k2 is the multiple of the first row value; k2 = the first row not yet full in the target direction and the a-th row. i The absolute value of the difference in row numbers between the rows containing the characters, where k3 is a multiple of the second row, k3 = the first not-full row and the a-th row in the opposite direction of the target direction. i The absolute value of the difference in line numbers between the lines containing the characters.

[0108] With storage space in 4 rows, the a-th row... i For example, if the word is located in the second line, and the storage space is not full, but the word in line a is not full, then... i If the row containing the character is full, it means the second row is also full. At this point, a new row needs to be found based on the target direction for data storage. The target direction can be forward (i.e., from relative to 'a'). i (Select a row from the smaller serial numbers), or it can be backwards (i.e., from the relative a) i(Select a row from the larger sequence numbers). The target direction can be determined in advance through configuration. This embodiment does not limit the configuration method or configuration basis.

[0109] If the target direction is forward, then k1 = -1, and from the a-th direction of the target direction... i Check if the row closest to the character is not full, i.e., check if row 1 is not full. If row 1 is not full, then row 1 is the first row not full to the left and right. k2 is the row 1 and row 2 (i.e., row a). i The absolute value of the difference in line numbers between the characters (the lines in which they are located), i.e., k2 = 1. Then a i =a i +k1×k2×x=a i -x. At this point, the first line is the a-th line. i If the first row is full, check if the second row is not full. If the second row is not full, then the second row is the first row that is not full to the left and right. k2 is the intersection of the second and first rows (i.e., the a-th row). i The absolute value of the difference in line numbers between the characters (the lines in which they are located), i.e., k2 = 1. Then a i =a i +k1×k2×x=a i -x. At this point, line 0 is the a-th line. i If the 0th row is full, then it's confirmed that there are no rows preceding the 0th row, meaning there can't be any unfilled rows preceding the 0th row. At this point, it's determined whether the storage space is full. If not, and there can't be any unfilled rows preceding the 0th row, then the 0th, 1st, and 2nd rows are all full. In the opposite direction (backwards), the first unfilled row is the 3rd row, k3 = the 3rd row and the 0th row (i.e., the ath row). i The absolute value of the line number difference between the characters in the same row is 3, i.e., k3 = 3. Update a. i =a i -k1×k3×x=a i =a i +3×x.

[0110] If the target direction is backward, then k1 = 1, and from the a-th direction of the target direction... i Check if the row closest to the character is not full, i.e., check if the 3rd row is not full. If the 3rd row is not full, then the 3rd row is the first not full row above it. k2 is the row between the 3rd row and the 2nd row (i.e., the row a). i The absolute value of the difference in line numbers between the characters (the lines in which they are located), i.e., k2 = 1. Then a i =a i +k1×k2×x=a i +x. At this point, the 3rd line is the a-th line. iIf the third row is full, then it's confirmed that there are no rows after the third row, meaning there can't be any incomplete rows after the third row. At this point, it's determined whether the storage space is full. If not, and there can't be any incomplete rows after the third row, then the first incomplete row in the opposite direction (i.e., forward) is the first row, k3 = the first row and the third row (i.e., the a-th row). i The absolute value of the line number difference between the characters in the same row is 2, i.e., k3 = 2. Update a. i =a i -k1×k3×x=a i =a i -2×x. At this point, the first line is the a-th line. i If the first row is full, then start from the target direction at row a. i The system checks if the row closest to the character (row 2) is incomplete. If row 2 is full, it checks if row 3 is incomplete. If row 3 is full, then in this case, there cannot be any incomplete rows in the backward direction. Since the storage space is not full, the first incomplete row in the opposite direction (forward) is row 0. k3 = row 0 and row 1 (i.e., row a) i The absolute value of the line number difference between the characters (the lines containing the characters) is 3, i.e., k3 = 1. Update a. i =a i -k1×k3×x=a i =a i -x. At this point, line 0 is the a-th line. i The line containing the word.

[0111] The following example uses data 0 to 95 stored in three logical blocks (e.g., logical block 0, logical block 1, and logical block 2) (e.g., logical block 0 stores data 0-31, logical block 1 stores data 32-63, and logical block 3 stores data 64-95), with a storage granularity of 2 bits. The values ​​are in decimal, b=16, Gran=3, N=24, Swap=0, and S=2. Any logical block is shown in Table 2. This example details the process of storing data in a row-by-row manner based on the starting storage word of each logical block.

[0112] The data for each logical block will be stored in a 2-row, 16-column storage space.

[0113] The starting storage word of the 0th logic block is 1, the starting storage word of the 1st logic block is 25, and the starting storage word of the 2nd logic block is 1.

[0114] The initial storage word a0 of the 0th logic block is 1, the initial storage word a1 of the 1st logic block is 25, and the initial storage word a2 of the 2nd logic block is 1.

[0115] Starting from the first logical block (i.e., logical block 0), select one logical block at a time to store the data.

[0116] (1) Select logic block 0

[0117] Starting from the a0=1th word of the storage space 0 corresponding to logic block 0, the data in logic block 0 is stored sequentially until the last word of the 0th row containing word 0. If the target direction is forward, there are no incomplete rows in the forward direction. In this case, k1=-1, k3=the first incomplete row (i.e., the 1st row) in the opposite direction of the target direction and the a0=1th word. i The absolute value of the difference in row numbers between the rows containing the characters (i.e., row 0) is then k3 = 1, and a is updated. i =a i -k1×k3×x=0+16=16. Starting from the 16th word of storage space 0, the subsequent data of logic block 0 is stored sequentially until the last word of the first line of storage space 0. At this point, storage space 0 is full, and the storage of logic block 0 is completed, as shown in Table 3.

[0118] Table 3

[0119] 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

[0120] (2) Select logic block 1

[0121] Starting from the a1=25th word of the storage space 1 corresponding to logic block 1, the data in logic block 1 is stored sequentially until the last word of the first line where the 25th word is located.

[0122] At this point, storage space 1 only contains 8 data items (as shown in Table 4), which is not full. The row containing the 21st character (i.e., row 2) is not full either. So, we continue to store data sequentially starting from the first character of the row containing the 21st character (i.e., row 2) until the row containing the 21st character (i.e., row 2) is full (as shown in Table 5). At this point, storage space 1 only contains 16 data items.

[0123] Table 4

[0124] 32 33 34 35 36 37 38 39

[0125] Table 5

[0126] 40 41 42 43 44 45 46 47 32 33 34 35 36 37 38 39

[0127] The current storage space 1 is not full. If the target direction is forward, then k1 = -1. There is an unfilled row ahead of the first row, i.e., the 0th row. Therefore, k2 = 1. Thus, starting from the a-th row of storage space 1... i =a iData is stored sequentially starting from the word +k1×k2×x=25-16=9 until the last word of the 0th row of storage space 1, as shown in Table 6. At this time, storage space 1 only contains 24 data items. Storage space 1 is not yet full, so it is stored sequentially starting from the first word of the 0th row until the 0th row is full. Then the data of logic block 1 is also stored, as shown in Table 7. At this time, the storage of storage space 1 is completed.

[0128] Table 6

[0129] 48 49 50 51 52 53 54 55 40 41 42 43 44 45 46 47 32 33 34 35 36 37 38 39

[0130] Table 7

[0131] 56 57 58 59 60 61 62 63 48 49 50 51 52 53 54 55 40 41 42 43 44 45 46 47 32 33 34 35 36 37 38 39

[0132] (3) Select logic block 2

[0133] Starting from the a0=1th word of storage space 2 corresponding to logic block 2, data is stored sequentially until the last word of the 0th row containing word 0. If the target direction is forward, there are no incomplete rows in the forward direction. In this case, k1=-1, k3=the first incomplete row (i.e., the 1st row) in the opposite direction of the target direction and the a0th word. i The absolute value of the difference in row numbers between the rows containing the characters (i.e., row 0) is then k3 = 1, and a is updated. i =a i -k1×k3×x=0+16=16. Starting from the 16th word of storage space 2, data is stored sequentially until the last word of the first row of storage space 2. At this point, storage space 2 is full, and the storage of logic block 2 is completed, as shown in Table 8.

[0134] Table 8

[0135] 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95

[0136] The final storage of all data is shown in Table 9.

[0137] Table 9

[0138] 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 56 57 58 59 60 61 62 63 48 49 50 51 52 53 54 55 40 41 42 43 44 45 46 47 32 33 34 35 36 37 38 39 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95

[0139] If the storage method is column storage, the data storage process is as follows: obtain S consecutive storage spaces in the storage and form a storage space group; starting from the first logical block group, determine the logical block group corresponding to each storage space group; wherein, each logical block group consists of multiple consecutive logical blocks; starting from the first logical block group, store the data of the logical block group into the corresponding storage space group in sequence.

[0140] Each storage space consists of y rows and x columns. Each group of storage spaces comprises S contiguous storage spaces.

[0141] For any logical block group j, the data is stored according to the following steps:

[0142] B.1 Determine the initial storage word of each storage space in storage space group j as the starting storage word of each logical block.

[0143] B.2 In accordance with the storage space order, the data of each logical block in logical block group j is stored into the initial storage word of each storage space in turn.

[0144] B.3 Update the initial storage word of each storage space, and repeat the step (i.e. B.2) of storing the data of each logical block in logical block group j into the initial storage word of each storage space in the order of storage space, until storage space group j is full.

[0145] For any storage space v, its initial storage word a is updated through the following steps. j (v):

[0146] For any logical block group j, the data of logical block group j is stored into the corresponding storage space group j according to the following steps:

[0147] The initial storage word of each storage space in storage space group j is determined as the starting storage word of each logical block.

[0148] According to the storage space order, the data of each logical block in logical block group j is stored into the initial storage word of each storage space in turn.

[0149] Update the initial storage word of each storage space, and repeat the steps of storing the data of each logical block in logical block group j into the initial storage word of each storage space in the order of storage space, and the subsequent steps, until storage space group j is full.

[0150] For any storage space v, its initial storage word a is updated through the following steps. u (v), where u is the logical block identifier in the logical block group corresponding to storage space v:

[0151] If a u (v) is not the last word of its line, and a u If (v)+1 is not stored, then update a. u (v)=a u (v)+1.

[0152] If a u (v) is not the last word of its line, but a u (v)+1 has already stored data. If the storage space v is not full, then at the a-th... u (v) If there are incomplete rows in the target direction of the row containing the character, update a. u (v)=au (v)+k1×k2×x. At the a-th... u (v) If there are no incomplete rows in the target direction of the row containing the word, update a. u (v)=a u (v)-k1×k3×x. Where k1 is the target direction value; if the target direction is backward, then k1 = 1; if the target direction is forward, then k1 = -1. k2 is the multiple of the first row, k2 = the sum of the first unfilled row and the a-th row in the target direction. u (v) The absolute value of the difference in row numbers between the rows containing the character, k3 is a multiple of the second row, k3 = the first row that is not full in the opposite direction of the target direction and the a-th row. u (v) The absolute value of the difference in line numbers between the lines containing the character.

[0153] If a u (v) is the last word of its line, then in a u (v) Update a if the current row is not full. u (v) is a u (v) The first character of the line. In a u If the row containing (v) is full, and if the storage space v is not full, then in the a-th row... u (v) If there are incomplete rows in the target direction of the row containing the character, update a. u (v)=a u (v)+k1×k2×x. At the a-th... i If there are no unfilled rows in the target direction of the row containing the character, update 'a'. u (v)=a u (v)-k1×k3×x.

[0154] The following example uses two logic blocks (e.g., logic block 0 and logic block 1) to store data from 0 to 63 (e.g., logic block 0 stores data 0-31, and logic block 1 stores data 32-63). The storage granularity is 2 bits, and the values ​​are in decimal, with b=16, Gran=3, N=24, Swap=0, and S=2. Any logic block is shown in Table 2. This example details the process of storing data in columnar storage based on the starting storage word of each logic block.

[0155] Obtain S = 2 consecutive storage spaces (such as storage space 0 and storage space 1) in the storage, and form them into a storage space group (such as storage space group 0); where each storage space is 2 rows and 16 columns, so storage space group 0 is a space of 4 rows and 14 columns.

[0156] Each logical block stores 32 words of data, and the two logical blocks store a total of 64 data items. Therefore, there are 64 data items to be stored. Since S = 2 consecutive storage spaces constitute a storage space group of 64 words, all data can be stored through storage space group 1. If logical block 0 and logical block 1 constitute logical block group 0, then the logical block group corresponding to storage space group 0 is logical block group 0.

[0157] The method provided in this embodiment will sequentially store the data in logical block group 0 into storage space group 0. (If there are multiple storage space groups, each corresponding to a logical block group, then the data in logical block group 0 will be sequentially stored into storage space group 0 first, then the data in logical block group 1 will be sequentially stored into storage space group 1, and so on, until all data is stored.)

[0158] The stored procedure is as follows:

[0159] (1) Determine that the initial storage word a0(0) of logic block 0 in logic block group 0 is the starting storage word of logic block 0 (i.e., a0(0) = 1), and the initial storage word a0(0) of logic block 1 is the starting storage word of logic block 1 (i.e., a1(0) = 25).

[0160] (2) According to the order of the storage spaces in storage space group 0, the data of each logical block in logical block group 0 is stored into the initial storage word of each storage space in turn. That is, the first data (i.e., 0) of logical block 0 is stored in the first word of storage space 0, and the second data (i.e., 1) of logical block 0 is stored in the 25th word of storage space 1, forming the data shown in Table 10.

[0161] Table 10

[0162]

[0163]

[0164] In Table 10, the white background represents one storage space (e.g., storage space 0), and the gray background represents another storage space (e.g., storage space 1).

[0165] (3) If a0(0) is not the last character of its row (i.e., row 0) and the character after a0(0) is not stored, then update a0(0) = a0(0) + 1 (i.e., the current a0(0) = 1). If a1(0) is not the last character of its row (i.e., row 1) and the character after a1(0) is not stored, then update a1(0) = a1(0) + 1 (i.e., the current a1(0) = 26).

[0166] (4) The third data (i.e., 2) of logical block 0 is stored in the second word of storage space 0, the fourth data (i.e., 3) of logical block 0 is stored in the 26th word of storage space 1, ..., and so on, until storage space group 0 is as shown in Table 11.

[0167] Table 11

[0168]

[0169] (5) If a0(0) is not the last character of its row (i.e., row 0), and the character after a0(0) is not stored, then update a0(0) = a0(0) + 1 (i.e., the current a0(0) = 9). If a1(0) is the last character of its row (i.e. row 1), and the first row of storage space 1 is not full, update a1(0) to the first character of the first row of storage space 1 (i.e., the 17th character of storage space 1), i.e., a1(0) = 16 (because in this example, the character identifier of storage space 1 starts from 0, and the identifier of the 17th character is 17).

[0170] (6) The data of the logical block continues to be stored sequentially in the 9th word of storage space 0 and the 17th word of storage space 1, as shown in Table 12.

[0171] Table 12

[0172]

[0173] (7) Store sequentially until 31 is stored, forming Table 13.

[0174] Table 13

[0175]

[0176] (8) At this point, a0(0) is the last word of its row (i.e., row 0), and the row (i.e., row 0) where a0(0) is located in storage space 0 is full, but storage space 0 is not full. If there is an unfilled row in the target direction of the row where the word a0(0) is located, update a0(0) = a0(0) + k1 × k2 × 16; if there is no unfilled row in the target direction of the row where the word a0(0) is located, update a0(0) = a0(0) - k1 × k3 × 16. (This process is similar to the related process in row storage, and will not be explained in detail here. Please refer to row storage).

[0177] If a1(0) is not the last word of its row (i.e., the first row), but a1(0)+1 has already stored data and the storage space 0 is not full, then if there is an unfilled row in the target direction of the row where a1(0) is located, update a1(0) = a1(0) + k1×k2×16; if there is no unfilled row in the target direction of the row where a1(0) is located, update a1(0) = a1(0) - k1×k3×16. (This process is similar to the related process in row storage, and will not be explained in detail here. Please refer to row storage.)

[0178] The data is stored sequentially, resulting in the table shown in Table 14.

[0179] Table 14

[0180]

[0181] Execution complete. Column storage.

[0182] After storage, the data can be read. For example, the read method can be determined, and data can be read according to the starting storage location of each logical block.

[0183] The reading method can be either row reading or column reading.

[0184] The reading process is the reverse of the storage process. It involves using a reading method to determine the storage location of the data to be read within the logical block, and then reading the data from that location. In other words, the method for determining the address is the same; the only difference is that during storage, data is stored at that address, and during reading, data is read from that address.

[0185] For example, determine the storage granularity and reading method; determine the offset value based on the storage granularity; determine the number of reset blocks based on the storage granularity; determine the starting read word for each logical block based on the offset value and the number of reset blocks (this process is the same as "determining the starting storage word for each logical block based on the offset value and the number of reset blocks," see the above description of "determining the starting storage word for each logical block based on the offset value and the number of reset blocks," which will not be repeated here); and read data according to the reading method based on the starting storage location of each logical block.

[0186] This embodiment provides a data storage method that determines the storage granularity and storage mode; wherein the storage mode is row storage or column storage; the storage granularity is a multi-bit value; an offset value is determined based on the storage granularity; the number of reset blocks is determined based on the storage granularity; the starting storage word of each logical block is determined based on the offset value and the number of reset blocks; and data is stored according to the storage mode based on the starting storage word of each logical block. The method provided in this embodiment can determine the starting storage word of each logical block based on the storage granularity, and store data according to the storage mode based on the starting storage word of each logical block, thus achieving fast data storage.

[0187] Based on the same inventive concept of data storage methods, this embodiment provides a data storage device, see [link to relevant documentation]. Figure 2 The device includes:

[0188] The first determining unit 201 is used to determine the storage granularity and storage method. The storage method is either row storage or column storage. The storage granularity is a multi-bit value.

[0189] The second determining unit 202 is used to determine the offset value according to the storage granularity determined by the first determining unit 201.

[0190] The third determining unit 203 is used to determine the number of reset blocks based on the storage granularity determined by the first determining unit 201.

[0191] The fourth determining unit 204 is used to determine the starting storage word of each logic block based on the offset value determined by the second determining unit 202 and the number of blocks reset by the third determining unit 203.

[0192] Storage unit 205 is used to store data according to the storage method determined by the first determining unit 201, based on the starting storage word of each logic block determined by the fourth determining unit 204.

[0193] The second determining unit 202 is used to determine the offset value N = 2. Gran +b. Where Gran is the storage granularity, b is a pre-set perturbation parameter, and 0 ≤ b < the total number of words in a logical block.

[0194] The third determining unit 203 is used to determine the reset value according to the storage granularity.

[0195] Determine the number of reset blocks S = 2 Swap ×2.

[0196] The fourth determining unit 204 is used to determine the starting storage word of each logic block using the following formula:

[0197] a i = (i mod S) × N + 1.

[0198] Where i is the logical block identifier, a i Let S be the starting storage word of the i-th logical block, S be the number of reset blocks, N be the offset value, and i mod S be the remainder of i / S.

[0199] The size of a logical block is x times y, where x is the storage width and y is the multiple. The logical block corresponds to y rows and x columns of storage space. The storage method is row-based.

[0200] Storage unit 205 is used to store the data of each logical block sequentially, starting from the first logical block.

[0201] For any logical block i, the data is stored according to the following steps:

[0202] Initial storage word a i The i-th logical block is determined as the starting storage word in the storage space.

[0203] From the a i The data in logical block i is stored sequentially starting from word a, up to word a. i The last character in the line containing the character.

[0204] If the storage space is not full, and the a-th i If the line containing the character is not full, then start from line a. i The characters are stored sequentially starting from the first character of the row containing the character, up to the ath character. i The line containing the character is full.

[0205] If the storage space is not full, but the a-th... i If the line containing the character is full, then in line a... i If there are incomplete rows in the target direction of the row containing the character, update 'a'. i =a i +k1×k2×x, re-execute from the a-th... i The data in logical block i is stored sequentially starting from word a, up to word a. i The steps for the last character in the line containing the character and subsequent steps. In the a... i If there are no unfilled rows in the target direction of the row containing the character, update 'a'. i =a i -k1×k3×x, re-execute from the a-th node i The data in logical block i is stored sequentially starting from word a, up to word a. i The steps for the last character in the line containing the character, and subsequent steps, continue until the storage space is full.

[0206] Where k1 is the target direction value; if the target direction is backward, then k1 = 1; if the target direction is forward, then k1 = -1. k2 is the multiple of the first row value; k2 = the first row not yet full in the target direction and the a-th row. i The absolute value of the difference in row numbers between the rows containing the characters, where k3 is a multiple of the second row, k3 = the first not-full row and the a-th row in the opposite direction of the target direction. i The absolute value of the difference in line numbers between the lines containing the characters.

[0207] The size of the logical block is x times y, where x is the storage width and y is the multiple. The storage method is columnar storage.

[0208] Storage unit 205 is used to acquire S consecutive storage spaces in the storage and form a storage space group. Each storage space is y rows and x columns.

[0209] Starting with the first logical block group, the logical block groups corresponding to each storage space group are determined. Each logical block group consists of multiple consecutive logical blocks.

[0210] Starting with the first logical block group, the data of the logical block group is stored into the corresponding storage space group in sequence.

[0211] For any logical block group j, the data of logical block group j is stored into the corresponding storage space group j according to the following steps:

[0212] The initial storage word of each storage space in storage space group j is determined as the starting storage word of each logical block.

[0213] According to the storage space order, the data of each logical block in logical block group j is stored into the initial storage word of each storage space in turn.

[0214] Update the initial storage word of each storage space, and repeat the steps of storing the data of each logical block in logical block group j into the initial storage word of each storage space in the order of storage space, and the subsequent steps, until storage space group j is full.

[0215] For any storage space v, its initial storage word a is updated through the following steps. u (v), where u is the logical block identifier in the logical block group corresponding to storage space v:

[0216] If a u (v) is not the last word of its line, and a u If (v)+1 is not stored, then update a. u (v)=a u (v)+1.

[0217] If a u (v) is not the last word of its line, but a u (v)+1 has already stored data. If the storage space v is not full, then at the a-th... u (v) If there are incomplete rows in the target direction of the row containing the character, update a. u (v)=a u (v)+k1×k2×x. At the a-th... u (v) If there are no incomplete rows in the target direction of the row containing the word, update a. u (v)=a u(v)-k1×k3×x. Where k1 is the target direction value; if the target direction is backward, then k1 = 1; if the target direction is forward, then k1 = -1. k2 is the multiple of the first row, k2 = the sum of the first unfilled row and the a-th row in the target direction. y (v) The absolute value of the difference in row numbers between the rows containing the character, k3 is a multiple of the second row, k3 = the first row that is not full in the opposite direction of the target direction and the a-th row. u (v) The absolute value of the difference in line numbers between the lines containing the character.

[0218] If a u (v) is the last word of its line, then in a u (v) Update a if the current row is not full. u (v) is a u (v) The first character of the line. In a u If the row containing (v) is full, and if the storage space v is not full, then in the a-th row... u (v) If there are incomplete rows in the target direction of the row containing the character, update a. u (v)=a u (v)+k1×k2×x. At the a-th... i If there are no unfilled rows in the target direction of the row containing the character, update 'a'. u (v)=a u (v)-k1×k3×x.

[0219] The device also includes a reading module for determining the reading method. The reading method can be either row reading or column reading.

[0220] Data is read according to the starting storage location of each logical block and the read method.

[0221] The device provided in this embodiment can determine the starting storage word of each logic block according to the storage granularity, and store data according to the storage method based on the starting storage word of each logic block, thereby realizing fast data storage.

[0222] Based on the same inventive concept of data storage methods, this embodiment provides an electronic device, which is as follows: Figure 3 As shown, it includes: a memory 301, a processor 302, and a computer program.

[0223] The computer program is stored in memory 301 and configured to be executed by processor 302 to implement the above data storage method.

[0224] Specifically,

[0225] Determine the storage granularity and storage method. The storage method can be row-based or column-based. The storage granularity is a multi-bit value.

[0226] The offset value is determined based on the storage granularity.

[0227] The number of reset blocks is determined based on the storage granularity.

[0228] The starting storage word for each logical block is determined based on the offset value and the number of reset blocks.

[0229] Data is stored according to the storage method based on the starting storage word of each logical block.

[0230] Optionally, the offset value is determined based on the storage granularity, including:

[0231] Determine the offset value N=2 Gran +b. Where Gran is the storage granularity, b is a pre-set perturbation parameter, and 0 ≤ b < the total number of words in a logical block.

[0232] Optionally, the number of reset blocks is determined based on the storage granularity, including:

[0233] Determine the reset value based on the storage granularity.

[0234] Determine the number of reset blocks S = 2 Swap ×2.

[0235] Optionally, the starting storage word of each logical block is determined based on the offset value and the number of reset blocks, including:

[0236] The starting memory word for each logic block is determined using the following formula:

[0237] a i = (i mod S) × N + 1.

[0238] Where i is the logical block identifier, a i Let S be the starting storage word of the i-th logical block, S be the number of reset blocks, N be the offset value, and i mod S be the remainder of i / S.

[0239] Optionally, the size of the logical block is x times y, where x is the storage width and y is the multiple. The logical block corresponds to y rows and x columns of storage space. The storage method is row storage.

[0240] Based on the starting storage word of each logical block, data is stored according to the storage method, including:

[0241] Starting with the first logical block, the data of each logical block is stored sequentially.

[0242] For any logical block i, the data is stored according to the following steps:

[0243] Initial storage word a i The i-th logical block is determined as the starting storage word in the storage space.

[0244] From the a i The data in logical block i is stored sequentially starting from word a, up to word a. i The last character in the line containing the character.

[0245] If the storage space is not full, and the a-th i If the line containing the character is not full, then start from line a. i The characters are stored sequentially starting from the first character of the row containing the character, up to the ath character. i The line containing the character is full.

[0246] If the storage space is not full, but the a-th... i If the line containing the character is full, then in line a... i If there are incomplete rows in the target direction of the row containing the character, update 'a'. i =a i +k1×k2×x, re-execute from the a-th... i The data in logical block i is stored sequentially starting from word a, up to word a. i The steps for the last character in the line containing the character and subsequent steps. In the a... i If there are no unfilled rows in the target direction of the row containing the character, update 'a'. i =a i -k1×k3×x, re-execute from the a-th node i The data in logical block i is stored sequentially starting from word a, up to word a. i The steps for the last character in the line containing the character, and subsequent steps, continue until the storage space is full.

[0247] Where k1 is the target direction value; if the target direction is backward, then k1 = 1; if the target direction is forward, then k1 = -1. k2 is the multiple of the first row value; k2 = the first row not yet full in the target direction and the a-th row. i The absolute value of the difference in row numbers between the rows containing the characters, where k3 is a multiple of the second row, k3 = the first not-full row and the a-th row in the opposite direction of the target direction. i The absolute value of the difference in line numbers between the lines containing the characters.

[0248] Optionally, the size of the logical block is x times y, where x is the storage width and y is the multiple. The storage method is column storage.

[0249] Based on the starting storage word of each logical block, data is stored according to the storage method, including:

[0250] Retrieve S contiguous storage spaces from the storage and group them into a storage space group. Each storage space consists of y rows and x columns.

[0251] Starting with the first logical block group, the logical block groups corresponding to each storage space group are determined. Each logical block group consists of multiple consecutive logical blocks.

[0252] Starting with the first logical block group, the data of the logical block group is stored into the corresponding storage space group in sequence.

[0253] For any logical block group j, the data of logical block group j is stored into the corresponding storage space group j according to the following steps:

[0254] The initial storage word of each storage space in storage space group j is determined as the starting storage word of each logical block.

[0255] According to the storage space order, the data of each logical block in logical block group j is stored into the initial storage word of each storage space in turn.

[0256] Update the initial storage word of each storage space, and repeat the steps of storing the data of each logical block in logical block group j into the initial storage word of each storage space in the order of storage space, and the subsequent steps, until storage space group j is full.

[0257] For any storage space v, its initial storage word a is updated through the following steps. u (v), where u is the logical block identifier in the logical block group corresponding to storage space v:

[0258] If a u (v) is not the last word of its line, and a u If (v)+1 is not stored, then update a. u (v)=a u (v)+1.

[0259] If a u (v) is not the last word of its line, but a u (v)+1 has already stored data. If the storage space v is not full, then at the a-th... u (v) If there are incomplete rows in the target direction of the row containing the character, update a. u (v)=a u (v)+k1×k2×x. At the a-th... u (v) If there are no incomplete rows in the target direction of the row containing the word, update a. u (v)=a u (v)-k1×k3×x. Where k1 is the target direction value; if the target direction is backward, then k1 = 1; if the target direction is forward, then k1 = -1. k2 is the multiple of the first row, k2 = the sum of the first unfilled row and the a-th row in the target direction. u(v) The absolute value of the difference in row numbers between the rows containing the character, k3 is a multiple of the second row, k3 = the first row that is not full in the opposite direction of the target direction and the a-th row. u (v) The absolute value of the difference in line numbers between the lines containing the character.

[0260] If a u (v) is the last word of its line, then in a u (v) Update a if the current row is not full. u (v) is a u (v) The first character of the line. In a u If the row containing (v) is full, and if the storage space v is not full, then in the a-th row... u (v) If there are incomplete rows in the target direction of the row containing the character, update a. u (v)=a u (v)+k1×k2×x. At the a-th... i If there are no unfilled rows in the target direction of the row containing the character, update 'a'. u (v)=a u (v)-k1×k3×x.

[0261] Optionally, after storing the data according to the storage method based on the starting storage location of each logical block, the method further includes:

[0262] Determine the reading method. The reading method can be either row-based or column-based.

[0263] Data is read according to the starting storage location of each logical block and the read method.

[0264] The electronic device provided in this embodiment has a computer program executed by a processor to determine the starting storage word of each logic block according to the storage granularity. Based on the starting storage word of each logic block, data is stored according to the storage method, thereby realizing fast data storage.

[0265] Based on the same inventive concept of data storage methods, this embodiment provides a computer-readable storage medium on which a computer program is stored. The computer program is executed by a processor to implement the above-described data storage method.

[0266] Specifically,

[0267] Determine the storage granularity and storage method. The storage method can be row-based or column-based. The storage granularity is a multi-bit value.

[0268] The offset value is determined based on the storage granularity.

[0269] The number of reset blocks is determined based on the storage granularity.

[0270] The starting storage word for each logical block is determined based on the offset value and the number of reset blocks.

[0271] Data is stored according to the storage method based on the starting storage word of each logical block.

[0272] Optionally, the offset value is determined based on the storage granularity, including:

[0273] Determine the offset value N=2 Gran +b. Where Gran is the storage granularity, b is a pre-set perturbation parameter, and 0 ≤ b < the total number of words in a logical block.

[0274] Optionally, the number of reset blocks is determined based on the storage granularity, including:

[0275] Determine the reset value based on the storage granularity.

[0276] Determine the number of reset blocks S = 2 Swap ×2.

[0277] Optionally, the starting storage word of each logical block is determined based on the offset value and the number of reset blocks, including:

[0278] The starting memory word for each logic block is determined using the following formula:

[0279] a i = (i mod S) × N + 1.

[0280] Where i is the logical block identifier, a i Let S be the starting storage word of the i-th logical block, S be the number of reset blocks, N be the offset value, and i mod S be the remainder of i / S.

[0281] Optionally, the size of the logical block is x times y, where x is the storage width and y is the multiple. The logical block corresponds to y rows and x columns of storage space. The storage method is row storage.

[0282] Based on the starting storage word of each logical block, data is stored according to the storage method, including:

[0283] Starting with the first logical block, the data of each logical block is stored sequentially.

[0284] For any logical block i, the data is stored according to the following steps:

[0285] Initial storage word a i The i-th logical block is determined as the starting storage word in the storage space.

[0286] From the a i The data in logical block i is stored sequentially starting from word a, up to word a. i The last character in the line containing the character.

[0287] If the storage space is not full, and the a-th i If the line containing the character is not full, then start from line a. i The characters are stored sequentially starting from the first character of the row containing the character, up to the ath character. i The line containing the character is full.

[0288] If the storage space is not full, but the a-th... i If the line containing the character is full, then in line a... i If there are incomplete rows in the target direction of the row containing the character, update 'a'. i =a i +k1×k2×x, re-execute from the a-th... i The data in logical block i is stored sequentially starting from word a, up to word a. i The steps for the last character in the line containing the character and subsequent steps. In the a... i If there are no unfilled rows in the target direction of the row containing the character, update 'a'. i =a i -k1×k3×x, re-execute from the a-th node i The data in logical block i is stored sequentially starting from word a, up to word a. i The steps for the last character in the line containing the character, and subsequent steps, continue until the storage space is full.

[0289] Where k1 is the target direction value; if the target direction is backward, then k1 = 1; if the target direction is forward, then k1 = -1. k2 is the multiple of the first row value; k2 = the first row not yet full in the target direction and the a-th row. i The absolute value of the difference in row numbers between the rows containing the characters, where k3 is a multiple of the second row, k3 = the first not-full row and the a-th row in the opposite direction of the target direction. i The absolute value of the difference in line numbers between the lines containing the characters.

[0290] Optionally, the size of the logical block is x times y, where x is the storage width and y is the multiple. The storage method is column storage.

[0291] Based on the starting storage word of each logical block, data is stored according to the storage method, including:

[0292] Retrieve S contiguous storage spaces from the storage and group them into a storage space group. Each storage space consists of y rows and x columns.

[0293] Starting with the first logical block group, the logical block groups corresponding to each storage space group are determined. Each logical block group consists of multiple consecutive logical blocks.

[0294] Starting with the first logical block group, the data of the logical block group is stored into the corresponding storage space group in sequence.

[0295] For any logical block group j, the data of logical block group j is stored into the corresponding storage space group j according to the following steps:

[0296] The initial storage word of each storage space in storage space group j is determined as the starting storage word of each logical block.

[0297] According to the storage space order, the data of each logical block in logical block group j is stored into the initial storage word of each storage space in turn.

[0298] Update the initial storage word of each storage space, and repeat the steps of storing the data of each logical block in logical block group j into the initial storage word of each storage space in the order of storage space, and the subsequent steps, until storage space group j is full.

[0299] For any storage space v, its initial storage word a is updated through the following steps. u (v), where u is the logical block identifier in the logical block group corresponding to storage space v:

[0300] If a u (v) is not the last word of its line, and a u If (v)+1 is not stored, then update a. u (v)=a u (v)+1.

[0301] If a u (v) is not the last word of its line, but a u (v)+1 has already stored data. If the storage space v is not full, then at the a-th... u (v) If there are incomplete rows in the target direction of the row containing the character, update a. u (v)=a u (v)+k1×k2×x. At the a-th... u (v) If there are no incomplete rows in the target direction of the row containing the word, update a. u (v)=a u (v)-k1×k3×x. Where k1 is the target direction value; if the target direction is backward, then k1 = 1; if the target direction is forward, then k1 = -1. k2 is the multiple of the first row, k2 = the sum of the first unfilled row and the a-th row in the target direction. u (v) The absolute value of the difference in row numbers between the rows containing the character, k3 is a multiple of the second row, k3 = the first row that is not full in the opposite direction of the target direction and the a-th row. u (v) The absolute value of the difference in line numbers between the lines containing the character.

[0302] If a u (v) is the last word of its line, then in a u (v) Update a if the current row is not full.u (v) is a u (v) The first character of the line. In a u If the row containing (v) is full, and if the storage space v is not full, then in the a-th row... u (v) If there are incomplete rows in the target direction of the row containing the character, update a. u (v)=a u (v)+k1×k2×x. At the a-th... i If there are no unfilled rows in the target direction of the row containing the character, update 'a'. u (v)=a u (v)-k1×k3×x.

[0303] Optionally, after storing the data according to the storage method based on the starting storage location of each logical block, the method further includes:

[0304] Determine the reading method. The reading method can be either row-based or column-based.

[0305] Data is read according to the starting storage location of each logical block and the read method.

[0306] The computer-readable storage medium provided in this embodiment allows a computer program thereon to be executed by a processor to determine the starting storage word of each logical block based on the storage granularity. Based on the starting storage word of each logical block, data is stored according to the storage method, thus achieving fast data storage.

[0307] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The solutions in the embodiments of this application can be implemented in various computer languages, such as the object-oriented programming language Java and the interpreted scripting language JavaScript.

[0308] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0309] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0310] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0311] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.

[0312] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A data storage method, characterized in that, The method includes: Determine the storage granularity and storage method; wherein the storage method is row storage or column storage; and the storage granularity is a multi-bit value. The offset value is determined based on the storage granularity; The number of reset blocks is determined based on the storage granularity. Determine the starting storage word for each logical block based on the offset value and the number of reset blocks; Data is stored according to the storage method based on the starting storage word of each logical block; Determining the offset value based on the storage granularity includes: Determine the offset value ;in, For storage granularity, For the pre-set disturbance parameters, Total number of words in a logic block; Determining the number of reset blocks based on the storage granularity includes: Determine the reset value based on the storage granularity. ; Determine the number of reset blocks ; The step of determining the starting storage word of each logical block based on the offset value and the number of reset blocks includes: The starting memory word for each logic block is determined using the following formula: ; in, For logical block identifiers, For the first The starting storage word of each logical block, To reset the number of blocks, This is the offset value. for The remainder; The size of the logic block is of times, of which, For storage width, It is a multiple; the logical block corresponds to the storage in OK Column storage space; when the storage method is row storage; The data stored according to the storage method based on the starting storage word of each logical block includes: Starting with the first logical block, the data of each logical block is stored sequentially; For any logical block Store the data using the following steps: Initial storage word Determined as the number The starting storage word of each logical block in the storage space; From the Word-first sequential storage logic block The data in, up to the first The last character in the line containing the character; If the storage space is not full, and the first If the line containing a character is not full, then start from the next line. The characters are stored sequentially starting from the first character of the row containing the character, up to the [number]th character. The line containing the character is full; If the storage space is not full, but the first If the line containing the character is full, then in the next line... If there are incomplete rows in the target direction of the row containing the character, update. Re-execute from the first Word-first sequential storage logic block The data in, up to the first The steps for the last character in the line containing the character and subsequent steps; in the... Update if there are no non-full rows in the target direction of the row containing the character. Re-execute from the first Word-first sequential storage logic block The data in, up to the first The steps for the last character in the line containing the character, and subsequent steps, until the storage space is full; in, This is the target direction value. If the target direction is backward, then... If the target direction is forward, then , The value is a multiple of the first row. The first row that is not full in the target direction and the row that is not full The absolute value of the line number difference between the lines containing the characters. The value is a multiple of the second row. In the opposite direction of the target direction, the first row that is not full and the row that is full. The absolute value of the difference in line numbers between the lines containing the characters.

2. The method according to claim 1, characterized in that, The size of the logic block is of times, of which, For storage width, It is a multiple; when the storage method is column storage; The data stored according to the storage method based on the starting storage word of each logical block includes: Retrieve from storage A contiguous storage space is grouped into a storage space group; where each storage space is... OK List; Starting with the first logical block group, determine the logical block group corresponding to each storage space group; each logical block group consists of multiple consecutive logical blocks; Starting with the first logical block group, the data of the logical block group is stored into the corresponding storage space group in sequence; For any logical block group Group the logic blocks as follows The data is stored in the corresponding storage space group middle: Determine storage space group The initial storage word of each storage space is the starting storage word of each logical block; Logical blocks are grouped sequentially according to storage space order. The data of each logical block is stored in the initial storage word of each storage space; Update the initial storage words of each storage space, and repeat the process of sequentially grouping logical blocks according to storage space order. The steps involved in storing data from each logical block into the initial storage word of each storage space, and subsequent steps, until the storage space group... Full; For any storage space Update its initial storage word through the following steps. ,in, For storage space The corresponding logic block identifier in the logic block group: like Not the last word of its line, and If no data is stored, update. ; like It is not the last word of its line, but If the data has already been stored, then if the storage space If not fully stored, then in the [number]th [stage / phase] If there are incomplete rows in the target direction of the row containing the character, update. ; in the Update if there are no non-full rows in the target direction of the row containing the character. ;in, This is the target direction value. If the target direction is backward, then... If the target direction is forward, then , The value is a multiple of the first row. The first row that is not full in the target direction and the row that is not full The absolute value of the line number difference between the lines containing the characters. The value is a multiple of the second row. In the opposite direction of the target direction, the first row that is not full and the row that is full. The absolute value of the difference in line numbers between characters; like If it is the last character of its line, then in Update if the current row is not full. for The first character of the line; in If the current row is full, if the storage space If not fully stored, then in the [number]th [stage / phase] If there are incomplete rows in the target direction of the row containing the character, update. ; in the Update if there are no non-full rows in the target direction of the row containing the character. .

3. The method according to claim 1, characterized in that, After storing the data according to the storage method based on the starting storage location of each logical block, the method further includes: Determine the reading method; wherein the reading method is either row reading or column reading; Data is read according to the reading method based on the starting storage location of each logical block.

4. A data storage device, characterized in that, The apparatus for implementing the method of any one of claims 1-3 comprises: The first determining unit is used to determine the storage granularity and storage method; wherein the storage method is row storage or column storage; and the storage granularity is a multi-bit value. The second determining unit is used to determine the offset value based on the storage granularity determined by the first determining unit; The third determining unit is used to determine the number of reset blocks based on the storage granularity determined by the first determining unit; The fourth determining unit is used to determine the starting storage word of each logical block based on the offset value determined by the second determining unit and the number of blocks reset by the third determining unit; The storage unit is used to store data according to the storage method determined by the first determining unit, based on the starting storage word of each logical block determined by the fourth determining unit.

5. An electronic device, characterized in that, include: Memory; processor; as well as Computer programs; The computer program is stored in the memory and configured to be executed by the processor to implement the method as described in any one of claims 1-3.

6. A computer-readable storage medium, characterized in that, It stores a computer program thereon; the computer program is executed by a processor to implement the method as described in any one of claims 1-3.

Citation Information

Patent Citations

  • Multi-granularity parallel storage system and memory

    CN110096450A

  • Data storage method and device, electronic equipment and storage medium

    CN118034600A