JPH11220383A - Counter device with output holding function, clock controller, counter device, and interval timer device - Google Patents

Counter device with output holding function, clock controller, counter device, and interval timer device

Info

Publication number
JPH11220383A
JPH11220383A JP2170698A JP2170698A JPH11220383A JP H11220383 A JPH11220383 A JP H11220383A JP 2170698 A JP2170698 A JP 2170698A JP 2170698 A JP2170698 A JP 2170698A JP H11220383 A JPH11220383 A JP H11220383A
Authority
JP
Japan
Prior art keywords
clock
counter
timer
tclk
timing
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
JP2170698A
Other languages
Japanese (ja)
Inventor
Hisasuke Sawai
寿承 澤井
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.)
Panasonic Holdings Corp
Original Assignee
Matsushita Electric Industrial Co Ltd
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 Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP2170698A priority Critical patent/JPH11220383A/en
Publication of JPH11220383A publication Critical patent/JPH11220383A/en
Pending legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To provide a counter device which can read or write a timer counter stably with a timer clock asynchronous with a system clock, a clock controller which stably supplies the timer clock, and a interval timer device which is equipped with those devices and actualized by easy designing. SOLUTION: The interval timer device is equipped with the timer counter 11 which inputs and counts the TLCK (timer clock) asynchronous with the CLK (system clock) or writes external input data from an asynchronous preset terminal, a means 12 which decides the timing of counter value update, a readout temporary register 13 which inputs and holds the counter value again when the timing is constant, a means 14 which controls whether or not the TCLK is allowed to pass, a write temporary register 16 which temporarily stores the external input data when the timer clock passes, and a means 15 which generates a control signal showing the timing of the writing of the temporarily stored data to the timer counter 11.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、CPU等を含むシ
ステムにおいて用いる装置であって、システムクロック
とタイマクロックとが非同期で、該タイマクロックで動
作するタイマカウンタを有するカウンタ装置,及び該タ
イマクロックの供給を制御するクロック制御装置,並び
にこれらの装置を備えたインタバルタイマ装置に関す
る。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an apparatus for use in a system including a CPU and the like, and a counter apparatus having a timer counter operating with the system clock and the timer clock and operating with the timer clock, and the timer clock. The present invention relates to a clock control device for controlling the supply of power and an interval timer device provided with these devices.

【0002】[0002]

【従来の技術】一般的にインタバルタイマなどの一定時
刻を刻むための回路に供給するクロック(タイマクロッ
ク)は、CPUなどに供給するシステムクロックとは非
同期である。従来からCPUに供給するシステムクロッ
クは、動作の高速化を追及するためできるだけ高い周波
数が用いられてきたが、インタバルタイマなどの一定時
刻を刻むための回路のタイマクロックは、あまり速いク
ロックが必要にならないのが一般的である。したがっ
て、タイマクロックをシステムクロックでサンプリング
して、タイマクロックをシステムクロックに同期させて
用いる手法が一般的であった。しかし、最近携帯機器な
どの出現で低消費電力化が求められ、システムが待機状
態など処理をほとんど行なわないときは、システムクロ
ック周波数を低くしたり、場合によってはシステムクロ
ックを止めるといったことも必要になってきた。一方
で、インタバルタイマは一定時刻を刻むものであるの
で、常に一定の周波数のタイマクロックを供給する必要
があり、システムクロックの周波数がタイマクロックの
周波数よりも低くなることもあり、タイマクロックをシ
ステムクロックでサンプリングする手法が使えないこと
もあった。
2. Description of the Related Art Generally, a clock (timer clock) supplied to a circuit for keeping a fixed time such as an interval timer is asynchronous with a system clock supplied to a CPU or the like. Conventionally, the system clock supplied to the CPU has been used at the highest possible frequency in order to pursue high-speed operation.However, a timer clock such as an interval timer for counting a certain time requires an extremely fast clock. In general, it should not. Therefore, a method of sampling the timer clock with the system clock and using the timer clock in synchronization with the system clock has been generally used. However, with the advent of mobile devices and other devices that require low power consumption, when the system performs little processing, such as in a standby state, it is necessary to lower the system clock frequency or stop the system clock in some cases. It has become. On the other hand, since the interval timer ticks a fixed time, it is necessary to always supply a timer clock having a constant frequency, and the frequency of the system clock may be lower than the frequency of the timer clock. In some cases, sampling techniques could not be used.

【0003】そこで、システムクロックとは非同期で動
作するタイマカウンタの値を正しく読み出す手法(例え
ば、特開平6−197010号公報)や、簡単な回路で実現で
きる非同期クロックのオン・オフの制御手法が提案され
ている(例えば、特開平6−125247号公報)。
[0003] Therefore, a method of correctly reading the value of a timer counter that operates asynchronously with the system clock (for example, Japanese Patent Application Laid-Open No. 6-197010) and a method of controlling the on / off of an asynchronous clock that can be realized with a simple circuit are proposed. It has been proposed (for example, JP-A-6-125247).

【0004】また、システムクロックとタイマクロック
が非同期である場合、タイマカウンタへのデータの書き
込みには、システムクロックに同期したCPUからのデ
ータの書き込みと、タイマクロックに同期したタイマカ
ウンタデータの1減算値(タイマカウンタがアップカウ
ンタの場合は1加算値)書き込みアクセスがあるが、シ
ステムクロックに同期したCPUからの書き込みアクセ
スとタイマクロックに同期したタイマカウンタ減算値書
き込みアクセスが微小な時間間隔の範囲で重なってしま
い、タイマカウンタの値が誤った値になってしまう可能
性がある。たとえば、図12に示す回路で、1減算する
遅延時間をDmとすると、図13のタイムチャートに示
すように、CPUからタイマカウンタへ書き込んだ直後
の時間△にタイマクロックの立ち上がりエッジがある
と、Dm>△の場合、1減算器の減算時間Dmが確保で
きず、正しく1減算された値がタイマカウンタに書き込
まれない。また、システムクロック(CLK)とタイマ
クロック(TCLK)のセレクタ161を、ヒゲ状のパ
ルスが発生しないように設計するのは容易ではなく、さ
らに、クロックスキューの調整が非常に困難になってし
まう。
When the system clock and the timer clock are asynchronous, writing data to the timer counter includes writing data from the CPU in synchronization with the system clock and subtracting 1 from the timer counter data in synchronization with the timer clock. There is a write access to the value (1 added value if the timer counter is an up counter), but the write access from the CPU synchronized with the system clock and the write access from the timer counter subtracted value synchronized with the timer clock are within a minute time interval. There is a possibility that the value of the timer counter becomes an incorrect value. For example, assuming that the delay time for subtracting 1 in the circuit shown in FIG. 12 is Dm, as shown in the time chart of FIG. 13, when there is a rising edge of the timer clock at time △ immediately after writing from the CPU to the timer counter, If Dm> △, the subtraction time Dm of the one-subtractor cannot be ensured, and the value obtained by correctly subtracting one is not written into the timer counter. In addition, it is not easy to design the selector 161 for the system clock (CLK) and the timer clock (TCLK) so as not to generate a whisker-like pulse, and it is very difficult to adjust the clock skew.

【0005】これを避けるため、従来から一般的に、図
14に示すように、非同期のTCLKをCLKでサンプ
リングしてから、CLKに同期したTCLKをタイマカ
ウンタに供給する方法が用いられてきた。
In order to avoid this, conventionally, as shown in FIG. 14, a method has been used in which an asynchronous TCLK is sampled by CLK, and then TCLK synchronized with CLK is supplied to a timer counter.

【0006】[0006]

【発明が解決しようとする課題】しかしながら、特開平
6−197010号公報に記載されている手法は、その回路
(図15)のタイミングチャート(図16)により、L
ATCH_1信号でタイマカウンタの値をラッチするこ
とでタイマカウンタがN−2からN−3に遷移する際、
遷移中のタイマカウンタ値を取ってしまうことなく、正
しくタイマカウンタ値を読み込めると説明しているが、
システムクロックの立ち上がりエッジと立ち下がりエッ
ジの両エッジを使う手法であるため制御が複雑になって
いる。すなわち、図15に示したように、カウンタクロ
ック(C_CLK)(本発明のタイマクロックに相当)
を分周した信号(TGL)をシステムクロック(S_C
LK)でサンプリングしているため、正確にC_CLK
とS_CLKの関係を判定することが困難である。たと
えば、図15に示した,フリップフロップFF1のクロ
ック入力端子Dから端子Qまでの遅延、すなわちC_C
LKの分周遅延D(TGL)と、フリップフロップFF
2のセットアップ時間であるSetup(FF2)との
和が、C_CLKとS_CLKとの位相差△よりも大き
い場合、図17のタイムチャートに示す動作となり、カ
ウンタ(本発明のタイマカウンタに相当)値のラッチ信
号LATCH_1がLATCH_0と同じタイミングに
なってしまう。従って、カウンタ値の遷移中に当該カウ
ンタ値がラッチされ、正確な読み出しができない。これ
を避けるには、D(TGL)+Setup(FF2)<
△を保証する必要があり、素子特性のばらつきや配線遅
延のばらつきを厳密に解析した設計が必要となり、設計
が非常に困難になる。
However, the method described in Japanese Patent Laid-Open No. 6-197010 is based on the timing chart (FIG. 16) of the circuit (FIG. 15).
When the timer counter transitions from N-2 to N-3 by latching the value of the timer counter with the ATCH_1 signal,
It is explained that the timer counter value can be read correctly without taking the timer counter value during transition,
Since the method uses both the rising edge and the falling edge of the system clock, the control is complicated. That is, as shown in FIG. 15, the counter clock (C_CLK) (corresponding to the timer clock of the present invention)
Is divided by the system clock (S_C)
LK), so that C_CLK
It is difficult to determine the relationship between and S_CLK. For example, the delay from the clock input terminal D to the terminal Q of the flip-flop FF1 shown in FIG.
LK division delay D (TGL) and flip-flop FF
When the sum of the setup time (FF2), which is the setup time of C2, is larger than the phase difference C between C_CLK and S_CLK, the operation shown in the time chart of FIG. The latch signal LATCH_1 has the same timing as LATCH_0. Therefore, the counter value is latched during the transition of the counter value, and accurate reading cannot be performed. To avoid this, D (TGL) + Setup (FF2) <
It is necessary to guarantee Δ, and it is necessary to perform a design by strictly analyzing variations in element characteristics and variations in wiring delay, which makes the design extremely difficult.

【0007】また、特開平6−125247号公報では、図1
8に示す具体的回路が挙げられているが、図19の該回
路におけるタイミングチャートに示すように、タイマク
ロックのオン・オフを制御する信号であるTONがLに
なった後,すなわちタイマクロック(TCLK)を止め
る指令を出した後に、TCLKが1パルス供給される可
能性がある。これをインタバルタイマのクロックに用い
た場合、CPUがインタバルタイマをオフにした後で遅
れて1回タイマのカウント動作が行なわれる可能性があ
る。この現象があると、例えばユーザプログラムでイン
タバルタイマをオフにした後、しばらくしてからタイマ
カウンタが1カウント進み、タイマからの割り込み信号
などが発生してしまう可能性があり、ユーザプログラム
とハードウェアの同期がとれなくなる。
In Japanese Patent Application Laid-Open No. 6-125247, FIG.
8, a specific circuit shown in FIG. 19 is used. After the signal TON, which is a signal for controlling ON / OFF of the timer clock, becomes L, as shown in the timing chart of the circuit in FIG. After issuing a command to stop TCLK), one pulse of TCLK may be supplied. When this is used for the clock of the interval timer, there is a possibility that the timer count operation is performed once after the CPU turns off the interval timer. If this phenomenon occurs, for example, after turning off the interval timer in the user program, the timer counter may advance by one after a while and an interrupt signal from the timer may be generated. Will be out of sync.

