Data reading method and device, equipment and storage medium
By allocating address ranges to store data in the order of tag information during DMA transmission between FPGA and host, and reading the data after it is completely received, the data disorder problem is solved and orderly storage and reading of data are achieved.
Patent Information
- Application Number
- CN202510700121.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-28
- Publication Date
- 2025-09-19
AI Technical Summary
During DMA transmission between FPGA and host, the multi-burst transmission design leads to data disorder problem.
In response to data reception, data is stored in the target address range of the target read request, addresses are allocated in the order of tag information in the read request, and when data reception is complete and data in the previous address has been read, data is read and sent.
The sequential arrangement and reading of data are realized, ensuring the orderliness and integrity of data transmission.
Smart Images

Figure CN120669907A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data transmission technology, and in particular to a data reading method, device, equipment and storage medium. Background Art
[0002] The PCIe (Peripheral Component Interconnect Express) protocol is widely used for data transmission between FPGAs (Field Programmable Gate Arrays) and hosts due to its high bandwidth, low latency, and flexible point-to-point communication. Through the PCIe interface, FPGAs can directly access host memory using DMA transfers, achieving efficient data exchange. However, during DMA transfers, the multi-burst design significantly improves transmission efficiency but also introduces the problem of data out-of-order. Summary of the Invention
[0003] In view of this, the present invention provides a data reading method, apparatus, device and storage medium to solve the problem of disordered data transmission.
[0004] In a first aspect, the present invention provides a data reading method, the method comprising:
[0005] In response to receiving the data, storing the data in a target address range corresponding to the target read request, wherein the target address range of the target read request is allocated according to the order of tag information in the read request;
[0006] If the data corresponding to the target read request is completely received and the data stored in the address before the target address range has been read, the data in the target address range is read and sent.
[0007] In an optional implementation, storing the data in a target address range corresponding to the target read request includes:
[0008] Determine the starting address of the target address range based on the tag information in the response packet containing the data, where the tag information in the response packet containing the data is consistent with the tag information in the target read request;
[0009] Determine the storage address corresponding to the data based on the starting address and the number of remaining bytes corresponding to the target read request;
[0010] Based on the storage address, the data is stored in the target address range.
[0011] In an optional implementation, determining the storage address corresponding to the data based on the starting address and the number of remaining bytes corresponding to the target read request includes:
[0012] Determine the number of completed bytes of the target read request based on the number of remaining bytes and the total number of bytes corresponding to the target read request;
[0013] Based on the starting address and the number of completed bytes, determine the storage address corresponding to the data.
[0014] In an optional implementation, storing data in a target address range based on the storage address includes:
[0015] If the target read request contains data to be stored, the data to be stored is concatenated with the first data and split based on a preset data bit width to obtain at least one segment of target storage data;
[0016] Determine a target address corresponding to at least one segment of target storage data based on the storage address and the splitting order;
[0017] storing the target storage data whose bytes reach the preset data bit width in at least one segment of target storage data in the target address range in sequence according to the corresponding target addresses;
[0018] The target storage data whose byte number does not reach the preset data bit width in at least one segment of the target storage data is used as the data to be stored.
[0019] In an optional implementation, storing the data in the target address range based on the storage address further includes:
[0020] If the target read request does not contain the data to be stored, splitting the second data based on the preset data bit width to obtain at least one segment of target storage data;
[0021] Determine a target address corresponding to at least one segment of target storage data based on the storage address and the splitting order;
[0022] storing the target storage data whose bytes reach the preset data bit width in at least one segment of target storage data in the target address range in sequence according to the corresponding target addresses;
[0023] The target storage data whose byte number does not reach the preset data bit width in at least one segment of the target storage data is used as the data to be stored.
[0024] In an optional implementation, storing the data in the target address range based on the storage address further includes:
[0025] If, in at least one segment of target storage data, the number of bytes does not reach the preset data bit width, the target address corresponding to the target storage data is the end address of the target address range, and the remaining number of bytes is consistent with the number of bytes of the received data, the target storage data is stored in the corresponding target address, and it is determined that the data corresponding to the target read request is completely received.
[0026] In an optional embodiment, the method further includes:
[0027] Determine a buffer size based on a set maximum read request and the number of tag information, and allocate block memory to the buffer;
[0028] Determine the address offset corresponding to the tag information based on the preset data bit width and the maximum read request;
[0029] Based on the address offset, the starting address corresponding to each tag information is determined.
[0030] In a second aspect, the present invention provides a data reading device, the device comprising:
[0031] a data storage module, configured to store the data into a target address range of a corresponding target read request in response to receiving the data, wherein the target address range of the target read request is allocated according to the order of tag information in the read request;
[0032] The data reading module is configured to read and send the data in the target address range if the data corresponding to the target read request is completely received and the data stored in the address before the target address range has been read.
[0033] In a third aspect, the present invention provides a computer device comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the data reading method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0034] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the data reading method of the first aspect or any corresponding embodiment thereof.
[0035] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the data reading method of the first aspect or any corresponding embodiment thereof.
[0036] The data reading method provided by an embodiment of the present invention stores the received data in the corresponding target address range according to its corresponding target read request, thereby storing the data corresponding to each read request in the order of the tag information in the read request, thereby realizing sequential arrangement of the data; at the same time, when the data corresponding to the target read request is completely received and the data stored in the address before the target address range has been read, the data corresponding to the target read request in the target address range is read and sent, thereby realizing sequential reading of the data. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0038] Figure 1 is a flow chart of a data reading method according to an embodiment of the present invention;
[0039] Figure 2 is a schematic diagram of a buffer area of a data reading method according to an embodiment of the present invention;
[0040] Figure 3 is a flow chart of another data reading method according to an embodiment of the present invention;
[0041] Figure 4 is a structural block diagram of a data reading device according to an embodiment of the present invention;
[0042] Figure 5 Schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0043] To make the purpose, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative efforts shall fall within the scope of protection of the present invention.
[0044] The PCIe (Peripheral Component Interconnect Express) protocol is widely used for data transmission between FPGAs and hosts due to its high bandwidth, low latency, and flexible point-to-point communication. Through the PCIe interface, FPGAs can directly access host memory using DMA transfers, achieving efficient data exchange. However, during DMA transfers, while the multi-burst transfer design significantly improves transmission efficiency, it also introduces the problem of data out-of-order.
[0045] Based on this, an embodiment of the present invention provides a data reading method, which includes: in response to receiving data, storing the data in a target address range corresponding to a target read request, wherein the target address range of the target read request is allocated according to the order of tag information in the read request; if the data corresponding to the target read request is completely received and the data stored in the address before the target address range has been read, then reading and sending the data in the target address range. In this way, the received data is stored in the corresponding target address range according to its corresponding target read request, so that the data corresponding to each read request is stored in the order of tag information in the read request, thereby achieving sequential arrangement of the data; at the same time, when the data corresponding to the target read request is completely received and the data stored in the address before the target address range has been read, the data corresponding to the target read request in the target address range is read and sent, thereby achieving sequential reading of the data.
[0046] According to an embodiment of the present invention, an embodiment of a data reading method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0047] In this embodiment, a data reading method is provided, which can be used for data transmission between FPGA and host. Figure 1 is a flow chart of a data reading method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0048] Step S101 , in response to receiving data, storing the data in a target address range corresponding to a target read request.
[0049] In an embodiment of the present invention, the tag information is a field in a read request that is used to uniquely identify an unfinished request and to match a request with a response. The tag information may be a tag field in a request header of the read request. The tag field is generated by the request initiator. The length of the tag field is determined by the device capability of the request initiator. The number of tag fields and the length of the tag field are in an exponential relationship. For example, if the length of the tag field is 8 bits, the number of tag fields is 256.
[0050] In this embodiment of the present invention, the target address range of a target read request is allocated based on the order of the tag information in the read request. Each read request is allocated a corresponding address range in the buffer in order of the tag information size. The allocated address range is used to temporarily store the read data after the read request is completed.
[0051] In an optional implementation, in order to ensure that the data of each read request can be stored sequentially in the corresponding address range, a buffer is also required to be set up, and a corresponding address range is allocated to each tag information in the buffer. Specifically, first, based on the set maximum read request and the number of tag information, the buffer size is determined, and block memory (bram) is allocated to the buffer; wherein, the maximum read request is MRRS (Max Read Request Size), which is the set maximum byte size that can be requested to be read from the receiving end at one time, which is used to limit the size of the address range corresponding to a tag information or a read request; the maximum read request is multiplied by the number of tag information to obtain the size of the buffer, and based on the size of the buffer, the number of block memories to be allocated is determined, and the corresponding number of block memories is allocated to the buffer. Then, based on the preset data bit width and the maximum read request, the address offset corresponding to the tag information is determined, and based on the address offset, the starting address corresponding to each tag information is determined; wherein, the preset data bit width indicates the data length corresponding to an address, that is, the data length that can be stored at the address, and the maximum read request is divided by the preset data bit width to obtain the address offset; for the first tag information, its corresponding starting address is 0, and the address offset is added to the starting address corresponding to the first tag information to obtain the starting address corresponding to the second tag information, thereby accumulating and calculating to obtain the starting address corresponding to each tag information in turn; accordingly, the address range between the starting address corresponding to one tag information and the starting address corresponding to the next tag information is the address range corresponding to the tag information.
[0052] For example, Figure 2 is a schematic diagram of a buffer area of a data reading method according to an embodiment of the present invention, such as Figure 2 As shown in the figure, the maximum read request MRRS is set to 512B, and the number of tag information is 256. Then the buffer size is buffer size = 256 × 512B = 32 × 4kB. Therefore, 32 block memories need to be allocated as data cache space, which is specifically reflected in Figure 2 There are 32 rectangles representing block memories in the image. Assuming the data width is 512 bits, the starting address for the first tag is 0, the second is 8, the third is 16, and so on. The starting address for the nth tag is 8*(n-1). Consequently, the address range for the nth tag is 8*(n-1) to 8n-1.
[0053] Step S102 : If the data corresponding to the target read request is completely received and the data stored in the address before the target address range has been read, then the data in the target address range is read and sent.
[0054] In an embodiment of the present invention, the data of a read / write request is not received all at once, but may be received multiple times in multiple response packets, and the multiple response packets may not be received continuously. Therefore, in order to ensure that the data can be read out sequentially, the data corresponding to the target read request is received completely, that is, all the response packets corresponding to the target read request are received and the data are stored in the target address range, and the data stored in the address before the target address range has been read, that is, the data corresponding to the read request with tag information before the target read request has been read, then the data in the target address range is read and sent. Thus, on the one hand, it is ensured that the data corresponding to the read request has been completely received when it is read, so as to ensure that the corresponding data can be read out completely, avoiding the data corresponding to the read request that has been responded to being read again when the data corresponding to other subsequent read requests are read. On the other hand, it is ensured that the data corresponding to the read request corresponding to the previous tag information is read after the data corresponding to the read request corresponding to the subsequent tag information is read. Thus, sequential reading of data is achieved through the above two aspects.
[0055] The data reading method provided in this embodiment stores the received data in the corresponding target address range according to its corresponding target read request, so that the data corresponding to each read request is stored in the order of the tag information in the read request, thereby realizing sequential arrangement of the data; at the same time, when the data corresponding to the target read request is completely received and the data stored in the address before the target address range has been read, the data corresponding to the target read request in the target address range is read and sent, thereby realizing sequential reading of the data.
[0056] In this embodiment, a data reading method is provided, which can be used for data transmission between FPGA and host. Figure 3 is a flow chart of another data reading method according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:
[0057] Step S301 : In response to receiving data, storing the data in a target address range corresponding to a target read request.
[0058] Specifically, step S301 includes:
[0059] Step S3011: Determine the starting address of the target address range based on the tag information in the response packet containing the data.
[0060] In an embodiment of the present invention, the response packet also includes tag information, and is consistent with the tag information in the corresponding read request, that is, the tag information in the response packet where the data is located is consistent with the tag information in the target read request. Therefore, the address range corresponding to the tag information in the response packet where the data is located can be used as the target address, and the starting address corresponding to the tag information in the response packet where the data is located can be used as the starting address of the target address range.
[0061] Step S3012: Determine the storage address corresponding to the data based on the starting address and the number of remaining bytes corresponding to the target read request.
[0062] In this embodiment of the present invention, the Byte Count field included in the response packet header indicates the number of remaining bytes corresponding to the target read request, that is, the number of bytes of unreceived data remaining in the target read request. Based on the remaining bytes corresponding to the target read request, the address offset of the currently received data within the target address range is determined. Combined with the starting address, the storage address corresponding to the currently received data is obtained.
[0063] In an optional embodiment, the storage address corresponding to the data can be determined by the following method: based on the number of remaining bytes and the total number of bytes corresponding to the target read request, the number of completed bytes of the target read request is determined; specifically, the total number of bytes is subtracted from the number of remaining bytes to obtain the number of completed bytes. Based on the starting address and the number of completed bytes, the storage address corresponding to the data is determined; specifically, the number of completed bytes is divided by the preset data bit width to obtain an address offset, and the address offset is added to the starting address to obtain the storage address. Optionally, the storage address corresponding to the currently received data can be obtained by adding one to the storage address last used when the target read request last stored the received data.
[0064] Step S3013: based on the storage address, store the data into the target address range.
[0065] In the embodiment of the present invention, data is stored in a target address range in sequence based on the storage address.
[0066] In an optional embodiment, the data storage process is different depending on whether there is data to be stored in the target read request; wherein the data to be stored is temporarily retained because the data is not enough to fill the storage space corresponding to an address. Specifically, it is divided into the following cases:
[0067] In the first case, if the target read request has data to be stored, the following process is executed:
[0068] Step a1: If the target read request contains data to be stored, the data to be stored is concatenated with the first data and split based on a preset data bit width to obtain at least one segment of target storage data.
[0069] In step a1, if the target read request contains data to be stored, the data to be stored is first concatenated with the first data, so that when the data to be stored and the first data can fully fill the storage space corresponding to one address, the data to be stored is stored in the target address range. After the data to be stored is concatenated with the first data, it is split based on a preset data bit width to obtain at least one segment of target storage data, thereby splitting the data into data segments that can fully fill the storage space corresponding to one address, so as to facilitate data storage.
[0070] Step a2: determining a target address corresponding to at least one segment of target storage data based on the storage address and the splitting order.
[0071] In step a2, the target addresses corresponding to at least one segment of target storage data are accumulated based on the splitting order. For example, if the storage address is a, the target address corresponding to the first segment of target storage data is a, the target address corresponding to the second segment of target storage data is a+1, ..., and the target address corresponding to the nth segment of target storage data is a+n-1.
[0072] Step a3: storing the target storage data whose byte number reaches the preset data bit width in at least one segment of target storage data into the target address range in sequence according to the corresponding target address.
[0073] In step a3, in at least one segment of target storage data, the target storage data whose byte number reaches the preset data bit width is a data segment that can fill the storage space corresponding to an address, so these data segments are stored in the target address range in sequence according to the corresponding target address.
[0074] Step a4: taking the target storage data in which the number of bytes does not reach the preset data bit width in at least one segment of the target storage data as the data to be stored.
[0075] In step a4, in at least one segment of target storage data, the target storage data whose number of bytes does not reach the preset data bit width is a data segment that cannot fill the storage space corresponding to one address. It is the last segment of target storage data in at least one segment of target storage data. Therefore, it is used as the data to be stored and is spliced with the subsequently received data to form a data segment that can fill the storage space corresponding to one address before being stored.
[0076] In an optional embodiment, if the total number of bytes of the data to be stored and the first data does not reach the preset data bit width, that is, the data after the data to be stored and the first data are spliced is split, and only a segment of target storage data with a byte number that does not reach the preset data bit width can be obtained, then the first data is directly added to the data to be stored.
[0077] In the second case, if the target read request does not contain any data to be stored, the following process is executed:
[0078] Step b1: If the target read request does not contain the data to be stored, the second data is split based on the preset data bit width to obtain at least one segment of target storage data.
[0079] In step b1, if the target read request does not contain data to be stored, the second data is directly split based on the preset data bit width to obtain at least one segment of target storage data, thereby splitting the data into data segments that can fill the storage space corresponding to an address to facilitate data storage.
[0080] Step b2: Determine the target address corresponding to at least one segment of target storage data based on the storage address and the splitting order. Please refer to step a2 for details and will not be repeated here.
[0081] Step b3: Store the target storage data of at least one segment of target storage data whose bytes reach the preset data bit width into the target address range according to the corresponding target address. Please refer to step a5 for details and will not be repeated here.
[0082] Step b4: The target storage data of at least one segment of the target storage data, the number of bytes of which does not reach the preset data bit width, is used as the data to be stored. Please refer to step a4 for details and will not be repeated here.
[0083] In an optional embodiment, in the above steps a4 and b4, if the number of bytes in at least one segment of target storage data does not reach the preset data bit width, the target address corresponding to the target storage data is the end address of the target address range, and the remaining number of bytes is consistent with the number of bytes of the received data, then it indicates that the currently received data is the last segment of data corresponding to the target read request, and no data corresponding to the target read request will be stored in the target address range subsequently. Therefore, the target storage data is stored in the corresponding target address, and it is determined that the data corresponding to the target read request is completely received; wherein, a flag bit can be used to mark whether the data corresponding to the target read request is completely received. When the flag bit is a first preset value, it indicates that the data corresponding to the target read request is completely received. When the flag bit is a second preset value, it indicates that the data corresponding to the target read request is not completely received.
[0084] Step S302: If the data corresponding to the target read request has been received completely and the data stored in the address before the target address range has been read, then the data in the target address range is read and sent. Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.
[0085] The data extraction method provided by an embodiment of the present invention splits the received data into data segments that can fill the storage space corresponding to an address, and fills the addresses in the target address range in sequence until all the data corresponding to the target read reception request are stored in the target address range, and marks the data corresponding to the target read request as completely received, so that the data can be read and sent after all the data is received to ensure that the data reading can be carried out in sequence.
[0086] In this embodiment, a data reading device is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments. The details already described will not be repeated here. As used below, the term "module" can mean a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.
[0087] This embodiment provides a data reading device, such as Figure 4 Shown, including:
[0088] A data storage module 401 is configured to store the data into a target address range of a corresponding target read request in response to receiving the data, wherein the target address range of the target read request is allocated according to the order of tag information in the read request;
[0089] The data reading module 402 is configured to read and send the data in the target address range if the data corresponding to the target read request has been completely received and the data stored in the addresses before the target address range has been read.
[0090] In an optional embodiment, the data storage module 401 includes:
[0091] a starting address determining unit, configured to determine a starting address of a target address range based on tag information in a response packet containing data, wherein the tag information in the response packet containing data is consistent with the tag information in the target read request;
[0092] a storage address determining unit, configured to determine a storage address corresponding to the data based on the starting address and the number of remaining bytes corresponding to the target read request;
[0093] The data storage unit is used to store data into a target address range based on the storage address.
[0094] In an optional implementation, the storage address determining unit includes:
[0095] a completed byte number determination subunit, configured to determine the completed byte number of the target read request based on the remaining byte number and the total byte number corresponding to the target read request;
[0096] The storage address determination subunit is used to determine the storage address corresponding to the data based on the starting address and the number of completed bytes.
[0097] In an optional embodiment, the data storage unit includes:
[0098] a data splitting subunit, configured to, if the target read request contains data to be stored, concatenate the data to be stored with the first data, and split the data based on a preset data bit width to obtain at least one segment of target storage data;
[0099] a target address determination subunit, configured to determine a target address corresponding to at least one segment of target storage data based on the storage address and the splitting order;
[0100] The data storage subunit is used to store the target storage data whose bytes reach the preset data bit width in at least one segment of target storage data in a target address range according to the corresponding target address;
[0101] The data to-be-stored subunit is configured to take, in at least one segment of target storage data, target storage data whose byte number does not reach a preset data bit width, as data to-be-stored.
[0102] In an optional embodiment, the data storage unit further includes:
[0103] The data splitting subunit is further configured to split the second data based on a preset data bit width to obtain at least one segment of target storage data if the target read request does not contain the data to be stored;
[0104] The data storage subunit is further used as a target address determination subunit, and is further used to determine a target address corresponding to at least one segment of target storage data based on the storage address and the splitting order;
[0105] storing the target storage data whose bytes reach the preset data bit width in at least one segment of target storage data in the target address range in sequence according to the corresponding target addresses;
[0106] The data to be stored subunit is further used to take the target storage data whose byte number does not reach the preset data bit width in at least one segment of target storage data as the data to be stored.
[0107] In an optional embodiment, the data storage unit further includes:
[0108] The data storage subunit is also used to store the target storage data in the corresponding target address if the number of bytes in at least one segment of target storage data does not reach the preset data bit width, the target address corresponding to the target storage data is the end address of the target address range, and the remaining number of bytes is consistent with the number of bytes of the received data, and determine that the data corresponding to the target read request is completely received.
[0109] In an optional embodiment, the device further comprises:
[0110] A memory allocation module, configured to determine a buffer size based on a set maximum read request and a quantity of tag information, and allocate block memory to the buffer;
[0111] An address offset determination module, configured to determine an address offset corresponding to the tag information based on a preset data bit width and a maximum read request;
[0112] The starting address determination module is used to determine the starting address corresponding to each tag information based on the address offset.
[0113] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0114] The data reading device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0115] The embodiment of the present invention also provides a computer device having the above Figure 4 The data reading device shown.
[0116] See also Figure 5 , Figure 5 is a structural diagram of a computer device provided by an optional embodiment of the present invention, such as Figure 5As shown, the computer device includes: one or more processors 10, memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components utilize different buses to communicate with each other and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in the memory or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Equally, multiple computer devices can be connected, and each device provides part of the necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 5 A processor 10 is taken as an example.
[0117] The processor 10 may be a central processing unit, a network processor, or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic, or any combination thereof.
[0118] The memory 20 stores instructions that can be executed by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0119] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created based on the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0120] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid-state drive; the memory 20 may also include a combination of the above types of memory.
[0121] The computer device further includes a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0122] The embodiment of the present invention also provides a computer-readable storage medium. The above-mentioned method according to the embodiment of the present invention can be implemented in hardware, firmware, or implemented as a computer code that can be recorded in a storage medium, or implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and downloaded through a network and will be stored in a local storage medium, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor or hardware, the method shown in the above embodiment is implemented.
[0123] A portion of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the form in which the computer program instruction exists in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc. Accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium that can be accessed by the computer.
[0124] Although the embodiments of the present invention have been described with reference to the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations shall all fall within the scope defined by the present invention.
Claims
1. A data reading method, characterized in that: The method comprises: In response to receiving the data, storing the data in a target address range corresponding to the target read request, wherein the target address range of the target read request is allocated according to the order of tag information in the read request; If the data corresponding to the target read request has been completely received and the data stored in the addresses before the target address range has been read, the data in the target address range is read and sent.
2. The method according to claim 1, characterized in that The storing of the data into the target address range of the corresponding target read request includes: Determining the starting address of the target address range based on tag information in the response packet containing the data, wherein the tag information in the response packet containing the data is consistent with the tag information in the target read request; Determining a storage address corresponding to the data based on the starting address and the number of remaining bytes corresponding to the target read request; Based on the storage address, data is stored in the target address range.
3. The method according to claim 2, characterized in that The determining, based on the starting address and the number of remaining bytes corresponding to the target read request, a storage address corresponding to the data includes: Determining the number of completed bytes of the target read request based on the number of remaining bytes and the total number of bytes corresponding to the target read request; Based on the starting address and the number of completed bytes, a storage address corresponding to the data is determined.
4. The method according to claim 2, characterized in that The storing the data in the target address range based on the storage address includes: If the target read request contains data to be stored, the data to be stored is concatenated with the first data, and split based on a preset data bit width to obtain at least one segment of target storage data; Determining a target address corresponding to the at least one segment of target storage data based on the storage address and the splitting order; storing the target storage data whose bytes reach the preset data bit width in the at least one segment of target storage data in the target address range in sequence according to the corresponding target addresses; The target storage data whose byte number does not reach the preset data bit width in the at least one segment of target storage data is used as the data to be stored.
5. The method according to claim 4, characterized in that The storing the data into the target address range based on the storage address further includes: If the target read request does not contain any data to be stored, splitting the second data based on the preset data bit width to obtain at least one segment of target storage data; Determining a target address corresponding to the at least one segment of target storage data based on the storage address and the splitting order; storing the target storage data whose bytes reach the preset data bit width in the at least one segment of target storage data in the target address range in sequence according to the corresponding target addresses; The target storage data whose byte number does not reach the preset data bit width in the at least one segment of target storage data is used as the data to be stored.
6. The method according to claim 4 or 5, characterized in that The storing the data into the target address range based on the storage address further includes: If, in at least one segment of target storage data, the number of bytes does not reach the preset data bit width, the target address corresponding to the target storage data is the end address of the target address range, and the remaining number of bytes is consistent with the number of bytes of the received data, then the target storage data is stored in the corresponding target address, and it is determined that the data corresponding to the target read request is completely received.
7. The method according to claim 1, characterized in that The method further comprises: Determine a buffer size based on a set maximum read request and the amount of tag information, and allocate a block memory to the buffer; Determining an address offset corresponding to the tag information based on a preset data bit width and the maximum read request; Based on the address offset, a starting address corresponding to each piece of tag information is determined.
8. A data reading device, characterized in that: The device comprises: a data storage module, configured to store the data into a target address range of a corresponding target read request in response to receiving the data, wherein the target address range of the target read request is allocated according to the order of tag information in the read request; The data reading module is configured to read and send the data in the target address range if the data corresponding to the target read request is completely received and the data stored in the address before the target address range has been read.
9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the data reading method according to any one of claims 1 to 7 by executing the computer instructions.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the data reading method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method and system for orderly storing CPLD data packets
CN105260332A
Data reading management method and device used for PCIe (Peripheral Component Interface Express) equipment
CN107766270A
Memory controller for transmitting decrement andincrement burst and the decrement and increment bursttransmitting method thereof
KR1020070013163A