Data reading method, device and computer equipment

By combining data read addresses of the same category and reading data based on lookup table, the problem of frequent call to memory by LUP-based address query operations is solved, which improves memory reading efficiency and reduces power consumption.

CN113704143BActive Publication Date: 2025-03-18HUNAN GOKE MICROELECTRONICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110992935.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-27
Publication Date
2025-03-18
Estimated Expiration
2041-08-27

AI Technical Summary

Technical Problem

LUP-based address query operations require frequent call to memory, resulting in a decrease in memory read efficiency and power consumption.

Method used

By obtaining the first data read address in the data read request, combining the addresses of the same category as the second data read address, and reading the data corresponding to the second data read address based on the lookup table, and finally outputting the data to the port corresponding to the first data read address.

Benefits of technology

By combining the addresses to be read, the number of calls to the memory is reduced, the overall reading efficiency of random memory is improved, and power consumption is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113704143B_ABST
    Figure CN113704143B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a data reading method, device and computer equipment. The data reading method includes: obtaining a data reading request; according to the category of each first data reading address, merging all first data reading addresses into different second data reading addresses, and then reading the data corresponding to each second data reading address according to a lookup table; finally, outputting the data of the second data reading address to the port corresponding to the first data reading address. Thus, before reading data from the access device, each address to be read is first classified and merged, so that when the addresses to be read are the same or the addresses to be read are continuous, there is no need to repeatedly call the memory, thereby improving the overall reading efficiency of the memory and reducing the power consumption of the memory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a data reading method, device and computer equipment. Background Art

[0002] LUP (Look Up Table) enables the memory to receive the query address and output the content corresponding to the query address according to the mapping rules stored in LUP. Therefore, LUP is often used in gray value mapping, contrast setting, neural network accelerators and other fields.

[0003] However, each LUP-based address query operation requires calling the access memory once to obtain the corresponding output result, resulting in a certain negative impact on the overall reading efficiency and power consumption of the memory. Summary of the invention

[0004] In view of this, in order to improve the reading efficiency of accessing a memory, the present invention provides a data reading method, device and computer equipment.

[0005] In a first aspect, an embodiment of the present invention provides a data reading method, comprising:

[0006] Obtaining a data read request, wherein the data read request includes a predetermined number of first data read addresses;

[0007] Merging all first data read addresses of the same category in the data read request into corresponding second data read addresses;

[0008] Based on the lookup table, reading the data corresponding to each second data reading address;

[0009] According to the corresponding relationship between all the second data read addresses and all the first data read addresses, the data corresponding to the second data read addresses are output to the ports corresponding to the first data read addresses.

[0010] In an implementation manner provided by an embodiment of the present invention, merging all first data read addresses of the same category in a data read request into corresponding second data read addresses includes:

[0011] Selecting a predetermined field of each first data reading address as a characteristic address corresponding to the first data reading address;

[0012] In the data read request, all first data read addresses that match the characteristic addresses are combined into corresponding second data read addresses.

[0013] In an implementation manner provided by an embodiment of the present invention, merging all first data read addresses that match characteristic addresses in a data read request into corresponding second data read addresses includes:

[0014] Obtaining all first data read addresses in the data read request that are different from any other characteristic address and are not continuous with any other characteristic address as second data read addresses;

[0015] In the data read request, any two first data read addresses whose characteristic addresses are the same or whose characteristic addresses are consecutive addresses are merged into the corresponding second data read address.

[0016] In an implementation manner provided in an embodiment of the present invention, the method further includes:

[0017] Determine whether each first data read address in the data read request has corresponding data output;

[0018] If not, the data corresponding to the second data read address is output to the port corresponding to the first data read address again according to the correspondence between all the second data read addresses and all the first data read addresses.

[0019] When reading data from a memory based on the LUP table, the embodiment of the present invention first obtains a data read request to obtain all first data read addresses, that is, the addresses of the data to be read in the memory; then, based on the category of each first data, all the first data read addresses are merged into different second data read addresses, and then the data corresponding to each second data read address is read according to the lookup table; finally, according to the correspondence between all the second data read addresses and all the first data read addresses, the data corresponding to the second data read address is output to the port corresponding to the first data read address.

