JPH03188514A - Counting circuit - Google Patents

Counting circuit

Info

Publication number
JPH03188514A
JPH03188514A JP1327549A JP32754989A JPH03188514A JP H03188514 A JPH03188514 A JP H03188514A JP 1327549 A JP1327549 A JP 1327549A JP 32754989 A JP32754989 A JP 32754989A JP H03188514 A JPH03188514 A JP H03188514A
Authority
JP
Japan
Prior art keywords
circuit
counting
counting circuit
count value
register
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
JP1327549A
Other languages
Japanese (ja)
Other versions
JP2725419B2 (en
Inventor
Michihiro Yamane
山根 道広
Tsutomu Komatsubara
小松原 勉
Satoru Miyayama
哲 宮山
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.)
Nippon Telegraph and Telephone Corp
Original Assignee
Nippon Telegraph and Telephone Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nippon Telegraph and Telephone Corp filed Critical Nippon Telegraph and Telephone Corp
Priority to JP1327549A priority Critical patent/JP2725419B2/en
Publication of JPH03188514A publication Critical patent/JPH03188514A/en
Application granted granted Critical
Publication of JP2725419B2 publication Critical patent/JP2725419B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Measurement Of Unknown Time Intervals (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

PURPOSE:To read out an exact counted value at an arbitrary time without correcting the momently changing counted value of a counting circuit by providing plural cascaded counting circuits except the lowest-order counting circuit with buffer registers. CONSTITUTION:A device consists of a lower-order counting circuit 10, a higher- order counting circuit 11, a buffer register 12 connected to the higher-order counting circuit 11, a carry propagating circuit 13, a general register 14, a control circuit 16, and a data bus 15 which connects them in common. The general register 14 and the buffer register 12 are connected to the control circuit 16 through the data bus 15, and the control circuit 16 controls the operation of data stored in the register 14 and the procedures. That is, higher-order counting circuits other than the lowest-order counting circuit are provided with buffer registers, and host counted values are simultaneously transferred to buffer registers at the time of reading out the lowest-order counted value. Thus, the exact counted value is read out at an arbitrary time without correcting the momently changing counted value of the counting circuit.

Description

【発明の詳細な説明】 【産業上の利用分野】 本発明は、マイクロプロセッサ等の制御論理回路に用い
られ、複数の計数回路により構成される長語長のハード
ウェア計数回路に関するものである。 〔従来の技術〕 従来より、プロセス制御等の制御論理回路においては、
専用のハードウェアで構成されたイベントカウンタ、あ
るいはタイマ等が広く使用されている。これらのイベン
トカウンタやタイマ等の計数回路の語長としては、制御
論理回路での処理の容易さを考慮して、通常は制御論理
回路に用いられているマイクロプロセッサ等のIM長に
一致させて設計されている。 しかしながら、1語長では制御論理回路の適用分野が広
がるに伴って、計時計数精度あるいは計時計数範囲が不
足することが多くなってきた。 −例として、プロセス装置の設置時期からの通算日数を
計数精度ミリ秒の単位で計数するハードウェア構成の計
数回路(タイマ)と、lllll長上2ビツトイクロプ
ロセッサとから構成される装置論理回路について、以下
に説明する。 1日をミリ秒の単位で計算すると、86,40o、oo
oミリ秒(60X 60 X 24 X 1000)で
ある。さらに、これを2進数で表わすと、 1010010101001011010000ooo
o。 となり、全体で27ビツトである。1語長32ビットの
マイクロプロセッサにおいて、経過時間を表わすための
通算ミリ秒の計数値に27ビツトを使用すると、その他
の表示に割り当てられるのは、32−27=5ビツトだ
けである。5ビツトでは、2°=32であるため、その
計数範囲は1日車位で通算した場合、すなわち1日1ビ
ツトで表示した場合には、僅か1月分しかないことにな
る。 そこで、32ビツト1語長だけで計数するためには、計
数単位を例えばミリ秒から秒単位に変更して、計時精度
を下げる必要がある。 このように、装置設置時期からの通算日数を数年程度に
わたってミリ秒の精度で計時するためには、32ビツト
1語長では不十分であって、十分な計時範囲を得るため
には複数語の計数回路が必要となる。 以上のように、マイクロプロセッサ等において、ハード
ウェア計数回路を備えることにより、必要な計数精度お
よび計数範囲を確保することができる。しかしながら、
計数値読み出し中にも、ハードウェア計数回路が制御論
理回路とは独立して計数を行っているため、読み出し中
の計数値の変化に対処することが必要となる。 第6図は、従来のハードウェア計数回路の第1の例を示
す構成図であって、計時範囲を確保するために、2個の
計数回路を縦続接続したハードウェア計数回路を備える
制御論理回路を示している。 第6図において、61.62はキャリ伝搬回路63によ
り縦続接続された加算計数回路、64は計数回路61.
62とともにデータバス65に接続される汎用レジスタ
、66は汎用レジスタ64に格納されたデータの演算、
あるいは計数回路61.62から計数値の汎用レジスタ
64への読み出し等の手順を制御する制御回路である。 計数回路61.62は、計数クロック68に同期して時
刻を計数する。また、制御回路66は、データの演算と
手順等を制御するために、マシンクロック67に同期し
て動作する。 先ず、マシンクロック67と計数クロック68について
述べる。計数回路61と62の各計数値は、制御回路6
6の操作により汎用レジスタ64に読み出されて、これ
が利用されるため、計数クロック68の周波数f、をマ
シンクロック67の周波数f、より高い周波数にしても
、周波数11以上の精度は得られない、また、周波数f
、と周波数f、を等しいか、あるいは同程度に設定する
と、計数クロック68の精度を生かすためには、制御回
路66が頻繁に計数回路61.62の内容を読み出して
判断する必要に迫られる。その結果、制御回路66は、
論理回路全体の制御回路として機能できなくなる可能性
もある。そのため、計数クロック68の周波数f、は、
マシンクロック67の周波数f、を、一般には、より1
桁以上低く設定する。 以下の説明では、計数回路の動作と制御回路の動作の理
解を容易にするため、計数クロック68とマシンクロッ
ク67とは同一の周波数で、位相が180″′異なるク
ロックとする。また、計数回路61が下位、計数回路6
2が上位となるように縦続接続した加算計数回路にする
。 第7図は、第6図における動作タイムチャートである。 制御回路66は、計数値読み出し命令があると、上位に
比べて計数頻度の高い下位の計数回路61の値を先ず読
み出して、その値をデータバス65を介して汎用レジス
タ64に転送する0次に、下位に比べて計数頻度の低い
上位の計数回路62の値を読み出し、この値をデータバ
ス65を介して汎用レジスタ64に転送する。汎用レジ
スタ64に転送された計数値を基に、制御回路66は計
数値と予め定めた初期値との比較等の処理を行う。 第7図に示すように、計数回路61は時刻K。 でクロック68を計数し、計数値B、でキャリを発生し
ている。読み出し時刻T、で、計数回路61の計数値B
、が汎用レジスタ64に転送される。 計数回路61にキャリが発生しているので、時刻に、に
は計数クロック68を計数して、キャリ伝搬回路63を
介して計数回路62にキャリが転送されることにより、
計数回路62の計数値はA。 +1に歩進する。このため、計数回路61の下位データ
B、は読み出し時刻T、に読み出させるが、続いて時刻
T1に読み出される計数回路62の上位データは読み出
し時刻T、の値A、と異なり、歩進した値A、+1を読
み出すことになる。 従って、計数回路61と計数回路62を制御する制御回
路66は、計数値の読み出し期間中、下位の計数回路6
1かも上位の計数回路62へのキャリ発生状態を計数値
の読み出し期間中監視して、キャリ発生があったときに
は、読み出し終了後に上位の計数値を減算して、補正を
行う。 従来、このような補正のための処理を不要にするため、
複数語からなる長語長のハードウェア計数回路も、提案
されている。 第8図は、従来のハードウェア計数回路の第2の例を示
す構成図であって、読み出し時の計数値の変化の補正を
必要としない2語構成の計数回路を備えた制御論理回路
の例を示している。 第8図において、第7図の構成と異なる点は、計数回路
80.82とデータバス86の間に、それぞれバッファ
レジスタ81.83が挿入されていることである。制御
回路87全体は、マシンクロック88に同期して動作し
、また計数回路80゜82は計数クロック89に同期し
て計数動作している。 計数回路80と82は、キャリ伝搬回路84で縦続接続
された加算計数回路であり、計数回路80は下位、計数
回路82は上位の値を計数する。 読み出し用のバッファレジスタ81と83は、ともにデ
ータバス86を介して制御回路87と接続され、制御回
路87は汎用レジスタ85に格納されたデータの演算と
手順を制御する。 第9図は、第8図における動作タイムチャートである。 第8図において、読み出し中に起こり得る計数値変化の
補正をせずに、計数回路から計数値を読み出すため、計
数値フェッチ命令とバッファレジスタからのデータ読み
出し命令を必要とする。計数値フェッチ命令により、計
数回路80と計数回路82の計数値B0、計数値A、が
バッファレジスタ81と83に同時にフェッチされる。 統いて、バッファレジスタ81の読み出し命令により、
計数値B、はデータバス86を介して汎用レジスタ85
に転送される。さらに、バッファレジスタ83の読み出
し命令により、計数値A、がデータバス86を介して汎
用レジスタ85に転送される。 すなわち、第91!Iに示すように、計数回路80は、
時刻T、でクロック89を計数して計数値B。 でキャリを発生している0時刻T、で、計数値フェッチ
命令により、計数回路80と計数回路82の計数値B、
と計数値A、がバッファレジスタ81と83にフェッチ
される。計数回路80にキャリが発生しているので、時
刻T、には、計数回路82の計数値がA、+1に歩進す
る。しかし、汎用レジスタ85には、時刻T、でバッフ
ァレジスタ8工の読み出し命令で計数値B、が、時刻T
、でバッファレジスタ83の読み出し命令で計数値A。 が、それぞれ読み出される。 なお、この種の従来文献としては、例えば。 FNECマイクロプロセッサ/周辺データブックJl 
1989  pp、118〜139に記載されたプログ
ラムマブル・インタバル・タイマがある。 〔発明が解決しようとする課Ill 従来のハードウェア計数回路の第1の例(第6図)、つ
まり単に複数語の計数回路を縦続接続した長語長のハー
ドウェア計数回路では、制御回路がハードウェア計数回
路から計数値を読み出すだけでなく、計数値の読み出し
期間中、計数回路のキャリ発生状態を検出して、キャリ
発生があった場合には、読み出し終了後に上位の計数値
を減算し、補正する手続きをソフトウェアで行う必要が
あった。このように、計数値読み出し時における処理の
オーバーヘッドは、制御論理回路の効率を低下される要
因となっていた。 また、第8図に示す第2の例、つまりそれぞれの計数回
路にバッファレジスタを設けたハードウェア計数回路で
は、計数値の読み出し期間中に計数値の変化が起きても
、読み出し終了後に計数値の補正を必要としない、しか
しながら、計数回路と同数のバッファレジスタを必要と
するので、ハードウェア量が多くなるとともに、計数値
の読み出しにバッファレジスタからのデータ読み出し命
令の他に、計数値フェッチ命令を必要とするので、命令
数が多くなるという問題があった。 本発明の目的は、これら従来の課題を解決し、計数値を
外部に転送する期間中に計数が進んで計数値が変化して
も、計数値の補正が不要であり、かつハードウェア量と
命令数を従来より少なくすることが可能な計数回路を提
供することにある。 〔課題を解決するための手段〕 上記目的を達成するため、本発明の計数回路は、縦続接
続されたm個の計数回路と、最下位の計数回路を除く全
ての計数回路にそれぞれ接続されたm−1個のバッファ
レジスタと、最下位の計数回路の出力端子およびバッフ
ァレジスタの出力端子に接続された出力回路とを具備し
、最下位の計数回路の計数値の読み出し時には、計数回
路の計数値を出力すると同時に、最下位の計数回路を除
く全ての計数回路の計数値をm−1個の上記バッファレ
ジスタに転送し、出力回路は該最下位の計数回路および
m−1個のバッファレジスタ毎に、転送された計数値を
読み出し要求元に出力するように構成したことに特徴が
ある。 〔作  用J 本発明においては、高い計数精度あるいは広い計数範囲
を得るために複数語で構成した計数回路において、縦続
接続された複数語で構成される計数回路に、再開を除く
上位の計数回路にバッファレジスタを備え、最下位の計
数値の読み出し時に上位の計数値を同時にバッファレジ
スタに転送することにより、時々刻々と変化する計数回
路の計数値を補正せずに、正確な計数値を任意の時刻に
読み出すことができるようにしている。 〔実施例〕 以下、本発明の実施例を、図面により詳細に説明する。 第1図は、本発明の第1の実施例を示す計数回路の構成
図であって、2語構成のハードウェア計数回路を備えた
制御論理回路を示す。 第1図の制御論理回路は、下位の計数回路10と上位の
計数回路11と、上位の計数回路11に接続されたバッ
ファレジスタ12と、キャリ伝搬回路13と、汎用レジ
スタ14と、制御回路16と、これらを共通に接続する
データバス15がら構成されている。制御回路16全体
は、マシンクロック17に同期して動作し、また計数回
路10゜11は計数クロック18に同期して計数を行う
。 計数回路lOおよび11は、キャリ伝搬回路13で縦続
接続された加算計数回路であり、計数回路10は下位を
計数し、計数回路11は上位を計数する。読み出し用の
バッファレジスタ12の入力端子は、計数回路11の出
力端子に接続され、バッファレジスタ12の出力端子は
データバス15に接続される。汎用レジスタ14、バッ
ファレジスタ12は、いずれもデータバス15を介して
制御回路16に接続され、制御回路16は汎用レジスタ
14に格納されたデータの演算と手順を制御する。 第2図は、第1図の動作タイミングチャートである。 第1図において、制御回路16から計数値の読み出し命
令があると、計数回路10の計数値B。 がデータバス15に、また計数回路11の計数値A、が
バッファレジスタ12に、同時に読み出される。すなわ
ち、縦続接続された計数回路の中で、バッファレジスタ
を備えていない計数回路10への読み出し命令は、バッ
ファレジスタ12を備えた計数回路11の計数値のバッ
ファレジスタ12へのフェッチ命令を兼用している。統
いて、計数回路11の計数値読み出し命令によって、計
数値A、がデータバス15を介して汎用レジスタ14に
転送される。 第2図に示すように、計数回路lOは時刻K。 でクロック18を計数して、計数値B、でキャリを発生
している。読み出し時刻T、で計数回路10の計数値B
、が汎用レジスタ14に転送され、同時に計数回路11
の計数値A、がバッファレジスタ12に転送される。計
数回路lOにキャリが発生しているため、時刻に1には
計数クロック18を計数して、キャリ伝搬回路13を介
して計数回路11にキャリを転送し、それにより計数回
路11の計数値はA、+1に歩進する。しかし、時刻T
。 で計数回路11の計数値A、はバッファレジスタ12に
転送されているため、時刻T1にバッファレジスタ12
を読み出せば、時刻T、の値A、を読み出すことが可能
である。 このように二本実施例では、最下位の計数値読み出し時
には、上位の計数値全語を同時にバッファレジスタに転
送するので、時々刻々と変化する計数回路の計数値を補
正することなく、正確な計数値を任意の時刻に読み出す
ことができる。 第3図は、本発明の第2の実施例を示す計数回路の構成
図であって、制御回路の語長と一致していない2訓構成
のハードウェア計時回路を備えた制御論理回路を示して
いる。 ハードウェア計時回路の語長と制御回路の処理単位語長
とが必ずしも一致しない場合も多い。 第3図において、制御論理回路は、計時回路30と計時
回路31とバッファレジスタ32とキャリ伝搬回路33
と汎用レジスタ34とデータバス35と制御回路36と
から構成される。制御回路36全体は、マシンクロック
37に同期して動作し、計時回路30と計時回路31は
計時クロック38に同期して計時動作を行う。 汎用レジスタ34とデータバス35と制御回路36は、
III長32ビットのマイクロプロセッサとし、制御論
理回路全体も32ビツトの語長である。計時回路30は
ミリ秒の単位で1日を通算する計時回路であり、また計
時回路31は1日の単位で10年を通算する計時回路で
ある。計時回路30と計時回路31とは、キャリ伝搬回
路33で縦続接続された計時回路として動作する。 第4図は、第3図における計時回路のビット構成図であ
って、第4図(a)は計時回路30の構成、第4図(b
)は計時回路31の構成を示している。 第4図に示すように、1日はミリ秒の単位で86400
000ミリ秒(60X 60 X 24 X 1000
)であり、2進数では下記27ビツトで表示される。 1010010101001011010000ooo
o。 ここでは、計時回路30は32ビツトのうち上位5ビツ
トは使用せず、常時0とする。 また、10年は1日の単位で3650 日(365X 
10)であり、2進数では下記12ビツトで表示される
。 111001000010 ここでは、計時回路31は32ビツトのうち、上位20
ビツトは使用せずに、常時0とする。 第5図は、第3図におけるバッファレジスタと制御回路
のデータバスとの整合方法を示す図である。 ここでは、27ビツトの計時回路30および12ビツト
のバッファレジスタ32を、32ビツトのデータバス3
5に整合させる方法を示している。 27ビツト(ビット5〜31)の計時回路30の出力端
子はデータバス35の27個のバス駆動回路35−1の
入力端子に接続されている。また、12ビツト(ビット
20〜31)のバッファレジスタ32の入力端子は、1
2ビツトの計時回路31の出力端子に接続される。そし
て、12ビツトのバッファレジスタ32の出力端子は、
データバス35内部の12個のバス駆動回路35−1の
入力端子に接続される。 32ビツトのうちの使用されない上位ビットにはレジス
タを配置せず、論理値0に対応する電位回路(VSS)
を入力端子に接続したバス駆動回路35−1に配置する
。ここでは、論理値Oは、接地電位とする。 このようにして、制御回路36の処理単位語長と一致し
ていない計時回路と制御回路との接続が行われる。 なお、汎用レジスタ34、バッファレジスタ32は、と
もにデータバス35を介して制御回路36と接続され、
制御回路36は汎用レジスタ34に格納されたデータの
演算および手順を制御する。 動作タイミングは、第1の実施例と同じであるため、説
明を省略する。 このように、本実施例の計数回路では、読み出し期間内
に計数動作が発生した場合、読み出し完了後にシステム
M弁用ソフトウェアで行っていた計数値の補正は不要と
なる。 なお、実施例では、2個の計数回路を縦続接続した場合
のみを説明したが、3個以上の計数回路を縦続接続する
場合も全く同じようにして、最下位を除く計数回路にバ
ッファレジスタを備えるとともに、最下位の計数値を読
み出す時には上位の計数値全語を同時にバッファレジス
タに転送し、次のタイミング以降で順次バッファレジス
タからデータバスを介して汎用レジスタに転送する。 〔発明の効果] 以上説明したように、本発明によれば、高い計時計数精
度あるいは広い計時計数範囲を実現するため、縦続接続
された複数個の計数回路のうち、最下位を除く計数回路
にバッファレジスタを備えたハードウェア計数回路を構
成するので、最下位の計数値読み出し時には、上位の計
数値全語を同時にバッファレジスタに転送し、時々刻々
と変化する計数回路の計数値を補正せずに、正確な計数
値を任意の時刻に読み出すことが可能となり、高い効率
でプロセッサを利用することができる。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a long word length hardware counting circuit that is used in a control logic circuit such as a microprocessor and is composed of a plurality of counting circuits. [Prior Art] Conventionally, in control logic circuits such as process control,
Event counters or timers configured with dedicated hardware are widely used. Considering the ease of processing in the control logic circuit, the word length of counting circuits such as event counters and timers is usually set to match the IM length of the microprocessor used in the control logic circuit. Designed. However, as the field of application of control logic circuits expands with one word length, the counting accuracy or counting range is often insufficient. - As an example, regarding a device logic circuit consisting of a hardware-configured counting circuit (timer) that counts the total number of days since installation of the process device with a counting precision of milliseconds, and a 2-bit microprocessor. , explained below. If one day is calculated in milliseconds, it is 86,40o,oo
o milliseconds (60 x 60 x 24 x 1000). Furthermore, if this is expressed in binary, 1010010101001011010000ooo
o. So, the total is 27 bits. In a microprocessor with a word length of 32 bits, if 27 bits are used for the total millisecond count to represent elapsed time, only 32-27=5 bits are allocated to other displays. In the case of 5 bits, 2°=32, so the counting range is only one month when totaled in units of one day, that is, when displayed with one bit per day. Therefore, in order to count using only 32 bits and one word length, it is necessary to change the counting unit from milliseconds to seconds, for example, to lower the accuracy of timekeeping. In this way, one word length of 32 bits is insufficient to measure the total number of days since the device was installed with millisecond accuracy over several years, and multiple words are required to obtain a sufficient time measurement range. A counting circuit is required. As described above, by providing a hardware counting circuit in a microprocessor or the like, necessary counting accuracy and counting range can be ensured. however,
Since the hardware counting circuit performs counting independently of the control logic circuit even while reading the count value, it is necessary to deal with changes in the count value during readout. FIG. 6 is a block diagram showing a first example of a conventional hardware counting circuit, in which a control logic circuit includes a hardware counting circuit in which two counting circuits are connected in cascade to ensure a time measurement range. It shows. In FIG. 6, numerals 61 and 62 are addition and counting circuits connected in series by a carry propagation circuit 63, and numeral 64 is a counting circuit 61.
62 is a general-purpose register connected to the data bus 65; 66 is an operation for data stored in the general-purpose register 64;
Alternatively, it is a control circuit that controls procedures such as reading count values from the counting circuits 61 and 62 to the general-purpose register 64. Counting circuits 61 and 62 count time in synchronization with counting clock 68. Further, the control circuit 66 operates in synchronization with the machine clock 67 in order to control data calculations, procedures, and the like. First, the machine clock 67 and counting clock 68 will be described. Each count value of the counting circuits 61 and 62 is calculated by the control circuit 6.
6 is read out to the general-purpose register 64 and used, so even if the frequency f of the counting clock 68 is set to a higher frequency than the frequency f of the machine clock 67, accuracy higher than frequency 11 cannot be obtained. , and the frequency f
, and the frequency f are set to be equal or approximately the same, in order to take advantage of the accuracy of the counting clock 68, the control circuit 66 is forced to frequently read and judge the contents of the counting circuits 61 and 62. As a result, the control circuit 66:
There is also a possibility that it will no longer be able to function as a control circuit for the entire logic circuit. Therefore, the frequency f of the counting clock 68 is
The frequency f of the machine clock 67 is generally set to be less than 1
Set it an order of magnitude lower. In the following explanation, in order to facilitate understanding of the operation of the counting circuit and the operation of the control circuit, it is assumed that the counting clock 68 and the machine clock 67 have the same frequency and a phase difference of 180''. 61 is the lower order, counting circuit 6
Addition and counting circuits are connected in cascade so that 2 is at the top. FIG. 7 is an operation time chart in FIG. 6. When there is a count read command, the control circuit 66 first reads the value of the lower counting circuit 61 whose counting frequency is higher than that of the upper one, and transfers the value to the general-purpose register 64 via the data bus 65. Next, the value of the upper counting circuit 62 whose counting frequency is lower than that of the lower one is read out, and this value is transferred to the general-purpose register 64 via the data bus 65. Based on the count value transferred to the general-purpose register 64, the control circuit 66 performs processing such as comparing the count value with a predetermined initial value. As shown in FIG. 7, the counting circuit 61 is at time K. The clock 68 is counted, and a carry is generated at the count value B. At read time T, the count value B of the counting circuit 61
, is transferred to the general-purpose register 64. Since a carry has occurred in the counting circuit 61, the counting clock 68 is counted at the time, and the carry is transferred to the counting circuit 62 via the carry propagation circuit 63.
The count value of the counting circuit 62 is A. Advance to +1. Therefore, the lower data B of the counting circuit 61 is read out at the read time T, but the upper data of the counting circuit 62, which is subsequently read out at the time T1, differs from the value A at the read time T, and is incremented. The value A, +1 will be read out. Therefore, the control circuit 66 that controls the counting circuit 61 and the counting circuit 62 controls the lower counting circuit 6 during the reading period of the counted value.
The state of occurrence of a carry to the higher-order counting circuit 62 is monitored during the reading period of the count value, and if a carry is generated, the higher-order count value is subtracted after the readout to perform correction. Conventionally, in order to eliminate the need for such correction processing,
Hardware counting circuits for long word lengths consisting of multiple words have also been proposed. FIG. 8 is a block diagram showing a second example of a conventional hardware counting circuit, which is a control logic circuit equipped with a two-word counting circuit that does not require correction of changes in count values during readout. An example is shown. 8 differs from the configuration in FIG. 7 in that buffer registers 81 and 83 are inserted between counting circuits 80 and 82 and data bus 86, respectively. The entire control circuit 87 operates in synchronization with a machine clock 88, and the counting circuits 80 and 82 perform counting operations in synchronization with a counting clock 89. Counting circuits 80 and 82 are addition counting circuits connected in cascade through a carry propagation circuit 84, with counting circuit 80 counting the lower value and counting circuit 82 counting the upper value. The read buffer registers 81 and 83 are both connected to a control circuit 87 via a data bus 86, and the control circuit 87 controls the operation and procedure of data stored in the general-purpose register 85. FIG. 9 is an operation time chart in FIG. 8. In FIG. 8, a count value fetch instruction and a data read instruction from the buffer register are required to read the count value from the counting circuit without correcting for changes in the count value that may occur during reading. The count value fetch command causes the count value B0 and count value A of the count circuit 80 and the count circuit 82 to be fetched into the buffer registers 81 and 83 at the same time. In response to the command to read the buffer register 81,
The count value B is sent to the general-purpose register 85 via the data bus 86.
will be forwarded to. Further, in response to a read command from the buffer register 83, the count value A is transferred to the general-purpose register 85 via the data bus 86. In other words, the 91st! As shown in I, the counting circuit 80 is
At time T, the clock 89 is counted and the count value B is obtained. At time 0 T, when a carry is generated, the count value B of the counting circuit 80 and the counting circuit 82 is changed by the count value fetch instruction.
and count value A are fetched into buffer registers 81 and 83. Since a carry has occurred in the counting circuit 80, the count value of the counting circuit 82 increments to A,+1 at time T. However, at time T, the count value B is stored in the general-purpose register 85 by the read command of the buffer register 8 at time T.
, the count value A is read out from the buffer register 83. are read out respectively. In addition, as this type of conventional literature, for example. FNEC Microprocessor/Peripheral Data Book Jl
1989 pp. 118-139. [Problem to be solved by the invention Ill] In the first example of the conventional hardware counting circuit (Fig. 6), that is, in the long word length hardware counting circuit in which counting circuits for multiple words are simply connected in cascade, the control circuit is In addition to reading the count value from the hardware counting circuit, it also detects the carry generation state of the counting circuit during the reading period of the count value, and if a carry occurs, subtracts the upper count value after the readout is completed. , it was necessary to perform correction procedures using software. In this way, the processing overhead when reading the count value has been a factor in reducing the efficiency of the control logic circuit. In addition, in the second example shown in Fig. 8, that is, in a hardware counting circuit in which each counting circuit is provided with a buffer register, even if a change in the count value occurs during the reading period of the count value, the count value does not change after the reading is finished. However, since it requires the same number of buffer registers as counting circuits, the amount of hardware increases, and reading the count value requires a count value fetch instruction in addition to the data read instruction from the buffer register. , the problem is that the number of instructions increases. The purpose of the present invention is to solve these conventional problems, and to eliminate the need for correction of the counted value even if the counted value changes as the counting progresses during the period of transmitting the counted value to the outside, and to reduce the amount of hardware. An object of the present invention is to provide a counting circuit that can reduce the number of instructions compared to the conventional one. [Means for Solving the Problems] In order to achieve the above object, the counting circuit of the present invention is connected to m cascade-connected counting circuits and all counting circuits except the lowest counting circuit. It is equipped with m-1 buffer registers and an output circuit connected to the output terminal of the lowest counting circuit and the output terminal of the buffer register. At the same time as outputting the numerical value, the count values of all the counting circuits except the lowest counting circuit are transferred to the m-1 buffer registers, and the output circuit transfers the counted values of all the counting circuits except the lowest counting circuit and the m-1 buffer registers. The feature is that the transferred count value is output to the read request source in each case. [Function J] In the present invention, in a counting circuit composed of a plurality of words in order to obtain high counting accuracy or a wide counting range, a counting circuit composed of a plurality of cascaded words is provided with an upper counting circuit other than restarting. A buffer register is provided at the top, and by simultaneously transferring the upper count value to the buffer register when reading the lowest count value, accurate count values can be obtained arbitrarily without having to correct the count values of the counting circuit that change from time to time. It can be read out at the time of [Example] Hereinafter, an example of the present invention will be described in detail with reference to the drawings. FIG. 1 is a block diagram of a counting circuit showing a first embodiment of the present invention, and shows a control logic circuit equipped with a two-word hardware counting circuit. The control logic circuit in FIG. 1 includes a lower-order counting circuit 10, an upper-order counting circuit 11, a buffer register 12 connected to the upper-order counting circuit 11, a carry propagation circuit 13, a general-purpose register 14, and a control circuit 16. and a data bus 15 that connects these in common. The entire control circuit 16 operates in synchronization with a machine clock 17, and the counting circuits 10 and 11 perform counting in synchronization with a counting clock 18. Counting circuits 10 and 11 are addition counting circuits connected in cascade through a carry propagation circuit 13, with counting circuit 10 counting the lower order and counting circuit 11 counting the upper order. The input terminal of the read buffer register 12 is connected to the output terminal of the counting circuit 11, and the output terminal of the buffer register 12 is connected to the data bus 15. Both the general-purpose register 14 and the buffer register 12 are connected to a control circuit 16 via a data bus 15, and the control circuit 16 controls operations and procedures for data stored in the general-purpose register 14. FIG. 2 is an operation timing chart of FIG. 1. In FIG. 1, when there is a command to read a count value from the control circuit 16, the count value B of the counting circuit 10 is read. is read out to the data bus 15, and the count value A of the counting circuit 11 is read out to the buffer register 12 at the same time. That is, among the cascade-connected counting circuits, a read instruction to the counting circuit 10 that does not include a buffer register is also used as a fetch instruction for the count value of the counting circuit 11 that includes the buffer register 12 to the buffer register 12. ing. Then, the count value A is transferred to the general-purpose register 14 via the data bus 15 in response to a count read instruction from the counting circuit 11 . As shown in FIG. 2, the counting circuit IO is at time K. The clock 18 is counted and a carry is generated at the count value B. At read time T, the count value B of the counting circuit 10
, is transferred to the general-purpose register 14, and at the same time the counting circuit 11
The count value A, is transferred to the buffer register 12. Since a carry has occurred in the counting circuit IO, the count clock 18 is counted at time 1 and the carry is transferred to the counting circuit 11 via the carry propagation circuit 13, so that the count value of the counting circuit 11 becomes A, step to +1. However, time T
. Since the count value A of the counting circuit 11 is transferred to the buffer register 12 at time T1, the count value A of the counting circuit 11 is transferred to the buffer register 12 at time T1.
By reading , it is possible to read the value A of time T. In this way, in the two embodiments, when reading the lowest count value, all the upper count values are transferred to the buffer register at the same time, so the count value of the counting circuit that changes from moment to moment can be accurately read without having to correct the count value. Count values can be read out at any time. FIG. 3 is a configuration diagram of a counting circuit showing a second embodiment of the present invention, and shows a control logic circuit equipped with a hardware timer circuit having a two-step configuration that does not match the word length of the control circuit. ing. In many cases, the word length of the hardware clock circuit and the processing unit word length of the control circuit do not necessarily match. In FIG. 3, the control logic circuit includes a clock circuit 30, a clock circuit 31, a buffer register 32, and a carry propagation circuit 33.
, a general-purpose register 34 , a data bus 35 , and a control circuit 36 . The entire control circuit 36 operates in synchronization with a machine clock 37, and the time measurement circuit 30 and time measurement circuit 31 perform time measurement operations in synchronization with a time measurement clock 38. The general-purpose register 34, data bus 35, and control circuit 36 are
The microprocessor has a 32-bit word length, and the entire control logic circuit also has a word length of 32 bits. The timekeeping circuit 30 is a timekeeping circuit that counts the whole day in units of milliseconds, and the timekeeping circuit 31 is a timekeeping circuit that counts the whole 10 years in units of one day. The clock circuit 30 and the clock circuit 31 operate as a clock circuit connected in cascade through a carry propagation circuit 33. 4 is a bit configuration diagram of the clock circuit in FIG. 3, in which FIG. 4(a) shows the configuration of the clock circuit 30,
) shows the configuration of the clock circuit 31. As shown in Figure 4, one day consists of 86400 milliseconds.
000 milliseconds (60 x 60 x 24 x 1000
), and is displayed in the following 27 bits in binary. 1010010101001011010000ooo
o. Here, the clock circuit 30 does not use the upper 5 bits of the 32 bits and always sets them to 0. In addition, 10 years has 3650 days (365X
10), and is expressed in the following 12 bits in binary. 111001000010 Here, the clock circuit 31 selects the top 20 of the 32 bits.
The bit is not used and is always set to 0. FIG. 5 is a diagram showing a method of matching the buffer register in FIG. 3 with the data bus of the control circuit. Here, a 27-bit clock circuit 30 and a 12-bit buffer register 32 are connected to a 32-bit data bus 3.
5 is shown. The output terminal of the 27-bit (bits 5 to 31) clock circuit 30 is connected to the input terminals of 27 bus drive circuits 35-1 of the data bus 35. In addition, the input terminal of the 12-bit (bits 20 to 31) buffer register 32 is
It is connected to the output terminal of the 2-bit clock circuit 31. The output terminal of the 12-bit buffer register 32 is
It is connected to the input terminals of 12 bus drive circuits 35-1 inside the data bus 35. No register is placed in the unused upper bits of the 32 bits, and a potential circuit (VSS) corresponding to the logical value 0 is used.
is placed in the bus drive circuit 35-1 connected to the input terminal. Here, the logical value O is the ground potential. In this way, a connection is made between the timer circuit and the control circuit, which do not match the processing unit word length of the control circuit 36. Note that both the general-purpose register 34 and the buffer register 32 are connected to a control circuit 36 via a data bus 35.
Control circuit 36 controls operations and procedures for data stored in general-purpose register 34. Since the operation timing is the same as in the first embodiment, the explanation will be omitted. In this way, in the counting circuit of this embodiment, if a counting operation occurs during the readout period, it is no longer necessary to correct the counted value using the system M valve software after the readout is completed. In the embodiment, only the case where two counting circuits are connected in cascade has been explained, but when three or more counting circuits are connected in cascade, buffer registers are installed in the counting circuits except the lowest one in exactly the same way. At the same time, when reading the lowest counted value, all words of the higher counted value are transferred to the buffer register at the same time, and from the next timing onwards, they are sequentially transferred from the buffer register to the general-purpose register via the data bus. [Effects of the Invention] As explained above, according to the present invention, in order to achieve high counting precision or a wide counting range, counting circuits excluding the lowest among a plurality of cascade-connected counting circuits Since the circuit consists of a hardware counting circuit with a buffer register, when reading the lowest count value, all the upper count values are transferred to the buffer register at the same time, and the count value of the counting circuit that changes from moment to moment is corrected. It becomes possible to read out accurate count values at any time without having to do so, and the processor can be used with high efficiency.