【0008】さらに、上述の図14の回路において、シ
ステムが低速動作状態になる場合は、システムクロック
の周波数がタイマクロックの周波数よりも低くなり、シ
ステムクロックでタイマクロックをサンプリングするこ
とができなくなる問題がある。一方、タイマカウンタが
停止している場合には、タイマカウンタにタイマクロッ
クが供給されないが、その場合でもタイマカウンタへの
書き込みを行なう必要がある。タイマカウンタへの書き
込みがある場合に特別にクロックを発生させる方法もあ
るが、クロック回路が非常に複雑になり、ヒゲ状のパル
スの発生やクロックスキューを回避して回路を実現する
ことは非常に困難である。すなわち、タイマカウンタへ
の書き込みアクセスにおいて、タイマクロックの周波数
をf(TCLK)、システムクロックの周波数をf(C
LK)とすると、f(TCLK=0)、f(CLK)>
f(TCLK)およびf(CLK)<f(TCLK)の
いずれの場合にも、CPUからタイマカウンタへの書き
込みアクセスが可能であり、また、f(CLK=0)、
f(CLK)<f(TCLK)およびf(CLK)>f
(TCLK)のいずれの場合にもTCLKに同期して、
タイマカウンタへ減算値を書き込み可能なタイマカウン
タ書き込み回路を、TCLKをCLKでサンプリングす
ることなく、しかもヒゲ状のパルスの発生やクロックス
キューを回避しつつ、かつ、容易なクロック配線設計で
もって実現できることが要望される。
Further, in the circuit shown in FIG. 14, when the system enters a low-speed operation state, the frequency of the system clock becomes lower than the frequency of the timer clock, and the timer cannot be sampled by the system clock. There is. On the other hand, when the timer counter is stopped, the timer clock is not supplied to the timer counter. However, even in that case, writing to the timer counter must be performed. There is also a method of generating a clock specially when there is a write to the timer counter, but the clock circuit becomes very complicated, and it is very difficult to realize the circuit by avoiding the generation of mustache-like pulses and clock skew. Have difficulty. That is, in the write access to the timer counter, the frequency of the timer clock is f (TCLK) and the frequency of the system clock is f (CCLK).
LK), f (TCLK = 0), f (CLK)>
In both cases of f (TCLK) and f (CLK) <f (TCLK), write access from the CPU to the timer counter is possible, and f (CLK = 0),
f (CLK) <f (TCLK) and f (CLK)> f
In any case of (TCLK), in synchronization with TCLK,
A timer counter writing circuit capable of writing a subtraction value to a timer counter can be realized without sampling TCLK with CLK, avoiding generation of whisker-like pulses and clock skew, and with an easy clock wiring design. Is required.

【0009】このように、従来の技術では、システムク
ロックが遅い場合に対応できない、あるいは対応できて
も回路が非常に複雑になり、その実現に労力を要した
り、場合によっては誤動作を発生させてしまうといった
問題点があった。
As described above, the prior art cannot cope with the case where the system clock is slow, or even if it can cope with it, the circuit becomes very complicated, and it takes much effort to realize it, and in some cases, malfunctions may occur. There was a problem that it would.

【0010】本発明は、かかる問題点を解決するために
なされたもので、システムクロックと非同期のタイマク
ロックで安定してタイマカウンタの読み出し,或いは書
き込みが可能なカウンタ装置,及びそのタイマクロック
を安定して供給するクロック制御装置,並びにこれらの
装置を備えて、容易な設計で実現できるインタバルタイ
マ装置を提供することを目的とする。
SUMMARY OF THE INVENTION The present invention has been made to solve such a problem, and a counter device capable of reading or writing a timer counter stably with a timer clock asynchronous with a system clock, and stabilizing the timer clock. It is an object of the present invention to provide a clock control device to be supplied as a clock, and an interval timer device provided with these devices, which can be realized with an easy design.

【0011】[0011]

【課題を解決するための手段】上記課題を解決するため
に、本発明(請求項1)にかかる出力保持機能付きカウ
ンタ装置は、システムクロックと非同期のタイマクロッ
クをシステムクロックでサンプリングするカウンタ装置
において、上記タイマクロックを入力してカウントを行
うカウンタと、上記システムクロックに同期した第1の
タイミングで上記カウンタの値を取り込み保持する読出
一時記憶手段と、上記第1のタイミングの前後それぞれ
システムクロック半サイクルの区間で、上記カウンタに
おいて上記タイマクロックによりカウンタ値を更新した
第2のタイミングがあったか否かを判定する手段とを備
え、上記読出一時記憶手段は、上記区間で上記第2のタ
イミングがあったとき、再度上記カウンタの値を取り込
んで保持するものである。
In order to solve the above-mentioned problems, a counter device with an output holding function according to the present invention (claim 1) is a counter device which samples a timer clock asynchronous with a system clock by the system clock. A counter for counting by inputting the timer clock, read-out temporary storage means for taking in and holding the value of the counter at a first timing synchronized with the system clock, and a system clock half before and after the first timing, respectively. Means for determining whether or not there is a second timing at which the counter updates the counter value with the timer clock in the cycle section, and wherein the read temporary storage means has the second timing in the section. The value of the above counter is captured and held again when A.

【0012】また、本発明(請求項2)にかかる出力保
持機能付きカウンタ装置は、請求項1記載の出力保持機
能付きカウンタ装置において、上記読出一時記憶手段
は、上記区間で上記第2のタイミングがあったとき、上
記第1のタイミングからシステムクロック1サイクルの
後、再度上記カウンタの値を取り込んで保持するもので
ある。
In the counter device with an output holding function according to the present invention (claim 2), in the counter device with the output holding function according to claim 1, the read temporary storage means includes the second timing in the section. When there is a delay, the value of the counter is fetched and held again one cycle after the system clock from the first timing.

【0013】また、本発明(請求項3)にかかるクロッ
ク制御装置は、システムクロックに同期した制御信号を
入力して、タイマクロックの通過/不通過を制御するク
ロック制御装置において、上記タイマクロックを一定時
間遅延させる遅延手段と、上記遅延手段で遅延されたタ
イマクロックおよび上記制御信号を入力し、当該タイマ
クロックがローレベルのとき、当該制御信号をそのまま
出力し、当該タイマクロックがハイレベルのとき、当該
ハイレベルに変化したとき入力された制御信号を保持し
て出力する記憶手段と、上記タイマクロックおよび上記
記憶手段からの出力がハイレベルのとき、ハイレベルを
出力するゲート手段とを備えたものである。
The clock control device according to the present invention (claim 3) is a clock control device for controlling the passage / non-passage of a timer clock by inputting a control signal synchronized with a system clock. A delay means for delaying a fixed time, a timer clock delayed by the delay means and the control signal are input, and when the timer clock is at a low level, the control signal is output as it is, and when the timer clock is at a high level. Storage means for holding and outputting an input control signal when the signal changes to the high level, and gate means for outputting a high level when the output from the timer clock and the storage means is at a high level. Things.

【0014】また、本発明(請求項4)にかかるカウン
タ装置は、システムクロックと非同期のタイマクロック
の通過あるいは不通過によってカウント動作の開始ある
いは停止を制御するカウンタ装置であって、上記システ
ムクロックで制御された制御信号を受けて、上記タイマ
クロックの通過/不通過を制御するクロック制御手段
と、非同期プリセット端子を持つフリップフロップ素
子,及び該フリップフロップ素子に上記クロック制御手
段から上記タイマクロックが供給されないときに,上記
外部入力データを該非同期プリセット端子より入力する
ための手段を有し、上記タイマクロックが供給されてい
るときには、当該タイマクロックを該フリップフロップ
素子に入力してカウントを行うカウンタと、上記クロッ
ク制御手段が上記タイマクロックを通過にしていると
き、上記外部入力データを一時記憶して上記カウンタに
出力する書込一時記憶手段と、上記書込一時記憶手段に
書き込まれたデータが安定した後、最初のタイマカウン
タ値更新のタイミングで当該データの値を上記カウンタ
に書き込むための制御信号を発生する信号発生手段とを
備えたものである。
Further, a counter device according to the present invention (claim 4) is a counter device for controlling start or stop of a count operation by passing or non-passing of a timer clock asynchronous with a system clock. Clock control means for controlling the passage / non-passage of the timer clock in response to the controlled control signal, a flip-flop element having an asynchronous preset terminal, and the timer clock supplied to the flip-flop element from the clock control means A counter for inputting the external input data from the asynchronous preset terminal when the timer clock is supplied, and a counter for counting the timer clock by inputting the timer clock to the flip-flop element when the timer clock is supplied. The clock control means is Writing temporary storage means for temporarily storing the external input data and outputting the data to the counter when the clock is passed; and a first timer counter value after the data written in the writing temporary storage means is stabilized. Signal generating means for generating a control signal for writing the value of the data into the counter at the timing of updating.

【0015】また、本発明(請求項5)にかかるカウン
タ装置は、請求項4記載のカウンタ装置において、上記
カウンタは、上記クロック制御手段が上記タイマクロッ
クを通過にしたまま、上記信号発生手段からの信号がな
くなったとき、上記フリップフロップ素子が上記タイマ
クロックでの制御により、当該信号がなくなる前に入力
されたデータの値を1減算していくことによって、カウ
ントを行なうものとしたものである。
In the counter device according to the present invention (claim 5), in the counter device according to claim 4, the counter is controlled by the signal generation unit while the clock control unit passes the timer clock. When the signal is lost, the flip-flop element counts by subtracting 1 from the value of data input before the signal disappears, under the control of the timer clock. .

【0016】また、本発明(請求項6)にかかるカウン
タ装置は、請求項4または5記載のカウンタ装置におい
て、上記クロック制御手段は、請求項3記載のクロック
制御装置としたものである。
The counter device according to the present invention (claim 6) is the counter device according to claim 4 or 5, wherein the clock control means is the clock control device according to claim 3.

【0017】また、本発明(請求項7)にかかるインタ
バルタイマ装置は、システムクロックと非同期のタイマ
クロックで動作するカウンタ装置を有するインタバルタ
イマ装置であって、上記カウンタ装置は、請求項1記載
の出力保持機能付きカウンタ装置,及び請求項4記載の
カウンタ装置からなるものとしたものである。
Further, an interval timer device according to the present invention (claim 7) is an interval timer device having a counter device that operates with a timer clock that is asynchronous with a system clock, wherein the counter device is as defined in claim 1. A counter device having an output holding function and a counter device according to claim 4 are provided.

【0018】また、本発明(請求項8)にかかるインタ
バルタイマ装置は、請求項7記載のインタバルタイマ装
置において、上記出力保持機能付きカウンタ装置の読出
一時記憶手段,及び上記カウンタ装置の書込一時記憶手
段に代えて、読み出し記憶あるいは書き込み記憶のいず
れかに切り替えて記憶する1つの記憶手段を備えたもの
としたものである。
The interval timer device according to the present invention (claim 8) is the interval timer device according to claim 7, wherein the read temporary storage means of the counter device with the output holding function and the write temporary storage device of the counter device. Instead of the storage means, one storage means for switching to one of read storage and write storage for storage is provided.

【0019】[0019]

【発明の実施の形態】以下、本発明の実施の形態につい
て添付図面に基づき詳細に説明する。 実施の形態1.図1は、本発明の実施の形態1によるイ
ンタバルタイマ装置の構成を示すブロック図である。図
1に示すように、該インタバルタイマ装置は、タイマカ
ウンタ11,TCLK立上り判定回路12,読出一時レ
ジスタ13,タイマクロックオンオフ回路14,書込同
期回路15および書込一時レジスタ16を備えている。
すなわち、該インタバルタイマ装置は、タイマカウンタ
11,TCLK立上り判定回路12および読出一時レジ
スタ13からなる出力保持機能付きカウンタ装置と、タ
イマクロックオンオフ回路14によるクロック制御装置
と、タイマカウンタ11,タイマクロックオンオフ回路
14,書込同期回路15および書込一時レジスタ16か
らなるカウンタ装置とから構成される。
Embodiments of the present invention will be described below in detail with reference to the accompanying drawings. Embodiment 1 FIG. FIG. 1 is a block diagram showing a configuration of an interval timer device according to Embodiment 1 of the present invention. As shown in FIG. 1, the interval timer device includes a timer counter 11, a TCLK rising determination circuit 12, a read temporary register 13, a timer clock on / off circuit 14, a write synchronization circuit 15, and a write temporary register 16.
That is, the interval timer device includes a counter device having an output holding function including a timer counter 11, a TCLK rising determination circuit 12, and a read temporary register 13, a clock control device including a timer clock on / off circuit 14, a timer counter 11, and a timer clock on / off. It comprises a circuit 14, a write synchronizing circuit 15, and a counter device comprising a write temporary register 16.

