[go: up one dir, main page]

WO2009082852A1 - Data sorting device for processing communication data - Google Patents

Data sorting device for processing communication data Download PDF

Info

Publication number
WO2009082852A1
WO2009082852A1 PCT/CN2007/003883 CN2007003883W WO2009082852A1 WO 2009082852 A1 WO2009082852 A1 WO 2009082852A1 CN 2007003883 W CN2007003883 W CN 2007003883W WO 2009082852 A1 WO2009082852 A1 WO 2009082852A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
input
register
output
communication data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2007/003883
Other languages
French (fr)
Chinese (zh)
Inventor
Tianliang Sun
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by ZTE Corp filed Critical ZTE Corp
Priority to PCT/CN2007/003883 priority Critical patent/WO2009082852A1/en
Publication of WO2009082852A1 publication Critical patent/WO2009082852A1/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/22Arrangements for sorting or merging computer data on continuous record carriers, e.g. tape, drum, disc
    • G06F7/24Sorting, i.e. extracting data from one or more carriers, rearranging the data in numerical or other ordered sequence, and rerecording the sorted data on the original carrier or on a different carrier or set of carriers sorting methods in general

Definitions

  • the present invention relates to the field of communications, and in particular to a data sorting apparatus for processing communication data.
  • BACKGROUND OF THE INVENTION Sorting operations are common operations in various algorithms. The sorting operation is usually programmed in software and then implemented on a general purpose computing device. However, in the process of implementing the present invention, the inventors have found that at least the following problems exist in the prior art: The software implementation is serial processing, and even if the CPU operates at a higher frequency, the sorting operation still takes a lot of time.
  • the method is (1) taking the first input data as the current maximum value; (2) taking the next input data. Compared with the current maximum value, if the next input data is greater than the current maximum value, the next input data becomes the current maximum value; (3) repeat step 2 until all input data is processed; (4) the current maximum value is The input data is removed; (5) Steps 1 to 4 are repeated until m maximum values are found.
  • the m maximum values have been sorted in descending order of order, and the maximum value found for the first time is m values. The biggest one.
  • the above sorting operation is to sort all input data.
  • the number of clock cycles occupied by the software implementation of the sort operation is proportional to the factorial of n.
  • the time taken by the sorting operation is particularly significant. Real-time signal processing requires high real-time performance.
  • the sorting operation using the above techniques cannot meet the real-time requirements of real-time signal processing for data processing.
  • the current maximum or smaller is used as the new current minimum value, and the output is compared to the comparator for comparison;
  • the second register is used to save the smaller or larger one, and is output to the next-level data comparison unit; the output processing state machine And sequentially outputting the current maximum value or the current minimum value in the m cascaded data comparison units to obtain m
  • the communication data is from a queue
  • the input processing state machine includes: a first reader for sequentially reading communication data from the queue; and a counter for counting each time a communication data is retrieved from the queue, When n is counted, a full signal is issued; a first monitor for monitoring the full signal, the first read unit is disabled; and a first outputter for sequentially outputting the communication data to the first level data comparison unit.
  • the queue is a first in first out queue.
  • the selector comprises: two two-select multiplexers, comprising: a first two-select multiplexer, comprising: two inputs, wherein the first input is used for inputting communication data, and the second The input terminal is used to input the current maximum value or the current minimum value provided by the first register; 1 enable end for inputting the comparison result; and 1 output terminal for the communication end receiving the communication data whose comparison result is input
  • the second two-select multiplexer includes: 2 input terminals, wherein the second input end For inputting communication data, the first input is used to input the current maximum value or the current minimum value provided by the first register; 1 enable end for inputting the comparison result; and 1 output terminal for the enable end receiving
  • the comparison result is that the input communication data is greater than the current maximum value or less than the current minimum value, enabling the output of the current maximum value or the current minimum value input by the first
  • the output processing state machine comprises: a second reader for sequentially reading m cascaded data comparison units; and a counter for counting each data from the m cascaded data comparison units One time, when the count reaches m, a full signal is issued; the second monitor is used to monitor the full letter
  • the second read unit is disabled, and the second output is used to sequentially output data to a queue.
  • the queue is a first in first out queue.
  • the communication data is k bits, and all components in the data sorting device are components capable of processing k bits.
  • the first register and the second register are D flip-flops.
  • FIG. 1 is a circuit diagram of a hardware sequencer implementation apparatus according to an embodiment of the present invention
  • FIG. 2 is a circuit diagram of the data comparison unit of FIG. 1.
  • FIG. 3 shows an implementation of the present invention.
  • FIG. 4 is a state transition diagram of an output processing state machine in accordance with an embodiment of the present invention.
  • the present invention will be described in detail with reference to the accompanying drawings in conjunction with the embodiments.
  • the following is an example of sorting by the maximum value, but it is obvious that the present invention can also be applied to the minimum order as long as the maximum value is replaced with the minimum value and the smaller one is sorted.
  • the input data be n, and find the m maximum values sorted by size from the input data.
  • 1 shows a hardware sequencer implementation apparatus according to an embodiment of the present invention, which is composed of the following parts: an input processing state machine 10; an output processing state machine 30; m data comparison units 20.
  • the input processing state machine is configured to process the input n communication data;
  • the m cascaded data comparison units, m ⁇ n, each of which includes: a comparator, configured to input communication data and current
  • 3 P 17456 Comparing the maximum value or the current minimum value to obtain a comparison result; a selector for outputting the input communication data and the current maximum value according to the comparison result or the smaller one of the input communication data and the current minimum value to The first register outputs the smaller or larger to the second register; the first register is configured to save the larger one as the new current maximum value or the smaller one as the new current minimum value, and output the output to the comparator Comparing; a second register for storing the smaller or larger, outputting to the next level of data comparison unit; an output processing state machine for comparing the current maximum or current of the m cascaded data comparison units The minimum values are sequentially outputted to obtain m sorted communication data among the n communication data.
  • the communication data is from a queue
  • the input processing state machine includes: a first reader for sequentially reading communication data from the queue; and a counter for counting each time a communication data is retrieved from the queue, When n is counted, a full signal is issued; a first monitor for monitoring the full signal, the first read unit is disabled; and a first outputter for sequentially outputting the communication data to the first level data comparison unit.
  • the queue is a first in first out queue.
  • the selector comprises: two two-select multiplexers, comprising: a first two-select multiplexer, comprising: two inputs, wherein the first input is used for inputting communication data, and the second The input terminal is used to input the current maximum value or the current minimum value provided by the first register; 1 enable end for inputting the comparison result; and 1 output terminal for the communication end receiving the communication data whose comparison result is input
  • the second two-select multiplexer includes: 2 input terminals, wherein the second input end For inputting communication data, the first input is used to input the current maximum value or the current minimum value provided by the first register; 1 enable end for inputting the comparison result; and 1 output terminal for the enable end receiving
  • the comparison result is that the input communication data is greater than the current maximum value or less than the current minimum value, enabling the output of the current maximum value or the current minimum value input by the first
  • the output processing state machine comprises: a second reader for sequentially reading m cascaded data comparison units; and a counter for counting each data from the m cascaded data comparison units a number of times, when counting to m, a full signal is issued; a second monitor for monitoring the full signal, disabling the second reading unit; and a second output for sequentially outputting data to a queue
  • the queue is a first in first out queue.
  • the communication data is k bits, and all components in the data sorting device are components capable of processing k bits.
  • the first register and the second register are D flip-flops.
  • Figure 2 shows a circuit diagram of the data comparison unit of Figure 1, the data comparison unit consists of one greater than comparator 22, one selector (including two two-select multiplexers 24, 26) and two bit widths. It is a combination of k-bit registers (28, 29). The input data (V_in) greater than the bit width of the comparator is compared with the current maximum value (value).
  • the two-choice multiplexer selects one of the two inputs as the output according to the value of the selection signal, and outputs the input from the branch 1 (the first input terminal) if the value of the selection signal is 1, if the value of the selection signal is 0. Then the input from branch 0 (the second input) is output.
  • the register is used to store the result of each data comparison; the initial value of the register after power-on reset is 0; when the register enable signal (enable) is valid, the data on the register data input is saved to the register; when the register clears the signal The register is cleared when (clear) is active.
  • the two registers respectively store the current maximum value (value) and output to the value (v_out) of the next-stage data comparison unit. If the input data v_in is greater than the current maximum value, the value of the value register will be updated to the current input data when the enable signal is valid, and the value of the v_out register will be updated to the original maximum value. If the input data v_in is not greater than the current maximum value, the value of the value register will be unchanged when the enable signal is valid, and the value of the v_out register will be updated to the current input data.
  • the packet format of the input data packet according to an embodiment of the present invention is shown in the following table:
  • the packet parameter n is the number of input data; the packet format parameter I is the bit width of the parameter n.
  • the packet parameter m is the number of output results;
  • the packet format parameter J is the bit width of the parameter m.
  • the CPU is in the order of the number of the input packet from small to large.
  • the input processing state machine monitors the input FIFO, and generates a FIFO read signal when there is a data packet in the input FIFO; parses the packet parameters n and m from the first word of the data packet according to the determined packet format parameters I and J;
  • the parameter n value obtained from the input data packet determines the number of times the data is read, sequentially reads n data from the input FIFO and synchronously generates a register enable signal of the data comparison unit; reads n data and m clocks
  • the cycle sorting pipeline delays the current round of data processing and generates a sorting completion signal; waits for the output completion signal generated by the output processing state machine to complete the output of the data, and generates a register clearing signal of the data comparison unit after detecting the output completion signal and returns Idle state.
  • 3 shows a state transition diagram of an input processing state machine in accordance with an embodiment of the present invention, as follows:
  • S—IDLE Idle state.
  • the input processing state machine is in this state after power-on reset. In this state, the data presence signal ( s_exists ) of the input FIFO is monitored, and when the signal is active (high level), a FIFO read signal (s-read, active high) is generated and goes to the S_DECODE state.
  • S— DECODE Decode status.
  • the first word of the packet on the input FIFO data signal (s_data) is parsed to obtain the packet parameters n and m. If the parameter n or m is 0, no sorting is required, and the input processing state machine returns to the S_IDLE state. If the parameters n and m are both greater than 0, the data of the input FIFO is monitored (s_present). When the signal is valid (high level), a FIFO read signal (s-read, active high) is generated and transferred.
  • S_COMP Comparison status. In this state the input data into the count ⁇ 1, if the input data counter data- cnt is smaller than n, the monitoring of the presence signal FIFO input data (s_exists), as a FIFO read signal (s When this signal is active (high level) —read, active high). If the input data counter data_cnt is equal to ⁇ , it is transferred to the S_WAIT state.
  • S—WAIT Waiting state. In this state, first wait m clock cycles, ensure that the last input data reaches the m-th data comparison unit and complete the data comparison; then generate a sort completion signal (order_ finish), notify the output processing state machine to start outputting the result; The output completion signal (output_finish) generated by the processing state machine is monitored. When the signal is valid (high level), the register clear signal of the data comparison unit is generated and the S_IDLE state is returned. The output processing state machine monitors the sort completion signal, generates a FIFO write signal when the signal is valid and there is an idle position in the output FIFO, and stores the m maximum values stored in the current maximum value register of the m data comparison units from large to small. The order is sequentially written to the output FIFO, the first level of data ratio
  • M— WRITE Output status, in which the m maximum values stored in the current maximum value register of m data comparison units are sequentially written to the output FIFO in descending order. If the FIFO full signal of the output FIFO (m_ftill, active high) is invalid, that is, there is an idle position in the output FIFO, the current maximum value stored in each stage of the data comparison unit is output to the data input signal (m_data) of the output FIFO one by one.
  • the FIFO write signal (m_write, active high) of the output FIFO is synchronously generated, and the maximum value stored in the first-stage data comparison unit is output first.
  • an output completion signal ( output_fmish ) is generated and the M_IDLE state is returned.
  • the entire hardware sequencer implementation is shown in Figure 1.
  • the input data packets stored in the input FIFO are sequentially read under the control of the input processing state machine, and the packet parameters n and m are parsed from the first word of the data packet according to the determined packet format parameters I and J; Then, each data is sequentially read and input to the first-stage data comparison unit; each time one data is read from the input FIFO, the enable signal of each data comparison unit is valid once; the output of the first-stage data comparison unit is input to the second level.
  • the data comparison unit inputs the output of the second-stage data comparison unit to the third-stage data comparison unit, and so on, and the output of the m-1th-level data comparison unit is input to the m-th level data comparison unit; After the unit has also completed the comparison of all the data, the m maximum values stored in the data comparison units of each stage are written to the output FIFO under the control of the output processing state machine.
  • the input processing state machine returns to the idle state, and the output processing state machine returns to the idle state. Take the common peak search operation in wireless communication processing as an example.
  • the number of input data is at most
  • the data bit width is 16 bits; it is required to find up to 8 maximum peaks from the input data.
  • the hardware sequencing coprocessor implemented by the embodiment of the present invention implements input through
  • the FIFO and output FIFO are connected to the CPU.
  • the CPU writes the input data packet to the input FIFO according to the data packet format of Figure 2.
  • the implementation device completed according to the above design requirements can handle all cases where the number of input data is less than or equal to 256 and the number of output results is less than or equal to 8.
  • the actual number of input data is 199, and it is required to output 7 maximum peaks.
  • the working process of the entire hardware sequencing coprocessor implementation device can be derived.
  • the input processing state machine is idle after a power-on reset and monitors the input FIFO.
  • the output of the first-stage data comparison unit is input to the second-stage data comparison unit, the output of the second-stage data comparison unit is input to the third-stage data comparison unit, and so on, and the output of the sixth-stage data comparison unit is input to Level 7 data comparison unit; after the 7th stage data comparison unit also completes the comparison of all 199 data, the 7 maximum values stored in the 1st to 7th stage data comparison units are under the control of the output processing state machine Is written to the output FIFO. The input processing state machine returns to the idle state, and the output processing state returns to the idle state.
  • the above embodiments of the present invention are characterized by: 1.
  • the sorting operation is implemented by hardware.
  • each data comparison unit compares the input data of the unit, and the data comparison units of the pipelines operate simultaneously; all the input data can be sorted once by the pipeline once. operating. 3.
  • the implementation device according to the determined n and m values can process all cases where the number of input data is less than or equal to n and the number of output results is less than or equal to m.
  • the sorting operation is improved from software implementation to hardware implementation as compared with the prior art. Assuming that there are a total of n input data and m-level data comparison units, after n + m clock cycles, the m-level data comparison units from 1 to m store m maximum values arranged in descending order.
  • the device of the present invention can overcome the shortcoming that the number of clock cycles occupied by the software implementation of the sorting operation in the prior art is proportional to the factorial of n, and solves the problem that the sorting operation implemented by software in the prior art cannot meet the real-time signal processing pair.

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Communication Control (AREA)