[0020] Therefore, before reading data from the memory, the embodiment of the present invention first classifies and merges the addresses to be read, reducing the number of addresses to be read, thereby improving the current situation in which the computer device needs to call SRAM to complete data reading for each address to be read, thereby improving the overall reading efficiency of the random access memory and reducing the power consumption of the random access memory.

[0021] In a second aspect, an embodiment of the present invention provides a data reading device, comprising:

[0022] An acquisition module, configured to acquire a data read request, wherein the data read request includes a predetermined number of first data read addresses;

[0023] A first merging module, used for merging all first data reading addresses of the same category in the data reading request into corresponding second data reading addresses;

[0024] A reading module, configured to read data corresponding to each second data reading address based on a lookup table;

[0025] The output module is used to output the data corresponding to the second data reading address to the port corresponding to the first data reading address according to the corresponding relationship between all the second data reading addresses and all the first data reading addresses.

[0026] In an implementation manner provided by an embodiment of the present invention, the first merging module further includes:

[0027] A feature selection submodule, used for selecting a predetermined field of each first data reading address as a feature address corresponding to the first data reading address;

[0028] The second merging submodule is used to merge all first data reading addresses that match the characteristic addresses in the data reading request into corresponding second data reading addresses.

[0029] In an implementation manner provided by an embodiment of the present invention, the second merging submodule is further used for:

[0030] Obtaining all first data read addresses in the data read request that are different from any other characteristic address and are not continuous with any other characteristic address as second data read addresses;

[0031] In the data read request, any two first data read addresses whose characteristic addresses are the same or whose characteristic addresses are consecutive addresses are merged into the corresponding second data read address.

[0032] In an implementation manner provided by an embodiment of the present invention, the data reading device further includes:

[0033] A judging module, used for judging whether each first data reading address in the data reading request has corresponding data output;

[0034] The secondary output module is used to output the data corresponding to the second data reading address to the port corresponding to the first data reading address again according to the corresponding relationship between all the second data reading addresses and all the first data reading addresses if no.

[0035] In a third aspect, an embodiment of the present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program runs on the processor, it executes the data reading method as described in any one of the first aspects.

[0036] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run on a processor, it executes the data reading method as described in any one of the first aspects. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solution of the present invention, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and should not be regarded as limiting the scope of protection of the present invention. In each of the drawings, similar components are numbered similarly.

[0038] Figure 1 A schematic diagram of a flow chart of a data reading method provided by an embodiment of the present invention is shown;

[0039] Figure 2 A schematic structural diagram of a data reading device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0040] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.

[0041] The components of the embodiments of the present invention generally described and shown in the drawings herein may be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0042] Hereinafter, the terms "including", "having" and their cognates, which may be used in various embodiments of the present invention, are intended only to indicate specific features, numbers, steps, operations, elements, components or combinations of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components or combinations of the foregoing items or adding the possibility of one or more features, numbers, steps, operations, elements, components or combinations of the foregoing items.

[0043] Furthermore, the terms “first”, “second”, “third”, etc. are merely used for distinguishing descriptions and are not to be understood as indicating or implying relative importance.

[0044] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present invention belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present invention.

[0045] Example 1

[0046] Reference Figure 1 , Figure 1 A schematic flow chart of a data reading method provided by an embodiment of the present invention is shown. The data reading method provided by an embodiment of the present invention includes:

[0047] S110, obtaining a data read request, wherein the data read request includes a predetermined number of first data read addresses.

[0048] It can be understood that the data reading method provided in the embodiment of the present invention can be applied to SRAM (Static Random Access Memory) and LUP (Look Up Table), that is, the computer device obtains the corresponding information from the SRAM using the data reading address in the data reading request according to the mapping relationship in the lookup table.

[0049] It is also understandable that when requesting data read from the SRAM, one request will include multiple data read addresses, and the SRAM will read the data read addresses one by one and return them to the corresponding port.

[0050] Optionally, the data read request in the embodiment of the present invention may be in any form of a data read queue, a data read linked list, a data read stack, etc., which may be specifically set / selected according to actual conditions.

