JPH04283811A - Timer circuit - Google Patents

Timer circuit

Info

Publication number
JPH04283811A
JPH04283811A JP3047952A JP4795291A JPH04283811A JP H04283811 A JPH04283811 A JP H04283811A JP 3047952 A JP3047952 A JP 3047952A JP 4795291 A JP4795291 A JP 4795291A JP H04283811 A JPH04283811 A JP H04283811A
Authority
JP
Japan
Prior art keywords
timer
cpu
circuit
timers
timer circuit
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.)
Withdrawn
Application number
JP3047952A
Other languages
Japanese (ja)
Inventor
Kyo Nagahama
巨 長浜
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.)
Fujitsu Ltd
Original Assignee
Fujitsu 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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP3047952A priority Critical patent/JPH04283811A/en
Publication of JPH04283811A publication Critical patent/JPH04283811A/en
Withdrawn legal-status Critical Current

Links

Abstract

PURPOSE:To offer the timer circuit which performs time control over many systems simultaneously with a relatively simple circuit scale as to a timer circuit for time control by a CPU which performs control by a stored program system. CONSTITUTION:The timer circuit controls plural timers which can be accessed from the CPU 50 and is equipped with a storage means 10 for storing the counted values of the timers, a timer processing means 12 which updates the respective counted values of the timers stored in the storage means 10 at specific periods and informs said CPU 50 of the number of a timer which finishes counting, and a selecting means 16 which connects the bus of the CPU 50 and the bus of the timer processing means 12 to the storage means 10 alternately.

Description

【発明の詳細な説明】[Detailed description of the invention]

【0001】0001

【産業上の利用分野】本発明は、CPUにおける時間管
理のためのタイマ回路に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a timer circuit for time management in a CPU.

【0002】0002

【従来の技術】CPUは通常、記憶装置に格納された処
理プログラムをプログラムカウンタに従って順次読み出
して実行する、いわゆるストアドプログラム方式で一定
の処理を達成する。その場合に、所定の時間をおいて処
理を実行するという、時間管理が必要な場合がしばしば
生じる。その時間管理の方法として、第1に、CPUの
命令の処理時間が一定であることを利用して、所定の処
理時間を要するループを所定回数だけループさせるとい
う方法がある。
2. Description of the Related Art A CPU usually accomplishes certain processing using a so-called stored program method, in which processing programs stored in a storage device are sequentially read out and executed according to a program counter. In this case, there often arises a need for time management in which processing is executed after a predetermined period of time. As a time management method, firstly, there is a method of making a loop which requires a predetermined processing time repeat a predetermined number of times by utilizing the fact that the processing time of a CPU instruction is constant.

【0003】この方法は、タイマ処理のためのハードウ
ェアが特に必要がないという利点があるが、ソフトウェ
アの処理が複雑化し、また、同時に多数の系列の時間管
理を行なう必要がある場合には現実的ではない。したが
って、外付けのタイマ用LSIを接続し、時間管理をこ
のLSIに委ねるという方式を採用するのが一般的であ
る。
[0003] This method has the advantage that no special hardware is required for timer processing, but it is not practical when the software processing becomes complex and when it is necessary to manage the time of a large number of series at the same time. Not the point. Therefore, it is common to connect an external timer LSI and leave time management to this LSI.

【0004】0004

【発明が解決しようとする課題】しかしながらこの方式
では、通常1個のタイマ用LSIが処理可能なタイマの
数に制限があるため、多数の系列の時間を同時に管理す
る必要がある場合にその数に見合っただけの多数のタイ
マ用LSIが必要となり、ハードウェアの規模が全体と
して膨大になるという問題がある。
[Problem to be Solved by the Invention] However, in this method, there is usually a limit to the number of timers that one timer LSI can process. A problem arises in that a large number of timer LSIs are required, and the scale of the hardware as a whole becomes enormous.

【0005】したがって本発明の目的は、比較的簡潔な
回路規模で多数の系列の時間管理を同時に実行すること
の可能なタイマ回路を提供することにある。
[0005] Accordingly, an object of the present invention is to provide a timer circuit that can simultaneously manage the time of a large number of series with a relatively simple circuit scale.

【0006】[0006]