Abstract

A data sorting device is disclosed, including: input process state machine, for processing the n inputted data; m cascade data comparison units, each of which includes comparator for comparing the inputted data with the current largest data or the current smallest data to get a result, selector for outputting the larger one of the inputted communication data and the current largest data, or the smaller one of the inputted communication data and the current smallest data to the first register and the smaller or the larger one to the second register according to the comparison result, the first register for storing the larger one as the new current largest data or the smaller one as the new current smallest data, and outputting them to the comparator, and the second register for storing the smaller one or the larger one to be outputted to the next data compassion unit; output process state machine, for outputting the current largest data or the current smallest data in the m cascade data comparison units in order. The sorting speed is improved.

Description

用于处理通信数据的数据排序装置 技术领域 本发明涉及通信领域, 具体而言, 涉及用于处理通信数据的数据排序装 置。 背景技术 排序操作是各种算法中常见的操作。排序操作通常是用软件编程, 然后 在通用的计算装置上运算实现的。 但是在实现本发明过程中, 发明人发现现 有技术中至少存在如下问题: 软件实现是串行处理, 即使 CPU的运行频率再 高, 排序操作仍然要占用大量的时间。 假设输入数据为 n个, 要从输入数据中找出按大小排好序的 m个最大 值, 则做法为 ( 1 )取第一个输入数据作为当前最大值; (2 )取下一个输入 数据与当前最大值做比较, 若下一个输入数据大于当前最大值, 则下一个输 入数据成为当前最大值; (3 )重复步骤 2, 直到所有输入数据都处理完; (4 ) 将当前最大值从输入数据中移去; ( 5 )重复步骤 1至 4直到找到 m个最大值, 这 m个最大值已经按找到的先后顺序依次从大到小排序, 第一次找到的最大 值是 m个值中最大的。 当 m=n时, 上述排序操作即为对所有输入数据进行排序。 假设比较指 令、 分支指令的执行周期均为 1个时钟周期且不考虑取数据、 更新当前最大 值占用的指令周期, 则上述排序操作占用的 CPU 时钟周期数目 为 2*(n-l)*(n-2)*...*(n-m)=2*(n-l)!/(n-m-l)!。 由上可知, 排序操作的软件实现占用的时钟周期数与 n的阶乘成正比。 在 n值较大时, 排序操作占用的时间尤为显著。 实时信号处理对实时性要求高,用上述技术实现排序操作无法满足实时 信号处理对数据处理的实时性要求。 发明内容 本发明旨在提供一种用于处理通信数据的数据排序装置,能够解决现有  BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to the field of communications, and in particular to a data sorting apparatus for processing communication data. BACKGROUND OF THE INVENTION Sorting operations are common operations in various algorithms. The sorting operation is usually programmed in software and then implemented on a general purpose computing device. However, in the process of implementing the present invention, the inventors have found that at least the following problems exist in the prior art: The software implementation is serial processing, and even if the CPU operates at a higher frequency, the sorting operation still takes a lot of time. Assuming that the input data is n, to find the m maximum values sorted by size from the input data, the method is (1) taking the first input data as the current maximum value; (2) taking the next input data. Compared with the current maximum value, if the next input data is greater than the current maximum value, the next input data becomes the current maximum value; (3) repeat step 2 until all input data is processed; (4) the current maximum value is The input data is removed; (5) Steps 1 to 4 are repeated until m maximum values are found. The m maximum values have been sorted in descending order of order, and the maximum value found for the first time is m values. The biggest one. When m=n, the above sorting operation is to sort all input data. Assuming that the execution cycle of the compare instruction and the branch instruction is one clock cycle and the instruction cycle occupied by the current maximum value is not considered, the number of CPU clock cycles occupied by the above sort operation is 2*(nl)*(n- 2)*...*(nm)=2*(nl)!/(nml)!. As can be seen from the above, the number of clock cycles occupied by the software implementation of the sort operation is proportional to the factorial of n. When the value of n is large, the time taken by the sorting operation is particularly significant. Real-time signal processing requires high real-time performance. The sorting operation using the above techniques cannot meet the real-time requirements of real-time signal processing for data processing. SUMMARY OF THE INVENTION The present invention is directed to a data sorting apparatus for processing communication data, which can solve the existing

