JPH05189201A - Counter device - Google Patents

Counter device

Info

Publication number
JPH05189201A
JPH05189201A JP2334692A JP2334692A JPH05189201A JP H05189201 A JPH05189201 A JP H05189201A JP 2334692 A JP2334692 A JP 2334692A JP 2334692 A JP2334692 A JP 2334692A JP H05189201 A JPH05189201 A JP H05189201A
Authority
JP
Japan
Prior art keywords
value
output
input
terminal
dff
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.)
Pending
Application number
JP2334692A
Other languages
Japanese (ja)
Inventor
Tadayoshi Nakayama
忠義 中山
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.)
Canon Inc
Original Assignee
Canon Inc
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 Canon Inc filed Critical Canon Inc
Priority to JP2334692A priority Critical patent/JPH05189201A/en
Publication of JPH05189201A publication Critical patent/JPH05189201A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To obtain a counter device which can calculate the appearing frequency of the value of input data with simple circuit constitution by individually addition-processing an arbitrary appearing frequency value which is selected in accordance with a value corresponding to input data. CONSTITUTION:When code data of two bits is inputted to a terminal 101, input data is converted into four signal lines 123-126 in a decoder 102. Namely, it is converted into the four signal lines 123-126 in accordance with the value of input data. Namely, one of four outputs becomes high by the value of input data, and other three outputs become low. One among the signal lines 123-126 becoming four inputs is selected in a selector 107 in accordance with the level of the signal lines 123-126, and it is outputted to an adder 108. When input data of two bits is valid, a high level is inputted to a terminal 109 and therefore one is added in the output value of the selector 107 in the adder 108. Only a D-type flip flop (DEF-CEN) outputting the frequency value selected in the selector 107 updates the value.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、データの出現頻度を計
数するカウンタ装置に関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a counter device for counting the appearance frequency of data.

【0002】[0002]

【従来の技術】従来、nビット情報の各データの出現頻
度を計数するカウンタ装置は、nビットの信号を2n
もしくはそれ以下の信号をデコードするデコーダと、当
該デコーダ出力の各信号毎に独立にカウント動作を行う
複数のカウンタ並びにnビットの入力データが有効な時
のみカウント動作を行うためのカウントイネーブル制御
回路から構成されていた。
2. Description of the Related Art Conventionally, a counter device for counting the appearance frequency of each piece of data of n-bit information has a decoder for decoding 2 n or less n-bit signals, and each signal output from the decoder. It is composed of a plurality of counters that independently perform a count operation and a count enable control circuit that performs a count operation only when n-bit input data is valid.

【0003】図8は従来のカウンタ装置の構成を説明す
る回路ブロック図で、2ビット(n=2)の場合に相当
する。
FIG. 8 is a circuit block diagram for explaining the configuration of a conventional counter device, which corresponds to the case of 2 bits (n = 2).

【0004】図において、801は2ビットのデータを
入力する端子、802は当該2ビット入力データが有効
であることを示す制御信号を入力する端子、803はク
ロックを入力する端子、804はカウンタのクリア信号
を入力する端子、805は入力された2ビットデータを
フルデコードするデコーダ、806〜809はカウンタ
のイネーブル信号を制御するAND回路、810〜81
3はイネーブル端子付きのmビットのカウンタ、814
〜817は前記mビットのカウンタ810〜813のカ
ウント結果をそれぞれ出力するmビットの出力端子であ
る。
In the figure, 801 is a terminal for inputting 2-bit data, 802 is a terminal for inputting a control signal indicating that the 2-bit input data is valid, 803 is a terminal for inputting a clock, and 804 is a counter. A terminal for inputting a clear signal, 805 is a decoder for fully decoding the input 2-bit data, 806 to 809 are AND circuits for controlling the enable signal of the counter, 810 to 81
3 is an m-bit counter with an enable terminal, 814
˜817 are m-bit output terminals for outputting the count results of the m-bit counters 810-813, respectively.

【0005】このように構成された構成において、先
ず、最初に端子804へカウンタのクリア信号が印加さ
れ、4つのカウンタ810〜813がすべてゼロにクリ
アされる。次に、端子801に2ビットのデータが入力
され、デコーダ805でデコードされる。デコーダ80
5は図9に示すようにゲートG1〜G4により構成され
ており、2ビットの入力データの値に応じて4つの出力
E0〜E3のうち、1つのみがHIGHとなり、他の3
つはLOWとなる。デコーダ805の出力は、2入力の
AND回路806〜809の一方の端子に入力され、も
う一方の入力端子には、端子802に入力される2ビッ
トデータ有効信号が入力される。当該信号がLOWの場
合、すなわち、2ビットデータが有効でない場合、AN
D回路806〜809の出力は、すべてLOWにマスク
されるので、この状態で端子803にクロックが印加さ
れても、カウンタ810〜813はいずれもカウントア
ップ動作しない。2ビットデータが有効な時、端子80
2の入力信号はHIGHなので、AND回路806〜8
09の出力は、デコーダ805の出力と同じになり、4
つの出力の内1つのみHIGHとなる。よって、4つの
カウンタ810〜813の内、1つのカウンタのみイネ
ーブル信号がHIGHとなり、この状態で端子803に
クロックが印加されると、当該カウンタのみカウントア
ップ動作を行う。
In the configuration thus configured, first, the counter clear signal is first applied to the terminal 804, and the four counters 810 to 813 are all cleared to zero. Next, 2-bit data is input to the terminal 801 and decoded by the decoder 805. Decoder 80
As shown in FIG. 9, 5 is composed of gates G1 to G4. Among the four outputs E0 to E3, only one becomes HIGH according to the value of the 2-bit input data, and the other three.
One is LOW. The output of the decoder 805 is input to one terminal of the 2-input AND circuits 806 to 809, and the 2-bit data valid signal input to the terminal 802 is input to the other input terminal. When the signal is LOW, that is, when 2-bit data is not valid, AN
Since the outputs of the D circuits 806 to 809 are all masked to LOW, even if a clock is applied to the terminal 803 in this state, none of the counters 810 to 813 count up. When 2-bit data is valid, terminal 80
Since the input signal of 2 is HIGH, AND circuits 806 to 8
The output of 09 becomes the same as the output of the decoder 805, and
Only one of the two outputs is HIGH. Therefore, when the enable signal of only one of the four counters 810 to 813 becomes HIGH and a clock is applied to the terminal 803 in this state, only that counter performs the count-up operation.