【課題を解決するための手段】図1は本発明の原理構成
を表わすブロック図である。図において、本発明のタイ
マ回路は、 CPU50からアクセス可能な複数個のタ
イマを管理するタイマ回路であって、 CPU50から
アクセス可能であり該複数個のタイマのカウント値を記
憶する記憶手段10と、該記憶手段10に記憶された該
複数個のタイマのカウント値のそれぞれを所定の周期で
更新し、カウントを終了したタイマがあればそのタイマ
の番号を前記 CPU50に通知するタイマ処理手段1
2とを具備することを特徴とするものである。
[Means for Solving the Problems] FIG. 1 is a block diagram showing the basic configuration of the present invention. In the figure, the timer circuit of the present invention is a timer circuit that manages a plurality of timers accessible from a CPU 50, and includes a storage means 10 that is accessible from the CPU 50 and stores count values of the plurality of timers; a timer processing means 1 for updating each of the count values of the plurality of timers stored in the storage means 10 at a predetermined cycle, and for notifying the CPU 50 of the number of any timer that has finished counting;
2.

【0007】このタイマ回路は、前記 CPU50のバ
スと前記タイマ処理手段12のバスとを交互に前記記憶
手段10に接続する選択手段16とをさらに具備するこ
とが好適である。
Preferably, this timer circuit further includes selection means 16 for alternately connecting the bus of the CPU 50 and the bus of the timer processing means 12 to the storage means 10.

【0008】[0008]

【作用】CPU50は記憶手段10をアクセスすること
が可能である。したがって、 CPU50は記憶手段1
0内のタイマ定数の設定等の処理を行なうことができ、
タイマ処理手段12はカウント値の書込みおよび読み出
しの処理を行ない、また、タイマの減算、終了判定、C
PUへの通知等の処理を行なうことができ、タイマ用L
SIを外付けした場合とほぼ同等の処理が実現される。 さらに、記憶手段10の容量はタイマの必要個数に応じ
て任意に設計することができるので、多数のタイマを有
するタイマ回路が比較的簡潔な回路で実現される。
[Operation] The CPU 50 can access the storage means 10. Therefore, the CPU 50 uses the storage means 1
Processing such as setting timer constants within 0 can be performed,
The timer processing means 12 performs writing and reading of count values, and also performs timer subtraction, termination determination, and C
Processing such as notification to PU can be performed, and L for timer
Almost the same processing as when the SI is externally attached is realized. Furthermore, since the capacity of the storage means 10 can be arbitrarily designed depending on the required number of timers, a timer circuit having a large number of timers can be realized with a relatively simple circuit.

【0009】また、 CPU50とタイマ処理手段16
とを交互に記憶手段10にバス接続せしめる選択手段1
6を設けることにより、 CPU50とタイマ処理手段
16との記憶手段10への競合が回避される。
[0009] Furthermore, the CPU 50 and the timer processing means 16
selection means 1 for alternately connecting the
6, contention between the CPU 50 and the timer processing means 16 for the storage means 10 is avoided.

【0010】0010

【実施例】図2は本発明の一実施例に係るタイマ回路の
回路図である。セレクタ160 は切替信号(入力S)
に応じて、アドレスバス、データバス、出力イネーブル
信号*OE、書込イネーブル信号*WE、およびチップ
セレクト信号*CSについて、CPU500からのもの
とタイマ回路側からのものとで交互に切り換えて記憶素
子100 に接続する。
Embodiment FIG. 2 is a circuit diagram of a timer circuit according to an embodiment of the present invention. Selector 160 is a switching signal (input S)
The address bus, data bus, output enable signal *OE, write enable signal *WE, and chip select signal *CS are switched alternately between the CPU 500 and the timer circuit side according to the Connect to 100.