【0020】以下、図1に示したインタバルタイマ装置
を構成する各装置について、実施例1〜3に分けて詳細
に説明する。なお、上記各装置は、システムクロックの
立ち上がりを基準に動作し、タイマカウンタはタイマク
ロックの立ち上がりを基準に動作し、また、タイマカウ
ンタがダウンカウンタであることを前提に説明する。
Hereinafter, each device constituting the interval timer device shown in FIG. 1 will be described in detail by dividing into first to third embodiments. The following description is based on the premise that the above devices operate based on the rising edge of the system clock, the timer counter operates based on the rising edge of the timer clock, and the timer counter is a down counter.

【0021】(実施例1)図2は実施例1による出力保
持機能付きカウンタ装置の構成を示すブロック図であ
る。図2において、TCLKはタイマクロックであり、
インタバルタイマなどの一定時刻を刻むための回路のク
ロックである。TRD_2はカウンタ読み出し事前信号
であり、CPU等の指令によりタイマカウンタデータを
CPU等に転送するタイミングより少なくとも2×T_
clk前のタイミングで発生する。ここで、T_clk
はCLKの周期とし、T_tclkはTCLKの周期と
する。また、TRD_1はTCLK立上り判定信号であ
り、TCLKの立ち上がりを示す。CLKはシステムク
ロックであり、CPU等に供給する。11はタイマカウ
ンタであり、TCLKの立ち上がりエッジでカウントダ
ウンする。12はTCLK立上り判定回路であり、TR
D_2が有効な時のCLKの立ち上がりエッジの前半サ
イクルと後半サイクルの間でTCLKが立ち上がったか
否かを判定し、TCLKが立ち上がっていればTRD_
2の次のシステムクロックサイクルでTRD_1を出
す。13は読出一時レジスタであり、TRD_2がHレ
ベル,又はTRD_1がHレベルのとき、CLKの立ち
上がりでタイマカウンタ11のデータCNT[n−1:
0]を書き込む。
Embodiment 1 FIG. 2 is a block diagram showing a configuration of a counter device with an output holding function according to Embodiment 1. In FIG. 2, TCLK is a timer clock,
This is a clock of a circuit such as an interval timer for counting a certain time. TRD_2 is a counter readout advance signal, which is at least 2 × T_
This occurs at a timing before clk. Where T_clk
Is the cycle of CLK, and T_tclk is the cycle of TCLK. Further, TRD_1 is a TCLK rising determination signal, which indicates the rising of TCLK. CLK is a system clock and is supplied to a CPU or the like. Reference numeral 11 denotes a timer counter, which counts down at the rising edge of TCLK. 12 is a TCLK rising judgment circuit, TR
It is determined whether TCLK has risen between the first half cycle and the second half cycle of the rising edge of CLK when D_2 is valid, and if TCLK has risen, TRD_
Issue TRD_1 at the next system clock cycle after 2. Reference numeral 13 denotes a read temporary register. When TRD_2 is at the H level or TRD_1 is at the H level, the data CNT [n−1:
0] is written.

【0022】図3は図2の出力保持機能付きカウンタ装
置におけるタイミングチャートを示す図である。図にお
いて、TRDは読出一時レジスタ13に取り込まれたデ
ータが、タイミングt0で外部のCPU等に読み出され
る読み出しサイクルである。
FIG. 3 is a diagram showing a timing chart in the counter device with an output holding function of FIG. In the figure, TRD is a read cycle in which data taken into the read temporary register 13 is read by an external CPU or the like at a timing t0.

【0023】次に実施例1による出力保持機能付きカウ
ンタ装置の動作の概略を図3により説明する。CLKに
同期したTRD_2のH区間のCLK立ち上がりエッジ
タイミングt0で、タイマカウンタ11のデータCNT
[n−1:0]が読出一時レジスタ13に取り込まれ
る。図3(a)のように、タイミングt0の前後半サイ
クル区間R0中にTCLKの立ち上がりエッジがある場
合は、TRD_1がHになり、次のCLK立ち上がりエ
ッジタイミングt1で、再度カウンタの値CNT[n−
1:0]が読出一時レジスタ13に取り込まれ、このデ
ータがTRDでCPU等に取り込まれる。図3(b)の
ように、区間R0中にTCLKの立ち上がりエッジがな
い場合、TRD_1はHにならず、タイミングt0で取
り込まれたデータNがTRDで外部に読み出されCPU
等に取り込まれる。
Next, the operation of the counter device with an output holding function according to the first embodiment will be schematically described with reference to FIG. At the rising edge timing t0 of the CLK in the H section of TRD_2 synchronized with the clock CLK, the data CNT of the timer counter 11 is
[N−1: 0] is taken into the read temporary register 13. As shown in FIG. 3A, when there is a rising edge of TCLK in the first half cycle section R0 of the timing t0, TRD_1 becomes H, and at the next CLK rising edge timing t1, the counter value CNT [n −
1: 0] is taken into the read temporary register 13, and this data is taken into the CPU or the like by TRD. As shown in FIG. 3B, when there is no rising edge of TCLK in the section R0, TRD_1 does not become H, and the data N taken in at the time t0 is read out to the outside by TRD and the CPU reads out.
Etc.

【0024】図4は図2の出力保持機能付きカウンタ装
置の回路の一例を示す回路図である。図4において、図
2と同一符号は同一または相当部分である。また、3
1,32,34および38はプリップフロップであり、
31および32はCLKの立ち下がりで、34および3
8はCLKの立ち上がりで、それぞれ入力データDを取
り込み、34は入力データ(TRD_2)をT_clk
遅らせて出力する。33,35,36および37は論理
ゲートである。論理ゲート33を信号が通過すること
で、CLKの立ち上がりの前後半サイクルの間にTCL
Kの立ち上がりがあったかどうかを判定し、論理ゲート
35は論理ゲート33を通過した信号と、TRD_2を
T_clk遅らせた信号とでアンド論理をとることによ
り、読出一時レジスタ13にTRD_1を与え、書き込
み許可を指示する。
FIG. 4 is a circuit diagram showing an example of a circuit of the counter device with an output holding function shown in FIG. 4, the same reference numerals as those in FIG. 2 denote the same or corresponding parts. Also, 3
1, 32, 34 and 38 are flip-flops,
31 and 32 are the falling edges of CLK, and 34 and 3
Reference numeral 8 denotes a rising edge of CLK, each of which takes in input data D, and 34 denotes input data (TRD_2) of T_clk.
Output with a delay. 33, 35, 36 and 37 are logic gates. By passing the signal through the logic gate 33, the TCL during the first and second half cycles of the rising edge of CLK is set.
The logic gate 35 determines whether or not there has been a rise of K, and the logic gate 35 performs an AND logic operation on the signal passed through the logic gate 33 and the signal obtained by delaying TRD_2 by T_clk, thereby giving TRD_1 to the read temporary register 13 and permitting write permission. To instruct.

【0025】次に実施例1による出力保持機能付きカウ
ンタ装置の動作を図3および図4により説明する。ま
ず、フリップフロップ31および32で、CLKの立ち
下がりによってTCLKをサンプリングし、論理ゲート
33を通過することで、CLKの立ち上がりの前後半サ
イクルの間にTCLKの立ち上がりがあったかどうかを
判定する。すなわち、図3(a)の場合であれば、タイ
ミングt0の前半サイクルでのCLKの立ち下がりによ
って、フリップフロップ31はTCLK(L)をサンプ
リングして、Lレベルの信号が出力される。タイミング
t0の後半サイクルでのCLKの立ち下がりによって、
該出力(L)をフリップフロップ32はサンプリングし
て出力するとともに、フリップフロップ31はTCLK
(H)をサンプリングして出力する。論理ゲート33で
は、フリップフロップ31の出力(H)と、フリップフ
ロップ32の出力(L)の負論理とでアンド論理をとっ
てHレベルとなることにより、CLKの立ち上がり(t
0)の前後半サイクルの間にTCLKの立ち上がりがあ
ったことを判定する。一方、図3(b)の場合であれ
ば、タイミングt0の後半サイクルでのCLKの立ち下
がりによって、論理ゲート33では、フリップフロップ
31の出力(L)と、フリップフロップ32の出力
(H)の負論理とでアンド論理をとってLレベルとなる
ので、TCLKの立ち上がりがなかったことを判定す
る。
Next, the operation of the counter device with an output holding function according to the first embodiment will be described with reference to FIGS. First, the flip-flops 31 and 32 sample TCLK at the falling edge of CLK and pass through the logic gate 33 to determine whether or not TCLK has risen during the first and second half cycles of CLK rising. That is, in the case of FIG. 3A, the flip-flop 31 samples TCLK (L) and outputs an L-level signal at the fall of CLK in the first half cycle of the timing t0. By the falling edge of CLK in the second half cycle of the timing t0,
The flip-flop 32 samples and outputs the output (L), and the flip-flop 31 outputs
(H) is sampled and output. In the logic gate 33, the output (H) of the flip-flop 31 and the negative logic of the output (L) of the flip-flop 32 are ANDed to be at the H level, so that the rising edge of CLK (t
It is determined that TCLK has risen during the first and second half cycles of 0). On the other hand, in the case of FIG. 3B, the output of the flip-flop 31 (L) and the output (H) of the flip-flop 32 are output from the logic gate 33 by the fall of CLK in the second half cycle of the timing t0. Since the logic becomes L level by taking AND logic with negative logic, it is determined that TCLK has not risen.

【0026】また、論理ゲート35では、図3(a)の
場合に論理ゲート33を通過した信号(H)と、フリッ
プフロップ34でTRD_2をT_clk遅らせた信号
とアンド論理をとることで、読出一時レジスタ13の書
き込み許可信号TRD_1を与える。すなわち、フリッ
プフロップ34はt0の前半サイクルでのCLKの立ち
下がりによってTRD_2を取り込み、T_clk遅ら
せてt0の後半サイクルでのCLKの立ち下がりによっ
て出力し、該TRD_2の(H)と論理ゲート33を通
過した信号(H)とでアンド論理をとってHレベルとな
り、読出一時レジスタ13にTRD_1を与える。図3
(b)の場合には、論理ゲート33を通過した信号
(L)と、フリップフロップ34でTRD_2をT_c
lk遅らせた信号(H)とで、論理ゲート35はアンド
論理をとる。該アンド論理はLレベル,すなわち書き込
み許可信号TRD_1を与えないことになる。
In the logic gate 35, the signal (H) passed through the logic gate 33 in the case of FIG. 3A and the signal obtained by delaying TRD_2 by T_clk by the flip-flop 34 are AND-operated, so that readout is temporarily performed. A write enable signal TRD_1 for the register 13 is given. That is, the flip-flop 34 takes in TRD_2 at the fall of CLK in the first half cycle of t0, delays by T_clk and outputs it at the fall of CLK in the second half cycle of t0, and passes through (H) of the TRD_2 and the logic gate 33. With the signal (H), the AND logic is taken and the level becomes H level, and TRD_1 is supplied to the read temporary register 13. FIG.
In the case of (b), the signal (L) passed through the logic gate 33 and the flip-flop 34 convert TRD_2 to T_c.
The logic gate 35 takes an AND logic with the signal (H) delayed by lk. The AND logic does not supply the L level, that is, the write enable signal TRD_1.