【0006】以上のようにして、有効な2ビットデータ
の出現頻度をカウントすることができる。
As described above, the appearance frequency of valid 2-bit data can be counted.

【0007】[0007]

【発明が解決しようとする課題】従来のカウンタ装置は
図8に示すように構成されているので、同じ機能のカウ
ンタをデコーダの出力数だけ用意しなければならないた
め、回路規模が大きくなるという欠点があった。また、
従来のカウンタ装置でモード値(出現頻度の最も高いデ
ータ)を求めようとすると、付加回路の規模もそれに付
随して大きくなってしまう等の問題点があった。
Since the conventional counter device is constructed as shown in FIG. 8, it is necessary to prepare counters having the same function for the number of outputs of the decoder, which results in a large circuit scale. was there. Also,
If a conventional counter device is used to obtain a mode value (data having the highest frequency of appearance), there is a problem that the scale of the additional circuit also increases accordingly.

【0008】本発明は、上記の問題点を解決するために
なされたもので、入力データに対応する値に応じて選択
された任意の出現頻度値を個別的に加算処理することに
より、簡単な回路構成で入力データの値の出現頻度を計
数できるカウンタ装置を得ることを目的とする。
The present invention has been made in order to solve the above-mentioned problems, and a simple addition process is performed by individually adding arbitrary appearance frequency values selected according to values corresponding to input data. An object of the present invention is to obtain a counter device capable of counting the frequency of appearance of the value of input data with a circuit configuration.

【0009】[0009]

【課題を解決するための手段】本発明に係るカウンタ装
置は、入力データの各々の値の出現頻度を保持するため
の複数の頻度値保持手段と、各頻度値保持手段から入力
データに対応した頻度値を選択する選択手段と、この選
択手段により選択された頻度値に1を加算する加算手段
とを有するものである。
A counter device according to the present invention corresponds to input data from a plurality of frequency value holding means for holding the frequency of appearance of each value of input data. It has selection means for selecting a frequency value and addition means for adding 1 to the frequency value selected by this selection means.

【0010】[0010]

【作用】本発明においては、入力データの各々の値に応
じて選択手段が選択した1つの頻度値保持手段から出力
される頻度値に加算手段が1を加算して対応する頻度値
保持手段に更新された頻度値を保持させ、簡単な構成で
入力データの各々の値に対する出現頻度のカウントを行
うことを可能とする。
According to the present invention, the adding means adds 1 to the frequency value output from one frequency value holding means selected by the selecting means in accordance with each value of the input data, and the corresponding frequency value holding means is added. The updated frequency value is held, and the appearance frequency can be counted for each value of the input data with a simple configuration.

【0011】[0011]

【実施例】【Example】

〔第1実施例〕図1は本発明の第1実施例を示すカウン
タ装置の構成を説明するブロック図である。
[First Embodiment] FIG. 1 is a block diagram for explaining the arrangement of a counter device according to the first embodiment of the present invention.

【0012】図において、101は2ビットのコードデ
ータを入力する端子、102は当該入力データをデコー
ドして4つの信号に変換するデコーダ、103〜106
は頻度値を保持する頻度値保持手段として機能する各々
mビットのクロックイネーブル制御付きのD型フリップ
フロップ(DFFーCEN)、107は選択手段である
ところのmビット4入力1出力のセレクタ、108はm
ビットと1ビット加算処理を行う加算器で、本実施例の
加算手段として機能する。109は前記端子101から
入力される2ビットデータが有効であることを示す制御
信号を入力する端子、110はクロックを入力する端
子、111はすべての頻度値をゼロにクリアする信号を
入力する端子である。
In the figure, 101 is a terminal for inputting 2-bit code data, 102 is a decoder for decoding the input data and converting it into four signals, and 103 to 106.
Is a D-type flip-flop (DFF-CEN) with clock enable control of m bits each functioning as a frequency value holding means for holding a frequency value, 107 is an m-bit 4-input 1-output selector which is a selecting means, 108 Is m
It is an adder that performs 1-bit and 1-bit addition processing, and functions as the addition means of this embodiment. 109 is a terminal for inputting a control signal indicating that the 2-bit data input from the terminal 101 is valid, 110 is a terminal for inputting a clock, and 111 is a terminal for inputting a signal for clearing all frequency values to zero. Is.

【0013】このように構成されたカウンタ装置におい
て、先ず最初に端子111へクリア信号が印加され、4
つのDFFーCEN103〜106はすべてゼロにクリ
アされる。4つのDFFーCEN103〜106は、保
持機能を有するD型フリップフロップで、クロックイネ
ーブル端子(以下、CEN端子と略す)がHIGHレベ
ルのときに、通常のD型フリップフロップと同じ動作を
実行し、CEN端子がLOWレベルのときは、クロック
が印加されても入力データを取り込まずに以前の出力デ
ータを保持し続けるものである。等価的には、図2に示
す回路で示すことができる。
In the counter device thus constructed, the clear signal is first applied to the terminal 111, and the clear signal is applied to the terminal 111.
The two DFF-CENs 103-106 are all cleared to zero. The four DFF-CENs 103 to 106 are D-type flip-flops having a holding function and perform the same operation as a normal D-type flip-flop when a clock enable terminal (hereinafter abbreviated as CEN terminal) is at a high level. When the CEN terminal is at the LOW level, the input data is not taken in and the previous output data is continuously held even if the clock is applied. Equivalently, it can be represented by the circuit shown in FIG.