1 P17456 技术排序速度较慢的问题。 在本发明的实施例中, 提供了一种用于处理通信数据的数据排序装置, 包括: 输入处理状态机, 用于处理输入的 n个通信数据; m个级联的数据比 较单元, m<=n, 其均包括: 比较器, 用于对输入的通信数据和当前最大值或 当前最小值进行比较, 得到比较结果; 选择器, 用于根据比较结果输出输入 的通信数据和当前最大值中的较大者或输入的通信数据和当前最小值中的较 小者至第一寄存器, 输出较小者或较大者至第二寄存器; 第一寄存器, 其用 于保存较大者作为新的当前最大值或较小者作为新的当前最小值, 输出给比 较器进行比较; 第二寄存器, 其用于保存较小者或较大者, 输出给下一级数 据比较单元; 输出处理状态机, 用于将 m个级联的数据比较单元中的当前最 大值或当前最小值依次输出,以得到 n个通信数据中的 m个排序的通信数据。 优选的,通信数据来自于一个队列,输入处理状态机包括: 第一读取器, 用于从队列依次读取通信数据; 计数器, 用于从队列中每取一个通信数据时, 记一次数, 当计数到 n时, 发出满信号; 第一监视器, 用于监视到满信号时, 禁用第一读取单元; 以及第一输出器, 用于依次输出通信数据到第一级数据 比较单元。 优选的, 队列是先进先出队列。 优选的, 选择器包括: 2个二选一复用器, 其包括: 第一二选一复用器, 其包括: 2 个输入端, 其中的第一输入端用于输入通信数据, 第二输入端用 于输入第一寄存器提供的当前最大值或当前最小值; 1 个使能端, 用于输入 比较结果; 以及 1个输出端, 用于使能端接收到比较结果是输入的通信数据 大于当前最大值或小于当前最小值时, 使能输出第一输入端输入的通信数据 到第一寄存器; 第二二选一复用器, 其包括: 2 个输入端, 其中的第二输入 端用于输入通信数据, 第一输入端用于输入第一寄存器提供的当前最大值或 当前最小值; 1 个使能端, 用于输入比较结果; 以及 1 个输出端, 用于使能 端接收到比较结果是输入的通信数据大于当前最大值或小于当前最小值时, 使能输出第一输入端输入的当前最大值或当前最小值到第二寄存器; 否则, 使能输出第二输入端输入的通信数据到第二寄存器。 优选的, 输出处理状态机包括: 第二读取器, 用于依次读取 m个级联 的数据比较单元; 计数器, 用于从 m个级联的数据比较单元中每取一个数据 时, 记一次数, 当计数到 m时, 发出满信号; 第二监视器, 用于监视到满信 1 P17456 The problem of slower sorting of technology. In an embodiment of the present invention, there is provided a data sorting apparatus for processing communication data, comprising: an input processing state machine for processing input n communication data; m cascaded data comparison units, m< =n, which includes: a comparator, configured to compare the input communication data with the current maximum value or the current minimum value to obtain a comparison result; and a selector for outputting the input communication data and the current maximum value according to the comparison result The larger one or the smaller of the input communication data and the current minimum value to the first register, the smaller or the larger one to the second register; the first register, which is used to hold the larger one as a new one The current maximum or smaller is used as the new current minimum value, and the output is compared to the comparator for comparison; the second register is used to save the smaller or larger one, and is output to the next-level data comparison unit; the output processing state machine And sequentially outputting the current maximum value or the current minimum value in the m cascaded data comparison units to obtain m sorted communication data in the n communication data. Preferably, the communication data is from a queue, and the input processing state machine includes: a first reader for sequentially reading communication data from the queue; and a counter for counting each time a communication data is retrieved from the queue, When n is counted, a full signal is issued; a first monitor for monitoring the full signal, the first read unit is disabled; and a first outputter for sequentially outputting the communication data to the first level data comparison unit. Preferably, the queue is a first in first out queue. Preferably, the selector comprises: two two-select multiplexers, comprising: a first two-select multiplexer, comprising: two inputs, wherein the first input is used for inputting communication data, and the second The input terminal is used to input the current maximum value or the current minimum value provided by the first register; 1 enable end for inputting the comparison result; and 1 output terminal for the communication end receiving the communication data whose comparison result is input When the current value is greater than the current maximum value or less than the current minimum value, the communication data input from the first input terminal is enabled to the first register; the second two-select multiplexer includes: 2 input terminals, wherein the second input end For inputting communication data, the first input is used to input the current maximum value or the current minimum value provided by the first register; 1 enable end for inputting the comparison result; and 1 output terminal for the enable end receiving When the comparison result is that the input communication data is greater than the current maximum value or less than the current minimum value, enabling the output of the current maximum value or the current minimum value input by the first input terminal to the second register; Of the communication data can be output to the second input terminal of the second register. Preferably, the output processing state machine comprises: a second reader for sequentially reading m cascaded data comparison units; and a counter for counting each data from the m cascaded data comparison units One time, when the count reaches m, a full signal is issued; the second monitor is used to monitor the full letter

