Data sorting method, device, chip and equipment based on digital integrated circuit

By determining the first and second sequences of target symbols in a digital integrated circuit and moving the symbol positions, real-time sorting of data streams is achieved, solving the low efficiency problem in the prior art and improving data processing efficiency.

CN119088845BActive Publication Date: 2025-09-09T-HEAD (SHANGHAI) SEMICON CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310877762.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-17
Publication Date
2025-09-09
Estimated Expiration
2043-07-17

AI Technical Summary

Technical Problem

The existing technology is inefficient when using digital integrated circuits to sort data, resulting in prolonged data processing time.

Method used

By determining a first sequence and a second sequence of multiple target symbols in a data stream, the symbol positions are shifted according to these sequences to generate an ordered sequence, thereby achieving real-time sorting of data.

Benefits of technology

An ordered sequence can be obtained at any time in the data stream, which improves data processing efficiency and reduces data processing time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119088845B_ABST
    Figure CN119088845B_ABST
Patent Text Reader

Abstract

The present application provides a data sorting method, apparatus, chip, and device based on a digital integrated circuit. The data sorting method based on a digital integrated circuit includes: when sorting symbols in a data stream, determining a first sequence and a second sequence of multiple target symbols for the i-th group of data in the data stream; based on the first sequence and the second sequence of the multiple target symbols, moving each other symbol in the first ordered sequence to a corresponding first position to obtain a second ordered sequence; and based on the second sequence of the multiple target symbols, moving each target symbol in the second ordered sequence to a corresponding second position to obtain a target ordered sequence. This technical solution simultaneously sorts the symbols in the data stream while acquiring the data stream, effectively saving data processing time and improving data processing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to data processing technology, and in particular to a data sorting method, device, chip and equipment based on digital integrated circuits. Background Art

[0002] When processing data using digital integrated circuits, statistics and sorting of data (or symbols) are very common applications. In these applications, statistics and sorting often exist simultaneously. Generally, the data (or symbols) are sorted according to a certain method based on the statistical results.

[0003] However, the above method takes a lot of time and has low data processing efficiency. Summary of the Invention

[0004] The present application provides a data sorting method, device, chip and equipment based on digital integrated circuits to solve the problem of low efficiency in sorting data (or symbols) in the prior art.

[0005] In a first aspect, the present application provides a data sorting method based on a digital integrated circuit, comprising:

[0006] When sorting symbols in a data stream, determining, for an i-th group of data in the data stream, a first sequence and a second sequence of multiple target symbols, the multiple target symbols being symbols in the i-th group of data, the first sequence being obtained by sorting the multiple target symbols according to the number of times they appear in a first group of data to an (i-1)th group of data in the data stream, and the second sequence being obtained by sorting the multiple target symbols according to the number of times they appear in the first group of data to the i-th group of data, where i is an integer greater than or equal to 2;

[0007] moving each other symbol in the first ordered sequence to a corresponding first position according to the first and second sequences of the multiple target symbols to obtain a second ordered sequence, wherein the first ordered sequence is obtained by sorting each symbol in the first group of data to the (i-1)th group of data in the data stream according to a number of occurrences, and the other symbols are symbols in the first ordered sequence other than the multiple target symbols;

[0008] According to the second sequence of the plurality of target symbols, each target symbol in the second ordered sequence is moved to a corresponding second position to obtain a target ordered sequence.

[0009] In a possible implementation, the step of moving each other symbol in the first ordered sequence to a corresponding first position according to the first sequence and the second sequence of the plurality of target symbols to obtain the second ordered sequence includes:

[0010] For each other symbol, based on the number of first symbols that appear less than the other symbol in the first sequence and the number of second symbols that appear less than the other symbol in the second sequence, the other symbols in the first ordered sequence need to be moved to the corresponding first position to obtain the second ordered sequence.

[0011] In a possible implementation, for each other symbol, according to a first number of symbols that appear less than the other symbol in the first sequence and a second number of symbols that appear less than the other symbol in the second sequence, moving the other symbol in the first ordered sequence to a corresponding first position to obtain the second ordered sequence includes:

[0012] For each other symbol, calculating a first difference between the first number of symbols and the second number of symbols;

[0013] The other symbols in the first ordered sequence are moved in a target direction by the first difference position so that the other symbols are moved to the corresponding first position to obtain the second ordered sequence, where the target direction is the direction in which the number of occurrences of each symbol in the first ordered sequence decreases.

[0014] In a possible implementation, the moving each target symbol in the second ordered sequence to a corresponding second position according to the second sequence of the plurality of target symbols to obtain a target ordered sequence includes:

[0015] determining the position of the target symbol in the second ordered sequence as a second position;

[0016] For each second position, determining a third position ahead of the second position along the target direction;

[0017] According to the character corresponding to the third position, the first ordered sequence and the second sequence, the target symbol corresponding to the second position is placed in the second position to obtain the target ordered sequence.

[0018] In a possible implementation, for each second position, determining a third position ahead of the second position along the target direction includes:

[0019] For each second position, a position where the first other symbol appears is determined as the corresponding third position along the target direction.

[0020] In a possible implementation, placing the target symbol corresponding to the second position at the second position according to the character corresponding to the third position, the first ordered sequence, and the second sequence to obtain the target ordered sequence includes:

[0021] For each third position, determining a second difference between a position of a character corresponding to the third position in the first ordered sequence and the third position;

[0022] Determine a fourth position along the target direction that is a position behind the third position by the second difference value;

[0023] determining a target value for the character at the fourth position in the first ordered sequence, the target value being the number of characters in the second sequence that appear less than the character;

[0024] determining a target symbol corresponding to the third position according to the target value and the second sequence;

[0025] The target symbol corresponding to the third position is moved to the third position to obtain the target ordered sequence.

[0026] In a possible implementation, when sorting symbols in a data stream, determining, for an i-th group of data in the data stream, a first sequence and a second sequence of multiple target symbols includes:

[0027] When sorting the symbols in the data stream, for an i-th group of data in the data stream, obtaining, from a statistical table, a number of first occurrences of a target symbol in the first to the (i-1)th groups of data, the statistical table being used to store the number of occurrences of each symbol in the first to the (i-1)th groups of data;

[0028] For each target symbol, add the number of times the target symbol appears in the i-th group of data to the corresponding first number to obtain a second number of times the target symbol appears in the first to i-th groups of data;