【0014】図2は、図1に示したカウンタ装置の等価
回路の一例を示す回路ブロック図である。
FIG. 2 is a circuit block diagram showing an example of an equivalent circuit of the counter device shown in FIG.

【0015】図において、201はデータ入力端子、2
02は前述のCEN端子、203はクロック入力端子、
204はデータ出力端子、205は通常のD型フリップ
フロップ(DFFと略す)、206はセレクタ、207
はクリア信号入力端子である。CEN端子202の入力
信号がLOWレベルの時、DFF205の出力データは
セレクタ206を介して当該DFFの入力データとなる
ため、端子203からクロックが印加されても、出力デ
ータの値は変化しないわけである。
In the figure, 201 is a data input terminal, 2
02 is the above-mentioned CEN terminal, 203 is a clock input terminal,
Reference numeral 204 is a data output terminal, 205 is a normal D-type flip-flop (abbreviated as DFF), 206 is a selector, and 207
Is a clear signal input terminal. When the input signal of the CEN terminal 202 is LOW level, the output data of the DFF 205 becomes the input data of the DFF through the selector 206. Therefore, even if the clock is applied from the terminal 203, the value of the output data does not change. is there.

【0016】さて、図1に示した4つのDFFーCEN
103〜106がクリアされ、頻度値がすべてゼロにセ
ットされると、端子101に2ビットのコードデータが
入力される。当該入力データは、デコーダ102にて、
4つの信号線123〜126に変換される。デコーダ1
02の構成は、図9に示したデコーダと略同じで、入力
データの値によって4つの出力のうち、1つだけがHI
GHとなり、他の3つはLOWレベルとなる。
Now, the four DFF-CENs shown in FIG.
When 103 to 106 are cleared and the frequency values are all set to zero, 2-bit code data is input to the terminal 101. The input data is received by the decoder 102.
It is converted into four signal lines 123 to 126. Decoder 1
The configuration of 02 is almost the same as that of the decoder shown in FIG. 9, and only one of the four outputs is HI depending on the value of the input data.
It becomes GH and the other three become LOW level.

【0017】例えば2ビット入力データが「00」のと
き、図1における信号線123がHIGHとなり、信号
線124〜126はLOWになる。入力データが「0
1」,「10」,「11」の各々に対しては信号線12
4〜126が各々HIGHになる。当該デコーダの出力
信号に対応する信号線123〜126のレベルに応じて
セレクタ107では4つの入力信号となる信号線113
〜116の中から1つを選択して、加算器108へ出力
する。入力データ「00」,「01」,「10」「1
1」に対して信号線113〜116が各々選択される。
2ビット入力データが有効のときは、端子109にはH
IGHレベルが入力されるので、加算器108にてセレ
クタ107の出力値に「1」が加算される。逆に、2ビ
ット入力データが有効でない時には、端子109の入力
レベルはLOWになるので、加算器108では加算が行
われず、セレクタ107から出力された値が加算器10
8をそのまま通過し、当該値が出力される。すなわち、
簡略して言えば、2ビット入力データに対応する頻度値
をセレクタ107で選択し、その頻度値に「1」を加え
るということである。セレクタ107で選択された頻度
値を出力していたDFFーCENだけが当該値を更新
し、他のDFFーCENは以前の値をそのまま保持する
ように値を更新するDFFーCENのCEN端子だけレ
ベルをHIGHにして、他のDFFーCENのレベルは
LOWにした状態で、端子110からクロックを入力す
る。2ビット入力データが有効でない場合、すなわち端
子109から入力される信号がLOWレベルの場合で
も、頻度値の選択とDFFーCENにおける頻度値の更
新動作は行われるが、更新後の値も同じであるため(加
算器108で「1」が加算されないから)問題とはなら
ない。以上のようにして、2ビット入力の各々のデータ
に対する出現頻度をカウントすることができる。 〔第2実施例〕図3は本発明の第2実施例を示すカウン
タ装置の構成を説明するブロック図であり、図1と同一
のものには同じ符号を付してある。
For example, when the 2-bit input data is "00", the signal line 123 in FIG. 1 becomes HIGH and the signal lines 124 to 126 become LOW. Input data is "0
The signal line 12 for each of "1", "10", and "11"
4-126 become HIGH respectively. In the selector 107, the signal lines 113 which become four input signals according to the levels of the signal lines 123 to 126 corresponding to the output signals of the decoder.
1 to 116 are selected and output to the adder 108. Input data “00”, “01”, “10” “1”
The signal lines 113 to 116 are selected for "1".
When 2-bit input data is valid, H
Since the IGH level is input, the adder 108 adds “1” to the output value of the selector 107. On the contrary, when the 2-bit input data is not valid, the input level of the terminal 109 becomes LOW, so that the adder 108 does not perform addition and the value output from the selector 107 is the value output from the adder 10.
8 is passed as it is, and the value is output. That is,
In short, it means that the frequency value corresponding to the 2-bit input data is selected by the selector 107 and "1" is added to the frequency value. Only the DFF-CEN that outputs the frequency value selected by the selector 107 updates the value, and the other DFF-CEN updates the value so that it retains the previous value. Only the CEN terminal of the DFF-CEN. A clock is input from the terminal 110 in a state where the level is HIGH and the other DFF-CEN levels are LOW. Even when the 2-bit input data is not valid, that is, when the signal input from the terminal 109 is at the LOW level, the frequency value selection and the frequency value update operation in DFF-CEN are performed, but the updated value is the same. Since it exists (because "1" is not added by the adder 108), it does not pose a problem. As described above, the appearance frequency of each 2-bit input data can be counted. [Second Embodiment] FIG. 3 is a block diagram illustrating the structure of a counter device according to a second embodiment of the present invention. The same parts as those in FIG. 1 are designated by the same reference numerals.