【0027】そして、読出一時レジスタ13では、TR
D_2およびTRD_1のいずれかがHになったときに
タイマカウンタ11の値を取り込む。すなわち、図3
(a)の場合、t0でTRD_2がH,TRD_1がL
より、論理ゲート36からのHレベルと、CLKのHレ
ベルの負論理(L)とから、論理ゲート37はアンド論
理をとったLレベルの負論理(H)によって、タイマカ
ウンタ11の値を読出一時レジスタ13に取り込む。こ
こで、TRD_2がHレベルになったときのCLK立ち
上がりエッジタイミング(t0)の前半サイクルと後半
サイクルの間にTCLKの立ち上がりがあるので、再度
次のCLKの立ち上がり(t1)でTCLK立上り判定
回路12からのTRD_1がHとなり、TRD_2はL
より、論理ゲート36からのHと、CLKのHの負論理
(L)とから、論理ゲート37でアンド論理をとったL
の負論理(H)によって、再びタイマカウンタ11の値
を取り込む。一方、図3(b)の場合、t0では(a)
の場合と同様、TRD_2がH,TRD_1がLより、
論理ゲート36からのHと、CLKのHの負論理(L
レ)とから、論理ゲート37はアンド論理をとったLの
負論理(H)によって、タイマカウンタ11の値を読出
一時レジスタ13に取り込む。ただし、(a)とは異な
り、TRD_2がHになったときのCLK立ち上がりエ
ッジタイミング(t0)の前半サイクルと後半サイクル
の間にTCLKの立ち上がりがないので、t1でTCL
K立上り判定回路12からのTRD_1がLのままで、
TRD_2もLより、論理ゲート36からのLと、CL
KのHの負論理(L)とから、論理ゲート37でアンド
論理をとったLの負論理によってHレベルのままであ
り、再度タイマカウンタ11の値を取り込むことはな
い。
In the read temporary register 13, TR
When one of D_2 and TRD_1 becomes H, the value of the timer counter 11 is fetched. That is, FIG.
In the case of (a), at t0, TRD_2 is H and TRD_1 is L
From the H level from the logic gate 36 and the negative logic (L) of the H level of CLK, the logic gate 37 reads the value of the timer counter 11 by the L level negative logic (H) of the AND logic. It is taken into the temporary register 13. Here, since the TCLK rises between the first half cycle and the second half cycle of the CLK rising edge timing (t0) when TRD_2 goes to the H level, the TCLK rising determination circuit 12 again at the next rising edge of the CLK (t1). TRD_1 becomes H, and TRD_2 becomes L
From the H from the logic gate 36 and the negative logic (L) of H of CLK, the logic gate 37 performs AND logic on L.
The value of the timer counter 11 is fetched again by negative logic (H). On the other hand, in the case of FIG.
As in the case of, TRD_2 is higher than H and TRD_1 is lower than L,
H from the logic gate 36 and the negative logic (L
), The logic gate 37 takes in the value of the timer counter 11 into the read-out temporary register 13 by negative logic (H) of L, which is an AND logic. However, unlike (a), there is no rise of TCLK between the first half cycle and the second half cycle of the CLK rising edge timing (t0) when TRD_2 goes to H, so that TCL at t1
While TRD_1 from the K rise determination circuit 12 remains L,
TRD_2 is also lower than L, and L from logic gate 36 and CL
From the negative logic (L) of K to the negative logic (L) of which the AND logic is obtained by the logic gate 37, the logic gate 37 remains at the H level, and the value of the timer counter 11 is not taken in again.

【0028】このように、実施例1による出力保持機能
付カウンタ装置では、CLKと非同期のTCLKで動作
するタイマカウンタの値を、TRD_2が有効な時のC
LKの立ち上がりで読出一時レジスタに取り込み、この
タイミングの前後CLKの半サイクルの間でカウント動
作の有無を判定し、有りと判定した場合には、上記タイ
ミングからCLK1サイクル後に、再度上記の値を読出
一時レジスタに取り込む構成としたから、TCLKを直
接CLKでサンプリングするものとして、制御が複雑に
なったり、素子特性のばらつきや配線遅延のばらつきを
厳密に解析した設計が必要となり、設計が非常に困難に
なる等の問題を回避することができる。また、CLKと
TCLKの干渉による悪影響を受けることなく、安定に
カウンタの値を読み出すことができる。
As described above, in the counter device with the output holding function according to the first embodiment, the value of the timer counter that operates on TCLK asynchronous with CLK is set to C when TRD_2 is valid.
At the rising edge of LK, the value is read into the read temporary register, and the presence or absence of a count operation is determined during a half cycle of CLK before and after this timing. When it is determined that the count operation is performed, the above value is read again after one cycle of CLK from the above timing. Since it is configured to take in the temporary register, TCLK is sampled directly with CLK, so that control becomes complicated, and a design that strictly analyzes variations in element characteristics and variations in wiring delays is required, which is very difficult to design. Can be avoided. Further, the value of the counter can be read stably without being adversely affected by interference between CLK and TCLK.

【0029】(実施例2)図5は実施例2によるクロッ
ク制御装置の回路の一例を示す回路図である。上述のよ
うに、該クロック制御装置は、図1のタイマクロックオ
ンオフ回路14に相当する。図5において、図2と同一
の略語で示した信号は同一の信号である。また、TCL
KOは外部から供給されて制御された後TCLKとされ
る原振のTCLKである。TONはCPU等からの指令
によりTCLKOを制御することによってTCLKのオ
ン・オフを行なうためのCLKに同期したタイマクロッ
クのオンオフ信号である。41はレベルセンシティブラ
ッチであり、入力GがLレベルのときの入力Dがそのま
ま出力Qに現れ、入力GがHレベルのときには出力Qを
保持する。42は遅延バッファであり、TCLKOをレ
ベルセンシティブラッチ41の入力Gに供給する。43
は論理ゲートであり、出力QおよびTCLKOのアンド
論理による信号をTCLKとして、例えば図1に示した
インタバルタイマ装置のタイマカウンタ等に供給する。
(Embodiment 2) FIG. 5 is a circuit diagram showing an example of a circuit of a clock control device according to Embodiment 2. As described above, the clock control device corresponds to the timer clock on / off circuit 14 in FIG. In FIG. 5, signals indicated by the same abbreviations as those in FIG. 2 are the same signals. Also, TCL
KO is the original TCLK which is supplied from the outside and controlled to be TCLK after being controlled. TON is an on / off signal of a timer clock synchronized with CLK for turning on / off TCLK by controlling TCLKO according to a command from a CPU or the like. Reference numeral 41 denotes a level-sensitive latch. The input D when the input G is at the L level appears on the output Q as it is, and holds the output Q when the input G is at the H level. A delay buffer 42 supplies TCLKO to the input G of the level-sensitive latch 41. 43
Is a logic gate, which supplies a signal based on AND logic of the output Q and TCLKO as TCLK to, for example, a timer counter of the interval timer device shown in FIG.

【0030】図6は図5のクロック制御装置におけるタ
イミングチャートを示す図である。図6において、図5
と同一の略語で示した信号は同一の信号である。次に実
施例2によるクロック制御装置の動作を図4および図5
により説明する。
FIG. 6 is a diagram showing a timing chart in the clock control device of FIG. In FIG. 6, FIG.
The signals indicated by the same abbreviations are the same signals. Next, the operation of the clock control device according to the second embodiment will be described with reference to FIGS.
This will be described below.

【0031】まず、図6(a)の場合、TCLKOがL
レベルのときにTONの立ち上がりによって、タイマク
ロックのオン信号がレベルセンシティブラッチ41の入
力Dに入力される。このとき、レベルセンシティブラッ
チ41の入力Gには、遅延バッファ42を通ったTCL
KOのLが入力されるので、入力Dがそのまま出力Qに
現れて、出力QはHレベルのままである。そして、TC
LKOがHレベル、すなわち入力GがHレベルになって
も、出力QのHレベルは保持されてTCLKOのHとの
アンド論理により論理ゲート43からTCLKが出力さ
れる。また、TCLKOがLレベルのときにTONの立
ち下がりによって、タイマクロックのオフ信号が入力D
に入力され、入力Gには遅延バッファ42を通ったTC
LKOのLが入力されて入力Dがそのまま出力Qに現
れ、出力QはLレベルとなる。そして、TONおよびQ
がLレベルのまま、TCLKOがHレベル、すなわち入
力GもHレベルになると、出力QのLレベルは保持され
てTCLKOのHレベルとアンド論理がとれず、論理ゲ
ート43からはTCLKが出力されない。
First, in the case of FIG.
When the signal is at the level, the ON signal of the timer clock is input to the input D of the level sensitive latch 41 by the rise of TON. At this time, the input G of the level sensitive latch 41 is connected to the TCL passing through the delay buffer 42.
Since L of KO is input, the input D directly appears at the output Q, and the output Q remains at the H level. And TC
Even if LKO becomes H level, that is, the input G becomes H level, the H level of the output Q is maintained and TCLK is output from the logic gate 43 by AND logic with H of TCLKO. When TCLKO is at the L level, the falling edge of TON causes the timer clock off signal to be input to the input D.
, And the input G has a TC
When L of LKO is input, input D directly appears at output Q, and output Q is at L level. And TON and Q
When the level of TCLKO becomes H level, that is, the level of the input G also becomes H level, while the level of the input G also becomes H level, the L level of the output Q is maintained, the AND level cannot be obtained with the H level of TCLKO, and the logic gate 43 does not output TCLK.

【0032】次に、図6(b)の場合、TCLKOがH
レベルのときにTONの立ち上がりによって、タイマク
ロックのオン信号がレベルセンシティブラッチ41の入
力DにHが入力される。このとき、レベルセンシティブ
ラッチ41の入力Gには、遅延バッファ42を通ったT
CLKOのHレベルが入力されているので、出力Qは入
力DがLレベルの状態を保持し、出力QはLレベルのま
まである。この状態で、TCLKOがLレベル、すなわ
ち入力GがLレベルになると、出力Qには入力DのHレ
ベルがそのまま現れる。このときは、まだ出力QのHレ
ベルとTCLKOのLレベルとでアンド論理がとれない
ので、TCLKは出力されない。そして、次にTCLK
OがHレベルになったとき、入力GがHレベルとなり、
出力QのHレベルとTCLKOのHレベルとでアンド論
理をとって、論理ゲート43からTCLKが出力され
る。また、TCLKOがHレベルのときにTONの立ち
下がりによって、タイマクロックのオフ信号が入力Dに
入力されると、入力GはHレベルより、出力Qは入力D
がHレベルの状態を保持する。したがって、TCLKO
のHレベルおよび出力QのHレベルより、論理ゲート4
3からTCLKは出力され続ける。そして、TCLKO
がLレベル、すなわち入力GがLレベルになると、出力
Qには入力DのLレベルがそのまま現れて、TCLKO
のLレベルとで、論理ゲート43からはTCLKが出力
されなくなる。図6のタイミングチャートに示すとお
り、TCLKにヒゲ状のパルスが出ることはない。
Next, in the case of FIG. 6B, TCLKO becomes H
When the signal is at the level, the ON of the timer clock is input to the input D of the level-sensitive latch 41 by the rise of TON. At this time, the input G of the level-sensitive latch 41 is connected to the T
Since the H level of CLKO is input, the output Q maintains the state where the input D is at the L level, and the output Q remains at the L level. In this state, when TCLKO becomes L level, that is, when the input G becomes L level, the H level of the input D appears on the output Q as it is. At this time, the AND logic cannot be obtained between the H level of the output Q and the L level of the TCLKO, so that TCLK is not output. And then TCLK
When O becomes H level, input G becomes H level,
The logic gate 43 outputs TCLK by taking AND logic between the H level of the output Q and the H level of TCLKO. Further, when the timer clock OFF signal is input to the input D due to the fall of TON when TCLKO is at the H level, the input G is at the H level and the output Q is at the input D level.
Hold the H level state. Therefore, TCLKO
Logic gate 4 from the H level of output Q and the H level of output Q.
3 continues to output TCLK. And TCLKO
Is at the L level, that is, when the input G is at the L level, the L level of the input D appears at the output Q as it is, and TCLKO
, The TCLK is no longer output from the logic gate 43. As shown in the timing chart of FIG. 6, no whisker-like pulse appears on TCLK.

【0033】なお、図6において、TCLKOがLレベ
ルのときTONが立ち上がり、TCLKOがLレベルの
ときTONが立ち下がる場合(場合(a)),及びTC
LKOがHレベルのときTONが立ち上がり、TCLK
OがHレベルのときTONが立ち下がる場合(場合
(b))に分けて説明したが、TCLKOがLレベルの
ときTONが立ち上がり、TCLKOがHレベルのとき
TONが立ち下がる場合や、その逆の場合もあり、上記
場合(a)および(b)と同様に説明される。
In FIG. 6, TON rises when TCLKO is at L level, TON falls when TCLKO is at L level (case (a)), and TC
When LKO is at H level, TON rises and TCLK
The case where TON falls when O is at the H level (case (b)) has been described separately. However, TON rises when TCLKO is at the L level, and TON falls when TCLKO is at the H level, and vice versa. In some cases, description will be made in the same manner as in the above cases (a) and (b).