【0011】クロック発振器148 はこのタイマ回路
の動作の基本クロックを発生する。アドレスカウンタ1
20 はこの基本クロックに基づいて、このタイマ回路
が処理すべきタイマのアドレスを順次発生して、セレク
タ160 へ供給する。タイミング生成回路122 は
クロック発振器148 からの基本クロックに基いて、
セレクタ160 の切替のための切替信号、記憶素子1
00 を生かすためのチップセレクト信号*CS、記憶
素子100 からの読み出し制御のための出力イネーブ
ル信号*OE、記憶素子100 への書込み制御のため
の書込みイネーブル信号*WE、およびバッファ126
,128 の制御信号等を所定のタイミングで出力する
。バッファ128 は記憶素子100 からアドレスカ
ウンタ120 で指定されたタイマのカウント値を読み
出すためのバッファである。ラッチ130 はタイミン
グ生成部122 からの制御信号(図示せず)の制御の
もとに記憶素子100 から読み出されたカウント値を
次の書き込みタイミングまで保持する。減算回路134
 はラッチ130 に保持されたカウント値を1だけ減
算して出力する。バッファ126 は減算回路134 
の出力を記憶素子100 に書き込むためのバッファで
ある。
Clock oscillator 148 generates the basic clock for the operation of this timer circuit. address counter 1
20 sequentially generates timer addresses to be processed by this timer circuit based on this basic clock and supplies them to selector 160. The timing generation circuit 122 is based on the basic clock from the clock oscillator 148.
Switching signal for switching selector 160, storage element 1
chip select signal *CS to make use of 00, output enable signal *OE to control reading from the storage element 100, write enable signal *WE to control writing to the storage element 100, and buffer 126.
, 128 control signals, etc. are output at predetermined timing. The buffer 128 is a buffer for reading the count value of the timer specified by the address counter 120 from the storage element 100. The latch 130 holds the count value read from the storage element 100 under the control of a control signal (not shown) from the timing generator 122 until the next write timing. Subtraction circuit 134
decrements the count value held in the latch 130 by 1 and outputs the result. The buffer 126 is a subtraction circuit 134
This is a buffer for writing the output of 2 to the storage element 100.

【0012】“0”比較回路136 は減算回路136
 の出力が“0”であるとき、タイマのカウント終了を
示す出力が有効になり、その出力はANDゲート140
 を介して割り込み処理回路146 に入力されるとと
もにフリップフロップ142 のクロック入力となる。 フリップフロップ142 はクロック入力によりアドレ
スカウンタ120 の出力をラッチする。このときラッ
チされる値はカウントを終了したタイマのタイマ番号に
相当する。割り込み処理回路146 は“0”比較回路
136 からのカウント終了信号を受け付けてCPU5
00への割り込み信号INTを出力するとともに、CP
U500が割り込み受け付けを完了するまでに他のタイ
マがカウントを終了してフリップフロップ142 が書
き換わってしまうのを防止するため、CPU500が割
り込みを受け付けるまでANDゲート140 を閉じる
信号を出力する。
The “0” comparison circuit 136 is a subtraction circuit 136
When the output of 140 is "0", the output indicating the end of the timer's count is enabled, and the output is connected to AND gate 140.
The signal is input to the interrupt processing circuit 146 through the gate and serves as a clock input to the flip-flop 142. Flip-flop 142 latches the output of address counter 120 by clock input. The value latched at this time corresponds to the timer number of the timer that has finished counting. The interrupt processing circuit 146 receives the count end signal from the “0” comparison circuit 136 and outputs the signal to the CPU 5.
At the same time as outputting the interrupt signal INT to 00,
In order to prevent other timers from finishing counting and rewriting the flip-flop 142 before the CPU 500 completes accepting the interrupt, a signal is output that closes the AND gate 140 until the CPU 500 accepts the interrupt.

【0013】CPU500が割り込みを受け付けたら所
定の入力ポートアドレスからデータを入力する命令を実
行するようにプログラムされており、この命令の実行に
より、アドレスデコーダ144 の出力は有効になり、
フリップフロップ142 からCPU500のデータバ
スへタイマ番号が出力され、CPU500に取り込まれ
る。タイマのカウント値が“1”であるために減算回路
134 の出力が“0”であるとき、またはタイマの値
がタイマ未使用を意味する“0”であるとき、ORゲー
ト138 の出力が有効になるのでゲート124 は閉
じられ、カウント値の更新は行なわれない。
When the CPU 500 receives an interrupt, it is programmed to execute an instruction to input data from a predetermined input port address, and by executing this instruction, the output of the address decoder 144 becomes valid.
The timer number is output from the flip-flop 142 to the data bus of the CPU 500 and taken into the CPU 500. When the count value of the timer is "1" and the output of the subtraction circuit 134 is "0", or when the timer value is "0" meaning that the timer is not used, the output of the OR gate 138 is valid. Therefore, the gate 124 is closed and the count value is not updated.