2 P 17456 号时, 禁用第二读取单元; 以及第二输出器, 用于依次输出数据到一个队列 中。 优选的, 队列是先进先出队列。 优选的, 通信数据为 k 位, 数据排序装置中的所有部件均为能处理 k 位的部件。 优选的, 第一寄存器和第二寄存器是 D触发器。 本发明上述数据排序装置因为采用专门电路进行排序,所以克服了现有 技术排序较慢的问题, 进而达到了较好的通信数据实时处理效果。 附图说明 此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一部 分, 本发明的示意性实施例及其说明用于解释本发明, 并不构成对本发明的 不当限定。 在附图中: 图 1示出了根据本发明实施例的硬件排序器实现装置的电路示意图; 图 2示出了图 1 中的数据比较单元的电路示意图; 图 3示出了 居本发明实施例的输入处理状态机的状态转移图; 图 4示出了 居本发明实施例的输出处理状态机的状态转移图。 具体实施方式 下面将参考附图并结合实施例, 来详细说明本发明。 下面均以取最大值 排序进行举例说明, 但显然, 只要将最大值替换为最小值, 排序时取较小者, 本发明也可以应用于最小值排序。 设输入数据为 n个, 要从输入数据中找出按大小排好序的 m个最大值。 图 1示出了根据本发明实施例的硬件排序器实现装置,其由以下几部分组成: 一个输入处理状态机 10; —个输出处理状态机 30; m个数据比较单元 20。 具体来说, 输入处理状态机, 用于处理输入的 n个通信数据; m个级联 的数据比较单元, m<=n, 其均包括: 比较器, 用于对输入的通信数据和当前 2 P 17456 The second read unit is disabled, and the second output is used to sequentially output data to a queue. Preferably, the queue is a first in first out queue. Preferably, the communication data is k bits, and all components in the data sorting device are components capable of processing k bits. Preferably, the first register and the second register are D flip-flops. The above-mentioned data sorting device of the present invention overcomes the problem of slow sorting in the prior art by using a special circuit for sorting, thereby achieving better real-time processing effect of communication data. BRIEF DESCRIPTION OF THE DRAWINGS The accompanying drawings, which are set to illustrate,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, In the drawings: FIG. 1 is a circuit diagram of a hardware sequencer implementation apparatus according to an embodiment of the present invention; FIG. 2 is a circuit diagram of the data comparison unit of FIG. 1. FIG. 3 shows an implementation of the present invention. A state transition diagram of an input processing state machine of an example; FIG. 4 is a state transition diagram of an output processing state machine in accordance with an embodiment of the present invention. BEST MODE FOR CARRYING OUT THE INVENTION Hereinafter, the present invention will be described in detail with reference to the accompanying drawings in conjunction with the embodiments. The following is an example of sorting by the maximum value, but it is obvious that the present invention can also be applied to the minimum order as long as the maximum value is replaced with the minimum value and the smaller one is sorted. Let the input data be n, and find the m maximum values sorted by size from the input data. 1 shows a hardware sequencer implementation apparatus according to an embodiment of the present invention, which is composed of the following parts: an input processing state machine 10; an output processing state machine 30; m data comparison units 20. Specifically, the input processing state machine is configured to process the input n communication data; the m cascaded data comparison units, m<=n, each of which includes: a comparator, configured to input communication data and current

3 P 17456 最大值或当前最小值进行比较, 得到比较结果; 选择器, 用于根据比较结果 输出输入的通信数据和当前最大值中的较大者或输入的通信数据和当前最小 值中的较小者至第一寄存器, 输出较小者或较大者至第二寄存器; 第一寄存 器, 其用于保存较大者作为新的当前最大值或较小者作为新的当前最小值, 输出给比较器进行比较; 第二寄存器, 其用于保存较小者或较大者, 输出给 下一级数据比较单元; 输出处理状态机, 用于将 m个级联的数据比较单元中 的当前最大值或当前最小值依次输出, 以得到 n个通信数据中的 m个排序的 通信数据。 上述实施例的数据排序装置因为采用专门电路进行排序,所以克服了现 有技术排序较慢的问题, 进而达到了较好的通信数据实时处理效果。 优选的,通信数据来自于一个队列,输入处理状态机包括: 第一读取器, 用于从队列依次读取通信数据; 计数器, 用于从队列中每取一个通信数据时, 记一次数, 当计数到 n时, 发出满信号; 第一监视器, 用于监视到满信号时, 禁用第一读取单元; 以及第一输出器, 用于依次输出通信数据到第一级数据 比较单元。 优选的, 队列是先进先出队列。 优选的, 选择器包括: 2个二选一复用器, 其包括: 第一二选一复用器, 其包括: 2 个输入端, 其中的第一输入端用于输入通信数据, 第二输入端用 于输入第一寄存器提供的当前最大值或当前最小值; 1 个使能端, 用于输入 比较结果; 以及 1个输出端, 用于使能端接收到比较结果是输入的通信数据 大于当前最大值或小于当前最小值时, 使能输出第一输入端输入的通信数据 到第一寄存器; 第二二选一复用器, 其包括: 2 个输入端, 其中的第二输入 端用于输入通信数据, 第一输入端用于输入第一寄存器提供的当前最大值或 当前最小值; 1个使能端, 用于输入比较结果; 以及 1个输出端, 用于使能 端接收到比较结果是输入的通信数据大于当前最大值或小于当前最小值时, 使能输出第一输入端输入的当前最大值或当前最小值到第二寄存器; 否则, 使能输出第二输入端输入的通信数据到第二寄存器。 优选的, 输出处理状态机包括: 第二读取器, 用于依次读取 m个级联 的数据比较单元; 计数器, 用于从 m个级联的数据比较单元中每取一个数据 时, 记一次数, 当计数到 m时, 发出满信号; 第二监视器, 用于监视到满信 号时, 禁用第二读取单元; 以及第二输出器, 用于依次输出数据到一个队列 3 P 17456 Comparing the maximum value or the current minimum value to obtain a comparison result; a selector for outputting the input communication data and the current maximum value according to the comparison result or the smaller one of the input communication data and the current minimum value to The first register outputs the smaller or larger to the second register; the first register is configured to save the larger one as the new current maximum value or the smaller one as the new current minimum value, and output the output to the comparator Comparing; a second register for storing the smaller or larger, outputting to the next level of data comparison unit; an output processing state machine for comparing the current maximum or current of the m cascaded data comparison units The minimum values are sequentially outputted to obtain m sorted communication data among the n communication data. The data sorting device of the above embodiment overcomes the problem of slower sorting in the prior art because it uses a special circuit for sorting, thereby achieving better real-time processing effect of communication data. Preferably, the communication data is from a queue, and the input processing state machine includes: a first reader for sequentially reading communication data from the queue; and a counter for counting each time a communication data is retrieved from the queue, When n is counted, a full signal is issued; a first monitor for monitoring the full signal, the first read unit is disabled; and a first outputter for sequentially outputting the communication data to the first level data comparison unit. Preferably, the queue is a first in first out queue. Preferably, the selector comprises: two two-select multiplexers, comprising: a first two-select multiplexer, comprising: two inputs, wherein the first input is used for inputting communication data, and the second The input terminal is used to input the current maximum value or the current minimum value provided by the first register; 1 enable end for inputting the comparison result; and 1 output terminal for the communication end receiving the communication data whose comparison result is input When the current value is greater than the current maximum value or less than the current minimum value, the communication data input from the first input terminal is enabled to the first register; the second two-select multiplexer includes: 2 input terminals, wherein the second input end For inputting communication data, the first input is used to input the current maximum value or the current minimum value provided by the first register; 1 enable end for inputting the comparison result; and 1 output terminal for the enable end receiving When the comparison result is that the input communication data is greater than the current maximum value or less than the current minimum value, enabling the output of the current maximum value or the current minimum value input by the first input terminal to the second register; otherwise, The communication data input from the second input terminal is enabled to the second register. Preferably, the output processing state machine comprises: a second reader for sequentially reading m cascaded data comparison units; and a counter for counting each data from the m cascaded data comparison units a number of times, when counting to m, a full signal is issued; a second monitor for monitoring the full signal, disabling the second reading unit; and a second output for sequentially outputting data to a queue