【0034】このように、実施例2によるクロック制御
装置では、TCLKOの入力がLレベルのときTONの
入力がそのまま出力され、TCLKOの入力がHレベル
のときには出力を保持するレベルセンシティブラッチ
と、TCLKOをレベルセンシティブラッチに供給する
遅延バッファと、TCLKOとレベルセンシティブラッ
チの出力とのアンド論理による信号をTCLKとする論
理ゲートとを備えた構成としたから、非常に容易に構成
でき、CLKに同期した制御信号でTCLKを切り替え
る際に、単にTCLKのパルス幅を保証するだけではな
く、TON信号がLレベルになった後にTCLKが1パ
ルス供給されるという不都合を回避することができる。
このクロック制御装置をインタバルタイマ装置に用いれ
ば、ユーザプログラムでインタバルタイマをオフにした
後、しばらくしてからタイマカウンタが1カウント進ん
で割り込み信号などが発生することがなく、インタバル
タイマをオフにすれば、必ずタイマクロックがオフにな
り、ユーザプログラムとハードウェアの同期をとること
ができる。
As described above, in the clock control device according to the second embodiment, when the input of TCLKO is at the L level, the input of TON is output as it is, and when the input of TCLKO is at the H level, the level-sensitive latch for holding the output and the TCLKO Is provided to the level-sensitive latch, and a logic gate that sets the signal based on the AND logic between TCLKO and the output of the level-sensitive latch to TCLK is provided. When switching the TCLK by the control signal, it is possible not only to guarantee the pulse width of the TCLK, but also to avoid the disadvantage that one pulse of the TCLK is supplied after the TON signal becomes L level.
If this clock control device is used as an interval timer device, after the interval timer is turned off by a user program, the timer counter advances one count later and no interrupt signal is generated, so that the interval timer can be turned off. In this case, the timer clock is always turned off, and the user program and the hardware can be synchronized.

【0035】(実施例3)図7は実施例3による,カウ
ント動作の開始あるいは停止を制御するカウンタ装置の
回路の一例を示す回路図である。図7において、図4,
図5および図6と同一符号は同一または相当部分であ
り、同一の略語で示した信号は同一の信号である。ま
た、TWTは書き込み信号であり、CLKに同期してい
る。TWT_TCLKは書き込みアクセス信号であり、
TCLKに同期し、書込一時レジスタの値WDT_TC
LK[n−1:0]をタイマカウンタ11に取り込むた
めの制御信号である。15は書込同期回路であり、TO
NがHのときにTWT_TCLKを発生する回路であ
る。16は書込一時レジスタであり、TONがHのとき
TWTを受けてCPU等から出力されるタイマカウンタ
への書き込みデータWDT[n−1:0]を取り込む。
63は書込回路であり、TCLKが供給されないとき、
当該書込回路を通してWDT[n−1:0]をタイマカ
ウンタ11に書き込む。その具体回路例については後述
する。64はフリップフロップであり、非同期セット/
リセット端子を有してダウンカウンタを構成する。65
はセレクタであり、TWT_TCLKの有無によってW
DT_TCLK[n−1:0]あるいはCNT[n−
1:0]を1減算した値をセレクトする。ここで、本実
施例3に示したタイマカウンタ11は、実施例1に示し
たようにTCLKの立ち上がりエッジでカウントダウン
だけでなく、非同期セット/リセット端子を有してダウ
ンカウンタを構成するフリップフロップ64および書込
回路63で構成され、TCLKが供給されていないとき
でもデータを設定するものである。
(Embodiment 3) FIG. 7 is a circuit diagram showing an example of a circuit of a counter device for controlling start or stop of a count operation according to Embodiment 3. In FIG. 7, FIG.
5 and FIG. 6 are the same or corresponding parts, and the signals indicated by the same abbreviations are the same signals. TWT is a write signal and is synchronized with CLK. TWT_TCLK is a write access signal,
In synchronization with TCLK, the value of the write temporary register WDT_TC
LK [n−1: 0] is a control signal for taking in the timer counter 11. 15 is a write synchronization circuit, and TO
This circuit generates TWT_TCLK when N is H. Reference numeral 16 denotes a write temporary register, which receives TWT when TON is H, and takes in write data WDT [n-1: 0] to the timer counter output from the CPU or the like.
63 is a write circuit, and when TCLK is not supplied,
WDT [n-1: 0] is written to the timer counter 11 through the write circuit. The specific circuit example will be described later. Reference numeral 64 denotes a flip-flop, which is an asynchronous set /
A down counter is provided with a reset terminal. 65
Is a selector, and W depends on the presence or absence of TWT_TCLK.
DT_TCLK [n-1: 0] or CNT [n-
1: 0] is subtracted by 1. Here, the timer counter 11 shown in the third embodiment not only counts down at the rising edge of TCLK as in the first embodiment but also has a flip-flop 64 having an asynchronous set / reset terminal to constitute a down counter. And a write circuit 63 for setting data even when TCLK is not supplied.

【0036】図8は図7のカウンタ装置におけるタイミ
ングチャートを示す図である。次に実施例3によるカウ
ンタ装置の動作を説明する。まず、図8(a)のTON
=Hのとき、すなわちTCLKが供給されているとき、
書込一時レジスタ16は、CLKに同期したTWT=H
を受けてCPU等から出力されるデータWDT[n−
1:0]を取り込む。このとき、書込同期回路15は、
次のTCLKの立ち上がりからTCLKの1サイクルの
期間、TWT_TCLK=Hを出力する。ここで、タイ
マカウンタ11では、TCLKが供給されているので、
フリップフロップ64のクロック入力端子にはTCLK
が常に供給されている。したがって、TWT_TCLK
=Hのとき、すなわちCPUからの書き込みアクセス信
号があるときには、セレクタ65でTCLKに同期して
WDT_TCLK[n−1:0]がセレクトされ、TC
LKに同期して次のTCLKの立ち上がりでCPUから
の書き込みデータがフリップフロップ64に書き込まれ
る。これによりCLKに同期したタイミングで書込一時
レジスタ16にデータが書き込まれ、その値が十分安定
になった後、TCLKに同期したタイミングで安定にタ
イマカウンタへの書き込みが可能である。なお、この場
合、図8(a)に示すように、TCLKの周波数f(T
CLK)>CLKの周波数f(CLK)の場合を説明し
たが、f(TCLK)<f(CLK)の場合について
も、同様にして説明されるものである。次に、TWT_
TCLKがLのとき、すなわちCPUからの書き込みア
クセス信号がないときには、セレクタ65でタイマカウ
ンタ値CNT[n−1:0]を1減算した値をセレクト
し、TCLKに同期してフリップフロップ64に書き込
みが行なわれ、カウントダウン動作が行なわれる(f
(CLK)=0)。
FIG. 8 is a diagram showing a timing chart in the counter device of FIG. Next, the operation of the counter device according to the third embodiment will be described. First, the TON shown in FIG.
= H, that is, when TCLK is supplied,
The write temporary register 16 stores TWT = H synchronized with CLK.
Receiving data WDT [n-
1: 0]. At this time, the write synchronization circuit 15
TWT_TCLK = H is output for one cycle of TCLK from the next rise of TCLK. Here, since TCLK is supplied to the timer counter 11,
The clock input terminal of the flip-flop 64 has TCLK
Is always supplied. Therefore, TWT_TCLK
= H, that is, when there is a write access signal from the CPU, WDT_TCLK [n-1: 0] is selected by the selector 65 in synchronization with TCLK, and TC
Write data from the CPU is written to the flip-flop 64 at the next rise of TCLK in synchronization with LK. As a result, data is written to the write temporary register 16 at a timing synchronized with CLK, and after its value is sufficiently stabilized, writing to the timer counter can be stably performed at a timing synchronized with TCLK. In this case, as shown in FIG. 8A, the frequency f (T
Although the case where the frequency f (CLK) of CLK)> CLK has been described, the same applies to the case where f (TCLK) <f (CLK). Next, TWT_
When TCLK is L, that is, when there is no write access signal from the CPU, the selector 65 selects a value obtained by subtracting 1 from the timer counter value CNT [n−1: 0], and writes the value to the flip-flop 64 in synchronization with TCLK. Is performed, and a countdown operation is performed (f
(CLK) = 0).

【0037】一方、図8(b)のTONがLレベルでT
CLKが供給されていないとき(f(TCLK)=
0)、フリップフロップ64にはクロックが供給されて
いないので、CPUからの書込データWDT[n−1:
0]をタイマカウンタ11に書き込むには、書込回路6
3を通してフリップフロップ64のセット端子Sおよび
リセット端子Rからデータを供給する。ここで、書込回
路63の具体回路例を図9に示し、図9を参照してTO
N=Lの場合について説明する。TON=Lで、TWT
=Hのときにゲート81の出力がHとなる。すなわち、
タイマOFFの状態でCPUからの書き込み信号が出力
されると、ゲート81の出力がHとなる。そして、ゲー
ト81の出力がHの場合、CPUからの書き込みデータ
の第kビットWDT[k]がHのときに、CLKがLの
区間でゲート83の出力がLとなり、図7におけるタイ
マカウンタ11を構成するフリップフロップ64のセッ
ト端子Sに供給され、タイマカウンタ11の第kビット
の値が1にセットされる。また、ゲート81の出力がH
の場合に、CPUからの書き込みデータの第kビットW
DT[k]がLのとき、CLKがLの区間でゲート82
の出力がLとなり、図7におけるタイマカウンタ11を
構成するフリップフロップ64のリセット端子Rに供給
され、タイマカウンタ11の第kビットの値が0にセッ
トされる。
On the other hand, when TON in FIG.
CLK is not supplied (f (TCLK) =
0), since no clock is supplied to the flip-flop 64, the write data WDT [n-1:
0] to the timer counter 11, the writing circuit 6
3, data is supplied from the set terminal S and the reset terminal R of the flip-flop 64. Here, a specific circuit example of the write circuit 63 is shown in FIG.
The case where N = L will be described. TON = L, TWT
= H, the output of the gate 81 becomes H. That is,
When a write signal is output from the CPU with the timer turned off, the output of the gate 81 becomes H. When the output of the gate 81 is H, and when the k-th bit WDT [k] of the write data from the CPU is H, the output of the gate 83 becomes L in the section where CLK is L, and the timer counter 11 shown in FIG. Is supplied to the set terminal S of the flip-flop 64, and the value of the k-th bit of the timer counter 11 is set to 1. When the output of the gate 81 is H
, The k-th bit W of the write data from the CPU
When DT [k] is L, gate 82
Is supplied to the reset terminal R of the flip-flop 64 constituting the timer counter 11 in FIG. 7, and the value of the k-th bit of the timer counter 11 is set to 0.

【0038】このように、本発明の実施例3によるカウ
ンタ装置では、タイマカウンタ動作のオン・オフをTC
LKのオン・オフで制御し、かつ、タイマカウンタがオ
フのときにはタイマカウンタを構成するフリップフロッ
プ素子の非同期プリセット端子から外部入力データを設
定し、タイマカウンタがオンのときには書込一時レジス
タに外部入力データを書き込み、書き込まれたデータが
安定してから最初のタイマカウンタ値更新のタイミング
で書込一時レジスタの値をカウンタに書き込む制御信号
を発生するものとし、さらに、タイマカウンタがオンの
まま制御信号が発生しなくなったときには、すでにフリ
ップフロップ素子に書き込まれたデータを1減算してカ
ウントする構成としたから、f(TCLK)=0、f
(TCLK)<f(CLK)、f(TCLK)>f(C
LK)のいずれの場合にも、CPUからタイマカウンタ
へデータを正しく書き込むことが可能であり、f(CL
K)=0、f(CLK)>f(TCLK)、f(CL
K)<f(TCLK)のいずれの場合にも、タイマカウ
ンタへ1減算値を書き込むことが可能となる。すなわ
ち、TCLKのオン・オフにかかわらないだけでなく、
CLKの供給がないときでも、タイマカウンタ動作のオ
ン・オフを通じて安定なデータをタイマカウンタに書き
込むことができる。また、クロック配線はTCLKとC
LKが明確に分離されているので、クロック配線設計が
容易である。さらに、クロック回路にゲートが付加され
るのはタイマクロックオンオフ回路のみであり、実施例
2で説明したように非常に簡単な構成で実現できる,タ
イマクロックオンオフ回路を備えることによって、タイ
マ動作のオン・オフを通じて安定なデータをタイマカウ
ンタに書き込むことができる回路を、クロックスキュー
が発生したりクロックにヒゲ状のパルスを生じることな
く容易に実現できる。
As described above, in the counter device according to the third embodiment of the present invention, ON / OFF of the timer counter operation is determined by TC
When the timer counter is off, external input data is set from the asynchronous preset terminal of the flip-flop element constituting the timer counter. When the timer counter is on, the external input data is set in the write temporary register. A control signal for writing the data and writing the value of the write temporary register to the counter at the timing of the first timer counter value update after the written data is stabilized, and furthermore, the control signal while the timer counter is on. Is no longer generated, the data already written in the flip-flop element is decremented by one and counted, so that f (TCLK) = 0, f (TCLK)
(TCLK) <f (CLK), f (TCLK)> f (C
LK), data can be correctly written from the CPU to the timer counter, and f (CL
K) = 0, f (CLK)> f (TCLK), f (CL
K) <f (TCLK), it is possible to write a 1-subtracted value to the timer counter. That is, not only does TCLK turn on or off,
Even when CLK is not supplied, stable data can be written to the timer counter through ON / OFF of the timer counter operation. The clock wiring is TCLK and C
Since the LKs are clearly separated, the clock wiring design is easy. Furthermore, only the timer clock on / off circuit is added to the gate of the clock circuit. By providing the timer clock on / off circuit, which can be realized with a very simple configuration as described in the second embodiment, the timer operation is turned on. A circuit that can write stable data to the timer counter through the OFF state can be easily realized without generating clock skew or generating a whisker-like pulse in the clock.