[0051] S120: Combine all first data read addresses of the same category in the data read request into corresponding second data read addresses.

[0052] It is understandable that SRAM generally includes multiple BANKs, that is, a SRAM with a larger storage space is usually divided into multiple BANKs with smaller storage space. Assuming that the storage matrix of SRAM is 256 columns by 128 rows, and SRAM includes 8 BANKs, the storage space of each BANK is 32 columns by 128 rows.

[0053] It can also be understood that if the data read address is the same, the same data will be obtained after reading the address; and if the data read addresses are continuous and the continuous data read addresses are located in the same row in the SRAM, it can be known that the data corresponding to the data read address is located in the same BANK in the SRAM.

[0054] Furthermore, when multiple consecutive data read addresses read the same BANK in the SRAM, the SRAM can directly read and output the data starting from the first address of the multiple read addresses. For example, if the addresses are 0x01, 0x02, 0x03, and 0x03, the SRAM reads and outputs the data in 0x01, and then reads and outputs the data corresponding to 0x02, 0x03, and 0x03 in sequence.

[0055] Therefore, based on this address relationship, the embodiment of the present invention merges the same or continuous first data read addresses into corresponding second data read addresses, thereby reducing the need to repeatedly read the SRAM when reading data at the same or continuous data read addresses during LUP mapping, thereby improving the reading efficiency of the SRAM and reducing the power consumption of the SRAM.

[0056] S130, based on the lookup table, reading data corresponding to each second data reading address.

[0057] Therefore, after obtaining multiple merged second data read addresses through S120, the SRAM can complete data reading according to different and discontinuous second data read addresses, without the need to perform corresponding readings for each first data read. It also avoids the situation where the SRAM obtains multiple identical data when reading data according to multiple identical data read addresses.

[0058] S140 , according to the correspondence between all the second data read addresses and all the first data read addresses, output the data corresponding to the second data read addresses to the ports corresponding to the first data read addresses.

[0059] It can be understood that the data reading address includes the port information to which the read data needs to be forwarded after the data is read, which is determined by the fixed field in the data reading address.

[0060] It can also be understood that, although multiple identical or continuous addresses are merged into one address, the computer device needs to respond to each first data read address, that is, corresponding data needs to be returned for each first data read address. Therefore, after obtaining the data corresponding to the second data read address, the embodiment of the present invention forwards the data of the second data read address to the ports corresponding to each first data read address for output according to the multiple first data read addresses corresponding to the second data read address, thereby ensuring that each first data read address can be correctly responded to.

[0061] Therefore, before reading data from the memory, the embodiment of the present invention first classifies and merges the addresses to be read, reducing the number of addresses to be read, thereby improving the current situation in which the computer device needs to call SRAM to complete data reading for each address to be read, thereby improving the overall reading efficiency of the random access memory and reducing the power consumption of the random access memory.

[0062] Optionally, in an implementation manner provided in an embodiment of the present invention, S120 includes:

[0063] Selecting a predetermined field of each first data reading address as a characteristic address corresponding to the first data reading address;

[0064] In the data read request, all first data read addresses that match the characteristic addresses are combined into corresponding second data read addresses.

[0065] It is understandable that not every bit in the data read address can be used to read data in the SRAM. For example, the data read address also includes a port information field for determining the port to which the read data should be output. It may also include a check field for determining whether the data read address is reasonable.

[0066] Therefore, the embodiment of the present invention combines all the data read addresses according to the characteristic address in the data read address used to determine where the data to be read is located in the SRAM. In other words, the embodiment of the present invention combines multiple first data read addresses into second data read addresses that read the same position based on a more accurate method, which is more accurate and effective than comparing whether any two complete first data read addresses are the same or continuous.

[0067] Therefore, in an implementation manner provided in an embodiment of the present invention, S120 includes:

[0068] Obtaining all first data read addresses in the data read request that are different from any other characteristic address and are not continuous with any other characteristic address as second data read addresses;

[0069] In the data read request, any two first data read addresses whose characteristic addresses are the same or whose characteristic addresses are consecutive addresses are merged into the corresponding second data read address.