[0029] performing bitonic sorting on a plurality of target symbols according to a first order of each target symbol to obtain the first sequence;

[0030] According to the second number of each target symbol, a plurality of target symbols are subjected to bitonic sorting to obtain the second sequence.

[0031] In a second aspect, the present application provides a data sorting device based on a digital integrated circuit, comprising:

[0032] a determination module configured to, when sorting symbols in a data stream, determine, for an i-th group of data in the data stream, a first sequence and a second sequence of multiple target symbols, where the multiple target symbols are symbols in the i-th group of data, the first sequence being obtained by sorting the multiple target symbols according to the number of times they appear in a first group of data to an (i-1)th group of data in the data stream, and the second sequence being obtained by sorting the multiple target symbols according to the number of times they appear in the first group of data to the i-th group of data, where i is an integer greater than or equal to 2;

[0033] a moving module, configured to move each other symbol in a first ordered sequence to a corresponding first position according to the first sequence and the second sequence of the plurality of target symbols, to obtain a second ordered sequence, wherein the first ordered sequence is obtained by sorting each symbol in the first group of data to the (i-1)th group of data in the data stream according to a number of occurrences, and the other symbols are symbols in the first ordered sequence other than the plurality of target symbols;

[0034] The moving module is further configured to move each target symbol in the second ordered sequence to a corresponding second position according to the second sequence of the plurality of target symbols, so as to obtain a target ordered sequence.

[0035] In a possible implementation, the mobile module is specifically configured to:

[0036] For each other symbol, based on the number of first symbols that appear less than the other symbol in the first sequence and the number of second symbols that appear less than the other symbol in the second sequence, the other symbols in the first ordered sequence need to be moved to the corresponding first position to obtain the second ordered sequence.

[0037] In a possible implementation, the mobile module is specifically configured to:

[0038] For each other symbol, calculating a first difference between the first number of symbols and the second number of symbols;

[0039] The other symbols in the first ordered sequence are moved in a target direction by the first difference position so that the other symbols are moved to the corresponding first position to obtain the second ordered sequence, where the target direction is the direction in which the number of occurrences of each symbol in the first ordered sequence decreases.

[0040] In a possible implementation, the mobile module is specifically configured to:

[0041] determining the position of the target symbol in the second ordered sequence as a second position;

[0042] For each second position, determining a third position ahead of the second position along the target direction;

[0043] According to the character corresponding to the third position, the first ordered sequence and the second sequence, the target symbol corresponding to the second position is placed in the second position to obtain the target ordered sequence.

[0044] In a possible implementation, the mobile module is specifically configured to:

[0045] For each second position, a position where the first other symbol appears is determined as the corresponding third position along the target direction.

[0046] In a possible implementation, the mobile module is specifically configured to:

[0047] For each third position, determining a second difference between a position of a character corresponding to the third position in the first ordered sequence and the third position;

[0048] Determine a fourth position along the target direction that is a position behind the third position by the second difference value;

[0049] determining a target value for the character at the fourth position in the first ordered sequence, the target value being the number of characters in the second sequence that appear less than the character;

[0050] determining a target symbol corresponding to the third position according to the target value and the second sequence;

[0051] The target symbol corresponding to the third position is moved to the third position to obtain the target ordered sequence.

[0052] In a possible implementation, the determining module is specifically configured to:

[0053] When sorting the symbols in the data stream, for an i-th group of data in the data stream, obtaining, from a statistical table, a number of first occurrences of a target symbol in the first to the (i-1)th groups of data, the statistical table being used to store the number of occurrences of each symbol in the first to the (i-1)th groups of data;

[0054] For each target symbol, add the number of times the target symbol appears in the i-th group of data to the corresponding first number to obtain a second number of times the target symbol appears in the first to i-th groups of data;

[0055] performing bitonic sorting on a plurality of target symbols according to a first order of each target symbol to obtain the first sequence;

[0056] According to the second number of each target symbol, a plurality of target symbols are subjected to bitonic sorting to obtain the second sequence.

[0057] In a third aspect, the present application provides a chip comprising a digital integrated circuit, wherein the digital integrated circuit is configured to execute the method as described in any one of the first aspect and possible implementations.

[0058] In a fourth aspect, the present application provides an electronic device, comprising:

[0059] at least one processor; and

[0060] a memory communicatively coupled to the at least one processor;

[0061] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the electronic device to perform the method as described in any one of the first aspect and various possible implementation methods.

[0062] In a fifth aspect, the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the method as described in the first aspect and any one of the possible implementation methods is implemented.

[0063] In a sixth aspect, the present application provides a computer program product, comprising a computer program, which, when executed by a processor, implements the method as described in the first aspect and any one of its possible implementations.

[0064] The present application provides a data sorting method, device, chip, and apparatus based on a digital integrated circuit. The data sorting method based on a digital integrated circuit includes: when sorting symbols in a data stream, determining a first sequence and a second sequence of multiple target symbols for the i-th group of data in the data stream; based on the first sequence and the second sequence of the multiple target symbols, moving each other symbol in the first ordered sequence to a corresponding first position to obtain a second ordered sequence; based on the second sequence of the multiple target symbols, moving each target symbol in the second ordered sequence to a corresponding second position to obtain a target ordered sequence. In this technical solution, after obtaining the i-th group of data, the first ordered sequence generated for the i-1-th group of data can be updated based on the target symbols included in the i-th group of data and the number of occurrences of each target symbol, thereby obtaining a target ordered sequence. The target ordered sequence is a sequence obtained by sorting the first to i-th groups of data. In this way, the symbols in the data stream can be sorted while the data stream is being obtained. That is, at any time when the data stream is being counted, an ordered sequence can be obtained. The ordered sequence is obtained by sorting the counted symbols, which can effectively save data processing time and improve data processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0066] Figure 1a A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0067] Figure 1b A schematic diagram of a scenario of a data sorting method based on a digital integrated circuit provided in an embodiment of the present application;

[0068] Figure 2 A flowchart of a data sorting method based on a digital integrated circuit provided in an embodiment of the present application;

[0069] Figure 3 A flowchart of another data sorting method based on a digital integrated circuit provided in an embodiment of the present application;

[0070] Figure 4 A flowchart of another data sorting method based on a digital integrated circuit provided in an embodiment of the present application;