【図面の簡単な説明】 第1図は本発明の第1の実施例を示す計数回路の構成図
、第2図は第1図における動作タイムチャート、第3図
は本発明の第2の実施例を示す計数回路の構成図、第4
図は第3図における計時回路のビット構成図、第5図は
第3図における計時回路とバッファレジスタとデータバ
スとの整合方法を示す図、第6図は従来の計数回路の第
1例を示す構成図、第7図は第6図の動作タイムチャー
ト、第8図は従来の計数回路の第2例を示す構成図、第
9図は第8図における動作タイムチャートである。 1O111:計数回路、12,32 :バッファレジス
タ、14,34:汎用レジスタ、16.36:制御回路
、15,35:データバッファ、130゜3に計時回路
、17.37:マシンクロック、18.38:計数クロ
ック。 Vへ入C+) Q ’/ゝ 一 第 8 図
[Brief Description of the Drawings] Fig. 1 is a block diagram of a counting circuit showing a first embodiment of the present invention, Fig. 2 is an operation time chart in Fig. 1, and Fig. 3 is a diagram showing a second embodiment of the present invention. Block diagram of a counting circuit showing an example, No. 4
The figure is a bit configuration diagram of the clock circuit in Figure 3, Figure 5 is a diagram showing the matching method of the clock circuit, buffer register, and data bus in Figure 3, and Figure 6 is a diagram showing the first example of the conventional counting circuit. FIG. 7 is an operation time chart of FIG. 6, FIG. 8 is a configuration diagram of a second example of a conventional counting circuit, and FIG. 9 is an operation time chart of FIG. 10111: Counting circuit, 12, 32: Buffer register, 14, 34: General-purpose register, 16.36: Control circuit, 15, 35: Data buffer, 130°3 clock circuit, 17.37: Machine clock, 18.38 : Counting clock. Enter V C+) Q'/ゝ1 Fig. 8