【0039】次に、上記実施例1〜3による各装置によ
り構成される,実施の形態1によるインタバルタイマ装
置(図1)の全体の動作を説明する。まず、CPUから
のタイマオンオフ信号TONに基づき、外部から供給さ
れるTCLKOがタイマクロックオンオフ回路14でオ
ンオフ制御された後、TCLKとしてインタバルタイマ
装置内各部に供給される。該TCLKが供給されるTC
LK立上り判定回路12では、カウンタ読み出し事前信
号TRD_2が有効なときのCLKの立ち上がりエッジ
の前半サイクルと後半サイクルの間でTCLKが立ち上
がったか否かを判定し、TCLKが立ち上がっていれば
TRD_2の次のシステムクロックサイクルでTCLK
立ち上がり判定信号TRD_1を出す。そして、読出一
時レジスタ13は、TRD_2がHまたはTRD_1が
Hのとき、CLKの立ち上がりでタイマカウンタ11の
データCNT[n−1:0]を書き込み、CLKに同期
したタイマカウンタ値読み出しデータRDT[n−1:
0]としてCPUにデータを転送する。また、書込一時
レジスタ16には、TON=HおよびTWT=Hのと
き、すなわちインタバルタイマがオン状態でCPUから
の書き込みアクセスがあるとき、CLKに同期したタイ
ミングでCPUからタイマカウンタへの書き込みデータ
WDT[n−1:0]が書き込まれる。このとき、書込
同期回路15では、TCLKの1サイクルの期間TWT
_TCLK=Hを出力する。そして、TON=Hおよび
TWT_TCLK=Hのとき、タイマカウンタ151に
はTCLKに同期してWDT_TCLK[n−1:0]
が書き込まれる。一方、TON=LおよびTWT=Hの
とき、すなわちインタバルタイマがオフ状態でCPUか
らの書き込みアクセスがあると、タイマカウンタ11内
の書込回路により直接CLKに同期したWDT[n−
1:0]の書き込みが行なわれる。
Next, the overall operation of the interval timer device (FIG. 1) according to the first embodiment constituted by the devices according to the first to third embodiments will be described. First, based on a timer on / off signal TON from the CPU, TCLKO supplied from the outside is controlled on / off by a timer clock on / off circuit 14, and then supplied as TCLK to each section in the interval timer device. TC to which the TCLK is supplied
The LK rising determination circuit 12 determines whether or not TCLK has risen between the first half cycle and the second half cycle of the rising edge of CLK when the counter read advance signal TRD_2 is valid. TCLK in system clock cycle
A rise determination signal TRD_1 is issued. When TRD_2 is H or TRD_1 is H, the read temporary register 13 writes the data CNT [n-1: 0] of the timer counter 11 at the rising edge of CLK, and reads the timer counter value read data RDT [n -1:
0] to transfer the data to the CPU. When TON = H and TWT = H, that is, when the interval timer is on and there is a write access from the CPU, the write temporary register 16 stores the write data from the CPU to the timer counter at a timing synchronized with CLK. WDT [n-1: 0] is written. At this time, in the write synchronization circuit 15, the period TWT of one cycle of TCLK
_TCLK = H is output. When TON = H and TWT_TCLK = H, the timer counter 151 has WDT_TCLK [n−1: 0] in synchronization with TCLK.
Is written. On the other hand, when TON = L and TWT = H, that is, when the interval timer is off and there is a write access from the CPU, the write circuit in the timer counter 11 directly writes WDT [n−
1: 0].

【0040】このように、本発明の実施の形態1による
インタバルタイマ装置では、実施例1〜3による各装置
を備えた構成としたから、CLKと非同期のTCLKを
カウントするタイマカウンタにおいて、TCLKをCL
KでサンプリングしてCLKに同期化しなくても、安定
してタイマカウンタの読み書きができ、かつ容易に設計
することが可能である。
As described above, the interval timer device according to the first embodiment of the present invention has a configuration including the devices according to the first to third embodiments. Therefore, in the timer counter that counts TCLK that is asynchronous with CLK, TCLK is used. CL
The timer counter can be stably read and written without being sampled at K and synchronized with CLK, and can be easily designed.

【0041】実施の形態2.図10は本発明の実施の形
態2によるインタバルタイマ装置の構成の一例を示すブ
ロック図である。図10において、図1と同一符号は同
一または相当部分であり、同一の略語で示した信号は同
一の信号である。また、94は読出・書込一時レジスタ
であり、図1における読出一時レジスタ13および書込
一時レジスタ16の機能を兼ね備えている。
Embodiment 2 FIG. 10 is a block diagram showing an example of a configuration of an interval timer device according to Embodiment 2 of the present invention. 10, the same reference numerals as those in FIG. 1 denote the same or corresponding parts, and the signals indicated by the same abbreviations are the same signals. Reference numeral 94 denotes a read / write temporary register, which has the functions of the read temporary register 13 and the write temporary register 16 in FIG.

【0042】図11に読出・書込一時レジスタ94の内
部構成の具体例を示す。図において、95はセレクタで
あり、書き込みデータを選択する。96はフリップフロ
ップであり、セレクタ95で選択されたデータを書き込
む。
FIG. 11 shows a specific example of the internal configuration of the read / write temporary register 94. In the figure, reference numeral 95 denotes a selector for selecting write data. A flip-flop 96 writes the data selected by the selector 95.

【0043】次に、読出・書込一時レジスタ94におけ
る動作について説明すると、CPUからの書き込み信号
TWT=Hのとき、CPUからタイマカウンタへの書き
込みデータWDT[n−1:0]が選択され、それ以外
のときはタイマカウンタ11(図10参照)のデータC
NT[n−1:0]が選択される。CPUからタイマカ
ウンタへデータを書き込む場合、CPUからの書き込み
信号TWT=Hを受け、読出書込一時レジスタを構成す
るフリップフロップ96の入力端子DにはCPUからデ
ータWDT[n−1:0]が与えられ、それと同時にゲ
ート98、ゲート99を通じてフリップフロップ96に
CLKが供給され、書き込みデータWDT[n−1:
0]が書き込まれることにより、読出・書込一時レジス
タ94は書込一時レジスタとして動作する。一方、CP
Uへタイマカウンタデータを読み出す場合、CPUから
のカウンタ読み出し事前信号TRD_2=HあるいはT
CLK立ち上がり判定回路からのTCLK立ち上がり判
定信号TRD_1=Hを受け、ゲート97、ゲート9
8、ゲート99を通じてフリップフロップ96にCLK
が供給される。一方、CPUへタイマカウンタへデータ
を読み出す場合CPUからタイマカウンタへデータを書
き込まないため、CPUからの書き込み信号TWT=L
であるので、フリップフロップ96の入力端子Dにはタ
イマカウンタのデータCNT[n−1:0]が入力さ
れ、読出・書込一時レジスタ94は読出一時レジスタと
して動作する。
Next, the operation of the read / write temporary register 94 will be described. When the write signal TWT = H from the CPU, the CPU selects write data WDT [n-1: 0] to the timer counter, Otherwise, the data C of the timer counter 11 (see FIG. 10)
NT [n-1: 0] is selected. When writing data from the CPU to the timer counter, the CPU receives a write signal TWT = H from the CPU, and receives data WDT [n−1: 0] from the CPU at the input terminal D of the flip-flop 96 constituting a read / write temporary register. At the same time, CLK is supplied to the flip-flop 96 through the gates 98 and 99, and the write data WDT [n-1:
0] is written, the read / write temporary register 94 operates as a write temporary register. On the other hand, CP
When the timer counter data is read out to U, the counter readout advance signal TRD_2 = H or T
The gate 97 and the gate 9 receive the TCLK rising determination signal TRD_1 = H from the CLK rising determining circuit.
8. CLK is applied to the flip-flop 96 through the gate 99.
Is supplied. On the other hand, when data is read from the CPU to the timer counter, the data is not written from the CPU to the timer counter.
Therefore, the timer counter data CNT [n−1: 0] is input to the input terminal D of the flip-flop 96, and the read / write temporary register 94 operates as a read temporary register.

【0044】なお、本実施の形態2によるインタバルタ
イマ装置においては、読出・書込一時レジスタの1個の
レジスタで読出一時レジスタおよび書込一時レジスタの
機能を兼ねることによって、読み出しと書き込みを同時
に行なうことはできなくなるが、一般的にタイマカウン
タの読み出しと書き込みの頻度は少ないので問題になる
ことはない。
In the interval timer device according to the second embodiment, reading and writing are performed simultaneously by using one of the reading and writing temporary registers as the function of the reading and writing temporary registers. However, there is no problem since the reading and writing of the timer counter is generally infrequent.

【0045】このように、本発明の実施の形態2による
インタバルタイマ装置では、上記実施の形態1によるイ
ンタバルタイマ装置において、当該インタバルタイマ装
置における,読出一時レジスタおよび書込一時レジスタ
に代えて、これらのレジスタの機能を兼ね備えた読出・
書込一時レジスタを備えた構成としたから、読出・書込
一時レジスタが読出一時レジスタ,及び書込一時レジス
タのいずれとして機能する場合においても、システムク
ロックで動作するため、これら両機能を兼ね備えてもク
ロック配線が複雑になることはなく、タイマカウンタの
読み書きのために必要なシステムクロックおよびタイマ
クロックの間の同期をとるためのレジスタを1個で済ま
せることができ、回路規模の削減が可能である。
As described above, in the interval timer device according to the second embodiment of the present invention, in the interval timer device according to the first embodiment, these interval timer devices are replaced by the read temporary register and the write temporary register. Readout that combines the functions of
Since the configuration includes the write temporary register, even when the read / write temporary register functions as either the read temporary register or the write temporary register, it operates with the system clock. Also, the clock wiring does not become complicated, and only one register for synchronizing the system clock and the timer clock necessary for reading and writing of the timer counter is required, and the circuit scale can be reduced. is there.

【0046】以上、実施の形態1および2では、タイマ
カウンタがダウンカウンタであることを前提として説明
したが、アップカウンタとしても構わない。また、シス
テムクロック、タイマクロックの有効エッジが立ち上が
りであるとして説明したが、各々個別に、立ち上がり,
或いは立ち下がりとしても実施の形態1および2と同様
の効果を得ることが可能である。
Although the first and second embodiments have been described on the assumption that the timer counter is a down counter, the timer counter may be an up counter. In addition, the valid edges of the system clock and the timer clock have been described as rising edges.
Alternatively, it is possible to obtain the same effect as in the first and second embodiments even when falling.

【0047】[0047]