[0071] Figure 5a A flowchart of another data sorting method based on a digital integrated circuit provided in an embodiment of the present application;

[0072] Figure 5bA flowchart of another data sorting method based on a digital integrated circuit provided in an embodiment of the present application;

[0073] Figure 5c A flowchart of another data sorting method based on a digital integrated circuit provided in an embodiment of the present application;

[0074] Figure 5d A flowchart of another data sorting method based on a digital integrated circuit provided in an embodiment of the present application;

[0075] Figure 5e A flowchart of another data sorting method based on a digital integrated circuit provided in an embodiment of the present application;

[0076] Figure 6 A schematic diagram of the structure of a data sorting device based on a digital integrated circuit provided in an embodiment of the present application;

[0077] Figure 7 A schematic structural diagram of another electronic device provided in an embodiment of the present application.

[0078] The above drawings illustrate specific embodiments of the present application, which will be described in more detail below. These drawings and the textual description are not intended to limit the scope of the present application in any way, but rather to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION

[0079] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.

[0080] It should be noted that the user information (including but not limited to user device information, user attribute information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0081] Next, the application scenarios of this application are explained.

[0082] In the actual development of product projects, it is often necessary to count and sort data (or symbols). For example, suppose a compression and decompression accelerator is needed for a product project. During use, the accelerator needs to count and sort the symbols to be compressed, and then perform Huffman encoding on them using a dynamic Huffman compression algorithm.

[0083] When using digital integrated circuits to implement statistics and sorting of data (or symbols), the existing technology mainly counts the data (or symbols), and after the statistics are completed, sorts the data (or symbols) according to a specific sorting algorithm to finally obtain an ordered sequence.

[0084] However, the above method implements statistics and sorting of data (or symbols) serially, that is, there is a sequence in the statistical processing and sorting of data. Only after all the data (or symbols) contained in the data stream are counted can the data (or symbols) in the data stream be sorted, resulting in a relatively large delay in the entire data processing (the time required from starting data (or symbol) statistics to completing data (or symbol) sorting), and there is a problem of low data processing efficiency.

[0085] Based on this, the present application provides a data sorting method based on digital integrated circuits. This method can obtain data in the data stream while sorting the data in the acquired data stream according to the symbols of each group of data in the data stream and the number of times each symbol appears, thereby realizing real-time statistics and sorting of the data stream.

[0086] For example, the above-mentioned data sorting method based on digital integrated circuit can be applied to Figure 1a In the electronic device shown, Figure 1a This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 1a The electronic device includes a chip 70 and a memory 702 , wherein the chip 70 includes a processor 701 and a communication interface 703 .

[0087] The aforementioned digital integrated circuit-based data sorting method can be applied to or implemented by chip 70. Processor 701 can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the digital integrated circuit-based data sorting method can be performed by hardware integrated logic circuits in processor 701 or by software instructions.

[0088] Specifically, the processor 701 can be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), a graphics processing unit (GPU), a field programmable gate array (FPGA), or one or more digital integrated circuits used to control the execution of the program of the present application.

[0089] In the embodiment of the present application, the memory 702, the communication interface 703 and the memory 702 are coupled together via a system bus.

[0090] The memory 702 is used to store computer-executable instructions for executing the solution of the present application, and the execution is controlled by the processor 701. The processor 701 is used to execute the computer-executable instructions stored in the memory 702, thereby implementing the data sorting method based on digital integrated circuits provided in the embodiment of the present application.

[0091] Specifically, the processor 701 may obtain the data stream to be sorted through the communication interface 703 , execute the above-mentioned data sorting method based on digital integrated circuits, and obtain an ordered sequence obtained by sorting.

[0092] Optionally, the ordered sequence may also be output via the communication interface 703 .

[0093] Furthermore, the processor 701 can perform the above-mentioned data sorting method based on digital integrated circuits by referring to Figure 1b The scene diagram shown is Figure 1b Schematic diagram of a data sorting method based on digital integrated circuits provided in an embodiment of the present application. Figure 1b As shown, the data stream to be sorted includes n groups of data, namely the first group of data, the second group of data, the third group of data, ..., the i-th group of data, ..., the n-th group of data, and the electronic device obtains each group of data in the data stream in sequence.

[0094] Specifically, after obtaining the first set of data, the electronic device updates the initial ordered table based on the symbols in the first set of data and the number of times each symbol appears, generating an ordered table 1 and an ordered sequence 1. The ordered table includes all symbols that may be included in the data stream and the number of times each symbol has appeared. The symbols in the ordered table are sorted according to the number of times they appear. The number of times each symbol appears in the initial ordered table is 0.

[0095] Furthermore, the electronic device obtains a second set of data, updates ordered table 1 based on the symbols in the second set of data and the number of times each symbol appears, and generates ordered table 2 and ordered sequence 2. Furthermore, the electronic device obtains a third set of data, updates ordered table 2 based on the symbols in the third set of data and the number of times each symbol appears, and generates ordered table 3 and ordered sequence 3. This process is repeated until the nth set of data is obtained, and ordered table n-1 is updated based on the symbols in the nth set of data and the number of times each symbol appears, generating ordered table n and ordered sequence n. Ordered sequence n is the ordered sequence generated by sorting the data stream.

[0096] It is understood that the execution subject of the embodiments of the present application can be an electronic device, such as a terminal device such as a computer or tablet computer, or a server, such as a backend processing platform. Therefore, the present embodiment will be explained by collectively referring to terminal devices and servers as electronic devices. Whether the electronic device is specifically a terminal device or a server can be determined in actual circumstances.

[0097] The technical solution of the present application is described in detail below through specific embodiments.

[0098] It should be noted that the following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0099] Figure 2 The following is a flow chart of a data sorting method based on a digital integrated circuit provided in an embodiment of the present application. Figure 2 As shown, the data sorting method based on digital integrated circuit may include the following steps:

[0100] S21 . When sorting symbols in a data stream, determine a first sequence and a second sequence of multiple target symbols for an i-th group of data in the data stream.

[0101] The execution subject of the embodiments of the present application may be an electronic device, or a data sorting device based on a digital integrated circuit provided in the electronic device. The data sorting device based on a digital integrated circuit may be implemented by software, or by a combination of software and hardware. For ease of understanding, the following description will be based on an electronic device as an example.