【0018】図において、301は2ビットの入力デー
タを1クロック遅延させるためのD型のフリップフロッ
プ(DFF)、302は端子101から入力された2ビ
ットデータからDFF301の出力データ(2ビット)
を減算するための減算器、303〜306は2ビット入
力の各データに対する頻度値を保持するためのmビット
のDFF、107,310〜312はデコーダ102の
出力に応じて頻度値を示す信号線113〜116から所
定の値を選択するセレクタである。
In the figure, 301 is a D-type flip-flop (DFF) for delaying 2-bit input data by 1 clock, and 302 is output data (2 bits) of DFF 301 from 2-bit data input from a terminal 101.
, A m-bit DFF for holding the frequency value for each 2-bit input data, and 107, 310 to 312 signal lines indicating the frequency value according to the output of the decoder 102. A selector for selecting a predetermined value from 113 to 116.

【0019】本実施例は、2ビットの入力データの各々
のコードに対する出現頻度をカウントするという点では
第1実施例と略同様であるが、更新直後の頻度値がある
特定のDFFのみ(本実施例ではDFF303)から出
力されるという点で多少異なる。
This embodiment is substantially the same as the first embodiment in that the appearance frequency for each code of 2-bit input data is counted, but only the specific DFF having a frequency value immediately after the update (the book The embodiment is slightly different in that it is output from the DFF 303).

【0020】以下、図3を参照しながら本実施例の動作
について説明する。
The operation of this embodiment will be described below with reference to FIG.

【0021】先ず、最初に端子111へクリア信号が印
加され、DFF303〜306並びにDFF301がす
べてゼロにクリアされる。次いで、最初の2ビット入力
データが端子101に入力される。当該入力データが減
算器302に入力され、そこで、DFF301の出力値
が引き算されるが当該出力値は「0」であるため、実質
的には何も減算されず、端子101に入力された2ビッ
トデータがそのまま減算器302から出力され、デコー
ダ102に入力される。当該デコーダ102は、入力さ
れた2ビットデータを4つの信号にデコードし、セレク
タ107,310〜312に出力する。デコーダ102
の2ビット入力が「00」の時のセレクタ107,31
0〜312の出力はそれぞれ信号線113,114,1
15,116であり、同2ビット入力が「01」のとき
の同出力は、信号線114,115,116,113で
ある。以下、デコーダ102の2ビット入力の値が1つ
ずつ大きくなる毎に4つのセレクタ107,310〜3
12の出力が1つずつシフトしてゆく関係にある。セレ
クタ310〜312の出力はそのままDFF304〜3
06に接続されているので、クロック印加後、各セレク
タ107,310〜312の出力値は対応するDFF3
03〜306で保持される。
First, a clear signal is first applied to the terminal 111, and the DFFs 303 to 306 and the DFF 301 are all cleared to zero. Next, the first 2-bit input data is input to the terminal 101. The input data is input to the subtractor 302, where the output value of the DFF 301 is subtracted, but since the output value is “0”, practically nothing is subtracted, and the value 2 input to the terminal 101 is input. The bit data is directly output from the subtractor 302 and input to the decoder 102. The decoder 102 decodes the input 2-bit data into four signals and outputs them to the selectors 107, 310 to 312. Decoder 102
Selectors 107, 31 when the 2-bit input of is "00"
The outputs of 0 to 312 are signal lines 113, 114 and 1 respectively.
15 and 116, and the same outputs when the 2-bit input is “01” are the signal lines 114, 115, 116 and 113. Hereinafter, each time the value of the 2-bit input of the decoder 102 increases by one, the four selectors 107, 310-3 are selected.
There is a relationship in which the 12 outputs are shifted one by one. The outputs of the selectors 310 to 312 are the same as those of the DFFs 304 to 3
06, the output value of each selector 107, 310 to 312 after the application of the clock is the corresponding DFF3.
It is held in 03-306.

【0022】一方、セレクタ107で選択された信号
は、既に第1実施例で述べた処理と全く同じことが加算
器108にて行われ、DFF303にて保持される。4
つのDFF303〜306の保持内容が、端子101か
ら入力される2ビットデータの値に応じてシフトするた
め、あるデータ入力でシフトした分を1クロック後に元
に戻すといった処理が、本実施例では新たに必要にな
る。
On the other hand, for the signal selected by the selector 107, exactly the same processing as that described in the first embodiment is performed by the adder 108 and held by the DFF 303. Four
Since the contents held in the two DFFs 303 to 306 are shifted according to the value of 2-bit data input from the terminal 101, a process of returning the amount shifted by a certain data input after one clock is newly added in the present embodiment. Will be needed.