Claims (1)

【特許請求の範囲】[Claims] (1)縦続接続されたm個の計数回路と、最下位の計数
回路を除く全ての計数回路にそれぞれ接続されたm−1
個のバッファレジスタと、該最下位の計数回路の出力端
子および該バッファレジスタの出力端子に接続された出
力回路とを具備し、該最下位の計数回路の計数値の読み
出し時には、該計数回路の計数値を出力すると同時に、
最下位の計数回路を除く全ての計数回路の計数値をm−
1個の上記バッファレジスタに転送し、該出力回路は該
最下位の計数回路およびm−1個のバッファレジスタ毎
に、転送された計数値を読み出し要求元に出力するよう
に構成したことを特徴とする計数回路。
(1) m counting circuits connected in cascade and m-1 each connected to all counting circuits except the lowest counting circuit
buffer registers, an output terminal of the lowest counting circuit, and an output circuit connected to the output terminal of the buffer register, and when reading the count value of the lowest counting circuit, At the same time as outputting the count value,
The count values of all counting circuits except the lowest counting circuit are m-
The count value is transferred to one of the buffer registers, and the output circuit is configured to output the transferred count value to the read request source for each of the lowest counting circuit and m-1 buffer registers. A counting circuit with
JP1327549A 1989-12-18 1989-12-18 Counting circuit Expired - Lifetime JP2725419B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP1327549A JP2725419B2 (en) 1989-12-18 1989-12-18 Counting circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP1327549A JP2725419B2 (en) 1989-12-18 1989-12-18 Counting circuit