[0070] It is understandable that when the characteristic address of a first data read address is not the same as or continuous with the characteristic addresses of other first data read addresses, that is, the characteristic address of the first data read address only matches itself, the first data read address is used as a second data read address.

[0071] Exemplarily, when the characteristic addresses of multiple first data read addresses included in a data read request are the same, that is, the multiple first data read addresses read the same data, the first data read addresses with the same characteristic address are merged into a second data read address for reading data from the same position in the SRAM, that is, multiple first data read addresses correspond to one second data read address; after the SRAM completes reading the data using the second data read address, the computer device only needs to output the data of the second data read address to all ports of the multiple first data read addresses corresponding to the second data read address to complete the data reading. Thus, when there are multiple first data read addresses that need to read data in the same address, the computer device only needs to call the SRAM to complete a data read operation, and then distribute the read data to the ports corresponding to each first data read address, and no longer needs to repeatedly read the address according to the LUT, thereby reducing the power consumption of the SRAM.

[0072] Furthermore, when the characteristic addresses of multiple first data read addresses included in a data read request are continuous, such as when the characteristic addresses of four first data read addresses are 0x01, 0x02, 0x03 and 0x04, the four first data read addresses are combined into a second data read address. When the computer device calls the SRAM to read data according to the second data read address, it first reads and outputs data from the first data read address corresponding to 0x01, and then reads and outputs the data stored in the next address, the next next address, etc. of the "first data read address corresponding to 0x01" in sequence. Therefore, when there are multiple data read addresses with continuous addresses in the data read request, it only needs to call the SRAM to read the first address in the continuous addresses, and then read and output the data in the second address, the third address, etc., and it is no longer necessary to read the data according to the LUT.

[0073] It can also be understood that by merging based on characteristic addresses, it is no longer necessary to match all bits in any two first data read addresses, which reduces the load on the computer device and further improves the reading efficiency of the first data read addresses that read the same data.

[0074] In an implementation manner provided by an embodiment of the present invention, the data reading method further includes:

[0075] Determine whether each first data read address in the data read request has corresponding data output;

[0076] If not, the data corresponding to the second data read address is output to the port corresponding to the first data read address again according to the correspondence between all the second data read addresses and all the first data read addresses.

[0077] Specifically, based on this implementation, the embodiment of the present invention determines whether the SRAM returns the same amount of data as the first data read address, that is, determines whether the SRAM returns a predetermined amount of data, and if not, returns the corresponding data to the output port corresponding to each first data read address again. Thus, it is ensured that each data read address in the data read request can get the corresponding data return, avoiding the omission of data read address processing.

[0078] Example 2

[0079] Reference Figure 2 , Figure 2 FIG. 2 is a schematic diagram showing the structure of a data reading device provided by an embodiment of the present invention. The data reading device 200 provided by an embodiment of the present invention includes:

[0080] An acquisition module 210, configured to acquire a data read request, wherein the data read request includes a predetermined number of first data read addresses;

[0081] A first merging module 220, configured to merge all first data read addresses of the same category in the data read request into corresponding second data read addresses;

[0082] A reading module 230, configured to read data corresponding to each second data reading address based on a lookup table;

[0083] The output module 240 is used to output the data corresponding to the second data read address to the port corresponding to the first data read address according to the corresponding relationship between all the second data read addresses and all the first data read addresses.

[0084] In an implementation manner provided by an embodiment of the present invention, the first merging module 220 further includes:

[0085] A feature selection submodule, used for selecting a predetermined field of each first data reading address as a feature address corresponding to the first data reading address;

[0086] The second merging submodule is used to merge all first data reading addresses that match the characteristic addresses in the data reading request into corresponding second data reading addresses.

[0087] In an implementation manner provided by an embodiment of the present invention, the second merging submodule is further used for:

[0088] Obtaining all first data read addresses in the data read request that are different from any other characteristic address and are not continuous with any other characteristic address as second data read addresses;

[0089] In the data read request, any two first data read addresses whose characteristic addresses are the same or whose characteristic addresses are consecutive addresses are merged into the corresponding second data read address.

[0090] In an implementation manner provided by an embodiment of the present invention, the data reading device 200 further includes:

[0091] A judging module, used for judging whether each first data reading address in the data reading request has corresponding data output;