【0023】例えば2ビット入力の「00」を基準にす
ると、「11」入力では当該DFFの出力が全体的に3
つシフトする(これをプラス方向とする)。これを1ク
ロック後に元に戻すには、1クロック後にマイナス方向
へ3つシフトしなければならない。実際には、1クロッ
ク後に端子101へ、また新たな2ビットデータが入力
されるので、このデータに基づく新たなシフト(このシ
フト量をSとする)が発生し、トータルで「S−3」と
いう量を1クロック後にしなければならない。このシフ
ト量を演算するためのブロックがDFF301と減算器
302である。ところで、「S−3」という演算におい
て、シフト量Sが「3」よりも小さい場合、当該演算結
果は負になってしまう。例えばS=2の場合は、Sー3
=−1となり、マイナス方向へ1つシフトする処理が必
要になる。ところが、マイナス方向へ「1」つシフトす
るということは、プラス方向へ「3」シフトすることと
等価であるため、演算結果としては「3」、すなわち2
ビットコードで、「11」という値が出力されればよ
い。そのような演算は、ボローを無視した下位2ビット
のみの演算で実現可能である。
For example, when a 2-bit input “00” is used as a reference, the output of the DFF is 3 as a whole at “11” input.
Shift two (this is the positive direction). In order to restore this after one clock, three shifts must be made in the negative direction after one clock. Actually, one clock later, new 2-bit data is input to the terminal 101, so a new shift (this shift amount is S) is generated based on this data, and the total is "S-3". Must be done one clock later. The blocks for calculating this shift amount are the DFF 301 and the subtractor 302. By the way, in the calculation of "S-3", when the shift amount S is smaller than "3", the calculation result becomes negative. For example, when S = 2, S-3
= -1, and a process of shifting one in the minus direction is required. However, a shift of "1" in the minus direction is equivalent to a shift of "3" in the plus direction, so that the calculation result is "3", that is, 2
It suffices if the value “11” is output as a bit code. Such an operation can be realized by an operation of only the lower 2 bits ignoring borrow.

【0024】以上説明したように、2ビット入力データ
の各コードの出現頻度値がDFF303〜306の間で
シフトされながらカウントされてゆくわけである。な
お、本実施例では、セレクタ107,セレクタ310〜
312の構成を変えることでデコーダ102を省略する
こともできる。すなわち、4入力1出力のセレクタを2
入力1出力のセレクタを3つ用いて構成した場合の制御
信号は、デコードする以前のバイナリコードをそのまま
用いることができるからである。 〔第3実施例〕図4は本発明の第3実施例を示すカウン
タ装置の構成を説明するブロック図であり、図3と同一
のものには同じ符号を付してあり、出現頻度が最大のも
の、すなわち統計学でいうモードを検出する装置の場合
に相当する。
As described above, the appearance frequency value of each code of 2-bit input data is counted while being shifted among the DFFs 303 to 306. In the present embodiment, the selector 107 and the selectors 310 to 310.
The decoder 102 can be omitted by changing the configuration of 312. That is, a 2-input / 1-output selector is
This is because the binary code before decoding can be used as it is as the control signal in the case of using three selectors of one input and one output. [Third Embodiment] FIG. 4 is a block diagram for explaining the configuration of a counter device showing a third embodiment of the present invention. The same parts as those in FIG. This corresponds to the case of a device for detecting the mode in statistics, that is, the mode.

【0025】図において、401はDFFーCENで、
最大頻度値を保持し、比較器404にその値を出力す
る。402はDFFーCENで、モードを保持し、端子
403を介して当該モードが出力される。
In the figure, 401 is DFF-CEN,
The maximum frequency value is held and the value is output to the comparator 404. Reference numeral 402 denotes a DFF-CEN, which holds a mode and outputs the mode via a terminal 403.

【0026】端子111からクリア信号が印加され、す
べての頻度値がゼロにクリアされる時に、DFFーCE
N401も同時にゼロにクリアされる。この時点で、既
にDFFーCEN401の出力は、頻度値の最大値(ゼ
ロ)に等しい。頻度値のカウントアップは必ず加算器1
08で行われるので、当該加算器108の出力を常時監
視し、その最大値を保持していれば必ずその保持してい
る値は頻度値の最大と一致する。そこで、加算器108
の出力、すなわち最新の入力データに対する頻度値と過
去の頻度値の最大値であるところのDFFーCEN40
1の出力を比較し、加算器108の出力の方が大きけれ
ば、比較器404からHIGHレベルを出力し、当該加
算器108の出力をDFFーCEN401に、また、そ
の時の2ビット入力データをDFFーCEN402に取
り込む。これによって、頻度値の最大値とモードが更新
される。反対に、加算器108の出力の方が小さければ
比較器404からはLOWレベルを出力し、過去の最大
頻度値(現在の最大頻度値でもある)とモードを保持し
続ける。また、加算器108の出力が過去の最大頻度値
と等しい場合には、比較器404の出力レベルは、HI
GH,LOWのどとらでも構わないが、HIGHを出力
するように設定すれば、出現頻度の等しいデータは最後
に出現した方が優先される。このような場合、図5に示
す構成としてモードを検出してもよい。
When a clear signal is applied from the terminal 111 and all frequency values are cleared to zero, the DFF-CE
N401 is also cleared to zero at the same time. At this point, the output of DFF-CEN 401 is already equal to the maximum frequency value (zero). Be sure to adder 1 to count up the frequency value
Since it is performed at 08, the output of the adder 108 is constantly monitored, and if the maximum value is held, the held value always matches the maximum frequency value. Therefore, the adder 108
Output, that is, the DFF-CEN40 which is the maximum value of the frequency value for the latest input data and the past frequency value.
If the output of the adder 108 is larger, the comparator 404 outputs a HIGH level, the output of the adder 108 is output to the DFF-CEN 401, and the 2-bit input data at that time is output to the DFF. -Import to CEN402. As a result, the maximum frequency value and the mode are updated. On the contrary, if the output of the adder 108 is smaller, the comparator 404 outputs the LOW level, and the past maximum frequency value (which is also the current maximum frequency value) and the mode are continuously maintained. Further, when the output of the adder 108 is equal to the past maximum frequency value, the output level of the comparator 404 is HI.
GH or LOW may be used, but if HIGH is set to be output, the data having the same appearance frequency is given priority to the one that appears last. In such a case, the mode may be detected with the configuration shown in FIG.