Publications (2)

Publication Number Publication Date
JPH03188514A true JPH03188514A (en) 1991-08-16
JP2725419B2 JP2725419B2 (en) 1998-03-11

Family

ID=18200314

Family Applications (1)

Application Number Title Priority Date Filing Date
JP1327549A Expired - Lifetime JP2725419B2 (en) 1989-12-18 1989-12-18 Counting circuit

Country Status (1)

Country Link
JP (1) JP2725419B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07295806A (en) * 1994-04-27 1995-11-10 Kofu Nippon Denki Kk Timer reading controller
JP2017028381A (en) * 2015-07-17 2017-02-02 日本電信電話株式会社 Timer circuit

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07295806A (en) * 1994-04-27 1995-11-10 Kofu Nippon Denki Kk Timer reading controller
JP2017028381A (en) * 2015-07-17 2017-02-02 日本電信電話株式会社 Timer circuit

Also Published As

Publication number Publication date
JP2725419B2 (en) 1998-03-11

Similar Documents

Publication Publication Date Title
KR920007905B1 (en) Direct memory access controller
US4330840A (en) Multi-function electronic digital watch
JPH03188514A (en) Counting circuit
JPS592924B2 (en) Sequencer input/output control circuit
JPS63187913A (en) Pulse duty detecting circuit
JPS6047612B2 (en) Microinstruction output control method
JP2517943B2 (en) Timer device
JPS58169183A (en) Crt display unit
JPS6269352A (en) Microprocessor
JPH10171654A (en) Fast data arithmetic processor
JPS59100926A (en) Timer circuit
JPH0422220A (en) Synchronous output circuit
JPS61140886A (en) Setting circuit for date and time
JPH02192315A (en) Pulse generator
JPH01236817A (en) Pulse counter
JPH03161883A (en) Microprocessor
JPH0375909A (en) System for reading out counter value
JPH02110733A (en) Information processor
JPS62117052A (en) Serial input and output circuit
JPH05333956A (en) Timer circuit
JPH01276240A (en) Timer counter
JPS62197839A (en) Control system for central processing unit
JPS58121432A (en) Memory control circuit
JPS61235790A (en) System timepiece
JPH03246603A (en) Rapid counter

Legal Events

Date Code Title Description
FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20071205

Year of fee payment: 10

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

Free format text: PAYMENT UNTIL: 20081205

Year of fee payment: 11

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

Free format text: PAYMENT UNTIL: 20091205

Year of fee payment: 12

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

Free format text: PAYMENT UNTIL: 20101205

Year of fee payment: 13

EXPY Cancellation because of completion of term
FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20101205

Year of fee payment: 13