4 P 17456 中。 优选的, 队列是先进先出队列。 优选的, 通信数据为 k 位, 数据排序装置中的所有部件均为能处理 k 位的部件。 优选的, 第一寄存器和第二寄存器是 D触发器。 图 2 示出了图 1 中的数据比较单元的电路示意图, 数据比较单元由 1 个大于比较器 22、 1个选择器(包括 2个二选一复用器 24、 26 )和 2个位宽 为 k比特的寄存器 (28、 29 ) 组合而成。 大于比较器对位宽为 k比特的输入 数据( V— in )和当前最大值( value )进行比较, 若输入数据 v_in大于当前最 大值 value则大于比较器的输出 ( big )取值 1 , 否则取值 0。 二选一复用器根 据选择信号的取值从 2个输入中选择一个作为输出, 若选择信号的值为 1则 输出来自分支 1 (第一输入端) 的输入, 若选择信号的值为 0则输出来自分 支 0 (第二输入端) 的输入。 寄存器用于存储每次数据比较的结果; 上电复 位后寄存器的初始值为 0; 当寄存器使能信号( enable )有效时寄存器数据输 入端上的数据被保存到寄存器中; 当寄存器清零信号 (clear )有效时寄存器 被清零。 在本发明所述装置中, 2个寄存器分别保存当前最大值(value )、 输 出到下一级数据比较单元的值 (v_out )。 若输入数据 v_in 大于当前最大值 value, 则使能信号有效时 value寄存器的值将更新为当前输入数据, 而 v_out 寄存器的值将更新为原来的最大值。 若输入数据 v_in 不大于当前最大值 value, 则使能信号有效时 value寄存器的值将不变, 而 v— out寄存器的值将 更新为当前输入数据。 下表中示出了根据本发明实施例的输入数据包的包格式: 4 P 17456 in. Preferably, the queue is a first in first out queue. Preferably, the communication data is k bits, and all components in the data sorting device are components capable of processing k bits. Preferably, the first register and the second register are D flip-flops. Figure 2 shows a circuit diagram of the data comparison unit of Figure 1, the data comparison unit consists of one greater than comparator 22, one selector (including two two-select multiplexers 24, 26) and two bit widths. It is a combination of k-bit registers (28, 29). The input data (V_in) greater than the bit width of the comparator is compared with the current maximum value (value). If the input data v_in is greater than the current maximum value, the output of the comparator (big) is greater than 1, otherwise Take the value 0. The two-choice multiplexer selects one of the two inputs as the output according to the value of the selection signal, and outputs the input from the branch 1 (the first input terminal) if the value of the selection signal is 1, if the value of the selection signal is 0. Then the input from branch 0 (the second input) is output. The register is used to store the result of each data comparison; the initial value of the register after power-on reset is 0; when the register enable signal (enable) is valid, the data on the register data input is saved to the register; when the register clears the signal The register is cleared when (clear) is active. In the apparatus of the present invention, the two registers respectively store the current maximum value (value) and output to the value (v_out) of the next-stage data comparison unit. If the input data v_in is greater than the current maximum value, the value of the value register will be updated to the current input data when the enable signal is valid, and the value of the v_out register will be updated to the original maximum value. If the input data v_in is not greater than the current maximum value, the value of the value register will be unchanged when the enable signal is valid, and the value of the v_out register will be updated to the current input data. The packet format of the input data packet according to an embodiment of the present invention is shown in the following table:

Figure imgf000007_0001
Figure imgf000007_0001

数据包参数 n是输入数据的个数; 数据包格式参数 I是参数 n的比特位 宽。数据包参数 m是输出结果的个数; 数据包格式参数 J是参数 m的比特位 宽。 数据的比特位宽为 k=I+J。 CPU按输入数据包的字序号从小到大的顺序  The packet parameter n is the number of input data; the packet format parameter I is the bit width of the parameter n. The packet parameter m is the number of output results; the packet format parameter J is the bit width of the parameter m. The bit width of the data is k = I + J. The CPU is in the order of the number of the input packet from small to large.

5 P 17456 依次将各个字写入到输入 FIFO。 输入处理状态机监控输入 FIFO,在输入 FIFO中存在数据包时产生 FIFO 读信号; 按已确定的包格式参数 I和 J从数据包的第一个字中解析出数据包 参数 n和 m; 根据从输入数据包中获取的参数 n值决定读数据的次数, 依次 从输入 FIFO中读取 n个数据并同步产生数据比较单元的寄存器使能信号; 在完成 n个数据的读取和 m个时钟周期的排序流水线延迟后结束本轮数据处 理并产生排序完成信号; 等待输出处理状态机完成数据的输出后产生的输出 完成信号, 检测到输出完成信号后产生数据比较单元的寄存器清零信号并返 回空闲状态。 图 3示出了根据本发明实施例的输入处理状态机的状态转移图, 如下: 5 P 17456 Each word is written to the input FIFO in turn. The input processing state machine monitors the input FIFO, and generates a FIFO read signal when there is a data packet in the input FIFO; parses the packet parameters n and m from the first word of the data packet according to the determined packet format parameters I and J; The parameter n value obtained from the input data packet determines the number of times the data is read, sequentially reads n data from the input FIFO and synchronously generates a register enable signal of the data comparison unit; reads n data and m clocks The cycle sorting pipeline delays the current round of data processing and generates a sorting completion signal; waits for the output completion signal generated by the output processing state machine to complete the output of the data, and generates a register clearing signal of the data comparison unit after detecting the output completion signal and returns Idle state. 3 shows a state transition diagram of an input processing state machine in accordance with an embodiment of the present invention, as follows:

S— IDLE: 空闲状态, 上电复位后输入处理状态机处于此状态。 在此状 态下监控输入 FIFO的数据存在信号 ( s_exists ), 当该信号有效时 (高电平) 产生 FIFO读信号 ( s—read, 高电平有效) 并转到 S_DECODE状态。 S—IDLE: Idle state. The input processing state machine is in this state after power-on reset. In this state, the data presence signal ( s_exists ) of the input FIFO is monitored, and when the signal is active (high level), a FIFO read signal (s-read, active high) is generated and goes to the S_DECODE state.

S— DECODE: 解码状态。 在此状态下对输入 FIFO数据信号 (s_data ) 上的数据包的第一个字进行解析, 获取数据包参数 n和 m。 若参数 n或 m为 0, 则无需进行排序, 输入处理状态机返回 S_IDLE状态。 若参数 n和 m均 大于 0, 则监控输入 FIFO的数据存在信号 ( s— exists ), 当该信号有效时 (高 电平) 产生 FIFO读信号 ( s—read, 高电平有效) 并转入 S— COMP状态。 S— DECODE: Decode status. In this state, the first word of the packet on the input FIFO data signal (s_data) is parsed to obtain the packet parameters n and m. If the parameter n or m is 0, no sorting is required, and the input processing state machine returns to the S_IDLE state. If the parameters n and m are both greater than 0, the data of the input FIFO is monitored (s_present). When the signal is valid (high level), a FIFO read signal (s-read, active high) is generated and transferred. S—COMP status.

