Data processing method and device, electronic equipment and storage medium
By converting the format of the processing request to adapt to the data length of different hardware, the problem of low data processing efficiency between different hardware in the existing technology is solved, and efficient data processing between different hardware is realized.
Patent Information
- Application Number
- CN202310898226.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-20
- Publication Date
- 2025-01-21
- Estimated Expiration
- 2043-07-20
AI Technical Summary
The prior art is difficult to efficiently switch computing tasks between different hardware, mainly due to differences in data format requirements, which leads to gaps within or between data, affecting processing efficiency.
Provide a data processing method and device, by converting the address and size in the request message received from the first device into the data length adapted to the second device, and converting the format of the request message so that it can be easily transferred between different hardware switch.
By format conversion of processing requests, efficient data processing between different hardware is achieved, improving overall processing efficiency.
Smart Images

Figure CN119336824A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of data processing technology, and more specifically, to a data processing method, a data processing device, an electronic device, and a storage medium. Background Art
[0002] For different operators such as convolutional neural networks (CNN) and matrix multiplication (Mat Mul), the implementation methods of various existing computing devices, coprocessors, accelerators, etc. are different. Different hardware has different granularity for reading and writing data, which may cause gaps within or between data. For example, some computing devices can read and write data by bytes, and the data can be arranged tightly, but for some external accelerators (for example, open source neural network accelerators), the starting address of each row of data must be aligned according to a specific data length (for example, 32 bytes), so that there may be gaps between each row of data. These different data format requirements make it difficult to switch computing tasks between different hardware. Summary of the invention
[0003] This summary is provided to introduce concepts in a brief form that will be described in detail in the detailed description below. This summary is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0004] At least one embodiment of the present disclosure provides a data processing method, including: receiving a first request message from a first device, wherein the first request message includes a first address aligned according to a first data length and a first size in units of the first data length; converting the first address into a second address aligned according to a second data length, wherein the second data length is greater than the first data length; converting the first size into a second size in units of the second data length; and sending a second request message to a second device, wherein the second request message includes the second address and the second size.
[0005] At least one embodiment of the present disclosure provides a data processing device, including: a first interface, used to receive a first request message from a first device, wherein the first request message includes a first address aligned according to a first data length and a first size in units of the first data length; a first conversion module, used to convert the first address into a second address aligned according to a second data length, wherein the second data length is greater than the first data length; a second conversion module, used to convert the first size into a second size in units of the second data length; and a second interface, used to send a second request message to a second device, wherein the second request message includes the second address and the second size.
[0006] At least one embodiment of the present disclosure provides a data processing device, including: at least one processor; and a storage device, on which at least one program is stored, when the at least one program is executed by the at least one processor, the at least one processor implements any data processing method according to the embodiment of the present disclosure.
[0007] At least one embodiment of the present disclosure provides an electronic device, including any data processing device according to the embodiments of the present disclosure.
[0008] At least one embodiment of the present disclosure provides a non-transitory storage medium containing computer-executable instructions, wherein the computer-executable instructions are used to perform any data processing method according to the embodiments of the present disclosure when executed by a computer processor.
[0009] The data processing method provided by the embodiment of the present disclosure converts the format of processing requests (eg, read / write requests) so that the processing requests can be easily switched between different hardware, thereby improving the overall processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0011] Figure 1 A schematic diagram of the architecture of a non-aligned direct memory access translator (UDMAC) according to at least one embodiment of the present disclosure is shown;
[0012] Figure 2 A flowchart showing an example data processing method according to at least one embodiment of the present disclosure is shown;
[0013] Figure 3 A schematic diagram showing an exemplary processing flow of an exemplary data processing method according to at least one embodiment of the present disclosure is shown;
[0014] Figure 4 Another exemplary processing flow diagram of an exemplary data processing method according to at least one embodiment of the present disclosure is shown;
[0015] Figure 5 A schematic diagram of a data processing device according to at least one embodiment of the present disclosure is shown;
[0016] Figure 6 A schematic diagram showing another data processing device according to at least one embodiment of the present disclosure; and
[0017] Figure 7 An exemplary structural diagram of an electronic device suitable for implementing at least one embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0018] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0019] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0020] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0021] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0022] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0023] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0024] As mentioned above, the interfaces of some neural network accelerators (e.g., Deep Learning Accelerator (DLA)) require that the processed address (addr) and size (size) must be an integer multiple of a specific data length (e.g., 32 bytes), and that the starting address of each row of data must be aligned according to the specific data length. Therefore, it is impossible to directly read tightly arranged (e.g., aligned per byte) data processed by some specific computing devices.
[0025] The embodiments of the present disclosure provide an unaligned direct memory access converter (UDMAC) to support the conversion of aligned and unaligned data. UDMAC can convert unaligned read and write requests into aligned formats to support operations, commands or requests (e.g., read and write requests) in unaligned formats, so that DLA can directly read data that is tightly arranged in memory.
[0026] In this document, "aligned data" may also refer to data whose address and size are aligned according to the second data length. In some embodiments, the second data length may be greater than 2 of the first data length. N Bytes, where N is an integer greater than or equal to 1. For example, the second data length may be 32 bytes, 64 bytes, etc. Correspondingly, data whose address and size are not aligned according to the second data length is "unaligned data". For example, data whose address and size are aligned according to a first data length that is less than the second data length may be called "unaligned data". In some embodiments, the first data length may be 2 X Byte, where X is an integer greater than or equal to 0. For example, the first data length can be 1 byte, 2 bytes, etc. In the following, an exemplary description is given with the first data length being 1 byte and the second data length being 32 bytes. In addition, in this document, "byte" is used as the basic unit of data for exemplary description, however, in some embodiments, other data units such as "bit" and "half byte" may also be used for description, which is not limited herein.
[0027] Next, Figure 1 A schematic diagram of the architecture of a non-aligned direct memory access translator (UDMAC) according to at least one embodiment of the present disclosure is shown.
[0028] like Figure 1As described, according to at least one embodiment of the present disclosure, UDMAC 102 can be located between the first device 101 and the second device 103, and can be communicatively connected to the first device 101 and the second device 103 respectively. For example, the communication connection can be based on a bus protocol and the bus width (e.g., 16 bytes, 32 bytes, etc.) can be selected as needed. The bus can be an intra-chip bus (e.g., AXI) or an inter-chip bus (e.g., PCIE), and the embodiments of the present disclosure are not limited to this.
[0029] The first device 101 may be a computing device that arranges and processes data according to a first data length (e.g., 1 byte), and the embodiments of the present disclosure are not limited to this. For example, the computing device may be a processor based on any instruction set (e.g., X86, RISC-V, or ARM instruction set), and may be a single-core or multi-core processor, etc. For example, in some embodiments, the first device 101 may further refer to an interface device of a computing device that arranges and processes data according to a first data length, such as a DMA interface device of the computing device. The UDMAC 102 may receive a first request message 104 aligned according to the first data length from the first device 101.
[0030] The first request message 104 may be or may include one or more of a first write request message (or write command), a first read request message (or read command), etc. It should be understood that in other implementations, the first request message may also be any other request such as a data transmission request.
[0031] The second device 103 may be a device that arranges and processes data according to the second data length (e.g., 32 bytes), and the embodiments of the present disclosure are not limited to this. For example, the second device is provided in the form of a coprocessor. For example, in some embodiments, the second device 103 may further refer to an interface device of a device that arranges and processes data according to the second data length, such as a data bus interface device of the device, such as an AXI interface of a DLA, an ACE interface, etc.
[0032] UDMAC 102 can convert the first request message 104 corresponding to the first data length received from the first device 101 to generate a second request message 105 corresponding to the second data length, thereby sending the second request message 105 corresponding to the second data length to the second device 103 for subsequent processing by the second device 103.
[0033] The data processing method of UDMAC 102 according to at least one embodiment of the present disclosure will be described below in conjunction with Figures 2 to 4 Provide a detailed description.
[0034] Figure 2A flowchart of an example data processing method according to at least one embodiment of the present disclosure is shown. Figure 3 A schematic diagram showing an exemplary processing flow of an exemplary data processing method according to at least one embodiment of the present disclosure is shown; Figure 4 Another exemplary processing flow diagram of an exemplary data processing method according to at least one embodiment of the present disclosure is shown.
[0035] like Figure 2 As shown, the exemplary data processing method 200 according to the embodiment of the present disclosure may include the following steps:
[0036] Step S201: receiving a first request message from a first device, wherein the first request message may include a first address aligned according to a first data length and a first size in units of the first data length;
[0037] Step S202: converting the first address into a second address aligned according to a second data length, wherein the second data length may be greater than the first data length;
[0038] Step S203: converting the first size into a second size in units of a second data length; and
[0039] Step S204: Send a second request message to the second device, wherein the second request message includes a second address and a second size.
[0040] For example, in one example, in step S201 , the data processing method 200 may include receiving a first request message 104 from a first device.
[0041] In some embodiments, the first request message 104 may be a first write request message or a first read request message. As described above, in some embodiments, the first device may be a computing device or an interface device thereof that arranges and processes data according to a first data length, and therefore, the first request message 104 may include a first address addr_u_start aligned according to the first data length and a first size size_u in units of the first data length. In the case where the first request message 104 is a first write request message, the first request message 104 may also include first write data data_u in units of the first data length. The processing of the first address addr_u_start, the first size size_u and / or the first write data data_u by the UDMAC 102 will be described in detail below in conjunction with specific embodiments.
[0042] Figure 3 An example in which the first request message 104 is a first write request message is used for illustrative description.
[0043] like Figure 3As shown in 310, the first address addr_u_start aligned according to the first data length (ie, 1 byte) may be any address within the memory range, and the first size size_u in units of the first data length may be any size in units of bytes. Figure 3 In the example, it is assumed that the first address addr_u_start included in the first request message 104 is 0x10052, and the first size size_u is 0x0005f (ie, 95 bytes).
[0044] As shown in 310, the first write data data_u may be the shaded portion from the first address addr_u_start (0x10052) to the first end address addr_u_end (0x100b0). Here, the first end address addr_u_end may be determined by the first address addr_u_start and the first size size_u. For example, the first end address addr_u_end may be determined according to the following equation (1):
[0045] addr_u_end = addr_u_start + size_u - 1 (1)
[0046] For example, in this example, in step S202 , the data processing method 200 may include converting the first address addr_u_start into a second address addr_a_start aligned according to the second data length.
[0047] As mentioned above, the second data length may be greater than the first data length by 2. N Bytes, where N is an integer greater than or equal to 1. Figure 3 , it is assumed that the first data length is 1 byte and the second data length is 32 bytes.
[0048] In some embodiments, converting the first address addr_u_start to the second address addr_a_start aligned according to the second data length may include setting the low bit corresponding to the low bit of the value 0 in the binary representation of the second data length in the first address addr_u_start to 0, so as to obtain the second address addr_a_start. For example, taking the second data length as 32 bytes as an example, its corresponding binary representation is 0010 0000, wherein the low bit of the value 0 is the lowest 5 bits, therefore, the lowest 5 bits in the first address 0x10052 (i.e., 0001 0000 0000 0101 0010) may be set to 0, so as to obtain the second address addr_a_start=0x10040 (i.e., 0001 0000 0000 0100 0000). It can be known that the second address 0x10040 after conversion is an integer multiple of 32 bytes, that is, it is aligned according to the second data length 32 bytes.
[0049] Figure 3 320 in the figure shows four consecutive "32-byte" data units starting from the second address 0x10040. By setting the low bit in the first address addr_u_start corresponding to the low bit of the value 0 in the binary representation of the second data length to 0, the second address addr_a_start aligned with the second data length can be easily and efficiently determined.
[0050] For example, in one example, in step S203 , the data processing method 200 may include converting the first size size_u into a second size size_a in units of the second data length.
[0051] In some implementations, the quotient of the first size size_u=0x0005f (ie, 95 bytes) and the second data length 32 bytes may be rounded up to obtain an intermediate size size_m in units of 32 bytes. For example, in the above example, in is a round-up function. In some implementations, the first boundary address addr_bound1 may also be determined based on the second address addr_a_start=0x10040 and the intermediate size size_m=3 acquired in step S202. For example, the first boundary address addr_bound1 may be determined by the following equation (2):
[0052] addr_bound1 = addr_a_start + 0x00020*size_m - 1 (2)
[0053] Wherein, "0x00020" is the hexadecimal representation of the second data length 32. In the above example, the first boundary address addr_bound1=0x1009f, ie, the end address of the third "32-byte" data unit in 320, can be calculated by equation (2).
[0054] In some embodiments, as described above, the first end address addr_u_end can be determined based on the first address addr_u_start and the first size size_u by the above equation (1). In the above example, the first end address addr_u_end=0x100b0 can be calculated by equation (1).
[0055] In some embodiments, the required second size size_a may be determined based on a comparison of the first end address addr_u_end=0x100b0 and the first boundary address addr_bound1=0x1009f and the intermediate size size_m=3. In some embodiments, when the first end address addr_u_end is greater than the first boundary address addr_bound1, the value of the intermediate size size_m+1 may be determined as the second size size_a. Figure 3 This is shown in 320 in FIG. Figure 3 In the example shown in 320 in , since the data start address in the request message is converted from the first address 0x10052 to the second address 0x10040 aligned according to the second data length, it is actually equivalent to shifting the valid data corresponding to the first write data data_u backward from the second address 0x10040. Therefore, if the end address 0x100b0 of the valid data corresponding to the first write data data_u after the shift exceeds the first boundary address addr_bound1=0x1009f calculated based on the second address 0x10040 and the intermediate size size_m=3, that is, the shifted valid data exceeds the third "32-byte" data unit and falls into the fourth "32-byte" data unit, the value of the intermediate size size_m+1 should be determined as the second size size_a, that is, size_a=4 (that is, 0x00004).
[0056] However, in some other embodiments, for example, when the first end address addr_u_end is less than or equal to the first boundary address addr_bound1, the value of the intermediate size size_m can be directly determined as the second size size_a. For example, in another example, assuming that the first address addr_u_start' is still 0x10052, but the first size size_u'=0x0004a (i.e., 74 bytes). In this case, the second address addr_a_start'=0x10040, the intermediate size size_m can be calculated according to the method described above. The first boundary address addr_bound1'=0x1009f, the first end address addr_u_end'=0x1009b. In this case, since the data start address in the request message is converted from the first address 0x10052 to the second address 0x10040 aligned according to the second data length, it is actually equivalent to shifting the valid data corresponding to the first write data data_u' backward from the second address 0x10040. However, since the end address 0x1009b of the valid data corresponding to the first write data data_u' after the shift does not exceed the first boundary address addr_bound1'=0x1009f calculated based on the second address 0x10040 and the intermediate size size_m'=3, that is, the end address of the shifted valid data still falls in the third "32-byte" data unit, therefore, the value of the intermediate size size_m' can be directly determined as the second size size_a', that is, size_a'=3 (that is, 0x00003). In this way, the second size after conversion can be optimally determined so that the second size after conversion can be the minimum size that can contain the first size before conversion.
[0057] In such Figure 3 In the example shown, according to the method described above, the first address addr_u_start=0x10052 aligned with 1 byte is converted to the second address addr_a_start=0x10040 aligned with 32 bytes, and the first size size_u=0x0005f (i.e., 95 bytes) in units of 1 byte is converted to the second size size_a=4 (i.e., 0x00004) in units of 32 bytes, which corresponds to an integer multiple of 32 bytes, i.e., 128 bytes.
[0058] For example, in one example, in step S204, the data processing method 200 may further include sending a second request message 105 including a second address addr_a_start and a second size size_a to the second device 103, so that the second device 103 performs subsequent operations or processing. As described above, the second device 105 may be a device or an interface device thereof that arranges and processes data according to the second data length (e.g., 32 bytes).
[0059] In some embodiments, as described above, in the case where the first request message 104 is or includes a first write request message, the first request message 104 may also include first write data data_u in units of a first data length. In this case, the exemplary data processing method 200 according to an embodiment of the present disclosure may also include converting the first write data data_u into second write data data_a in units of a second data length.
[0060] Still like Figure 3 Taking the example shown as an example, first, the first offset value offset1=addr_u_start-addr_a_start=0x00012 (i.e., 18) bytes between the first address addr_u_start=0x10052 included in the first request message 104 and the converted second address addr_a_start=0x10040 aligned according to 32 bytes can be determined. After determining the value J of the first offset value offset1 (J is an integer, for example, 18 in this example), J bytes of "0" can be added before the first write data data_u, and the J bytes of "0" can be considered as invalid data.
[0061] Next, as described above, according to equation (1), the first end address addr_u_end=0x100b0 of the first write data data_u can be calculated based on the first address addr_u_start=0x10052 and the first size size_u=0x0005f included in the first request message 104, and the second end address addr_a_end can be determined based on the converted second address addr_a_start=0x10040 and the second size size_a=4 (i.e., 0x00004). For example, the second end address addr_a_end can be determined by the following equation (3):
[0062] addr_a_end = addr_a_start + 0x00020*size_a - 1 (3)
[0063] Among them, "0x00020" is the hexadecimal representation of the second data length 32. In the above example, the second end address addr_a_end=0x100bf can be calculated by equation (3), that is, the end address of the fourth "32-byte" data unit in 320.
[0064] After determining the second end address addr_a_end, the second offset value offset2 = addr_a_end-addr_u_end = 0x0000f (i.e., 15) bytes between the first end address addr_u_end = 0x100b0 and the second end address addr_a_end = 0x100bf can be further determined. After determining the value M of the second offset value offset2 (M is an integer, for example, 15 in this example), M bytes of "0" can be added after the first write data data_u, and the M bytes of "0" can be considered as invalid data. In other embodiments, "1" can also be added as invalid data, which is not limited herein.
[0065] Thus, by padding the first and the last 0s of the first write data data_u having the first size 0x0005f (i.e., 95 bytes) according to the above method, the second write data data_a having the second size 0x00004 (i.e., 128 bytes) in units of 32 bytes can be obtained, which meets the processing format requirements of the second device 103, for example, Figure 3 The data corresponding to the addresses 0x10040-0x100bf in 320 are shown in FIG. The second write data data_a may be further included in the second request message 105 to be sent to the second device 103 for subsequent operation or processing, such as a write operation.
[0066] As described above, since the second write data data_a is generated by performing operations such as padding the beginning and the end of the first write data data_u with 0, the beginning and the end of the second write data data_a may contain invalid data of a certain length (such as "invalid data" shown in 320). In some embodiments, an indication signal for indicating which data in the second write data data_a is valid data corresponding to the first write data data_u may also be generated, and the indication signal may be included in the second request message 105 and sent to the second device 103. By sending the indication signal, the second device 103 can easily know which data in the received second write data data_a is valid data, thereby improving operation efficiency.
[0067] In some embodiments, the indication signal may include a first indication signal and a second indication signal. The first indication signal may be used to indicate which data in the first 32-byte data unit of the second write data data_a is valid data corresponding to the first write data data_u, and the second indication signal may be used to indicate which data in the last 32-byte data unit of the second write data data_a is valid data corresponding to the first write data data_u.
[0068] For example, still Figure 3 Taking the example shown as an example, since it has been determined according to the method described above that 18 bytes of "0" are added before the first write data data_u to generate the second write data data_a, it can be determined that in the first 32-byte data unit, the first 18 bytes are invalid data. Therefore, for example, a 32-bit first indication signal "0000 0000 00000000 0011 1111 1111 1111" can be generated to indicate which data in the first 32-byte data unit is valid data corresponding to the first write data data_u, wherein the upper 18 bits of the 32 bits are 0 to indicate "invalid", and the lower 14 bits are 1 to indicate "valid". In other implementations, "1" can also be used to indicate "invalid", and "0" can be used to indicate "valid". Similarly, since it has been determined according to the method described above that 15 bytes of "0" are added after the first write data data_u to generate the second write data data_a, it can be determined that in the last data unit of 32 bytes, the last 15 bytes are invalid data. Therefore, for example, a 32-bit second indication signal "1111 1111 1111 1111 1000 0000 0000 0000" can also be generated to indicate which data in the last data unit of 32 bytes is valid data corresponding to the first write data data_u, wherein the upper 17 bits of the 32 bits are 1 to indicate "valid", and the lower 15 bits are 0 to indicate "invalid".
[0069] In addition, since the intermediate data units between the first 32 bytes and the last 32 bytes in the second write data data_a are all valid data corresponding to the first write data data_u, there is no need to generate additional indication signals to indicate the validity of these data. In this way, by only generating and sending indication signals indicating the validity of the data in the first 32 bytes and the last 32 bytes in the second write data data_a, not only can the second device 103 be indicated which data in the second write data is valid data, but also signaling overhead can be saved and processing efficiency can be improved.
[0070] As mentioned above, Figure 3 The example case where the first request message 104 is a first write request message (or a first write command) is shown. Figure 4 An example case is shown where the first request message 104 is a first read request message (or a first read command).
[0071] The above combination Figure 3 The various methods described for the write command scenario can also be applied to the read command scenario. Figure 4 As shown, in the case where the first request message 104 is a first read command, it is still assumed that the first address addr_u_start included in the first request message 104 is 0x10052 and the first size size_u is 0x0005f (i.e., 95 bytes). The converted second address addr_a_start=0x10040 aligned according to the second data length and the second size size_a=4 (i.e., 0x00004) in units of the second data length can be determined according to the method described above. Therefore, the UDMAC 102 can read data (which can be referred to as second read data) in units of "32 bytes" from 0x10040 to 0x100bf (a size of 4 "32-byte" data units, i.e., 128 bytes) from the second device 103 based on the second address and the second size. At the same time, for the read command, the UDMAC 102 may also store the first address addr_u_start and the first size size_u in the read command in a memory or cache (e.g., a command fifo) for use in subsequent operations (e.g., when converting the read data). Since according to the read command, only the first read data starting from the first address addr_u_start=0x10052 and having a size of the first size size_u=0x0005f is desired to be read, the second read data read from the second device 103 may be converted based on the first address addr_u_start and the first size size_u to obtain the first read data.
[0072] In some embodiments, in combination with Figure 3 The method described above is similar to that described above, and a third offset value offset3=addr_u_start-addr_a_start=0x00012 (i.e., 18) bytes between the first address addr_u_start=0x10052 and the second address addr_a_start=0x10040 can be determined. After determining the value K (K is an integer, for example, 18 in this example) of the third offset value offset3, the first K bytes of data in the second read data can be removed or discarded.
[0073] Next, as described above, according to equation (1), the third end address addr_u_end=0x100b0 of the first read data can be calculated based on the first address addr_u_start=0x10052 and the first size size_u=0x0005f included in the first request message 104, and the fourth end address addr_a_end=0x100bf, that is, the end address of the 4th "32-byte" data unit in 420, can be determined based on the converted second address addr_a_start=0x10040 and the second size size_a=4 (i.e., 0x00004).
[0074] After determining the fourth end address addr_a_end, a fourth offset value offset4=addr_a_end-addr_u_end=0x0000f (i.e., 15) bytes between the third end address addr_u_end=0x100b0 and the fourth end address addr_a_end=0x100bf may be further determined. After determining the value L (L is an integer, for example, 15 in this example) of the fourth offset value offset4, the last L bytes of data in the second read data may be removed or discarded, so that the first read data may be obtained from the second read data (as shown in 410). The UDMAC 102 may send the converted first read data to the first device 101 that arranges and processes the data according to the first data length (e.g., 1 byte) to complete the read operation.
[0075] Next, Figure 5 A schematic diagram of a data processing device according to at least one embodiment of the present disclosure is shown.
[0076] like Figure 5 As shown, the data processing device 500 according to at least one embodiment of the present disclosure may include a first interface 501, a first conversion module 502, a second conversion module 503, and a second interface 504. In one embodiment, the data processing device 500 may be a combination of the above Figure 1 In other embodiments, the data processing device 500 may also include the above-mentioned UDMAC 102. Figure 1 any other data processing device of the UDMAC 102.
[0077] The first interface 501 may be used to receive a first request message from the first device 101. In some implementations, the first request message may include a first address aligned according to a first data length and a first size in units of the first data length.
[0078] The first conversion module 502 may be used to convert the first address into a second address aligned according to a second data length. In some embodiments, the second data length may be greater than 2 of the first data length. N The length in bytes, where N is an integer greater than or equal to 1.
[0079] The second conversion module 503 may be configured to convert the first size into a second size in units of a second data length.
[0080] The second interface 504 may be used to send a second request message to the second device 103 , wherein the second request message may include a second address and a second size.
[0081] For example, the first conversion module 502 and the second conversion module 503 may be implemented by software, hardware, firmware or any combination thereof; for example, the first conversion module 502 and the second conversion module 503 may be implemented by converters or conversion circuits, respectively.
[0082] For example, the first interface 501 may be a bus interface (e.g., AXI interface, ACE interface, etc.) that interfaces or communicates with a computing device that arranges and processes data according to a first data length (e.g., 1 byte) or an interface device of the computing device (e.g., DMA interface device); the second interface 504 may be a bus interface (e.g., AXI interface, ACE interface, etc.) that arranges and processes data according to a second data length (e.g., 32 bytes) or an interface device thereof. For example, the first interface 501 and the second interface 504 may be implemented by software, hardware, firmware, or any combination thereof; for example, the first interface 501 and the second interface 504 may be implemented by bus interface circuits, respectively.
[0083] In some embodiments, converting the first address to a second address aligned according to the second data length may include setting a low bit in the first address corresponding to a low bit of value 0 in a binary representation of the second data length to 0 to obtain the second address.
[0084] In some embodiments, converting a first size to a second size in units of a second data length may include: rounding up a quotient of the first size and the second data length to obtain an intermediate size in units of the second data length; determining a first boundary address based on the second address and the intermediate size; determining a first end address based on the first address and the first size; and determining the second size based on a comparison of the first end address and the first boundary address and the intermediate size.
[0085] In some embodiments, determining the second size based on a comparison of the first end address and the first boundary address and the intermediate size may include: when the first end address is less than or equal to the first boundary address, determining the intermediate size as the second size; and when the first end address is greater than the first boundary address, adding 1 to the intermediate size to determine the second size.
[0086] In some embodiments, the first request message may include a first write request message, the first write request message may also include first write data in units of first data length, and the data processing device 500 may also include: a third conversion module, used to convert the first write data into second write data in units of second data length; and a first processing module, used to include the second write data in the second request message.
[0087] In some embodiments, converting the first write data into the second write data in units of the second data length may also include: determining a first offset value between the first address and the second address; adding J zeros corresponding to the first data length before the first write data, where J is an integer the same as the first offset value; determining a first end address based on the first address and the first size; determining a second end address based on the second address and the second size; determining a second offset value between the first end address and the second end address; and adding M zeros corresponding to the first data length after the first write data to generate the second write data, where M is an integer the same as the second offset value.
[0088] In some embodiments, the data processing device 500 may further include: a first generating module for generating an indication signal for indicating which data in the second write data is valid data corresponding to the first write data; and a second processing module for including the indication signal in the second request message.
[0089] In some embodiments, the indication signal may include a first indication signal and a second indication signal, wherein the first indication signal may be used to indicate which data of the first second data length in the second write data is valid data corresponding to the first write data; and wherein the second indication signal is used to indicate which data of the last second data length in the second write data is valid data corresponding to the first write data.
[0090] In some embodiments, the first request message may include a first read request message, and the data processing device 500 may also include: a first receiving module, used to receive second read data in units of a second data length from a second device based on a second address and a second size; a fourth conversion module, used to convert the second read data into first read data based on the first address and the first size; and a first sending module, used to send the first read data to the first device.
[0091] In some embodiments, based on the first address and the first size, converting the second read data to the first read data may include: determining a third offset value between the first address and the second address; removing data corresponding to the first K first data lengths in the second read data, where K is an integer the same as the third offset value; determining a third end address based on the first address and the first size; determining a fourth end address based on the second address and the second size; determining a fourth offset value between the third end address and the fourth end address; and removing data corresponding to the last L first data lengths in the second read data to generate the first read data, where L is an integer the same as the fourth offset value.
[0092] In some implementations, the first device may be a direct memory access interface device and the second device may be a data bus interface device.
[0093] In some embodiments, the first data length may be 1 byte, and the second data length may be 2 N Bytes, where N is an integer greater than or equal to 1.
[0094] It should be understood that the data processing device 500 according to the embodiment of the present disclosure may also include a method for executing any data processing method described according to the embodiment of the present disclosure (such as the data processing method 200 and the method combined with the method described above). Figure 1-Figure 4 Similarly, these modules can be implemented by software, hardware, firmware, or any combination thereof; for example, these modules can be implemented by functional circuits that implement corresponding functions, respectively. In addition, these modules and the modules described above can be implemented in any combination in an integrated manner, or can also be implemented separately.
[0095] Figure 6 A schematic diagram of another data processing device according to at least one embodiment of the present disclosure is shown.
[0096] like Figure 6As shown, the data processing device 600 according to the embodiment of the present disclosure may include at least one processor 601 and a storage device 602. The storage device 602 may store at least one program, and when the at least one program is executed by the at least one processor 601, the at least one processor 601 may implement any method according to the embodiment of the present disclosure, such as the above data processing method 200 and the combination Figure 1-Figure 4 Any other data processing methods described.
[0097] In addition, an embodiment of the present disclosure further provides an electronic device, which may include a data processing device 500 or 600 according to an embodiment of the present disclosure, and may execute or implement any method according to an embodiment of the present disclosure, such as the data processing method 200 and the method in combination with the data processing method 200. Figure 1-Figure 4 Any other data processing methods described.
[0098] For example, the electronic device may also include other devices that cooperate with the data processing device 500 or 600, for example, including the first device and the second device mentioned in the above embodiment, wherein the data processing device 500 or 600 is respectively connected to the first device and the second device in communication, for example, the communication connection may be based on a certain bus protocol and the bus width (e.g., 16 bytes, 32 bytes, etc.) may be selected as needed, and the embodiments of the present disclosure are not limited to this. For example, the electronic device may include but is not limited to a personal computer (PC), a server, a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a vehicle navigation terminal), a digital TV, a desktop computer, etc.
[0099] Figure 7 An example structural diagram of an electronic device 700 suitable for implementing at least one embodiment of the present disclosure is shown. The electronic device in the embodiment of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0100] like Figure 7As shown, the electronic device 700 may include a processing device 701, which may perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage device 706 to a random access memory (RAM) 703. For example, the processing device 701 may include the data processing device 500 or 600 according to an embodiment of the present disclosure, and may execute or implement any method according to an embodiment of the present disclosure, such as the above-mentioned data processing method 200 and the method in combination with the above-mentioned data processing method 200. Figure 1-Figure 4 Any other data processing method described. As described above, the processing device 701 may also include other devices that work in conjunction with the data processing device 500 or 600, for example, including the first device and the second device mentioned in the aforementioned embodiment, for example, a central processing unit (CPU), a graphics processing unit (GPU), a general-purpose graphics processing unit (GPGPU), a tensor processing unit (TPU), a data processing unit (DPU), an artificial intelligence (AI) accelerator, a deep learning accelerator (DLA), etc. In some embodiments, in RAM 703, various programs and data required for the operation of the electronic device 700 are also stored. The processing device 701, ROM 702, and RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0101] Typically, the following devices may be connected to the I / O interface 705: an input device 706 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 707 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 706 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 709. The communication device 709 may allow the electronic device 700 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 7 The electronic device 700 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0102] In addition, an embodiment of the present disclosure further provides a non-transitory storage medium containing computer executable instructions, wherein the computer executable instructions are used to execute any method according to an embodiment of the present disclosure when executed by a computer processor, such as the data processing method 200 and the method in combination with the above-mentioned method. Figure 1-Figure 4 Any other data processing methods described.
[0103] The data processing method provided by the embodiment of the present disclosure converts the format of processing requests (eg, read / write requests) so that the processing requests can be easily switched between different hardware, thereby improving the overall processing efficiency.
[0104] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device, or installed from a ROM. When the computer program is executed by a processing device, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0105] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0106] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0107] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0108] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: receives a first request message from a first device, wherein the first request message includes a first address aligned according to a first data length and a first size in units of the first data length; converts the first address into a second address aligned according to a second data length, wherein the second data length is greater than the first data length; converts the first size into a second size in units of the second data length; and sends a second request message to a second device, wherein the second request message includes the second address and the second size.
[0109] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0110] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession 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 square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0111] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a unit does not limit the unit itself in some cases. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses".
[0112] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0113] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0114] According to one or more embodiments of the present disclosure, a data processing method is provided, including:
[0115] receiving a first request message from a first device, wherein the first request message includes a first address aligned according to a first data length and a first size in units of the first data length;
[0116] Converting the first address into a second address aligned according to a second data length, wherein the second data length is greater than the first data length;
[0117] converting the first size into a second size in units of the second data length; and
[0118] A second request message is sent to a second device, wherein the second request message includes the second address and the second size.
[0119] According to one or more embodiments of the present disclosure, converting the first address into a second address aligned according to a second data length includes:
[0120] The lower bits in the first address corresponding to the lower bits of the value 0 in the binary representation of the second data length are set to 0 to obtain the second address.
[0121] According to one or more embodiments of the present disclosure, converting the first size into a second size in units of the second data length includes:
[0122] Rounding up a quotient of the first size and the second data length to obtain an intermediate size in units of the second data length;
[0123] determining a first boundary address based on the second address and the intermediate size;
[0124] determining a first end address based on the first address and the first size; and
[0125] The second size is determined based on a comparison of the first end address and the first boundary address and the intermediate size.
[0126] According to one or more embodiments of the present disclosure, determining the second size based on a comparison between the first end address and the first boundary address and the intermediate size includes:
[0127] In a case where the first end address is less than or equal to the first boundary address, determining the intermediate size as the second size; and
[0128] When the first end address is greater than the first boundary address, the intermediate size is increased by 1 to determine the second size.
[0129] According to one or more embodiments of the present disclosure, the first request message includes a first write request message, the first write request message also includes first write data in units of the first data length, and the method further includes:
[0130] converting the first write data into second write data in units of the second data length; and
[0131] The second write data is included in the second request message.
[0132] According to one or more embodiments of the present disclosure, converting the first write data into second write data in units of the second data length includes:
[0133] determining a first offset value between the first address and the second address;
[0134] Adding J zeros corresponding to the first data length before the first written data, where J is an integer equal to the first offset value;
[0135] determining a first end address based on the first address and the first size;
[0136] determining a second end address based on the second address and the second size;
[0137] determining a second offset value between the first end address and the second end address; and
[0138] M zeros corresponding to the first data length are added after the first write data to generate the second write data, where M is an integer the same as the second offset value.
[0139] According to one or more embodiments of the present disclosure, the method further includes:
[0140] generating an indication signal for indicating which data in the second write data is valid data corresponding to the first write data; and
[0141] The indication signal is included in the second request message.
[0142] According to one or more embodiments of the present disclosure, the indication signal includes a first indication signal and a second indication signal, wherein:
[0143] The first indication signal is used to indicate which data of the first second data length in the second write data is valid data corresponding to the first write data; and wherein,
[0144] The second indication signal is used to indicate which data of the last data of the second data length in the second write data is valid data corresponding to the first write data.
[0145] According to one or more embodiments of the present disclosure, the first request message includes a first read request message,
[0146] The method further comprises:
[0147] receiving second read data in units of the second data length from the second device based on the second address and the second size;
[0148] converting the second read data into first read data based on the first address and the first size; and
[0149] The first read data is sent to the first device.
[0150] According to one or more embodiments of the present disclosure, the converting the second read data into the first read data based on the first address and the first size includes:
[0151] determining a third offset value between the first address and the second address;
[0152] Remove the first K data corresponding to the first data length in the second read data, where K is an integer equal to the third offset value;
[0153] determining a third end address based on the first address and the first size;
[0154] determining a fourth end address based on the second address and the second size;
[0155] determining a fourth offset value between the third end address and the fourth end address; and
[0156] The data corresponding to the last L first data lengths in the second read data are removed to generate the first read data, wherein L is an integer the same as the fourth offset value.
[0157] According to one or more embodiments of the present disclosure, the first device is a direct memory access interface device, and the second device is a data bus interface device.
[0158] According to one or more embodiments of the present disclosure, the first data length is 1 byte, and the second data length is 2 N Bytes, where N is an integer greater than or equal to 1.
[0159] According to one or more embodiments of the present disclosure, there is provided a data processing device, including:
[0160] A first interface, configured to receive a first request message from a first device, wherein the first request message includes a first address aligned according to a first data length and a first size in units of the first data length;
[0161] A first conversion module, configured to convert the first address into a second address aligned according to a second data length, wherein the second data length is greater than the first data length;
[0162] A second conversion module, configured to convert the first size into a second size in units of the second data length; and
[0163] The second interface is used to send a second request message to the second device, wherein the second request message includes the second address and the second size.
[0164] According to one or more embodiments of the present disclosure, converting the first address into a second address aligned according to a second data length includes:
[0165] The lower bits in the first address corresponding to the lower bits of the value 0 in the binary representation of the second data length are set to 0 to obtain the second address.
[0166] According to one or more embodiments of the present disclosure, converting the first size into a second size in units of the second data length includes:
[0167] Rounding up a quotient of the first size and the second data length to obtain an intermediate size in units of the second data length;
[0168] determining a first boundary address based on the second address and the intermediate size;
[0169] determining a first end address based on the first address and the first size; and
[0170] The second size is determined based on a comparison of the first end address and the first boundary address and the intermediate size.
[0171] According to one or more embodiments of the present disclosure, determining the second size based on a comparison between the first end address and the first boundary address and the intermediate size includes:
[0172] In a case where the first end address is less than or equal to the first boundary address, determining the intermediate size as the second size; and
[0173] When the first end address is greater than the first boundary address, the intermediate size is increased by 1 to determine the second size.
[0174] According to one or more embodiments of the present disclosure, the first request message includes a first write request message, the first write request message also includes first write data in units of the first data length,
[0175] The data processing device further comprises:
[0176] A third conversion module, configured to convert the first write data into second write data in units of the second data length; and
[0177] The first processing module is configured to include the second write data in the second request message.
[0178] According to one or more embodiments of the present disclosure, converting the first write data into second write data in units of the second data length includes:
[0179] determining a first offset value between the first address and the second address;
[0180] Adding J zeros corresponding to the first data length before the first written data, where J is an integer equal to the first offset value;
[0181] determining a first end address based on the first address and the first size;
[0182] determining a second end address based on the second address and the second size;
[0183] determining a second offset value between the first end address and the second end address; and
[0184] M zeros corresponding to the first data length are added after the first write data to generate the second write data, where M is an integer the same as the second offset value.
[0185] According to one or more embodiments of the present disclosure, the data processing device further includes:
[0186] A first generating module, configured to generate an indication signal for indicating which data in the second write data is valid data corresponding to the first write data; and
[0187] The second processing module is configured to include the indication signal in the second request message.
[0188] According to one or more embodiments of the present disclosure, the indication signal includes a first indication signal and a second indication signal, wherein:
[0189] The first indication signal is used to indicate which data of the first second data length in the second write data is valid data corresponding to the first write data; and wherein,
[0190] The second indication signal is used to indicate which data of the last data of the second data length in the second write data is valid data corresponding to the first write data.
[0191] According to one or more embodiments of the present disclosure, the first request message includes a first read request message,
[0192] The data processing device further comprises:
[0193] A first receiving module, configured to receive second read data in units of the second data length from the second device based on the second address and the second size;
[0194] a fourth conversion module, configured to convert the second read data into first read data based on the first address and the first size; and
[0195] A first sending module is configured to send the first read data to the first device.
[0196] According to one or more embodiments of the present disclosure, the converting the second read data into the first read data based on the first address and the first size includes:
[0197] determining a third offset value between the first address and the second address;
[0198] Remove the first K data corresponding to the first data length in the second read data, where K is an integer equal to the third offset value;
[0199] determining a third end address based on the first address and the first size;
[0200] determining a fourth end address based on the second address and the second size;
[0201] determining a fourth offset value between the third end address and the fourth end address; and
[0202] The data corresponding to the last L first data lengths in the second read data are removed to generate the first read data, wherein L is an integer the same as the fourth offset value.
[0203] According to one or more embodiments of the present disclosure, the first device is a direct memory access interface device, and the second device is a data bus interface device.
[0204] According to one or more embodiments of the present disclosure, the first data length is 1 byte, and the second data length is 2 N Bytes, where N is an integer greater than or equal to 1.
[0205] According to one or more embodiments of the present disclosure, a data processing device is provided, including:
[0206] at least one processor; and
[0207] A storage device stores at least one program thereon, and when the at least one program is executed by the at least one processor, the at least one processor implements any data processing method according to the embodiments of the present disclosure.
[0208] According to one or more embodiments of the present disclosure, an electronic device is provided, including any data processing device according to the embodiments of the present disclosure.
[0209] According to one or more embodiments of the present disclosure, a non-transitory storage medium containing computer-executable instructions is provided, wherein the computer-executable instructions are used to perform any data processing method according to the embodiments of the present disclosure when executed by a computer processor.
[0210] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0211] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0212] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A data processing method, comprising: receiving a first request message from a first device, wherein the first request message includes a first address aligned according to a first data length and a first size in units of the first data length; Converting the first address into a second address aligned according to a second data length, wherein the second data length is greater than the first data length; converting the first size into a second size in units of the second data length; and A second request message is sent to a second device, wherein the second request message includes the second address and the second size.
2. The method according to claim 1, wherein: Converting the first address into a second address aligned according to a second data length comprises: The lower bits in the first address corresponding to the lower bits of the value 0 in the binary representation of the second data length are set to 0 to obtain the second address.
3. The method according to claim 1, wherein: Converting the first size into a second size in units of the second data length includes: Rounding up a quotient of the first size and the second data length to obtain an intermediate size in units of the second data length; determining a first boundary address based on the second address and the intermediate size; determining a first end address based on the first address and the first size; and The second size is determined based on a comparison of the first end address and the first boundary address and the intermediate size.
4. The method according to claim 3, wherein: Determining the second size based on a comparison between the first end address and the first boundary address and the intermediate size includes: In a case where the first end address is less than or equal to the first boundary address, determining the intermediate size as the second size; and When the first end address is greater than the first boundary address, the intermediate size is increased by 1 to determine the second size.
5. The method according to claim 1, wherein: The first request message includes a first write request message, and the first write request message also includes first write data in units of the first data length. The method further comprises: converting the first write data into second write data in units of the second data length; and The second write data is included in the second request message.
6. The method according to claim 5, wherein: Converting the first write data into second write data in units of the second data length includes: determining a first offset value between the first address and the second address; Adding J zeros corresponding to the first data length before the first written data, where J is an integer equal to the first offset value; determining a first end address based on the first address and the first size; determining a second end address based on the second address and the second size; determining a second offset value between the first end address and the second end address; and M zeros corresponding to the first data length are added after the first write data to generate the second write data, where M is an integer the same as the second offset value.
7. The method according to claim 5, further comprising: generating an indication signal for indicating which data in the second write data is valid data corresponding to the first write data; as well as The indication signal is included in the second request message.
8. The method according to claim 7, wherein: The indication signal includes a first indication signal and a second indication signal, wherein: The first indication signal is used to indicate which data of the first second data length in the second write data is valid data corresponding to the first write data; and wherein, The second indication signal is used to indicate which data of the last data of the second data length in the second write data is valid data corresponding to the first write data.
9. The method according to claim 1, wherein: The first request message includes a first read request message, The method further comprises: receiving second read data in units of the second data length from the second device based on the second address and the second size; converting the second read data into first read data based on the first address and the first size; and The first read data is sent to the first device.
10. The method according to claim 9, wherein: Based on the first address and the first size, converting the second read data into first read data includes: determining a third offset value between the first address and the second address; Remove the first K data corresponding to the first data length in the second read data, where K is an integer equal to the third offset value; determining a third end address based on the first address and the first size; determining a fourth end address based on the second address and the second size; determining a fourth offset value between the third end address and the fourth end address; and The data corresponding to the last L first data lengths in the second read data are removed to generate the first read data, wherein L is an integer the same as the fourth offset value.
11. The method according to claim 1, wherein: The first device is a direct memory access interface device, and the second device is a data bus interface device.
12. The method according to claim 1, wherein: The first data length is 1 byte, and the second data length is 2 N Bytes, where N is an integer greater than or equal to 1.
13. A data processing device, comprising: A first interface, configured to receive a first request message from a first device, wherein the first request message includes a first address aligned according to a first data length and a first size in units of the first data length; A first conversion module, configured to convert the first address into a second address aligned according to a second data length, wherein the second data length is greater than the first data length; A second conversion module, configured to convert the first size into a second size in units of the second data length; and The second interface is used to send a second request message to the second device, wherein the second request message includes the second address and the second size.
14. A data processing device, comprising: at least one processor; and A storage device having at least one program stored thereon, which, when the at least one program is executed by the at least one processor, enables the at least one processor to implement the method according to any one of claims 1 to 12.
15. An electronic device comprising the data processing device according to claim 13 or 14.
16. A non-transitory storage medium containing computer executable instructions, wherein: The computer executable instructions are used to perform the method of any one of claims 1-12 when executed by a computer processor.
Citation Information
Patent Citations
Storage device including memory controller
CN113093988A
Method, electronic device and computer program product for processing data
CN114817121A
Data precision conversion method and device, DMA controller and medium
CN116166583A
Variable length multi-format converting apparatus and method and file transfer system using the same
JP2005216251A
Optimizing structures to fit into a complete cache line
US20190026088A1