【0014】したがってタイマのカウント値が“0”で
あるとき、その値は更新されず、“2”以上であるとき
、処理周期が来る毎に減算され、“1”から“0”にな
ろうとするときに割り込みが発生し、CPUが割り込み
を受け付けてCPUからの命令等により0に書き換えら
れるまで“1”であり続ける。図3は図2の回路の動作
の概略を説明するためのタイミングチャートである。 (a)欄はセレクタ160 の状態を示し、(b)欄は
バッファ126 からの記憶素子100 への書き込み
データの状態を示し、(c)欄は記憶素子100 から
バッファ128 を経て読み出されるデータの状態を示
し、(d)欄はアドレスカウンタ120 の出力の状態
を表わす。
[0014] Therefore, when the count value of the timer is "0", the value is not updated, and when it is greater than "2", it is subtracted every time the processing cycle comes, and the value changes from "1" to "0". When an interrupt is generated, the CPU accepts the interrupt and continues to be "1" until it is rewritten to 0 by an instruction from the CPU. FIG. 3 is a timing chart for explaining the outline of the operation of the circuit shown in FIG. Column (a) shows the state of the selector 160, column (b) shows the state of data written to the memory element 100 from the buffer 126, and column (c) shows the state of data read from the memory element 100 via the buffer 128. The column (d) shows the state of the output of the address counter 120.

【0015】図3に示すように、セレクタ160 がタ
イマ回路側を選択している期間((a) 欄)の後半部
分で記憶素子100 からデータが読み出され((c)
 欄)、CPU側を選択している間にカウント値の減算
および判定の処理が行なわれ、次にタイマ回路側が選択
される期間の前半部分((b)欄)で記憶素子100 
の同じアドレス((d)欄)に更新された値が書き込ま
れる。
As shown in FIG. 3, data is read from the memory element 100 in the latter half of the period (column (a)) in which the selector 160 selects the timer circuit side (column (c)).
column), while the CPU side is selected, the count value subtraction and judgment processing are performed, and then in the first half of the period when the timer circuit side is selected (column (b)), the memory element 100 is
The updated value is written to the same address (column (d)).

【0016】なお、セレクタ160 の動作の一周期を
CPUの処理1サイクルの時間と一致させ、タイマ回路
に割り当てられる期間をCPUが外部をアクセスしない
期間に割り当てることにより、CPUから記憶素子への
アクセスは他の記憶素子(図示せず)のアクセスと全く
同等に行なうことができる。この様に、CPU500が
記憶素子100 に書き込んだ値を、ハードウェアが直
接減算・判定を行うので、ソフトウェアとは一切無関係
に、しかも高速でタイマの管理を行うことができる。C
PU500はタイムアウトの割り込み発生後、タイムア
ウトバッファ142 にアクセスする処理のみをソフト
ウェアで行えばよい。
Furthermore, by making one cycle of the operation of the selector 160 coincide with the time of one processing cycle of the CPU, and by allocating the period assigned to the timer circuit to a period in which the CPU does not access the outside, access from the CPU to the memory element is reduced. can be performed in exactly the same way as accessing other storage elements (not shown). In this way, since the hardware directly subtracts and judges the value written by the CPU 500 to the storage element 100, the timer can be managed at high speed, completely independent of software. C
The PU 500 only needs to use software to access the timeout buffer 142 after a timeout interrupt occurs.

【0017】この実施例では、(記憶素子100 の容
量によって決定される)多数のタイマの同時処理、ソフ
トウェアが不必要という効果が得られる。
This embodiment has the advantage that simultaneous processing of a large number of timers (determined by the capacity of the memory element 100) and no software are required.

【0018】[0018]

【発明の効果】以上説明したように本発明によれば、比
較的簡潔な回路およびソフトウェア処理により、同時に
多数の系列の時間管理が実現される。
As described above, according to the present invention, time management of a large number of sequences can be realized simultaneously using a relatively simple circuit and software processing.

【図面の簡単な説明】[Brief explanation of the drawing]