S_COMP: 比较状态。 在此状态下对输入数据进^ 1计数, 若输入数据计 数器 data— cnt小于 n, 则监控输入 FIFO的数据存在信号 ( s_exists ), 当该信 号有效时 (高电平) 产生 FIFO读信号 (s—read, 高电平有效)。 若输入数据 计数器 data_cnt等于 η , 则转入 S_WAIT状态。 S_COMP: Comparison status. In this state the input data into the count ^ 1, if the input data counter data- cnt is smaller than n, the monitoring of the presence signal FIFO input data (s_exists), as a FIFO read signal (s When this signal is active (high level) —read, active high). If the input data counter data_cnt is equal to η, it is transferred to the S_WAIT state.

S— WAIT: 等待状态。 在此状态下首先等待 m个时钟周期, 确保最后一 个输入数据到达第 m级数据比较单元并完成数据比较; 随后产生排序完成信 号( order— finish ), 通知输出处理状态机开始输出结果; 对输出处理状态机产 生的输出完成信号 (output_finish)进行监控, 当该信号有效时 (高电平) 产生 数据比较单元的寄存器清零信号并返回 S_IDLE状态。 输出处理状态机监控排序完成信号, 在该信号有效且输出 FIFO中存在 空闲位置时产生 FIFO写信号, 将保存在 m个数据比较单元的当前最大值寄 存器中的 m个最大值按从大到小的顺序依次写入输出 FIFO, 第一级数据比 S—WAIT: Waiting state. In this state, first wait m clock cycles, ensure that the last input data reaches the m-th data comparison unit and complete the data comparison; then generate a sort completion signal (order_ finish), notify the output processing state machine to start outputting the result; The output completion signal (output_finish) generated by the processing state machine is monitored. When the signal is valid (high level), the register clear signal of the data comparison unit is generated and the S_IDLE state is returned. The output processing state machine monitors the sort completion signal, generates a FIFO write signal when the signal is valid and there is an idle position in the output FIFO, and stores the m maximum values stored in the current maximum value register of the m data comparison units from large to small. The order is sequentially written to the output FIFO, the first level of data ratio

6 P 17456 较单元中存储的当前最大值最先写入; 在输出 FIFO满时等待; 完成 m个最 大值的输出后产生输出完成信号并返回空闲状态。 图 4示出了根据本发明实施例的输出处理状态机的状态转移图,说明如 下: MJDLE: 空闲状态, 上电复位后输出处理状态机处于此状态。 在此状 态下监控输入处理状态机产生的排序完成信号( order_finish ), 当该信号有效 时 (高电平) 转到 M— WRITE状态。 6 P 17456 The current maximum value stored in the unit is written first; waiting when the output FIFO is full; the output completion signal is generated after the output of the m maximum values is completed and returns to the idle state. 4 shows a state transition diagram of an output processing state machine in accordance with an embodiment of the present invention, as follows: MJDLE: Idle state, the output processing state machine is in this state after power-on reset. In this state, the sort completion signal (order_finish) generated by the input processing state machine is monitored, and when the signal is active (high level), it is transferred to the M_WRITE state.

M— WRITE: 输出状态, 在此状态下将保存在 m个数据比较单元的当前 最大值寄存器中的 m个最大值按从大到小的顺序依次写入输出 FIFO。 若输 出 FIFO的 FIFO满信号 (m_ftill, 高电平有效) 无效, 即输出 FIFO中存在 空闲位置,则逐个将各级数据比较单元中存储的当前最大值输出到输出 FIFO 的数据输入信号( m_data )上并同步产生输出 FIFO的 FIFO写信号( m—write, 高电平有效), 第一级数据比较单元中存储的最大值最先输出。输出完成后产 生输出完成信号 ( output_fmish ) 并返回 M_IDLE状态。 整个硬件排序器实现装置如图 1所示。 保存在输入 FIFO中的输入数据 包在输入处理状态机的控制下被依次读出, 从数据包的第一个字中按已确定 的包格式参数 I和 J解析出数据包参数 n和 m; 随后依次读出各个数据并输 入第 1级数据比较单元; 从输入 FIFO中每读出一个数据, 各数据比较单元 的使能信号就有效一次; 第 1级数据比较单元的输出输入到第 2级数据比较 单元, 第 2级数据比较单元的输出输入到第 3级数据比较单元, 以此类推, 第 m-1级数据比较单元的输出输入到第 m级数据比较单元; 在第 m级数据 比较单元也完成了所有数据的比较后,保存在各级数据比较单元中的 m个最 大值在输出处理状态机的控制下被写入到输出 FIFO。输入处理状态机回到空 闲状态, 输出处理状态机回到空闲状态。 以无线通讯处理中常见的查找峰值操作为例, 输入数据个数至多为M— WRITE: Output status, in which the m maximum values stored in the current maximum value register of m data comparison units are sequentially written to the output FIFO in descending order. If the FIFO full signal of the output FIFO (m_ftill, active high) is invalid, that is, there is an idle position in the output FIFO, the current maximum value stored in each stage of the data comparison unit is output to the data input signal (m_data) of the output FIFO one by one. The FIFO write signal (m_write, active high) of the output FIFO is synchronously generated, and the maximum value stored in the first-stage data comparison unit is output first. After the output is completed, an output completion signal ( output_fmish ) is generated and the M_IDLE state is returned. The entire hardware sequencer implementation is shown in Figure 1. The input data packets stored in the input FIFO are sequentially read under the control of the input processing state machine, and the packet parameters n and m are parsed from the first word of the data packet according to the determined packet format parameters I and J; Then, each data is sequentially read and input to the first-stage data comparison unit; each time one data is read from the input FIFO, the enable signal of each data comparison unit is valid once; the output of the first-stage data comparison unit is input to the second level. The data comparison unit inputs the output of the second-stage data comparison unit to the third-stage data comparison unit, and so on, and the output of the m-1th-level data comparison unit is input to the m-th level data comparison unit; After the unit has also completed the comparison of all the data, the m maximum values stored in the data comparison units of each stage are written to the output FIFO under the control of the output processing state machine. The input processing state machine returns to the idle state, and the output processing state machine returns to the idle state. Take the common peak search operation in wireless communication processing as an example. The number of input data is at most

256, 数据位宽为 16比特; 要求从输入数据中找出至多 8个最大的峰值。 则本发明实施例所述的硬件排序协处理器实现装置由以下几部分组成: 8个数据比较单元、 1个输入处理状态机、 1个输出处理状态机。 根据图 2的描述, 数据比较单元由 1个大于比较器、 2个二选一复用器 和 2个位宽为 k = 16比特的寄存器组合而成。 256, the data bit width is 16 bits; it is required to find up to 8 maximum peaks from the input data. The device for implementing the hardware sequencing coprocessor according to the embodiment of the present invention is composed of the following components: 8 data comparison units, 1 input processing state machine, and 1 output processing state machine. According to the description of Fig. 2, the data comparison unit is composed of one register larger than the comparator, two two-selection multiplexers, and two registers having a bit width of k = 16 bits.

7 P 17456 优选的, 本发明实施例所述的硬件排序协处理器实现装置通过输入7 P 17456 Preferably, the hardware sequencing coprocessor implemented by the embodiment of the present invention implements input through