[0102] In an embodiment of the present application, the electronic device can sequentially obtain each set of data in a data stream, each set of data including multiple symbols. When sorting the symbols in the data stream, after obtaining each set of data, the electronic device can update the ordered sequence generated based on the previous set of data based on the symbols in the set of data and the number of times each symbol appears. In this way, after updating the ordered sequence generated from the second-to-last set of data based on the last set of data in the data stream, an ordered sequence of the data stream can be obtained, in which the symbols in the ordered sequence of the data stream are arranged according to the number of times each symbol appears in the data stream.

[0103] In this step, the multiple target symbols are symbols in the i-th group of data. The first sequence is obtained by sorting the multiple target symbols according to the number of times they appear in the first to i-1th groups of data in the data stream. The second sequence is obtained by sorting the multiple target symbols according to the number of times they appear in the first to i-th groups of data, where i is an integer greater than or equal to 2. In other words, in addition to the first group of data, after obtaining the i-th group of data from the data stream, the electronic device can generate the first and second sequences of the i-th group of data based on the target symbols in the i-th group of data and the number of times the target symbols appear in the i-th group of data.

[0104] It should be understood that when i=2, the first sequence is obtained by sorting the target symbols according to the number of times they appear in the first data set of the data stream, and the second sequence is obtained by sorting the target symbols according to the number of times they appear in the first data set and the second data set.

[0105] In one possible implementation, a statistical table is pre-stored in an electronic device. When sorting symbols in a data stream, for the i-th group of data in the data stream, the first occurrence count of a target symbol in the first to i-1th groups of data can be obtained from the statistical table. The number of occurrences of the target symbol in the i-th group of data is then added to the corresponding first occurrence count to obtain a second occurrence count of the target symbol in the first to i-th groups of data. Furthermore, the target symbols are sorted based on the first occurrence count of each target symbol to obtain a first sequence, and the target symbols are sorted based on the second occurrence count of each target symbol to obtain a second sequence.

[0106] Exemplarily, the above-mentioned sorting method can be a bitonic sorting method, or a sorting method existing in other prior arts, which can be determined according to actual needs and will not be described in detail here.

[0107] The statistical table is used to count the number of occurrences of each symbol in the statistical data stream. For example, before receiving the i-th data set, the statistical table indicates the number of occurrences of all possible symbols in the data stream from the first to the i-1th data sets. Assume that the number of occurrences of symbol B in the first to the i-1th data sets is 2, and symbol B appears 4 times in the i-th data set. Then, based on the i-th data set, the statistical table is updated. The number of occurrences of symbol B in the updated statistical table becomes 6, and the updated statistical table now indicates the number of occurrences of all possible symbols in the data stream from the first to the i-th data sets.

[0108] Optionally, the statistics table is organized by symbol size rather than by the number of times a symbol appears.

[0109] Next, the implementation method is explained through a specific example.

[0110] Exemplarily, the i-th group of data can be represented by Table 1.

[0111] Table 1

[0112]

[0113]

[0114] In Table 1, "valid bit" represents the valid bit; "Y" indicates that the row is valid, meaning the target symbol exists in that row; "N" represents that the row is invalid, meaning the target symbol does not exist in that row; "Symbol Array" represents the symbol; and "Symbol Count" represents the number of times the symbol appears. As shown in Table 1, the target symbols included in the i-th data set are symbol A, symbol B, symbol D, and symbol E, respectively. The number of times each target symbol appears in the i-th data set is 1, 4, 2, and 1, respectively.

[0115] Exemplarily, before receiving the i-th group of data, the statistical table can be represented by the following Table 2.

[0116] Table 2

[0117] Symbol Array A B C D E F …… Z …… Symbol Count 1 2 3 4 0 0 …… 0 ……

[0118] As can be seen from Table 2, in the first to i-1th data sets, the total number of occurrences of symbol A, symbol B, symbol D, and symbol E are 1, 2, 4, and 0, respectively.

[0119] Based on this, it can be obtained that the total number of times symbol A, symbol B, symbol D, and symbol E appear in the first group of data to the i-th group of data are: 2, 6, 6, and 1 respectively. The statistical table shown in Table 2 can be updated according to the i-th group of data. The updated statistical table is used to represent the number of times all possible symbols that may appear in the data stream appear in the first group of data to the i-th group of data.

[0120] For example, the updated statistics table can be represented by Table 3.

[0121] Table 3

[0122] Symbol Array A B C D E F …… Z …… Symbol Count 2 6 3 6 1 0 …… 0 ……

[0123] For example, based on Table 1, Table 2, and Table 3, the first sequence of symbol A, symbol B, symbol D, and symbol E can be represented by Table 4, and the second sequence can be represented by Table 5.

[0124] Table 4

[0125] Valid bit Symbol Array Symbol Count Y E 1 Y A 2 Y B 6 Y D 6 N - - N - - N - - N - -

[0126] Table 5

[0127]

[0128]

[0129] Based on Table 4 and Table 5, it can be seen that the first sequence and the second sequence obtained by sorting are both: E, A, B, D. The first sequence and the second sequence are both obtained by sorting the target symbols in order of the number of occurrences from small to large.

[0130] S22. According to the first sequence and the second sequence of the plurality of target symbols, move each other symbol in the first ordered sequence to the corresponding first position to obtain a second ordered sequence.

[0131] In an embodiment of the present application, the first ordered sequence is obtained by sorting each symbol in the first group of data to the i-1th group of data in the data stream according to the number of occurrences. After obtaining the i-th group of data, the first ordered sequence needs to be updated according to the i-th group of data.

[0132] In this step, updating the first ordered sequence first requires adjusting the position of each other symbol in the first ordered sequence according to the first sequence and second sequence of multiple target symbols of the i-th group of data to obtain a second ordered sequence, where the other symbols are the symbols in the first ordered sequence other than the multiple target symbols.

[0133] In one possible implementation, for each other symbol, based on the number of first symbols that appear less than other symbols in the first sequence and the number of second symbols that appear less than other symbols in the second sequence, the other symbols in the first ordered sequence need to be moved to the corresponding first position to obtain the second ordered sequence.