【図1】本発明の原理構成図である。FIG. 1 is a diagram showing the principle configuration of the present invention.

【図2】本発明の一実施例を表わす回路図である。FIG. 2 is a circuit diagram representing one embodiment of the present invention.

【図3】図2の回路の動作の概略を表わすタイミングチ
ャートである。
FIG. 3 is a timing chart schematically showing the operation of the circuit in FIG. 2;

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

10…記憶手段 12…タイマ処理手段 16…選択手段 50…CPU 10...Storage means 12...Timer processing means 16...Selection means 50...CPU

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】  CPU(50)からアクセス可能な複
数個のタイマを管理するタイマ回路であって、該CPU
(50)からアクセス可能であり、該複数個のタイマの
カウント値を記憶する記憶手段(10)と、該記憶手段
(10)に記憶された該複数個のタイマのカウント値の
それぞれを所定の周期で更新し、カウントを終了したタ
イマがあればそのタイマの番号を前記CPU(50)に
通知するタイマ処理手段(12)とを具備することを特
徴とするタイマ回路。
Claim 1: A timer circuit that manages a plurality of timers accessible from a CPU (50), wherein the CPU
storage means (10) that can be accessed from (50) and stores the count values of the plurality of timers; A timer circuit comprising: timer processing means (12) that updates the timer periodically and, if there is a timer that has finished counting, notifies the CPU (50) of the number of that timer.
【請求項2】  前記 CPU(50)のバスと前記タ
イマ処理手段(12)のバスとを交互に前記記憶手段(
10)に接続する選択手段(16)をさらに具備するこ
とを特徴とする請求項1記載のタイマ回路。
2. A bus for the CPU (50) and a bus for the timer processing means (12) are alternately connected to the storage means (12).
2. A timer circuit according to claim 1, further comprising selection means (16) connected to the timer circuit (10).
JP3047952A 1991-03-13 1991-03-13 Timer circuit Withdrawn JPH04283811A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP3047952A JPH04283811A (en) 1991-03-13 1991-03-13 Timer circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP3047952A JPH04283811A (en) 1991-03-13 1991-03-13 Timer circuit

Publications (1)

Publication Number Publication Date
JPH04283811A true JPH04283811A (en) 1992-10-08

Family

ID=12789694

Family Applications (1)

Application Number Title Priority Date Filing Date
JP3047952A Withdrawn JPH04283811A (en) 1991-03-13 1991-03-13 Timer circuit

Country Status (1)

Country Link
JP (1) JPH04283811A (en)

Similar Documents

Publication Publication Date Title
US5115510A (en) Multistage data flow processor with instruction packet, fetch, storage transmission and address generation controlled by destination information
US4553203A (en) Easily schedulable horizontal computer
US5761703A (en) Apparatus and method for dynamic memory refresh
US4733346A (en) Data processor with multiple register blocks
US5201036A (en) Data processor having wait state control unit
US5299320A (en) Program control type vector processor for executing a vector pipeline operation for a series of vector data which is in accordance with a vector pipeline
EP0180196A2 (en) Programmable counter/timer device
US4521874A (en) Random access memory device
JPS6235949A (en) Memory device
US4811201A (en) Interconnect circuit
US5467454A (en) Bus use request adjusting apparatus allowing changing priority levels
US5526500A (en) System for operand bypassing to allow a one and one-half cycle cache memory access time for sequential load and branch instructions
KR100321745B1 (en) A micro controller unit for external memory access
US5012410A (en) Data processor with instruction cache memory
JPH04283811A (en) Timer circuit
US5889966A (en) Data processor having bus controller for controlling a plurality of buses independently of each other
JPH05107314A (en) Ic testing device
US6785799B1 (en) Multiprocessor with asynchronous pipeline processing of instructions, and control method thereof
JPH07146814A (en) Memory device
JPS6391756A (en) Partial write instruction processing system for storage device
JP2870812B2 (en) Parallel processor
JP2915912B2 (en) Pattern sequence control circuit for semiconductor test equipment
KR0139966B1 (en) Common device access device
JPH07111683B2 (en) Processor with task switching function
JPH07120938B2 (en) Pulse output device

Legal Events

Date Code Title Description
A300 Application deemed to be withdrawn because no request for examination was validly filed

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 19980514