FIFO和输出 FIFO与 CPU连接。 CPU按照图 2的数据包格式将输入数据包 写入输入 FIFO, 数据包的包格式参数 I、 J的取值分别为 1=10 ( 2Λ10>=256 ), J=6 ( 2Λ6>=8 )。 根据上述设计要求完成的实现装置能处理输入数据个数小于 等于 256且输出结果个数小于等于 8的所有情况。 实际输入数据个数为 199 个, 要求输出 7个最大的峰值, 则数据包中的参数 n、 m的实际取值分别为 n=199、 m=7 o 199个输入数据取实际值。 根据图 3、 4可以得出整个硬件排序协处理器实现装置的工作过程。 输 入处理状态机在上电复位后处于空闲状态, 监控输入 FIFO。 当输入 FIFO中 存在数据包时, 保存在输入 FIFO 中的输入数据包在输入处理状态机的控制 下被依次读出,按 1=10和 J=6的包格式参数从数据包的第一个字中解析出数 据包参数 n=199和 m=7;随后依次读出各个数据并输入第 1级数据比较单元; 从输入 FIFO 中每读出一个数据, 各数据比较单元的使能信号就有效一次; 第 1级数据比较单元的输出输入到第 2级数据比较单元, 第 2级数据比较单 元的输出输入到第 3级数据比较单元, 以此类推, 第 6级数据比较单元的输 出输入到第 7级数据比较单元; 在第 7级数据比较单元也完成了所有 199个 数据的比较后, 保存在第 1至第 7级数据比较单元中的 7个最大值在输出处 理状态机的控制下被写入到输出 FIFO。输入处理状态机回到空闲状态, 输出 处理 态机回到空闲^■态。 本发明上述实施例的特点在于: 一、 用硬件实现了排序操作。 二、 用多 个数据比较单元依次连接构成流水线, 各数据比较单元对本单元的输入数据 进行比较, 流水线上的各级数据比较单元同时运作; 所有输入数据只需依次 通过流水线一次即可完成一次排序操作。 三、 据已确定的 n、 m值完成的 实现装置, 能处理输入数据个数小于等于 n且输出结果个数小于等于 m的所 有情况。 采用本发明所述装置, 与现有技术相比, 排序操作由软件实现改进为硬 件实现。 假设共有 n个输入数据和 m级数据比较单元, 那么经过 n+m个时 钟周期后, 从 1到 m这 m级数据比较单元中存储的就是按照从大到小顺序 排列的 m个最大值。 因此, 用硬件排序器实现的排序操作占用的时钟周期数 与 n成正比。 所以采用本发明所述装置能够克服现有技术中排序操作的软件 实现占用的时钟周期数与 n的阶乘成正比的缺点, 解决现有技术中存在的用 软件实现排序操作无法满足实时信号处理对数据处理的实时性要求的问题。 The FIFO and output FIFO are connected to the CPU. The CPU writes the input data packet to the input FIFO according to the data packet format of Figure 2. The values of the packet format parameters I and J of the data packet are 1=10 ( 2 Λ 10>=256 ), J=6 ( 2 Λ 6 >=8 ). The implementation device completed according to the above design requirements can handle all cases where the number of input data is less than or equal to 256 and the number of output results is less than or equal to 8. The actual number of input data is 199, and it is required to output 7 maximum peaks. The actual values of the parameters n and m in the data packet are n=199 and m=7 o respectively. 199 input data take the actual value. According to Figures 3 and 4, the working process of the entire hardware sequencing coprocessor implementation device can be derived. The input processing state machine is idle after a power-on reset and monitors the input FIFO. When there is a data packet in the input FIFO, the input data packets stored in the input FIFO are sequentially read under the control of the input processing state machine, and the first format of the packet is from the packet format parameters of 1=10 and J=6. The data packet parameters n=199 and m=7 are parsed in the word; then each data is sequentially read and input into the first level data comparison unit; each time a data is read from the input FIFO, the enable signal of each data comparison unit is valid. Once; the output of the first-stage data comparison unit is input to the second-stage data comparison unit, the output of the second-stage data comparison unit is input to the third-stage data comparison unit, and so on, and the output of the sixth-stage data comparison unit is input to Level 7 data comparison unit; after the 7th stage data comparison unit also completes the comparison of all 199 data, the 7 maximum values stored in the 1st to 7th stage data comparison units are under the control of the output processing state machine Is written to the output FIFO. The input processing state machine returns to the idle state, and the output processing state returns to the idle state. The above embodiments of the present invention are characterized by: 1. The sorting operation is implemented by hardware. Second, multiple data comparison units are sequentially connected to form a pipeline, each data comparison unit compares the input data of the unit, and the data comparison units of the pipelines operate simultaneously; all the input data can be sorted once by the pipeline once. operating. 3. The implementation device according to the determined n and m values can process all cases where the number of input data is less than or equal to n and the number of output results is less than or equal to m. With the apparatus of the present invention, the sorting operation is improved from software implementation to hardware implementation as compared with the prior art. Assuming that there are a total of n input data and m-level data comparison units, after n + m clock cycles, the m-level data comparison units from 1 to m store m maximum values arranged in descending order. Therefore, the number of clock cycles occupied by the sort operation implemented by the hardware sequencer is proportional to n. Therefore, the device of the present invention can overcome the shortcoming that the number of clock cycles occupied by the software implementation of the sorting operation in the prior art is proportional to the factorial of n, and solves the problem that the sorting operation implemented by software in the prior art cannot meet the real-time signal processing pair. The problem of real-time requirements for data processing.

8 P17456 以上所述仅为本发明的优选实施例而已, 并不用于限制本发明, 对于本 领域的技术人员来说, 本发明可以有各种更改和变化。 凡在本发明的精神和 原则之内, 所作的任何修改、 等同替换、 改进等, 均应包含在本发明的保护 范围之内。 8 P17456 The above is only the preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes can be made to the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and scope of the present invention are intended to be included within the scope of the present invention.

9 P 17456 9 P 17456

Claims