[0134] In this implementation, specifically, for each other symbol, the first difference between the number of first symbols and the number of second symbols is calculated; the other symbols in the first ordered sequence are moved in the target direction by the first difference position so that the other symbols are moved to the corresponding first position, and the second ordered sequence is obtained, and the target direction is the direction in which the number of occurrences of each symbol in the first ordered sequence decreases.

[0135] Optionally, when the valid sequence sorts the symbols in order of number of occurrences from least to most, the target direction is from right to left.

[0136] Specifically, an electronic device may pre-store an ordered table, which includes all the symbols that may be included in the data stream and the number of times each symbol has appeared. The symbols in the ordered table are sorted according to the number of times they appear. The essential idea of ​​real-time sorting of the ordered table is: for each other symbol "X" in the ordered table, after generating the first sequence and the second sequence of the target symbol, the position that "X" needs to move to in the target direction = the number of first symbols that appear less than "X" in the first sequence minus the number of second symbols that appear less than "X" in the second sequence. The target symbol that appears less than "X" in the first sequence represents that the target symbol needs to be moved from the position in the target direction of "X" to a new position; and the target symbol that appears less than "X" in the second sequence represents that the target symbol needs to be inserted into a new position in the target direction of "X". Therefore, the difference between the two represents the number of bits that "X" needs to move to the target direction.

[0137] For example, the ordered list can be represented by the following Table 6.

[0138] Table 6

[0139] Symbol Array A B C D E F …… Z …… Symbol Count 0 1 2 3 4 5 …… 25 ……

[0140] S23. According to the second sequence of multiple target symbols, move each target symbol in the second ordered sequence to a corresponding second position to obtain a target ordered sequence.

[0141] In this step, the position of the target symbol in the second ordered sequence can be determined as the second position. At this time, the target symbol placed at the second position has not yet been sorted and needs to be adjusted. Based on the second sequence of the multiple target symbols, the position of the target symbol can be adjusted on the basis of the second ordered sequence to obtain a target ordered sequence. The target ordered sequence is obtained by sorting the symbols in the first to i-th groups of data according to their number of occurrences, thereby achieving the purpose of updating the first ordered sequence.

[0142] There are two ways to adjust the target symbol placed at the second position:

[0143] In a first approach, the plurality of second positions may be sorted according to the sorting order of the target symbols in the second sequence, and the target symbol corresponding to each second position may be adjusted to the second position.

[0144] For example, assuming that the second sequence is symbol A, symbol B, symbol C, and symbol D, and the target symbols are sorted in order of the number of occurrences from the smallest to the largest, the second positions are sorted according to the above order (i.e., the number of occurrences from the smallest to the largest), and the resulting sorting results are second position 1, second position 2, second position 3, and second position 4. The correspondence between each second position and the symbol is: symbol A - second position 1, symbol B - second position 2, symbol C - second position 3, and symbol D - second position 4. Symbol A is then moved to second position 1, symbol B to second position 2, symbol C to second position 3, and symbol D to second position 4.

[0145] Method 2: The third position in front of the second position can be determined according to the target direction, the character corresponding to the third position and the second difference between the position of the character in the first ordered sequence and the third position can be determined, and then the fourth position that is the second difference position behind the third position can be determined along the target direction, and the target value of the character at the fourth position in the first ordered sequence can be determined, the target value is the number of characters that appear less than the character in the second sequence, and the target symbol corresponding to the third position can be determined based on the target value and the second sequence.

[0146] It should be understood that the specific implementation process and principles of the second method can refer to Figure 3 The embodiments shown are not described in detail here.

[0147] The data sorting method based on a digital integrated circuit provided in an embodiment of the present application, when sorting symbols in a data stream, determines a first sequence and a second sequence of multiple target symbols for the i-th group of data in the data stream; based on the first sequence and the second sequence of the multiple target symbols, moves each other symbol in the first ordered sequence to a corresponding first position to obtain a second ordered sequence; based on the second sequence of the multiple target symbols, moves each target symbol in the second ordered sequence to a corresponding second position to obtain a target ordered sequence. The multiple target symbols are symbols in the i-th group of data; the first sequence is obtained by sorting the multiple target symbols according to the number of times they appear in the first to i-1 groups of data in the data stream; the second sequence is obtained by sorting the multiple target symbols according to the number of times they appear in the first to i-1 groups of data in the data stream, where i is an integer greater than or equal to 2; the first ordered sequence is obtained by sorting each symbol in the first to i-1 groups of data in the data stream according to the number of times they appear; and the other symbols are symbols in the first ordered sequence other than the multiple target symbols. In the present technical solution, after obtaining the i-th group of data, the first ordered sequence generated by the i-1-th group of data can be updated according to the target symbols included in the i-th group of data and the number of times each target symbol appears, thereby obtaining a target ordered sequence. The target ordered sequence is a sequence obtained by sorting the first group of data to the i-th group of data. In this way, the symbols in the data stream can be sorted while the data stream is obtained. That is to say, at any time when the data stream is counted, an ordered sequence can be obtained. The ordered sequence is obtained by sorting the counted symbols, which can effectively save data processing time and improve data processing efficiency.

[0148] Next, through Figure 3 The illustrated embodiment further describes S23.

[0149] Figure 3 This is a flow chart of another data sorting method based on digital integrated circuits provided in an embodiment of the present application. Figure 3 As shown, S23 may include the following steps:

[0150] S231. Determine the position of the target symbol in the second ordered sequence as the second position.

[0151] S232. For each second position, determine a third position ahead of the second position along the target direction.

[0152] In this step, the target symbol placed at the second position in the second ordered sequence has not yet been sorted and needs to be adjusted. Since the symbols in the first ordered sequence are arranged in a certain order, a third position ahead of the second position can be determined along the target direction, and the target symbol corresponding to the second position can be determined based on the symbol corresponding to the third position.

[0153] In a possible implementation, for each second position, the position where the first other symbol appears may be determined as the corresponding third position along the target direction.

[0154] S233. Place the target symbol corresponding to the second position at the second position according to the character corresponding to the third position, the first ordered sequence, and the second sequence to obtain a target ordered sequence.

[0155] In this step, the distance that the symbol moves from its position in the first ordered sequence to the third position can be determined based on the character corresponding to the third position, so as to determine theoretically from which position (the fourth position) in the first ordered sequence the character should be obtained for the third position. However, compared with the first ordered sequence, the target symbol appears more often. When the first ordered sequence is updated, the target symbol needs to be inserted between the third position and the fourth position of the first ordered sequence. As a result, the character at the fourth position in the first ordered sequence is not the character that needs to be inserted into the second position in the second ordered sequence, and the corresponding target symbol needs to be inserted into the second position.