[0092] The secondary output module is used to output the data corresponding to the second data reading address to the port corresponding to the first data reading address again according to the corresponding relationship between all the second data reading addresses and all the first data reading addresses if no.

[0093] It can be understood that the technical solution of the data reading device disclosed in Example 1 of the present invention is used to execute the data reading method disclosed in Example 1 through the synergistic effect of various functional modules. The implementation scheme and beneficial effects involved in the data reading method are also applicable in this embodiment and will not be repeated here.

[0094] An embodiment of the present invention further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program runs on the processor, it executes any data reading method as described in Embodiment 1.

[0095] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run on a processor, the data reading method as described in any one of the first embodiments is executed.

[0096] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and a part of the module, program segment or code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in an alternative implementation, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or the flow diagram, and the combination of boxes in the structure diagram and / or the flow diagram, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0097] In addition, the functional modules or units in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.

[0098] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0099] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.

Claims

1. A data reading method, characterized in that: include: Obtaining a data read request, wherein the data read request includes a predetermined number of first data read addresses; combining all the first data read addresses of the same category in the data read request into corresponding second data read addresses, wherein the same category is used to indicate that the data read addresses are the same or the data read addresses are continuous; Based on the lookup table, reading the data corresponding to each of the second data reading addresses; According to the correspondence between all the second data reading addresses and all the first data reading addresses, outputting the data corresponding to the second data reading addresses to the ports corresponding to the first data reading addresses; The step of merging all the first data read addresses of the same category in the data read request into corresponding second data read addresses includes: selecting a predetermined field of each of the first data reading addresses as a characteristic address corresponding to the first data reading address; Merging all the first data reading addresses matched by the characteristic addresses in the data reading request into corresponding second data reading addresses; The step of merging all the first data reading addresses matched by the characteristic addresses in the data reading request into corresponding second data reading addresses includes: All first data reading addresses in the data read request that are different from any other characteristic address and discontinuous with any other characteristic address are used as second data reading addresses; In the data read request, any two of the first data read addresses whose characteristic addresses are the same or whose characteristic addresses are consecutive addresses are combined into a corresponding second data read address.

2. The method according to claim 1, characterized in that The method further comprises: Determine whether each of the first data read addresses in the data read request has corresponding data output; If not, the data corresponding to the second data read address is output to the port corresponding to the first data read address again according to the correspondence between all the second data read addresses and all the first data read addresses.

3. A data reading device, characterized in that: include: An acquisition module, configured to acquire a data read request, wherein the data read request includes a predetermined number of first data read addresses; A first merging module, configured to merge all the first data reading addresses of the same category in the data reading request into corresponding second data reading addresses; A reading module, configured to read data corresponding to each of the second data reading addresses based on a lookup table; an output module, configured to output data corresponding to the second data reading address to a port corresponding to the first data reading address according to a correspondence between all the second data reading addresses and all the first data reading addresses; The first merging module also includes a feature selection submodule and a second merging submodule; The feature selection submodule is used to select a predetermined field of each first data reading address as a feature address corresponding to the first data reading address; The second merging submodule is used to merge the first data reading addresses that match all the characteristic addresses in the data reading request into corresponding second data reading addresses; The second merging submodule is further configured to use, in the data read request, all first data read addresses that are different from any other characteristic address and are not continuous with any other characteristic address as second data read addresses; In the data read request, any two of the first data read addresses whose characteristic addresses are the same or whose characteristic addresses are consecutive addresses are combined into a corresponding second data read address.

4. The device according to claim 3, characterized in that The device also includes: A judging module, used for judging whether each of the first data reading addresses in the data reading request has corresponding data output; The secondary output module is used for, if not, outputting the data corresponding to the second data read address to the port corresponding to the first data read address again according to the correspondence between all the second data read addresses and all the first data read addresses.

5. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is run on the processor, the data reading method according to claim 1 or 2 is executed.

6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is run on a processor, the data reading method according to claim 1 or 2 is executed.

Citation Information

Patent Citations

  • Memory control device, memory device, and memory control method

    CN101495975A

  • Rearrangement method and device of reference frame data reading instructions

    CN105681789A