权 利 要 求 书  Claims 1. 一种用于处理通信数据的数据排序装置, 其特征在于, 包括: A data sorting apparatus for processing communication data, comprising: 输入处理状态机, 用于处理输入的 n个通信数据;  An input processing state machine for processing the input n communication data; m个级联的数据比较单元, m<=n, 其均包括:  m cascaded data comparison units, m<=n, which all include: 比较器, 用于对所述输入的通信数据和当前最大值或当前最 小值进行比较, 得到比较结果;  a comparator, configured to compare the input communication data with a current maximum value or a current minimum value to obtain a comparison result; 选择器, 用于根据所述比较结果输出所述输入的通信数据和 所述当前最大值中的较大者或所述输入的通信数据和所述当前最 小值中的较小者至第一寄存器, 输出较小者或较大者至第二寄存 器;  a selector, configured to output, according to the comparison result, the larger of the input communication data and the current maximum value or the input communication data and the current minimum value to a first register , the smaller or larger output to the second register; 所述第一寄存器, 其用于保存所述较大者作为新的所述当前 最大值或较小者作为新的所述当前最小值, 输出给所述比较器进 行比较;  The first register is configured to save the larger one as a new current maximum value or a smaller one as a new current minimum value, and output the result to the comparator for comparison; 所述第二寄存器, 其用于保存所述较小者或较大者, 输出给 下一级所述数据比较单元;  The second register is configured to save the smaller one or the larger one, and output the data comparison unit to the next stage; 输出处理状态机, 用于将所述 m 个级联的数据比较单元中的所述 当前最大值或当前最小值依次输出, 以得到所述 n个通信数据中的 m个 排序的通信数据。  And an output processing state machine, configured to sequentially output the current maximum value or the current minimum value in the m cascaded data comparison units to obtain m pieces of the communication data in the n communication data. 2. 根据权利要求 1所述的数据排序装置, 其特征在于, 所述通信数据来自 于一个队列, 所述输入处理状态机包括: 2. The data sorting apparatus according to claim 1, wherein the communication data is from a queue, and the input processing state machine comprises: 第一读取器, 用于从所述队列依次读取所述通信数据; 计数器, 用于从所述队列中每取一个所述通信数据时, 记一次数, 当计数到 n时, 发出满信号;  a first reader, configured to sequentially read the communication data from the queue; a counter, configured to count a number of times when the communication data is taken from the queue, and when the count reaches n, issue the full Signal 第一监视器, 用于监视到所述满信号时, 禁用所述第一读取单元; 以及  a first monitor, configured to disable the first reading unit when the full signal is monitored; 第一输出器,用于依次输出所述通信数据到第一级所述数据比较单 元。  And a first outputter for sequentially outputting the communication data to the first level data comparison unit. 10 P17456 根据权利要求 2所述的数据排序装置, 其特征在于, 所述队列是先进先. 出队列。 根据权利要求 1所述的数据排序装置, 其特征在于, 所述选择器包括: 2 个二选一复用器, 其包括: 10 P17456 The data sorting apparatus according to claim 2, wherein the queue is an advanced first-out queue. The data sorting apparatus according to claim 1, wherein the selector comprises: two two-selection multiplexers, including: 第一二选一复用器, 其包括:  The first two-select multiplexer includes: 2个输入端, 其中的第一输入端用于输入所述通信数据, 第 二输入端用于输入所述第一寄存器提供的所述当前最大值或当前 最小值;  Two inputs, wherein a first input is used to input the communication data, and a second input is used to input the current maximum value or a current minimum value provided by the first register; 1个使能端, 用于输入所述比较结果; 以及  1 enable terminal for inputting the comparison result; 1 个输出端, 用于所述使能端接收到所述比较结果是所述输 入的通信数据大于所述当前最大值或小于当前最小值时, 使能输 出所述第一输入端输入的所述通信数据到所述第一寄存器; 第二二选一复用器, 其包括:  1 output terminal, configured to enable the output of the first input terminal when the communication terminal receives the comparison result that the input communication data is greater than the current maximum value or less than a current minimum value Transmitting communication data to the first register; a second two-select multiplexer, comprising: 2个输入端, 其中的第二输入端用于输入所述通信数据, 第 一输入端用于输入所述第一寄存器提供的所述当前最大值或当前 最小值; Two inputs, wherein the second input is used to input the communication data, and the first input is used to input the current maximum value or the current minimum value provided by the first register; 1个使能端, 用于输入所述比较结果; 以及  1 enable terminal for inputting the comparison result; 1 个输出端, 用于所述使能端接收到所述比较结果是所述输 入的通信数据大于所述当前最大值或小于当前最小值时, 使能输 出所述第一输入端输入的所述当前最大值或当前最小值到所述第 二寄存器; 否则, 使能输出所述第二输入端输入的所述通信数据 到所述第二寄存器。 根据权利要求 1所述的数据排序装置, 其特征在于, 所述输出处理状态 机包括:  1 output terminal, configured to enable the output of the first input terminal when the communication terminal receives the comparison result that the input communication data is greater than the current maximum value or less than a current minimum value Describe the current maximum value or the current minimum value to the second register; otherwise, enable the output of the communication data input by the second input terminal to the second register. The data sorting apparatus according to claim 1, wherein the output processing state machine comprises: 第二读取器, 用于依次读取所述 m个级联的数据比较单元; 计数器, 用于从所述 m个级联的数据比较单元中每取一个数据时, 记一次数, 当计数到 m时, 发出满信号;  a second reader, configured to sequentially read the m cascaded data comparison units; and a counter for counting each time data is taken from the m cascaded data comparison units, when counting When m is reached, a full signal is issued; 第二监视器, 用于监视到所述满信号时, 禁用所述第二读取单元; 以及  a second monitor, configured to disable the second reading unit when the full signal is monitored; 11 P17456 第二输出器, 用于依次输出所述数据到一个队列中。 11 P17456 a second outputter for sequentially outputting the data to a queue. 6. 根据权利要求 5所述的数据排序装置, 其特征在于, 所述队列是先进先 出队列。 6. The data sorting apparatus according to claim 5, wherein the queue is a first in first out queue. 7. 根据权利要求 1至 6任一项所述的数据排序装置, 其特征在于, 所述通 信数据为 k位,所述数据排序装置中的所有部件均为能处理 k位的部件。 The data sorting apparatus according to any one of claims 1 to 6, wherein the communication data is k bits, and all components in the data sorting means are components capable of processing k bits. 8. 根据权利要求 1至 6任一项所述的数据排序装置, 其特征在于, 所述第 一寄存器和所述第二寄存器是 D触发器。 The data sorting apparatus according to any one of claims 1 to 6, wherein the first register and the second register are D flip-flops. 12 P 17456 12 P 17456
PCT/CN2007/003883 2007-12-28 2007-12-28 Data sorting device for processing communication data Ceased WO2009082852A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2007/003883 WO2009082852A1 (en) 2007-12-28 2007-12-28 Data sorting device for processing communication data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2007/003883 WO2009082852A1 (en) 2007-12-28 2007-12-28 Data sorting device for processing communication data

Publications (1)

Publication Number Publication Date
WO2009082852A1 true WO2009082852A1 (en) 2009-07-09

Family

ID=40823754

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2007/003883 Ceased WO2009082852A1 (en) 2007-12-28 2007-12-28 Data sorting device for processing communication data

Country Status (1)

Country Link
WO (1) WO2009082852A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1105134A (en) * 1993-07-13 1995-07-12 三菱电机株式会社 Classification systems and methods
US5740459A (en) * 1992-10-07 1998-04-14 Motorola, Inc. Method and circuit for sorting data in a fuzzy inference data processing system
US20030123418A1 (en) * 2001-12-27 2003-07-03 Interdigital Technology Corporation Insertion sorter
CN1783760A (en) * 2004-11-30 2006-06-07 中兴通讯股份有限公司 Peak value searching and arranging device for energy signal

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5740459A (en) * 1992-10-07 1998-04-14 Motorola, Inc. Method and circuit for sorting data in a fuzzy inference data processing system
CN1105134A (en) * 1993-07-13 1995-07-12 三菱电机株式会社 Classification systems and methods
US20030123418A1 (en) * 2001-12-27 2003-07-03 Interdigital Technology Corporation Insertion sorter
CN1783760A (en) * 2004-11-30 2006-06-07 中兴通讯股份有限公司 Peak value searching and arranging device for energy signal

Similar Documents

Publication Publication Date Title
JP6109186B2 (en) Counter operation in a state machine grid
CN104487957B (en) Method and device for programmed state machine engine
EP1422611B1 (en) Microprocessor with random number generator and instruction for storing random data
JP6154824B2 (en) Boolean logic in state machine lattices
TWI515669B (en) System and method for data analysis in state machine
EP1422613B1 (en) Continuous multi-buffering random number generator
TWI220041B (en) Random number generator bit string filter
JP3188467B2 (en) Minimum / maximum value search device
CN106462431B (en) The extraction system framework in higher synthesis
JP2010517182A (en) Content end type DMA
WO2013173550A1 (en) Fusing conditional write instructions having opposite conditions in instruction processing circuits, and related processor systems, methods, and computer-readable media
CN104487956A (en) Methods and systems for using state vector data in a state machine engine
Chen et al. Computer generation of high throughput and memory efficient sorting designs on FPGA
CN101599760A (en) Asynchronous ping-pong counter
TW200409029A (en) Microprocessor including random number generator supporting operating system-independent multitasking operation
CN102736888A (en) Data retrieval circuit being synchronous with data stream
CN105868026A (en) Method and device for calculating sequence average value
CN117032801A (en) Instruction execution method, equipment, data processing system and chip for SHA256
WO2009082852A1 (en) Data sorting device for processing communication data
CN114371876B (en) Configuration circuit of register and integrated circuit chip
EP1770519A2 (en) Information processing apparatus and its data processing method capable of forming descriptor queue
JP2001168911A (en) Packet filter device
TW201631927A (en) Apparatus and method for collecting responses to multiple parallel lookup queries for a packet flow at a network switch
CN103399727A (en) Hardware integer saturation detector, method for detecting saturation and hardware device thereof
Szecowka et al. Towards hardware implementation of bzip2 data compression algorithm

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 07855884

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 07855884

Country of ref document: EP

Kind code of ref document: A1