【0027】図5は、図4に示したカウンタ装置の他の
構成を説明するブロック図であり、図4と同一のものに
は同じ符号を付してある。
FIG. 5 is a block diagram for explaining another configuration of the counter device shown in FIG. 4, and the same components as those in FIG. 4 are designated by the same reference numerals.

【0028】図において、501は一致検出器で、加算
器108の入力が1入力としている。
In the figure, 501 is a coincidence detector, and the input of the adder 108 is one input.

【0029】このように構成されたカウンタ装置におい
て、加算器108の出力を参照することにより、最大頻
度値の検出が可能であるが、当該加算器108の出力の
代わりに入力を参照することによっても最大頻度の検出
は最大可能である。ただし、当該加算器108の入力値
が過去の最大頻度値であるDFFーCEN401の出力
より大きくなることは原理的にありえず、当該入力値の
最大値はDFFーCEN401の出力値と等しい。そし
て、それらの値が等しい時に最大頻度値の更新がなされ
る。なぜならば、加算器108の入力とDFFーCEN
401の出力とが等しいということは、当該加算器10
8の出力が当該DFFーCEN401の出力より大きく
なることがあるからである(端子109の入力がHIG
Hであれば必ず1つ大きくなるが、当該入力がLOWで
あれば等しいままである)。よって、当該加算器108
の入力とDFFーCEN401の出力とを比較し、それ
らの値が一致したらDFFーCNN401,402のC
EN端子をHIGHレベルにして最大頻度値とモードの
更新を行う。
In the counter device configured as described above, the maximum frequency value can be detected by referring to the output of the adder 108, but by referring to the input instead of the output of the adder 108. Also the maximum frequency of detection is possible. However, in principle, the input value of the adder 108 cannot be larger than the output of the DFF-CEN 401, which is the maximum frequency value in the past, and the maximum value of the input value is equal to the output value of the DFF-CEN 401. Then, when the values are equal, the maximum frequency value is updated. Because the input of the adder 108 and the DFF-CEN
The fact that the output of 401 is equal means that the adder 10
8 is sometimes larger than the output of the DFF-CEN 401 (the input of the terminal 109 is HIG.
If it is H, it will be incremented by one, but if the input is LOW, it will remain the same). Therefore, the adder 108
Is compared with the output of DFF-CEN401, and if their values match, C of DFF-CNN401 and 402
The EN terminal is set to HIGH level to update the maximum frequency value and the mode.

【0030】一致検出器501は2つの値が完全に一致
した場合にHIGHレベルを出力するもので、例えば4
ビットデータの一致検出器は、例えば図6に示すように
EX・NOR1〜4およびアンドゲートANDより構成
されているので、通常の比較器に比べて大幅に回路規模
が小さく遅延も小さい。
The coincidence detector 501 outputs a HIGH level when the two values completely coincide with each other.
Since the bit data coincidence detector is composed of EX.NOR1 to 4 and an AND gate AND as shown in FIG. 6, for example, the circuit scale is much smaller and the delay is smaller than that of an ordinary comparator.

【0031】上記実施例ではすべて入力データが2ビッ
トであったが、入力データを1ビットとし、メモリのラ
イトアドレスとリードアドレスに対応させることによ
り、ランダムアクセスメモリをファースト・イン・ファ
ーストアウト型のメモリ(FIFOメモリ)と使用する
際のアドレス発生器として使用することも可能となる。
以下、その実施例について説明する。なお、説明の都合
上、最初からアドレス発生器として動作説明を行うが、
本質はカウンタ装置である。 〔第4実施例〕図7は本発明の第4実施例を示すカウン
タ装置の構成を説明するブロック図である。
In the above embodiments, the input data is all 2 bits, but the input data is 1 bit and the write address and the read address of the memory are made to correspond to each other, so that the random access memory is of the first-in-first-out type. It can also be used as an address generator when used with a memory (FIFO memory).
Hereinafter, the example will be described. For convenience of explanation, the operation will be described as an address generator from the beginning.
The essence is a counter device. [Fourth Embodiment] FIG. 7 is a block diagram for explaining the arrangement of a counter device according to the fourth embodiment of the present invention.

【0032】図において、701はライトアドレスとリ
ードアドレスの選択を行うための制御信号を入力する端
子、702はアドレスのカウントアップをするための制
御信号入力端子、703はクロック入力端子、704は
アドレスをゼロにクリアするクリア入力端子、705,
706はライトアドレスとリードアドレスを保持するそ
れぞれmビットのDFF、707,708はmビットの
2入力1出力のセレクタ、709は前記セレクタ707
から出力されるmビットアドレスと端子702から入力
される1ビットの信号を加算する加算器、710は端子
701から入力される信号を1クロック遅延させる1ビ
ットのDFF、711は排他的論理和素子(EXORゲ
ート)、720はmビットのアドレス出力端子である。
In the figure, 701 is a terminal for inputting a control signal for selecting a write address and a read address, 702 is a control signal input terminal for counting up the address, 703 is a clock input terminal, and 704 is an address. Clear input terminal, 705
706 is an m-bit DFF that holds a write address and a read address, 707 and 708 are m-bit 2-input 1-output selectors, and 709 is the selector 707.
An adder for adding the m-bit address output from the terminal to the 1-bit signal input from the terminal 702, 710 is a 1-bit DFF that delays the signal input from the terminal 701 by 1 clock, and 711 is an exclusive OR element (EXOR gate) and 720 are m-bit address output terminals.

