JPWO2009066342A1 - Binary search circuit and method - Google Patents

Binary search circuit and method Download PDF

Info

Publication number
JPWO2009066342A1
JPWO2009066342A1 JP2008504558A JP2008504558A JPWO2009066342A1 JP WO2009066342 A1 JPWO2009066342 A1 JP WO2009066342A1 JP 2008504558 A JP2008504558 A JP 2008504558A JP 2008504558 A JP2008504558 A JP 2008504558A JP WO2009066342 A1 JPWO2009066342 A1 JP WO2009066342A1
Authority
JP
Japan
Prior art keywords
data
comparison
circuit
range
search
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.)
Granted
Application number
JP2008504558A
Other languages
Japanese (ja)
Other versions
JP4104649B1 (en
Inventor
貢 名古屋
貢 名古屋
Original Assignee
デュアキシズ株式会社
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 デュアキシズ株式会社 filed Critical デュアキシズ株式会社
Application granted granted Critical
Publication of JP4104649B1 publication Critical patent/JP4104649B1/en
Publication of JPWO2009066342A1 publication Critical patent/JPWO2009066342A1/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/02Comparing digital values
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2207/00Indexing scheme relating to methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F2207/02Indexing scheme relating to groups G06F7/02 - G06F7/026
    • G06F2207/025String search, i.e. pattern matching, e.g. find identical word or best match in a string

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Radar Systems Or Details Thereof (AREA)

Abstract

バイナリサーチ回路36は、昇順又は降順に整列されたデータを格納した第1データベース50から、バイナリサーチにより比較対象データを探索する。制御回路36Zは、第1データベース50の探索対象範囲を2n個に分割したとき、比較対象データxと、探索対象範囲の1/2n、・・、(2n−1)/2nの位置のデータとを、2n−1個の比較回路36A〜36Oのそれぞれに入力させ、第1段階として、探索対象範囲の1/2n1、・・、(2n1−1)/2n1の位置のデータが入力された2n1−1個の比較回路により範囲を判定し、第2段階として、第1段階で判定された範囲の1/2n2、・・、(2n2−1)/2n2の位置のデータが入力された2n2−1個の比較回路により範囲を判定し、以降同様にして、第N段階(ただし、n1+・・+nN=n)まで繰り返すことにより、n回分の探索を実行する。The binary search circuit 36 searches the comparison target data by the binary search from the first database 50 storing the data arranged in ascending order or descending order. When the search target range of the first database 50 is divided into 2n pieces, the control circuit 36Z compares the comparison target data x and the data of the search target range 1 / 2n, ..., (2n-1) / 2n Is input to each of the 2n-1 comparison circuits 36A to 36O, and as a first step, 2n1 to which data at a position of 1 / 2n1, ..., (2n1-1) / 2n1 of the search target range is input -The range is determined by one comparison circuit, and as the second stage, 2n2- is input as the data of the position of 1 / 2n2, ..., (2n2-1) / 2n2 of the range determined in the first stage The range is determined by one comparison circuit, and thereafter, the search is repeated n times by repeating until the Nth stage (where n1 +... + NN = n).

Description

本発明は、データ処理技術に関し、特に、バイナリサーチ法によりデータベースからデータを探索するバイナリサーチ回路及び方法に関する。   The present invention relates to a data processing technique, and more particularly to a binary search circuit and method for searching data from a database by a binary search method.

インターネットのインフラが整備され、携帯電話端末、パーソナルコンピュータ、VoIP(Voice over Internet Protocol)電話端末などの通信端末が広く普及した現在、インターネットの利用者は爆発的に増加している。このような状況下、コンピュータウイルス、ハッキング、スパムメールなど、セキュリティに関する問題が顕在化しており、通信を適切に制御する技術が求められている。通信環境の向上に伴って通信量も膨大になっており、大容量のデータを高速に処理する通信制御装置の必要性が増している。   With the development of the Internet infrastructure and the widespread use of communication terminals such as mobile phone terminals, personal computers, and VoIP (Voice over Internet Protocol) telephone terminals, the number of Internet users is increasing explosively. Under such circumstances, security problems such as computer viruses, hacking, and spam mails are becoming obvious, and a technique for appropriately controlling communication is required. With the improvement of the communication environment, the amount of communication has become enormous, and the need for a communication control device that processes large volumes of data at high speed is increasing.

図1は、従来の通信制御装置1の構成を示す。従来の通信制御装置1は、受信側の通信制御部2と、パケット処理部3と、送出側の通信制御部4とを備える。通信制御部2及び4は、それぞれ、パケットの物理層の処理を行うPHY処理部5a及び5bと、パケットのMAC層の処理を行うMAC処理部6a及び6bとを備える。パケット処理部3は、IP(Internet Protocol)のプロトコル処理を行うIP処理部7、TCP(Transport Control Protocol)のプロトコル処理を行うTCP処理部8など、プロトコルに応じた処理を行うプロトコル処理部と、アプリケーション層の処理を行うAP処理部9とを備える。AP処理部9は、パケットに含まれるデータに応じて、フィルタリングなどの処理を実行する。
特開平4−180425号公報
FIG. 1 shows a configuration of a conventional communication control apparatus 1. The conventional communication control device 1 includes a communication control unit 2 on the reception side, a packet processing unit 3, and a communication control unit 4 on the transmission side. The communication control units 2 and 4 include PHY processing units 5a and 5b that perform processing on the physical layer of the packet, and MAC processing units 6a and 6b that perform processing on the MAC layer of the packet, respectively. The packet processing unit 3 includes a protocol processing unit that performs processing according to a protocol, such as an IP processing unit 7 that performs IP (Internet Protocol) protocol processing and a TCP processing unit 8 that performs TCP (Transport Control Protocol) protocol processing. And an AP processing unit 9 that performs application layer processing. The AP processing unit 9 performs processing such as filtering according to the data included in the packet.
JP-A-4-180425

従来の通信制御装置1では、パケット処理部3は、汎用プロセッサであるCPUと、CPU上で動作するOSとを利用して、ソフトウェアにより実現されていた。しかしながら、このような構成では、通信制御装置1の性能はCPUの性能に依存することになり、高速に大容量のパケットを処理可能な通信制御装置を実現しようとしても、自ずと限界がある。例えば、64ビットのCPUであれば、一度に同時に処理可能なデータ量は最大で64ビットであり、それ以上の性能を有する通信制御装置は存在しなかった。   In the conventional communication control apparatus 1, the packet processing unit 3 is realized by software using a CPU that is a general-purpose processor and an OS that runs on the CPU. However, with such a configuration, the performance of the communication control device 1 depends on the performance of the CPU, and there is a limit to the implementation of a communication control device that can process a large-capacity packet at high speed. For example, in the case of a 64-bit CPU, the maximum amount of data that can be processed simultaneously at a time is 64 bits, and there has been no communication control device having higher performance.

このように、光通信網などのインフラが普及してノード間のデータ通信速度は飛躍的に向上していても、通信制御装置の処理速度が律速となって、その能力を十分に発揮することができていないのが実状である。したがって、できる限り高速な通信制御装置を早急に実現することが強く求められている。   In this way, even if the infrastructure such as an optical communication network is widespread and the data communication speed between nodes has been dramatically improved, the processing speed of the communication control device becomes the rate-determining and its ability is fully demonstrated. It is the actual situation that has not been made. Therefore, there is a strong demand to quickly realize a communication control device that is as fast as possible.

本発明はこうした状況に鑑みてなされたものであり、その目的は、高速なデータベース検索を実現する技術の提供にある。   The present invention has been made in view of such circumstances, and an object thereof is to provide a technique for realizing high-speed database search.

本発明のある態様は、バイナリサーチ回路に関する。このバイナリサーチ回路は、昇順又は降順に整列されたデータを格納したデータベースから、バイナリサーチにより比較対象データを探索する回路であって、前記データベースから読み出されたデータと前記比較対象データとを比較する2−1個の比較回路と、前記比較回路を制御する制御回路と、を備え、前記制御回路は、前記データベースの探索対象範囲を2個に分割したとき、前記比較対象データと、前記探索対象範囲の1/2、2/2、・・・、(2−1)/2の位置のデータとを、前記2−1個の比較回路のそれぞれに入力させ、まず、第1段階として、前記探索対象範囲の1/2n1、2/2n1、・・・、(2n1−1)/2n1の位置のデータが入力された2n1−1個の比較回路により、前記比較対象データが、前記探索対象範囲を2n1個に分割した範囲のいずれに属するかを判定し、つづいて、第2段階として、前記第1段階で判定された範囲の1/2n2、2/2n2、・・・、(2n2−1)/2n2の位置のデータが入力された2n2−1個の比較回路により、前記比較対象データが、前記探索対象範囲を2n1+n2個に分割した範囲のいずれに属するかを判定し、以降同様にして、第N段階(ただし、n1+n2+・・・+nN=n)まで繰り返すことにより、n回分の探索を実行し、前記n回分の探索において前記比較対象データが探索されなかった場合は、新たに、前記第N段階で判定された範囲の1/2、2/2、・・・、(2−1)/2の位置のデータを、前記2−1個の比較回路のそれぞれに入力させ、次のn回分の探索を実行することを特徴とする。One embodiment of the present invention relates to a binary search circuit. This binary search circuit is a circuit for searching for comparison target data by a binary search from a database storing data arranged in ascending or descending order, and compares the data read from the database with the comparison target data 2 n -1 comparison circuits and a control circuit that controls the comparison circuit, and the control circuit divides the search target range of the database into 2 n pieces, 1/2 n, 2/2 n of said search range, ..., and the data of the position of the (2 n -1) / 2 n, is input to each of the 2 n -1 comparison circuits, First, as a first stage, 2 n1 −1 comparisons in which data at positions of 1/2 n1 , 2/2 n1 ,..., (2 n1 −1) / 2 n1 of the search target range are input. Before circuit Comparison target data, the search range to determine one to belongs of the ranges divided in 2 n1 pieces, followed, in a second stage, 1/2 n2 range determined in the first step, 2 / 2 n2 ,..., (2 n2 −1) / 2 The comparison target data is converted into the 2 n1 + n2 search target ranges by 2 n2 −1 comparison circuits to which data at the position of n2 is input. It is determined which of the divided ranges it belongs to, and thereafter, in the same manner, by repeating up to the Nth stage (where n1 + n2 +... + NN = n), n times of searches are executed. When the comparison target data is not searched, a position of ½ n , 2/2 n ,..., (2 n −1) / 2 n newly determined in the Nth stage Of the 2 n -1 comparison circuits And the next n searches are executed.

バイナリサーチ回路は、第m(1≦m<N)段階の比較回路の比較結果を示す出力信号から、次の第(m+1)段階の比較回路のうち前記第m段階で判定された範囲のデータが入力されている比較回路に比較を実行させるトリガ信号を生成して第(m+1)段階の比較回路に入力するトリガ回路を更に備えてもよい。   The binary search circuit uses the output signal indicating the comparison result of the m-th (1 ≦ m <N) -stage comparison circuit to determine the data in the range determined in the m-th stage among the next (m + 1) -th comparison circuits. A trigger circuit that generates a trigger signal that causes the comparison circuit to input the comparison to be input to the (m + 1) -th stage comparison circuit may be further provided.

前記トリガ回路は、第m段階の2−1個の比較回路のうち、隣接する比較回路から異なる比較結果を示す出力信号が出力されたときに、それらの比較回路に入力されているデータの間の範囲のデータが入力された第(m+1)段階の比較回路に前記トリガ信号を入力してもよい。When the output signal indicating a different comparison result is output from an adjacent comparison circuit among the 2 m −1 comparison circuits in the m-th stage, the trigger circuit is configured to store the data input to the comparison circuits. The trigger signal may be input to the (m + 1) -th stage comparison circuit to which data in the range is input.

第m(1≦m<N)段階において、2−1個の比較回路は、同時に並列して比較を実行してもよい。In the m-th (1 ≦ m <N) stage, the 2 m −1 comparison circuits may perform the comparison in parallel.

バイナリサーチ回路は、前記比較回路のそれぞれに接続された2−1個の前記データベースを備えてもよく、前記制御回路は、前記探索対象範囲の1/2、2/2、・・・、(2−1)/2の位置のデータを、それぞれの比較回路に接続されたデータベースから並列して入力させてもよい。Binary search circuit may comprise a 2 n -1 one of said database connected to each of the comparator circuit, the control circuit, 1/2 n, 2/2 n of said search range, ... The data at the position (2 n -1) / 2 n may be input in parallel from the database connected to each comparison circuit.

本発明の別の態様は、バイナリサーチ方法に関する。このバイナリサーチ方法は、昇順又は降順に整列されたデータを格納したデータベースの探索対象範囲を2個に分割したとき、比較対象データと、前記探索対象範囲の1/2、2/2、・・・、(2−1)/2の位置のデータとを、2−1個の比較回路のそれぞれに入力させるステップと、第1段階として、前記探索対象範囲の1/2n1、2/2n1、・・・、(2n1−1)/2n1の位置のデータが入力された2n1−1個の比較回路により、前記比較対象データが、前記探索対象範囲を2n1個に分割した範囲のいずれに属するかを判定するステップと、第2段階として、前記第1段階で判定された範囲の1/2n2、2/2n2、・・・、(2n2−1)/2n2の位置のデータが入力された2n2−1個の比較回路により、前記比較対象データが、前記探索対象範囲を2n1+n2個に分割した範囲のいずれに属するかを判定するステップと、以降同様にして、第N段階(ただし、n1+n2+・・・+nN=n)まで繰り返すことにより、n回分の探索を実行するステップと、前記n回分の探索において前記比較対象データが探索されなかった場合は、新たに、前記第N段階で判定された範囲の1/2、2/2、・・・、(2−1)/2の位置のデータを、前記2−1個の比較回路のそれぞれに入力させ、次のn回分の探索を実行するステップと、を含むことを特徴とする。Another aspect of the present invention relates to a binary search method. In this binary search method, when the search target range of the database storing data arranged in ascending or descending order is divided into 2 n pieces, the comparison target data and 1/2 n of the search target range, 2/2 n ,..., (2 n −1) / 2 n position data is input to each of the 2 n −1 comparison circuits, and as a first step, 1/2 of the search target range. n1 , 2/2 n1 ,..., (2 n1 −1) / 2 The data to be compared is divided into two search target ranges by 2 n1 −1 comparison circuits to which data at the position of n1 is input. A step of determining which of the ranges divided into n1 pieces and a second stage include 1/2 n2 , 2/2 n2 ,... (2 n2 − 1) / 2 n 2 where data at position n2 is input In the same manner as the step of determining which of the 2 1 -1 comparison circuits the comparison target data belongs to the range obtained by dividing the search target range into 2 n1 + n2 , and thereafter, the Nth stage (where n1 + n2 + ... + NN = n) by repeating the search for n times, and when the comparison target data is not searched in the n times of search, it is newly determined in the Nth stage. , N 2, 2/2 n ,..., (2 n −1) / 2 n is input to each of the 2 n −1 comparison circuits, and the next n Performing a batch of searches.

なお、以上の構成要素の任意の組合せ、本発明の表現を方法、装置、システム、記録媒体、コンピュータプログラムなどの間で変換したものもまた、本発明の態様として有効である。   It should be noted that any combination of the above-described constituent elements and a conversion of the expression of the present invention between a method, an apparatus, a system, a recording medium, a computer program, etc. are also effective as an aspect of the present invention.

本発明によれば、高速なバイナリサーチを実現する技術を提供することができる。   ADVANTAGE OF THE INVENTION According to this invention, the technique which implement | achieves a high-speed binary search can be provided.

従来の通信制御装置の構成を示す図である。It is a figure which shows the structure of the conventional communication control apparatus. 実施の形態に係る通信制御装置の構成を示す図である。It is a figure which shows the structure of the communication control apparatus which concerns on embodiment. パケット処理回路の構成を示す図である。It is a figure which shows the structure of a packet processing circuit. 位置検出回路の構成を示す図である。It is a figure which shows the structure of a position detection circuit. 位置検出回路の別の例を示す図である。It is a figure which shows another example of a position detection circuit. 位置検出回路の別の例を示す図である。It is a figure which shows another example of a position detection circuit. 第1のデータベースの内部データを例を示す図である。It is a figure which shows the internal data of a 1st database. 第1のデータベースの内部データを別の例を示す図である。It is a figure which shows another example of the internal data of a 1st database. 第1のデータベースの内部データを更に別の例を示す図である。It is a figure which shows another example of the internal data of a 1st database. インデックス回路の別の例を示す図である。It is a figure which shows another example of an index circuit. バイナリサーチ回路に含まれる比較回路の構成を示す図である。It is a figure which shows the structure of the comparison circuit contained in a binary search circuit. バイナリサーチ回路の構成を示す図である。It is a figure which shows the structure of a binary search circuit. 第1のデータベースの内部データの更に別の例を示す図である。It is a figure which shows another example of the internal data of a 1st database. 第2のデータベースの内部データの例を示す図である。It is a figure which shows the example of the internal data of a 2nd database. 第2のデータベースの内部データの別の例を示す図である。It is a figure which shows another example of the internal data of a 2nd database. バイナリサーチ回路の別の構成例を示す図である。It is a figure which shows another structural example of a binary search circuit. バイナリサーチ回路の更に別の構成例を示す図である。It is a figure which shows another example of a structure of a binary search circuit.

符号の説明Explanation of symbols

10 通信制御装置、20 パケット処理回路、30 検索回路、32 位置検出回路、33 比較回路、34 インデックス回路、35 比較回路、36 バイナリサーチ回路、36A〜36O 比較回路、37 否定回路、38A,38B 排他的論理和回路、36Z 制御回路、40 処理実行回路、50 第1データベース、60 第2データベース。   10 communication control device, 20 packet processing circuit, 30 search circuit, 32 position detection circuit, 33 comparison circuit, 34 index circuit, 35 comparison circuit, 36 binary search circuit, 36A to 36O comparison circuit, 37 negation circuit, 38A, 38B exclusive Logical OR circuit, 36Z control circuit, 40 processing execution circuit, 50 first database, 60 second database.

図2は、本発明のデータ処理装置の一例である通信制御装置の構成を示す。本実施の形態の通信制御装置10は、従来の通信制御装置においてはCPU及びOSを含むソフトウェアにより実現されていたパケット処理部に代えて、ワイヤードロジック回路による専用のハードウェアにより構成されたパケット処理回路20を備える。汎用処理回路であるCPUにおいて動作するOSとソフトウェアにより通信データを処理するのではなく、通信データを処理するための専用のハードウェア回路を設けることにより、CPUやOSなどに起因する性能の限界を克服し、処理能力の高い通信制御装置を実現することが可能となる。   FIG. 2 shows a configuration of a communication control apparatus which is an example of the data processing apparatus of the present invention. The communication control device 10 according to the present embodiment is a packet processing unit configured by dedicated hardware using a wired logic circuit instead of the packet processing unit realized by software including a CPU and an OS in the conventional communication control device. A circuit 20 is provided. Rather than processing communication data with an OS and software that run on a CPU that is a general-purpose processing circuit, a dedicated hardware circuit for processing communication data is provided, thereby limiting the performance limit caused by the CPU, OS, etc. It is possible to overcome and realize a communication control device with high processing capability.

例えば、パケットフィルタリングなどを実行するために、パケットに含まれるデータに、フィルタリングの判断基準となる基準データが含まれるか否かを検索する場合に、CPUを用いて通信データと基準データを比較すると、一度に高々64ビットしか比較することができず、処理速度を向上させようとしてもCPUの性能で頭打ちになるという問題があった。CPUでは、通信データから64ビットをメモリへ読み上げ、基準データとの比較を行い、つづいて、次の64ビットをメモリへ読み上げる、という処理を何度も繰り返し行う必要があるので、メモリへの読み上げ時間が律速となり、処理速度に限界がある。   For example, when searching for whether or not the data included in the packet includes reference data that is a criterion for filtering in order to perform packet filtering or the like, the communication data and the reference data are compared using the CPU. However, only 64 bits can be compared at a time, and even if it is attempted to improve the processing speed, there is a problem that the performance of the CPU reaches a peak. In the CPU, it is necessary to repeat the process of reading 64 bits from the communication data into the memory, comparing with the reference data, and then reading the next 64 bits into the memory. Time is rate limiting and processing speed is limited.

それに対し、本実施の形態では、通信データと基準データとを比較するために、ワイヤードロジック回路により構成された専用のハードウェア回路を設ける。この回路は、64ビットよりも長いデータ長、例えば、1024ビットのデータ長の比較を可能とするために、並列に設けられた複数の比較器を含む。このように、専用のハードウェアを設けることにより、同時に並列して多数のビットマッチングを実行することができる。従来のCPUを用いた通信制御装置1では一度に64ビットしか処理できなかったところを、一度に1024ビットの処理を可能にすることで、飛躍的に処理速度を向上させることができる。比較器の数を多くすれば処理能力も向上するが、コストやサイズも増大するので、所望の処理性能と、コスト、サイズ、などを考慮して、最適なハードウェア回路を設計すればよい。   On the other hand, in the present embodiment, a dedicated hardware circuit configured by a wired logic circuit is provided to compare communication data and reference data. This circuit includes a plurality of comparators provided in parallel to enable comparison of data lengths longer than 64 bits, for example, a data length of 1024 bits. In this way, by providing dedicated hardware, a large number of bit matching operations can be executed in parallel at the same time. The communication control apparatus 1 using a conventional CPU can process 1024 bits at a time, which can process only 64 bits at a time, and can dramatically improve the processing speed. If the number of comparators is increased, the processing capability is improved, but the cost and size also increase. Therefore, an optimum hardware circuit may be designed in consideration of desired processing performance, cost, size, and the like.

また、本実施の形態の通信制御装置10は、ワイヤードロジック回路による専用のハードウェアにより構成されるので、OS(Operating System)を必要としない。このため、OSのインストール、バグ対応、バージョンアップなどの作業が必要なく、管理やメンテナンスのためのコストや工数を低減させることができる。また、汎用的な機能が求められるCPUとは異なり、不必要な機能を包含していないので、余計なリソースを用いることがなく、低コスト化、回路面積の低減、処理速度の向上などが望める。さらに、OSを利用していた従来の通信制御装置とは異なり、余分な機能を有しないので、セキュリティホールなどが発生する可能性が低く、ネットワークを介した悪意ある第三者からの攻撃に対する耐性に優れている。   Further, since the communication control apparatus 10 of the present embodiment is configured by dedicated hardware using a wired logic circuit, an OS (Operating System) is not required. For this reason, there is no need for OS installation, bug handling, version upgrade, and the like, and costs and man-hours for management and maintenance can be reduced. Unlike CPUs that require general-purpose functions, unnecessary functions are not included, so unnecessary resources are not used, and cost reduction, circuit area reduction, and processing speed improvement can be expected. . Furthermore, unlike conventional communication control devices that use an OS, it does not have an extra function, so it is unlikely that security holes will occur, and is resistant to attacks from malicious third parties via the network. Is excellent.

従来の通信制御装置1は、CPUとOSを前提としたソフトウェアによりパケットを処理しており、パケットの全てのデータを受信してからプロトコル処理を行い、データがアプリケーションに渡される。それに対して、本実施の形態の通信制御装置10では、専用のハードウェア回路により処理を行うので、パケットの全てのデータを受信してから処理を開始する必要はなく、処理に必要なデータを受信すれば、後続のデータの受信を待たずに、任意の時点で処理を開始することができる。例えば、後述する位置検出回路における位置検出処理は、比較対象データの位置を特定するための位置特定データを受信した時点で開始することができる。このように、全てのデータの受信を待たずに様々な処理をフローティングで実行することができるので、パケットのデータを処理するのに要する時間を短縮することができる。   The conventional communication control apparatus 1 processes a packet by software premised on a CPU and an OS, receives all data of the packet, performs protocol processing, and passes the data to the application. On the other hand, in the communication control apparatus 10 according to the present embodiment, since processing is performed by a dedicated hardware circuit, it is not necessary to start processing after receiving all the data of the packet. If received, the process can be started at an arbitrary time without waiting for the reception of subsequent data. For example, position detection processing in a position detection circuit described later can be started when position specifying data for specifying the position of comparison target data is received. As described above, since various processes can be executed in a floating manner without waiting for reception of all data, the time required to process packet data can be shortened.

図3は、パケット処理回路の内部構成を示す。パケット処理回路20は、通信データに対して実行する処理の内容を決定するための基準となる基準データを記憶する第1データベース50A、50B、及び50C(これらを総称して「第1データベース50」という)と、受信された通信データの中に基準データが含まれているか否かを、通信データと基準データとを比較することにより検索する検索回路30と、検索回路30による検索結果と通信データに対して実行する処理の内容とを対応づけて記憶する第2データベース60と、検索回路30による検索結果と第2データベース60に記憶された条件とに基づいて通信データを処理する処理実行回路40とを含む。   FIG. 3 shows the internal configuration of the packet processing circuit. The packet processing circuit 20 includes first databases 50A, 50B, and 50C that store reference data serving as a reference for determining the contents of processing to be performed on communication data (collectively, “first database 50”). And a search circuit 30 that searches whether the received communication data includes reference data by comparing the communication data with the reference data, and the search result by the search circuit 30 and the communication data. The second database 60 that stores the contents of the processing to be executed in association with each other, the processing execution circuit 40 that processes the communication data based on the search result by the search circuit 30 and the conditions stored in the second database 60. Including.

検索回路30は、通信データの中から基準データと比較すべき比較対象データの位置を検出する位置検出回路32と、第1データベース50に記憶された基準データを3以上の範囲に分割したとき、比較対象データがそれらの範囲のうちいずれに属するかを判定する判定回路の一例であるインデックス回路34と、判定された範囲の中で比較対象データと合致する基準データを検索するバイナリサーチ回路36とを含む。比較対象データを基準データの中から検索する方法としては、任意の検索技術を利用可能であるが、本実施の形態ではバイナリサーチ法を用いる。本実施の形態では、後述するように、改良されたバイナリサーチ法を用いるので、そのために第1データベース50を3つ設けている。第1データベース50A、50B、及び50Cには、同じ基準データが格納されている。   When the search circuit 30 divides the reference data stored in the first database 50 into three or more ranges, the position detection circuit 32 detects the position of the comparison target data to be compared with the reference data from the communication data. An index circuit 34 that is an example of a determination circuit that determines to which of the ranges the comparison target data belongs; a binary search circuit 36 that searches for reference data that matches the comparison target data in the determined range; including. Although any search technique can be used as a method for searching the comparison target data from the reference data, the binary search method is used in the present embodiment. In the present embodiment, as will be described later, since an improved binary search method is used, three first databases 50 are provided for this purpose. The same reference data is stored in the first databases 50A, 50B, and 50C.

図4は、位置検出回路の内部構成を示す。位置検出回路32は、比較対象データの位置を特定するための位置特定データと通信データとを比較するための複数の比較回路33a〜33fを含む。ここでは、6個の比較回路33a〜33fが設けられているが、後述するように、比較回路の個数は任意でよい。それぞれの比較回路33a〜33fには、通信データが、所定のデータ長、例えば、1バイトずつずらして入力される。そして、これら複数の比較回路33a〜33fにおいて、同時に並列して、検出すべき位置特定データと通信データとの比較がなされる。   FIG. 4 shows the internal configuration of the position detection circuit. The position detection circuit 32 includes a plurality of comparison circuits 33a to 33f for comparing the position specifying data for specifying the position of the comparison target data with the communication data. Here, six comparison circuits 33a to 33f are provided, but the number of comparison circuits may be arbitrary as will be described later. Communication data is input to each of the comparison circuits 33a to 33f with a predetermined data length, for example, shifted by 1 byte. In the plurality of comparison circuits 33a to 33f, the position specifying data to be detected and the communication data are compared in parallel at the same time.

本実施の形態においては、通信制御装置10の動作を説明するための例として、通信データ中に含まれる「No. ###」という文字列を検出し、その文字列中に含まれる数字「###」を基準データと比較して、基準データに合致した場合はパケットの通過を許可し、合致しなかった場合はパケットを破棄する処理を行う場合について説明する。   In the present embodiment, as an example for explaining the operation of the communication control apparatus 10, a character string “No. ##” included in the communication data is detected, and a number “ “##” is compared with the reference data, and the case where the packet is allowed to pass if it matches the reference data and the packet is discarded if it does not match will be described.

図4の例では、通信データの中から、数字「###」の位置を特定するための位置特定データ「No.」を検出するために、通信データ「01No. 361・・・」を、1文字ずつずらして比較回路33a〜33fに入力している。すなわち、比較回路33aには「01N」が、比較回路33bには「1No」が、比較回路33cには「No.」が、比較回路33dには「o. 」が、比較回路33eには「. 3」が、比較回路33fには「 36」が、それぞれ入力される。ここで、比較回路33a〜33fが同時に位置特定データ「No.」との比較を実行する。これにより、比較回路33cがマッチし、通信データの先頭から3文字目に「No.」という文字列が存在することが検出される。こうして、位置検出回路32により検出された位置特定データ「No.」の次に、比較対象データである数字のデータが存在することが検出される。   In the example of FIG. 4, in order to detect the position specifying data “No.” for specifying the position of the number “####” from the communication data, the communication data “01No. 361. Each character is shifted and input to the comparison circuits 33a to 33f. That is, the comparison circuit 33a has "01N", the comparison circuit 33b has "1No", the comparison circuit 33c has "No.", the comparison circuit 33d has "o." . 3 ”and“ 36 ”are input to the comparison circuit 33f. Here, the comparison circuits 33a to 33f simultaneously perform comparison with the position specifying data “No.”. Thereby, the comparison circuit 33c matches, and it is detected that the character string “No.” exists in the third character from the head of the communication data. In this way, it is detected that numerical data that is comparison target data exists after the position specifying data “No.” detected by the position detection circuit 32.

CPUにより同様の処理を行うならば、まず、文字列「01N」を「No.」と比較し、続いて、文字列「1No」を「No.」と比較する、というように、先頭から順に1つずつ比較処理を実行する必要があるため、検出速度の向上は望めない。これに対し、本実施の形態の通信制御装置10では、複数の比較回路33a〜33fを並列に設けることにより、CPUではなしえなかった同時並列的な比較処理が可能となり、処理速度を格段に向上させることができる。比較回路は多ければ多いほど同時に比較可能な位置が多くなるので、検出速度も向上するが、コスト、サイズ、などを考慮の上、所望の検出速度を得られるのに十分な数の比較回路を設ければよい。   If similar processing is performed by the CPU, first, the character string “01N” is compared with “No.”, and then the character string “1No” is compared with “No.”. Since it is necessary to execute comparison processing one by one, improvement in detection speed cannot be expected. On the other hand, in the communication control apparatus 10 according to the present embodiment, by providing a plurality of comparison circuits 33a to 33f in parallel, simultaneous parallel comparison processing that cannot be performed by the CPU becomes possible, and the processing speed is remarkably increased. Can be improved. As the number of comparison circuits increases, the number of positions that can be compared simultaneously increases, so the detection speed also improves.However, considering the cost, size, etc., a sufficient number of comparison circuits are required to obtain the desired detection speed. What is necessary is just to provide.

位置検出回路32は、位置特定データを検出するためだけでなく、汎用的に文字列を検出する回路として利用されてもよい。また、文字列だけでなく、ビット単位で位置特定データを検出するように構成されてもよい。   The position detection circuit 32 may be used not only for detecting position specifying data but also for detecting a character string for general use. Further, not only the character string but also the position specifying data may be detected in bit units.

図5は、位置検出回路の別の例を示す。図5に示した例では、位置検出回路32に設けられたそれぞれの比較回路33a〜33fのデータ長よりも位置特定データの方が短い場合は、位置特定データの後に所定のデータ、例えば、「00H」又は「01H」などをパディングする。また、位置特定データと比較する通信データについても、位置特定データと同じデータ長のみを抜き出して、その後に、位置特定データにパディングしたデータと同じデータをパディングする。このとき、通信データ自身を改変しないために、通信データをワークとしてコピーし、コピーしたデータを加工して比較回路33a〜33fに入力してもよい。これにより、位置特定データのデータ長によらず、位置検出回路32を汎用的に用いることができる。   FIG. 5 shows another example of the position detection circuit. In the example illustrated in FIG. 5, when the position specifying data is shorter than the data length of each of the comparison circuits 33 a to 33 f provided in the position detecting circuit 32, predetermined data such as “ "00H" or "01H" is padded. For communication data to be compared with the position specifying data, only the same data length as the position specifying data is extracted, and then the same data as the data padded in the position specifying data is padded. At this time, in order not to modify the communication data itself, the communication data may be copied as a work, and the copied data may be processed and input to the comparison circuits 33a to 33f. Thereby, the position detection circuit 32 can be used for general purposes regardless of the data length of the position specifying data.

図6は、位置検出回路の更に別の例を示す。図6に示した例では、図5に示した例と同様に、位置特定データの後に所定のデータをパディングするが、このデータをワイルドカードとして扱う。すなわち、比較回路33a〜33fは、ワイルドカードであるデータが入力されると、比較対象のデータが何であっても無条件に合致したと判定する。これにより、位置特定データのデータ長によらず、位置検出回路32を汎用的に用いることができる。   FIG. 6 shows still another example of the position detection circuit. In the example shown in FIG. 6, as in the example shown in FIG. 5, predetermined data is padded after the position specifying data, but this data is treated as a wild card. In other words, when data that is a wild card is input, the comparison circuits 33a to 33f determine that the data to be compared matches unconditionally. Thereby, the position detection circuit 32 can be used for general purposes regardless of the data length of the position specifying data.

図7は、第1データベースの内部データの例を示す。第1データベース50には、パケットのフィルタリング、ルーティング、スイッチング、置換などの処理の内容を決定するための基準となる基準データが、何らかのソート条件にしたがって昇順又は降順にソートされて格納されている。図7の例では、1000個の基準データが記憶されている。   FIG. 7 shows an example of internal data of the first database. The first database 50 stores reference data serving as a reference for determining processing contents such as packet filtering, routing, switching, and replacement, sorted in ascending or descending order according to some sort condition. In the example of FIG. 7, 1000 pieces of reference data are stored.

インデックス回路34は、第1データベース50に格納されている基準データを3以上の範囲52a〜52dに分割したとき、比較対象データがそれらの範囲のうちいずれに属するかを判定する。図7の例では、1000個の基準データは、250個ずつ4つの範囲52a〜52dに分割されている。インデックス回路34は、範囲の境界の基準データと比較対象データとを比較する複数の比較回路35a〜35cを含む。比較回路35a〜35cにより比較対象データと境界の基準データとを同時に並列して比較することにより、比較対象データがいずれの範囲に属するかを1度の比較処理で判定することができる。   When the reference data stored in the first database 50 is divided into three or more ranges 52a to 52d, the index circuit 34 determines to which of the ranges the comparison target data belongs. In the example of FIG. 7, 1000 pieces of reference data are divided into four ranges 52 a to 52 d, each having 250 pieces. The index circuit 34 includes a plurality of comparison circuits 35a to 35c that compare the reference data at the boundary of the range with the comparison target data. By comparing the comparison target data with the boundary reference data simultaneously in parallel by the comparison circuits 35a to 35c, it is possible to determine in which range the comparison target data belongs by one comparison process.

インデックス回路34の比較回路35a〜35cに入力される境界の基準データは、通信制御装置10の外部に設けられた装置により設定されてもよいし、予め第1データベース50の所定位置の基準データが自動的に入力されるようにしてもよい。後者の場合、第1データベース50を更新しても、自動的に第1データベース50の所定位置の基準データが比較回路35a〜35cに入力されるので、初期設定などを必要とせず、直ちに通信制御処理を実行させることができる。   The boundary reference data input to the comparison circuits 35 a to 35 c of the index circuit 34 may be set by a device provided outside the communication control device 10, or the reference data at a predetermined position in the first database 50 is previously stored. You may make it input automatically. In the latter case, even if the first database 50 is updated, the reference data at a predetermined position in the first database 50 is automatically input to the comparison circuits 35a to 35c. Processing can be executed.

前述したように、CPUによりバイナリサーチを実行する場合は、同時に複数の比較を実行することができないが、本実施の形態の通信制御装置10では、複数の比較回路35a〜35cを並列に設けることにより、同時並列的な比較処理を可能とし、検索速度を格段に向上させることができる。   As described above, when a binary search is executed by the CPU, a plurality of comparisons cannot be executed at the same time. However, in the communication control device 10 of the present embodiment, a plurality of comparison circuits 35a to 35c are provided in parallel. Thus, simultaneous parallel processing can be performed, and the search speed can be remarkably improved.

インデックス回路34により範囲が判定されると、バイナリサーチ回路36がバイナリサーチ法により検索を実行する。バイナリサーチ回路36は、インデックス回路34により判定された範囲をさらに2個に分割し、その境界位置にある基準データと比較対象データとを比較することにより、いずれの範囲に属するかを判定する。バイナリサーチ回路36は、基準データと比較対象データとをビット単位で比較する比較器を複数個、例えば本実施の形態では1024個含んでおり、1024ビットのビットマッチングを同時に実行する。2分割された範囲のいずれに属するかが判定されると、さらに、その範囲を2分割して境界位置にある基準データを読み出し、比較対象データと比較する。以降、この処理を繰り返すことにより範囲をさらに限定し、最終的に比較対象データと合致する基準データを検索する。When the range is determined by the index circuit 34, the binary search circuit 36 executes a search by the binary search method. The binary search circuit 36 further divides the range determined by the index circuit 34 into 2 n pieces, and compares the reference data at the boundary position with the comparison target data to determine which range the data belongs to. . The binary search circuit 36 includes a plurality of, for example, 1024 comparators in this embodiment for comparing the reference data and the comparison target data in bit units, and simultaneously executes 1024-bit bit matching. When it is determined which of the 2n- divided ranges it belongs, the range is further divided into 2n , the reference data at the boundary position is read, and compared with the comparison target data. Thereafter, this process is repeated to further limit the range, and finally, reference data that matches the comparison target data is searched.

前述した例を用いてさらに詳細に動作を説明する。インデックス回路34の比較回路35a〜35cには、比較対象データとして「361」が入力され、基準データとして、比較回路35aには、範囲52aと52bの境界にある基準データ「378」が、比較回路35bには、範囲52bと52cの境界にある基準データ「704」が、比較回路35cには、範囲52cと52dの境界にある基準データ「937」が、それぞれ入力される。比較回路35a〜35cにより同時に比較が行われ、比較対象データ「361」が範囲52aに属することが判定される。以降、バイナリサーチ回路36が基準データの中に比較対象データ「361」が存在するか否かを検索する。   The operation will be described in more detail using the example described above. “361” is input as comparison target data to the comparison circuits 35a to 35c of the index circuit 34, and reference data “378” at the boundary between the ranges 52a and 52b is input to the comparison circuit 35a as reference data. The reference data “704” at the boundary between the ranges 52b and 52c is input to 35b, and the reference data “937” at the boundary between the ranges 52c and 52d is input to the comparison circuit 35c. The comparison circuits 35a to 35c perform comparison at the same time, and it is determined that the comparison target data “361” belongs to the range 52a. Thereafter, the binary search circuit 36 searches whether or not the comparison target data “361” exists in the reference data.

図8は、第1データベースの内部データの別の例を示す。図8に示した例では、基準データのデータ数が、第1データベース50に保持可能なデータ数、ここでは1000個よりも少ない。このとき、第1データベース50には、最終データ位置から降順に基準データが格納される。そして、残りのデータには0が格納される。データベースのローディング方法として、先頭からデータを配置せずにローディングエリアの後方から配置し、ローディングエリア先頭に空きが生じた場合は全ての空きをゼロサプレスすることで、データーベースは常にフルの状態になり、バイナリー検索する場合の検索時間を一定にすることができる。また、バイナリサーチ回路36は、検索中に基準データとして「0」を読み込んだときには、比較結果が自明であるから、比較を行わずに範囲を特定して、次の比較にうつることができる。これにより、検索速度を向上させることができる。   FIG. 8 shows another example of internal data of the first database. In the example shown in FIG. 8, the number of reference data is less than the number of data that can be held in the first database 50, here 1000. At this time, the first database 50 stores the reference data in descending order from the last data position. Then, 0 is stored in the remaining data. As a database loading method, data is placed from the back of the loading area without placing data from the beginning, and if there is a space at the beginning of the loading area, all the space is zero-suppressed, so the database is always full. The search time for binary search can be made constant. Further, when “0” is read as the reference data during the search, the binary search circuit 36 can determine the range without performing the comparison and can proceed to the next comparison because the comparison result is self-explanatory. Thereby, the search speed can be improved.

CPUによるソフトウェア処理においては、第1データベース50に基準データを格納する際に、最初のデータ位置から昇順に基準データが格納される。残りのデータには、例えば最大値が格納されることになるが、この場合、バイナリサーチにおいて、上述したような比較処理の省略はできない。上述した比較技術は、専用のハードウェア回路により検索回路30を構成したことにより実現される。   In the software processing by the CPU, when the reference data is stored in the first database 50, the reference data is stored in ascending order from the first data position. For example, the maximum value is stored in the remaining data. In this case, the comparison process as described above cannot be omitted in the binary search. The comparison technique described above is realized by configuring the search circuit 30 with a dedicated hardware circuit.

図9は、第1データベースの内部データのさらに別の例を示す。図9に示した例では、基準データを均等に3以上の範囲に分割するのではなく、範囲52aは500個、範囲52bは100個というように、範囲に属する基準データの数が不均一になっている。これらの範囲は、通信データ中における基準データの出現頻度の分布に応じて設定されてもよい。すなわち、それぞれの範囲に属する基準データの出現頻度の和がほぼ同じになるように範囲が設定されてもよい。これにより、検索効率を向上させることができる。インデックス回路34の比較回路35a〜35cに入力される基準データは、外部から変更可能になっていてもよい。これにより、範囲を動的に設定することができ、検索効率を最適化することができる。   FIG. 9 shows still another example of internal data of the first database. In the example shown in FIG. 9, the reference data is not equally divided into three or more ranges, but the number of reference data belonging to the range is uneven, such as 500 for the range 52a and 100 for the range 52b. It has become. These ranges may be set according to the distribution of the appearance frequency of the reference data in the communication data. That is, the ranges may be set so that the sum of the appearance frequencies of the reference data belonging to the respective ranges is substantially the same. Thereby, search efficiency can be improved. The reference data input to the comparison circuits 35a to 35c of the index circuit 34 may be changeable from the outside. Thereby, a range can be set dynamically and search efficiency can be optimized.

図10は、インデックス回路の別の例を示す。図7〜9に示した例では、インデックス回路34は、3つの比較回路35a〜35cを用いて、比較対象データが第1データベース50の4つの範囲52a〜52dのいずれに属するかを判定したが、図10の例では、インデックス回路34には、比較対象データが、4つの範囲52a〜52dのそれぞれに含まれるか否かを判定するための4つの比較回路35d〜35gが設けられている。例えば、比較回路35dには、第1データベース50の0件目の基準データと、250件目の基準データと、比較対象データとが入力され、それぞれの基準データと比較対象データとを比較することにより、基準データが範囲52aに含まれるか否かを判定する。それぞれの比較回路35d〜35gの比較結果は判定回路35zに入力され、判定回路35zから、基準データがいずれの範囲に含まれているかが出力される。比較回路35d〜35gは、基準データが入力された2つの基準データの間に含まれるか否かを出力してもよいし、範囲よりも大きい、範囲に含まれる、範囲よりも小さい、のいずれかを出力してもよい。比較対象データが、範囲52a〜52dのいずれにも含まれないと判定された場合は、比較対象データが第1データベース50中に存在しないことが分かるので、以降のバイナリサーチを行うまでもなく、検索を終了することができる。   FIG. 10 shows another example of the index circuit. In the example shown in FIGS. 7 to 9, the index circuit 34 uses the three comparison circuits 35 a to 35 c to determine which of the four ranges 52 a to 52 d of the first database 50 belongs to the comparison target data. In the example of FIG. 10, the index circuit 34 is provided with four comparison circuits 35d to 35g for determining whether or not the comparison target data is included in each of the four ranges 52a to 52d. For example, the comparison circuit 35d receives the 0th reference data, the 250th reference data, and the comparison target data in the first database 50, and compares each reference data with the comparison target data. Thus, it is determined whether or not the reference data is included in the range 52a. The comparison results of the respective comparison circuits 35d to 35g are input to the determination circuit 35z, and the determination circuit 35z outputs in which range the reference data is included. The comparison circuits 35d to 35g may output whether or not the reference data is included between the two input reference data, and may be any one of larger than the range, included in the range, and smaller than the range. May be output. If it is determined that the comparison target data is not included in any of the ranges 52a to 52d, it can be seen that the comparison target data does not exist in the first database 50. The search can be terminated.

図11は、バイナリサーチ回路に含まれる比較回路の構成を示す。前述したように、バイナリサーチ回路36に含まれる比較回路は、1024個の比較器36a、36b、・・・、を含む。それぞれの比較器36a、36b、・・・、には、基準データ54と比較対象データ56が1ビットずつ入力され、それらの大小が比較される。インデックス回路34の各比較回路35a〜35cの内部構成も同様である。このように、専用のハードウェア回路で比較処理を実行することにより、多数の比較回路を並列して動作させ、多数のビットを同時に比較することができるので、比較処理を高速化することができる。   FIG. 11 shows a configuration of a comparison circuit included in the binary search circuit. As described above, the comparison circuit included in the binary search circuit 36 includes 1024 comparators 36a, 36b,. Each of the comparators 36a, 36b,... Receives the reference data 54 and the comparison target data 56 one bit at a time, and compares them. The internal configurations of the comparison circuits 35a to 35c of the index circuit 34 are the same. In this way, by executing the comparison process with a dedicated hardware circuit, a large number of comparison circuits can be operated in parallel and a large number of bits can be compared simultaneously, so that the comparison process can be speeded up. .

図12は、バイナリサーチ回路の構成を示す。バイナリサーチ回路36は、図11に示した1024個の比較器36a、36b、・・・を含む比較回路36A、36B、及び36Cと、それらの比較回路を制御する制御回路36Zを含む。   FIG. 12 shows the configuration of the binary search circuit. The binary search circuit 36 includes comparison circuits 36A, 36B, and 36C including the 1024 comparators 36a, 36b,... Shown in FIG. 11, and a control circuit 36Z that controls these comparison circuits.

従来のバイナリサーチ法では、まず1回目は、データが昇順又は降順に整列されたデータベースの探索対象範囲の1/2の位置にあるデータを読み出して比較対象データと比較する。データが昇順に並べられている場合、比較対象データの方が小さければ、比較対象データは探索対象範囲の前半に存在するので、2回目は前半を探索対象範囲としてその1/2、すなわち最初の探索対象範囲の1/4の位置にあるデータを読み出して比較対象データと比較する。逆に、比較対象データの方が大きければ、比較対象データは探索対象範囲の後半に存在するので、2回目は後半を探索対象範囲としてその1/2、すなわち最初の探索対象範囲の3/4の位置にあるデータを読み出して比較対象データと比較する。このように、探索対象範囲を半分ずつ絞っていき、最終的に対象データに到達する。   In the conventional binary search method, first, data at a position half the search target range of a database in which data is arranged in ascending or descending order is read and compared with comparison target data. When the data is arranged in ascending order, if the comparison target data is smaller, the comparison target data exists in the first half of the search target range, so the second time uses the first half as the search target range, that is, the first Data at a position ¼ of the search target range is read and compared with the comparison target data. On the other hand, if the comparison target data is larger, the comparison target data exists in the latter half of the search target range. Therefore, in the second time, the second half is set as the search target range, that is, 3/4 of the first search target range. The data at the position is read and compared with the comparison target data. In this way, the search target range is narrowed by half and finally reaches the target data.

本実施の形態では、バイナリサーチのための比較回路を3つ設けているので、1回目の探索のために探索対象範囲の1/2の位置にあるデータと比較対象データとを比較させるときに、同時に並行して、2回目の探索のために探索対象範囲の1/4及び3/4の位置にあるデータと比較対象データとを比較させる。これにより、2回分の探索を一度に行うことができるので、データベースからデータを読み上げる時間を短縮することができる。また、3つの比較回路を同時に並列して動作させることにより、比較の回数を半分に抑え、探索に要する時間を短縮することができる。   In this embodiment, since three comparison circuits for binary search are provided, when comparing the data at the half position of the search target range with the comparison target data for the first search. At the same time, the comparison target data is compared with the data at the 1/4 and 3/4 positions of the search target range for the second search. Thereby, since the search for 2 times can be performed at once, the time which reads data from a database can be shortened. Also, by operating the three comparison circuits in parallel at the same time, the number of comparisons can be reduced to half and the time required for the search can be shortened.

図12の例では、2回分の探索を同時に行うために、3つの比較回路を設けたが、一般に、n回分の探索を同時に並行して行うためには、2−1個の比較回路を設ければよい。制御回路36Zは、探索対象範囲の1/2、2/2、・・・、(2−1)/2の位置のデータを、2−1個の比較回路のそれぞれに入力させ、それらを同時に並列して動作させて比較対象データと比較させる。制御回路36Zは、それぞれの比較回路の比較結果を取得して、比較対象データが探索されたか否かを判定する。制御回路36Zは、いずれかの比較回路が、データが一致した旨の信号を出力した場合、比較対象データが探索されたと判定して、バイナリサーチを終了する。一致した旨の信号が出力されなかった場合、次回の探索に移る。比較対象データがデータベースに存在するならば、2−1個の比較回路の比較結果が反転する範囲に存在するはずである。例えば、15個の比較回路が設けられているときに、5/16の位置のデータが比較対象データより小さく、6/16の位置のデータが比較対象データより大きければ、5/16から6/16の間の範囲に比較対象データがある。したがって、制御回路36Zは、各比較回路の比較結果を取得して、比較結果が反転した範囲を次回の探索対象範囲と決定し、決定された次回の探索対象範囲の1/2、2/2、・・・、(2−1)/2の位置のデータをそれぞれの比較回路へ入力させる。In the example of FIG. 12, three comparison circuits are provided in order to perform two searches simultaneously. In general, in order to perform n searches in parallel at the same time, 2 n −1 comparison circuits are provided. What is necessary is just to provide. The control circuit 36Z inputs data at positions of 1/2 n , 2/2 n ,..., (2 n −1) / 2 n in the search target range to each of the 2 n −1 comparison circuits. They are operated in parallel at the same time and compared with the data to be compared. The control circuit 36Z acquires the comparison results of the respective comparison circuits and determines whether comparison target data has been searched. If any of the comparison circuits outputs a signal indicating that the data match, the control circuit 36Z determines that the comparison target data has been searched and ends the binary search. If no match signal is output, the next search is performed. If the data to be compared exists in the database, it should exist in a range where the comparison results of 2 n −1 comparison circuits are inverted. For example, when 15 comparison circuits are provided, if the data at the 5/16 position is smaller than the comparison target data and the data at the 6/16 position is larger than the comparison target data, 5/16 to 6 / The comparison target data is in the range between 16. Therefore, the control circuit 36Z acquires the comparison results of the respective comparison circuits, determines the range in which the comparison results are inverted as the next search target range, ½ n of the determined next search target range, 2 n ,..., (2 n −1) / 2 n position data is input to each comparison circuit.

本実施の形態では、第1データベース50を3つ設けており、第1データベース50Aは比較回路36Aに接続されて探索対象範囲の1/4の位置にあるデータを比較回路36Aに供給し、第2データベース50Bは比較回路36Bに接続されて探索対象範囲の2/4の位置にあるデータを比較回路36Bに供給し、第1データベース50Cは比較回路36Cに接続されて探索対象範囲の3/4の位置にあるデータを比較回路36Cに供給する。これにより、それぞれの比較回路にデータを同時に並行して読み上げることができるので、データの読み上げに要する時間を更に短縮し、バイナリサーチを高速化することができる。   In the present embodiment, three first databases 50 are provided, and the first database 50A is connected to the comparison circuit 36A and supplies data at a position of 1/4 of the search target range to the comparison circuit 36A. The second database 50B is connected to the comparison circuit 36B and supplies data at a position 2/4 of the search target range to the comparison circuit 36B, and the first database 50C is connected to the comparison circuit 36C and 3/4 of the search target range. The data at the position is supplied to the comparison circuit 36C. As a result, data can be simultaneously read out in parallel to the respective comparison circuits, so that the time required for reading data can be further shortened and the binary search can be speeded up.

比較回路は多ければ多いほど探索速度も向上するが、コスト、サイズなどを考慮の上、所望の探索速度を得られるのに十分な数の比較回路を設ければよい。また、比較回路の数と同じだけ第1データベースを設けるのが好ましいが、コスト、サイズなどを考慮の上、いくつかの比較回路でデータベースを共用してもよい。   As the number of comparison circuits increases, the search speed improves. However, in consideration of cost, size, etc., a sufficient number of comparison circuits may be provided to obtain a desired search speed. Although it is preferable to provide as many first databases as the number of comparison circuits, in consideration of cost, size, etc., the databases may be shared by several comparison circuits.

図13は、第1データベースの内部データの更に別の例を示す。図13に示した第1データベース50は、フィルタリングの対象となるコンテンツのURLを格納している。第1データベース50に格納されるデータは、ワイルドカードとして認識される所定のデータ、例えば、「00H」又は「01H」などを含んでもよい。図13に示した例において、「http://www.xx.xx/*********」は、「*********」がワイルドカードとして認識され、比較器36a、36b、・・・において、比較対象データが何であっても合致すると判定される。したがって、「http://www.xx.xx/」で始まる文字列は全てバイナリサーチ回路36により検出される。これにより、例えば、ドメイン「http://www.xx.xx/」の配下にあるコンテンツの全てにフィルタリングをかける処理などを容易に行うことができる。   FIG. 13 shows still another example of internal data of the first database. The first database 50 shown in FIG. 13 stores URLs of contents to be filtered. The data stored in the first database 50 may include predetermined data recognized as a wild card, for example, “00H” or “01H”. In the example shown in FIG. 13, “http: //www.xx.xx/*********” is recognized as “*********” as a wild card and compared. In the devices 36a, 36b,..., It is determined that they match regardless of the comparison target data. Therefore, all the character strings starting with “http: //www.xx.xx/” are detected by the binary search circuit 36. Thereby, for example, it is possible to easily perform processing for filtering all the contents under the domain “http: //www.xx.xx/”.

図14は、第2データベースの内部データの例を示す。第2データベース60は、検索回路30による検索結果を格納する検索結果欄62と、通信データに対して実行する処理の内容を格納する処理内容欄64とを含み、検索結果と処理内容とを対応づけて保持する。図14の例では、通信データに基準データが含まれている場合は、そのパケットの通過を許可し、含まれていない場合は、そのパケットを破棄するという条件が設定されている。処理実行回路40は、検索結果に基づいて第2データベース60から処理内容を検索し、通信データに対して処理を実行する。処理実行回路40も、ワイヤードロジック回路により実現されてもよい。   FIG. 14 shows an example of internal data of the second database. The second database 60 includes a search result column 62 for storing a search result by the search circuit 30 and a processing content column 64 for storing the content of processing to be executed on communication data, and corresponds the search result to the processing content. Hold it. In the example of FIG. 14, a condition is set in which when the reference data is included in the communication data, the packet is allowed to pass, and when the reference data is not included, the packet is discarded. The process execution circuit 40 searches the second database 60 for process contents based on the search result, and executes the process on the communication data. The processing execution circuit 40 may also be realized by a wired logic circuit.

図15は、第2データベースの内部データの別の例を示す。図15の例では、基準データごとに、処理内容が設定されている。パケットの置換を行う場合、置換先のデータを第2データベース60に格納しておいてもよい。パケットのルーティングやスイッチングを行う場合、経路に関する情報を第2データベース60に格納しておいてもよい。処理実行回路40は、検索回路30による検索結果に応じて、第2データベース60に格納された、フィルタリング、ルーティング、スイッチング、置換などの処理を実行する。図15のように、基準データごとに処理内容を設定する場合、第1データベース50と第2データベース60とを統合してもよい。   FIG. 15 shows another example of internal data of the second database. In the example of FIG. 15, the processing content is set for each reference data. When packet replacement is performed, replacement destination data may be stored in the second database 60. When packet routing or switching is performed, information on the route may be stored in the second database 60. The process execution circuit 40 executes processes such as filtering, routing, switching, and replacement stored in the second database 60 according to the search result by the search circuit 30. As shown in FIG. 15, when setting the processing content for each reference data, the first database 50 and the second database 60 may be integrated.

図16は、バイナリサーチ回路の別の構成例を示す。図16に示した例では、4回分の探索を一度に実行するために、15個の比較回路36A〜36Oが設けられている。制御回路36Zは、15個の比較回路36A〜36Oのそれぞれに接続された第1データベース50から、探索対象範囲の1/16、2/16、・・・、15/16の位置のデータを同時に並列して読み上げて比較回路36A〜36Oに入力する。また、比較対象データxをそれぞれの比較回路36A〜36Oに入力する。   FIG. 16 shows another configuration example of the binary search circuit. In the example illustrated in FIG. 16, 15 comparison circuits 36 </ b> A to 36 </ b> O are provided in order to execute four searches at a time. The control circuit 36Z simultaneously receives data at positions 1/16, 2/16,..., 15/16 of the search target range from the first database 50 connected to each of the 15 comparison circuits 36A to 36O. They are read out in parallel and input to the comparison circuits 36A to 36O. Further, the comparison target data x is input to each of the comparison circuits 36A to 36O.

制御回路36Zは、まず、第1段階として、探索対象範囲の4/16、8/16、12/16の位置のデータが入力された3個の比較回路36A、36B、36Cにより、比較対象データxが、探索対象範囲を4個に分割した範囲のいずれに属するかを判定する。つづいて、第2段階として、第1段階で判定された範囲の1/4、2/4、3/4の位置のデータが入力された3個の比較回路により、比較対象データxが、探索対象範囲を16個に分割した範囲のいずれに属するかを判定する。   First, as a first step, the control circuit 36Z uses the three comparison circuits 36A, 36B, and 36C to which the data of the positions 4/16, 8/16, and 12/16 of the search target range are input, as the comparison target data. It is determined which x belongs to the range obtained by dividing the search target range into four. Subsequently, as the second stage, the comparison target data x is searched by three comparison circuits to which data at positions 1/4, 2/4, and 3/4 of the range determined in the first stage is input. It is determined which of the ranges obtained by dividing the target range into 16 pieces.

バイナリサーチ回路36には、第1段階の比較回路36A、36B、36Cの比較結果を示す出力信号から、次の第2段階の比較回路36D〜36Oのうち第1段階で判定された範囲のデータが入力されている比較回路に比較を実行させるトリガ信号を生成して第2段階の比較回路36D〜36Oに入力するトリガ回路として、否定回路37及び排他的論理和回路38A、38Bを更に備えている。ここで、比較回路36A〜36Oは、比較対象データxが参照データよりも大きいときに「1」、小さいときに「0」を出力するものとする。   The binary search circuit 36 receives data in the range determined in the first stage from the output signals indicating the comparison results of the first stage comparison circuits 36A, 36B, and 36C among the next second stage comparison circuits 36D to 36O. Is further provided with a negation circuit 37 and exclusive OR circuits 38A and 38B as a trigger circuit that generates a trigger signal that causes the comparison circuit to input the comparison to be input to the second-stage comparison circuits 36D to 36O. Yes. Here, the comparison circuits 36A to 36O output “1” when the comparison target data x is larger than the reference data, and output “0” when it is smaller.

まず、第1段階の比較回路36A、36B、36Cにトリガ信号が入力され、同時に並列して比較が実行される。比較回路36Aの出力が「0」であれば、比較対象データxは、第1データベース50の探索対象範囲のうち0/16〜4/16の範囲に属するので、その範囲の参照データが入力されている比較回路36D、36E、36Fに、否定回路37を介して、トリガ信号「1」が入力される。これにより、第2段階の比較回路36D〜36Oのうち、探索対象範囲の1/16、2/16、3/16の位置の参照データが入力されている比較回路36D、36E、36Fのみが起動され、同時に並列して第2段階の比較を実行する。比較対象データxが、探索対象範囲のうち4/16〜16/16の範囲に属する場合は、比較回路36Aの出力が「1」となるので、否定回路37からは「0」が出力され、比較回路36D、36E、36Fには、トリガ信号が入力されない。   First, a trigger signal is input to the first stage comparison circuits 36A, 36B, and 36C, and the comparison is executed in parallel at the same time. If the output of the comparison circuit 36A is “0”, the comparison target data x belongs to the range of 0/16 to 4/16 of the search target range of the first database 50, and therefore the reference data of that range is input. The trigger signal “1” is input to the comparison circuits 36D, 36E, and 36F through the negative circuit 37. Thereby, only the comparison circuits 36D, 36E, and 36F to which the reference data at the positions 1/16, 2/16, and 3/16 of the search target range are input are activated among the comparison circuits 36D to 36O in the second stage. At the same time, the second stage comparison is performed in parallel. When the comparison target data x belongs to the range of 4/16 to 16/16 of the search target range, the output of the comparison circuit 36A becomes “1”, so that “0” is output from the negative circuit 37, A trigger signal is not input to the comparison circuits 36D, 36E, and 36F.

比較回路36Aの出力が「1」で、比較回路36Bの出力が「0」であれば、比較対象データxは、探索対象範囲のうち4/16〜8/16の範囲に属するので、その範囲の参照データが入力されている比較回路36G、36H、36Iに、排他的論理和回路38Aを介して、トリガ信号「1」が入力される。これにより、第2段階の比較回路36D〜36Oのうち、探索対象範囲の5/16、6/16、7/16の位置の参照データが入力されている比較回路36G、36H、36Iのみが起動され、同時に並列して第2段階の比較を実行する。比較対象データxが、探索対象範囲のうち4/16〜8/16の範囲に属さない場合は、比較回路36A及び36Bの出力が同じになるので、排他的論理和回路38Aからは「0」が出力され、36G、36H、36Iには、トリガ信号は入力されない。   If the output of the comparison circuit 36A is “1” and the output of the comparison circuit 36B is “0”, the comparison target data x belongs to the range of 4/16 to 8/16 of the search target range. The trigger signal “1” is input to the comparison circuits 36G, 36H, and 36I to which the reference data is input via the exclusive OR circuit 38A. Thereby, only the comparison circuits 36G, 36H, and 36I to which the reference data at the positions of 5/16, 6/16, and 7/16 of the search target range are input are activated among the comparison circuits 36D to 36O in the second stage. At the same time, the second stage comparison is performed in parallel. When the comparison target data x does not belong to the range of 4/16 to 8/16 of the search target range, the outputs of the comparison circuits 36A and 36B are the same, so that the exclusive OR circuit 38A receives “0”. Is output, and no trigger signal is input to 36G, 36H, and 36I.

比較回路36Bの出力が「1」で、比較回路36Cの出力が「0」であれば、比較対象データxは、探索対象範囲のうち8/16〜12/16の範囲に属するので、その範囲の参照データが入力されている比較回路36J、36K、36Lに、排他的論理和回路38Bを介して、トリガ信号「1」が入力される。これにより、第2段階の比較回路36D〜36Oのうち、探索対象範囲の9/16、10/16、11/16の位置の参照データが入力されている比較回路36J、36K、36Lのみが起動され、同時に並列して第2段階の比較を実行する。比較対象データxが、探索対象範囲のうち8/16〜12/16の範囲に属さない場合は、比較回路36B及び36Cの出力が同じになるので、排他的論理和回路38Bからは「0」が出力され、36J、36K、36Lには、トリガ信号は入力されない。   If the output of the comparison circuit 36B is “1” and the output of the comparison circuit 36C is “0”, the comparison target data x belongs to the range of 8/16 to 12/16 of the search target range. The trigger signal “1” is input to the comparison circuits 36J, 36K, and 36L to which the reference data is input via the exclusive OR circuit 38B. Thereby, only the comparison circuits 36J, 36K, and 36L to which the reference data of the positions 9/16, 10/16, and 11/16 of the search target range are input are activated among the comparison circuits 36D to 36O in the second stage. At the same time, the second stage comparison is performed in parallel. When the comparison target data x does not belong to the range of 8/16 to 12/16 of the search target range, the outputs of the comparison circuits 36B and 36C are the same, so that the exclusive OR circuit 38B receives “0”. Is output, and no trigger signal is input to 36J, 36K, and 36L.

比較回路36Cの出力が「1」であれば、比較対象データxは、探索対象範囲のうち12/16〜16/16の範囲に属するので、その範囲の参照データが入力されている比較回路36M、36N、36Oに、比較回路36Cの出力信号がトリガ信号「1」として入力される。これにより、第2段階の比較回路36D〜36Oのうち、探索対象範囲の13/16、14/16、15/16の位置の参照データが入力されている比較回路36M、36N、36Oのみが起動され、同時に並列して第2段階の比較を実行する。比較対象データxが、探索対象範囲のうち0/16〜12/16の範囲に属する場合は、比較回路36Cの出力が「0」となるので、36M、36N、36Oには、トリガ信号は入力されない。   If the output of the comparison circuit 36C is “1”, the comparison target data x belongs to the range of 12/16 to 16/16 of the search target range, and therefore the comparison circuit 36M to which the reference data of that range is input. , 36N, 36O, the output signal of the comparison circuit 36C is input as the trigger signal “1”. Thereby, only the comparison circuits 36M, 36N, and 36O to which the reference data of the positions 13/16, 14/16, and 15/16 of the search target range are input among the second-stage comparison circuits 36D to 36O are activated. At the same time, the second stage comparison is performed in parallel. When the comparison target data x belongs to the range of 0/16 to 12/16 of the search target range, the output of the comparison circuit 36C becomes “0”, so that a trigger signal is input to 36M, 36N, and 36O. Not.

こうして、図16に示した例では、2段階の比較処理で4回分の探索を実行することができる。この4回分の探索において比較対象データxが探索されなかった場合は、制御回路36Zは、新たに、第2段階で判定された範囲の1/16、2/16、・・・、15/16の位置のデータを、15個の比較回路36A〜36Oのそれぞれに入力させ、次の4回分の探索を実行する。   In this way, in the example shown in FIG. 16, four searches can be executed by a two-stage comparison process. When the comparison target data x is not searched in the four searches, the control circuit 36Z newly sets 1/16, 2/16,..., 15/16 of the range determined in the second stage. Is input to each of the 15 comparison circuits 36A to 36O, and the next four searches are executed.

このように、n回分の探索を行うための比較回路を複数の段階に階層化させ、第2段階以降は、前段階までに判定された範囲の比較回路のみを動作させるので、消費電力を低減させることができる。   In this way, the comparison circuit for performing the search for n times is hierarchized into a plurality of stages, and after the second stage, only the comparison circuits in the range determined up to the previous stage are operated, thereby reducing power consumption. Can be made.

図16の例では、4回分の探索を同時に行うために、15個の比較回路を設けたが、一般に、n回分の探索を同時に並行して行うためには、2−1個の比較回路を設ければよい。制御回路36Zは、第1データベース50の探索対象範囲を2個に分割したとき、比較対象データxと、探索対象範囲の1/2、2/2、・・・、(2−1)/2の位置のデータとを、2−1個の比較回路のそれぞれに入力させる。まず、第1段階として、探索対象範囲の1/2n1、2/2n1、・・・、(2n1−1)/2n1の位置のデータが入力された2n1−1個の比較回路により、比較対象データxが、探索対象範囲を2n1個に分割した範囲のいずれに属するかを判定する。つづいて、第2段階として、第1段階で判定された範囲の1/2n2、2/2n2、・・・、(2n2−1)/2n2の位置のデータが入力された2n2−1個の比較回路により、比較対象データxが、探索対象範囲を2n1+n2個に分割した範囲のいずれに属するかを判定する。以降同様にして、第N段階(ただし、n1+n2+・・・+nN=n)まで繰り返すことにより、n回分の探索を実行する。n回分の探索において比較対象データxが探索されなかった場合は、新たに、第N段階で判定された範囲の1/2、2/2、・・・、(2−1)/2の位置のデータを、2−1個の比較回路のそれぞれに入力させ、次のn回分の探索を実行する。In the example of FIG. 16, 15 comparison circuits are provided to perform four searches simultaneously, but in general, 2 n −1 comparison circuits are used to perform n searches simultaneously. May be provided. Control circuit 36Z is, when dividing a search range of the first database 50 to the 2 n, the compared data x, 1/2 n, 2/2 n the search range, · · ·, (2 n - 1) / 2 and n of the location of the data, it is input to each of the 2 n -1 comparison circuits. First, as a first stage, 2 n1 −1 comparison circuits to which data at positions of 1/2 n1 , 2/2 n1 ,..., (2 n1 −1) / 2 n1 of the search target range are input. Thus, it is determined whether the comparison target data x belongs to a range obtained by dividing the search target range into 2 n1 pieces. Subsequently, as the second step, 1/2 n2, 2/2 n2 ranges determined in the first stage, ···, (2 n2 -1) / 2 2 data of the position is input n2 n2 It is determined by the one comparison circuit whether the comparison target data x belongs to the range obtained by dividing the search target range into 2 n1 + n2 . In the same manner, n times of searches are executed by repeating until the Nth stage (where n1 + n2 +... + NN = n). If the comparison target data x is not searched in the n searches, a new value of 1/2 n , 2/2 n ,..., (2 n −1) / Data of 2 n positions are input to each of 2 n −1 comparison circuits, and the next n searches are executed.

この場合、トリガ回路は、第m(1≦m<N)段階の比較回路の比較結果を示す出力信号から、次の第(m+1)段階の比較回路のうち第m段階で判定された範囲のデータが入力されている比較回路に比較を実行させるトリガ信号を生成して第(m+1)段階の比較回路に入力する。具体的には、第m段階の2−1個の比較回路のうち、隣接する比較回路から異なる比較結果を示す出力信号が出力されたときに、それらの比較回路に入力されているデータの間の範囲のデータが入力された第(m+1)段階の比較回路にトリガ信号を入力すればよい。また、第m段階で判定される2の範囲のうち、最小の範囲と、最大の範囲のデータが入力された第(m+1)段階の比較回路には、第m段階の2−1個の比較回路のうち、最小と最大の参照データが入力された比較回路の比較結果に応じてトリガ信号を入力すればよい。In this case, the trigger circuit has an output signal indicating the comparison result of the m-th (1 ≦ m <N) -stage comparison circuit, within the range determined in the m-th stage among the next (m + 1) -th comparison circuits. A trigger signal that causes the comparison circuit to which data is input to perform comparison is generated and input to the (m + 1) th comparison circuit. Specifically, among the 2 m -1 comparison circuits in the m-th stage, when an output signal indicating a different comparison result is output from an adjacent comparison circuit, the data input to the comparison circuits The trigger signal may be input to the (m + 1) -th stage comparison circuit to which data in the range between them is input. In addition, in the (m + 1) -th stage comparison circuit to which the data of the minimum range and the maximum range among the 2 m ranges determined in the m-th stage are input, 2 m −1 pieces in the m-th stage are included. Of these comparison circuits, a trigger signal may be input according to the comparison result of the comparison circuit to which the minimum and maximum reference data are input.

図17は、バイナリサーチ回路の更に別の構成例を示す。図17に示した例では、バイナリサーチ回路36は、3つの比較回路36A〜36Cを用いて、比較対象データxが第1データベース50の探索対象範囲を4つに分割した範囲のいずれに属するかを判定したが、図17の例では、比較対象データxが、4つの範囲のそれぞれに含まれるか否かを判定するための4つの比較回路36P〜36Sが設けられている。例えば、比較回路36Pには、第1データベース50の探索対象範囲の0/16の位置にある基準データと、4/16の位置にある基準データと、比較対象データxとが入力され、それぞれの基準データと比較対象データxとを比較することにより、基準データが探索対象範囲の0/16から4/16の範囲に含まれるか否かを判定する。範囲に含まれる場合には、比較回路36Pから、その範囲に含まれるデータが参照データとして入力されている比較回路36D、36E、36Fに、トリガ信号が入力される。これにより、第2段階では、第1段階で判定された範囲の比較回路のみが比較を実行するので、消費電力を低減させることができる。   FIG. 17 shows still another configuration example of the binary search circuit. In the example shown in FIG. 17, the binary search circuit 36 uses three comparison circuits 36 </ b> A to 36 </ b> C to which of the ranges obtained by dividing the comparison target data x into four search target ranges of the first database 50. However, in the example of FIG. 17, four comparison circuits 36 </ b> P to 36 </ b> S are provided for determining whether or not the comparison target data x is included in each of the four ranges. For example, the reference data at the position 0/16 of the search target range of the first database 50, the reference data at the position 4/16, and the comparison target data x are input to the comparison circuit 36P. By comparing the reference data and the comparison target data x, it is determined whether or not the reference data is included in the range of 0/16 to 4/16 of the search target range. When included in the range, the trigger signal is input from the comparison circuit 36P to the comparison circuits 36D, 36E, and 36F to which the data included in the range is input as reference data. Thereby, in the second stage, only the comparison circuit in the range determined in the first stage performs the comparison, so that the power consumption can be reduced.

なお、図16及び図17に示した例では、n回分の探索を一度に行うための2−1個の比較回路のうち、1/2n1、2/2n1、・・・、(2n1−1)/2n1の位置のデータが入力された2n1−1個の比較回路を第1段階の比較回路としたが、これに限らず、任意の位置のデータが入力された比較回路を第1段階の比較回路としてもよい。要は、複数の比較回路を階層化し、前段階までに判定された範囲の比較回路のみを動作させるようにすればよい。In the example shown in FIG. 16 and FIG. 17, out of 2 n −1 comparison circuits for performing n searches at a time, 1/2 n1 , 2/2 n1,. n1 -1) / 2 The 2 n1 -1 comparison circuits to which the data at the position n1 are input are the first-stage comparison circuits. However, the present invention is not limited to this, and the comparison circuit to which data at an arbitrary position is input May be a first-stage comparison circuit. In short, a plurality of comparison circuits may be hierarchized so that only the comparison circuits in the range determined up to the previous stage are operated.