【発明の効果】以上説明したように、本発明(請求項
1)にかかる出力保持機能付きカウンタ装置によれば、
システムクロックと非同期のタイマクロックをシステム
クロックでサンプリングするカウンタ装置において、上
記タイマクロックを入力してカウントを行うカウンタ
と、上記システムクロックに同期した第1のタイミング
で上記カウンタの値を取り込み保持する読出一時記憶手
段と、上記第1のタイミングの前後それぞれシステムク
ロック半サイクルの区間で、上記カウンタにおいて上記
タイマクロックによりカウンタ値を更新した第2のタイ
ミングがあったか否かを判定する手段とを備え、上記読
出一時記憶手段は、上記区間で上記第2のタイミングが
あったとき、再度上記カウンタの値を取り込んで保持す
るものとしたから、タイマクロックを直接システムクロ
ックでサンプリングするものとして、制御が複雑になっ
たり、素子特性のばらつきや配線遅延のばらつきを厳密
に解析した設計が必要となり、設計が非常に困難になる
等の問題を回避することができる効果がある。また、シ
ステムクロックとタイマクロックの干渉による悪影響を
受けることなく、安定にカウンタの値を読み出すことが
できる効果がある。
As described above, according to the counter device with an output holding function according to the present invention (claim 1),
In a counter device for sampling a timer clock asynchronous with a system clock with a system clock, a counter for counting by inputting the timer clock, and a reading device for taking in and holding a value of the counter at a first timing synchronized with the system clock Temporary storage means; and means for determining whether or not there is a second timing at which the counter updates the counter value with the timer clock in the system clock half cycle section before and after the first timing, respectively. Since the read temporary storage means takes in and holds the value of the counter again at the time of the second timing in the section, the timer clock is directly sampled by the system clock, so that the control becomes complicated. If the device characteristics Design strictly analyze variations in regard and wiring delay is required, there is an effect that it is possible to avoid problems such as the design becomes very difficult. Further, there is an effect that the value of the counter can be read stably without being adversely affected by the interference between the system clock and the timer clock.

【0048】また、本発明(請求項2)にかかる出力保
持機能付きカウンタ装置によれば、請求項1記載の出力
保持機能付きカウンタ装置において、上記読出一時記憶
手段は、上記区間で上記第2のタイミングがあったと
き、上記第1のタイミングからシステムクロック1サイ
クルの後、再度上記カウンタの値を取り込んで保持する
ものとしたから、さらに、各部は常にシステムクロック
1サイクル単位で動作することになり、容易に安定な回
路の実現ができる効果がある。
Further, according to the counter device with output holding function according to the present invention (claim 2), in the counter device with output holding function according to claim 1, the read temporary storage means includes the second temporary storage device in the section. In this case, after one cycle of the system clock from the first timing, the value of the counter is fetched and held again, so that each unit always operates in units of one cycle of the system clock. Thus, there is an effect that a stable circuit can be easily realized.

【0049】また、本発明(請求項3)にかかるクロッ
ク制御装置によれば、システムクロックに同期した制御
信号を入力して、タイマクロックの通過/不通過を制御
するクロック制御装置において、上記タイマクロックを
一定時間遅延させる遅延手段と、上記遅延手段で遅延さ
れたタイマクロックおよび上記制御信号を入力し、当該
タイマクロックがローレベルのとき、当該制御信号をそ
のまま出力し、当該タイマクロックがハイレベルのと
き、当該ハイレベルに変化したとき入力された制御信号
を保持して出力する記憶手段と、上記タイマクロックお
よび上記記憶手段からの出力がハイレベルのとき、ハイ
レベルを出力するゲート手段とを備えた構成としたか
ら、非常に簡単な構成で実現でき、システムクロックに
同期した制御信号でカウンタクロックを切り替える際
に、単にカウンタクロックのパルス幅を保証するだけで
はなく、カウンタクロックをオフにする制御信号を出力
した後はカウンタクロックが出力されないことを保証で
きる効果がある。
According to the clock control device of the present invention (claim 3), in the clock control device for controlling the passage / non-passage of the timer clock by inputting a control signal synchronized with the system clock, A delay means for delaying a clock for a predetermined time, a timer clock delayed by the delay means and the control signal are input, and when the timer clock is at a low level, the control signal is output as it is, and the timer clock is at a high level. At this time, storage means for holding and outputting a control signal input when the signal changes to the high level, and gate means for outputting a high level when the output from the timer clock and the storage means are at a high level. With this configuration, it can be realized with a very simple configuration, and can be implemented with a control signal synchronized with the system clock. When switching the printer clock, not only to ensure the pulse width of the counter clock, outputs the control signal to turn off the counter clock is effective which can ensure that the counter clock is not output.

【0050】また、本発明(請求項4)にかかるカウン
タ装置によれば、システムクロックと非同期のタイマク
ロックの通過あるいは不通過によってカウント動作の開
始あるいは停止を制御するカウンタ装置であって、上記
システムクロックで制御された制御信号を受けて、上記
タイマクロックの通過/不通過を制御するクロック制御
手段と、非同期プリセット端子を持つフリップフロップ
素子,及び該フリップフロップ素子に上記クロック制御
手段から上記タイマクロックが供給されないときに,上
記外部入力データを該非同期プリセット端子より入力す
るための手段を有し、上記タイマクロックが供給されて
いるときには、当該タイマクロックを該フリップフロッ
プ素子に入力してカウントを行うカウンタと、上記クロ
ック制御手段が上記タイマクロックを通過にしていると
き、上記外部入力データを一時記憶して上記カウンタに
出力する書込一時記憶手段と、上記書込一時記憶手段に
書き込まれたデータが安定した後、最初のタイマカウン
タ値更新のタイミングで当該データの値を上記カウンタ
に書き込むための制御信号を発生する信号発生手段とを
備えた構成としたから、タイマクロックのオン・オフに
かかわらず、タイマカウンタ動作のオン・オフを通じて
安定なデータをタイマカウンタに書き込むことが可能と
なる効果がある。また、クロック配線設計が容易となる
効果がある。
According to the counter device of the present invention (claim 4), there is provided a counter device for controlling the start or stop of the count operation by passing or not passing a timer clock asynchronous with the system clock. A clock control means for controlling passage / non-passage of the timer clock in response to a control signal controlled by a clock, a flip-flop element having an asynchronous preset terminal, and a timer clock transmitted from the clock control means to the flip-flop element Means for inputting the external input data from the asynchronous preset terminal when the timer clock is not supplied. When the timer clock is supplied, the timer clock is input to the flip-flop element to perform counting. Counter and clock control means Writing temporary storage means for temporarily storing the external input data and outputting the data to the counter when the timer clock is passed; and a first timer counter after the data written in the writing temporary storage means is stabilized. Signal generating means for generating a control signal for writing the value of the data to the counter at the time of updating the value, so that the timer counter operation is turned on and off regardless of whether the timer clock is on or off. Thus, there is an effect that stable data can be written to the timer counter. In addition, there is an effect that clock wiring design becomes easy.

【0051】また、本発明(請求項5)にかかるカウン
タ装置によれば、請求項4記載のカウンタ装置におい
て、上記カウンタは、上記クロック制御手段が上記タイ
マクロックを通過にしたまま、上記信号発生手段からの
信号がなくなったとき、上記フリップフロップ素子が上
記タイマクロックでの制御により、当該信号がなくなる
前に入力されたデータの値を1減算していくことによっ
て、カウントを行なうものとしたから、さらに、タイマ
クロックのオン・オフにかかわらないだけでなく、シス
テムクロックの供給がないときでも、タイマカウンタ動
作のオン・オフを通じて安定なデータをタイマカウンタ
に書き込むことが可能となる効果がある。
Further, according to the counter device according to the present invention (claim 5), in the counter device according to claim 4, the counter generates the signal while keeping the clock control means passing the timer clock. When the signal from the means disappears, the flip-flop element counts by subtracting 1 from the value of the data input before the signal disappears under the control of the timer clock. Further, there is an effect that stable data can be written to the timer counter through the ON / OFF operation of the timer counter even when the system clock is not supplied, regardless of whether the timer clock is ON / OFF.

【0052】また、本発明(請求項6)にかかるカウン
タ装置によれば、請求項4または5記載のカウンタ装置
において、上記クロック制御手段は、請求項3記載のク
ロック制御装置であるものとしたから、さらに、タイマ
動作のオン・オフを通じて安定なデータをタイマカウン
タに書き込むことができる回路を、クロックスキューが
発生したりクロックにヒゲ状のパルスを生じることなく
容易に実現できる効果がある。
According to the counter device of the present invention (claim 6), in the counter device of claim 4 or 5, the clock control means is the clock control device of claim 3. Furthermore, there is an effect that a circuit capable of writing stable data to the timer counter through ON / OFF of the timer operation can be easily realized without generating clock skew or generating a whisker-like pulse in the clock.

【0053】また、本発明(請求項7)にかかるインタ
バル装置によれば、システムクロックと非同期のタイマ
クロックで動作するカウンタ装置を有するインタバルタ
イマ装置であって、上記カウンタ装置は、請求項1記載
の出力保持機能付きカウンタ装置および請求項4記載の
カウンタ装置からなるものとしたから、システムクロッ
クと非同期のタイマクロックをカウントするタイマカウ
ンタにおいて、タイマクロックをシステムクロックでサ
ンプリングしてシステムクロックに同期化しなくても、
安定してタイマカウンタの読み書きができ、かつ容易に
設計することが可能である。
Further, according to the interval device of the present invention (claim 7), there is provided an interval timer device having a counter device that operates with a timer clock that is asynchronous with a system clock. And a counter device having an output holding function, and a timer device that counts a timer clock that is asynchronous with the system clock. In the timer counter, the timer clock is sampled by the system clock and synchronized with the system clock. Even without,
The timer counter can be read and written stably, and the design can be made easily.

【0054】また、本発明(請求項8)にかかるインタ
バル装置によれば、請求項7記載のインタバルタイマ装
置において、上記出力保持機能付きカウンタ装置の読出
一時記憶手段,及び上記カウンタ装置の書込一時記憶手
段に代えて、読み出し記憶あるいは書き込み記憶のいず
れかに切り替えて記憶する1つの記憶手段を備えた構成
としたから、読出・書込一時レジスタが読出一時記憶手
段および書込一時記憶手段の両機能を兼ね備えても、ク
ロック配線が複雑になることはなく、タイマカウンタの
読み書きのために必要なシステムクロックとタイマクロ
ックの間の同期をとるための記憶手段を1個で済ませる
ことができ、回路規模を削減できる効果がある。
According to the interval device of the present invention (claim 8), in the interval timer device according to claim 7, the reading temporary storage means of the counter device with the output holding function and the writing of the counter device. In place of the temporary storage means, one storage means for switching to either read storage or write storage for storage is provided, so that the read / write temporary register is used for the read temporary storage means and the write temporary storage means. Even if both functions are provided, the clock wiring does not become complicated, and only one storage unit for synchronizing the system clock and the timer clock necessary for reading and writing of the timer counter can be used. This has the effect of reducing the circuit scale.

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

【図1】本発明の実施の形態1によるインタバルタイマ
装置の構成を示すブロック図である。
FIG. 1 is a block diagram illustrating a configuration of an interval timer device according to a first embodiment of the present invention.

【図2】実施例1による出力保持機能付きカウンタ装置
の構成を示すブロック図である。
FIG. 2 is a block diagram illustrating a configuration of a counter device with an output holding function according to the first embodiment.

【図3】図2の出力保持機能付きカウンタ装置における
タイミングチャートを示す図である。
3 is a diagram showing a timing chart in the counter device with an output holding function of FIG. 2;

【図4】図2の出力保持機能付きカウンタ装置の回路の
一例を示す回路図である。
FIG. 4 is a circuit diagram showing an example of a circuit of the counter device with an output holding function of FIG. 2;

【図5】実施例2によるクロック制御装置の回路の一例
を示す回路図である。
FIG. 5 is a circuit diagram illustrating an example of a circuit of a clock control device according to a second embodiment.

【図6】図5のクロック制御装置におけるタイミングチ
ャートを示す図である。
6 is a diagram showing a timing chart in the clock control device of FIG. 5;

【図7】実施例3による,カウント動作の開始あるいは
停止を制御するカウンタ装置の回路の一例を示す回路図
である。
FIG. 7 is a circuit diagram illustrating an example of a circuit of a counter device that controls start or stop of a count operation according to a third embodiment.