【0033】上記構成において、先ず、最初に端子70
4へクリア信号が印加され、DFF705,706,7
10がクリアされる。この時点で、DFFにはライトア
ドレスが保持され、DFF706にはリードアドレスが
保持されている。ここで、FIFOメモリへのデータ書
込み用のアドレスを発生するため、先ず、端子701に
LOW(ライトアドレスの選択を意味する)、端子70
2にHIGHを入力する。これにより、排他的論理和素
子711からLOWレベルが出力され、それによってセ
レクタ707ではDFF705の出力がセレクタ708
ではDFF706の出力が選択される。この場合、どち
らのセレクタ708の出力もゼロである。セレクタ70
8の出力は、DFF706に送られ、セレクタ707の
出力は加算器709で「1」が加算された後、DFF7
05に送られる。ここで、クロック入力端子703から
クロックを印加すると、DFF705,706,710
はそれぞれデータを取り込み、それぞれ「1」,
「0」,「0」を出力する。アドレス出力端子720に
は、DFF705の出力である「1」が出力され、それ
がライトアドレスとして用いられる。次に、直前にFI
FOメモリへ書き込んだデータを読み出すためのリード
アドレスの生成を行う。この場合、端子701,制御信
号入力端子702に対して共にHIGHを入力する。こ
れにより、排他的論理和素子711からHIGHが出力
され、それによってセレクタ707では、DFF706
の出力がセレクタ708でDFF705が選択される。
DFF706の出力とは、値が「0」のリードアドレス
であり、それがセレクタ707から出力されると、加算
器709にて「1」が加算されDFF705に送出され
る。ここで、クロックを印加すると、DFF705を通
って制御信号入力端子702から値が「1」のリードア
ドレスが出力される。この時、DFF706からはライ
トアドレスが出力されている。従って、1クロック前に
対してライトアドレスとリードアドレスの出力が入れ替
わったことになる。さらに、1クロック後にまたライト
アドレスを当該端子から出力したければ、端子701の
入力をLOWにする。これにより、DFF710から出
力されるHIGHレベルとの間で演算がなされ、排他的
論理和素子711からはHIGHレベルが出力され、ま
た、アドレスが入れ替わり、クロック印加後に、アドレ
ス出力端子720からはライトアドレスが出力される。
その際に、制御信号入力端子702の入力がHIGHレ
ベルに設定している場合は、ライトアドレスは1から2
に更新されるが、当該入力がLOWレベルであればアド
レス値は「1」のままである。
In the above structure, first, the terminal 70
4, the clear signal is applied to DFFs 705, 706, 7
10 is cleared. At this point, the DFF holds the write address and the DFF 706 holds the read address. Here, in order to generate an address for writing data to the FIFO memory, first, LOW (meaning selection of a write address) is applied to the terminal 701, and the terminal 70
Input HIGH to 2. This causes the exclusive OR element 711 to output a LOW level, which causes the selector 707 to output the output of the DFF 705 to the selector 708.
Then, the output of the DFF 706 is selected. In this case, the output of both selectors 708 is zero. Selector 70
The output of 8 is sent to the DFF 706, and the output of the selector 707 is added with “1” by the adder 709.
Sent to 05. Here, when a clock is applied from the clock input terminal 703, the DFFs 705, 706, 710
Each captures the data, and each is "1",
"0" and "0" are output. The output "1" of the DFF 705 is output to the address output terminal 720, which is used as a write address. Next, just before FI
A read address for reading the data written in the FO memory is generated. In this case, HIGH is input to both the terminal 701 and the control signal input terminal 702. As a result, the exclusive OR element 711 outputs HIGH, which causes the selector 707 to output the DFF 706.
The output of the DFF 705 is selected by the selector 708.
The output of the DFF 706 is a read address whose value is "0", and when it is output from the selector 707, "1" is added by the adder 709 and the result is sent to the DFF 705. Here, when a clock is applied, a read address having a value of “1” is output from the control signal input terminal 702 through the DFF 705. At this time, the write address is output from the DFF 706. Therefore, the output of the write address and the output of the read address are exchanged one clock before. Further, if the write address is to be output from the terminal again after one clock, the input of the terminal 701 is set to LOW. As a result, an operation is performed with respect to the HIGH level output from the DFF 710, the exclusive OR element 711 outputs the HIGH level, the addresses are exchanged, and the write address is output from the address output terminal 720 after the clock is applied. Is output.
At that time, if the input of the control signal input terminal 702 is set to the HIGH level, the write address is from 1 to 2
However, if the input is LOW level, the address value remains "1".

【0034】以上のようにして、ランダムアクセスメモ
リをFIFOメモリとして使用するためのアドレスを効
率よく発生することができる。なお、本実施例では加算
器709がセレクタ出力とDFF入力の間にあるが、当
該DFF出力とセレクタ入力の間に配置しても良い。そ
の際、制御信号入力端子702から入力するアドレスの
カウントアップ信号は、DFFで1クロック遅延された
後、当該加算器709に入力する。これにより、本実施
例ではアドレス値「1」から書込みと読み出しを開始し
ていたのが、アドレス値「0」から開始することが可能
となる。
As described above, the address for using the random access memory as the FIFO memory can be efficiently generated. Although the adder 709 is provided between the selector output and the DFF input in this embodiment, it may be provided between the DFF output and the selector input. At that time, the count-up signal of the address input from the control signal input terminal 702 is delayed by one clock in the DFF and then input to the adder 709. As a result, in the present embodiment, writing and reading were started from the address value "1", but it is possible to start from the address value "0".