[0156] In one possible implementation, for each third position, determine the second difference between the position of the character corresponding to the third position in the first ordered sequence and the third position; along the target direction, determine the fourth position that is the second difference position behind the third position; determine the target value of the character at the fourth position in the first ordered sequence, which target value is the number of characters that appear less than the character in the second sequence, and the number of characters is the number of symbols that need to be inserted before the fourth position; determine the target symbol corresponding to the third position based on the target value and the second sequence; move the target symbol corresponding to the third position to the third position to obtain the target ordered sequence.

[0157] For example, assuming that the first ordered sequence is obtained by sorting the symbols in order of the number of occurrences from small to large, and the symbols in the second sequence are obtained by sorting the target characters in order of the number of occurrences from small to large, when the target value is determined to be 1, it means that one target symbol needs to be inserted before the fourth position, that is, the first target symbol in the second sequence needs to be inserted into the third position.

[0158] Based on the data sorting method based on digital integrated circuits provided in the above embodiment, the method will be specifically explained below through a specific example.

[0159] The entire process from obtaining to sorting the i-th group of data in the data stream can be achieved by Figure 4 、 Figure 5a 、 Figure 5b 、 Figure 5c 、 Figure 5d 、 Figure 5eTo express, Figure 4 A flow chart of another data sorting method based on a digital integrated circuit provided in an embodiment of the present application is provided. Figure 5a A flow chart of another data sorting method based on a digital integrated circuit provided in an embodiment of the present application is provided. Figure 5b A flow chart of another data sorting method based on a digital integrated circuit provided in an embodiment of the present application is provided. Figure 5c A flow chart of another data sorting method based on a digital integrated circuit provided in an embodiment of the present application is provided. Figure 5d A flow chart of another data sorting method based on a digital integrated circuit provided in an embodiment of the present application is provided. Figure 5e This is a flow chart of another data sorting method based on digital integrated circuits provided in an embodiment of the present application. Figure 4 、 Figure 5a 、 Figure 5b 、 Figure 5c 、 Figure 5d 、 Figure 5e In the figure, clock cycles 0-11 (English: Cycle) represent time points, which is the concept of clock cycles in digital integrated circuits, where clock cycle 0 represents the first clock cycle, clock cycle 1 represents the second clock cycle, and so on.

[0160] like Figure 4 As shown, the data sorting method based on digital integrated circuit includes the following process:

[0161] Clock cycle 0: Get the i-th group of data in the data stream.

[0162] Clock cycle 1: Obtain the first occurrence number of the target symbol in the first to i-1th groups of data from the statistical table, and update the statistical table based on the i-th group of data to obtain an updated statistical table.

[0163] The target symbol is the symbol in the i-th group of data.

[0164] It should be understood that the specific updating method can refer to the relevant content in S21 and will not be repeated here.

[0165] Clock cycle 2: Add the number of times the target symbol appears in the i-th group of data to the corresponding first number to obtain the second number of times the target symbol appears in the first group of data to the i-th group of data.

[0166] Clock cycles 3-8: performing bitwise sorting on multiple target symbols according to the first number of each target symbol; and performing bitwise sorting on multiple target symbols according to the second number of each target symbol.

[0167] Clock cycle 9: Acquire the first sequence and the second sequence of target symbols.

[0168] It should be understood that multiple target symbols can be bitonally sorted using clock cycles 3-8 (a total of 6 clock cycles), or the target symbols can be bitonally sorted using other numbers of clock cycles. For example, multiple target symbols can be bitonally sorted using clock cycle 3 (a total of 1 clock cycle). This can be pre-set based on the number of symbols included in the i-th group of data, and will not be repeated here.

[0169] Further, Figure 5a 、 Figure 5b 、 Figure 5c 、 Figure 5d 、 Figure 5e The processing that needs to be executed for clock cycle 10 is as follows: Figure 5a As shown, the data sorting method based on digital integrated circuits also includes the following process:

