Multi-channel input median sorting circuit
By designing the grouping sorting module and the median sorting screening module in the multi-channel input median sorting circuit, the effect of reducing the number of comparisons and improving the sorting efficiency is achieved, and the problems of high power consumption and large chip area in the prior art are solved.
Patent Information
- Application Number
- CN202311119855.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-31
- Publication Date
- 2025-02-28
Smart Images

Figure CN119538842A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of digital circuits, and in particular to a median sorting circuit for multi-channel inputs. Background Art
[0002] In chip design, chip area affects the power consumption and cost of the chip. The smaller the area, the fewer transistors are needed and the lower the power consumption. At the same time, a smaller chip area means that more chips can be cut from a wafer of the same size, thereby reducing chip costs. In data statistics, the median represents the middle level of data distribution. Compared with the average value, the median has the advantage of not being affected by the maximum or minimum values, can better reflect the data distribution, and represents the overall level. In the process of digital circuit design, it is often necessary to sort the data output by multiple channels to find the median. Most of the existing methods are to sort directly according to the bubble sort circuit, which has a large number of comparisons and increases the power consumption of the chip.
[0003] Therefore, it is necessary to provide a novel median sorting circuit with multi-channel input to solve the above problems existing in the prior art. Summary of the invention
[0004] The object of the present invention is to provide a median sorting circuit for multi-channel input, which effectively reduces the number of circuit comparisons, helps to reduce power consumption and chip area.
[0005] To achieve the above object, the median sorting circuit with multi-channel input of the present invention comprises a grouping sorting module, which is used to group and sort the data at least 2k times, and remove part of the edge data when the grouping is performed for an even number of times, wherein the edge data is part of the data at one end of the maximum value and part of the data at one end of the minimum value in the sorted data, and k is an integer greater than or equal to 1; and
[0006] The median sorting and screening module is used to sort the data output by the grouping and sorting module to obtain target median data.
[0007] The beneficial effect of the median sorting circuit with multi-channel input described in the present invention is that the grouping sorting module performs grouping sorting on the data at least 2k times, and removes some edge data during the even-numbered grouping sorting, thereby reducing the number of unnecessary comparisons in the entire sorting process, reducing the power consumption of the circuit and the entire chip, and effectively improving the data sorting efficiency.
[0008] Optionally, when the number of channel inputs is less than or equal to 16, k=1.
[0009] Optionally, the grouping and sorting module includes a first sorting module and a first sorting and filtering module, the first sorting module is used to divide the data into two groups and perform the first sorting respectively; the first sorting and filtering module is used to take the two data at one end of the maximum value in each group of sorted data into the first group of data and the two data at one end of the minimum value into the second group of data, and sort them respectively, and then remove m data from the first group of data from large to small, and remove m data from the second group of data from small to large, where m is a pre-set natural number greater than or equal to 1.
[0010] Optionally, the input data is an 8-channel input, the first sorting module includes two four-input first bubble sorting circuits, the first sorting and screening module includes two four-input second bubble sorting circuits, the median sorting and screening module includes a four-input third bubble sorting circuit and a first output unit, the two first bubble sorting circuits respectively input four-channel input data and output two groups of sorted data after sorting, the first output end and the second output end of the two first bubble sorting circuits are both electrically connected to the four input ends of the first second bubble sorting circuit, the fourth output end and the third output end of the two first bubble sorting circuits are both electrically connected to the four input ends of the second second bubble sorting circuit, the fourth output end and the third output end of the first second bubble sorting circuit are electrically connected to the two input ends of the third bubble sorting circuit, the first output end and the second output end of the second second bubble sorting circuit are electrically connected to the other two input ends of the third bubble sorting circuit, and the second output end and the third output end of the third bubble sorting circuit are both electrically connected to the first output unit to output the target median data.
[0011] Optionally, the first sorting module further includes eight first triggers, the first sorting and screening module further includes four second triggers, the fourth output terminals and the third output terminals of the two first bubble sorting circuits are respectively electrically connected to the four input terminals of the second second bubble sorting circuit through one of the first triggers, the fourth output terminals and the third output terminals of the two first bubble sorting circuits are respectively electrically connected to the four input terminals of the second second bubble sorting circuit through one of the first triggers, the fourth output terminal and the third output terminal of the first second bubble sorting circuit are respectively electrically connected to the two input terminals of the third bubble sorting circuit through one of the second triggers, and the first output terminal and the second output terminal of the second second bubble sorting circuit are respectively electrically connected to the other two input terminals of the third bubble sorting circuit through one of the second triggers. Its beneficial effect is that by adding triggers between bubble sorting circuits, it is convenient to realize data hierarchical processing by beating triggers, which effectively reduces glitches and timing problems in the circuit.
[0012] Optionally, the grouping and sorting module includes a first sorting module and a first sorting and filtering module, the first sorting module is used to divide the data into four groups and perform the first sorting respectively; the first sorting and filtering module is used to take the maximum value in each group of sorted data to form a first group of data, the second maximum value to form a second group of data, the second minimum value to form a third group of data and the minimum value to form a fourth group of data, sort the first group of data, the second group of data, the third group of data and the fourth group of data respectively, and then remove m data from the first group of data from large to small, remove n data from the second group of data from large to small, remove n data from the third group of data from small to large, and remove m data from the fourth group of data from small to large, where m and n are pre-set natural numbers greater than or equal to 1.
[0013] Optionally, the first sorting module includes four fourth bubble sorting circuits with four inputs, the first sorting screening module includes four fifth bubble sorting circuits with four inputs, the median sorting screening module includes a sixth bubble sorting circuit with ten inputs and a second output unit, 16-channel input data are respectively input into the four fourth bubble sorting circuits in four groups, so that the 16-channel input data are sorted by the four fourth bubble sorting circuits to obtain four groups of four-output sorted data, the first output ends of the four fourth bubble sorting circuits are respectively electrically connected to the four input ends of the first fifth bubble sorting circuit, the second output ends of the four fourth bubble sorting circuits are respectively electrically connected to the four input ends of the second fifth bubble sorting circuit, and the four fourth The third output end of the bubble sort circuit is electrically connected to the four input ends of the third fifth bubble sort circuit respectively, the fourth output ends of the four fourth bubble sort circuits are electrically connected to the four input ends of the fourth fifth bubble sort circuit respectively, the fourth output end and the third output end of the first fifth bubble sort circuit, the second output end, the third output end and the fourth output end of the second fifth bubble sort circuit, the first output end and the second output end of the third fifth bubble sort circuit, and the first output end and the second output end of the fourth fifth bubble sort circuit are electrically connected to the input ends of the sixth bubble sort circuit respectively, and the fifth output end and the sixth output end of the sixth bubble sort circuit are connected to the second output unit to output the target median data.
[0014] Optionally, the first sorting module also includes sixteen third triggers, and the first sorting and screening module also includes ten fourth triggers, the first output ends of the four fourth bubble sorting circuits are respectively electrically connected to the four input ends of the first fifth bubble sorting circuit through one of the third triggers, the second output ends of the four fourth bubble sorting circuits are respectively electrically connected to the four input ends of the second fifth bubble sorting circuit through one of the third triggers, the third output ends of the four fourth bubble sorting circuits are respectively electrically connected to the four input ends of the third fifth bubble sorting circuit through one of the third triggers, the fourth output ends of the four fourth bubble sorting circuits are respectively electrically connected to the four input ends of the fourth fifth bubble sorting circuit through one of the third triggers, the fourth output end and the third output end of the first fifth bubble sorting circuit, the second output end, the third output end and the fourth output end of the second fifth bubble sorting circuit, the first output end and the second output end of the third fifth bubble sorting circuit, and the first output end and the second output end of the fourth fifth bubble sorting circuit are respectively electrically connected to the input end of the sixth bubble sorting circuit through one of the fourth triggers. The beneficial effect is that by adding triggers between bubble sorting circuits, data hierarchical processing can be realized by beating the triggers, thereby effectively reducing glitches and timing problems in the circuit.
[0015] Optionally, when the number of channel inputs is greater than 16 and less than or equal to 32, k=2.
[0016] Optionally, the grouping and sorting module includes a first sorting module, a first sorting and filtering module, a second sorting module and a second sorting and filtering module, the first sorting module is used to divide the data into four groups for the first sorting respectively; the first sorting and filtering module is used to take the data in each group of data from large to small and sorted in the same position to form a first group of data, a second group of data, a third group of data, a fourth group of data, a fifth group of data, a sixth group of data, a seventh group of data and an eighth group of data, and sort them respectively, and then remove the maximum value and the second maximum value of the first group of data, the maximum value and the second maximum value of the second group of data, the maximum value and the second maximum value of the third group of data, the maximum value of the fourth group of data, the minimum value of the fifth group of data, the minimum value and the second minimum value of the sixth group of data, the minimum value and the second minimum value of the seventh group of data, and the minimum value and the second minimum value of the eighth group of data; the second sorting The module is used to divide the remaining data of the first group of data, the second group of data, the third group of data, the fourth group of data, the fifth group of data, the sixth group of data, the seventh group of data and the eighth group of data into three groups for the third sorting respectively; the second sorting and screening module is used to take the data from each group of data from large to small and sorted in the same position to form the ninth group of data, the tenth group of data, the eleventh group of data, the twelfth group of data, the thirteenth group of data and the fourteenth group of data, and sort them respectively, and then remove m data from the ninth group of data from large to small, remove n data from the tenth group of data from large to small, remove x data from the eleventh group of data from large to small, remove x data from the twelfth group of data from small to large, remove n data from the thirteenth group of data from small to large, and remove m data from the fourteenth group of data from small to large, where m, n and x are pre-set natural numbers greater than or equal to 1.
[0017] Optionally, the first sorting module includes four seventh bubble sorting circuits with eight inputs, the first sorting and screening module includes eight eighth bubble sorting circuits with four inputs, the second sorting module includes three ninth bubble sorting circuits with six inputs, the second sorting and screening module includes six tenth bubble sorting circuits with three inputs, the median sorting and screening module includes an eleventh bubble sorting circuit with ten inputs and a third output unit, 32-channel input data are respectively input to the input ends of the four seventh bubble sorting circuits for sorting to obtain four groups of sorted data, the first output ends of the four seventh bubble sorting circuits are respectively electrically connected to the four input ends of the first eighth bubble sorting circuit, and the second output ends of the four seventh bubble sorting circuits are electrically connected to the first eighth bubble sorting circuit. The fourth output terminals of the four seventh bubble sorting circuits are respectively electrically connected to the four input terminals of the fourth eighth bubble sorting circuit, the fifth output terminals of the four seventh bubble sorting circuits are respectively electrically connected to the four input terminals of the fifth eighth bubble sorting circuit, the sixth output terminals of the four seventh bubble sorting circuits are respectively electrically connected to the four input terminals of the sixth eighth bubble sorting circuit, the seventh output terminals of the four seventh bubble sorting circuits are respectively electrically connected to the four input terminals of the seventh eighth bubble sorting circuit, and the fourth output terminals of the four seventh bubble sorting circuits are respectively electrically connected to the four input terminals of the seventh eighth bubble sorting circuit. The eighth output end of the seventh bubble sort circuit is electrically connected to the four input ends of the eighth bubble sort circuit, the third output end and the fourth output end of the first eighth bubble sort circuit, the third output end and the fourth output end of the second eighth bubble sort circuit, the third output end and the fourth output end of the third eighth bubble sort circuit, the second output end, the third output end and the fourth output end of the fourth eighth bubble sort circuit, the first output end, the second output end and the third output end of the fifth eighth bubble sort circuit, the first output end and the second output end of the sixth eighth bubble sort circuit, the first output end and the second output end of the seventh eighth bubble sort circuit, the eighth output end and the fourth output end of the eighth bubble sort circuit The first output end and the second output end are electrically connected to the input ends of the three ninth bubble sorting circuits for sorting, the first output ends of the three ninth bubble sorting circuits are electrically connected to the input end of the first tenth bubble sorting circuit, the second output ends of the three ninth bubble sorting circuits are electrically connected to the input end of the second tenth bubble sorting circuit, the third output ends of the three ninth bubble sorting circuits are electrically connected to the input end of the third tenth bubble sorting circuit, the fourth output ends of the three ninth bubble sorting circuits are electrically connected to the input end of the fourth tenth bubble sorting circuit, and the fifth output ends of the three ninth bubble sorting circuits are electrically connected to the input end of the fifth tenth bubble sorting circuit.The sixth output terminals of the three ninth bubble sorting circuits are electrically connected to the input terminal of the sixth tenth bubble sorting circuit, respectively; the third output terminal of the first tenth bubble sorting circuit, the second output terminal and the third output terminal of the second and third tenth bubble sorting circuits, the first output terminal and the second output terminal of the fourth and fifth tenth bubble sorting circuits, and the first output terminal of the sixth tenth bubble sorting circuit are electrically connected to the input terminal of the eleventh bubble sorting circuit, respectively; the fifth output terminal and the sixth output terminal of the eleventh bubble sorting circuit are electrically connected to the third output unit to output the target median data.
[0018] Optionally, the first sorting module also includes 32 fifth triggers, the first sorting and screening module also includes eighteen sixth triggers, eighteen seventh triggers and ten eighth triggers, the first output ends of the four seventh bubble sorting circuits are respectively electrically connected to the four input ends of the first eighth bubble sorting circuit through one of the fifth triggers, the second output ends of the four seventh bubble sorting circuits are respectively electrically connected to the four input ends of the second eighth bubble sorting circuit through one of the fifth triggers, the third output ends of the four seventh bubble sorting circuits are respectively electrically connected to the four input ends of the third eighth bubble sorting circuit through one of the fifth triggers, and the fourth output ends of the four seventh bubble sorting circuits are respectively electrically connected to the four input ends of the third eighth bubble sorting circuit through one of the fifth triggers. The output ends of the four bubble sorting circuits are electrically connected to the four input ends of the fourth bubble sorting circuit through one of the fifth triggers, the fifth output ends of the four bubble sorting circuits are electrically connected to the four input ends of the fifth bubble sorting circuit through one of the fifth triggers, the sixth output ends of the four bubble sorting circuits are electrically connected to the four input ends of the sixth bubble sorting circuit through one of the fifth triggers, the seventh output ends of the four bubble sorting circuits are electrically connected to the four input ends of the seventh bubble sorting circuit through one of the fifth triggers, and the eighth output ends of the four bubble sorting circuits are electrically connected to the eighth bubble sorting circuit through one of the fifth triggers. The four input terminals of the bubble sorting circuit are electrically connected, and the third output terminal and the fourth output terminal of the first eighth bubble sorting circuit, the third output terminal and the fourth output terminal of the second eighth bubble sorting circuit, the third output terminal and the fourth output terminal of the third eighth bubble sorting circuit, the second output terminal, the third output terminal and the fourth output terminal of the fourth eighth bubble sorting circuit, the first output terminal, the second output terminal and the third output terminal of the fifth eighth bubble sorting circuit, the first output terminal and the second output terminal of the sixth eighth bubble sorting circuit, the first output terminal and the second output terminal of the seventh eighth bubble sorting circuit, and the first output terminal and the second output terminal of the eighth eighth bubble sorting circuit are respectively connected through one of the first output terminals. The six triggers are electrically connected to the input terminals of the three ninth bubble sorting circuits for sorting. The first output terminals of the three ninth bubble sorting circuits are electrically connected to the input terminal of the first tenth bubble sorting circuit through one seventh trigger, the second output terminals of the three ninth bubble sorting circuits are electrically connected to the input terminal of the second tenth bubble sorting circuit through one seventh trigger, the third output terminals of the three ninth bubble sorting circuits are electrically connected to the input terminal of the third tenth bubble sorting circuit through one seventh trigger, and the fourth output terminals of the three ninth bubble sorting circuits are electrically connected to the input terminal of the fourth tenth bubble sorting circuit through one seventh trigger.The fifth output terminals of the three ninth bubble sorting circuits are electrically connected to the input terminal of the fifth tenth bubble sorting circuit through a seventh trigger, respectively; the sixth output terminals of the three ninth bubble sorting circuits are electrically connected to the input terminal of the sixth tenth bubble sorting circuit through a seventh trigger, respectively; the third output terminal of the first tenth bubble sorting circuit, the second output terminal and the third output terminal of the second and third tenth bubble sorting circuits, the first output terminal and the second output terminal of the fourth and fifth tenth bubble sorting circuits, and the first output terminal of the sixth tenth bubble sorting circuit are electrically connected to the input terminal of the eleventh bubble sorting circuit through an eighth trigger. The beneficial effect is that by adding triggers between bubble sorting circuits, data hierarchical processing can be realized by trigger beating, which effectively reduces glitches and timing problems in the circuit. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 It is a structural block diagram of the median sorting circuit of multi-channel input according to the present invention;
[0020] Figure 2 A circuit diagram of the median sorting circuit with multiple channels of input in the present invention with 8 channels of input;
[0021] Figure 3 A circuit diagram of a median sorting circuit with multiple channels of input in the present invention with 16 channels of input;
[0022] Figure 4 This is a circuit diagram of the median sorting circuit with multi-channel inputs in the present invention when there are 32 channels of input. DETAILED DESCRIPTION
[0023] In order to make the purpose, technical solutions and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. Unless otherwise defined, the technical terms or scientific terms used herein should be understood by people with general skills in the field to which the present invention belongs. "Including" and similar words used in this article mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects.
[0024] In view of the problems existing in the prior art, an embodiment of the present invention provides a median sorting circuit with multi-channel input, comprising a grouping sorting module 10 and a median sorting screening module 20. The grouping sorting module 10 is used to group and sort the data at least 2k times, and remove part of the edge data when grouping and sorting for an even number of times, wherein the edge data is part of the data at the maximum value end and part of the data at the minimum value end in the sorted data, and k is an integer greater than or equal to 1; the median sorting screening module 20 is used to sort the data output by the grouping sorting module to obtain the target median data.
[0025] In some embodiments, when the number of channel inputs is less than or equal to 16, k=1, and the grouping and sorting module includes a first sorting module and a first sorting and filtering module, wherein the first sorting module is used to divide the data into two groups and perform the first sorting respectively; the first sorting and filtering module is used to take the two data at the maximum value end of each group of sorted data into the first group of data and the two data at the minimum value end into the second group of data, and sort them respectively, and then remove m data from the first group of data from large to small, and remove m data from the second group of data from small to large, where m is a natural number that is preset and greater than or equal to 1. Specifically, when the number of channel inputs is equal to 8, k=1, and m=2.
[0026] In some embodiments, the input data is 8-way, refer to Figure 2 The first sorting module includes two four-input first bubble sorting circuits 101, the first sorting screening module includes two four-input second bubble sorting circuits 201, the median sorting screening module includes a four-input third bubble sorting circuit 301 and a first output unit 302, the two first bubble sorting circuits 101 respectively input four-channel input data and output two groups of sorted data after sorting, the first output terminals and the second output terminals of the two first bubble sorting circuits 101 are electrically connected to the four input terminals of the first second bubble sorting circuit 201, the two first bubble sorting circuits The fourth output terminal and the third output terminal of 101 are both electrically connected to the four input terminals of the second second bubble sorting circuit 201, the fourth output terminal and the third output terminal of the first second bubble sorting circuit 201 are electrically connected to the two input terminals of the third bubble sorting circuit 301, the first output terminal and the second output terminal of the second second bubble sorting circuit 201 are electrically connected to the other two input terminals of the third bubble sorting circuit 301, and the second output terminal and the third output terminal of the third bubble sorting circuit 301 are both electrically connected to the first output unit 302 to output the target median data.
[0027] Furthermore, the first sorting module further includes eight first triggers 102, and the first sorting and screening module further includes four second triggers 202. Figure 2 In the figure, the eight first triggers 102 and the four second triggers 202 are represented by one trigger respectively, the fourth output terminal and the third output terminal of the two first bubble sorting circuits 101 are electrically connected to the four input terminals of the second second bubble sorting circuit 201 through one first trigger 102 respectively, the fourth output terminal and the third output terminal of the two first bubble sorting circuits 101 are electrically connected to the four input terminals of the second second bubble sorting circuit 201 through one first trigger 102 respectively, the fourth output terminal and the third output terminal of the first second bubble sorting circuit 201 are electrically connected to the two input terminals of the third bubble sorting circuit 301 through one second trigger 202 respectively, and the first output terminal and the second output terminal of the second second bubble sorting circuit 201 are electrically connected to the other two input terminals of the third bubble sorting circuit 301 through one second trigger 202 respectively.
[0028] In this embodiment, by adding a first trigger 102 between the output of the first bubble sort circuit 101 and the input of the second bubble sort circuit 201, and adding a second trigger 202 between the output of the second bubble sort circuit 201 and the input of the third bubble sort circuit 301, trigger beats are added between different levels to reduce glitches and timing problems that are prone to occur during circuit design.
[0029] Exemplarily, the 8-channel input data are ch1, ch2, ch3, ch4, ch5, ch6, ch7, and ch8, and the eight-channel input data are divided into two groups and input into the four input terminals of the two first bubble sorting circuits 101, that is, the data of the ch1, ch2, ch3, and ch4 channels are input into the first first bubble sorting circuit 101, and after passing through this circuit, the maximum value 1_1st, the second largest value 1_2st, the second smallest value 1_3st, and the minimum value 1_4st in the ch1, ch2, ch3, and ch4 channels are output. The input data of the ch5, ch6, ch7, and ch8 channels are input into the second first bubble sorting circuit 1001, and after passing through this circuit, the maximum value 2_1st, the second largest value 2_2st, the second smallest value 2_3st, and the minimum value 2_4st in the ch5, ch6, ch7, and ch8 channels are output. After obtaining the 8 data after preliminary sorting, firstly, the first trigger 102 is used to make a beat, and then 1_1st, 1_2st, 2_1st, and 2_2st are input to the first second bubble sort circuit 201, and 1_3st, 1_4st, 2_3st, and 2_4st are input to the second second bubble sort circuit 201. After re-sorting, the maximum value 1st and the second largest value 2st in the first second bubble sort circuit 201, and the second smallest value 3st and the smallest value 4st in the second second bubble sort circuit 201 are discarded. Finally, 4 data are left, which are re-input into a third bubble sort circuit 301 with 4 inputs. The 2st and 3st outputted by the third bubble sort circuit 301 are the medians of the 8-channel inputs.
[0030] In the above process, the total number of comparisons is 4×(3+2+1)=24 times, while the total number of comparisons directly using the traditional bubble sort method is (7+6+5+4+3+2+1)=28 times. Therefore, compared with the traditional bubble sort method, the present application effectively reduces the number of comparisons.
[0031] In some embodiments, when the number of channel inputs is less than or equal to 16, k=1, and the grouping and sorting module includes a first sorting module and a first sorting and filtering module, wherein the first sorting module is used to divide the data into four groups for first sorting respectively; the first sorting and filtering module is used to take the maximum value in each group of sorted data to form the first group of data, the second maximum value to form the second group of data, the second minimum value to form the third group of data, and the minimum value to form the fourth group of data, and sort the first group of data, the second group of data, the third group of data, and the fourth group of data respectively, and then remove m data from the first group of data from large to small, remove n data from the second group of data from large to small, remove n data from the third group of data from small to large, and remove m data from the fourth group of data from small to large, where m and n are pre-set natural numbers greater than or equal to 1. Specifically, when the number of channel inputs is equal to 16, k=1, m=2, and n=1.
[0032] In some embodiments, the input data is a 16-channel input, the first sorting module includes four fourth bubble sorting circuits 103 with four inputs, the first sorting and screening module includes four fifth bubble sorting circuits 203 with four inputs, the median sorting and screening module includes a sixth bubble sorting circuit 303 with ten inputs and a second output unit 304, the 16-channel input data is input to the four fourth bubble sorting circuits 103 in four groups, so that the 16-channel input data is sorted by the four fourth bubble sorting circuits 103 to obtain four groups of four-output sorted data, the first output ends of the four fourth bubble sorting circuits 103 are electrically connected to the four input ends of the first fifth bubble sorting circuit 203, and the second output ends of the four fourth bubble sorting circuits 103 are electrically connected to the four input ends of the second fifth bubble sorting circuit 203. The third output ends of the four fourth bubble sorting circuits 103 are electrically connected to the four input ends of the third fifth bubble sorting circuit 203, respectively; the fourth output ends of the four fourth bubble sorting circuits 103 are electrically connected to the four input ends of the fourth fifth bubble sorting circuit 203, respectively; the fourth output end and the third output end of the first fifth bubble sorting circuit 203, the second output end, the third output end and the fourth output end of the second fifth bubble sorting circuit 203, the first output end and the second output end of the third fifth bubble sorting circuit 203, and the first output end and the second output end of the fourth fifth bubble sorting circuit 203 are electrically connected to the input ends of the sixth bubble sorting circuit 303, respectively; the fifth output end and the sixth output end of the sixth bubble sorting circuit 303 are connected to the second output unit 304 to output the target median data.
[0033] Furthermore, the first sorting module further includes sixteen third triggers 104, and the first sorting and screening module further includes ten fourth triggers 204. Figure 3 In the embodiment, sixteen third triggers 104 and ten fourth triggers 204 are represented by one trigger respectively, and the first output terminals of the four fourth bubble sorting circuits 103 are electrically connected to the four input terminals of the first fifth bubble sorting circuit 203 through one third trigger 104 respectively, and the second output terminals of the four fourth bubble sorting circuits 103 are electrically connected to the four input terminals of the second fifth bubble sorting circuit 203 through one third trigger 104 respectively, and the third output terminals of the four fourth bubble sorting circuits 103 are electrically connected to the four input terminals of the third fifth bubble sorting circuit 203 through one third trigger 104 respectively. The fourth output terminals of the four fourth bubble sorting circuits 103 are electrically connected to the four input terminals of the fourth fifth bubble sorting circuit 203 through a third trigger 104, respectively; the fourth output terminal and the third output terminal of the first fifth bubble sorting circuit 203, the second output terminal, the third output terminal and the fourth output terminal of the second fifth bubble sorting circuit 203, the first output terminal and the second output terminal of the third fifth bubble sorting circuit 203, and the first output terminal and the second output terminal of the fourth fifth bubble sorting circuit 203 are electrically connected to the input terminals of the sixth bubble sorting circuit 303 through a fourth trigger 204, respectively.
[0034] In this embodiment, by adding a third trigger 104 between the output of the fourth bubble sort circuit 103 and the input of the fifth bubble sort circuit 203, and adding a fourth trigger 204 between the output of the fifth bubble sort circuit 203 and the input of the sixth bubble sort circuit 303, trigger beats are added between different levels to reduce glitches and timing problems that are prone to occur during circuit design.
[0035] Exemplarily, when the input data is 16-channel input, the data are the input data of channels ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8, ch9, ch10, ch11, ch12, ch13, ch14, ch15, and ch16, respectively. The data are divided into four groups and input into four fourth bubble sorting circuits 103 respectively. The data of channels ch1, ch2, ch3, and ch4 are input into the first fourth bubble sorting circuit 103. After passing through this circuit, the maximum value 1_1st, the second largest value 1_2st, the second smallest value 1_3st, and the minimum value 1_4st in channels ch1, ch2, ch3, and ch4 are output. The data of channels ch5, ch6, ch7, and ch8 are input into the second fourth bubble sorting circuit 103. After passing through this circuit, the maximum value 2_1st, the second largest value 2_2st, the second smallest value 2_3st, and the minimum value 2_4st in channels ch5, ch6, ch7, and ch8 are output. The data of channels ch9, ch10, ch11, and ch12 are input to the third fourth bubble sort circuit 103. After passing through this circuit, the maximum value 1_1st, the second largest value 1_2st, the second smallest value 1_3st, and the minimum value 1_4st in channels ch9, ch10, ch11, and ch12 are output. The data of channels ch13, ch14, ch15, and ch16 are input to the fourth fourth bubble sort circuit 103. After passing through this circuit, the maximum value 1_1st, the second largest value 1_2st, the second smallest value 1_3st, and the minimum value 1_4st in channels ch13, ch14, ch15, and ch16 are output. The 16 data after the initial sorting will be triggered by the third trigger 104, and then 1_1st, 2_1st, 3_1st, and 4_1st will be input into the first fifth bubble sort circuit 203, 1_2st, 2_2st, 3_2st, and 4_2st will be input into the second fifth bubble sort circuit 203, 1_3st, 2_3st, 3_3st, and 4_3st will be input into the third fifth bubble sort circuit 203, and 1_4st, 2_4st, 3_4st, and 4_4st will be input into the fourth fifth bubble sort circuit 203.When 16 channels are input, the median is at the 8th and 9th positions, so the median is greater than 8 numbers at most and less than 8 numbers at most. The 1st output of the first fifth bubble sort circuit 203 is greater than 3×4+3=15 numbers and the 2st is greater than 2×4+3=11 numbers, the 1st output of the second fifth bubble sort circuit 203 is greater than 2×3+3=9 numbers, the 4st output of the third fifth bubble sort circuit 203 is less than 2×3+3=9 numbers, the 3st output of the fourth fifth bubble sort circuit 203 is less than 2×4+3=11 numbers and the 4st is less than 3×4+3=15 numbers, so they are all discarded, leaving 10 data. After the fourth trigger 204 is triggered, these ten data are re-input into a 10-input sixth bubble sort circuit 303, and the 5st and 6st outputs of the sixth bubble sort circuit 303 are the final medians.
[0036] The final median is obtained in the above manner, and the total number of comparisons is 8×(3+2+1)+(9+8+7+6+5+4+3+2+1)=93 times, while the total number of comparisons of the traditional bubble sort method is (15+14+13+12+11+10+9+8+7+6+5+4+3+2+1)=120 times. Compared with the traditional bubble sort, this scheme significantly reduces the number of comparisons.
[0037] In some embodiments, when the number of channel inputs is greater than 16 and less than or equal to 32, k=2, and the grouping and sorting module includes a first sorting module, a first sorting and screening module, a second sorting module, and a second sorting and screening module, wherein the first sorting module is used to divide the data into four groups for the first sorting respectively; the first sorting and screening module is used to take the data in each group of data from large to small and sorted in the same position to form a first group of data, a second group of data, a third group of data, a fourth group of data, a fifth group of data, a sixth group of data, a seventh group of data, and an eighth group of data, and sort them respectively, and then remove the maximum value and the second maximum value of the first group of data, the maximum value and the second maximum value of the second group of data, the maximum value and the second maximum value of the third group of data, the maximum value of the fourth group of data, the minimum value of the fifth group of data, the minimum value and the second minimum value of the sixth group of data, the minimum value and the second minimum value of the seventh group of data, and the minimum value of the eighth group of data. The second sorting module is used to divide the remaining data of the first group of data, the second group of data, the third group of data, the fourth group of data, the fifth group of data, the sixth group of data, the seventh group of data and the eighth group of data into three groups for the third sorting respectively; the second sorting and screening module is used to take the data from each group of data from large to small and sorted in the same position to form the ninth group of data, the tenth group of data, the eleventh group of data, the twelfth group of data, the thirteenth group of data and the fourteenth group of data, and sort them respectively, and then remove m data from the ninth group of data from large to small, remove n data from the tenth group of data from large to small, remove x data from the eleventh group of data from large to small, remove x data from the twelfth group of data from small to large, remove n data from the thirteenth group of data from small to large, and remove m data from the fourteenth group of data from small to large, where m, n and x are pre-set natural numbers greater than or equal to 1. Specifically, when the number of channel inputs is equal to 32, k=2, m=2, n=1, and x=1.
[0038] In some embodiments, the input data is a 32-channel input, the first sorting module includes four eight-input seventh bubble sorting circuits 105, the first sorting and screening module includes eight four-input eighth bubble sorting circuits 205, the second sorting module includes three six-input ninth bubble sorting circuits 206, the second sorting and screening module includes six three-input tenth bubble sorting circuits 207, the median sorting and screening module includes a ten-input eleventh bubble sorting circuit 305 and a third output unit 306, the 32-channel input data is respectively input to the input ends of the four seventh bubble sorting circuits 105 for sorting to obtain four groups of sorted data, and the first output ends of the four seventh bubble sorting circuits 105 are respectively The fourth output terminals of the four seventh bubble sorting circuits 105 are electrically connected to the four input terminals of the fourth eighth bubble sorting circuit 205, the fifth output terminals of the four seventh bubble sorting circuits 105 are electrically connected to the four input terminals of the fifth eighth bubble sorting circuit 205, and the sixth output terminals of the four seventh bubble sorting circuits 105 are electrically connected to the four input terminals of the fifth eighth bubble sorting circuit 205. The seventh output terminals of the four seventh bubble sorting circuits 105 are respectively electrically connected to the four input terminals of the seventh eighth bubble sorting circuit 205, the eighth output terminals of the four seventh bubble sorting circuits 105 are respectively electrically connected to the four input terminals of the eighth eighth bubble sorting circuit 205, the third output terminal and the fourth output terminal of the first eighth bubble sorting circuit 205, the third output terminal and the fourth output terminal of the second eighth bubble sorting circuit 205, the third output terminal and the fourth output terminal of the third eighth bubble sorting circuit 205, the second output terminal, the third output terminal and the fourth output terminal of the fourth eighth bubble sorting circuit 205 , the first output end, the second output end and the third output end of the fifth eighth bubble sort circuit 205, the first output end and the second output end of the sixth eighth bubble sort circuit 205, the first output end and the second output end of the seventh eighth bubble sort circuit 205, and the first output end and the second output end of the eighth eighth bubble sort circuit 205 are electrically connected to the input ends of the three ninth bubble sort circuits 206 for sorting, the first output ends of the three ninth bubble sort circuits 206 are electrically connected to the input end of the first tenth bubble sort circuit 207, and the second output ends of the three ninth bubble sort circuits 206 are electrically connected to the input end of the second tenth bubble sort circuit 207, respectively.The third output terminals of the three ninth bubble sorting circuits 206 are respectively electrically connected to the input terminal of the third tenth bubble sorting circuit 207, the fourth output terminals of the three ninth bubble sorting circuits 206 are respectively electrically connected to the input terminal of the fourth tenth bubble sorting circuit 207, the fifth output terminals of the three ninth bubble sorting circuits 206 are respectively electrically connected to the input terminal of the fifth tenth bubble sorting circuit 207, and the sixth output terminals of the three ninth bubble sorting circuits 206 are respectively electrically connected to the input terminal of the sixth tenth bubble sorting circuit 207. The third output terminal of the first tenth bubble sort circuit 207, the second output terminal and the third output terminal of the second and third tenth bubble sort circuits 207, the first output terminal and the second output terminal of the fourth and fifth tenth bubble sort circuits 207, and the first output terminal of the sixth tenth bubble sort circuit 207 are electrically connected to the input terminal of the eleventh bubble sort circuit 305, respectively, and the fifth output terminal and the sixth output terminal of the eleventh bubble sort circuit 305 are electrically connected to the third output unit 306 to output the target median data.
[0039] Furthermore, the first sorting module further includes 32 fifth triggers 106, and the first sorting and screening module further includes 18 sixth triggers 208, 18 seventh triggers 209 and 10 eighth triggers 210. Figure 4In the embodiment, 32 fifth flip-flops 106, eight sixth flip-flops 208, eighteen seventh flip-flops 209 and ten eighth flip-flops 210 are respectively represented by only one flip-flop, and the first output ends of the four seventh bubble sorting circuits 105 are respectively electrically connected to the four input ends of the first eighth bubble sorting circuit 205 through one fifth flip-flop 106, the second output ends of the four seventh bubble sorting circuits 105 are respectively electrically connected to the four input ends of the second eighth bubble sorting circuit 205 through one fifth flip-flop 106, and the third output ends of the four seventh bubble sorting circuits 105 are respectively electrically connected to the four input ends of the third eighth bubble sorting circuit 205 through one fifth flip-flop 106. The fourth output terminals of the four seventh bubble sorting circuits 105 are electrically connected to the four input terminals of the fourth eighth bubble sorting circuit 205 through one of the fifth triggers 106, the fifth output terminals of the four seventh bubble sorting circuits 105 are electrically connected to the four input terminals of the fifth eighth bubble sorting circuit 205 through one of the fifth triggers 106, the sixth output terminals of the four seventh bubble sorting circuits 105 are electrically connected to the four input terminals of the sixth eighth bubble sorting circuit 205 through one of the fifth triggers 106, the seventh output terminals of the four seventh bubble sorting circuits 105 are electrically connected to the seventh eighth bubble sorting circuit 205 through one of the fifth triggers 106, The fourth input terminal of the seventh bubble sorting circuit 205 is electrically connected to the fourth input terminal of the eighth bubble sorting circuit 205, the eighth output terminals of the four seventh bubble sorting circuits 105 are electrically connected to the four input terminals of the eighth bubble sorting circuit 205 through the fifth trigger 106, the third output terminal and the fourth output terminal of the first eighth bubble sorting circuit 205, the third output terminal and the fourth output terminal of the second eighth bubble sorting circuit 205, the third output terminal and the fourth output terminal of the third eighth bubble sorting circuit 205, the second output terminal, the third output terminal and the fourth output terminal of the fourth eighth bubble sorting circuit 205, the first output terminal, the second output terminal and the third output terminal of the fifth eighth bubble sorting circuit 205, the sixth eighth bubble sorting circuit 205, the eighth output terminal and the fourth output terminal of the sixth eighth bubble sorting circuit 205, the eighth output terminal and the fourth output terminal of the fourth eighth bubble sorting circuit 205, the eighth output terminal and the fourth output terminal of the fifth ... fifth eighth bubble sorting circuit 205, the eighth output terminal and the fourth output terminal of the fifth eighth bubble sorting circuit 205, the eighth output terminal and the fourth output terminal of the fifth eighth bubble sorting circuit 205, the eighth output terminal and the fourth output terminal of the fourth eighth bubble sorting circuit 205, the eighth output terminal and the fourth output terminal of the fifth eighth bubble sorting circuit 205, the eighth output terminal and the fourth output terminal of the fifth eighth The first output end and the second output end of the bubble sorting circuit 205, the first output end and the second output end of the seventh eighth bubble sorting circuit 205, and the first output end and the second output end of the eighth eighth bubble sorting circuit 205 are respectively electrically connected to the input ends of the three ninth bubble sorting circuits 206 through a sixth trigger 208 for sorting, the first output ends of the three ninth bubble sorting circuits 206 are respectively electrically connected to the input end of the first tenth bubble sorting circuit 207 through a seventh trigger 209, and the second output ends of the three ninth bubble sorting circuits 206 are respectively electrically connected to the input end of the second tenth bubble sorting circuit 207 through a seventh trigger 209.The third output terminals of the three ninth bubble sorting circuits 206 are electrically connected to the input terminal of the third tenth bubble sorting circuit 207 through one of the seventh triggers 209, the fourth output terminals of the three ninth bubble sorting circuits 206 are electrically connected to the input terminal of the fourth tenth bubble sorting circuit 207 through one of the seventh triggers 209, the fifth output terminals of the three ninth bubble sorting circuits 206 are electrically connected to the input terminal of the fifth tenth bubble sorting circuit 207 through one of the seventh triggers 209, and the third ninth bubble sorting circuits 206 are electrically connected to the input terminal of the fifth tenth bubble sorting circuit 207 through one of the seventh triggers 209. The sixth output terminal of the tenth bubble sorting circuit 206 is electrically connected to the input terminal of the sixth tenth bubble sorting circuit 207 through a seventh trigger 209, the third output terminal of the first tenth bubble sorting circuit 207, the second output terminal and the third output terminal of the second and third tenth bubble sorting circuits 207, the first output terminal and the second output terminal of the fourth and fifth tenth bubble sorting circuits 207, and the first output terminal of the sixth tenth bubble sorting circuit 207 are electrically connected to the input terminal of the eleventh bubble sorting circuit 305 through an eighth trigger 210.
[0040] By adding a fifth trigger 106 between the output end of the seventh bubble sort circuit 105 and the input end of the eighth bubble sort circuit 205, adding a sixth trigger 208 between the output end of the eighth bubble sort circuit 205 and the input end of the ninth bubble sort circuit 206, adding a seventh trigger 209 between the output end of the ninth bubble sort circuit 206 and the input end of the tenth bubble sort circuit 207, and adding an eighth trigger 210 between the output end of the tenth bubble sort circuit 207 and the input end of the eleventh bubble sort circuit 305, it is convenient to add trigger beats between different levels, thereby reducing glitches and timing problems that are prone to occur in the circuit design process.
[0041] For example, when the input data is 32-channel input, they are ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8, ch9, ch10, ch11, ch12, ch13, ch14, ch15, ch16, ch17, ch18, ch19, ch20, ch21, ch22, ch23, ch24, ch25, ch26, ch27, ch28, ch29, ch30, ch31, The input data of channel ch32 is divided into four groups. The data of channels ch1, ch2, ch3, ch4, ch5, ch6, ch7, and ch8 are input to the first seventh bubble sort circuit 105. After passing through this circuit, 1_1st, 1_2st, 1_3st, 1_4st, 1_5st, 1_6st, 1_7st, and 1_8st of channels ch1, ch2, ch3, ch4, ch5, ch6, ch7, and ch8 are output. The data of channels ch9, ch10, ch11, ch12, ch13, ch14, ch15, and ch16 are input to the second seventh bubble sort circuit 105, and after passing through this circuit, 2_1st, 2_2st, 2_3st, 2_4st, 2_5st, 2_6st, 2_7st, and 2_8st in channels ch9, ch10, ch11, ch12, ch13, ch14, ch15, and ch16 are output. The data of channels ch17, ch18, ch19, ch20, ch21, ch22, ch23, and ch24 are input to the third seventh bubble sort circuit 105, and after passing through this circuit, 3_1st, 3_2st, 3_3st, 3_4st, 3_5st, 3_6st, 3_7st, and 3_8st in channels ch17, ch18, ch19, ch20, ch21, ch22, ch23, and ch24 are output. The data of channels ch25, ch26, ch27, ch28, ch29, ch30, ch31, and ch32 are input to the fourth seventh bubble sort circuit 105, and after passing through this circuit, 4_1st, 4_2st, 4_3st, 4_4st, 4_5st, 4_6st, 4_7st, and 4_8st in channels ch25, ch26, ch27, ch28, ch29, ch30, ch31, and ch32 are output.The 32 data after the initial sorting will be hit by the fifth trigger 106, and then 1_1st, 2_1st, 3_1st, and 4_1st are input to the first eighth bubble sort circuit 205, 1_2st, 2_2st, 3_2st, and 4_2st are input to the second eighth bubble sort circuit 205, 1_3st, 2_3st, 3_3st, and 4_3st are input to the third eighth bubble sort circuit 205, 1_4st, 2_4st, 3_4st, and 4_4st are input to the fourth eighth bubble sort circuit 205, and 1_5st, 2_5st, 3_5st, and 4_5st are input to the fourth eighth bubble sort circuit 205. 4_5st is input to the fifth eighth bubble sort circuit 205, 1_6st, 2_6st, 3_6st, and 4_6st are input to the sixth eighth bubble sort circuit 205, 1_7st, 2_7st, 3_7st, and 4_7st are input to the seventh eighth bubble sort circuit 205, and 1_8st, 2_8st, 3_8st, and 4_8st are input to the eighth eighth bubble sort circuit 205. When 32 channels are input, the median is at the 16th and 17th positions, so the median is at most greater than 16 numbers and at most less than 16 numbers, which is similar to the principle of discarding 16 channels above, and will not be repeated here. Therefore, part of the data will be discarded, leaving 18 data. These 18 data are divided into 3 groups after the sixth trigger 208 is triggered, and are input into a 6-input ninth bubble sort circuit 206 respectively. Then, after being sorted by 6 three-input tenth bubble sort circuits 207, part of the data is discarded and input into a 10-input eleventh bubble sort circuit 305. The final outputs 5st and 6st are the final medians.
[0042] The final median is obtained by the above method, and the total number of comparisons is:
[0043] 4×(7+6+5+4+3+2+1)+8×(3+2+1)+3×(5+4+3+2+1)+6×(2+1)+(9+8+7+6+5+4+3+2+1)=268 times;
[0044] The total number of comparisons for the bubble sort method is:
[0045] (31+30+29+28+27+26+25+24+23+22+21+20+19+18+17+1615+14+13+12+11+10+9+8+7+6+5+4+3+2+1)=496 times,
[0046] Therefore, compared with the bubble sort, the present application scheme significantly reduces the number of comparisons during median sorting, which is beneficial to reducing circuit power consumption and chip area.
[0047] It should be noted that, for the above-mentioned bubble sort circuit, the data output from the first output terminal to the last output terminal are arranged in descending order, which will not be described in detail here.
[0048] Although the embodiments of the present invention are described in detail above, it is obvious to those skilled in the art that various modifications and variations can be made to these embodiments. However, it should be understood that such modifications and variations are within the scope and spirit of the present invention as described in the claims. Moreover, the present invention described herein may have other embodiments and may be implemented or realized in a variety of ways.
Claims
1. A median sorting circuit for multi-channel input, characterized in that: include: A grouping and sorting module, used to group and sort the data at least 2k times, and remove some edge data when grouping and sorting for an even number of times, wherein the edge data is part of the data at one end of the maximum value and part of the data at one end of the minimum value in the sorted data, and k is an integer greater than or equal to 1; as well as The median sorting and screening module is used to sort the data output by the grouping and sorting module to obtain target median data.
2. The median sorting circuit for multi-channel input according to claim 1, characterized in that: When the number of channel inputs is less than or equal to 16, k=1.
3. The median sorting circuit for multi-channel input according to claim 2, characterized in that: The grouping and sorting module includes a first sorting module and a first sorting and filtering module, wherein the first sorting module is used to divide the data into two groups and perform the first sorting respectively; the first sorting and filtering module is used to take the two data at one end of the maximum value in each group of sorted data into the first group of data and the two data at one end of the minimum value into the second group of data, and sort them respectively, and then remove m data from the first group of data from large to small, and remove m data from the second group of data from small to large, where m is a pre-set natural number greater than or equal to 1.
4. The median sorting circuit for multi-channel input according to claim 3, characterized in that: The first sorting module includes two first bubble sorting circuits with four inputs, the first sorting and screening module includes two second bubble sorting circuits with four inputs, the median sorting and screening module includes a third bubble sorting circuit with four inputs and a first output unit, the two first bubble sorting circuits respectively input four-channel input data and output two groups of sorted data after sorting, the first output end and the second output end of the two first bubble sorting circuits are both electrically connected to the four input ends of the first second bubble sorting circuit, the fourth output end and the third output end of the two first bubble sorting circuits are both electrically connected to the four input ends of the second second bubble sorting circuit, the fourth output end and the third output end of the first second bubble sorting circuit are electrically connected to the two input ends of the third bubble sorting circuit, the first output end and the second output end of the second second bubble sorting circuit are electrically connected to the other two input ends of the third bubble sorting circuit, and the second output end and the third output end of the third bubble sorting circuit are both electrically connected to the first output unit to output the target median data.
5. The median sorting circuit for multi-channel input according to claim 4, characterized in that: The first sorting module also includes eight first triggers, and the first sorting and screening module also includes four second triggers. The fourth output terminal and the third output terminal of two of the first bubble sorting circuits are respectively electrically connected to the four input terminals of the second of the second bubble sorting circuits through one of the first triggers, the fourth output terminal and the third output terminal of two of the first bubble sorting circuits are respectively electrically connected to the four input terminals of the second of the second bubble sorting circuits through one of the first triggers, the fourth output terminal and the third output terminal of the first of the second bubble sorting circuits are respectively electrically connected to the two input terminals of the third bubble sorting circuit through one of the second triggers, and the first output terminal and the second output terminal of the second of the second bubble sorting circuit are respectively electrically connected to the other two input terminals of the third bubble sorting circuit through one of the second triggers.
6. The median sorting circuit for multi-channel input according to claim 2, characterized in that: The grouping and sorting module includes a first sorting module and a first sorting and filtering module, wherein the first sorting module is used to divide the data into four groups for first sorting respectively; the first sorting and filtering module is used to take the maximum value in each group of sorted data to form a first group of data, the second maximum value to form a second group of data, the second minimum value to form a third group of data and the minimum value to form a fourth group of data, sort the first group of data, the second group of data, the third group of data and the fourth group of data respectively, and then remove m data from the first group of data from large to small, remove n data from the second group of data from large to small, remove n data from the third group of data from small to large, and remove m data from the fourth group of data from small to large, where m and n are pre-set natural numbers greater than or equal to 1.
7. The median sorting circuit for multi-channel input according to claim 6, characterized in that: The first sorting module includes four fourth bubble sorting circuits with four inputs, the first sorting screening module includes four fifth bubble sorting circuits with four inputs, the median sorting screening module includes a sixth bubble sorting circuit with ten inputs and a second output unit, 16-channel input data are respectively input into the four fourth bubble sorting circuits in four groups, so that the 16-channel input data are sorted by the four fourth bubble sorting circuits to obtain four groups of four-output sorted data, the first output ends of the four fourth bubble sorting circuits are respectively electrically connected to the four input ends of the first fifth bubble sorting circuit, the second output ends of the four fourth bubble sorting circuits are respectively electrically connected to the four input ends of the second fifth bubble sorting circuit, the four fourth bubble sorting circuits are respectively electrically connected to the four input ends of the second fifth bubble sorting circuit, The third output end of the sorting circuit is electrically connected to the four input ends of the third fifth bubble sorting circuit respectively, the fourth output ends of the four fourth bubble sorting circuits are electrically connected to the four input ends of the fourth fifth bubble sorting circuit respectively, the fourth output end and the third output end of the first fifth bubble sorting circuit, the second output end, the third output end and the fourth output end of the second fifth bubble sorting circuit, the first output end and the second output end of the third fifth bubble sorting circuit, and the first output end and the second output end of the fourth fifth bubble sorting circuit are electrically connected to the input ends of the sixth bubble sorting circuit respectively, and the fifth output end and the sixth output end of the sixth bubble sorting circuit are connected to the second output unit to output the target median data.
8. The median sorting circuit for multi-channel input according to claim 7, characterized in that: The first sorting module also includes sixteen third triggers, and the first sorting and screening module also includes ten fourth triggers. The first output ends of the four fourth bubble sorting circuits are electrically connected to the four input ends of the first fifth bubble sorting circuit through one of the third triggers, respectively. The second output ends of the four fourth bubble sorting circuits are electrically connected to the four input ends of the second fifth bubble sorting circuit through one of the third triggers, respectively. The third output ends of the four fourth bubble sorting circuits are electrically connected to the four input ends of the third fifth bubble sorting circuit through one of the third triggers, respectively. The fourth output ends of the four fourth bubble sorting circuits are electrically connected to the four input ends of the fourth fifth bubble sorting circuit through one of the third triggers, respectively. The fourth output end and the third output end of the first fifth bubble sorting circuit, the second output end, the third output end and the fourth output end of the second fifth bubble sorting circuit, the first output end and the second output end of the third fifth bubble sorting circuit, and the first output end and the second output end of the fourth fifth bubble sorting circuit are electrically connected to the input end of the sixth bubble sorting circuit through one of the fourth triggers.
9. The median sorting circuit for multi-channel input according to claim 1, characterized in that: When the number of channel inputs is greater than 16 and less than or equal to 32, k=2.
10. The median sorting circuit for multi-channel input according to claim 9, characterized in that: The grouping and sorting module includes a first sorting module, a first sorting and screening module, a second sorting module and a second sorting and screening module, wherein the first sorting module is used to divide the data into four groups for first sorting respectively; the first sorting and screening module is used to take the data in each group of data from large to small and sorted in the same position to form a first group of data, a second group of data, a third group of data, a fourth group of data, a fifth group of data, a sixth group of data, a seventh group of data and an eighth group of data respectively, and sort them respectively, and then remove the maximum value and the second maximum value of the first group of data, the maximum value and the second maximum value of the second group of data, the maximum value and the second maximum value of the third group of data, the maximum value of the fourth group of data, the minimum value of the fifth group of data, the minimum value and the second minimum value of the sixth group of data, the minimum value and the second minimum value of the seventh group of data, and the minimum value and the second minimum value of the eighth group of data; The second sorting module is used to divide the remaining data of the first group of data, the second group of data, the third group of data, the fourth group of data, the fifth group of data, the sixth group of data, the seventh group of data and the eighth group of data into three groups and sort them for the third time respectively; the second sorting and screening module is used to take the data from each group of data from large to small and sorted in the same position to form a ninth group of data, a tenth group of data, an eleventh group of data, a twelfth group of data, a thirteenth group of data and a fourteenth group of data respectively, and sort them respectively, and then remove m data from the ninth group of data from large to small, remove n data from the tenth group of data from large to small, remove x data from the eleventh group of data from large to small, remove x data from the twelfth group of data from small to large, remove n data from the thirteenth group of data from small to large, and remove m data from the fourteenth group of data from small to large, where m, n and x are pre-set natural numbers greater than or equal to 1.
11. The median sorting circuit for multi-channel input according to claim 10, characterized in that: The first sorting module includes four seventh bubble sorting circuits with eight inputs, the first sorting and screening module includes eight eighth bubble sorting circuits with four inputs, the second sorting module includes three ninth bubble sorting circuits with six inputs, the second sorting and screening module includes six tenth bubble sorting circuits with three inputs, the median sorting and screening module includes an eleventh bubble sorting circuit with ten inputs and a third output unit, 32-channel input data are respectively input to the input ends of the four seventh bubble sorting circuits for sorting to obtain four groups of sorted data, the first output ends of the four seventh bubble sorting circuits are respectively electrically connected to the four input ends of the first eighth bubble sorting circuit, the second output ends of the four seventh bubble sorting circuits are respectively electrically connected to the second The four input terminals of the fourth bubble sorting circuit are electrically connected to the four input terminals of the third bubble sorting circuit, the third output terminals of the fourth bubble sorting circuit are electrically connected to the four input terminals of the fourth bubble sorting circuit, the fifth output terminals of the fourth bubble sorting circuit are electrically connected to the four input terminals of the fifth bubble sorting circuit, the sixth output terminals of the fourth bubble sorting circuit are electrically connected to the four input terminals of the sixth bubble sorting circuit, the seventh output terminals of the four seventh bubble sorting circuits are electrically connected to the four input terminals of the seventh bubble sorting circuit, and the fourth output terminals of the fourth bubble sorting circuit are electrically connected to the four input terminals of the fourth bubble sorting circuit. The eighth output end of the bubble sort circuit is electrically connected to the four input ends of the eighth bubble sort circuit, the third output end and the fourth output end of the first eighth bubble sort circuit, the third output end and the fourth output end of the second eighth bubble sort circuit, the third output end and the fourth output end of the third eighth bubble sort circuit, the second output end, the third output end and the fourth output end of the fourth eighth bubble sort circuit, the first output end, the second output end and the third output end of the fifth eighth bubble sort circuit, the first output end and the second output end of the sixth eighth bubble sort circuit, the first output end and the second output end of the seventh eighth bubble sort circuit, the first output end and the second output end of the eighth eighth bubble sort circuit, the The first output end and the second output end are electrically connected to the input ends of the three ninth bubble sorting circuits for sorting, the first output ends of the three ninth bubble sorting circuits are electrically connected to the input end of the first tenth bubble sorting circuit, the second output ends of the three ninth bubble sorting circuits are electrically connected to the input end of the second tenth bubble sorting circuit, the third output ends of the three ninth bubble sorting circuits are electrically connected to the input end of the third tenth bubble sorting circuit, the fourth output ends of the three ninth bubble sorting circuits are electrically connected to the input end of the fourth tenth bubble sorting circuit, and the fifth output ends of the three ninth bubble sorting circuits are electrically connected to the input end of the fifth tenth bubble sorting circuit.The sixth output terminals of the three ninth bubble sorting circuits are electrically connected to the input terminal of the sixth tenth bubble sorting circuit, respectively; the third output terminal of the first tenth bubble sorting circuit, the second output terminal and the third output terminal of the second and third tenth bubble sorting circuits, the first output terminal and the second output terminal of the fourth and fifth tenth bubble sorting circuits, and the first output terminal of the sixth tenth bubble sorting circuit are electrically connected to the input terminal of the eleventh bubble sorting circuit, respectively; the fifth output terminal and the sixth output terminal of the eleventh bubble sorting circuit are electrically connected to the third output unit to output the target median data.
12. The median sorting circuit for multi-channel input according to claim 11, characterized in that: The first sorting module also includes 32 fifth triggers, the first sorting and screening module also includes eighteen sixth triggers, eighteen seventh triggers and ten eighth triggers, the first output ends of the four seventh bubble sorting circuits are respectively electrically connected to the four input ends of the first eighth bubble sorting circuit through one fifth trigger, the second output ends of the four seventh bubble sorting circuits are respectively electrically connected to the four input ends of the second eighth bubble sorting circuit through one fifth trigger, the third output ends of the four seventh bubble sorting circuits are respectively electrically connected to the four input ends of the third eighth bubble sorting circuit through one fifth trigger, and the fourth output ends of the four seventh bubble sorting circuits are respectively electrically connected to the four input ends of the third eighth bubble sorting circuit through one fifth trigger. The fourth bubble sorting circuit is electrically connected to the four input terminals of the fourth bubble sorting circuit through one of the fifth triggers, the fifth output terminals of the four seventh bubble sorting circuits are electrically connected to the four input terminals of the fifth bubble sorting circuit through one of the fifth triggers, the sixth output terminals of the four seventh bubble sorting circuits are electrically connected to the four input terminals of the sixth bubble sorting circuit through one of the fifth triggers, the seventh output terminals of the four seventh bubble sorting circuits are electrically connected to the four input terminals of the seventh bubble sorting circuit through one of the fifth triggers, and the eighth output terminals of the four seventh bubble sorting circuits are electrically connected to the eighth bubble sorting circuit through one of the fifth triggers. The four input terminals of the sorting circuit are electrically connected, and the third output terminal and the fourth output terminal of the first eighth bubble sorting circuit, the third output terminal and the fourth output terminal of the second eighth bubble sorting circuit, the third output terminal and the fourth output terminal of the third eighth bubble sorting circuit, the second output terminal, the third output terminal and the fourth output terminal of the fourth eighth bubble sorting circuit, the first output terminal, the second output terminal and the third output terminal of the fifth eighth bubble sorting circuit, the first output terminal and the second output terminal of the sixth eighth bubble sorting circuit, the first output terminal and the second output terminal of the seventh eighth bubble sorting circuit, and the first output terminal and the second output terminal of the eighth eighth bubble sorting circuit are respectively connected through one of the sixth output terminals. The trigger is electrically connected to the input end of the three ninth bubble sorting circuits for sorting, the first output ends of the three ninth bubble sorting circuits are electrically connected to the input end of the first tenth bubble sorting circuit through one seventh trigger, the second output ends of the three ninth bubble sorting circuits are electrically connected to the input end of the second tenth bubble sorting circuit through one seventh trigger, the third output ends of the three ninth bubble sorting circuits are electrically connected to the input end of the third tenth bubble sorting circuit through one seventh trigger, and the fourth output ends of the three ninth bubble sorting circuits are electrically connected to the input end of the fourth tenth bubble sorting circuit through one seventh trigger.The fifth output terminals of the three ninth bubble sorting circuits are electrically connected to the input terminal of the fifth tenth bubble sorting circuit through one seventh trigger, the sixth output terminals of the three ninth bubble sorting circuits are electrically connected to the input terminal of the sixth tenth bubble sorting circuit through one seventh trigger, the third output terminal of the first tenth bubble sorting circuit, the second output terminal and the third output terminal of the second and third tenth bubble sorting circuits, the first output terminal and the second output terminal of the fourth and fifth tenth bubble sorting circuits, and the first output terminal of the sixth tenth bubble sorting circuit are electrically connected to the input terminal of the eleventh bubble sorting circuit through one eighth trigger.