第1のデータベース及び第2のデータベースは、外部から書き換え可能に設けられる。これらのデータベースを入れ替えることにより、同じ通信制御装置10を用いて、さまざまなデータ処理や通信制御を実現することができる。また、検索対象となる基準データを格納したデータベースを2以上設けて、多段階の検索処理を行ってもよい。このとき、検索結果と処理内容とを対応づけて格納したデータベースを2以上設けて、より複雑な条件分岐を実現してもよい。このように、データベースを複数設けて多段階の検索を行う場合に、位置検出回路32、インデックス回路34、バイナリサーチ回路36などを複数設けてもよい。   The first database and the second database are rewritable from the outside. By exchanging these databases, various data processing and communication control can be realized using the same communication control device 10. In addition, two or more databases storing reference data to be searched may be provided to perform multi-stage search processing. At this time, two or more databases that store search results and processing contents in association with each other may be provided to realize more complicated conditional branching. As described above, when a plurality of databases are provided to perform multi-stage search, a plurality of position detection circuits 32, index circuits 34, binary search circuits 36, etc. may be provided.

上述した比較に用いられるデータは、同じ圧縮ロジックにより圧縮されてもよい。比較に際して、比較元のデータと比較先のデータが同じ方式で圧縮されていれば、通常と同様の比較が可能である。これにより、比較の際にローディングするデータ量を低減することができる。ローディングするデータ量が少なくなれば、メモリからデータを読み出すのに要する時間が短縮されるので、全体の処理時間も短縮することができる。また、比較器の量を削減することができるので、装置の小型化、軽量化、低コスト化に寄与することができる。比較に用いられるデータは、圧縮された形式で格納されていてもよいし、メモリから読み出した後、比較の前に圧縮されてもよい。   The data used for the comparison described above may be compressed by the same compression logic. In comparison, if the comparison source data and the comparison destination data are compressed by the same method, the same comparison as usual is possible. As a result, the amount of data loaded at the time of comparison can be reduced. If the amount of data to be loaded is reduced, the time required to read data from the memory is reduced, so that the overall processing time can also be reduced. Further, since the amount of the comparator can be reduced, it is possible to contribute to downsizing, weight reduction, and cost reduction of the apparatus. The data used for the comparison may be stored in a compressed form, or may be compressed after being read from the memory and before the comparison.