[0170] Step 0, get the Insert Bit Vectors and Remove Bit Vectors of each symbol, where the bit of the Insert Bit Vectors (that is, Figure 5a The square at Insert Bit Vectors in the second sequence represents the number of symbols that appear more or equal to the symbol in the second sequence, and the bit of Remove Bit Vectors (that is, Figure 5a The squares at RemoveBit Vectors in represent the number of symbols that appear more than this symbol in the second sequence.

[0171] Further, such as Figure 5b As shown, the data sorting method based on digital integrated circuits also includes the following process:

[0172] Step 1. Shift the Remove Bit Vectors of each symbol by the number of 1s in the Insert Bit Vectors (upward), and obtain the shift result (Shift Remove Bit Vector by Insert Bit Vector). For example, the Remove Bit Vectors of the character J is 8'b11000000 (from top to bottom), and the insert bitvec is 8'b10000000 (from top to bottom, with three 1s). Therefore, after the shift, the Remove Bit Vectors becomes 8'b10000000 (from top to bottom).

[0173] Further, such as Figure 5b As shown, the data sorting method based on digital integrated circuits also includes the following process:

[0174] Step 2: Based on step 1, perform one-hot encoding on the shift result to obtain the one-hot encoding result.

[0175] Among them, the position of 1 in the one-hot encoding result (shift bitvec) represents how many positions the symbol at the corresponding position needs to be shifted left.

[0176] Further, such as Figure 5c As shown, the data sorting method based on digital integrated circuits also includes the following process:

[0177] Step 3: According to the one-hot encoding result, shift the other symbols in the first ordered sequence in the ordered table to obtain a second ordered sequence.

[0178] The arrows point to the destination positions of the symbols. For example, symbol E needs to be moved to the original position of symbol D, and symbol F needs to be moved to the original position of symbol E.

[0179] Further, such as Figure 5d As shown, the data sorting method based on digital integrated circuits also includes the following process:

[0180] Step 4: Insert the target symbol in the i-th group of data into the second ordered sequence.

[0181] The target value (Insert Sum) may refer to the relevant content in S23 and will not be described in detail here.

[0182] The position difference (PULL Num) is the difference between the position of the symbol in the second ordered sequence and the position of the symbol in the first ordered sequence.

[0183] Furthermore, the data sorting method based on digital integrated circuits also includes the following process:

[0184] Clock cycle 11, obtain the target ordered sequence.

[0185] Among them, the target ordered sequence is A, B, C, E, F, G, D, I, J, H, K, L, M, N, O, P.

[0186] The following are device embodiments of the present application, which can be used to implement the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.

[0187] Figure 6 This is a schematic diagram of the structure of a data sorting device based on a digital integrated circuit provided in an embodiment of the present application. Figure 6 As shown, the data sorting device 600 based on digital integrated circuit includes:

[0188] a determination module 601 configured to, when sorting symbols in a data stream, determine, for an i-th group of data in the data stream, a first sequence and a second sequence of multiple target symbols, where the multiple target symbols are symbols in the i-th group of data, the first sequence being obtained by sorting the multiple target symbols according to the number of times they appear in the first group of data to the i-1th group of data in the data stream, and the second sequence being obtained by sorting the multiple target symbols according to the number of times they appear in the first group of data to the i-th group of data, where i is an integer greater than or equal to 2;

[0189] a moving module 602 configured to move each other symbol in a first ordered sequence to a corresponding first position based on a first sequence and a second sequence of a plurality of target symbols to obtain a second ordered sequence, wherein the first ordered sequence is obtained by sorting each symbol in a first group of data to an i-1th group of data in the data stream according to a number of occurrences, and the other symbols are symbols in the first ordered sequence other than the plurality of target symbols;

[0190] The moving module 602 is further configured to move each target symbol in the second ordered sequence to a corresponding second position according to the second sequence of the plurality of target symbols, so as to obtain a target ordered sequence.

[0191] In a possible implementation, the mobile module 602 is specifically configured to:

[0192] For each other symbol, based on the number of first symbols that appear less than other symbols in the first sequence and the number of second symbols that appear less than other symbols in the second sequence, the other symbols in the first ordered sequence need to be moved to the corresponding first position to obtain the second ordered sequence.

[0193] In a possible implementation, the mobile module 602 is specifically configured to:

[0194] For each other symbol, calculating a first difference between the first number of symbols and the second number of symbols;

[0195] The other symbols in the first ordered sequence are moved in the target direction by the first difference position to move the other symbols to the corresponding first position, and a second ordered sequence is obtained. The target direction is the direction in which the number of occurrences of each symbol in the first ordered sequence decreases.

[0196] In a possible implementation, the mobile module 602 is specifically configured to:

[0197] determining the position of the target symbol in the second ordered sequence as a second position;

[0198] For each second position, determining a third position ahead of the second position along the target direction;

[0199] According to the character corresponding to the third position, the first ordered sequence and the second sequence, the target symbol corresponding to the second position is placed in the second position to obtain the target ordered sequence.

[0200] In a possible implementation, the mobile module 602 is specifically configured to:

[0201] For each second position, a position where the first other symbol appears is determined as the corresponding third position along the target direction.

[0202] In a possible implementation, the mobile module 602 is specifically configured to:

[0203] For each third position, determining a second difference between a position of a character corresponding to the third position in the first ordered sequence and the third position;

[0204] Determine a fourth position along the target direction that is a second difference position behind the third position;

[0205] determining a target value for the character at the fourth position in the first ordered sequence, the target value being the number of characters in the second sequence that appear less than the character;

[0206] Determining a target symbol corresponding to the third position according to the target value and the second sequence;

[0207] Move the target symbol corresponding to the third position to the third position to obtain the target ordered sequence.

[0208] In a possible implementation, the determining module 601 is specifically configured to:

[0209] When sorting symbols in a data stream, for the i-th group of data in the data stream, obtain the first occurrence count of the target symbol in the first to i-1-th groups of data from the statistical table, where the statistical table is used to store the number of occurrences of each symbol in the first to i-1-th groups of data;

[0210] For each target symbol, add the number of times the target symbol appears in the i-th group of data to the corresponding first number to obtain the second number of times the target symbol appears in the first group of data to the i-th group of data;

[0211] performing bitonal sorting on the plurality of target symbols according to the first order of each target symbol to obtain a first sequence;

[0212] According to the second order of each target symbol, a plurality of target symbols are subjected to bitonic sorting to obtain a second sequence.

[0213] The data sorting device based on digital integrated circuits provided in the embodiments of the present application can be used to execute the data sorting method based on digital integrated circuits in any of the above embodiments. Its implementation principles and technical effects are similar and will not be repeated here.

[0214] It should be noted that it should be understood that the division of the various modules of the above device is merely a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. Moreover, these modules can all be implemented in the form of software called by processing elements; they can also all be implemented in the form of hardware; some modules can also be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. In addition, these modules can be fully or partially integrated together or implemented independently. The processing element described here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each of the above modules can be completed by the hardware integrated logic circuit in the processor element or by instructions in the form of software.

[0215] Figure 7 This is a structural diagram of another electronic device provided in an embodiment of the present application. Figure 7 As shown, the electronic device of this embodiment may include:

[0216] at least one processor 701; and

[0217] a memory 702 in communication with the at least one processor;

[0218] The memory 702 stores instructions that can be executed by the at least one processor 701, and the instructions are executed by the at least one processor 701 to enable the electronic device to execute the method as described in any of the above embodiments.

[0219] Optionally, the memory 702 may be independent or integrated with the processor 701 .

[0220] The implementation principle and technical effects of the electronic device provided in this embodiment can be found in the aforementioned embodiments and will not be described in detail here.

[0221] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the method described in any of the above embodiments is implemented.

[0222] An embodiment of the present application further provides a computer program product, including a computer program, which implements the method described in any of the aforementioned embodiments when executed by a processor.

[0223] An embodiment of the present application further provides a chip, including a digital integrated circuit, which is used to implement the method described in any of the above embodiments.

[0224] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of modules is merely a logical function division. In actual implementation, other division methods may be used. For example, multiple modules may be combined or integrated into another system, or some features may be ignored or not implemented.

[0225] The above-mentioned integrated module implemented in the form of a software functional module can be stored in a computer-readable storage medium. The above-mentioned software functional module is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform some steps of the method described in each embodiment of the present application.

[0226] It should be understood that the processor may be a CPU, or other general-purpose processors, digital signal processors (DSPs), ASICs, etc. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the application may be directly implemented as being executed by a hardware processor, or may be implemented by a combination of hardware and software modules in the processor. The memory may include high-speed RAM memory, and may also include non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk, or an optical disk.

[0227] The storage medium may be implemented by any type of volatile or non-volatile memory device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The storage medium may be any available medium that can be accessed by a general-purpose or special-purpose computer.

[0228] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the storage medium can also exist as discrete components in an electronic device or a main control device.

[0229] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.

[0230] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0231] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0232] The above are only preferred embodiments of the present application and do not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A data sorting method based on digital integrated circuits, characterized in that: include: When sorting symbols in a data stream, for an i-th group of data in the data stream, determining a first sequence and a second sequence of multiple target symbols within a corresponding clock cycle, the multiple target symbols being symbols in the i-th group of data, the first sequence being obtained by sorting the multiple target symbols according to the number of times they appear in a first group of data to an (i-1)th group of data in the data stream, and the second sequence being obtained by sorting the multiple target symbols according to the number of times they appear in the first group of data to the i-th group of data, where i is an integer greater than or equal to 2; the data stream includes n groups of data; for each other symbol in the first ordered sequence, based on a first number of symbols in the first sequence that appears less than the other symbol and a second number of symbols in the second sequence that appears less than the other symbol, moving the other symbol in the first ordered sequence to a corresponding first position, to obtain a second ordered sequence, wherein the first ordered sequence is obtained by sorting each symbol in the first group of data to the (i-1)th group of data in the data stream according to the number of appearances, and the other symbols are symbols in the first ordered sequence other than the multiple target symbols; According to the second sequence of the plurality of target symbols, each target symbol in the second ordered sequence is moved to a corresponding second position to obtain a target ordered sequence; Output the target ordered sequence.

2. The method according to claim 1, characterized in that The step of moving, for each other symbol, the other symbol in the first ordered sequence to a corresponding first position according to a first symbol quantity that appears less than the other symbol in the first sequence and a second symbol quantity that appears less than the other symbol in the second sequence to obtain the second ordered sequence includes: For each other symbol, calculating a first difference between the first number of symbols and the second number of symbols; The other symbols in the first ordered sequence are moved in a target direction by the first difference position so that the other symbols are moved to the corresponding first position to obtain the second ordered sequence, where the target direction is the direction in which the number of occurrences of each symbol in the first ordered sequence decreases.

3. The method according to claim 2, characterized in that The step of moving each target symbol in the second ordered sequence to a corresponding second position according to the second sequence of the plurality of target symbols to obtain a target ordered sequence includes: determining the position of the target symbol in the second ordered sequence as a second position; For each second position, determining a third position ahead of the second position along the target direction; According to the character corresponding to the third position, the first ordered sequence and the second sequence, the target symbol corresponding to the second position is placed in the second position to obtain the target ordered sequence.

4. The method according to claim 3, characterized in that The step of determining, for each second position, a third position ahead of the second position along the target direction comprises: For each second position, a position where the first other symbol appears is determined as the corresponding third position along the target direction.

5. The method according to claim 3 or 4, characterized in that The step of placing the target symbol corresponding to the second position at the second position according to the character corresponding to the third position, the first ordered sequence, and the second sequence to obtain the target ordered sequence includes: For each third position, determining a second difference between a position of a character corresponding to the third position in the first ordered sequence and the third position; Determine a fourth position along the target direction that is a position behind the third position by the second difference value; determining a target value for the character at the fourth position in the first ordered sequence, the target value being the number of characters in the second sequence that appear less than the character; determining a target symbol corresponding to the third position according to the target value and the second sequence; The target symbol corresponding to the third position is moved to the third position to obtain the target ordered sequence.

6. The method according to claim 1, characterized in that The step of determining, for an i-th group of data in the data stream, a first sequence and a second sequence of a plurality of target symbols when sorting the symbols in the data stream comprises: When sorting the symbols in the data stream, for an i-th group of data in the data stream, obtaining, from a statistical table, a number of first occurrences of a target symbol in the first to the (i-1)th groups of data, the statistical table being used to store the number of occurrences of each symbol in the first to the (i-1)th groups of data; For each target symbol, add the number of times the target symbol appears in the i-th group of data to the corresponding first number to obtain a second number of times the target symbol appears in the first to i-th groups of data; performing bitonic sorting on a plurality of target symbols according to a first order of each target symbol to obtain the first sequence; According to the second number of each target symbol, a plurality of target symbols are subjected to bitonic sorting to obtain the second sequence.

7. A data sorting device based on a digital integrated circuit, applied to electronic equipment, characterized in that: The device comprises: a determination module configured to, when sorting symbols in a data stream, determine, for an i-th group of data in the data stream, within a corresponding clock cycle, a first sequence and a second sequence of multiple target symbols, the multiple target symbols being symbols in the i-th group of data, the first sequence being obtained by sorting the multiple target symbols according to the number of times they appear in a first group of data to an (i-1)th group of data in the data stream, and the second sequence being obtained by sorting the multiple target symbols according to the number of times they appear in the first group of data to the i-th group of data, where i is an integer greater than or equal to 2; the data stream comprising n groups of data; a moving module, configured to move, for each other symbol in the first ordered sequence, the other symbol in the first ordered sequence to a corresponding first position based on a first number of symbols in the first sequence that appears less than the other symbol and a second number of symbols in the second sequence that appears less than the other symbol, to obtain a second ordered sequence, wherein the first ordered sequence is obtained by sorting the symbols in the first group of data to the (i-1)th group of data in the data stream based on the number of appearances, and the other symbols are symbols in the first ordered sequence other than the multiple target symbols; The moving module is further configured to move each target symbol in the second ordered sequence to a corresponding second position according to the second sequence of the plurality of target symbols, so as to obtain a target ordered sequence.

8. A chip, characterized in that: The method comprises a digital integrated circuit, wherein the digital integrated circuit is configured to execute the method according to any one of claims 1 to 6.

9. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the electronic device to perform the method according to any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, and when a processor executes the computer-executable instructions, the method according to any one of claims 1 to 6 is implemented.

11. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Merging tree sorting device, sorting system and sorting method

    CN113076312A

  • Ranking query processing method for stream data and stream data processing system having ranking query processing mechanism

    US20090112853A1