【0035】[0035]

【発明の効果】以上説明したように、本発明は入力デー
タの各々の値に応じて選択手段が選択した1つの頻度値
保持手段から出力される頻度値に加算手段が1を加算し
て対応する頻度値保持手段に更新された頻度値を保持さ
せるように構成したので、簡単な構成で入力データの各
々の値に対する出現頻度のカウントを行うことができ
る。従って、種々の用途に適用可能なカウンタ機構を大
幅に簡略でき、わずかな付加回路で頻度値が最大である
モードを検出することも可能となる等の効果を奏する。
As described above, according to the present invention, the adding means adds 1 to the frequency value output from one frequency value holding means selected by the selecting means according to each value of the input data. Since the updated frequency value is held in the frequency value holding means, the appearance frequency can be counted for each value of the input data with a simple configuration. Therefore, the counter mechanism applicable to various uses can be greatly simplified, and the mode having the maximum frequency value can be detected with a few additional circuits.

【図面の簡単な説明】[Brief description of drawings]

【図1】本発明の第1実施例を示すカウンタ装置の構成
を説明するブロック図である。
FIG. 1 is a block diagram illustrating a configuration of a counter device according to a first embodiment of the present invention.

【図2】図1に示したカウンタ装置の等価回路の一例を
示す回路ブロック図である。
FIG. 2 is a circuit block diagram showing an example of an equivalent circuit of the counter device shown in FIG.

【図3】本発明の第2実施例を示すカウンタ装置の構成
を説明するブロック図である。
FIG. 3 is a block diagram illustrating a configuration of a counter device according to a second embodiment of the present invention.

【図4】本発明の第3実施例を示すカウンタ装置の構成
を説明するブロック図である。
FIG. 4 is a block diagram illustrating a configuration of a counter device according to a third embodiment of the present invention.

【図5】図4に示したカウンタ装置の他の構成を説明す
るブロック図である。
5 is a block diagram illustrating another configuration of the counter device shown in FIG.

【図6】図5に示した一致検出器の一例を示す回路ブロ
ック図である。
6 is a circuit block diagram showing an example of the coincidence detector shown in FIG.

【図7】本発明の第4実施例を示すカウンタ装置の構成
を説明するブロック図である。
FIG. 7 is a block diagram illustrating a configuration of a counter device according to a fourth embodiment of the present invention.

【図8】従来のカウンタ装置の構成を説明する回路ブロ
ック図である。
FIG. 8 is a circuit block diagram illustrating a configuration of a conventional counter device.

【図9】図8に示したデコーダの一例を示す回路ブロッ
ク図である。
9 is a circuit block diagram showing an example of the decoder shown in FIG.

【符号の説明】[Explanation of symbols]

102 デコーダ 103 DFFーCEN 104 DFFーCEN 105 DFFーCEN 106 DFFーCEN 107 セレクタ 108 加算器 102 Decoder 103 DFF-CEN 104 DFF-CEN 105 DFF-CEN 106 DFF-CEN 107 Selector 108 Adder

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】 入力データの各々の値の出現頻度を保持
するための複数の頻度値保持手段と、各頻度値保持手段
から前記入力データに対応した頻度値を選択する選択手
段と、この選択手段により選択された前記頻度値に1を
加算する加算手段とを有することを特徴とするカウンタ
装置。
1. A plurality of frequency value holding means for holding the appearance frequency of each value of input data, a selection means for selecting a frequency value corresponding to the input data from each frequency value holding means, and this selection. A counter device comprising: an addition unit that adds 1 to the frequency value selected by the unit.
JP2334692A 1992-01-14 1992-01-14 Counter device Pending JPH05189201A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2334692A JPH05189201A (en) 1992-01-14 1992-01-14 Counter device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2334692A JPH05189201A (en) 1992-01-14 1992-01-14 Counter device

Publications (1)

Publication Number Publication Date
JPH05189201A true JPH05189201A (en) 1993-07-30

Family

ID=12108029

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2334692A Pending JPH05189201A (en) 1992-01-14 1992-01-14 Counter device

Country Status (1)

Country Link
JP (1) JPH05189201A (en)

Similar Documents

Publication Publication Date Title
US5384744A (en) Look ahead flag for FIFO
US20060004980A1 (en) Address creator and arithmetic circuit
US5627797A (en) Full and empty flag generator for synchronous FIFOS
KR100489880B1 (en) State machine design to generate half-filled and half-blank flags in an asynchronous FIFO
JPH06216762A (en) Asynchronous counter
KR920003176B1 (en) Control data regenerating device for sort processor
US8201015B2 (en) Control card circuit and method for selecting a synchronization source among a plurality of line card circuits
JPH05189201A (en) Counter device
KR100301653B1 (en) High speed empty flag generator
US5963056A (en) Full and empty flag generator for synchronous FIFOs
US5146479A (en) Up/down counter for counting binary data stored in flip flops
JPH0738630B2 (en) Digital pattern decoder and decoding method
US6320881B1 (en) Method, architecture and circuit for locking a data transmission frame
KR100338402B1 (en) Memory device and method of controlling the same
SU1621140A2 (en) Counting device with check
KR0151004B1 (en) Divider of galois field
SU976438A1 (en) Device for determination of character line length
KR930005653B1 (en) Clock variable circuit
KR100247062B1 (en) Fifo method and circuit having ring structure
JPH08125494A (en) Moving average filter
JP2001202231A (en) Parallel data counting device
JPH0797743B2 (en) Majority logic circuit
JPH05175829A (en) Method and device for data input/output
JPH09186680A (en) Data latch circuit
JPS6333805B2 (en)