【図8】図7のカウンタ装置におけるタイミングチャー
トを示す図である。
8 is a diagram showing a timing chart in the counter device of FIG. 7;

【図9】図7に示した書込回路の具体例を示す回路図で
ある。
FIG. 9 is a circuit diagram showing a specific example of the write circuit shown in FIG. 7;

【図10】本発明の実施の形態2によるインタバルタイ
マ装置の構成を示すブロック図である。
FIG. 10 is a block diagram showing a configuration of an interval timer device according to a second embodiment of the present invention.

【図11】図11に示した読出・書込一時レジスタの具
体例を示す回路図である。
FIG. 11 is a circuit diagram showing a specific example of a read / write temporary register shown in FIG. 11;

【図12】従来のカウンタ装置の回路の一例を示す回路
図である。
FIG. 12 is a circuit diagram showing an example of a circuit of a conventional counter device.

【図13】図12に示した回路における動作を示すタイ
ミングチャート図である。
FIG. 13 is a timing chart showing an operation in the circuit shown in FIG. 12;

【図14】従来のカウンタ装置の回路のその他の例を示
す回路図である。
FIG. 14 is a circuit diagram showing another example of the circuit of the conventional counter device.

【図15】従来の出力保持機能付きカウンタ装置の回路
の一例を示す回路図である。
FIG. 15 is a circuit diagram showing an example of a circuit of a conventional counter device with an output holding function.

【図16】図15に示した回路における動作の一例を示
すタイミングチャート図である。
16 is a timing chart showing an example of the operation of the circuit shown in FIG.

【図17】図15のカウンタ装置における動作のその他
の一例を示すタイミングチャート図である。
17 is a timing chart showing another example of the operation of the counter device of FIG.

【図18】従来のクロック制御装置の回路の一例を示す
回路図である。
FIG. 18 is a circuit diagram showing an example of a circuit of a conventional clock control device.

【図19】図18に示した回路における動作を示すタイ
ミングチャート図である。
FIG. 19 is a timing chart showing an operation in the circuit shown in FIG. 18;

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

11 タイマカウンタ 12 TCLK立上り判定回路 13 読出一時レジスタ 14 タイマクロックオンオフ回路 15 書込同期回路 16 書込一時レジスタ 31,32,34,38 フリップフロップ 33,35,36,37 ゲート 41 レベルセンシティブラッチ 42 遅延バッファ 43 ゲート 63 書込回路 64 非同期セット/リセット端子を持つフリップフロ
ップ 65 セレクタ 81,82,83 ゲート 94 読出・書込一時レジスタ 95 フリップフロップ 96 セレクタ 97〜99 ゲート 161,181 セレクタ
11 Timer Counter 12 TCLK Rising Judgment Circuit 13 Read Temporary Register 14 Timer Clock On / Off Circuit 15 Write Synchronous Circuit 16 Write Temporary Register 31, 32, 34, 38 Flip-Flop 33, 35, 36, 37 Gate 41 Level Sensitive Latch 42 Delay Buffer 43 gate 63 write circuit 64 flip-flop with asynchronous set / reset terminal 65 selector 81, 82, 83 gate 94 read / write temporary register 95 flip-flop 96 selector 97-99 gate 161, 181 selector

Claims (8)

【特許請求の範囲】[Claims] 【請求項1】 システムクロックと非同期のタイマクロ
ックをシステムクロックでサンプリングするカウンタ装
置において、 上記タイマクロックを入力してカウントを行うカウンタ
と、 上記システムクロックに同期した第1のタイミングで上
記カウンタの値を取り込み保持する読出一時記憶手段
と、 上記第1のタイミングの前後それぞれシステムクロック
半サイクルの区間で、上記カウンタにおいて上記タイマ
クロックによりカウンタ値を更新した第2のタイミング
があったか否かを判定する手段とを備え、 上記読出一時記憶手段は、上記区間で上記第2のタイミ
ングがあったとき、再度上記カウンタの値を取り込んで
保持することを特徴とする出力保持機能付きカウンタ装
置。
1. A counter device for sampling a timer clock asynchronous with a system clock by a system clock, wherein the counter counts by inputting the timer clock, and a value of the counter at a first timing synchronized with the system clock. A temporary storage means for taking in and holding, and a means for determining whether or not there is a second timing at which the counter updates the counter value by the timer clock in a half cycle of the system clock before and after the first timing. A counter device with an output holding function, wherein the reading temporary storage means takes in and holds the value of the counter again when the second timing occurs in the section.
【請求項2】 請求項1記載の出力保持機能付きカウン
タ装置において、 上記読出一時記憶手段は、上記区間で上記第2のタイミ
ングがあったとき、上記第1のタイミングからシステム
クロック1サイクルの後、再度上記カウンタの値を取り
込んで保持することを特徴とする出力保持機能付きカウ
ンタ装置。
2. The counter device with an output holding function according to claim 1, wherein said read temporary storage means, when said second timing occurs in said section, after one system clock cycle from said first timing. And a counter device with an output holding function, which fetches and holds the value of the counter again.
【請求項3】 システムクロックに同期した制御信号を
入力して、タイマクロックの通過/不通過を制御するク
ロック制御装置において、 上記タイマクロックを一定時間遅延させる遅延手段と、 上記遅延手段で遅延されたタイマクロックおよび上記制
御信号を入力し、当該タイマクロックがローレベルのと
き、当該制御信号をそのまま出力し、当該タイマクロッ
クがハイレベルのとき、当該ハイレベルに変化したとき
入力された制御信号を保持して出力する記憶手段と、 上記タイマクロックおよび上記記憶手段からの出力がハ
イレベルのとき、ハイレベルを出力するゲート手段とを
備えたことを特徴とするクロック制御装置。
3. A clock control device for inputting a control signal synchronized with a system clock to control the passage / non-passage of a timer clock, wherein the delay unit delays the timer clock for a predetermined time; When the timer clock is at a low level, the control signal is output as it is, and when the timer clock is at a high level, the control signal input when the timer clock changes to the high level is input. A clock control device comprising: storage means for holding and outputting; and gate means for outputting a high level when the timer clock and the output from the storage means are at a high level.
【請求項4】 システムクロックと非同期のタイマクロ
ックの通過あるいは不通過によってカウント動作の開始
あるいは停止を制御するカウンタ装置であって、 上記システムクロックで制御された制御信号を受けて、
上記タイマクロックの通過/不通過を制御するクロック
制御手段と、 非同期プリセット端子を持つフリップフロップ素子,及
び該フリップフロップ素子に上記クロック制御手段から
上記タイマクロックが供給されないときに,上記外部入
力データを該非同期プリセット端子より入力するための
手段を有し、上記タイマクロックが供給されているとき
には、当該タイマクロックを該フリップフロップ素子に
入力してカウントを行うカウンタと、 上記クロック制御手段が上記タイマクロックを通過にし
ているとき、上記外部入力データを一時記憶して上記カ
ウンタに出力する書込一時記憶手段と、 上記書込一時記憶手段に書き込まれたデータが安定した
後、最初のタイマカウンタ値更新のタイミングで当該デ
ータの値を上記カウンタに書き込むための制御信号を発
生する信号発生手段とを備えたことを特徴とするカウン
タ装置。
4. A counter device for controlling start or stop of a count operation by passing or non-passing of a timer clock asynchronous with a system clock, wherein the counter device receives a control signal controlled by the system clock,
Clock control means for controlling the passage / non-passage of the timer clock; a flip-flop element having an asynchronous preset terminal; and when the timer clock is not supplied from the clock control means to the flip-flop element, the external input data is supplied to the flip-flop element. A counter for inputting from the asynchronous preset terminal, wherein the timer clock is supplied to the flip-flop element to count when the timer clock is supplied; and Writing temporary storage means for temporarily storing the external input data and outputting the data to the counter, and updating the first timer counter value after the data written in the writing temporary storage means is stabilized. Write the value of the data to the counter at the timing of Counter device characterized by comprising a signal generating means for generating a control signal for fit.
【請求項5】 請求項4記載のカウンタ装置において、 上記カウンタは、上記クロック制御手段が上記タイマク
ロックを通過にしたまま、上記信号発生手段からの信号
がなくなったとき、上記フリップフロップ素子が上記タ
イマクロックでの制御により、当該信号がなくなる前に
入力されたデータの値を1減算していくことによって、
カウントを行なうことを特徴とするカウンタ装置。
5. The counter device according to claim 4, wherein the counter controls the flip-flop element when the signal from the signal generation unit is lost while the clock control unit keeps passing the timer clock. By controlling with the timer clock, by subtracting 1 from the value of the input data before the signal disappears,
A counter device for performing counting.
【請求項6】 請求項4または5記載のカウンタ装置に
おいて、 上記クロック制御手段は、請求項3記載のクロック制御
装置であることを特徴とするカウンタ装置。
6. The counter device according to claim 4, wherein said clock control means is the clock control device according to claim 3.
【請求項7】 システムクロックと非同期のタイマクロ
ックで動作するカウンタ装置を有するインタバルタイマ
装置であって、 上記カウンタ装置は、請求項1記載の出力保持機能付き
カウンタ装置および請求項4記載のカウンタ装置からな
ることを特徴とするインタバルタイマ装置。
7. An interval timer device having a counter device that operates with a timer clock that is asynchronous with a system clock, wherein the counter device has the output holding function according to claim 1 and the counter device according to claim 4. An interval timer device comprising:
【請求項8】 請求項7記載のインタバルタイマ装置に
おいて、 上記出力保持機能付きカウンタ装置の読出一時記憶手
段,及び上記カウンタ装置の書込一時記憶手段に代え
て、読み出し記憶あるいは書き込み記憶のいずれかに切
り替えて記憶する1つの記憶手段を備えたことを特徴と
するインタバルタイマ装置。
8. The interval timer device according to claim 7, wherein the read temporary storage means of the counter device with the output holding function and the write temporary storage device of the counter device are replaced with either read storage or write storage. An interval timer device comprising one storage means for switching and storing the information.
JP2170698A 1998-02-03 1998-02-03 Counter device with output holding function, clock controller, counter device, and interval timer device Pending JPH11220383A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2170698A JPH11220383A (en) 1998-02-03 1998-02-03 Counter device with output holding function, clock controller, counter device, and interval timer device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2170698A JPH11220383A (en) 1998-02-03 1998-02-03 Counter device with output holding function, clock controller, counter device, and interval timer device

Publications (1)

Publication Number Publication Date
JPH11220383A true JPH11220383A (en) 1999-08-10

Family

ID=12062509

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2170698A Pending JPH11220383A (en) 1998-02-03 1998-02-03 Counter device with output holding function, clock controller, counter device, and interval timer device

Country Status (1)

Country Link
JP (1) JPH11220383A (en)

Similar Documents

Publication Publication Date Title
WO2002069146A2 (en) Data processing system having an on-chip background debug system and method therefor
JPS61148692A (en) Memory device
JP2695535B2 (en) Timer input control circuit and counter control circuit
CN116521604A (en) Method for synchronizing data and related device
US5305277A (en) Data processing apparatus having address decoder supporting wide range of operational frequencies
JP3852437B2 (en) Synchronous / asynchronous interface circuit and electronic equipment
JP2005518042A (en) Data transfer between buses with different clocks
JPH0136146B2 (en)
JPH11220383A (en) Counter device with output holding function, clock controller, counter device, and interval timer device
US5304855A (en) Bi-level pulse accumulator
JP3466755B2 (en) Electronics
JPH1173778A (en) Semiconductor memory device
JP4253383B2 (en) Memory device
JP4114749B2 (en) MEMORY CONTROL DEVICE AND ELECTRONIC DEVICE
JP3563223B2 (en) Register circuit
JP3450667B2 (en) Data processor
JP4640792B2 (en) Semiconductor logic device and electronic device including the same
JP3451631B2 (en) Handshake type data processing circuit
JP2661741B2 (en) Semiconductor memory circuit
JP2552388B2 (en) Semiconductor memory device
JP2545407B2 (en) Direct memory access controller
JP2626112B2 (en) Microprocessor
JPS61103257A (en) Memory control circuit
JP2003085124A (en) Integrated circuit device having circuit for reading out data of internal register in response to readout signal from external part and system having this device
JPH0581445A (en) Microcomputer lsi