以上、本発明を実施の形態をもとに説明した。この実施の形態は例示であり、それらの各構成要素や各処理プロセスの組合せにいろいろな変形例が可能なこと、またそうした変形例も本発明の範囲にあることは当業者に理解されるところである。   The present invention has been described based on the embodiments. This embodiment is an exemplification, and it will be understood by those skilled in the art that various modifications can be made to combinations of the respective constituent elements and processing processes, and such modifications are also within the scope of the present invention. is there.

本発明は、データベースからデータを探索するバイナリサーチ回路に利用することができる。   The present invention can be used in a binary search circuit that searches data from a database.

Claims (6)

昇順又は降順に整列されたデータを格納したデータベースから、バイナリサーチにより比較対象データを探索する回路であって、
前記データベースから読み出されたデータと前記比較対象データとを比較する2−1個の比較回路と、
前記比較回路を制御する制御回路と、を備え、
前記制御回路は、前記データベースの探索対象範囲を2個に分割したとき、前記比較対象データと、前記探索対象範囲の1/2、2/2、・・・、(2−1)/2の位置のデータとを、前記2−1個の比較回路のそれぞれに入力させ、
まず、第1段階として、前記探索対象範囲の1/2n1、2/2n1、・・・、(2n1−1)/2n1の位置のデータが入力された2n1−1個の比較回路により、前記比較対象データが、前記探索対象範囲を2n1個に分割した範囲のいずれに属するかを判定し、つづいて、第2段階として、前記第1段階で判定された範囲の1/2n2、2/2n2、・・・、(2n2−1)/2n2の位置のデータが入力された2n2−1個の比較回路により、前記比較対象データが、前記探索対象範囲を2n1+n2個に分割した範囲のいずれに属するかを判定し、以降同様にして、第N段階(ただし、n1+n2+・・・+nN=n)まで繰り返すことにより、n回分の探索を実行し、
前記n回分の探索において前記比較対象データが探索されなかった場合は、新たに、前記第N段階で判定された範囲の1/2、2/2、・・・、(2−1)/2の位置のデータを、前記2−1個の比較回路のそれぞれに入力させ、次のn回分の探索を実行することを特徴とするバイナリサーチ回路。
A circuit for searching comparison target data by a binary search from a database storing data arranged in ascending or descending order,
2 n −1 comparison circuits for comparing the data read from the database with the comparison target data;
A control circuit for controlling the comparison circuit,
When the search target range of the database is divided into 2 n pieces, the control circuit divides the comparison target data and 1/2 n of the search target range, 2/2 n , ..., (2 n -1 ) / 2 n position data is input to each of the 2 n −1 comparison circuits,
First, as a first stage, 2 n1 −1 comparisons in which data at positions of 1/2 n1 , 2/2 n1 ,..., (2 n1 −1) / 2 n1 of the search target range are input. A circuit determines whether the comparison target data belongs to a range obtained by dividing the search target range into 2 n1 pieces. Subsequently, as a second step, 1 / of the range determined in the first step is determined. 2 n2 , 2/2 n2 ,..., (2 n2 −1) / 2 The data of the comparison target data is converted into the search target range by 2 n2 −1 comparison circuits to which data at the position of n2 is input. 2 It is determined which of the range divided into n1 + n2 belongs, and thereafter, in the same manner, by repeating to the Nth stage (where n1 + n2 +... + NN = n), n times of searches are performed,
If the comparison target data is not searched in the n searches, a new range of 1/2 n , 2/2 n ,..., (2 n −1) ) / 2 A binary search circuit characterized in that data at position n is input to each of the 2 n −1 comparison circuits and the next n searches are executed.
第m(1≦m<N)段階の比較回路の比較結果を示す出力信号から、次の第(m+1)段階の比較回路のうち前記第m段階で判定された範囲のデータが入力されている比較回路に比較を実行させるトリガ信号を生成して第(m+1)段階の比較回路に入力するトリガ回路を更に備えることを特徴とする請求項1に記載のバイナリサーチ回路。   From the output signal indicating the comparison result of the mth (1 ≦ m <N) stage comparison circuit, the data in the range determined in the mth stage among the next (m + 1) th stage comparison circuits is input. The binary search circuit according to claim 1, further comprising a trigger circuit that generates a trigger signal for causing the comparison circuit to perform comparison and inputs the trigger signal to the (m + 1) -th stage comparison circuit. 前記トリガ回路は、第m段階の2−1個の比較回路のうち、隣接する比較回路から異なる比較結果を示す出力信号が出力されたときに、それらの比較回路に入力されているデータの間の範囲のデータが入力された第(m+1)段階の比較回路に前記トリガ信号を入力することを特徴とする請求項2に記載のバイナリサーチ回路。When the output signal indicating a different comparison result is output from an adjacent comparison circuit among the 2 m −1 comparison circuits in the m-th stage, the trigger circuit is configured to store the data input to the comparison circuits. 3. The binary search circuit according to claim 2, wherein the trigger signal is input to a (m + 1) -th stage comparison circuit to which data in a range between them is input. 第m(1≦m<N)段階において、2−1個の比較回路は、同時に並列して比較を実行することを特徴とする請求項1から3のいずれかに記載のバイナリサーチ回路。4. The binary search circuit according to claim 1, wherein in the m-th (1 ≦ m <N) stage, 2 m −1 comparison circuits simultaneously perform comparison in parallel. 前記比較回路のそれぞれに接続された2−1個の前記データベースを備え、
前記制御回路は、前記探索対象範囲の1/2、2/2、・・・、(2−1)/2の位置のデータを、それぞれの比較回路に接続されたデータベースから並列して入力させることを特徴とする請求項1から4のいずれかに記載のバイナリサーチ回路。
Comprising 2 n -1 databases connected to each of the comparison circuits;
Wherein the control circuit, 1/2 n, 2/2 n of said search range, ..., parallel data of the position of the (2 n -1) / 2 n , from a database that is connected to the comparison circuits 5. The binary search circuit according to claim 1, wherein the binary search circuit is inputted.
昇順又は降順に整列されたデータを格納したデータベースの探索対象範囲を2個に分割したとき、比較対象データと、前記探索対象範囲の1/2、2/2、・・・、(2−1)/2の位置のデータとを、2−1個の比較回路のそれぞれに入力させるステップと、
第1段階として、前記探索対象範囲の1/2n1、2/2n1、・・・、(2n1−1)/2n1の位置のデータが入力された2n1−1個の比較回路により、前記比較対象データが、前記探索対象範囲を2n1個に分割した範囲のいずれに属するかを判定するステップと、
第2段階として、前記第1段階で判定された範囲の1/2n2、2/2n2、・・・、(2n2−1)/2n2の位置のデータが入力された2n2−1個の比較回路により、前記比較対象データが、前記探索対象範囲を2n1+n2個に分割した範囲のいずれに属するかを判定するステップと、
以降同様にして、第N段階(ただし、n1+n2+・・・+nN=n)まで繰り返すことにより、n回分の探索を実行するステップと、
前記n回分の探索において前記比較対象データが探索されなかった場合は、新たに、前記第N段階で判定された範囲の1/2、2/2、・・・、(2−1)/2の位置のデータを、前記2−1個の比較回路のそれぞれに入力させ、次のn回分の探索を実行するステップと、
を含むことを特徴とするバイナリサーチ方法。
When dividing a search range of the database that stores the data aligned in ascending or descending order 2 n pieces, the compared data, 1/2 n, 2/2 n of said search range, ..., ( 2 n −1) / 2 n position data is input to each of 2 n −1 comparison circuits;
As a first stage, 2 n1 −1 comparator circuits to which data at positions of 1/2 n1 , 2/2 n1 ,..., (2 n1 −1) / 2 n1 of the search target range are input. Determining whether the comparison target data belongs to a range obtained by dividing the search target range into 2 n1 pieces;
As a second step, the 1/2 n2 of the determined range in the first step, 2/2 n2, ···, (2 n2 -1) / 2 n2 position data is input 2 n2 -1 Determining whether the comparison target data belongs to a range obtained by dividing the search target range into 2 n1 + n2 pieces by a plurality of comparison circuits;
Thereafter, in the same manner, a step of executing n searches by repeating up to the Nth stage (where n1 + n2 +... + NN = n),
If the comparison target data is not searched in the n searches, a new range of 1/2 n , 2/2 n ,..., (2 n −1) ) / a 2 n data location, is input to each of the 2 n -1 comparison circuits, performing a search for the next n times,
A binary search method comprising:
JP2008504558A 2007-11-19 2007-11-19 Binary search circuit and method Expired - Fee Related JP4104649B1 (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2007/001260 WO2009066342A1 (en) 2007-11-19 2007-11-19 Binary search circuit and method for binary search

Publications (2)

Publication Number Publication Date
JP4104649B1 JP4104649B1 (en) 2008-06-18
JPWO2009066342A1 true JPWO2009066342A1 (en) 2011-03-31

Family

ID=39608121

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008504558A Expired - Fee Related JP4104649B1 (en) 2007-11-19 2007-11-19 Binary search circuit and method

Country Status (2)

Country Link
JP (1) JP4104649B1 (en)
WO (1) WO2009066342A1 (en)

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5309354B2 (en) * 2006-02-28 2013-10-09 独立行政法人産業技術総合研究所 Search method for high-speed pattern matching device
US20090238344A1 (en) * 2006-07-04 2009-09-24 Duaxes Corporation Communication control device and communication control method

Also Published As

Publication number Publication date
WO2009066342A1 (en) 2009-05-28
JP4104649B1 (en) 2008-06-18

Similar Documents

Publication Publication Date Title
JP4027416B2 (en) Data processing device
CN1306449C (en) Parallel pattern detection engine integrated circuit, relative method and data processing system
US7487542B2 (en) Intrusion detection using a network processor and a parallel pattern detection engine
US20060212426A1 (en) Efficient CAM-based techniques to perform string searches in packet payloads
US20080189784A1 (en) Method and Apparatus for Deep Packet Inspection
JPWO2006103743A1 (en) Communication control device and communication control system
US10742670B1 (en) Detecting and preventing execution of a malicious computer application using utility driven graph summarization
US8812516B2 (en) Determining top N or bottom N data values and positions
US20080052644A1 (en) String matching engine for arbitrary length strings
US8868584B2 (en) Compression pattern matching
JP3993885B1 (en) Binary search circuit and method
JP4201822B2 (en) Data processing device
CN114594954A (en) Code optimization method and device, computing equipment and computer storage medium
JP4104649B1 (en) Binary search circuit and method
JP4146505B1 (en) Determination apparatus and determination method
US9104866B2 (en) Pattern matching engine, terminal apparatus using the same, and method thereof
JP4060348B2 (en) Data processing device
KR20080045761A (en) Binary search circuit and method
Nagaraju et al. Low power pattern matching scheme through FSM state transition for next generation NIDS system
US8607337B2 (en) Scanning circuit and method for data content
JP2005242668A (en) Pattern matching device, method, and program
CN116738012A (en) Message identification method, device, equipment and computer storage medium

Legal Events

Date Code Title Description
TRDD Decision of grant or rejection written
A975 Report on accelerated examination

Free format text: JAPANESE INTERMEDIATE CODE: A971005

Effective date: 20080319

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20080325

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20080325

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110404

Year of fee payment: 3

S303 Written request for registration of pledge or change of pledge

Free format text: JAPANESE INTERMEDIATE CODE: R316303

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110404

Year of fee payment: 3

R371 Transfer withdrawn

Free format text: JAPANESE INTERMEDIATE CODE: R371

S303 Written request for registration of pledge or change of pledge

Free format text: JAPANESE INTERMEDIATE CODE: R316303

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110404

Year of fee payment: 3

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110404

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110404

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110404

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110404

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110404

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110404

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110404

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120404

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120404

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130404

Year of fee payment: 5

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R360 Written notification for declining of transfer of rights

Free format text: JAPANESE INTERMEDIATE CODE: R360

R370 Written measure of declining of transfer procedure

Free format text: JAPANESE INTERMEDIATE CODE: R370

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees