JP2001075820A - Real time os device - Google Patents

Real time os device

Info

Publication number
JP2001075820A
JP2001075820A JP25344999A JP25344999A JP2001075820A JP 2001075820 A JP2001075820 A JP 2001075820A JP 25344999 A JP25344999 A JP 25344999A JP 25344999 A JP25344999 A JP 25344999A JP 2001075820 A JP2001075820 A JP 2001075820A
Authority
JP
Japan
Prior art keywords
priority
task
register
circuit
output
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
JP25344999A
Other languages
Japanese (ja)
Inventor
Isao Uchiumi
功朗 内海
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.)
Oki Electric Industry Co Ltd
Original Assignee
Oki Electric Industry 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 Oki Electric Industry Co Ltd filed Critical Oki Electric Industry Co Ltd
Priority to JP25344999A priority Critical patent/JP2001075820A/en
Publication of JP2001075820A publication Critical patent/JP2001075820A/en
Pending legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To obtain an OS performing fast processing without imposing a burden on a processor by scheduling a task with hardware. SOLUTION: A bit matrix storing part 10 stores the priority of each task to be a scheduling object and information showing the order for every priority. A priority encoder 12 reads the priority of a task having the highest priority. A comparator 14 compares the priority of the read task with the priority of an active task and outputs an interrupt signal for task switching to a processor when the read priority is higher than the priority of the active task. A stack pointer address generation circuit 20 receives the task priority and the order of each different priority high in the order for every priority among applicable priority tasks and generates a stack pointer address used for task switching.

Description

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

【0001】[0001]

【発明の属する技術分野】本発明は、タスク切り替え処
理を実行する部分をハードウェアによって構成したリア
ルタイムOS装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a real-time OS device in which a portion for executing a task switching process is constituted by hardware.

【0002】[0002]

【従来の技術】広く普及しているコンピュータのOS
(オペレーティングシステム)はソフトウェアにより実
現されている。しかしながら、例えば通信プロトコル処
理を実行するシステムでは、例えば1マイクロ秒といっ
た短時間にタスクの切り替えを終了しければならないと
いう要求がある。こうしたリアルタイム性を厳しく要求
される分野で、ソフトウェアにより実現されたOSでは
対応に限界がある。そこで、タスクの切り替え処理をハ
ードウェアによって構成したリアルタイムOS装置が検
討されている(リアルタイムOSのハードウェア化とそ
の評価、信学技法VLD93-97(1993-12))、(シリコン
TRONの実現とその評価、信学技法VLD94-40(1994-0
7))。
2. Description of the Related Art A widely used computer OS
(Operating system) is realized by software. However, in a system that executes communication protocol processing, for example, there is a demand that task switching must be completed in a short time, for example, 1 microsecond. In the field where such real-time property is strictly required, there is a limit to the correspondence of the OS realized by software. Therefore, a real-time OS device in which task switching processing is configured by hardware is being studied (hardware real-time OS and its evaluation, IEICE VLD93-97 (1993-12)). The evaluation, the religious technique VLD94-40 (1994-0
7)).

【0003】[0003]

【発明が解決しようとする課題】ところで、上記のよう
な従来の技術には次のような解決すべき課題があった。
プロセッサの高性能化に伴い、ソフトウェアによるリア
ルタイムOSの実現性は高まっている。しかしながら、
例えばタスクのスケジュールに関わるレディキューやウ
ェイトキューの操作をソフトウェアで実行すると、各タ
スクのアドレス操作に多くのサイクル数がかかる。プロ
セッサがこのアドレス操作を実行している間、他のアプ
リケーションプログラムは動作できないため、プロセッ
サのオーバーヘッドが問題になる。即ち、頻繁にタスク
の切り替えが行われると、他のアプリケーションの動作
速度が著しく低下する。
However, the above-mentioned prior art has the following problems to be solved.
The realization of a real-time OS using software has been increasing with the performance enhancement of processors. However,
For example, when operations of a ready queue and a wait queue related to a task schedule are executed by software, an address operation of each task requires a large number of cycles. While the processor is performing this address manipulation, no other application programs can run, thus causing processor overhead. That is, when the task is frequently switched, the operation speed of another application is significantly reduced.

【0004】また、多数の割り込み信号がアサートされ
ると、割り込みハンドラによる処理を経てソフトウェア
処理が開始される。しかし、割り込みに対して即座に処
理する必要が迫られているソフトウェアに対して、割り
込みハンドラによる処理のオーバーヘッドが問題にな
る。また、イベントフラグの設定からタスクが実行可能
状態になるまで多くのサイクル数がかかる場合、イベン
トフラグに対して即座に処理をする必要が迫られている
ソフトウェアに対してはイベントフラグ処理のオーバー
ヘッドが問題になる。
When a large number of interrupt signals are asserted, software processing is started via processing by an interrupt handler. However, the overhead of processing by an interrupt handler poses a problem for software that needs to process an interrupt immediately. In addition, if it takes a large number of cycles from the setting of the event flag to the state where the task can be executed, the overhead of the event flag processing is required for software that needs to process the event flag immediately. It becomes a problem.

【0005】また、周期起動ハンドラを指定した場合、
CPUが他の処理を止めて、キューの探索やタイマの減
算を行う。この場合のプロセッサの負荷が問題になる。
また、複数のプロセッサを搭載し、OSやアプリケーシ
ョンを分担して処理する構成も考えられる。しかしなが
ら、一方のCPUから他のCPUを呼び出すシステムコ
ールの処理に多くのサイクルが割かれるため、効率よく
リアルタイムOSを実行させることが容易でない。一
方、既に紹介したハードウェア化されたOSは、これら
の具体的な問題を解決するまでには至っていない。
When a cyclic handler is specified,
The CPU stops other processing and searches for a queue or decrements a timer. In this case, the load on the processor becomes a problem.
Further, a configuration in which a plurality of processors are mounted and an OS and an application are shared and processed is also conceivable. However, since many cycles are required for processing a system call for calling one CPU from another CPU, it is not easy to efficiently execute the real-time OS. On the other hand, the hardware-based OS introduced above has not yet solved these specific problems.

【0006】[0006]

【課題を解決するための手段】本発明は以上の点を解決
するため次の構成を採用する。 〈構成1〉スケジューリングの対象となる各タスクの優
先度と優先度別順位を示す情報を記憶した記憶回路と、
この記憶回路に記憶された上記タスクの優先度と優先度
別順位のうちから、最も高い優先度のタスクの優先度を
読み出す回路と、読み出したタスクの優先度と実行中の
タスクの優先度とを比較する回路と、当該読み出した優
先度が実行中のタスクの優先度より高いときにプロセッ
サにタスク切り替えのための割り込み信号を出力する回
路とを含む割り込み信号出力用回路と、上記記憶回路か
ら読み出したタスクの優先度と、上記記憶回路に記憶さ
れた該当する優先度のタスクのうちの優先度別順位の高
いタスクの優先度別順位とを受け入れて、タスク切り替
えに使用するスタックポインタアドレスを生成するスタ
ックポインタアドレス生成用回路とを備えたことを特徴
とするリアルタイムOS装置。
The present invention employs the following structure to solve the above problems. <Structure 1> a storage circuit storing information indicating the priority of each task to be scheduled and the order of priority,
A circuit for reading out the priority of the task having the highest priority from the priorities and priorities of the tasks stored in the storage circuit, a priority of the read task, and a priority of the task being executed. And an interrupt signal output circuit including a circuit that outputs an interrupt signal for task switching to the processor when the read priority is higher than the priority of the task being executed. The priority of the read task and the priority of the higher priority task among the tasks of the corresponding priority stored in the storage circuit are accepted, and the stack pointer address used for task switching is set. A real-time OS device comprising: a stack pointer address generation circuit for generating the stack pointer address.

【0007】〈構成2〉構成1に記載のリアルタイムO
S装置において、上記スタックポインタアドレス生成用
回路は、上記割り込み信号出力用回路から、実行中のタ
スクの現優先度を受け入れて、実行中のタスクの退避用
スタックポインタアドレスを生成して出力し、プロセッ
サから退避完了信号が入力したとき、上記記憶回路から
新たに読み出したタスクの次優先度を受け入れて、新た
に実行されるタスクのスタックポインタアドレスを生成
して出力する信号合成回路を備えたことを特徴とするリ
アルタイムOS装置。
<Configuration 2> Real-time O described in Configuration 1
In the S device, the circuit for generating a stack pointer address receives the current priority of the task being executed from the circuit for outputting an interrupt signal, generates and outputs a stack pointer address for saving the task being executed, When a save completion signal is input from the processor, a signal synthesizing circuit that accepts the next priority of the task newly read from the storage circuit and generates and outputs a stack pointer address of the newly executed task is provided. A real-time OS device characterized by the above-mentioned.

【0008】〈構成3〉構成1に記載のリアルタイムO
S装置において、直前に退避したタスクまたは待ち状態
に遷移したタスクの優先度別順位を、優先度別に保持し
て、各タスクの優先度と優先度別順位を示す情報を記憶
した記憶回路から読み出した優先度ラインビットの一部
をマスクして、同一優先度でキューの先頭にあるタスク
を、次に実行するタスクとして選択するキュー制御回路
を備えたことを特徴とするリアルタイムOS装置。
<Configuration 3> Real-time O described in Configuration 1
In the S device, the priorities of the tasks saved immediately before or the tasks that have transited to the waiting state are retained by priority, and read from the storage circuit storing the priority of each task and information indicating the priority order. A real-time OS device comprising a queue control circuit for masking a part of the priority line bit and selecting a task at the head of the queue with the same priority as a task to be executed next.

【0009】〈構成4〉構成1に記載のリアルタイムO
S装置において、各タスクの優先度と優先度別順位を示
す情報を記憶した記憶回路に割り込み信号を記憶させた
ことを特徴とするリアルタイムOS装置。
<Configuration 4> Real-time O described in Configuration 1
A real-time OS device in the S device, wherein an interrupt signal is stored in a storage circuit that stores information indicating the priority of each task and the priority order.

【0010】〈構成5〉構成1に記載のリアルタイムO
S装置において、各タスクの優先度と優先度別順位を示
す情報を記憶した記憶回路に割り込み信号と割り込み信
号の有効性を示すイネーブルビットとを記憶させたこと
を特徴とするリアルタイムOS装置。
<Structure 5> Real-time O described in Structure 1
A real-time OS device in the S device, wherein an interrupt signal and an enable bit indicating the validity of the interrupt signal are stored in a storage circuit storing information indicating the priority of each task and the priority order.

【0011】〈構成6〉構成1に記載のリアルタイムO
S装置において、イベントフラグ待ち状態のタスクが存
在した場合に、各タスク毎の現状フラグパターンと待ち
フラグパターンとを含むイベントフラグ情報を記憶する
メモリと、上記現状フラグパターンと待ちフラグパター
ンとを比較する回路と、現状フラグパターンと待ちフラ
グパターンとが一致したとき、上記待ち状態のタスクを
実行可能状態に移すように、各タスクの優先度と優先度
別順位を示す情報を記憶した記憶回路の内容を書き換え
るデータと、書き込みアドレスを出力する回路を設けた
ことを特徴とするリアルタイムOS装置。
<Configuration 6> Real-time O described in Configuration 1
In the S device, when there is a task in the event flag waiting state, a memory storing event flag information including a current flag pattern and a waiting flag pattern for each task is compared with the current flag pattern and the waiting flag pattern. And a memory circuit storing information indicating the priority of each task and the priority order so that the task in the waiting state is shifted to the executable state when the current flag pattern and the waiting flag pattern match. A real-time OS device comprising a circuit for outputting data for rewriting the contents and a write address.

【0012】〈構成7〉構成1に記載のリアルタイムO
S装置において、周期起動ハンドラが存在した場合に、
各ハンドラ毎の残り時間と周期時間とを含む周期起動ハ
ンドラ情報を記憶するメモリと、上記現残り時間と周期
時間とを比較する回路と、現状フラグパターンと待ちフ
ラグパターンとが一致したとき、該当する周期起動ハン
ドラを実行可能状態に移すように、各タスクの優先度と
優先度別順位を示す情報を記憶した記憶回路の内容を書
き換えるデータと、書き込みアドレスを出力する回路を
設けたことを特徴とするリアルタイムOS装置。
<Configuration 7> Real-time O described in Configuration 1
In the S device, if a cyclically activated handler exists,
A memory for storing cyclically activated handler information including a remaining time and a cycle time for each handler, a circuit for comparing the current remaining time with the cycle time, and a circuit for determining whether a current flag pattern and a wait flag pattern match. A circuit for rewriting the contents of a storage circuit storing information indicating the priority of each task and the order of priority, and a circuit for outputting a write address, so as to shift the cyclically activated handler to an executable state. Real-time OS device.

【0013】〈構成8〉構成1に記載のリアルタイムO
S装置において、各タスクの優先度と優先度別順位を示
す情報を記憶した記憶回路に、各タスクの停止状態と実
行可能状態と待ち状態と実行状態とを区別する情報を含
めたことを特徴とするリアルタイムOS装置。
<Structure 8> Real-time O described in Structure 1
In the S device, the storage circuit storing information indicating the priority of each task and the order of priority includes information for distinguishing a stopped state, an executable state, a waiting state, and an execution state of each task. Real-time OS device.

【0014】[0014]

【発明の実施の形態】以下、本発明の実施の形態を具体
例を用いて説明する。 〈具体例1〉図1は、本発明による具体例1のリアルタ
イムOS装置を示すブロック図である。この装置は、リ
アルタイムOSの主処理であるタスクの切り替え処理を
ハードウェアを用いて高速に実行することを実現してい
る。この装置の具体的な構成や動作を説明する前に、ま
ずタスク管理のためのレディキューとウェイトキューに
ついての説明を行う。
DESCRIPTION OF THE PREFERRED EMBODIMENTS Embodiments of the present invention will be described below using specific examples. <Example 1> FIG. 1 is a block diagram showing a real-time OS device of Example 1 according to the present invention. This device realizes high-speed execution of task switching processing, which is the main processing of the real-time OS, using hardware. Before describing the specific configuration and operation of this device, a ready queue and a wait queue for task management will be described first.

【0015】図2は、一般的なレディキューの構成例説
明図である。ビットテーブル1は、予め設けられている
優先度の数、ここでは31個のビットを持ち、該当する
優先度に、一つでもタスクコントロールブロック(TC
B)がつながっている場合には“1”がたつ。タスクコ
ントロールブロック(TCB)が1つもつながっていな
い場合には“0”がたつようにセットされている。優先
度が最も高いビットは図の最上段である。ここでは、優
先度が2番目のビットのビットテーブル1に“1”が立
っている。また、ここにはいくつかのタスクコントロー
ルブロックTCBがつながっている。TCBはタスクを
特定し、各タスクをコントロールするためのブロックで
あり、スタッカアドレスやタスクの状態等、該当するタ
スクに関わる様々な情報を保持するブロックである。O
Sは、こうしてTCBを参照し、処理を要求しているタ
スクのうちの最も優先度の高いタスクを次に実行するタ
スクに選択する。
FIG. 2 is an explanatory diagram of a configuration example of a general ready queue. The bit table 1 has the number of priorities provided in advance, here 31 bits, and at least one task control block (TC
When B) is connected, "1" is added. If one task control block (TCB) is not connected, "0" is set. The bit with the highest priority is at the top of the figure. Here, “1” is set in the bit table 1 of the bit having the second priority. Here, several task control blocks TCB are connected. The TCB is a block for specifying a task and controlling each task, and is a block for holding various information related to the task such as a stacker address and a task state. O
S refers to the TCB in this way, and selects the task with the highest priority among the tasks requesting processing as the task to be executed next.

【0016】タスクキューテーブル1Aは、同一優先度
のタスクが複数有る場合に、各タスクを順番にキューに
収容するためのテーブルである。タスクキューテーブル
1Aには、先頭のTCBと末尾のTCBを表すアドレス
が保持される。このように鎖のようにつながっているタ
スクのことをタスクチェーンと呼ぶ。このレディキュー
につながれているTCBはいずれも実行可能状態にあ
る。最も優先度が高くてタスクキューテーブル1Aに最
も近いTCBから順番にタスクが実行される。
The task queue table 1A is a table for sequentially storing each task in a queue when there are a plurality of tasks having the same priority. The task queue table 1A holds addresses representing the first TCB and the last TCB. Tasks connected like a chain in this way are called task chains. All TCBs connected to the ready queue are in an executable state. Tasks are executed in order from the TCB having the highest priority and closest to the task queue table 1A.

【0017】図3には、一般的なウェイトキューの構成
例説明図を示す。ウェイトキューはイベント発生待ち状
態にあるTCBにつながれたキューである。ウェイトキ
ューポインタ3はイベント待ちのための先頭のTCBと
末尾のTCBを指すアドレスを保持する。このTCB
は、図2に示すTCBと同様のものである。各TCB
は、イベント待ち状態になるとレディキューからウェイ
トキューに移される。また、イベント待ち状態から実行
可能状態に遷移すると、ウェイトキューからレディキュ
ーの該当する優先度のチェーンの末尾につながれる。
FIG. 3 is an explanatory diagram of a configuration example of a general wait queue. The wait queue is a queue connected to the TCB in an event occurrence waiting state. The wait queue pointer 3 holds an address indicating the first TCB and the last TCB for waiting for an event. This TCB
Is similar to the TCB shown in FIG. Each TCB
Is moved from the ready queue to the wait queue when the system enters the event waiting state. When the state changes from the event wait state to the executable state, the wait queue is connected to the end of the chain of the corresponding priority of the ready queue.

【0018】通常は、図2に示す各TCBが優先度の高
い順であってタスクキューテーブル1Aに近い順に順番
に実行されていく。ここで、ウェイトキューにあったあ
るTCBが実行可能状態になると、その優先度に応じて
レディキューのいずれかのチェーンの該当部分の末尾に
接続される。このように、各タスクは、レディキューの
タスクキューテーブル1Aに示したアドレスに基づいて
並べられ、プロセッサはこの順番を参照しながらタスク
の切り替えを行う。この発明では、こうしたタスクの切
り替えをハードウェアによって実現して、プロセッサへ
のタスク切り替え処理のためのオーバーヘッドを軽減す
る。
Normally, the TCBs shown in FIG. 2 are executed in the order of priority and in the order of proximity to the task queue table 1A. Here, when a certain TCB in the wait queue enters an executable state, it is connected to the end of the corresponding portion of any chain of the ready queue according to its priority. As described above, the tasks are arranged based on the addresses shown in the task queue table 1A of the ready queue, and the processor switches tasks while referring to this order. In the present invention, such task switching is realized by hardware, and the overhead for task switching processing to the processor is reduced.

【0019】図4には、具体例1のリアルタイムOS装
置ブロック図を示す。図は、CPU4によって制御され
るRTOSコプロセッサ5、メインメモリ6、ワークメ
モリ7及びデコーダ8を備える。メインメモリ6には、
主にCPUが実行するアプリケーションソフトウェアの
プログラムやデータが記憶されている。RTOSコプロ
セッサ5は、リアルタイムOS装置を実現するためのハ
ードウェア化したコプロセッサである。このRTOSコ
プロセッサ5のシーケンサ制御は、ハードワイアードで
実現される。この図には、その制御のための主要な制御
線を示した。その内容は、後で図1を用いて説明する。
FIG. 4 is a block diagram of the real-time OS device of the first embodiment. The figure includes an RTOS coprocessor 5 controlled by a CPU 4, a main memory 6, a work memory 7, and a decoder 8. In the main memory 6,
It mainly stores application software programs and data executed by the CPU. The RTOS coprocessor 5 is a hardware coprocessor for realizing a real-time OS device. The sequencer control of the RTOS coprocessor 5 is realized by hard wired. This figure shows main control lines for the control. The contents will be described later with reference to FIG.

【0020】ワークメモリ7は、RTOSコプロセッサ
5が動作する場合に利用するワークメモリである。ここ
には、RTOSコプロセッサ5の生成するスタックポイ
ンタアドレスによりアクセスされるスタックポインタレ
ジスタが記憶される。その内容は後述する。デコーダ8
は、CPU4から出力されるアドレスMAをデコードし
て、メインメモリ6あるいはRTOSコプロセッサ5の
チップセレクト信号MMCSあるいはHRCSを生成す
る回路である。
The work memory 7 is a work memory used when the RTOS coprocessor 5 operates. Here, a stack pointer register accessed by a stack pointer address generated by the RTOS coprocessor 5 is stored. The contents will be described later. Decoder 8
Is a circuit that decodes an address MA output from the CPU 4 and generates a chip select signal MMCS or HRCS of the main memory 6 or the RTOS coprocessor 5.

【0021】CPU4とRTOSコプロセッサ5とメイ
ンメモリ6との間のデータ交換には、データバスMDと
アドレスバスMAが利用される。また、RTOSコプロ
セッサ5とワークメモリ7との間のデータのやり取り
は、アドレスバスWAと、データバスWD及びチップセ
レクト信号WMCSを用いて行われる。
For data exchange between the CPU 4, the RTOS coprocessor 5, and the main memory 6, a data bus MD and an address bus MA are used. The exchange of data between the RTOS coprocessor 5 and the work memory 7 is performed using the address bus WA, the data bus WD, and the chip select signal WMCS.

【0022】図1は、具体例1のリアルタイムOS装置
主要部ブロック図である。図の装置は、8×8ビット分
のデータを格納するビットマトリクス記憶部10、アド
レスレジスタ(ADR)11、プライオリティエンコー
ダ(PE)12、マルチプレクサ(MUX)18、優先
度レジスタ(PRIR)13、比較器14、デコーダ1
5、フリップフロップ16及びオアゲート17を備え
る。
FIG. 1 is a block diagram of a main part of a real-time OS device according to the first embodiment. The device shown in the figure is a bit matrix storage unit 10 for storing data of 8 × 8 bits, an address register (ADR) 11, a priority encoder (PE) 12, a multiplexer (MUX) 18, a priority register (PRIR) 13, Unit 14, decoder 1
5, a flip-flop 16 and an OR gate 17.

【0023】ビットマトリクス記憶部10には、丁度図
2に示したようなレディキューに該当する配列された情
報を格納する。縦方向は優先度であって、この例では0
から7までの8段階の優先度が設定されている。各優先
度毎に横方向にキュー配列が設けられる。同一の優先度
で左側のビットほど順位が高い。各タスクのスケジュー
リングのための情報は、それぞれ1ビットでいずれかの
マトリクス上に配置される。このビットが“0”の場合
にはイベント待ち状態あるいは休止状態を示し、“1”
の場合は実行可能状態を示す。
The bit matrix storage unit 10 stores information arranged just like a ready queue as shown in FIG. The vertical direction is the priority, and in this example, 0
8 to 7 are set. A queue arrangement is provided in the horizontal direction for each priority. Bits on the left with the same priority have higher rank. Information for scheduling each task is arranged in one matrix in one bit. When this bit is “0”, it indicates an event waiting state or a pause state, and “1”
Indicates an executable state.

【0024】なお、本発明では、待ち状態と休止状態と
を同じ内容のビット“0”で表してハードウェアの説明
を簡略化してある。もし、両者を区別する場合には状態
ビットを2ビットにすればよい。この場合には、“0
0”が休止状態、“00”が待ち状態、“10”が実行
可能状態というように表すことができる。優先度の数が
大きく、同じ優先度でも順位の高い図の左側にあるタス
クほど先に実行されることになる。
In the present invention, the description of the hardware is simplified by expressing the wait state and the sleep state with the same bit "0". If the two are to be distinguished, the status bits may be set to 2 bits. In this case, "0
A state of “0” indicates a suspended state, a state of “00” is a waiting state, and a state of “10” is an executable state. Will be executed.

【0025】アドレスレジスタ11は、ビットマトリク
ス記憶部10の各ビットをリードしあるいはライトする
ためのアドレスを一時保持するためのものである。ビッ
トマトリクス記憶部10のアドレスは6ビットで構成さ
れ、上位3ビットは優先度、下位3ビットは同一の優先
度での順位を表している。以下これを優先度別順位と呼
ぶ。プライオリティエンコーダ12は、それぞれの優先
度で実行可能状態になっているビットの論理和をとり、
8種類の優先度に関するビットの論理和を受け入れてエ
ンコードする回路である。即ち、ビットマトリクス記憶
部10中の実行可能状態にある最も高い優先度のタスク
を検出して、その優先度に関する情報を得るための回路
である。
The address register 11 is for temporarily storing an address for reading or writing each bit of the bit matrix storage unit 10. The address of the bit matrix storage unit 10 is composed of 6 bits, with the upper 3 bits indicating the priority and the lower 3 bits indicating the order of the same priority. Hereinafter, this is called a priority order. The priority encoder 12 performs an OR operation on the bits that are in an executable state at each priority,
This is a circuit that receives and encodes the logical OR of the eight types of priorities. That is, it is a circuit for detecting the highest priority task in the executable state in the bit matrix storage unit 10 and obtaining information on the priority.

【0026】プライオリティエンコーダ12の出力は4
ビットで、上位1ビットはプライオリティエンコーダ1
2の出力が有効か無効かを示すビットである。優先度7
の行にビットが立っていた場合には、出力は“111
1”になる。優先度0の行にビットが立っていた場合
は、出力は“1000”となる。どの優先度のビット列
にも“1”のビットが立っていない場合、出力は無効に
なり、“0000”となる。
The output of the priority encoder 12 is 4
Bits, the upper 1 bit is priority encoder 1
2 is a bit indicating whether the output is valid or invalid. Priority 7
If the bit is set in the row of, the output is “111”.
The output becomes "1000" if a bit is set in a row of priority 0. If no "1" bit is set in any of the priority bit strings, the output is invalid. , "0000".

【0027】優先度レジスタ13は、プライオリティエ
ンコーダ12の出力を一時的に保持するレジスタであ
る。このレジスタの内容は、CPU1が直前に実行して
いたタスクのコンテキスト退避を完了したときに更新さ
れる。即ち、退避完了信号TC入力以前は実行中のタス
クの優先度を保持し、退避完了信号TCが入力すると、
次に実行するタスクの優先度を保持するよう動作する。
なお、コンテキストとは、タスクが再起動するために必
要な様々なデータのことである。
The priority register 13 is a register for temporarily holding the output of the priority encoder 12. The contents of this register are updated when the context saving of the task executed immediately before by the CPU 1 is completed. That is, prior to the input of the save completion signal TC, the priority of the task being executed is held, and when the save completion signal TC is input,
It operates to keep the priority of the task to be executed next.
Note that the context is various data necessary for the task to restart.

【0028】比較器14は、プライオリティエンコーダ
12の出力と、優先度レジスタ13の出力とを比較し、
プライオリティエンコーダ12の出力が大きい場合には
“1”を出力する機能を持つ。これは、優先度レジスタ
13に記憶された現在実行中のタスクの優先度よりも高
い優先度のタスクが実行可能状態になり、ビットマトリ
クス記憶部10に書き込まれたとき、タスクを切り換え
るための割り込み信号を生成するためのものである。
The comparator 14 compares the output of the priority encoder 12 with the output of the priority register 13,
When the output of the priority encoder 12 is large, it has a function of outputting “1”. This is because when a task having a higher priority than the priority of the currently executing task stored in the priority register 13 becomes ready for execution and is written to the bit matrix storage unit 10, an interrupt for switching the task is executed. It is for generating a signal.

【0029】デコーダ15は、処理が終了してビットマ
トリクス記憶部10からクリアされるタスクの情報をデ
コードして、セルフクリア信号SCLを生成する回路で
ある。このデコーダ15は、処理中のタスクのアドレス
ADRNとアドレスレジスタ11にセットされたアドレ
スとが同一の場合であって、ビットマトリクス記憶部1
0の該当する部分に“0”をライトするようなライト要
求HRCSが入力したとき、セルフクリア信号SCLを
アサートする機能を持つ。これにより、実行中のタスク
を退避させるための割り込み信号が生成される。
The decoder 15 is a circuit that decodes task information that is cleared from the bit matrix storage unit 10 after processing is completed, and generates a self-clear signal SCL. This decoder 15 is used when the address ADRN of the task being processed and the address set in the address register 11 are the same, and the bit matrix storage 1
When a write request HRCS for writing “0” to a corresponding part of “0” is input, the self-clear signal SCL is asserted. As a result, an interrupt signal for saving the task being executed is generated.

【0030】フリップフロップ16は、セルフクリア信
号SCLから割り込み信号を生成する際、そのタイミン
グを取るために、セルフクリア信号を一時保持するフリ
ップフロップである。オアゲート17は、フリップフロ
ップ16の出力と比較器14の出力の論理和をとって、
割り込み信号INTを出力する回路である。この割り込
み信号INTは、CPU1に対してタスク切り替えを要
求するための割り込みに使用される。
The flip-flop 16 is a flip-flop that temporarily holds the self-clear signal in order to take timing when an interrupt signal is generated from the self-clear signal SCL. The OR gate 17 calculates the logical sum of the output of the flip-flop 16 and the output of the comparator 14, and
This is a circuit that outputs an interrupt signal INT. This interrupt signal INT is used for an interrupt for requesting the CPU 1 to switch tasks.

【0031】マルチプレクサ18は、プライオリティエ
ンコーダ12の出力する優先度に相当する情報を受け入
れて、ビットマトリクス記憶部10から該当する優先度
の1列分8個のビット(ここでは優先度ラインビットと
呼ぶ)を取り出す機能を持つ。この優先度ラインビット
LBとプライオリティエンコーダ12の出力する次優先
度NYと、優先度レジスタ13の出力する現優先度LY
とが、図のスタックポインタアドレス生成回路20に供
給され、ここで、タスク切り替えに必要な各タスクのス
タックポインタアドレスSPAが生成される。
The multiplexer 18 receives information corresponding to the priority output from the priority encoder 12, and from the bit matrix storage unit 10, eight bits for one column of the corresponding priority (herein referred to as priority line bits). ) Has a function to take out. This priority line bit LB, the next priority NY output from the priority encoder 12, and the current priority LY output from the priority register 13
Are supplied to the stack pointer address generation circuit 20 shown in the figure, where the stack pointer address SPA of each task required for task switching is generated.

【0032】図5には、スタックポインタアドレス生成
回路のブロック図を示す。この回路は、インバータ2
1、アンドゲート22,23、プライオリティエンコー
ダ24,25、マルチプレクサ28、オアゲート27、
優先度別順位レジスタ30、マルチプレクサ31、デコ
ーダ32、減算器33、マルチプレクサ34、オアゲー
ト35、順位レジスタ36、スタックポインタテーブル
レジスタ37及び加算器38を備える。
FIG. 5 is a block diagram of the stack pointer address generation circuit. This circuit uses inverter 2
1, AND gates 22, 23, priority encoders 24, 25, multiplexer 28, OR gate 27,
It includes a priority order register 30, a multiplexer 31, a decoder 32, a subtractor 33, a multiplexer 34, an OR gate 35, an order register 36, a stack pointer table register 37, and an adder 38.

【0033】優先度別順位レジスタ30は、それぞれ優
先度に対応する8種類の3ビットのデータを格納するこ
とができるレジスタである。このレジスタには、ある優
先度のある優先度別順位のタスクが退避したり、実行可
能状態からイベント待ち状態に切り替わったときに、そ
の優先度別順位に相当する3ビット分のデータを保持す
る機能を持つ。図2や図3を用いて説明したように、同
一優先度のタスクが複数あるときは、キューが形成され
る。キューが形成されるとそのキューの先頭に並んだタ
スクから順番に処理が開始される。そして、あるタスク
がイベント待ち状態になったときは、そのタスクの次に
並んだタスクがキューの先頭にくる。
The priority order register 30 is a register capable of storing eight types of 3-bit data corresponding to the respective priorities. In this register, when a task of a certain priority with a certain priority is saved or switched from the executable state to the event waiting state, data of three bits corresponding to the priority is held. Has functions. As described with reference to FIGS. 2 and 3, when there are a plurality of tasks having the same priority, a queue is formed. When a queue is formed, processing is started in order from the task arranged at the head of the queue. When a task enters the event waiting state, the task arranged next to the task comes to the head of the queue.

【0034】しかしながら、ビットマトリクス記憶部1
0の同一優先度の場所にある8個のビットは、それぞれ
所定のタスクと対応するように配置されており、例えば
その中の最も左側のタスクをいつもキューの先頭とみな
すと、右端に近いタスクはキューの先頭にくることがで
きなくなるおそれがある。ハードウェアにより上記のよ
うなキューを実現するには、例えば最初は一番左端のタ
スクをキューの先頭にし、そのタスクがイベント待ち状
態に遷移すると次は左から2番目のタスクをキューの先
頭にするといった制御が必要になる。しかも、このキュ
ーは優先度ごとに別々に制御する必要がある。
However, the bit matrix storage unit 1
The eight bits at the same priority location of 0 are arranged so as to correspond to the predetermined tasks. For example, if the leftmost task among them is always regarded as the head of the queue, the task closest to the right end May not be at the head of the queue. To implement the above queue by hardware, for example, the task at the left end is set to the head of the queue first, and when the task changes to the event waiting state, the task at the second from the left is set to the head of the queue. Control is required. Moreover, this queue needs to be controlled separately for each priority.

【0035】そこで、マルチプレクサ28は、イベント
待ち状態になったタスクの優先度別順位を出力し、減算
器33は、タスクがイベント待ち状態になったとき、キ
ューを1つ右側にずらす機能を持つ。タスクが退避した
場合にはキューはそのままだから減算器33は機能しな
い。次のキューの位置はこうした処理をした後の優先度
別順位を見れば分かる。優先度別順位レジスタはキュー
の位置を指定するための優先度別順位を全ての優先度に
ついて記憶しておくレジスタである。
Therefore, the multiplexer 28 outputs the priority order of the tasks in the event waiting state, and the subtractor 33 has a function to shift the queue one place to the right when the task enters the event waiting state. . When the task is saved, the queue remains unchanged, so that the subtracter 33 does not function. The position of the next queue can be determined by looking at the order of priority after such processing. The priority order register is a register for storing the priority order for specifying the position of the queue for all the priorities.

【0036】デコーダ32は、キューの位置を指定し
て、ビットマトリクス記憶部から読み出された優先度ラ
インビットからキューの先頭のタスクに相当する優先度
別順位を取り出すためのマスク情報を生成する。アンド
ゲート22、23は、このマスク情報によって、優先度
ラインビットの一部をマスクする機能を持つ。
The decoder 32 designates the position of the queue and generates mask information for extracting the priority order corresponding to the task at the head of the queue from the priority line bits read from the bit matrix storage unit. . The AND gates 22 and 23 have a function of masking a part of the priority line bit with the mask information.

【0037】具体的には、優先度別順位レジスタ30の
いずれかの優先度の優先度別順位がマルチプレクサ31
により選択されて、デコーダ32によりマスク情報に変
換される。このマスク情報はアンドゲート22と23に
入力する。アンドゲート22は、マスク情報をインバー
タ21で反転したものと、図1に示したマルチプレクサ
18の出力する優先度ラインビットLBとを受け入れ
て、その論理積をとる回路である。
More specifically, any one of the priorities in the priority register 30 is assigned to the multiplexer 31.
And converted by the decoder 32 into mask information. This mask information is input to AND gates 22 and 23. The AND gate 22 is a circuit that receives the inverted mask information by the inverter 21 and the priority line bit LB output from the multiplexer 18 shown in FIG.

【0038】アンドゲート23は、マスク情報と、図1
に示したマルチプレクサ18の出力する優先度ラインビ
ットLBとを受け入れて、その論理積をとる回路であ
る。プライオリティエンコーダ24は、アンドゲート2
2の出力をエンコードして、優先度ラインビットLBの
うちアンドゲート22でマスクされていない部分で最も
順位の高いビットを求める回路である。プライオリティ
エンコーダ25は、アンドゲート23の出力をエンコー
ドして、優先度ラインビットLBのうちアンドゲート2
3でマスクされていない部分で最も順位の高いビットを
求める回路である。
The AND gate 23 stores the mask information and FIG.
Is a circuit which receives the priority line bit LB output from the multiplexer 18 shown in FIG. The priority encoder 24 is an AND gate 2
2 is a circuit that encodes the output of No. 2 and obtains the highest-order bit in the portion of the priority line bit LB not masked by the AND gate 22. The priority encoder 25 encodes the output of the AND gate 23 and outputs the AND gate 2 of the priority line bits LB.
3 is a circuit for finding the highest-order bit in the portion not masked by 3.

【0039】マルチプレクサ28は、アンドゲート23
の出力の論理和をとるオアゲート27の出力によって制
御され、プライオリティエンコーダ24または25の出
力のうちのいずれかを選択して出力する回路である。ア
ンドゲート23の出力に1ビットでも“1”が含まれて
いる場合には、オアゲート27から“1”が出力され、
マルチプレクサ28はプライオリティエンコーダ25の
出力を選択して出力する。即ち、プライオリティエンコ
ーダ25の出力が常に優先して選択されるように構成さ
れている。このマルチプレクサ28の出力は、マルチプ
レクサ34に入力する。また、このマルチプレクサ28
の出力は、減算器33を介してマルチプレクサ34の別
の端子に入力する。
The multiplexer 28 includes the AND gate 23
This is a circuit controlled by the output of the OR gate 27 that takes the logical sum of the outputs of the priority encoders 24 and 25, and selects and outputs one of the outputs of the priority encoders 24 and 25. If even one bit contains “1” in the output of the AND gate 23, “1” is output from the OR gate 27,
The multiplexer 28 selects and outputs the output of the priority encoder 25. That is, the output of the priority encoder 25 is always selected with priority. The output of the multiplexer 28 is input to the multiplexer 34. The multiplexer 28
Is input to another terminal of the multiplexer 34 via the subtractor 33.

【0040】既に説明したように、優先度別順位レジス
タ30は、実行中のタスクが退避したり、イベント待ち
状態に切り替わったときに、その優先度別順位を保持す
る。優先度別順位は、優先度別に区別された記憶領域に
保持される。例えば、そのタスクの優先度が“6”の場
合には、L6の部分に優先度別順位が保持される。オア
ゲート35は、この優先度別順位レジスタ30に対し、
保持タイミングのための信号を出力する。オアゲート3
5には、タスク終了時に出力されるセルフクリア信号S
CLと、直前に実行されていたタスクの退避が終了した
とき出力される退避完了信号TCとが入力する。オアゲ
ート35は、タスク終了時も、タスクの退避が終了時
も、そのタイミングでマルチプレクサ34の出力が優先
度別順位レジスタに保持されるように制御信号を出力す
る。
As described above, the priority order register 30 holds the priority order when the task being executed is saved or switched to the event waiting state. The order of priority is held in a storage area that is differentiated by priority. For example, when the priority of the task is “6”, the priority order is held in the portion of L6. The OR gate 35 sends the priority order register 30
A signal for holding timing is output. OR gate 3
5 includes a self-clear signal S output at the end of the task.
CL and a save completion signal TC output when saving of the task executed immediately before is completed. The OR gate 35 outputs a control signal so that the output of the multiplexer 34 is held in the priority order register at the timing when the task is completed and when the task is completely saved.

【0041】優先度別順位レジスタ30の出力は、マル
チプレクサ31に入力する。マルチプレクサ31の出力
は、デコーダ32に入力する。マルチプレクサ31は、
次に実行されるタスクの優先度に相当する信号NYを、
図1に示した割り込み信号生成用の回路から受け入れ
て、優先度別順位レジスタ30の該当する優先度の記憶
領域から、優先度別順位に相当するデータを取り出す機
能を持つ。
The output of the priority order register 30 is input to the multiplexer 31. The output of the multiplexer 31 is input to the decoder 32. The multiplexer 31
A signal NY corresponding to the priority of the task to be executed next is
It has a function of taking out data corresponding to the priority order from the storage area of the corresponding priority in the priority order register 30 which is received from the interrupt signal generation circuit shown in FIG.

【0042】デコーダ32は、マルチプレクサ31の出
力する3ビットの優先度別順位に相当するデータを、8
ビットのマスク情報Mに変換する。例えば、取り出され
た優先度別順位が100すなわち4番の場合、マスク情
報は右から4個“1”が並びその他は0とする。即ち、
“00001111”になる。これで、8ビットの優先
度ラインビットをマスクすると、右側の4ビットだけが
アンドゲート23から出力される。そのうちの最も左側
の“1”を示すタスクが次のキューの先頭のタスクであ
る。すなわち、このマスク情報で右から4番目以下のタ
スクをキューの先頭にする処理が実現する。
The decoder 32 converts the data output from the multiplexer 31 corresponding to the 3-bit priority order into 8 bits.
It is converted into bit mask information M. For example, when the extracted priority order is 100, that is, No. 4, four pieces of mask information "1" are arranged from the right, and the others are set to 0. That is,
It becomes “000011111”. Thus, when the eight priority line bits are masked, only the right four bits are output from the AND gate 23. The task indicating “1” on the leftmost side is the first task in the next queue. That is, a process of setting the fourth or lower task from the right to the head of the queue is realized by the mask information.

【0043】ここで、もし、右側の4ビットに“1”が
含まれていなかったら、アンドゲート23の出力には、
次のタスクを示す情報が含まれていないことになる。そ
のときは、アンドゲート23の出力する信号中の最も左
側の“1”を示すタスクがキューの先頭になる。この切
り替えをオアゲート27が行っている。
Here, if "1" is not included in the right four bits, the output of the AND gate 23 includes:
No information indicating the next task is included. At that time, the task indicating “1” on the leftmost side of the signal output from the AND gate 23 is at the head of the queue. This switching is performed by the OR gate 27.

【0044】マルチプレクサ34は、セルフクリア信号
を受け入れたとき、減算器33の出力を選択する。その
他の場合には、マルチプレクサ28から直接入力する信
号を選択する。例えば、自らのタスクを休止状態(イベ
ント待ち状態等)にしたタスクは、ビットマトリクス記
憶部10の対応するビットを“0”にする。そして、こ
のときセルフクリア信号SCLが有効になり、マルチプ
レクサ34に入力する。これによって、マルチプレクサ
34は、優先度別順位を1だけデクリメントした値を出
力する。これが優先度別順位レジスタ30に記憶される
ことになる。従って、イベント待ち状態になったタスク
はマスク情報によって、キューの最後にまわる。
The multiplexer 34 selects the output of the subtracter 33 when receiving the self-clear signal. In other cases, a signal directly input from the multiplexer 28 is selected. For example, a task that has set its own task to a suspended state (such as an event waiting state) sets the corresponding bit in the bit matrix storage unit 10 to “0”. Then, at this time, the self-clear signal SCL becomes valid and is input to the multiplexer 34. As a result, the multiplexer 34 outputs a value obtained by decrementing the priority order by one. This is stored in the priority order register 30. Therefore, the task in the event waiting state is moved to the end of the queue by the mask information.

【0045】一方、図の右下側に設けられた順位レジス
タ36は、マルチプレクサ28から出力される優先度別
順位を保持するためのレジスタである。退避完了信号T
Cがアサートされると、この順位レジスタ36が、その
ときマルチプレクサ28から出力されている優先度別順
位を記憶する。スタックポインタテーブルレジスタ37
は、図4のワークメモリ7中に設けられたスタックポイ
ンタテーブルのトップを指すポインタを記憶するための
レジスタである。
On the other hand, the order register 36 provided on the lower right side of the figure is a register for holding the order of priority output from the multiplexer 28. Evacuation completion signal T
When C is asserted, the order register 36 stores the priority order output from the multiplexer 28 at that time. Stack pointer table register 37
Is a register for storing a pointer pointing to the top of the stack pointer table provided in the work memory 7 of FIG.

【0046】図6に、スタックポインタテーブルの構成
説明図を示す。図のワークメモリ2には、管理される各
タスクのスタックポインタが記憶されている。このスタ
ックポインタにより、タスクを再起動するための様々な
情報(コンテキスト)の格納場所が指示される。スタッ
クポインタの記憶領域は優先度順に区別され、同一の優
先度について、それぞれ8つの記憶領域が設けられてい
る。これらの記憶領域はビットマトリクス記憶部10に
記憶された全てのタスクの情報と対応している。ワーク
メモリ2中の各記憶領域のアドレスは、スタックポイン
タテーブルレジスタ37に記憶されたアドレスに優先度
と優先度別順位とを組み合わせた値を加算して求められ
る。
FIG. 6 is a view illustrative of the configuration of the stack pointer table. In the illustrated work memory 2, a stack pointer of each task to be managed is stored. The stack pointer indicates a storage location of various information (context) for restarting the task. The storage areas of the stack pointer are distinguished in order of priority, and eight storage areas are provided for the same priority. These storage areas correspond to information of all tasks stored in the bit matrix storage unit 10. The address of each storage area in the work memory 2 is obtained by adding a value obtained by combining the priority and the priority order to the address stored in the stack pointer table register 37.

【0047】図5の加算器38は、図1に示す回路から
出力される現優先度LYと順位レジスタ36に記憶され
た優先度別順位とを組み合わせた値を受け入れて、スタ
ックポインタテーブルレジスタ37に記憶されたアドレ
スと加算する機能を持つ。こうして、スタックポインタ
アドレスが生成される。スタックポインタテーブルに
は、既に初期段階で所定のプログラム開始アドレスが設
定されており、初めてスタックからのコンテキスト回復
処理が実行された場合においても、初期設定されたプロ
グラムが実行されるようにしてある。
The adder 38 shown in FIG. 5 receives a value obtained by combining the current priority LY output from the circuit shown in FIG. 1 with the priority order stored in the order register 36, and outputs the stack pointer table register 37 Has the function of adding the address stored in the memory. Thus, a stack pointer address is generated. A predetermined program start address is already set in the stack pointer table at an initial stage, and the initially set program is executed even when context recovery processing from the stack is executed for the first time.

【0048】即ち、順位レジスタ36と、スタックポイ
ンタテーブルレジスタ37と、加算器38によって、タ
スクを休止状態にした際、そのタスクのプログラム開始
アドレスを記憶するためのスタックポインタアドレスが
順番に生成される。
That is, when the task is put into the sleep state, the stack pointer address for storing the program start address of the task is sequentially generated by the order register 36, the stack pointer table register 37, and the adder 38. .

【0049】〈動作〉以下、上記の回路の具体的な動作
を説明する。図7には、タスクの初期値割り付け状況説
明図を示す。図の(a)は、各タスクのアドレスであ
る。タスクは、task0,task1,task2の
3種類が存在するものとする。そのビットマトリクス記
憶部10におけるアドレスは、図に示す6ビットの数値
で表させる。最初の、bは、これらのアドレスが2値表
示であることを示す記号である。また、6ビットの
“0”または“1”の数値の中間に設けたアンダースコ
アは、優先度と優先度別順位とを区別できるようにした
表示で、実質的な意味はない。
<Operation> The specific operation of the above circuit will be described below. FIG. 7 is an explanatory diagram of a task initial value allocation status. (A) of the figure is the address of each task. It is assumed that there are three types of tasks, task0, task1, and task2. The address in the bit matrix storage unit 10 is represented by a 6-bit numerical value shown in FIG. The first, b, is a symbol indicating that these addresses are in binary representation. Further, an underscore provided in the middle of the 6-bit numerical value of “0” or “1” is a display in which the priority and the priority order can be distinguished, and has no practical meaning.

【0050】(b)は、ビットマトリクス記憶部の内容
を示す。例えば、task0は、その上位3ビットか
ら、優先度は“6”である。また、下位3ビットから、
優先度別順位は“5”である。従って、ビットマトリク
ス記憶部の下から7番目で右から6番目に該当する位置
に“1”が立っている。他のタスクについても同様で、
合計3箇所に“1”のビットが立っている。なお、ここ
で、動作の説明を容易にするために、3つのシステムコ
ールを定義する。
(B) shows the contents of the bit matrix storage. For example, task0 has a priority of “6” from the upper three bits. Also, from the lower 3 bits,
The priority order is “5”. Therefore, "1" stands at the position corresponding to the seventh from the bottom and the sixth from the right from the bit matrix storage unit. The same is true for other tasks,
Bits of “1” are set at three places in total. Here, three system calls are defined to facilitate the description of the operation.

【0051】最初のシステムコールは、slp−tsk
(task−id)である。このシステムコールは、自
らのタスクを実行状態から待ち状態に遷移させるもので
ある。この動作は、ビットマトリクス上のtask−i
dに対応するビットを“0”にクリアする。ビットマト
リクス上の状態ビットは実行状態も実行可能状態も
“1”であって区別していない。
The first system call is slp-tsk
(Task-id). This system call changes its task from the execution state to the waiting state. This operation is performed by task-i on the bit matrix.
The bit corresponding to d is cleared to “0”. The status bits on the bit matrix are both "executable" and "executable", and are not distinguished.

【0052】次のシステムコールは、sus−tsk
(task−id)である。このシステムコールは、タ
スクを実行可能状態から待ち状態に遷移させるものであ
る。この動作は、ビットマトリクス上のtask−id
に対応するビットを“0”にクリアする。
The next system call is sus-tsk
(Task-id). This system call changes a task from an executable state to a wait state. This operation is performed by task-id on the bit matrix.
Is cleared to "0".

【0053】次のシステムコールは、rsm−tsk
(task−id)である。このシステムコールは、他
のタスクを待ち状態から実行可能状態に遷移させるもの
である。この動作は、ビットマトリクス上のtask−
idに対応するビットを“1”に設定する。
The next system call is rsm-tsk
(Task-id). This system call changes another task from the waiting state to the executable state. This operation is performed by task-
The bit corresponding to id is set to “1”.

【0054】いずれのシステムコールも、図1に示すア
ドレスレジスタ11に、該当するタスクID(task
−id)を設定し、実行状態あるいは実行可能状態の場
合は“1”、待ち状態の場合は“0”を書き込むように
動作する。
In each system call, the corresponding task ID (task) is stored in the address register 11 shown in FIG.
−id), and writes “1” in the execution state or the executable state, and writes “0” in the waiting state.

【0055】図8には、各タスクの内容とタスクの実行
順序説明図を示す。図の(a)〜(c)は、task〜
task2の内容を示している。なお、これらはいずれ
もシステムコールの部分のみ示しており、その他の部分
の表示は省略した。/*と*/とで挟まれた部分は、対
応する処理ステップを表示している。なお、この処理ス
テップは、図1及び図2に示した回路におけるハードウ
ェア上の状態変化であって、プログラムの処理ステップ
ではない。
FIG. 8 is a diagram for explaining the contents of each task and the execution order of the tasks. (A) to (c) of FIG.
The content of task2 is shown. Each of these shows only the part of the system call, and the other parts are not shown. The portion sandwiched between / * and * / indicates the corresponding processing step. This processing step is a hardware state change in the circuits shown in FIGS. 1 and 2, and is not a program processing step.

【0056】また、図の(d)は、タスクの実行順序を
示す。ここでは、例えばタスクが、それぞれtask0,ta
sk1,task2,task0,task2,task1の順で実行され
るものとする。以下、初期状態から順番に、図1と図5
に示した回路の動作を説明する。
FIG. 6D shows the task execution order. Here, for example, the tasks are task0, ta
sk1, task2, task0, task2, and task1 are executed in this order. Hereinafter, FIG. 1 and FIG.
The operation of the circuit shown in FIG.

【0057】[ステップS1]まず、始めに、図7に示
したような内容のデータが記憶されたビットマトリクス
記憶部10からプライオリティエンコーダ12が優先度
別のデータを受け入れ、論理和をとる。プライオリティ
エンコーダ12の入力は、“01001000”にな
り、最も高い優先度は右から6番目のビット(1番目は
0)だから、エンコーダ出力は、“1110”になる。
この最上位ビット“1”は、プライオリティエンコーダ
12の出力が有効であることを示している。右側の3ビ
ットが6番目を表している。
[Step S1] First, the priority encoder 12 receives data for each priority from the bit matrix storage unit 10 in which the data as shown in FIG. 7 is stored, and performs a logical sum. The input of the priority encoder 12 is “01001000”, and the highest priority is the sixth bit from the right (the first bit is 0), so the encoder output is “1110”.
The most significant bit “1” indicates that the output of the priority encoder 12 is valid. The three right bits represent the sixth.

【0058】優先度レジスタ13には、初期値“000
0”が記憶されている。比較器14は、プライオリティ
エンコーダ12の出力が優先度レジスタ13に記憶され
た値よりも大きいので、出力を“1”にする。オアゲー
ト17は、これを受け入れて、CPU4に対する割り込
み信号をアサートする。
The priority register 13 has an initial value “000”.
The comparator 14 sets the output to "1" because the output of the priority encoder 12 is larger than the value stored in the priority register 13. The OR gate 17 accepts this and outputs "1". Assert an interrupt signal to the CPU 4.

【0059】[ステップS2]マルチプレクサ18に
は、プライオリティエンコーダ12の出力する優先度に
相当するデータが入力する。従って、マルチプレクサ1
8は、優先度が6番目の優先度ラインビットLBを選択
して出力する。その内容は、図7(b)の6番目の横1
列に示したように、“00100000”となる。図5
に示すマルチプレクサ31は、プライオリティエンコー
ダ12の出力した優先度NYを受け入れて、これに該当
する優先度別順位のデータを優先度別順位レジスタ30
から取り出して出力する。その初期値は“111”に設
定されている。従って、デコーダ32は、“11111
111”というマスク情報を出力する。
[Step S 2] Data corresponding to the priority output from the priority encoder 12 is input to the multiplexer 18. Therefore, multiplexer 1
No. 8 selects and outputs the sixth priority line bit LB. The content is shown in the sixth row 1 in FIG.
As shown in the column, it becomes "00100000". FIG.
Receives the priority NY output from the priority encoder 12 and stores the data of the priority order corresponding thereto into the priority order register 30.
And output it. Its initial value is set to "111". Therefore, the decoder 32 outputs “11111
111 ”is output.

【0060】アンドゲート23は、デコーダ32の出力
がオール1であるから、マルチプレクサ18の出力する
優先度ラインビットとの論理積をとり、優先度ラインビ
ットLBの値をそのままプライオリティエンコーダ25
に出力する。一方、インバータ21は、デコーダ32の
出力を反転するから、アンドゲート22にはオール0の
信号と優先度ラインビットLBとが入力する。従って、
アンドゲート22の出力はオール0となる。
Since the output of the decoder 32 is all 1s, the AND gate 23 performs a logical AND operation with the priority line bit output from the multiplexer 18 and outputs the value of the priority line bit LB as it is to the priority encoder 25.
Output to On the other hand, since the inverter 21 inverts the output of the decoder 32, the signal of all 0 and the priority line bit LB are input to the AND gate 22. Therefore,
The output of the AND gate 22 is all 0s.

【0061】プライオリティエンコーダ25は、アンド
ゲート23の出力する8ビットの信号中の“1”が立っ
ているビットのうち最も上位のビットの位置を3ビット
の信号で表す。従って、5番目に“1”が立っている入
力を受け付けると、出力を“101”とする。これは、
即ち優先度別順位を3ビット2値の信号で表した値であ
る。
The priority encoder 25 indicates the position of the most significant bit of the 8-bit signal output from the AND gate 23 in which the "1" is set by a 3-bit signal. Therefore, when an input having a fifth “1” is received, the output is set to “101”. this is,
That is, the priority order is a value represented by a 3-bit binary signal.

【0062】一方、プライオリティエンコーダ24は同
様の動作を行うが、プライオリティエンコーダ24には
オール0の値が入力するため、プライオリティエンコー
ダ24の出力はオール0である。
On the other hand, the priority encoder 24 performs the same operation, but since the value of all 0 is input to the priority encoder 24, the output of the priority encoder 24 is all 0.

【0063】オアゲート27は、アンドゲート23の出
力中に1つでも“1”が含まれている場合、マルチプレ
クサ28がプライオリティエンコーダ25の出力を選択
するように制御する。従って、プライオリティエンコー
ダ25の出力がマルチプレクサ28に選択されて、マル
チプレクサ34に向けて出力される。こうして、この回
路は、図1に示したプライオリティエンコーダ12の出
力する優先度のタスクであって、その優先度別順位が最
も高い順位を示す値を3ビット2値の信号にして出力す
るように動作する。
The OR gate 27 controls the multiplexer 28 to select the output of the priority encoder 25 when at least one "1" is included in the output of the AND gate 23. Therefore, the output of the priority encoder 25 is selected by the multiplexer 28 and output to the multiplexer 34. In this way, this circuit is a task of the priority output from the priority encoder 12 shown in FIG. 1, and outputs the value indicating the highest priority order as a 3-bit binary signal. Operate.

【0064】[ステップS3]図1に示したオアゲート
17の出力する割り込み信号INTがアサートされる
と、図3に示したCPU4は、コンテキストの切り替え
を行う。このとき、CPU4は、新たなタスク立ち上げ
の際に初期化ルーチンを実行して、これまで実行してい
たタスクを再開するためのスタックの読み出しアドレス
を、図6に示すスタックポインタテーブルに退避する。
このスタックはコンテキストを格納しておくための領域
である。この例では、未だCPU4は、初期化ルーチン
を実行中であるから、この初期化ルーチンのコンテキス
トがスタックに退避される。
[Step S3] When the interrupt signal INT output from the OR gate 17 shown in FIG. 1 is asserted, the CPU 4 shown in FIG. 3 switches contexts. At this time, the CPU 4 executes the initialization routine when starting up a new task, and saves the stack read address for resuming the task that has been executed so far to the stack pointer table shown in FIG. .
This stack is an area for storing a context. In this example, since the CPU 4 is still executing the initialization routine, the context of the initialization routine is saved on the stack.

【0065】優先度レジスタ13には、“000”が記
憶されていた。また、順位レジスタ36にも初期値“0
00”が記憶されている。これらが組み合わされた“0
00000”という値と、スタックポインタテーブルレ
ジスタ37に記憶されたスタックポインタテーブルのア
ドレスとが加算器38で記憶される。こうして、スタッ
クポインタテーブルレジスタ37に記憶された、図6に
示すスタックポインタテーブルのトップを示すアドレス
に初期化ルーチンを再起動するためのスタックポインタ
が記憶される。
“000” was stored in the priority register 13. The initial value “0” is also stored in the order register 36.
00 ”. These are combined with“ 0 ”.
The value “00000” and the address of the stack pointer table stored in the stack pointer table register 37 are stored in the adder 38. Thus, the value of the stack pointer table shown in FIG. A stack pointer for restarting the initialization routine is stored at the address indicating the top.

【0066】CPU4によってこのような処理が実行さ
れると、CPU4から退避完了信号TCが出力される。
退避完了信号TCがアサートされると、優先度レジスタ
13にはプライオリティエンコーダ12から出力されて
いた次のタスクの優先度“110”が記憶される。ま
た、順位レジスタ36には、マルチプレクサ28の出力
する次のタスクの優先度別順位である“101”が記憶
される。
When such processing is executed by the CPU 4, the CPU 4 outputs a save completion signal TC.
When the save completion signal TC is asserted, the priority register 13 stores the priority “110” of the next task output from the priority encoder 12. The order register 36 stores “101”, which is the priority order of the next task output from the multiplexer 28.

【0067】一方、マルチプレクサ34は、通常、マル
チプレクサ28の出力する優先度別順位をそのまま選択
して出力するように動作している。退避完了信号TCが
アサートされると、オアゲート35を通じて優先度別順
位レジスタ30への書き込みが可能になる。また、その
書き込み位置は現優先度NYによって指定されている。
従って、優先度別順位レジスタ30のL6の部分に“1
01”という内容の優先度別順位が記憶される。
On the other hand, the multiplexer 34 operates so as to normally select and output the priority order output from the multiplexer 28 as it is. When the save completion signal TC is asserted, writing into the priority order register 30 through the OR gate 35 becomes possible. The writing position is specified by the current priority NY.
Therefore, "1" is added to the L6 portion of the priority order order register 30.
01 ”is stored.

【0068】同時に、退避完了信号TCがアサートされ
た段階で、加算器38には、優先度レジスタ13の出力
と順位レジスタ36の出力が組み合わされた信号が入力
する。加算器38は、スタックポインタテーブルレジス
タ37の出力にこれらの値を加算して、スタックポイン
タアドレスSPAを生成する。これによって、これから
動作をさせるタスクtask0のプログラムの先頭アド
レスを格納したスタックポインタテーブルの該当データ
を読み出すことが可能になる。
At the same time, when the save completion signal TC is asserted, a signal obtained by combining the output of the priority register 13 and the output of the order register 36 is input to the adder 38. The adder 38 adds these values to the output of the stack pointer table register 37 to generate a stack pointer address SPA. This makes it possible to read out the corresponding data in the stack pointer table storing the start address of the program of the task task0 to be operated.

【0069】[ステップS4]CPU4は、このスタッ
クポインタアドレスSPAを用いて、図6に示すスタッ
クポインタテーブルの該当するアドレスからスタックポ
インタを取り出して、タスクtask0の動作を開始さ
せる。タスクtask0は、実行途中で、システムコー
ルslp−tsk(task0−id)を実行すること
により、task0−idからビットマトリクス記憶部
10に記憶された自己のタスクを示すビットを0にクリ
アする。即ち、これによって自己のタスクを動作状態か
ら休止状態に移行する処理を実行する。
[Step S4] Using the stack pointer address SPA, the CPU 4 extracts the stack pointer from the corresponding address in the stack pointer table shown in FIG. 6, and starts the operation of the task task0. The task task0 executes the system call slp-tsk (task0-id) during execution, thereby clearing the bit indicating its own task stored in the bit matrix storage unit 10 from task0-id to 0. That is, a process of shifting the task from the operation state to the sleep state is thereby performed.

【0070】図1に示すデコーダ15は、このタスクの
アドレスと、ビットマトリクス記憶部10の該当箇所の
ビットを“0”にするためのデータを受け入れてデコー
ドし、セルフクリア信号SCLをアサートする。優先度
レジスタ13の最上位ビットは、このタイミングで
“0”に切り替えられる。また、図5に示すマルチプレ
クサ34にはセルフクリア信号SCLが入力し、マルチ
プレクサ34は減算器33の出力を選択して出力する。
The decoder 15 shown in FIG. 1 receives and decodes the address of this task and data for setting the bit of the corresponding portion of the bit matrix storage unit 10 to “0”, and asserts the self-clear signal SCL. The most significant bit of the priority register 13 is switched to "0" at this timing. The multiplexer 34 shown in FIG. 5 receives the self-clear signal SCL, and the multiplexer 34 selects and outputs the output of the subtracter 33.

【0071】オアゲート35は、セルフクリア信号SC
Lがアサートされると、優先度別順位レジスタ30の書
き込みを可能にする。従って、マルチプレクサ34から
出力される信号が該当するタスクの優先度即ちL6の部
分に記憶される。その内容は、“101”から“1”を
減算した“100”となる。これは、このタスクをキュ
ーの最後尾に移動するための処理である。
The OR gate 35 is connected to the self-clear signal SC
When L is asserted, the priority order register 30 can be written. Therefore, the signal output from the multiplexer 34 is stored in the priority of the corresponding task, that is, the portion of L6. The content is “100” obtained by subtracting “1” from “101”. This is processing for moving this task to the end of the queue.

【0072】[ステップS5]ビットマトリクス記憶部
10において、タスクtask0に相当するビットが
“0”にされたことによって、プライオリティエンコー
ダ12には“00001000”という信号が出力され
る。これによって、プライオリティエンコーダ12は、
実行待ち状態のタスクの最高の優先度が“3”であるこ
とを示す“1011”という信号を出力する。これが比
較器14に入力すると、比較器14は、優先度レジスタ
13に記憶された“0110”という値と比較する。優
先度レジスタ13の内容は既に無効化されており、プラ
イオリティエンコーダ12の出力の方が優先度レジスタ
13の出力よりも大きいから、比較器14は“1”を出
力する。これがオアゲート17に入力し、再び割り込み
信号INTがアサートされる。
[Step S 5] In the bit matrix storage unit 10, a signal “00001000” is output to the priority encoder 12 because the bit corresponding to the task task 0 is set to “0”. Thereby, the priority encoder 12
A signal “1011” indicating that the highest priority of the task in the execution waiting state is “3” is output. When this is input to the comparator 14, the comparator 14 compares the value with the value “0110” stored in the priority register 13. Since the contents of the priority register 13 have already been invalidated and the output of the priority encoder 12 is larger than the output of the priority register 13, the comparator 14 outputs "1". This is input to the OR gate 17, and the interrupt signal INT is asserted again.

【0073】[ステップS6]マルチプレクサ18に
は、“011”という信号がプライオリティエンコーダ
12から入力し、マルチプレクサ18は、ビットマトリ
クス記憶部10から該当する優先度の優先度ラインビッ
トLBを取り出して出力する。プライオリティエンコー
ダ12から出力される次優先度NYに相当する信号は、
図5に示すマルチプレクサ31に入力する。これによっ
て、優先度別順位レジスタ30のL3に相当する部分か
ら、初期値である“111”というデータが読み出さ
れ、マルチプレクサ31を通じてデコーダ32に入力す
る。
[Step S 6] A signal “011” is input from the priority encoder 12 to the multiplexer 18, and the multiplexer 18 extracts and outputs the priority line bit LB of the corresponding priority from the bit matrix storage unit 10. . The signal output from the priority encoder 12 and corresponding to the next priority NY is:
The signal is input to the multiplexer 31 shown in FIG. As a result, the data “111”, which is the initial value, is read from the portion corresponding to L3 of the priority order register 30 and is input to the decoder 32 through the multiplexer 31.

【0074】デコーダ32は、前に説明した通り、初期
状態ではオール1の信号をマスク情報として出力する。
その結果、アンドゲート23からマルチプレクサ18へ
の出力する優先度ラインビットLBが、そのままプライ
オリティエンコーダ25に向けて出力される。アンドゲ
ート22は、全ての入力信号を阻止し、プライオリティ
エンコーダ24にはオール0の値が入力する。オアゲー
ト27は、マルチプレクサ28を制御し、プライオリテ
ィエンコーダ25の出力を出力させる。その結果、マル
チプレクサ28からは“111”という優先度別の順位
が出力される。
As described above, the decoder 32 outputs an all-one signal as mask information in the initial state.
As a result, the priority line bit LB output from the AND gate 23 to the multiplexer 18 is output directly to the priority encoder 25. The AND gate 22 blocks all input signals, and a value of all 0 is input to the priority encoder 24. The OR gate 27 controls the multiplexer 28 to output the output of the priority encoder 25. As a result, the multiplexer 28 outputs an order of priority "111".

【0075】[ステップS7]図4に示したCPU4
は、task0のときと同様にコンテキストの切り替え
を行う。即ち、CPU4は、task0再開用のスタッ
クポインタアドレスを、図6に示したスタックポインタ
テーブルの該当するアドレスに退避する。その退避後、
退避完了信号TCが出力されると、加算器38では新た
な優先度と優先度別順位に基づいて、次のタスクのスタ
ックポインタアドレスが計算される。即ち、優先度レジ
スタ13には、“1011”という優先度を示す信号が
記憶され、順位レジスタ36には“110”という信号
が記憶される。
[Step S7] CPU 4 shown in FIG.
Performs context switching as in the case of task0. That is, the CPU 4 saves the stack pointer address for resuming the task 0 to the corresponding address in the stack pointer table shown in FIG. After that evacuation,
When the save completion signal TC is output, the adder 38 calculates the stack pointer address of the next task based on the new priority and the priority order. That is, a signal indicating the priority “1011” is stored in the priority register 13, and a signal “110” is stored in the priority register 36.

【0076】図9に、task0のシステムコールのタ
イミングチャートを示す。上記のステップ1〜ステップ
S8までの処理は、このようなタイミングで実行され
る。(a)はシステムクロックである。システムクロッ
クのt0のタイミングで、図1に示した回路のアドレス
MAとデータMDとが有効になる。このアドレスは、ア
ドレスレジスタADR11から出力される信号である。
次のt1のタイミングで、ライト要求HRCSが有効に
なり、この信号と“0”のデータとを受け入れて、デコ
ーダ15がセルフクリア信号SCLを1クロック分有効
にする。
FIG. 9 is a timing chart of the system call task0. The above-described steps 1 to S8 are executed at such timing. (A) is a system clock. At time t0 of the system clock, the address MA and the data MD of the circuit shown in FIG. 1 become valid. This address is a signal output from the address register ADR11.
At the next timing t1, the write request HRCS becomes valid, and this signal and data of "0" are accepted, and the decoder 15 makes the self-clear signal SCL valid for one clock.

【0077】ここで、フリップフロップ16がこのセル
フクリア信号を受け入れ、次のクロック即ちt2のタイ
ミングで、オアゲート17に対しセルフクリア信号の内
容を出力する。従って、t2のタイミングで割り込み信
号intがアサートされる。プロセッサ4は、割り込み
信号intがアサートされると、優先度レジスタ13の
最上位ビット即ち有効ビットを“1”から“0”にクリ
アする。そして、優先度別順位レジスタ30はこのt2
のタイミングで、直前に記憶していたタスクの優先度別
順位を新たなタスクの優先度別順位に書き替える。
Here, the flip-flop 16 receives the self-clear signal, and outputs the content of the self-clear signal to the OR gate 17 at the next clock, that is, at the timing of t2. Therefore, the interrupt signal int is asserted at the timing of t2. When the interrupt signal int is asserted, the processor 4 clears the most significant bit, that is, the valid bit of the priority register 13 from “1” to “0”. Then, the priority order register 30 stores this t2
At the timing of, the priority order of the task stored immediately before is rewritten to the priority order of the new task.

【0078】こうして、タイミングt2以降、CPU4
は、図5に示す加算器38の出力するスタックポインタ
アドレスを参照して、直前まで有効であったタスクのコ
ンテキストを退避する処理を実行する。退避処理が完了
すると、tnのタイミングで退避完了信号が1クロック
分だけ有効にされる。
Thus, after the timing t2, the CPU 4
Executes the process of saving the context of the task that was valid until immediately before with reference to the stack pointer address output from the adder 38 shown in FIG. When the save processing is completed, the save completion signal is made valid for one clock at the timing of tn.

【0079】こうして、優先度レジスタ13には、新た
なタスクの優先度に相当するデータが記憶される。ま
た、加算器38からは新たなタスクのためのスタックポ
インタアドレスが出力される。更に、優先度別順位レジ
スタ30には、新たなタスクの優先度別の順位が記憶さ
れる。こうして、タイミングtn+1以降、新たなタス
クが実行される。上記のようにして、タスクの切り替え
が全てハードウェアを用いて実現される。
Thus, the priority register 13 stores data corresponding to the priority of a new task. The adder 38 outputs a stack pointer address for a new task. Further, the priority order register 30 stores a priority order of a new task. Thus, a new task is executed after the timing tn + 1. As described above, all task switching is realized using hardware.

【0080】[ステップS8]次に、タスクtask1
への切り替わり後の動作を説明する。まず、CPU4
は、加算器38から出力された新たなタスクのスタック
ポインタアドレスを用いて、ワークメモリからコンテキ
ストを取り出す。そして、新たなタスクtask1の動
作を開始させる。このタスクtask1の実行中、シス
テムコールslp−tsk(task1−id)が実行
される。task1−idでは、ビットマトリクス記憶
部10のタスクtask1に該当するビットを“0”に
クリアする。
[Step S8] Next, the task task1
The operation after switching to is described. First, CPU4
Extracts the context from the work memory using the stack pointer address of the new task output from the adder 38. Then, the operation of the new task task1 is started. During the execution of this task task1, the system call slp-tsk (task1-id) is executed. In task1-id, the bit corresponding to task task1 in the bit matrix storage unit 10 is cleared to "0".

【0081】デコーダ15は、このタイミングで、セル
フクリア信号SCLをアサートする。マルチプレクサ2
8は、このタスクの優先度別順位を出力しているが、こ
れが減算器33で“1”だけデクリメントされて、マル
チプレクサ34を通じて優先度別順位レジスタ30に記
憶される。この記憶場所はL3となる。記憶されるデー
タは、“101”である。
The decoder 15 asserts the self-clear signal SCL at this timing. Multiplexer 2
Numeral 8 outputs the priority order of this task, which is decremented by “1” by the subtracter 33 and stored in the priority order register 30 through the multiplexer 34. This storage location is L3. The stored data is “101”.

【0082】[ステップS9]上記のシステムコールに
よって、ビットマトリクス記憶部10のタスクtask
1に相当するビットが“0”にクリアされる。次のタス
クであるtask2の優先度はtask1と同じ“3”
である。従って、プライオリティエンコーダ12は、こ
れまでと同様の“1101”という信号を出力する。マ
ルチプレクサ18は、この優先度に応じたビット列“0
0001000”を取り出し、優先度ラインビットLB
とする。
[Step S9] The task task of the bit matrix storage unit 10 is executed by the above-described system call.
The bit corresponding to 1 is cleared to "0". The priority of task 2 which is the next task is “3” which is the same as task 1
It is. Therefore, the priority encoder 12 outputs the same signal as “1101” as before. The multiplexer 18 outputs a bit string “0” corresponding to the priority.
0001000 "and the priority line bit LB
And

【0083】[ステップS10]同時に、優先度別順位
レジスタ30の優先度“011”の部分に記憶された信
号がマルチプレクサ31を通じて出力される。この優先
度別順位レジスタ30のL3に相当する部分には、直前
のタスクによって“101”というデータが記憶されて
いる。これが取り出されると、デコーダ32は、マスク
情報“00111111”を出力する。アンドゲート2
3には、デコーダ32からこのマスク情報が入力し、マ
ルチプレクサ18から“00001000”という内容
の優先度ラインビットLBが入力する。
[Step S 10] At the same time, the signal stored in the priority “011” portion of the priority order register 30 is output through the multiplexer 31. In the portion corresponding to L3 of the priority order register 30, data "101" is stored by the immediately preceding task. When this is extracted, the decoder 32 outputs the mask information “00111111”. AND Gate 2
3, the mask information is input from the decoder 32, and the priority line bit LB having the content “00001000” is input from the multiplexer 18.

【0084】右から6個のビットのうち最も左の、
“1”のビットは、優先度別順位が4番目であるから、
“011”という信号がプライオリティエンコーダ25
から出力される。オアゲート27の出力は“1”である
から、マルチプレクサ28は、この優先度別順位に相当
する信号を出力する。
The leftmost of the six bits from the right,
Since the bit of “1” has the fourth priority order,
The signal “011” is transmitted to the priority encoder 25
Output from Since the output of the OR gate 27 is “1”, the multiplexer 28 outputs a signal corresponding to the priority order.

【0085】[ステップS11]ここで、CPU4によ
るスタックの退避が行われ、退避完了信号TCがアサー
トされる。この退避完了信号TCがアサートされると、
順位レジスタ36にこの順位“011”が記憶される。
同時に優先度別順位レジスタ30のL3部分にこの順位
“011”が記憶される。加算器38は、スタックポイ
ンタテーブルレジスタ37の出力と、順位レジスタ36
の出力と、優先度レジスタ13の出力とを加算して、ス
タックポインタアドレスを生成し、出力する。
[Step S11] Here, the stack is saved by the CPU 4, and the save completion signal TC is asserted. When the save completion signal TC is asserted,
The order “011” is stored in the order register 36.
At the same time, the order “011” is stored in the L3 portion of the priority order register 30. The adder 38 outputs the output of the stack pointer table register 37 and the order register 36
Is added to the output of the priority register 13 to generate and output a stack pointer address.

【0086】[ステップS12]CPU4は、このスタ
ックポインタアドレスSPAを用いて、ワークメモリ2
のスタックポインタテーブルをアクセスする。こうし
て、ワークメモリからタスクtask2のスタックポイ
ンタアドレスを取り出して、このタスクを実行させる。
図8の(c)において、このタスクtask2は、実行
中にシステムコールrsm−tsk(task1−i
d)を実行し、task1−idからビットマトリクス
記憶部10の対応するビットを“1”に設定する。
[Step S12] The CPU 4 uses the stack pointer address SPA to store the work memory 2
To access the stack pointer table. In this way, the stack pointer address of the task task2 is extracted from the work memory, and this task is executed.
In FIG. 8C, the task task2 is a system call rsm-tsk (task1-i) during execution.
d) is executed, and the corresponding bit of the bit matrix storage unit 10 is set to "1" from task1-id.

【0087】ところが、ビットマトリクス記憶部10の
対応するビットが“1”に設定されても、プライオリテ
ィエンコーダ12の出力は変わらない。その結果、比較
器14の出力も変わらないので、割り込み信号INTは
アサートされない。従って、タスクtask2は、シス
テムコール(rsm−tsk)を実行した後、そのまま
処理を継続する。
However, even if the corresponding bit in the bit matrix storage unit 10 is set to "1", the output of the priority encoder 12 does not change. As a result, the output of the comparator 14 does not change, so that the interrupt signal INT is not asserted. Therefore, the task 2 executes the system call (rsm-tsk), and then continues the processing.

【0088】[ステップS13]タスクtask2は、
実行途中でシステムコールrsm−tsk(task0
−id)を実行する。これにより、task0−idか
らビットマトリクス記憶部10の対応するビットを
“1”に設定する処理が行われる。プライオリティエン
コーダ12の出力は、その結果、“1110”となる。
これは、図7(a)に示した各タスクのアドレス通りで
ある。比較器14は、これまでタスクtask2の優先
度である“1011”を保持していた。従って、比較器
14は、プライオリティエンコーダ12の出力する信号
が大きいとして、“1”を出力する。こうして、オアゲ
ート17から割り込み信号INTが出力されアサートさ
れる。
[Step S13] The task task2 is
During execution, the system call rsm-tsk (task0
Perform id). As a result, a process of setting the corresponding bit of the bit matrix storage unit 10 from “task0-id” to “1” is performed. As a result, the output of the priority encoder 12 becomes “1110”.
This is according to the address of each task shown in FIG. The comparator 14 holds “1011” which is the priority of the task task2. Therefore, the comparator 14 outputs “1” assuming that the signal output from the priority encoder 12 is large. Thus, the interrupt signal INT is output from the OR gate 17 and asserted.

【0089】[ステップS14]マルチプレクサ18
は、プライオリティエンコーダ12の出力に従って、ビ
ットマトリクス記憶部10から該当する優先度ラインビ
ットLBを取り出す。この内容は“00100000”
となる。マルチプレクサ31は、優先度別順位レジスタ
30の優先度がL6の部分からこれまで記憶されていた
優先度別順位“100”を取り出してデコーダ32に供
給する。この内容は4だから、デコーダ32は、下位4
+1ビットが1となる“00011111”というマス
ク情報を生成する。
[Step S14] Multiplexer 18
Extracts the corresponding priority line bit LB from the bit matrix storage unit 10 in accordance with the output of the priority encoder 12. This content is “00100000”
Becomes The multiplexer 31 extracts the priority order “100” stored so far from the portion of the priority order register 30 where the priority is L6 and supplies it to the decoder 32. Since this content is 4, the decoder 32
The mask information “00011111” in which the +1 bit becomes 1 is generated.

【0090】アンドゲート23は、優先度ラインビット
LBとデコーダ32の出力の論理積をとる。これによっ
て、プライオリティエンコーダ25の出力は“101”
となる。このデコーダ32の信号は、アンドゲート23
において、優先度ラインビットLBの上位3ビットをマ
スクする。従って、アンドゲート23の出力はオール0
となる。オアゲート27は、その結果、出力を“0”と
し、マルチプレクサ28は、プライオリティエンコーダ
24の出力を選択するよう動作する。
The AND gate 23 takes the logical product of the priority line bit LB and the output of the decoder 32. As a result, the output of the priority encoder 25 becomes "101".
Becomes The signal of the decoder 32 is supplied to the AND gate 23.
, The upper three bits of the priority line bit LB are masked. Therefore, the output of the AND gate 23 is all 0
Becomes As a result, the OR gate 27 sets the output to “0”, and the multiplexer 28 operates to select the output of the priority encoder 24.

【0091】アンドゲート22には、マスク情報が反転
された信号と優先度ラインビットLBとが入力する。こ
れによって、アンドゲート22からは優先度ラインビッ
トLBの上位3ビットが有効になったデータ即ち“00
100000”という出力が得られる。これがプライオ
リティエンコーダ24によってエンコードされる。ビッ
ト位置は5番目にあるから、プライオリティエンコーダ
24は、“101”を出力する。その結果、マルチプレ
クサ28の出力は“101”となる。
The AND gate 22 receives the inverted signal of the mask information and the priority line bit LB. As a result, from the AND gate 22, the upper three bits of the priority line bit LB become valid data, ie, "00".
100000 "is obtained. This is encoded by the priority encoder 24. Since the bit position is at the fifth position, the priority encoder 24 outputs" 101 ". As a result, the output of the multiplexer 28 becomes" 101 ". Become.

【0092】[ステップS15]ステップS3と同様に
して、退避処理が行われ、退避完了信号がアサートされ
ると、優先度レジスタ13には、“110”が記憶され
る。また、順位レジスタ36には、マルチプレクサ28
から出力された“101”の信号が記憶される。この信
号は、これまでと同様の要領でマルチプレクサ34を通
じて優先度別順位レジスタ30の該当部分即ちL6の部
分に記憶される。加算器38は、スタックポインタテー
ブルレジスタ37の出力に、優先度レジスタ13の出力
と順位レジスタ36の出力を含めたものを加算し、スタ
ックポインタアドレスを出力する。
[Step S15] Similar to step S3, the saving process is performed. When the saving completion signal is asserted, "110" is stored in the priority register 13. The order register 36 includes the multiplexer 28
The signal of “101” output from is stored. This signal is stored in the corresponding portion of the priority order register 30, that is, the portion of L 6 through the multiplexer 34 in the same manner as before. The adder 38 adds the output of the priority register 13 and the output of the order register 36 to the output of the stack pointer table register 37, and outputs a stack pointer address.

【0093】[ステップS16]CPU4は、スタック
ポインタアドレスSPAを使用して、ワークメモリ2の
スタックポインタテーブルから新たなタスクのスタック
ポインタを取り出す。次に起動するタスクは、タスクt
ask0である。即ち、以前に中断をしていたタスクt
ask0を再開させる処理を実行する。タスクtask
0は最後まで実行され、その最後の段階でシステムコー
ルslp−tsk(task0−id)を実行する。こ
れによって、task0−idからビットマトリクス記
憶部10の対応するビットを“0”にクリアする動作が
実行される。同時に、優先度レジスタ13の上位1ビッ
トが“0”にクリアされ、優先度レジスタ13の内容は
“0110”となる。
[Step S16] Using the stack pointer address SPA, the CPU 4 extracts a stack pointer of a new task from the stack pointer table of the work memory 2. The next task to start is task t
Ask0. That is, the task t which was interrupted before
A process for restarting ask0 is executed. Task task
0 is executed to the end, and the system call slp-tsk (task0-id) is executed at the last stage. As a result, the operation of clearing the corresponding bit of the bit matrix storage unit 10 from “task0-id” to “0” is performed. At the same time, the upper one bit of the priority register 13 is cleared to “0”, and the content of the priority register 13 becomes “0110”.

【0094】[ステップS17]ビットマトリクス記憶
部10では、タスクtask0に相当するビットが
“0”にクリアされる。これによって、プライオリティ
エンコーダ12は、優先度が“3”を表す“011”を
出力する。比較器14は、優先度レジスタ13の出力よ
りもプライオリティエンコーダ12の出力が大きくなっ
たことから、オアゲート17に対し“1”の信号を出力
する。こうして、再び割り込み信号INTがアサートさ
れる。
[Step S17] In the bit matrix storage section 10, the bit corresponding to task task0 is cleared to “0”. As a result, the priority encoder 12 outputs “011” indicating that the priority is “3”. The comparator 14 outputs a “1” signal to the OR gate 17 because the output of the priority encoder 12 is larger than the output of the priority register 13. Thus, the interrupt signal INT is asserted again.

【0095】[ステップS18]マルチプレクサ18
は、プライオリティエンコーダ12の出力する優先度
“011”に従って、ビットマトリクス記憶部10から
対応する優先度ラインビットLBを取り出す。同時に、
優先度別順位レジスタ30の該当する優先度“011”
に応じた出力即ちL3に記憶されていた順位がマルチプ
レクサ31によって選択される。優先度別順位レジスタ
のL3部分には順位“011”が記憶されていた。これ
は、ステップS11で実行された結果である。
[Step S18] Multiplexer 18
Extracts the corresponding priority line bit LB from the bit matrix storage unit 10 according to the priority “011” output from the priority encoder 12. at the same time,
The corresponding priority “011” of the priority order register 30
, That is, the order stored in L3 is selected by the multiplexer 31. The order “011” was stored in the L3 part of the priority order register. This is the result of the execution in step S11.

【0096】従って、デコーダ32において、右から4
個だけ1になるマスク情報“00001111”が生成
される。このマスク情報は、丁度アンドゲート23にお
いて、上位4ビットをマスクし、アンドゲート22にお
いて、下位4ビットをマスクする内容になる。その結
果、プライオリティエンコーダ25からは、タスクta
sk2の順位に相当する“011”が出力される。ま
た、プライオリティエンコーダ24からはタスクtas
k1の順位に相当する“110”が出力される。オアゲ
ート27の出力は“1”となるから、マルチプレクサ2
8は、プライオリティエンコーダ25の出力する信号を
“011”を選択して出力する。
Therefore, in the decoder 32, 4
The mask information “000011111” that becomes “1” only is generated. This mask information has the contents of masking the upper 4 bits in the AND gate 23 and masking the lower 4 bits in the AND gate 22. As a result, from the priority encoder 25, the task ta
“011” corresponding to the rank of sk2 is output. Also, the task tas is output from the priority encoder 24.
“110” corresponding to the rank of k1 is output. Since the output of the OR gate 27 becomes “1”, the multiplexer 2
8 selects and outputs “011” as the signal output from the priority encoder 25.

【0097】[ステップS19]ステップS3と同様に
してスタックの退避が行われ、退避完了信号TCがアサ
ートされる。この退避完了信号によって、順位レジスタ
36には、マルチプレクサ28の出力した“011”と
いう信号が記憶される。更に、優先度別順位レジスタ3
0の該当するL3のレジスタに“011”の信号が記憶
される。加算器38は、スタックポインタテーブルレジ
スタ37の出力と、優先度レジスタ13の出力と、順位
レジスタ36の出力によって、スタックポインタアドレ
スを生成する。
[Step S19] The stack is saved as in step S3, and the save completion signal TC is asserted. The signal “011” output from the multiplexer 28 is stored in the order register 36 by the save completion signal. Furthermore, priority order register 3
The signal of “011” is stored in the register of L3 corresponding to “0”. The adder 38 generates a stack pointer address based on the output of the stack pointer table register 37, the output of the priority register 13, and the output of the order register 36.

【0098】[ステップS20]CPU4は、加算器3
8の出力するスタックポインタアドレスを利用して、ワ
ークメモリ2をアクセスする。そして、CPU2は、ス
タックポインタテーブルの該当するアドレスからスタッ
クポインタを取り出して、途中で実行を中断していたタ
スクtask2の実行を再開させる。タスクtask2
は、処理を終了する直前で、システムコールslp−t
sk(task−id)を実行する。これにより、ta
sk2−idからビットマトリクス記憶部10の対応す
るビットを“0”にクリアする処理を実行する。同時
に、セルフクリア信号SCLがデコーダ15から出力さ
れる。
[Step S20] The CPU 4 determines whether the adder 3
The work memory 2 is accessed using the stack pointer address output from the memory 8. Then, the CPU 2 retrieves the stack pointer from the corresponding address in the stack pointer table, and resumes the execution of the task task2 whose execution has been suspended halfway. Task task2
Is a system call slp-t immediately before the end of the processing.
Execute sk (task-id). Thereby, ta
A process of clearing the corresponding bit of the bit matrix storage unit 10 from “sk2-id” to “0” is executed. At the same time, the self-clear signal SCL is output from the decoder 15.

【0099】これにより、マルチプレクサ28が出力す
る信号が減算器33でデクリメントされた値がマルチプ
レクサ34を通じて優先度別順位レジスタ30に向け出
力される。そして、この値“010”が優先度別順位レ
ジスタ30のL3部分に記憶される。
As a result, the signal output from the multiplexer 28 is decremented by the subtracter 33, and the value is output to the priority order register 30 through the multiplexer 34. Then, this value “010” is stored in the L3 portion of the priority order register 30.

【0100】[ステップS21]ビットマトリクス記憶
部10では、タスクtask2に相当するビットが
“0”にクリアされている。しかしながら、同一の優先
度に相当する部分にはタスクtask1に相当するビッ
トが格納されており、プライオリティエンコーダ12の
出力は“1011”のままである。比較器14では、比
較結果を出力する。即ち、このプライオリティエンコー
ダの出力“1011”と、優先度レジスタ13の出力
“0011”を比較する。
[Step S21] In the bit matrix storage section 10, the bit corresponding to task task2 is cleared to "0". However, a bit corresponding to task task1 is stored in a portion corresponding to the same priority, and the output of the priority encoder 12 remains "1011". The comparator 14 outputs a comparison result. That is, the output “1011” of the priority encoder and the output “0011” of the priority register 13 are compared.

【0101】マルチプレクサ18は、この優先度に応じ
た優先度ラインビットLBをビットマトリクス記憶部1
0から取り出す。その内容は“01000000”とな
る。このデータは、優先度が“3”に相当する部分のラ
インビットである。マルチプレクサ31は、優先度別順
位レジスタ30から優先度が“011”に応じたL3の
部分のデータを選択して取り出す。これはデコーダ32
によってマスク情報に変換される。マスク情報の内容は
“00000111”である。
The multiplexer 18 stores the priority line bit LB according to the priority in the bit matrix storage 1
Take from 0. The content is “01000000”. This data is a line bit of a portion corresponding to the priority “3”. The multiplexer 31 selects and extracts the data of the L3 portion corresponding to the priority “011” from the priority order register 30. This is the decoder 32
Is converted into mask information. The content of the mask information is “00000111”.

【0102】[ステップS22]アンドゲート23は上
位5ビットがマスクされ、アンドゲート22は下位3ビ
ットがマスクされる。その結果、アンドゲート23から
オール0の信号が出力される。プライオリティエンコー
ダ25は“000”を出力する。また、アンドゲート2
2は、優先度ラインビットLBに相当するデータをプラ
イオリティエンコーダ24に出力する。プライオリティ
エンコーダ24は“110”をマルチプレクサ28に向
けて出力する。オアゲート27の出力は“0”であるか
ら、マルチプレクサ28はプライオリティエンコーダ2
4の出力を選択して出力する。
[Step S22] The upper 5 bits of the AND gate 23 are masked, and the lower 3 bits of the AND gate 22 are masked. As a result, an all-zero signal is output from the AND gate 23. The priority encoder 25 outputs “000”. Also, AND gate 2
2 outputs the data corresponding to the priority line bit LB to the priority encoder 24. The priority encoder 24 outputs “110” to the multiplexer 28. Since the output of the OR gate 27 is "0", the multiplexer 28 outputs the priority encoder 2
4 is selected and output.

【0103】[ステップS23]ステップS3と同様に
して、スタックの退避が行われ、退避完了信号TCがア
サートされる。この退避完了信号がアサートされること
によって、順位レジスタ36にマルチプレクサ28の出
力する“110”という信号が記憶される。同時に、優
先度別順位レジスタ30のL3部分に“110”の信号
が記憶される。加算器38は、スタックポインタテーブ
ルレジスタ37と、優先度レジスタ13及び順位レジス
タ36の出力に従ってスタックポインタアドレスSPA
を生成する。タスクtask1が、最後にシステムコー
ルtask1−idを呼び出すことによって全てのタス
クの処理が終了する。
[Step S23] Similar to step S3, the stack is saved, and the save completion signal TC is asserted. When the save completion signal is asserted, the signal “110” output from the multiplexer 28 is stored in the order register 36. At the same time, a signal of "110" is stored in the L3 portion of the priority order register 30. The adder 38 outputs the stack pointer address SPA according to the output of the stack pointer table register 37 and the output of the priority register 13 and the order register 36.
Generate When task task1 finally calls the system call task1-id, the processing of all tasks ends.

【0104】〈具体例1の効果〉以上のように、図1に
示した具体例1のリアルタイムOS装置は、スケジュー
リングの対象となる各タスクの優先度と優先度別順位を
示す情報を記憶回路に記憶して、全てハードウェアでそ
のスケジューリングを行う。タスクからタスク切り替え
のためのシステムコールがあると、図1の右側に示した
比較器14等を含む割り込み信号出力用回路が、CPU
に割り込み信号を出力する。この回路は、記憶回路に記
憶されたタスクの優先度と優先度別順位のうちから、最
も高い優先度のタスクの優先度を読み出す回路と、読み
出したタスクの優先度と実行中のタスクの優先度とを比
較する回路と、当該読み出した優先度が実行中のタスク
の優先度より高いときにプロセッサにタスク切り替えの
ための割り込み信号を出力する回路とを含むので、待機
中のタスクのうち優先度の高いタスクを選択して次に実
行するタスクとし、ハードウェアによりその割り込み信
号を生成して出力できる。
<Effect of Specific Example 1> As described above, the real-time OS device of the specific example 1 shown in FIG. 1 stores information indicating the priority of each task to be scheduled and the priority order by the storage circuit. And the scheduling is performed entirely by hardware. When there is a system call for task switching from task to task, the interrupt signal output circuit including the comparator 14 and the like shown on the right side of FIG.
Output an interrupt signal to This circuit includes a circuit for reading out the priority of a task having the highest priority from the priorities and priorities of tasks stored in a storage circuit, a priority of the read task and a priority of a task being executed. And a circuit that outputs an interrupt signal for task switching to the processor when the read priority is higher than the priority of the task being executed. A task having a high degree of selection can be selected as a task to be executed next, and an interrupt signal can be generated and output by hardware.

【0105】図5の右下の加算器38等を含むスタック
ポインタアドレス生成用回路は、直前のタスクの退避用
スタックポインタアドレスをCPUに供給する。そし
て、CPUが退避を完了し、退避完了信号を受け付ける
と、新たなタスクのスタックポインタアドレスを出力し
てCPUに新たなスタックポンタの読み出しをさせる。
このように、スタックポインタアドレスの生成処理とス
タックポインタアドレスの切り替えをハードウェアによ
り実行するので、CPUの負荷を軽減し、高速処理を可
能にする。
The stack pointer address generation circuit including the lower right adder 38 in FIG. 5 supplies the CPU with the save stack pointer address of the immediately preceding task. Then, when the CPU completes the evacuation and receives the evacuation completion signal, it outputs a stack pointer address of a new task and causes the CPU to read a new stack pointer.
As described above, since the stack pointer address generation processing and the stack pointer address switching are performed by hardware, the load on the CPU is reduced, and high-speed processing is enabled.

【0106】また、直前に退避したタスクまたは待ち状
態に遷移したタスクの優先度別順位を、優先度別に保持
して、ビットマトリクス記憶部から読み出した優先度ラ
インビットの一部をマスクして、同一優先度でキューの
先頭にあるタスクを、次に実行するタスクとして選択す
るキュー制御回路を実現したので、従来ソフトウェアに
より制御されていたタスクのキューの管理をハードウェ
アによって実現できる。
Also, the priorities of the tasks saved immediately before or the tasks that have transitioned to the waiting state are retained by priority, and a part of the priority line bits read from the bit matrix storage unit is masked. Since the queue control circuit that selects the task at the head of the queue with the same priority as the task to be executed next is realized, the management of the queue of tasks that has been conventionally controlled by software can be realized by hardware.

【0107】〈具体例2〉割り込み処理は、従来、割り
込みコントローラで制御している。割り込みコントロー
ラには多数の割り込み信号が入力する。割り込みコント
ローラは、これらの割り込み信号の競合調整をし、1本
の割り込み信号を割り込み信号出力用レジスタに保持す
る。この信号をCPUに送り、割り込みハンドラを起動
する。CPUは割り込み状態を解析してアプリケーショ
ンに渡す。CPUは、このように、割り込みがアサート
されてから割り込みを処理するための一連の処理を実行
することから、割り込み処理が大きな負荷になる。この
具体例では、割り込み処理を上記具体例1のタスクスケ
ジューリング処理のハードウェアと統合させて、CPU
のオーバーヘッドを削減する。
<Specific Example 2> Interrupt processing is conventionally controlled by an interrupt controller. Many interrupt signals are input to the interrupt controller. The interrupt controller adjusts the conflict between these interrupt signals and holds one interrupt signal in the interrupt signal output register. This signal is sent to the CPU to activate the interrupt handler. The CPU analyzes the interrupt state and passes it to the application. Since the CPU executes a series of processes for processing the interrupt after the interrupt is asserted, the interrupt process becomes a heavy load. In this specific example, the interrupt processing is integrated with the hardware of the task scheduling processing of the specific example 1, and
Reduce overhead.

【0108】図10には、一般的な割り込みコントロー
ラのハードウェア構成説明図を示す。アンドゲート41
は、各部から割り込み信号を受け付けるゲートである。
割り込みマスクレジスタ40は、書き込み設定に従いマ
スク信号を生成し、アンドゲート41に出力する回路で
ある。複数本の割り込み信号に対しては複数本のマスク
信号がアンドゲート41に供給される。そして、アンド
ゲート41でマスクされずに通過した割り込み信号が割
り込みレジスタ42に記憶される構成となっている。
FIG. 10 is an explanatory diagram of the hardware configuration of a general interrupt controller. AND gate 41
Is a gate for receiving an interrupt signal from each unit.
The interrupt mask register 40 is a circuit that generates a mask signal according to the write setting and outputs the mask signal to the AND gate 41. A plurality of mask signals are supplied to the AND gate 41 for a plurality of interrupt signals. Then, the interrupt signal passed without being masked by the AND gate 41 is stored in the interrupt register 42.

【0109】割り込みレジスタ42には、割り込みをし
ようとするタスクやデバイスに対応する複数の割り込み
信号保持領域が設けられている。プライオリティエンコ
ーダ44は、割り込みレジスタ42に記憶された優先順
位の最も高い割り込み信号の番号を読み出して、CPU
に出力する回路である。オアゲート43は、割り込みレ
ジスタ42のいずれかの領域が“1”となった場合、即
ち割り込みが発生した場合に、CPUへ割り込み信号を
アサートする回路である。
The interrupt register 42 is provided with a plurality of interrupt signal holding areas corresponding to tasks and devices to be interrupted. The priority encoder 44 reads out the number of the highest priority interrupt signal stored in the interrupt register 42 and
Circuit. The OR gate 43 is a circuit that asserts an interrupt signal to the CPU when any area of the interrupt register 42 becomes “1”, that is, when an interrupt occurs.

【0110】図11は、割り込みハンドラの処理例説明
図を示す。CPUは、割り込みハンドラの出力をこの図
に示すようなC言語likeのプログラムによって処理
する。即ち、オアゲート43の出力信号がアサートされ
ると、CPUは割り込みハンドラプログラムを実行す
る。割り込みハンドラプログラムにおいてプライオリテ
ィエンコーダ44の出力をリードし、優先度の最も高い
割り込み信号がどれであるかを判断する。次に、swi
tch文によって、該当する処理プロセスを呼び出す。
この呼び出しで初めて割り込み信号に対応する処理がな
される。即ち、優先度の高いものから順番に割り込み番
号N−1,N−2,…0というように割り込み処理を実
行していく。丁度それぞれ優先順位を持つタスクが処理
を待つ状態と同様になる。従って、ソフトウェアによる
場合、この図に示すプログラムを実行するためのオーバ
ーヘッドが問題となる。
FIG. 11 is a diagram for explaining a processing example of the interrupt handler. The CPU processes the output of the interrupt handler using a C-like program as shown in FIG. That is, when the output signal of the OR gate 43 is asserted, the CPU executes the interrupt handler program. In the interrupt handler program, the output of the priority encoder 44 is read to determine which interrupt signal has the highest priority. Next, swi
The corresponding processing process is called by the tch statement.
Processing corresponding to the interrupt signal is performed for the first time by this call. That is, the interrupt processing is executed in the order of the interrupt numbers N-1, N-2,... This is the same as the state in which tasks having the respective priorities just wait for processing. Therefore, in the case of software, an overhead for executing the program shown in FIG.

【0111】図12は、具体例2のビットマトリクス記
憶部ブロック図を示す。具体例2の装置は、この部分の
構造のみが具体例1と異なる。割り込み信号は、それぞ
れ3本ずつ8組、合計24の割り込み信号が入力するよ
うにビットマトリクス記憶部10に接続されている。図
の縦軸をY軸、横軸をX軸とすると、例えば1番左の信
号線の最初のビットは(7,7)の割り込み信号であ
る。2番目のビットは(6,7)の割り込み信号であ
る。3番目のビットは(5,7)の割り込み信号であ
る。
FIG. 12 is a block diagram of a bit matrix storage unit according to the second embodiment. The device of the second embodiment differs from the first embodiment only in the structure of this portion. The interrupt signals are connected to the bit matrix storage unit 10 such that eight sets of three interrupt signals are input, for a total of 24 interrupt signals. Assuming that the vertical axis in the figure is the Y axis and the horizontal axis is the X axis, for example, the first bit of the leftmost signal line is an interrupt signal of (7, 7). The second bit is an interrupt signal of (6, 7). The third bit is an interrupt signal of (5, 7).

【0112】次の6番の3本の割り込み信号は、初めの
ビットが(7,6)の割り込み信号である。2番目のビ
ットは(6,6)の割り込み信号である。3番目のビッ
トは(5,6)の割り込み信号である。この例では、こ
のように3×8即ち合計24本の割り込み信号を受け付
けるようにしたが、この数値は自由に変更してよい。な
お、このような割り込み信号は、各座標単位で予め記憶
されているイネーブルビットが“1”の場合にのみ有効
に機能する。図の各座標の2ビットのデータのうち左側
がこのイネーブルビットである。右側は状態ビットであ
る。
The next six interrupt signals are interrupt signals whose first bits are (7, 6). The second bit is a (6, 6) interrupt signal. The third bit is a (5, 6) interrupt signal. In this example, 3 × 8, that is, a total of 24 interrupt signals are accepted, but this numerical value may be freely changed. Such an interrupt signal functions effectively only when the enable bit stored in advance for each coordinate unit is “1”. The enable bit is on the left side of the 2-bit data at each coordinate in the figure. On the right are the status bits.

【0113】即ち、例えば(7,5)のイネーブルビッ
トが“1”の場合に、左から3番目の信号線の先頭のビ
ットの割り込み信号がアサートされた場合に、その割り
込みが有効になる。割り込みが有効になると、イネーブ
ルビットと共に状態ビットが立つ。即ち、(7,5)の
部分に“11”というデータが記憶される。なお、この
ようなイネーブルビットを書き込むために、アドレスレ
ジスタ11が設けられる。図のY軸方向は、具体例1と
同様、優先度であって、プライオリティエンコーダ12
は、具体例1と同様の論理和出力に基づく最も高い優先
度のデータを出力する機能を持つ。
That is, for example, when the enable bit of (7, 5) is "1" and the interrupt signal of the first bit of the third signal line from the left is asserted, the interrupt becomes valid. When an interrupt is enabled, a status bit is set along with the enable bit. That is, the data “11” is stored in the portion (7, 5). Note that an address register 11 is provided to write such an enable bit. The Y-axis direction in the figure is the priority, as in the specific example 1, and the priority encoder 12
Has the function of outputting the highest priority data based on the logical sum output similar to that of the first embodiment.

【0114】図13に、具体例2を実行する場合の割り
込みの初期割り付け状況説明図を示す。(a)に示すよ
うに、ビットマトリクス記憶部10の優先度の高いタス
クを示す7,6,5の各ラインには、それぞれ2ビット
ずつのデータが初期値として記憶されている。2ビット
のうちの左側のビットがイネーブルビットを示す。右側
は状態ビットである。従って、図のように、(7,
5)、(6,3)の欄でイネーブルビットが“1”とな
っていることが分かる。
FIG. 13 is a diagram illustrating the initial assignment of interrupts when the second embodiment is executed. As shown in (a), in each of the lines 7, 6, and 5 indicating a high-priority task in the bit matrix storage unit 10, two-bit data is stored as an initial value. The left bit of the two bits indicates an enable bit. On the right are the status bits. Therefore, as shown in the figure, (7,
It can be seen that the enable bits are "1" in columns 5) and (6, 3).

【0115】図13(b)は、タスク(10)、(1
1)、(12)の割り込みハンドラを示す。タスク10
の割り込みハンドラが(7,5)に、タスク11の割り
込みハンドラが(6,3)に、タスク12の割り込みハ
ンドラが(5,1)に、それぞれ割り当てられている。
優先度の低いほうには、具体例1と同様に、(3,6)
と(3,3)に待ち状態のタスクが表示されている。割
り込み処理は一般のタスクよりも優先度が高いたら、こ
のような割り当てをすれば、具体例1と同様にして、割
り込みと一般のタスクのスケジューリングが可能にな
る。
FIG. 13B shows tasks (10) and (1).
The interrupt handlers 1) and (12) are shown. Task 10
Is assigned to (7, 5), the interrupt handler for task 11 is assigned to (6, 3), and the interrupt handler for task 12 is assigned to (5, 1).
In the lower priority, as in the specific example 1, (3, 6)
And (3, 3) show waiting tasks. If the priority of the interrupt processing is higher than that of a general task, such allocation makes it possible to schedule the interrupt and the general task in the same manner as in the first embodiment.

【0116】図15に、割り込み処理のタイミングチャ
ートを示す。この図を参照しながら、具体例2の装置の
動作を説明する。まず、タイミングt0においては、図
14(i)に示すように、他のタスクが処理を実行して
いる。そして、タイミングt1で、(c)に示す割り込
み信号63がアサートされる。この63というのは、
(6,3)の座標に相当する割り込み信号である。ビッ
トマトリクス記憶部10のこの座標のイネーブルビット
は“1”なので、ビットマトリクス(6,3)の状態ビ
ットが“1”になる。また、優先順位が他のタスクより
も高いので、11番の割り込みハンドラint−han
d1が起動される。
FIG. 15 shows a timing chart of the interrupt processing. The operation of the device of the second embodiment will be described with reference to FIG. First, at the timing t0, as shown in FIG. 14 (i), another task is executing a process. Then, at timing t1, the interrupt signal 63 shown in (c) is asserted. This 63 is
This is an interrupt signal corresponding to the coordinates of (6, 3). Since the enable bit at this coordinate in the bit matrix storage unit 10 is “1”, the status bit of the bit matrix (6, 3) becomes “1”. Also, since the priority is higher than other tasks, the 11th interrupt handler int-han
d1 is activated.

【0117】次のタイミングt2で、今度は図14
(b)に示す割り込み信号73がアサートされる。しか
しながら、ビットマトリクス記憶部10の対応する座標
(7,3)のイネーブルビットは“0”なので、状態ビ
ットは“0”のままである。即ち、割り込みは受け付け
られない。従って、11番の割り込みハンドラが実行状
態のままとなる。次のタイミングt3で、割り込み信号
75がアサートされる。ビットマトリクス記憶部10の
該当する座標(7,5)のイネーブルビットは“1”な
ので、この座標の状態ビットが“1”になる。
At the next timing t2, this time, FIG.
The interrupt signal 73 shown in (b) is asserted. However, since the enable bit of the corresponding coordinates (7, 3) in the bit matrix storage unit 10 is “0”, the status bit remains “0”. That is, no interrupt is accepted. Therefore, the 11th interrupt handler remains in the execution state. At the next timing t3, the interrupt signal 75 is asserted. Since the enable bit of the corresponding coordinate (7, 5) in the bit matrix storage unit 10 is "1", the state bit of this coordinate becomes "1".

【0118】ビットマトリクス記憶部10を参照する
と、これまで実行されていた11番の割り込みハンドラ
int−hand1よりも、この割り込みで実行される
10番の割り込みハンドラint−hand0が優先度
が高いので、10番の割り込みハンドラが起動される。
10番の割り込みハンドラが処理を完了し、75番の割
り込み信号をネゲートさせると、10番の割り込みハン
ドラによるint−hand0が自らの状態ビットを
“0”にクリアして処理を完了させる。再び割り込み中
の11番の割り込みハンドラint−hand1が実行
を再開する(タイミングt4)。
Referring to the bit matrix storage unit 10, the 10th interrupt handler int-hand0 executed by this interrupt has a higher priority than the 11th interrupt handler int-hand1 executed so far. The 10th interrupt handler is activated.
When the No. 10 interrupt handler completes the process and negates the No. 75 interrupt signal, int-hand0 by the No. 10 interrupt handler clears its status bit to “0” and completes the process. The 11th interrupt handler int-hand1 interrupting again resumes execution (timing t4).

【0119】次に、タイミングt5で、割り込み信号5
1がアサートされる。ビットマトリクス記憶部10の
(5,1)のイネーブルビットは“1”なので、この座
標の状態ビットは“1”になる。ここで、現在実行して
いる11番の割り込みハンドラと今割り込みのかかった
12番の割り込みハンドラとを比較すると、12番の割
り込みハンドラの方が優先順位が低いので、起動されな
い。タイミングt6において、11番の割り込みハンド
ラの処理が終了し、割り込み信号63をネゲートさせ
る。11番の割り込みハンドラint−hand11は
自ら状態ビットを“0”にクリアして処理を完了させ
る。
Next, at timing t5, the interrupt signal 5
1 is asserted. Since the enable bit of (5, 1) in the bit matrix storage unit 10 is “1”, the status bit at this coordinate becomes “1”. Here, comparing the 11th interrupt handler that is currently being executed with the 12th interrupt handler that has been interrupted, the 12th interrupt handler is not activated because it has a lower priority. At the timing t6, the processing of the eleventh interrupt handler ends, and the interrupt signal 63 is negated. The eleventh interrupt handler int-hand11 clears the status bit to “0” and completes the process.

【0120】このタイミング即ちタイミングt6で、1
2番の割り込みハンドラint−hand2が起動す
る。次のタイミングt7では、12番の割り込みハンド
ラint−hand2が処理を完了し、割り込み信号を
ネゲートさせる。こうして、割り込みが入る前に実行さ
れていた他のタスクの実行が再開される。図12に示し
た部分以外は、図1と同様のハードウェアを使用し、優
先順位に応じて割り込みのスケジューリングを行う動作
は具体例1と全く同様であるため、重複する説明を省略
する。
At this timing, that is, at timing t6, 1
The second interrupt handler int-hand2 is activated. At the next timing t7, the twelfth interrupt handler int-hand2 completes the process and negates the interrupt signal. In this way, the execution of another task that was being executed before the interruption was input is resumed. Except for the part shown in FIG. 12, the same hardware as that of FIG. 1 is used, and the operation of scheduling an interrupt according to the priority order is completely the same as that of the first embodiment, and therefore, the duplicated description will be omitted.

【0121】〈具体例2の効果〉以上のように、具体例
1と同様のハードウェアでビットマトリクス記憶部10
に割り込み信号を記憶させることによって、割り込み信
号のスケジュールをハードウェアによって実現できる。
従って、割り込みハンドラに対するソフトウェア処理が
不要になり、割り込み信号がアサートされてからその割
り込み信号に対応したハンドラが起動するまで、コンテ
キストのスイッチ分のサイクルしか時間がかからない。
従って、極めてスループットの高い割り込み処理が可能
になる。
<Effects of Specific Example 2> As described above, the bit matrix storage unit 10 is configured using the same hardware as that of the specific example 1.
By storing the interrupt signal in the CPU, the schedule of the interrupt signal can be realized by hardware.
Therefore, software processing for the interrupt handler becomes unnecessary, and it takes only a cycle of context switching from the assertion of the interrupt signal to the activation of the handler corresponding to the interrupt signal.
Therefore, interrupt processing with extremely high throughput can be performed.

【0122】なお、上記の例において、イネーブルビッ
トを設け、割り込みを受け付ける座標を制限したのは、
図10に示す従来の割り込みマスクレジスタと同様の機
能をビットマトリクス記憶部10に与えるためである。
割り込みマスクが不要な場合には割り込み信号を具体例
1と全く同様の要領で処理し制御することが可能にな
る。
In the above example, the reason why the enable bit is provided and the coordinates for accepting the interrupt are limited is as follows.
This is because the same function as that of the conventional interrupt mask register shown in FIG.
When the interrupt mask is unnecessary, the interrupt signal can be processed and controlled in exactly the same manner as in the first embodiment.

【0123】〈具体例3〉リアルタイムOS装置におい
ては、タスク間の同期処理にイベントフラグが使用され
ることがある。イベントフラグのシステムコールには、
「イベントフラグ待ち状態」「イベントフラグ設定状
態」「イベントフラグクリア状態」がある。イベントフ
ラグ待ち状態では、フラグIDと待ちパターンの情報が
保持される。イベントフラグ設定状態では、フラグID
と設定パターンが保持される。イベントフラグクリアの
状態では、フラグIDが保持される。
<Example 3> In a real-time OS device, an event flag may be used for a synchronization process between tasks. Eventflag system calls include
There are “event flag waiting state”, “event flag setting state”, and “event flag clear state”. In the event flag waiting state, information on the flag ID and the waiting pattern is held. In the event flag setting state, the flag ID
And the setting pattern are held. In the event flag clear state, the flag ID is held.

【0124】イベントフラグ待ちのシステムコールを呼
び出したタスクは、他のタスクが同じイベントフラグI
Dのイベントフラグ設定システムコールを呼び、設定パ
ターンを待ちパターンと同じにするまで、待ち状態に入
る。設定パターンが待ちパターンと同じパターンになる
と、イベントフラグ待ちのシステムコールを呼び出した
タスクは、待ち状態から実行可能状態に移り、そのタス
クの優先度に対応したタスクチェーンにつながれる。イ
ベントフラグ設定のシステムコールを呼び出したタスク
は、設定パターンを設定した後、次の命令を実行する。
イベントフラグクリアは、フラグIDに対応したパター
ンを初期化する。
The task that has called the event-flag waiting system call has the same event flag I as another task.
The event flag setting system call of D is called, and the system enters a wait state until the set pattern becomes the same as the wait pattern. When the setting pattern becomes the same as the waiting pattern, the task that has called the eventflag waiting system call transitions from the waiting state to the executable state, and is connected to the task chain corresponding to the priority of the task. The task that has called the event flag setting system call executes the next instruction after setting the setting pattern.
The event flag clear initializes a pattern corresponding to the flag ID.

【0125】図15に、一般のイベントフラグキューの
構成例説明図を示す。図において、イベントフラグポイ
ンタ45Aは、鎖状に接続されたイベントフラグキュー
の先頭と末尾を指すポインタ領域である。各キュー45
Bには、それぞれイベントフラグの待ちフラグパターン
と設定フラグパターン、待ちフラグパターンにあるタス
クのTCBを保持している。
FIG. 15 is a diagram illustrating an example of the configuration of a general event flag queue. In the figure, an event flag pointer 45A is a pointer area indicating the head and the end of an event flag queue connected in a chain. Each queue 45
B holds the wait flag pattern and the set flag pattern of the event flag, and the TCB of the task in the wait flag pattern.

【0126】図16には、イベントフラグ使用例説明図
を示す。ここには、図の(a)、(b)、(c)に示す
ような3種類のタスクがあり、それぞれイベントフラグ
に関わるシステムコールを呼んでいる。タスクの実行順
序は(d)に示す。図中のwai−flgはイベントフ
ラグ待ちのシステムコールで、イベントフラグID、待
ちパターン、タスクIDの順に引数が並んでいる。se
t−flgはイベントフラグ設定のシステムコールで、
イベントフラグID、設定パターンの順に引数が並んで
いる。clr−flgはイベントフラグクリアのシステ
ムコールで、イベントフラグIDを引数としてとる。
FIG. 16 is an explanatory diagram of an example of using an event flag. Here, there are three types of tasks as shown in (a), (b), and (c) of the figure, each of which calls a system call relating to an event flag. The task execution order is shown in (d). In the figure, “wai-flg” is a system call for waiting for an event flag, and arguments are arranged in the order of an event flag ID, a waiting pattern, and a task ID. se
t-flg is a system call for setting an event flag.
Arguments are arranged in the order of the event flag ID and the setting pattern. clr-flg is a system call for clearing an event flag, and takes an event flag ID as an argument.

【0127】まず、タスク0からイベントフラグ待ちの
システムコール(wai−flg)がなされると、その
イベントID(if1)に対応したイベントフラグポイ
ンタの現パターンと待ちパターンとが比較される。現パ
ターンは、ここでは“0x0”とする。待ちパターン
は、ここでは“0x3”とする。両者が不一致の場合に
はそのイベントIDのTCBポインタにシステムコール
を呼び出したタスクのTCBのアドレスが設定される。
このタスクは、task0である。TCBの待ちパター
ンは“0x3”となる。
First, when an event flag waiting system call (wai-flg) is made from task 0, the current pattern of the event flag pointer corresponding to the event ID (if1) and the waiting pattern are compared. The current pattern is “0x0” here. Here, the wait pattern is “0x3”. If they do not match, the TCB address of the task that called the system call is set in the TCB pointer of the event ID.
This task is task0. The wait pattern of TCB is “0x3”.

【0128】task1で、イベントフラグ設定のシス
テムコール(set−flg)がなされると、そのイベ
ントIDに対応したイベントフラグポインタの現パター
ンに設定パターンが論理和された結果が反映される。現
パターンは“0x0”、設定パターンは“0x1”であ
る。論理和の結果、現パターンは“0x1”となり、T
CBキューの待ちパターンである“0x3”と一致しな
い。従って、タスク0の待ち状態が続く。
When a system call (set-flg) for setting an event flag is made in task1, the result of the logical OR of the set pattern is reflected on the current pattern of the event flag pointer corresponding to the event ID. The current pattern is “0x0” and the setting pattern is “0x1”. As a result of the logical sum, the current pattern becomes “0x1”, and T
It does not match the wait pattern of the CB queue “0x3”. Therefore, the waiting state of task 0 continues.

【0129】次のtask2で、イベントフラグ設定の
システムコール(set−flg)がなされると、その
イベントIDに対応したイベントフラグポインタの現パ
ターンに設定パターンが論理和される。現パターンは
“0x1”、設定パターンは“0x2”である。両者の
論理和の結果、現パターンは“0x3”となる。TCB
キューの待ちパターンも“0x3”である。従って、両
者は一致し、イベントフラグif0のTCBポインタか
らTCBアドレスが取り出されてタスク0が実行可能な
状態になる。
When a system call (set-flg) for setting an event flag is made in the next task 2, the set pattern is logically ORed with the current pattern of the event flag pointer corresponding to the event ID. The current pattern is “0x1” and the setting pattern is “0x2”. As a result of the logical sum of the two, the current pattern becomes “0x3”. TCB
The queue waiting pattern is also “0x3”. Therefore, they match, the TCB address is extracted from the TCB pointer of the event flag if0, and the task 0 becomes ready for execution.

【0130】タスクtask0でイベントフラグクリア
のシステムコール(clr−flg)がなされると、そ
のイベントIDに対応してイベントフラグポインタの現
パターンが“0”にクリアされる。
When the event flag clear system call (clr-flg) is made in task task0, the current pattern of the event flag pointer is cleared to "0" corresponding to the event ID.

【0131】上記のような処理は、従来、全てCPUが
ソフトウェアで実行していた。従って、イベントフラグ
の設定からそのフラグを待つタスクが実行可能状態にな
るまで多くのサイクル数がかかる。イベントフラグに対
して即座に処理をする必要が迫られているようなものに
対しては、イベントフラグ処理のオーバーヘッドが問題
にある。
Conventionally, all of the above processing has been executed by the CPU using software. Therefore, it takes a large number of cycles from the setting of the event flag until the task waiting for the flag becomes executable. If the event flag needs to be processed immediately, there is a problem with the overhead of the event flag processing.

【0132】図17には、具体例3のイベントフラグ処
理用ハードウェアのブロック図を示す。図5に示した加
算器38の部分がこの図17に示した回路に置き替わる
ことによって、イベントフラグ処理が可能になる。この
回路には、図5に示した順位レジスタ36とスタックポ
インタテーブルレジスタ37と、図1に示した優先順レ
ジスタ13の出力する優先度LYとが入力する。
FIG. 17 is a block diagram of hardware for processing an event flag according to the third embodiment. By replacing the portion of the adder 38 shown in FIG. 5 with the circuit shown in FIG. 17, event flag processing becomes possible. The order register 36 and the stack pointer table register 37 shown in FIG. 5 and the priority LY output from the priority order register 13 shown in FIG. 1 are input to this circuit.

【0133】マルチプレクサ48,49,52,54,
56,57,61及び62は、いずれもシーケンサ47
の制御によっていずれかの入力信号を選択して出力する
よう動作する。ALU51は、アドレスのインクリメン
トや待ちパターンと現状パターンの一致判定を行う回路
である。0検出回路46は、ALU51が“0”を検出
したかどうかを判定するための回路である。即ち、AL
U51が“0”を出力したことを検出すると、シーケン
サ47をリセットするように動作する。
The multiplexers 48, 49, 52, 54,
56, 57, 61 and 62 are all sequencers 47
Operates to select and output one of the input signals. The ALU 51 is a circuit for incrementing the address and determining whether the waiting pattern matches the current pattern. The 0 detection circuit 46 is a circuit for determining whether the ALU 51 has detected “0”. That is, AL
When detecting that U51 has output "0", the sequencer 47 is operated to be reset.

【0134】フラグキューヘッドアドレスレジスタ50
は、イベントフラグ情報のブロックの先頭アドレスをデ
ータMDとして受け入れ、これを保持するレジスタであ
る。フラグキューリードアドレスレジスタ58は、マル
チプレクサ56から出力されるイベントフラグ情報のブ
ロックからデータをリードするときのアドレスを保持す
るレジスタである。フラグキューライトアドレスレジス
タ59は、マルチプレクサ57から出力されるイベント
フラグ情報のブロックにデータをライトするときのアド
レスを保持するレジスタである。
Flag queue head address register 50
Is a register that receives the head address of the block of the event flag information as data MD and holds it. The flag queue read address register 58 is a register for holding an address when data is read from the block of the event flag information output from the multiplexer 56. The flag queue write address register 59 is a register for holding an address when data is written to the event flag information block output from the multiplexer 57.

【0135】レジスタ53及び55は、イベントフラグ
情報を一時的に保持するためのものである。ドライバ6
3は、マルチプレクサ61の出力を保持するためのもの
である。このドライバ63からワークメモリデータWD
が出力される。また、マルチプレクサ62からワークメ
モリアドレスWAが出力される。
The registers 53 and 55 are for temporarily holding event flag information. Driver 6
3 is for holding the output of the multiplexer 61. From this driver 63, the work memory data WD
Is output. The work memory address WA is output from the multiplexer 62.

【0136】図18には、ワークメモリ上のイベントフ
ラグ情報割り付け例を示す。各イベントフラグ情報ブロ
ック0〜n−1は、待ちフラグパターン、現状フラグパ
ターン、ハンドラID、予備領域を、それぞれ持つ。先
頭は、図7に示すフラグキューヘッドアドレスレジスタ
50に記憶されているアドレスである。
FIG. 18 shows an example of allocating event flag information on the work memory. Each of the event flag information blocks 0 to n-1 has a wait flag pattern, a current flag pattern, a handler ID, and a spare area. The head is the address stored in the flag queue head address register 50 shown in FIG.

【0137】[ステップS1−0]まず、タスクtas
k0がシステムコールwai−flg(if1,0x
3)を呼び出した後の処理を説明する。この呼び出し
は、シーケンサ47に直接伝えられるものとする。シー
ケンサに呼び出しが伝えられると、シーケンサ47は以
下の動作を行うと同時にCPU4を停止させる。
[Step S1-0] First, the task tas
k0 is the system call wai-flg (if1, 0x
The process after calling 3) will be described. This call is directly transmitted to the sequencer 47. When the call is transmitted to the sequencer, the sequencer 47 performs the following operation and simultaneously stops the CPU 4.

【0138】[ステップS1−1]タスクtask0が
起動され、システムコールwai−flgが呼び出され
る。このシステムコールで、イベントフラグif1に待
ちフラグパターンの値“0x3”を設定する。イベント
フラグif1は、インデックス値として“1”を持って
いる。従って、その値をレジスタ53に一時的に格納さ
せる。
[Step S1-1] The task task0 is started, and the system call wai-flg is called. In this system call, the value of the wait flag pattern “0x3” is set in the event flag if1. The event flag if1 has “1” as an index value. Therefore, the value is temporarily stored in the register 53.

【0139】[ステップS1−2]フラグキューヘッド
アドレスレジスタ50のアドレス情報と、レジスタ53
のインデックス値とを共に右にシフトさせて、ALU5
1において加算する。この値をフラグキューライトアド
レスレジスタ59に記憶させる。
[Step S1-2] The address information of the flag queue head address register 50 and the register 53
ALU5 is shifted to the right together with the index value of
Add at 1. This value is stored in the flag queue write address register 59.

【0140】[ステップS1−3]レジスタ55にイベ
ントフラグ待ちの値“0x3”を設定する。 [ステップS1−4]フラグキューライトアドレスレジ
スタ59が指すアドレス値のワークメモリにレジスタ5
5のイベントフラグ待ちの値“0x3”をライトする。
[Step S1-3] The event flag waiting value “0x3” is set in the register 55. [Step S1-4] The register 5 is stored in the work memory of the address value indicated by the flag queue write address register 59.
Write the event flag waiting value “0x3” of No. 5.

【0141】[ステップS1−5]フラグキューライト
アドレスレジスタ59の値にALU51を用いて“1”
を加算し、その結果をフラグキューリードアドレスレジ
スタ58に記憶させる。 [ステップS1−6]次に、ワークメモリからフラグキ
ューリードアドレスレジスタ58が指すアドレスに書き
込まれたイベントフラグ情報ブロック1の情報フラグパ
ターンをリードし、これをレジスタ53に書き込む。
[Step S1-5] The value of the flag queue write address register 59 is set to "1" by using the ALU 51.
And the result is stored in the flag queue read address register 58. [Step S1-6] Next, the information flag pattern of the event flag information block 1 written at the address indicated by the flag queue read address register 58 is read from the work memory, and is written to the register 53.

【0142】[ステップS1−7]1番目のイベントフ
ラグ情報ブロックの待ちフラグパターンが入っているレ
ジスタ55と、現状フラグパターンが入っているレジス
タ53の値が一致しているかどうかを判断するために、
ALU51は両者の信号を受け入れてエクスクルーシブ
オア処理を行う。両者が一致していればALU51の出
力は“0”となる。これを0検出回路46が検出する。
このケースでは両者が一致していない。その結果がシー
ケンサ47に伝えられる。
[Step S1-7] To determine whether the value of the register 55 containing the wait flag pattern of the first event flag information block matches the value of the register 53 containing the current flag pattern. ,
The ALU 51 performs an exclusive OR process by receiving both signals. If they match, the output of ALU 51 is "0". This is detected by the 0 detection circuit 46.
In this case, they do not match. The result is transmitted to the sequencer 47.

【0143】[ステップS1−8]フラグキューライト
アドレスレジスタ59に記憶された値をALU51に取
り込み、これに“2”を加算して1番上のイベントフラ
グ情報ブロックのハンドラIDのアドレス値とする。こ
の値を再び書き戻す。即ち、ビットマトリクス記憶部1
0のアドレスに対応するタスクtask0のID番号を
データMDとし、マルチプレクサ52を通じてレジスタ
53に送り込み、その内容を記憶させる。
[Step S1-8] The value stored in the flag queue write address register 59 is fetched into the ALU 51, and "2" is added to the value to make the address value of the handler ID of the top event flag information block. . Write this value back again. That is, the bit matrix storage unit 1
The ID number of the task task0 corresponding to the address 0 is set as data MD, sent to the register 53 through the multiplexer 52, and stored therein.

【0144】[ステップS1−9]ワークメモリへフラ
グキューライトアドレスレジスタ59の値をアドレス信
号としてアクセスし、レジスタ53に記憶されたデータ
を書き込む。また、レジスタ53に記憶されたビットマ
トリクスのアドレスに対応するtask0のID番号を
ビットマトリクス記憶部10に渡して、その該当する部
分のビットをクリアする。これによって、具体例1と同
様に割り込みが発生し、タスクtask0がスタックに
退避され、新たなタスクが起動する。シーケンサ47
は、CPUの動作を再開させる。
[Step S1-9] The value of the flag queue write address register 59 is accessed as an address signal to the work memory, and the data stored in the register 53 is written. Further, the ID number of task0 corresponding to the bit matrix address stored in the register 53 is passed to the bit matrix storage unit 10, and the bit of the corresponding portion is cleared. As a result, an interrupt occurs as in the first embodiment, the task task0 is saved on the stack, and a new task is started. Sequencer 47
Restarts the operation of the CPU.

【0145】[ステップS2−0]タスクtask2が
システムコールset−flg(if1,0x1)を呼
び出した後の処理が開始される。この呼び出しはシーケ
ンサに直接伝えられる。 [ステップS2−1]タスクtask1が起動されてシ
ステムコールset−flgが呼び出される。このシス
テムコールでイベントフラグif1に設定フラグパター
ンの値“0x1”をセットする。イベントフラグはイン
デックス値として“1”を持っているので、その値をレ
ジスタ53に一時記憶させる。
[Step S2-0] The processing after the task task2 calls the system call set-flg (if1, 0x1) is started. This call is passed directly to the sequencer. [Step S2-1] The task task1 is activated, and the system call set-flg is called. In this system call, the value “0x1” of the set flag pattern is set in the event flag if1. Since the event flag has "1" as an index value, the value is temporarily stored in the register 53.

【0146】[ステップS2−2]フラグキューヘッド
アドレスレジスタ50に記憶されたアドレス情報とレジ
スタ53に記憶されたインデックス値を、ALU51を
用いて右にシフトさせてキャリー加算し、その結果をフ
ラグキューリードアドレスレジスタ58とフラグキュー
ライトアドレスレジスタ59とに同時に記憶させる。
[Step S2-2] The address information stored in the flag queue head address register 50 and the index value stored in the register 53 are shifted to the right using the ALU 51 and carry added, and the result is added to the flag queue. The data is simultaneously stored in the read address register 58 and the flag queue write address register 59.

【0147】[ステップS2−3]次に、ワークメモリ
から1番目のイベントフラグ情報ブロックの現状フラグ
パターンのデータを取り出し、これをレジスタ55に記
憶させる。 [ステップS2−4]データバスからイベントフラグ設
定値“0x1”を取り込み、これをレジスタ53に記憶
させる。
[Step S2-3] Next, the data of the current state flag pattern of the first event flag information block is fetched from the work memory and stored in the register 55. [Step S2-4] The event flag set value “0x1” is fetched from the data bus and stored in the register 53.

【0148】[ステップS2−5]ALU51で、レジ
スタ53とレジスタ55の内容とを取り込み、両者の論
理和をとる。そして、その結果をレジスタ55に書き戻
す。 [ステップS2−6]レジスタ55に記憶されたデータ
をフラグキューライトアドレスレジスタ59が指すアド
レスのワークメモリに書き込む。これによって、更新し
た現状フラグパターンのデータをライトする。
[Step S2-5] The ALU 51 fetches the contents of the register 53 and the register 55 and calculates the logical sum of the two. Then, the result is written back to the register 55. [Step S2-6] The data stored in the register 55 is written to the work memory at the address indicated by the flag queue write address register 59. As a result, the updated data of the current state flag pattern is written.

【0149】[ステップS2−7]フラグキューリード
アドレスレジスタ58のアドレス値をALU51に取り
込み、これに“1”を加算してフラグキューリードアド
レスレジスタ58に書き戻す。[ステップS2−8]ワ
ークメモリからフラグキューリードアドレスレジスタ5
8が指すイベントフラグ情報ブロックの待ちフラグパタ
ーンをリードする。このイベントフラグ情報ブロック
は、1番目の情報ブロックである。そして、その結果を
レジスタ53に書き込む。
[Step S2-7] The address value of the flag queue read address register 58 is fetched into the ALU 51, "1" is added thereto, and the result is written back to the flag queue read address register 58. [Step S2-8] Read flag queue address 5 from work memory
The wait flag pattern of the event flag information block indicated by 8 is read. This event flag information block is the first information block. Then, the result is written into the register 53.

【0150】[ステップS2−9]ALU51でレジス
タ53とレジスタ55に書き込まれたデータのエクスク
ルーシブオアを演算する。その結果を再び0検出回路4
6で判断する。このケースでもALU51は“0”を出
力しない。即ち、レジスタ53に記憶された内容とレジ
スタ55に記憶された内容は一致しないので、このまま
処理を実行する。 [ステップS2−10]タスクtask1は、システム
コールslp−tsk(task1−id)を呼び出
し、自らの処理を完了させる。
[Step S2-9] The ALU 51 calculates an exclusive OR of the data written in the registers 53 and 55. The result is returned to the 0 detection circuit 4 again.
Judge at 6. Also in this case, the ALU 51 does not output “0”. That is, since the content stored in the register 53 does not match the content stored in the register 55, the process is executed as it is. [Step S2-10] The task task1 calls the system call slp-tsk (task1-id) and completes its own process.

【0151】[ステップS3−0]タスクtask2
が、システムコールset−flg(if1,0x2)
を呼び出した後の処理が開始される。この呼び出しは、
シーケンサ47に直接伝えられる。 [ステップS3−1]タスクtask2が起動され、シ
ステムコールset−flgが呼び出される。このシス
テムコールで、イベントフラグif1に設定フラグパタ
ーンの値“0x2”を設定する。イベントフラグはイン
デックス値として“1”を持っているので、その値をレ
ジスタ53に一時記憶させる。
[Step S3-0] Task task2
Is the system call set-flg (if1, 0x2)
The processing after calling is started. This call:
It is transmitted directly to the sequencer 47. [Step S3-1] The task task2 is activated, and the system call set-flg is called. In this system call, the value “0x2” of the setting flag pattern is set in the event flag if1. Since the event flag has "1" as an index value, the value is temporarily stored in the register 53.

【0152】[ステップS3−2]その後、現状フラグ
パターンと待ちフラグパターンが、それぞれレジスタ5
3とレジスタ55に記憶される。即ち、ステップS3−
1からこれらのパターンの記憶までは、ステップS2−
2〜ステップS2−8と同一の手順なので重複する説明
を省略する。なお、このケースでは、レジスタ53とレ
ジスタ55に記憶されるデータは共に“3”である。
[Step S3-2] Thereafter, the current flag pattern and the waiting flag pattern are stored in the register 5 respectively.
3 and stored in the register 55. That is, step S3-
From step 1 to storage of these patterns, step S2-
2 to S2-8, the same procedure will be omitted. In this case, the data stored in the registers 53 and 55 are both “3”.

【0153】[ステップS3−3]ALU51では、レ
ジスタ53とレジスタ55に記憶されたデータのエクス
クルーシブオアをとる。その結果を再び0検出回路46
が判断する。このケースでは、ALU51は“0”を出
力する。即ち、レジスタ53に記憶された内容とレジス
タ55に記憶された内容とは一致している。従って、1
番目でイベントフラグ情報ブロックのハンドラIDを取
り出すために、フラグキューリードアドレスレジスタ5
8の内容をALU51に取り出し、“1”を加算する。
そして、そのハンドラIDのアドレス値をフラグキュー
リードアドレスレジスタ58に書き戻す。
[Step S3-3] The ALU 51 takes an exclusive OR of the data stored in the register 53 and the register 55. The result is returned to the 0 detection circuit 46 again.
Judge. In this case, the ALU 51 outputs “0”. That is, the content stored in the register 53 and the content stored in the register 55 match. Therefore, 1
In order to take out the handler ID of the event flag information block, the flag queue read address register 5
The content of 8 is taken out to the ALU 51 and "1" is added.
Then, the address value of the handler ID is written back to the flag queue read address register 58.

【0154】[ステップS3−4]ワークメモリから1
番目のイベントフラグ情報ブロックのハンドラIDをリ
ードし、レジスタ53に記憶させた後、ビットマトリク
ス記憶部10のアドレスレジスタに転送する。具体例1
で説明したようにして、該当するビットマトリクスの要
素に“1”が立つように制御を行う。
[Step S3-4] 1 from work memory
After reading the handler ID of the event flag information block and storing it in the register 53, it is transferred to the address register of the bit matrix storage unit 10. Example 1
As described above, the control is performed so that “1” is set in the element of the corresponding bit matrix.

【0155】[ステップS3−5]1番目のイベントフ
ラグ情報ブロックの待ちフラグパターンアドレスを生成
するために、フラグキューライトアドレスレジスタ59
の内容をALU51に取り込み、これに“1”を加算す
る。そして、そのハンドラIDのアドレス値を再びフラ
グキューライトアドレスレジスタ59に書き戻す。 [ステップS3−6]ワークメモリ上のフラグキューラ
イトアドレスレジスタ59が指すアドレスに“0”をラ
イトし、待ちフラグパターンをクリアする。
[Step S3-5] The flag queue write address register 59 is used to generate the wait flag pattern address of the first event flag information block.
Is taken into the ALU 51, and "1" is added thereto. Then, the address value of the handler ID is written back to the flag queue write address register 59 again. [Step S3-6] "0" is written to the address indicated by the flag queue write address register 59 on the work memory to clear the wait flag pattern.

【0156】[ステップS4−0]タスクtask0が
システムコールcif−flg(if1)を呼び出した
後の処理が開始される。この呼び出しは、シーケンサ4
7に直接伝えられる。 [ステップS4−1]タスクtask0が再起動し、シ
ステムコールclr−flg(if1)が呼ばれる。イ
ベントフラグはインデックス値として“1”を持ってい
るので、その値をレジスタ53に一時記憶させる。
[Step S4-0] The processing after the task task0 calls the system call cif-flg (if1) is started. This call is made to sequencer 4
It is conveyed directly to 7. [Step S4-1] The task task0 is restarted, and the system call clr-flg (if1) is called. Since the event flag has "1" as an index value, the value is temporarily stored in the register 53.

【0157】[ステップS4−2]フラグキューヘッド
アドレスレジスタ50に記憶されたアドレス情報とレジ
スタ53に記憶されたインデックス値とがALU51に
取り込まれ、これが右にシフトされキャリー加算され
る。そして、その結果がフラグキューライトアドレスレ
ジスタ59に記憶される。 [ステップS4−3]ワークメモリ中の1番目のイベン
トフラグ情報ブロックの現状フラグパターンのデータに
対して“0”が書き込まれる。
[Step S4-2] The address information stored in the flag queue head address register 50 and the index value stored in the register 53 are fetched into the ALU 51, which is shifted right and carry-added. Then, the result is stored in the flag queue write address register 59. [Step S4-3] "0" is written to the data of the current flag pattern of the first event flag information block in the work memory.

【0158】〈具体例3の効果〉以上のように、イベン
トフラグ待ちのタスクが存在した場合に、ワークメモリ
に、各タスク毎のイベントフラグ情報を記憶する領域を
設け、このイベントフラグ情報には、現状フラグパター
ンと待ちフラグパターンとを含め、更に現状フラグパタ
ーンと待ちフラグパターンとを比較する回路と、両者が
一致したとき、待ち状態のタスクを実行可能状態に移す
ように、ビットマトリクス記憶部の内容を書き換えるデ
ータと、書き込みアドレスを出力する回路を設けたの
で、具体例1と同様のハードウェアによりイベントフラ
グ処理を専用のハードウェアで実行することが可能にな
る。従って、イベントフラグ待ちのタスクを高速起動す
ることが可能になる。
<Effect of Specific Example 3> As described above, when there is a task waiting for an event flag, an area for storing event flag information for each task is provided in the work memory. A circuit for comparing the current flag pattern and the wait flag pattern, including the current flag pattern and the wait flag pattern, and a bit matrix storage unit for transferring the task in the wait state to the executable state when the two match. Since the circuit for outputting the data for rewriting the contents and the write address is provided, it becomes possible to execute the event flag processing by dedicated hardware using the same hardware as in the first embodiment. Therefore, the task waiting for the event flag can be started at high speed.

【0159】また、フラグパターンを設定するシステム
コール例えばset−flgや、フラグパターンをクリ
アするシステムコール例えばcir−flgでは、CP
Uがそのシステムコールを実行した後、別の動作を続け
ることができるので、フラグ処理とCPUによるアプリ
ケーション処理を同時に並行させて実行することが可能
になる。
A system call for setting a flag pattern, for example, set-flg, and a system call for clearing a flag pattern, for example, cir-flg, have a CP
After U executes the system call, another operation can be continued, so that the flag processing and the application processing by the CPU can be executed simultaneously in parallel.

【0160】〈具体例4〉リアルタイムOSには一定間
隔で周期的にソフトウェアを実行させる周期起動ハンド
ラがあり、通常これを処理する場合、ハードウェアのタ
イマから一定間隔でCPUに割り込みを入れ、CPUが
その割り込みハンドラから待ち間隔に相当するハンドラ
を探し出して、そのタスクを起動する。
<Specific Example 4> The real-time OS has a cyclically activated handler for periodically executing software at regular intervals. When this is normally processed, an interrupt is issued to the CPU at regular intervals from a hardware timer and the CPU is executed. Finds a handler corresponding to the waiting interval from the interrupt handler and activates the task.

【0161】図19には、周期起動ハンドラのハードウ
ェアブロック図を示す。タイマ64がCPU4に接続さ
れており、タイマ64から一定の周期で割り込み信号が
アサートされる。タイマ64から割り込み信号がアサー
トされると、CPU4は割り込みハンドラを起動させ、
所定のソフトウェア処理を行う。これが従来の方法であ
る。
FIG. 19 shows a hardware block diagram of the cyclically activated handler. The timer 64 is connected to the CPU 4, and an interrupt signal is asserted from the timer 64 at a constant cycle. When the interrupt signal is asserted from the timer 64, the CPU 4 activates an interrupt handler,
Perform predetermined software processing. This is the conventional method.

【0162】図20には、周期起動ハンドラキューの構
成説明図を示す。ハンドラキューには、起動間隔と、現
残り間隔及びハンドラアドレスが記憶されている。周期
起動ハンドラキューポインタ39には、ハンドラキュー
の先頭と末尾が表示されている。タイマから割り込みが
来ると、CPUは、周期起動ハンドラキューポインタ3
9からポインタをたどり、各周期起動ハンドラのブロッ
ク現残り間隔の値を調べる。そして、この値から“1”
を引く。減算結果が“0”になった場合には、起動間隔
の値を現残り間隔にコピーして、ハンドラアドレスが指
しているプログラムを起動させる。このような作業をキ
ューの末尾まで実施した後に元の処理に戻る。
FIG. 20 is a diagram for explaining the configuration of the cyclically activated handler queue. The handler queue stores a start interval, a current remaining interval, and a handler address. The cyclically activated handler queue pointer 39 displays the head and tail of the handler queue. When an interrupt is received from the timer, the CPU sets the cyclically activated handler queue pointer 3
The pointer is traced from 9 to check the value of the block remaining interval of each cyclically activated handler. Then, from this value, "1"
pull. When the subtraction result becomes "0", the value of the activation interval is copied to the current remaining interval, and the program indicated by the handler address is activated. After performing such operations up to the end of the queue, the process returns to the original process.

【0163】以上のように、周期起動ハンドラを指定し
た場合、CPUが他の処理を止めて、ハンドラキューの
探索やタイマの減算処理を実行するため、CPUに負荷
がかかっていた。この具体例では、この処理をハードウ
ェアにより実現する。
As described above, when the cyclic handler is designated, the CPU is stopped because other processes are executed and the search of the handler queue and the subtraction of the timer are executed, so that the CPU is overloaded. In this specific example, this processing is realized by hardware.

【0164】図21に、具体例4による周期起動ハード
ウェアブロック図を示す。この回路は、具体例3と同様
に、図5に示すスタックポインタアドレスを生成するた
めの加算器38の部分に配置される。図17の具体例3
と同様に、ALU51が演算処理を行い、マルチプレク
サ48,49,52,54,56,57,61,62を
シーケンサ47によって操作し、ワークメモリデータW
DとワークメモリアドレスWAとを生成する。
FIG. 21 shows a hardware block diagram of the periodic startup according to the fourth embodiment. This circuit is arranged in the adder 38 for generating the stack pointer address shown in FIG. Specific example 3 of FIG.
Similarly to the above, the ALU 51 performs arithmetic processing, and the multiplexers 48, 49, 52, 54, 56, 57, 61, and 62 are operated by the sequencer 47, and the work memory data W
D and a work memory address WA are generated.

【0165】この回路で、具体例3と異なるのは、タイ
マ100を設けた点である。また、図21の右上部分に
示すタイムキューヘッドアドレスレジスタ104、マル
チプレクサ103、タイムキューテールアドレスレジス
タ105、一致回路106を設け、マルチプレクサ5
6,57の出力をタイマキューリードアドレスレジスタ
とタイマキューライトアドレスレジスタにより構成した
点が異なる。その他の部分は具体例3の回路と全く同様
である。
This circuit differs from the third embodiment in that a timer 100 is provided. Further, a time queue head address register 104, a multiplexer 103, a time queue tail address register 105, and a coincidence circuit 106 shown in the upper right part of FIG.
6 and 57 are configured by a timer queue read address register and a timer queue write address register. The other parts are completely the same as those of the circuit of the third embodiment.

【0166】上記タイマ100は、周期的にハンドラを
起動するための割り込み信号をアサートするタイマであ
る。タイムキューヘッドアドレスレジスタ104は、周
期起動ハンドラ情報のブロックをリードするときのアド
レスを保持するレジスタである。タイムキューテールア
ドレスレジスタ105は、周期起動ハンドラ情報のブロ
ックの最終アドレスを保持するレジスタである。
The timer 100 is a timer that periodically asserts an interrupt signal for activating a handler. The time queue head address register 104 is a register for holding an address when reading a block of cyclically activated handler information. The time queue tail address register 105 is a register that holds the last address of the block of the cyclically activated handler information.

【0167】一致回路106は、ライトアドレスが周期
起動ハンドラ情報のブロックの最終アドレスと一致する
かどうかを判定する回路である。タイマキューリードア
ドレスレジスタは、周期起動ハンドラ情報のブロックを
リードするときのアドレスを保持するレジスタである。
タイマキューライトアドレスレジスタ102は、周期起
動ハンドラ情報のブロックをライトするときのアドレス
を保持するためのものである。
The matching circuit 106 is a circuit for determining whether or not the write address matches the last address of the block of the cyclically activated handler information. The timer queue read address register is a register for holding an address when reading a block of cyclically activated handler information.
The timer queue write address register 102 is for holding an address at the time of writing a block of cyclically activated handler information.

【0168】〈動作〉図22には、ワークメモリ上の周
期起動ハンドラ情報の割り付け例説明図を示す。この例
では、この図に示すように、ワークメモリ上に周期起動
ハンドラ情報ブロックを0番目から−1番目まで割り付
け、従来のハンドラキューに相当する情報を順番に記憶
させておく。この先頭のアドレスがタイムキューヘッド
アドレスレジスタ104の示すアドレスである。周期起
動ハンドラ情報ブロックは、残り時間、周期時間、ビッ
トマトリクスのアドレスに相当するハンドラIDを持
つ。
<Operation> FIG. 22 is a diagram for explaining an example of allocation of cyclically activated handler information on the work memory. In this example, as shown in this figure, the cyclically activated handler information blocks are allocated from 0th to -1st on the work memory, and information corresponding to the conventional handler queue is stored in order. This leading address is the address indicated by the time queue head address register 104. The cyclically activated handler information block has a remaining time, a cyclical time, and a handler ID corresponding to a bit matrix address.

【0169】[ステップS1−0]ここで、初期処理を
実行する。 [ステップS1−1]まず、タイマ100がシーケンサ
47に割り込み信号をアサートする。 [ステップS1−2]シーケンサ47は割り込みを受け
付け、タイムキューヘッドアドレスレジスタ104に記
憶されたアドレス情報をタイマキューリードアドレスレ
ジスタ101とタイマキューライトアドレスレジスタ1
02にコピーする。
[Step S1-0] Here, an initial process is executed. [Step S1-1] First, the timer 100 asserts an interrupt signal to the sequencer 47. [Step S1-2] The sequencer 47 receives the interrupt, and stores the address information stored in the time queue head address register 104 into the timer queue read address register 101 and the timer queue write address register 1.
Copy to 02.

【0170】[ステップS2−0]次に、周期起動ハン
ドラ情報ブロック0の処理を実行する。 [ステップS2−1]ワークメモリからタイマキューリ
ードアドレスレジスタ101の指すアドレスをアクセス
し、周期起動ハンドラ情報ブロック0の残り時間データ
をレジスタ53にコピーする。この処理は、具体例3と
同様に、タイマキューリードアドレスレジスタ101か
らレジスタ53につながる経路のマルチプレクサ48,
52とを動作させてデータを転送することによって実現
する。次に、レジスタ53のデータをALU51で読み
取り、そのデータから“1”を減少して、再びレジスタ
53に書き戻す。
[Step S2-0] Next, the process of the cyclically activated handler information block 0 is executed. [Step S2-1] The address indicated by the timer queue read address register 101 is accessed from the work memory, and the remaining time data of the cyclically activated handler information block 0 is copied to the register 53. This processing is performed in the same manner as in the specific example 3, except that the multiplexer 48, the path from the timer queue read address register 101 to the register 53,
52 to operate to transfer data. Next, the data in the register 53 is read by the ALU 51, "1" is reduced from the data, and the data is written back to the register 53 again.

【0171】[ステップS2−3]0検出回路46を動
作させて、ALU51の出力が“0”になっているかど
うかを判断する。“0”になっていなければ、この周期
起動ハンドラはまだ起動できないと判定される。残り時
間が“0”の場合には、ALU51の出力が“0”にな
るから、このとき0検出がなされる。 [ステップS2−4]タイマキューライトアドレスレジ
スタ102に記憶されたアドレスをワークメモリに出力
し、レジスタ53に記憶させた周期起動ハンドラ情報ブ
ロック0の残り時間データを書き戻す。
[Step S2-3] The 0 detection circuit 46 is operated to determine whether or not the output of the ALU 51 is "0". If it is not "0", it is determined that this cyclically activated handler cannot be activated yet. If the remaining time is "0", the output of the ALU 51 becomes "0", and thus, 0 is detected at this time. [Step S2-4] The address stored in the timer queue write address register 102 is output to the work memory, and the remaining time data of the cyclically activated handler information block 0 stored in the register 53 is written back.

【0172】[ステップS2−5]同様にして、タイマ
キューライトアドレスレジスタ102に記憶されたアド
レス値をALU51に転送し、“3”を加算する。そし
て、その結果をタイマキューライトアドレスレジスタ1
02に書き戻す。同時に、タイマキューリードアドレス
レジスタ101も同じアドレス値を書き込む。こうし
て、アドレスを“3”進めることによって、周期起動ハ
ンドラ情報ブロック0の残り時間を読み取る状態から、
周期起動ハンドラ情報ブロック1の残り時間を読み取る
状態に移る。即ち、上記のステップS1−0と2−0の
処理によって、周期起動ハンドラ情報ブロック0の残り
時間をデクリメントし、残り時間が“0”でないことを
判断して次に移るといった処理が完了する。
[Step S2-5] Similarly, the address value stored in the timer queue write address register 102 is transferred to the ALU 51, and "3" is added. Then, the result is stored in the timer queue write address register 1.
Write it back to 02. At the same time, the timer queue read address register 101 writes the same address value. In this way, by advancing the address by “3”, the state where the remaining time of the cyclically activated handler information block 0 is read from
The state shifts to a state where the remaining time of the cyclically activated handler information block 1 is read. That is, the processing of steps S1-0 and 2-0 decrements the remaining time of the cyclically activated handler information block 0, determines that the remaining time is not "0", and proceeds to the next processing.

【0173】[ステップS3−0]ここでは、周期起動
ハンドラ情報ブロック1の処理を実行する。 [ステップS3−1]ワークメモリから、タイマキュー
リードアドレスレジスタ101の指すアドレスをアクセ
スする。そして、周期起動ハンドラ情報ブロック1の残
り時間データを読み取り、これをレジスタ53にライト
する。
[Step S3-0] Here, the process of the cyclically activated handler information block 1 is executed. [Step S3-1] The address indicated by the timer queue read address register 101 is accessed from the work memory. Then, the remaining time data of the cyclically activated handler information block 1 is read, and this is written to the register 53.

【0174】[ステップS3−2]レジスタ53に記憶
されたデータを取り出し、ALU51を用いて“1”だ
け減算する。 [ステップS3−3]0検出回路46によってALUの
結果が“0”になっているかどうかを判断する。例え
ば、ここでALU51の出力が“0”になったとする。
この場合、周期起動ハンドラ情報ブロック1が指定した
周期起動ハンドラが起動できると判断される。これに基
づいて、周期起動ハンドラの起動処理が進められる。
[Step S3-2] The data stored in the register 53 is taken out, and the ALU 51 is used to subtract "1". [Step S3-3] The 0 detection circuit 46 determines whether or not the result of the ALU is "0". For example, it is assumed here that the output of the ALU 51 has become “0”.
In this case, it is determined that the cyclically activated handler specified by the cyclically activated handler information block 1 can be activated. Based on this, the activation process of the cyclically activated handler proceeds.

【0175】[ステップS3−4]周期起動ハンドラ情
報ブロック1の周期時間データをアクセスするために、
タイマキューリードアドレスレジスタ101のアドレス
値をALU51に転送し、ここに“1”を加算する。そ
の値をタイマキューリードアドレスレジスタ101に書
き戻す。タイマキューライトアドレスレジスタ102の
内容は、ここではそのまま保存しておく。
[Step S3-4] In order to access the cycle time data of the cycle activation handler information block 1,
The address value of the timer queue read address register 101 is transferred to the ALU 51, and "1" is added thereto. The value is written back to the timer queue read address register 101. The contents of the timer queue write address register 102 are stored here as they are.

【0176】[ステップS3−5]ワークメモリからタ
イマキューリードアドレスレジスタの指すアドレスをア
クセスし、周期起動ハンドラ情報ブロック1の周期時間
データをレジスタ53に書き込む。タイマキューライト
アドレスレジスタ102のアドレスをワークメモリに出
力して、レジスタ53に記憶した周期起動ハンドラ情報
ブロック1の周期期間データを残り時間データを表示す
る領域に書き込む。こうして、残り時間に相当するデー
タが初期値に戻される。
[Step S3-5] The address indicated by the timer queue read address register is accessed from the work memory, and the cycle time data of the cycle start handler information block 1 is written into the register 53. The address of the timer queue write address register 102 is output to the work memory, and the cycle period data of the cycle start handler information block 1 stored in the register 53 is written to the area for displaying the remaining time data. Thus, the data corresponding to the remaining time is returned to the initial value.

【0177】[ステップS3−6、3−7]周期起動ハ
ンドラ情報ブロック1のハンドラIDをアクセスするた
めに、タイマキューリードアドレスレジスタのアドレス
“1”をALUに転送し、これに“1”を加算する。そ
の結果をタイマキューリードアドレスレジスタ101に
書き戻す。なお、同時にこの値をタイマキューライトア
ドレスレジスタ102にも書き込む。
[Steps S3-6, 3-7] In order to access the handler ID of the cyclically activated handler information block 1, the address “1” of the timer queue read address register is transferred to the ALU, and “1” is set therein. to add. The result is written back to the timer queue read address register 101. At the same time, this value is also written to the timer queue write address register 102.

【0178】[ステップS3−8]ワークメモリからハ
ンドラIDをアクセスし、ビットマトリクス記憶部10
の該当するアドレスにおけるビットマトリクスの要素を
“1”に変更する。こうして、周期起動ハンドラに対応
するタスクを実行状態にする。周期起動ハンドラに相当
するタスクは高い優先度のところに割り付けられるの
で、具体例1の手順より即時実施されることになる。
[Step S3-8] The handler ID is accessed from the work memory, and the bit matrix storage 10
Is changed to "1" in the bit matrix at the corresponding address. Thus, the task corresponding to the cyclically activated handler is set to the execution state. Since the task corresponding to the cyclically activated handler is assigned to a high priority, the task is immediately executed according to the procedure of the first embodiment.

【0179】[ステップS3−9]次の周期起動ハンド
ラ情報ブロックにアクセスするため、タイマキューリー
ドアドレスレジスタのアドレス値をALU51に転送
し、“1”を加算する。そして、その結果をタイマキュ
ーリードアドレスレジスタ101とタイマキューライト
アドレスレジスタ102とに書き込む。
[Step S3-9] In order to access the next cyclically activated handler information block, the address value of the timer queue read address register is transferred to the ALU 51, and "1" is added. Then, the result is written to the timer queue read address register 101 and the timer queue write address register 102.

【0180】[ステップS4−0]ここで、周期起動ハ
ンドラ情報ブロック2の処理を実行する。 [ステップS4−1]ワークメモリからタイマキューリ
ードアドレスレジスタ101の指すアドレスをアクセス
し、周期起動ハンドラ情報ブロック2の残り時間データ
をレジスタ53に書き込む。例えば、残り時間のデータ
の内容を“0”にセットしておくと、周期起動ハンドラ
は起動していないことを表す。周期起動ハンドラ情報ブ
ロック2の残り時間データが“0”であるとする。
[Step S4-0] Here, the process of the cyclically activated handler information block 2 is executed. [Step S4-1] The address indicated by the timer queue read address register 101 is accessed from the work memory, and the remaining time data of the cyclically activated handler information block 2 is written into the register 53. For example, if the content of the remaining time data is set to “0”, it indicates that the cyclically activated handler has not been activated. It is assumed that the remaining time data of the cyclically activated handler information block 2 is “0”.

【0181】[ステップS4−2]レジスタ53に記憶
されたデータをALU51に転送し、“1”を差し引
く。 [ステップS4−3]0負検出回路108でALU51
の出力した結果が負になったことを検出する。これによ
って、周期起動ハンドラが起動していないことが分か
る。その結果はシーケンサ47に出力される。シーケン
サ47は、この場合に次の周期起動ハンドラ情報ブロッ
クへのアクセスを開始するように動作する。即ち、ステ
ップS3−4〜ステップS3−9、あるいはステップS
2−4〜ステップS2−5の処理を省略し、タイマキュ
ーリードアドレスレジスタ101とタイマキューライト
アドレスレジスタ102のアドレスをジャンプさせるよ
うに動作する。
[Step S4-2] The data stored in the register 53 is transferred to the ALU 51, and "1" is subtracted. [Step S4-3] The ALU 51 is detected by the 0 negative detection circuit 108.
Detects that the output result of has become negative. This indicates that the cyclically activated handler has not been activated. The result is output to the sequencer 47. In this case, the sequencer 47 operates to start accessing the next cyclically activated handler information block. That is, step S3-4 to step S3-9, or step S3
The processing of 2-4 to step S2-5 is omitted, and the operation is performed so that the addresses of the timer queue read address register 101 and the timer queue write address register 102 are jumped.

【0182】[ステップS4−4]即ち、タイマキュー
リードアドレスレジスタ101のアドレス値を読み出
し、ALU51において“3”を加算する。そして、そ
の結果をタイマキューリードアドレスレジスタ101に
書き込む。同時に、タイマキューライトアドレスレジス
タ102にも同じアドレスを書き込む。
[Step S4-4] That is, the address value of the timer queue read address register 101 is read, and "3" is added in the ALU 51. Then, the result is written into the timer queue read address register 101. At the same time, the same address is written to the timer queue write address register 102.

【0183】[ステップS5−0]ここで、周期起動ハ
ンドラ情報ブロック5の最後の処理を実行する。 [ステップS5−1]周期起動ハンドラ情報ブロックの
末尾は、タイマキューライトアドレスレジスタのアドレ
ス値とタイムキューテールアドレスレジスタ105のア
ドレス値とが一致した場合である。図22に示すよう
に、最後の周期起動ハンドラ情報ブロックのアドレス値
がタイムキューテールアドレスレジスタ105に記憶さ
れている。従って、一致回路106によってタイマキュ
ーライトアドレスレジスタ102の内容とを比較して、
一致した場合に、ハンドラ探索終了となる。その終了結
果はCPUに通知される。
[Step S5-0] Here, the last process of the cyclically activated handler information block 5 is executed. [Step S5-1] The end of the cyclically activated handler information block is when the address value of the timer queue write address register matches the address value of the time queue tail address register 105. As shown in FIG. 22, the address value of the last cyclically activated handler information block is stored in the time queue tail address register 105. Therefore, the content of the timer queue write address register 102 is compared by the matching circuit 106,
If they match, the handler search ends. The end result is notified to the CPU.

【0184】従って、上記のように、タイマ100が起
動し、ハンドラ処理が開始されると、ハンドラ終了ま
で、図21に示した回路が自動的に処理を実行する。そ
して、ハンドラ起動の情報は、ビットマトリクス記憶部
10に記憶される。そして、他のタスクと同様に、優先
度順に処理される。
Therefore, as described above, when the timer 100 is started and the handler processing is started, the circuit shown in FIG. 21 automatically executes the processing until the handler ends. Then, the information of the activation of the handler is stored in the bit matrix storage unit 10. Then, like other tasks, they are processed in order of priority.

【0185】〈具体例4の効果〉以上のように、周期起
動ハンドラが存在した場合に、各ハンドラ毎の残り時間
と周期時間とを含む周期起動ハンドラ情報を記憶するメ
モリと、前記周期時間を初期値として前記残り時間がデ
クリメントされ、残り時間が無くなったことを検出する
回路と、残り時間が無くなったとき、該当する周期起動
ハンドラを実行可能状態に移すように、各タスクの優先
度と優先度別順位を示す情報を記憶した記憶回路の内容
を書き換えるデータと、書き込みアドレスを出力する回
路を設けたので、一致回路がハンドラ処理の終了を検出
するまで、CPUは全く処理に関与する必要がない。従
って、ハンドラ処理が高速にでき、しかもCPUの負荷
が十分に軽減される。また、この具体例は、具体例3と
同様の回路を利用することができ、周期起動処理とイベ
ントフラグ処理とをシーケンサ以外は同一のハードウェ
アで実現することが可能になる。即ち、兼用が可能にな
る。
<Effect of Specific Example 4> As described above, when a cyclically activated handler exists, a memory for storing cyclically activated handler information including a remaining time and a periodic time for each handler is provided. The remaining time is decremented as an initial value, and a circuit for detecting that the remaining time has run out, and when the remaining time runs out, the priority and priority of each task so as to shift the corresponding cyclically activated handler to an executable state. Since the data for rewriting the contents of the storage circuit storing the information indicating the rank order and the circuit for outputting the write address are provided, the CPU does not need to be involved in the processing at all until the matching circuit detects the end of the handler processing. Absent. Therefore, the handler process can be performed at high speed, and the load on the CPU is sufficiently reduced. In this specific example, the same circuit as that of the specific example 3 can be used, and the periodic start processing and the event flag processing can be realized by the same hardware except for the sequencer. That is, dual use is possible.

【0186】〈具体例5〉複数のCPUを使用し、OS
とアプリケーションとを動作させる場合、一方のCPU
でOSとアプリケーションを制御し、他方のCPUで残
りのアプリケーションを制御することが多い。この場
合、OSを制御するCPUは、他のCPUからのシステ
ムコール処理に多くのサイクルが割かれる。従って、O
Sを制御するCPUのアプリケーション実行効率が低下
するという問題がある。
<Example 5> When a plurality of CPUs are used and the OS
To run the application and the application
Often controls the OS and applications, and the other CPU controls the remaining applications. In this case, the CPU that controls the OS spends many cycles on system call processing from another CPU. Therefore, O
There is a problem that the application execution efficiency of the CPU controlling S is reduced.

【0187】また、1つのCPUにOSのみを実行さ
せ、他のCPUでアプリケーションを実行するという方
法もある。この場合、全てのアプリケーションがOSの
システムコールを呼び出していないときは、OSに割り
付けられたCPUはほとんど動作しない。即ち、資源が
有効に活用されない。逆に、他のCPUから複数のシス
テムコールがあった場合、一方のシステムコールについ
ての処理が完了するまでは他方のシステムコールについ
ての処理は待たされる。いずれの場合でも、マルチプロ
セッサにより効率よくリアルタイムOSを実行させるの
は容易でない。
There is also a method in which one CPU executes only the OS, and another CPU executes an application. In this case, when all applications do not call the OS system call, the CPU assigned to the OS hardly operates. That is, resources are not effectively used. Conversely, when there are a plurality of system calls from another CPU, the processing for the other system call is suspended until the processing for one system call is completed. In any case, it is not easy to efficiently execute the real-time OS by the multiprocessor.

【0188】図23には、リアルタイムOS装置の変形
例ブロック図を示す。この装置は、メインメモリ66、
ワークメモリ67、デコーダ68及び複数のCPU60
を備える。更に、OSをハードウェアで実現するための
RTOSコプロセッサ65を設けている。メインメモリ
66には、CPU60のアプリケーションプログラムと
データを保持する。CPU69が、いわゆるマルチプロ
セッサ構成である場合を除き、全体としての構成は、図
4を用いて説明した具体例1の装置と同様である。
FIG. 23 is a block diagram showing a modification of the real-time OS device. This device comprises a main memory 66,
Work memory 67, decoder 68, and multiple CPUs 60
Is provided. Further, an RTOS coprocessor 65 for realizing the OS by hardware is provided. The main memory 66 holds application programs and data of the CPU 60. Except for the case where the CPU 69 has a so-called multiprocessor configuration, the overall configuration is the same as the device of the first embodiment described with reference to FIG.

【0189】図24には、具体例5のリアルタイムOS
装置ブロック図を示す。この例でも、具体例1と同様の
8×8ビットマトリクス記憶部10を使用する。即ち、
ここには8×8個の要素が記憶される。ただし、各要素
は具体例1と異なり、全て2ビットで表され、それぞれ
次のように状態が割り付けられる。“00”は停止状態
を表す。“01”は実行可能状態を表す。“10”は待
ち状態を表す。“11”は実行状態を表す。
FIG. 24 shows a real-time OS according to the fifth embodiment.
FIG. 2 shows a device block diagram. Also in this example, the same 8 × 8 bit matrix storage unit 10 as in the first embodiment is used. That is,
Here, 8 × 8 elements are stored. However, each element is different from the specific example 1 and is all represented by 2 bits, and the state is assigned as follows. “00” indicates a stopped state. “01” indicates an executable state. “10” indicates a waiting state. “11” indicates an execution state.

【0190】ライト要求HRCS、データMD、アドレ
スMAが入力する構成と、これらをデコーダ72でデコ
ードする構成は、具体例1と同様である。デコーダ72
には、優先度と優先順位とを合わせた信号ADRNが入
力する。先入れ先出しメモリ73は、ライト要求HRC
S、データMD、アドレスMA及びデコーダ72の出力
を受け入れて、入力した順番に記憶し、出力するFIF
Oである。デコーダ72の出力は、この先入れ先出しメ
モリ73に一時的に記憶され、フリップフロップ75を
通じてセルフクリア信号として出力されるよう構成され
ている。
The configuration in which the write request HRCS, data MD, and address MA are input and the configuration in which these are decoded by the decoder 72 are the same as in the first embodiment. Decoder 72
, A signal ADRN in which the priority and the priority are combined is input. The first-in first-out memory 73 stores the write request HRC
S, the data MD, the address MA, and the output of the decoder 72, and are stored and output in the order of input.
O. The output of the decoder 72 is temporarily stored in the first-in first-out memory 73, and is output as a self-clear signal through a flip-flop 75.

【0191】微分回路71は、モード切り替えの際に出
力されるモード信号を受け入れて、先入れ先出しメモリ
73の更新制御用の信号を出力する回路である。マルチ
プレクサ74は、ビットマトリクス記憶部10への書き
込みアドレスやデータを選択制御する回路である。この
マルチプレクサ74は、先入れ先出しメモリ73の出力
とADRNの出力のいずれか一方を選択して、ビットマ
トリクス記憶部10に供給するよう動作する。
The differentiating circuit 71 is a circuit that receives a mode signal output at the time of mode switching and outputs a signal for controlling the update of the first-in first-out memory 73. The multiplexer 74 is a circuit that selectively controls a write address and data to be written to the bit matrix storage unit 10. The multiplexer 74 operates to select one of the output of the first-in first-out memory 73 and the output of the ADRN and supply the selected one to the bit matrix storage unit 10.

【0192】先入れ先出しメモリ73からの出力は、シ
ステムコールによって選択される。一方、ADRNの選
択は、実行可能状態から実行状態へ遷移する即ち状態を
変えるために行われる。プライオリティエンコーダ12
は、具体例1と全く同様の機能を持ち、実行可能状態に
ある最も高い優先度を計算し、これに該当する4ビット
のデータを出力する。
The output from the first-in first-out memory 73 is selected by a system call. On the other hand, the selection of the ADRN is performed to make a transition from the executable state to the execution state, that is, to change the state. Priority encoder 12
Has exactly the same function as the first embodiment, calculates the highest priority in the executable state, and outputs 4-bit data corresponding to the highest priority.

【0193】フリップフロップ75は、セルフクリア信
号のタイミング調整も行う。優先度レジスタ76は、プ
ライオリティエンコーダ12の出力を記憶するためのも
ので、ここでは上半分がCPU0の優先度レベル値を保
持し、下半分がCPU1の優先度レベル値を保持してい
る。
Flip-flop 75 also adjusts the timing of the self-clear signal. The priority register 76 stores the output of the priority encoder 12, in which the upper half holds the priority level value of the CPU0 and the lower half holds the priority level value of the CPU1.

【0194】MIN77は、優先度レジスタ76に保持
された優先度のレベル値の小さいものを選択して、その
レベル値とCPUの番号とを出力する選択器である。優
先度のレベル値は比較器78に向けて出力される。比較
器78のもう一方の端子にはプライオリティエンコーダ
12の出力が加えられる。また、CPUの番号はレジス
タ82に向け出力される。なお、優先度レジスタ76に
記憶された優先度のレベル値が等しい場合には、CPU
0の番号とそのレベル値を出力する。
The MIN 77 is a selector for selecting a priority having a smaller priority level value held in the priority register 76 and outputting the level value and the CPU number. The priority level value is output to the comparator 78. The output of the priority encoder 12 is applied to the other terminal of the comparator 78. The CPU number is output to the register 82. If the priority level values stored in the priority register 76 are equal, the CPU
The number of 0 and its level value are output.

【0195】選択器81は、優先度レジスタ76に記憶
されたレベル値の一方を選択して出力するマルチプレク
サである。MIN77が出力する番号がレジスタ82に
記憶され、このレジスタに記憶された番号によって選択
器81の選択動作が制御される。レジスタ82は、MI
N77の出力を記憶し、割り込みモードから切り替え時
になるまで、その記憶内容を保持する。
The selector 81 is a multiplexer for selecting and outputting one of the level values stored in the priority register 76. The number output by the MIN 77 is stored in the register 82, and the selection operation of the selector 81 is controlled by the number stored in this register. The register 82 stores the MI
The output of N77 is stored, and the stored contents are held until the time of switching from the interrupt mode.

【0196】比較器78、オアゲート79は、具体例1
と同様に動作する。即ち、比較器78は、プライオリテ
ィエンコーダ12の出力とMIN77の出力の比較を
し、プライオリティエンコーダ12の出力が大きい場合
には、“1”を出力する。オアゲート79は、セルフク
リア信号と比較器78の出力の論理和をとってフリップ
フロップ80に出力する回路である。
The comparator 78 and the OR gate 79 are described in the first embodiment.
Works the same as. That is, the comparator 78 compares the output of the priority encoder 12 with the output of the MIN 77, and outputs “1” when the output of the priority encoder 12 is large. The OR gate 79 is a circuit that calculates the logical sum of the self-clear signal and the output of the comparator 78 and outputs the result to the flip-flop 80.

【0197】選択器83は、CPU0割り込みとCPU
1割り込みの割り込み信号をアサートするための回路で
ある。フリップフロップ80から出力された信号は、こ
の選択器83によって、CPU0割り込みあるいはCP
U1割り込みとして出力される。レジスタ82に記憶さ
れた信号が、この選択器83の出力先を制御する。
The selector 83 selects the CPU0 interrupt and the CPU
This is a circuit for asserting an interrupt signal of one interrupt. The signal output from the flip-flop 80 is output to the selector 83 by the CPU 0 interrupt or CP.
Output as a U1 interrupt. The signal stored in the register 82 controls the output destination of the selector 83.

【0198】優先度別順位検出回路85は、図1に示し
たマルチプレクサ18や、図5に示したアンドゲート2
2,23及びマルチプレクサ28を含む回路を一括して
表示したものである。その内容は、具体例1と全く同一
とする。マルチプレクサ84は、セルフクリア信号がア
サートされた場合に、ビットマトリクス記憶部10への
ライトアドレスの下位即ち優先度別順位に相当する信号
を選択して出力する回路である。
The priority-based order detection circuit 85 includes the multiplexer 18 shown in FIG. 1 and the AND gate 2 shown in FIG.
2, 23 and a circuit including the multiplexer 28 are collectively displayed. The contents are exactly the same as in the first embodiment. The multiplexer 84 is a circuit that, when the self-clear signal is asserted, selects and outputs a signal corresponding to the lower order of the write address to the bit matrix storage unit 10, that is, the priority order.

【0199】図25には、具体例5の装置のスタックポ
インタアドレス生成回路ブロック図を示す。この図で具
体例1の場合と異なるのは、マルチプレクサ86とレジ
スタ87の部分である。マルチプレクサ86は、セルフ
クリア信号がアサートされた場合に、ビットマトリクス
記憶部10のライトアドレスの上位即ち優先度に対応す
る部分を選択するマルチプレクサである。
FIG. 25 is a block diagram of a stack pointer address generation circuit of the device of the fifth embodiment. This figure is different from the example 1 in a multiplexer 86 and a register 87. The multiplexer 86 is a multiplexer that selects, when the self-clear signal is asserted, a portion corresponding to the higher order of the write address of the bit matrix storage unit 10, that is, the portion corresponding to the priority.

【0200】レジスタ87は、順位を保持するレジスタ
である。この保持のタイミングは、旧タスクのスタック
アドレスをスタックポインタテーブルに書き込むときに
生成される退避完了信号がアサートされたときである。
レジスタ88は、スタックポインタテーブルのトップを
示すアドレスを記憶するレジスタである。加算器38の
機能は具体例1と同様である。
The register 87 is a register for holding the order. This holding timing is when the save completion signal generated when the stack address of the old task is written in the stack pointer table is asserted.
The register 88 is a register that stores an address indicating the top of the stack pointer table. The function of the adder 38 is the same as that of the first embodiment.

【0201】以下、上記回路の具体的な動作を示す。図
26(a)には、各タスクのアドレスとビットマトリク
スの初期状態を示す。また、(b)〜(e)にはタスク
task0〜task3の内容を示す。図26(a)に
示すように、タスクtask0とtask1は、それぞ
れ対応するビットマトリクスが“01”になっている。
これによって、両タスクは実行可能状態になっている。
一方、タスクtask2とtask3とは、対応するビ
ットマトリクスが“00”となっている。従って、これ
らのタスクは、休止状態である。
The specific operation of the above circuit will be described below. FIG. 26A shows the initial state of the address and bit matrix of each task. (B) to (e) show the contents of tasks task0 to task3. As shown in FIG. 26A, the task task0 and the task1 have bit matrices corresponding to “01”.
As a result, both tasks are in an executable state.
On the other hand, the corresponding bit matrices of the tasks task2 and task3 are “00”. Therefore, these tasks are dormant.

【0202】動作を簡単に説明するために、各タスクは
最大2つのシステムコールしか使用しないことにする。
sta−tskは、タスクの起動を意味する。引数のタ
スクIDに対応するタスクを停止状態から実行状態へ遷
移させる。即ち、この場合に、ビットマトリクスの内容
を“00”から“01”に遷移させる。ext−tsk
は実行状態である自タスクを停止状態へ遷移させるため
のものである。即ち、ビットマトリクスの内容が“1
1”であるものを“00”に遷移させる。また、図の/
*と*/の間に挟まれた番号は、次の処理の番号に対応
する。
For simplicity of operation, each task will use only a maximum of two system calls.
“sta-tsk” means activation of a task. The task corresponding to the task ID of the argument is changed from the stop state to the execution state. That is, in this case, the content of the bit matrix is changed from “00” to “01”. ext-tsk
Is for causing the in-task being executed to transition to the stopped state. That is, the content of the bit matrix is "1".
1 is transited to “00”.
The number between * and * / corresponds to the number of the next process.

【0203】図27に、各CPU上のタスクの実行順序
説明図を示す。この図には、それぞれ(1)〜(11)
まで、タスクの動作状況を時系列的に表したタイムチャ
ートが示されている。各CPU毎に、それぞれ図のよう
な順番にシステムコールが実行される。図のPRIR0
とPRIR1とは、各CPUの優先度レベルレジスタに
設定された優先度を示す。以下、この図に示す(1)〜
(11)までのステップの動作を順に説明していく。
FIG. 27 is a diagram for explaining the execution order of the tasks on each CPU. In this figure, (1) to (11)
Up to this, a time chart showing the operation status of the task in chronological order is shown. The system calls are executed in the order shown in the figure for each CPU. PRIR0 in the figure
And PRIR1 indicate the priority set in the priority level register of each CPU. Hereinafter, (1)-shown in this figure
The operation of the steps up to (11) will be described in order.

【0204】[ステップ(1)]まず、図24に示した
プライオリティエンコーダ12がビットマトリクス記憶
部10から実行可能状態の要素で最も優先度が高いもの
を取り出す。図26(a)に示した内容のビットマトリ
クスを処理すると、その出力は“1110”となる。最
上位ビットは、具体例1と同様、有効、無効を表すビッ
トである。従って、ここでタスクtask0が割り振ら
れている優先度6に対応する信号が取り出され、比較器
78に供給される。
[Step (1)] First, the priority encoder 12 shown in FIG. 24 takes out the executable element having the highest priority from the bit matrix storage section 10. When the bit matrix having the contents shown in FIG. 26A is processed, the output is “1110”. The most significant bit is a bit indicating validity or invalidity as in the first example. Therefore, a signal corresponding to the priority 6 to which the task task0 is allocated is extracted and supplied to the comparator 78.

【0205】優先度レジスタ76は初期状態なので、オ
ール0である。従って、MIN77から最小値“000
0”が比較器78に向け出力される。また、番号“0”
がレジスタ82に向け出力される。レジスタ82は、こ
の番号“0”を割り込みモードが解消されるまで保持す
る。比較器78は、プライオリティエンコーダ12の出
力の方が大きいと判断し、“1”を出力する。この信号
はオアゲート79を通り、フリップフロップ80をセッ
トする。
Since the priority register 76 is in the initial state, it is all 0s. Therefore, the minimum value “000” is obtained from MIN77.
"0" is output to the comparator 78. The number "0" is also output.
Is output to the register 82. The register 82 holds this number “0” until the interrupt mode is canceled. The comparator 78 determines that the output of the priority encoder 12 is larger, and outputs “1”. This signal passes through the OR gate 79 and sets the flip-flop 80.

【0206】レジスタ82には、“0”が記憶されてお
り、これが選択器83に入力する。その結果、選択器8
3に入力したフリップフロップ80の出力は、CPU0
割り込みとなって該当するプロセッサに向け出力され
る。即ち、ここで割り込み信号がアサートされる。その
結果、CPU0はコンテキストの切り替えを実行する。
同時に、CPU0はレジスタをスタックに退避する。
[0206] "0" is stored in the register 82, and this is input to the selector 83. As a result, the selector 8
The output of the flip-flop 80 input to CPU 3 is
An interrupt is output to the corresponding processor. That is, the interrupt signal is asserted here. As a result, the CPU 0 executes context switching.
At the same time, CPU0 saves the register on the stack.

【0207】加算器38には、スタックポインタテーブ
ルレジスタ88の出力が入力している。それ以外の入力
は初期値で“0”だから、加算結果はスタックポインタ
テーブルレジスタ88に記憶された内容となる。従っ
て、この結果出力されるスタックポインタアドレスにC
PU0の退避処理が行われる。CPU0による退避完了
信号がアサートされると、優先度レジスタ76が更新さ
れる。
The output of the stack pointer table register 88 is input to the adder 38. The other inputs are initially "0", so that the addition result is the content stored in the stack pointer table register 88. Therefore, the stack pointer address output as a result is C
The evacuation processing of PU0 is performed. When the save completion signal is asserted by the CPU 0, the priority register 76 is updated.

【0208】一方、優先度別順位検出回路85は、ビッ
トマトリクス記憶部10から優先度が“6”の実行可能
状態の優先度ラインビットを取り出す。この信号は、図
25に示すマルチプレクサ86と順位レジスタ87とに
供給される。順位レジスタ87は、この信号をそのまま
記憶する。ここで、スタックポインタテーブルレジスタ
88の出力と順位レジスタ87の出力とが加算器38に
入力するので、スタックポインタアドレスの値は“11
0010”に対応する値になる。
On the other hand, the priority order detection circuit 85 fetches an executable priority line bit having a priority “6” from the bit matrix storage unit 10. This signal is supplied to the multiplexer 86 and the order register 87 shown in FIG. The order register 87 stores this signal as it is. Here, since the output of the stack pointer table register 88 and the output of the order register 87 are input to the adder 38, the value of the stack pointer address is “11”.
0010 ".

【0209】図28には、エンコーダからCPU割り込
みまでのタイミングチャートを示す。図中(a)は、シ
ステムクロックである。図のタイミングt1で、プライ
オリティエンコーダ12が起動した。なお、これ以前に
レジスタ82は、“0”の信号を出力しているものとす
る。このとき、タイミングt2のクロックの立ち上がり
で、CPU0の割り込み信号がアサートされる。CPU
0の割り込み信号がアサートされると、旧タスクのスタ
ックへの退避処理がなされる。
FIG. 28 shows a timing chart from the encoder to the CPU interrupt. (A) in the figure is a system clock. At the timing t1 in the figure, the priority encoder 12 starts. It is assumed that the register 82 has output a signal of “0” before this. At this time, at the rising edge of the clock at the timing t2, the interrupt signal of the CPU 0 is asserted. CPU
When the 0 interrupt signal is asserted, the old task is saved to the stack.

【0210】tnのクロックの立ち上がりで、退避完了
信号がアサートされ、tn+1のクロックの立ち上がり
で、優先度レジスタ76に優先度が記憶される。また、
優先度別順位検出回路85からの出力が対応する優先度
別順位レジスタ30に記憶される。また、優先度別順位
検出回路85の出力が順位レジスタ87に記憶される。
At the rise of the clock at tn, the save completion signal is asserted, and at the rise of the clock at tn + 1, the priority is stored in the priority register. Also,
The output from the priority order detection circuit 85 is stored in the corresponding priority order register 30. The output of the priority order detection circuit 85 is stored in the order register 87.

【0211】図29には、CPUのモードの切り替えと
タイミング説明図を示す。図の(a)には、CPUの割
り込みモードの切り替え説明図を示した。図に示すよう
に、割り込みが発生すると、通常モードから割り込みモ
ードに移る。そして、割り込みモードでは、現レジスタ
のスタックへの退避を行い、新たなレジスタのスタック
からの回復を行う。割り込みモードが終了すると、再び
通常モードに戻る。
FIG. 29 is a diagram for explaining the switching of CPU modes and timing. FIG. 7A is a diagram for explaining the switching of the interrupt mode of the CPU. As shown in the figure, when an interrupt occurs, the mode shifts from the normal mode to the interrupt mode. In the interrupt mode, the current register is saved on the stack, and the new register is restored from the stack. When the interrupt mode ends, the mode returns to the normal mode again.

【0212】(b)に、モード切り替えのタイミング説
明図を示す。図のタイミングt1で、割り込み信号がア
サートされると、CPUは割り込みモードに入る。即
ち、図のタイミングt1〜t2まで、割り込みモード信
号が有効になっている。この間が割り込みモードであ
る。この間に、(a)で示したように、現レジスタのス
タックへの退避と新レジスタへのスタックの回復を行
う。
(B) is a timing chart for mode switching. When the interrupt signal is asserted at the timing t1 in the figure, the CPU enters the interrupt mode. That is, the interrupt mode signal is valid from timing t1 to t2 in the drawing. This is the interrupt mode. During this time, as shown in (a), the current register is saved to the stack and the stack is restored to the new register.

【0213】その後、通常モードへ戻るが、このとき、
タイミングt2で、割り込みモード信号がネゲートとさ
れ、図24に示す微分回路71がアサートされる。これ
によって、先入れ先出しメモリ73中に記憶されている
最先に記憶されたデータとアドレスがマルチプレクサ7
4を通じてビットマトリクス記憶部に供給される。
Thereafter, the mode returns to the normal mode.
At timing t2, the interrupt mode signal is negated, and the differentiating circuit 71 shown in FIG. 24 is asserted. As a result, the data and address stored first in the first-in first-out memory 73 are stored in the multiplexer 7.
4 to the bit matrix storage unit.

【0214】こうして、ビットマトリクス記憶部10の
内容が更新される。この例の場合には、ビットマトリク
ス記憶部10の要素(6,2)のビット状態が“01”
から“11”、即ち実行可能状態から実行状態に切り替
えられる。
Thus, the contents of the bit matrix storage section 10 are updated. In the case of this example, the bit state of the element (6, 2) of the bit matrix storage unit 10 is “01”.
To "11", that is, from the executable state to the executable state.

【0215】[ステップ(2)]ビットマトリクス記憶
部10の要素(6,2)のビット状態が“01”から
“11”に書き替えられると、プライオリティエンコー
ダ12の出力は次に高い実行可能状態のtask1の優
先度レベルを出力する。この内容は、“1011”であ
る。MIN77は、優先度データが入っていない方のデ
ータ即ち内容“0000”のデータとそのCPU番号
“1”を出力する。
[Step (2)] When the bit state of the element (6, 2) in the bit matrix storage section 10 is rewritten from “01” to “11”, the output of the priority encoder 12 becomes the next executable state. Output the priority level of task1. This content is “1011”. The MIN 77 outputs data without priority data, that is, data of the content “0000” and its CPU number “1”.

【0216】比較器78は、プライオリティエンコーダ
12の出力とMIN77の出力を比較する。プライオリ
ティエンコーダ12の出力の方が大きいため、比較器7
8は“1”を出力する。この信号はオアゲート79を通
じて、フリップフロップ80をセットする。レジスタ8
2には、既に説明した通り、“1”が記憶されている。
これが選択器83に入力する。選択器83は、この制御
に従ってフリップフロップ80の出力をCPU1割り込
み信号とする。即ち、CPU1割り込み信号がアサート
される。
The comparator 78 compares the output of the priority encoder 12 with the output of the MIN 77. Since the output of the priority encoder 12 is larger, the comparator 7
8 outputs "1". This signal sets the flip-flop 80 through the OR gate 79. Register 8
2 stores “1” as described above.
This is input to the selector 83. The selector 83 sets the output of the flip-flop 80 as a CPU1 interrupt signal according to this control. That is, the CPU1 interrupt signal is asserted.

【0217】その後は、ステップ(1)と同様にして処
理がなされ、その後ビットマトリクス記憶部10の要素
(3,1)のビット状態が“01”から“11”に書き
替えられる。
Thereafter, the processing is performed in the same manner as in step (1), and then the bit state of the element (3, 1) in the bit matrix storage unit 10 is rewritten from "01" to "11".

【0218】[ステップ(3)]CPU0で動作してい
るタスクtask0によってシステムコールsta−t
sk(task3−id)が発行される。ビットマトリ
クス記憶部10上のtask3−idである(4,0)
の要素に“01”をライトする。これによって、この要
素に対応するタスクが実行可能状態になる。
[Step (3)] The system call “start-t” is executed by the task “task0” operating on the CPU0.
sk (task3-id) is issued. Task3-id on the bit matrix storage unit 10 (4,0)
"01" is written to the element of. As a result, the task corresponding to this element becomes executable.

【0219】[ステップ(4)]プライオリティエンコ
ーダ12の出力は、task3−idである(4,0)
の要素に対応する値である。この内容は、“1100”
である。比較器78は、優先度レジスタ76に記憶され
た“1011”と“1100”とを比較する。“101
1”の方が小さいので、これが比較器78に向け出力さ
れる。比較器78は、プライオリティエンコーダ12の
出力の方が大きいと判断して、再び“1”の信号を出力
する。
[Step (4)] The output of the priority encoder 12 is a task 3-id (4, 0).
Is the value corresponding to the element of. This content is “1100”
It is. The comparator 78 compares “1011” stored in the priority register 76 with “1100”. “101
Since "1" is smaller, it is output to the comparator 78. The comparator 78 determines that the output of the priority encoder 12 is larger, and outputs the signal of "1" again.

【0220】MIN77は、レジスタ82に対し、
“1”という信号を出力している。従って、レジスタ8
2の出力によって選択器83が制御され、CPU1割り
込みがアサートされる。このCPU1割り込みによっ
て、task1のビットマトリクス記憶部10の要素
(3,1)は、“11”から“10”に変わる。即ち、
実行状態から実行可能状態に状態を遷移させる。その
後、ステップ(1)と同様に処理され、ビットマトリク
ス記憶部10の要素(4,0)のビット状態が、“0
1”から“11”に書き替えられる。即ち、割り込みモ
ードからの切り替え時に実行可能状態から実行状態への
遷移が行われる。
The MIN 77 provides the register 82 with
The signal "1" is output. Therefore, register 8
The selector 83 is controlled by the output of 2, and the CPU1 interrupt is asserted. Due to the CPU1 interrupt, the element (3, 1) of the bit matrix storage unit 10 of task1 changes from “11” to “10”. That is,
Transition the state from the execution state to the executable state. Thereafter, processing is performed in the same manner as in step (1), and the bit state of the element (4, 0) of the bit matrix
It is rewritten from "1" to "11", that is, transition from the executable state to the executable state is performed when switching from the interrupt mode.

【0221】図30には、システムコールsta−ts
k(task3−id)の動作のタイミングチャートを
示す。この図は、図28と同一の形式で記載している。
タイミングt1で、ビットマトリクスに対して、tas
k3に対応する要素(4,0)が更新される。即ち、そ
の内容が“00”から“01”に更新される。同時に、
MIN77の出力する番号がレジスタ82に記憶され
る。タイミングt2で、比較器78における比較が実行
され、タイミングt3で、割り込み信号がアサートされ
る。
FIG. 30 shows a system call "sta-ts".
4 shows a timing chart of the operation of k (task3-id). This figure is described in the same format as FIG.
At timing t1, the bit matrix
The element (4, 0) corresponding to k3 is updated. That is, the content is updated from “00” to “01”. at the same time,
The number output by the MIN 77 is stored in the register 82. At timing t2, the comparison in the comparator 78 is performed, and at timing t3, the interrupt signal is asserted.

【0222】割り込み信号がアサートされると、旧タス
クのスタックへの退避処理がなされる。tnのクロック
の立ち上がりで退避完了信号がアサートされると、tn
+1のクロックの立ち上がりでtask1のビットマト
リクス上の要素が“11”から“10”に書き替えられ
る。即ち、実行状態から待ち状態に切り替わる。同時
に、優先度レジスタ76と、順位レジスタ87と、優先
度別順位レジスタ30の内容が更新される。
When the interrupt signal is asserted, the old task is saved to the stack. When the save completion signal is asserted at the rise of the clock at tn, tn
At the rising edge of the +1 clock, the element on the bit matrix of task1 is rewritten from "11" to "10". That is, the state is switched from the execution state to the waiting state. At the same time, the contents of the priority register 76, the order register 87, and the priority order register 30 are updated.

【0223】[ステップ(5)]task0が自分自身
を停止状態にさせるext−tskシステムコールを発
行したとする。この場合、デコーダ72において、ビッ
トマトリクス用のアドレスとCPUで動作しているタス
クのアドレスが一致かどうか判断される。もし、一致す
る場合には、先入れ先出しメモリ73のセルフクリア信
号記憶部分に“1”が立つ。ext−tskシステムコ
ールに対応するデータが、先入れ先出しメモリ73の先
頭に来た場合、ビットマトリクス記憶部10へのライト
動作がなされる。この場合、ビットマトリクス記憶部1
0上でのタスクtask0の要素(6,2)を“11”
から“00”に遷移させる。即ち、実行状態から停止状
態に遷移させる。
[Step (5)] It is assumed that task0 issues an ext-tsk system call for stopping itself. In this case, the decoder 72 determines whether the address for the bit matrix matches the address of the task running on the CPU. If they match, "1" is set in the self-clearing signal storage portion of the first-in first-out memory 73. When data corresponding to the ext-tsk system call comes to the head of the first-in first-out memory 73, a write operation to the bit matrix storage unit 10 is performed. In this case, the bit matrix storage unit 1
The element (6, 2) of task task0 on “0” is “11”
To “00”. That is, a transition is made from the execution state to the stop state.

【0224】同時に、優先度レジスタ76のPRIR0
をクリアする。このセルフクリア信号によって、マルチ
プレクサ74はライトアドレスを選択する。優先度別順
位検出回路85の出力は、図25に示すマルチプレクサ
86に入力して、その後、マルチプレクサ34に入力す
る。減算器33は、マルチプレクサ86の内容を減算
し、ここではその内容が優先度別順位レジスタ30に記
憶される。セルフクリア信号は、即ちマルチプレクサ8
4とマルチプレクサ86を通じて、選択器81から入力
した信号を減算器33に送り込む。
At the same time, PRIR0 of priority register 76
Clear The multiplexer 74 selects a write address according to the self-clear signal. The output of the priority order detection circuit 85 is input to the multiplexer 86 shown in FIG. The subtracter 33 subtracts the content of the multiplexer 86, and the content is stored in the priority order register 30 here. The self-clear signal is output from the multiplexer 8
The signal input from the selector 81 is sent to the subtracter 33 through the multiplexer 4 and the multiplexer 86.

【0225】マルチプレクサ34は、セルフクリア信号
によって減算器33の出力を選択して優先度別順位レジ
スタ30に向け出力する。このセルフクリア信号によっ
て、優先度別順位レジスタ30への書き込みが制御され
ることは具体例1で説明した通りである。一方、セルフ
クリア信号は、図24のオアゲート79とフリップフロ
ップ80を通じてCPU0割り込み信号とされる。即
ち、CPU0割り込みがアサートされる。
The multiplexer 34 selects the output of the subtracter 33 according to the self-clear signal and outputs it to the priority order register 30. As described in the first embodiment, the writing to the priority order register 30 is controlled by the self-clear signal. On the other hand, the self-clear signal is a CPU0 interrupt signal through the OR gate 79 and the flip-flop 80 in FIG. That is, the CPU0 interrupt is asserted.

【0226】[ステップ(6)]優先度レジスタ76の
PRIR0の内容がクリアされたことによって、MIN
77からは“0000”が選択されて比較器78に出力
される。番号は、“0”がレジスタ82に出力される。
比較器78は、プライオリティエンコーダ12の出力の
方がMIN77の出力よりも大きいため、“1”を出力
する。こうして、CPU1割り込み信号がアサートされ
る。なお、優先度レジスタ76のPRIR0には、“1
011”が設定される。その後、ステップ(1)と同様
に処理されて、ビットマトリクス記憶部10の要素
(3,1)のビット状態が“01”から“11”に書き
替えられる。即ち、実行可能状態から実行状態に書き替
えられる。
[Step (6)] When the contents of PRIR0 of the priority register 76 are cleared, MIN
From “77”, “0000” is selected and output to the comparator 78. The number “0” is output to the register 82.
The comparator 78 outputs “1” because the output of the priority encoder 12 is larger than the output of MIN77. Thus, the CPU1 interrupt signal is asserted. It should be noted that “1” is stored in PRIR0 of the priority register 76.
011 "is set, and the process is performed in the same manner as in step (1), and the bit state of the element (3, 1) in the bit matrix storage unit 10 is rewritten from" 01 "to" 11 ". It is rewritten from the executable state to the executable state.

【0227】図31には、システムコールext−ts
k(task0−id)のタイミングチャートを示す。
タイミングt1で、ビットマトリクス記憶部10に記憶
されたtask0に対応する状態ビットを停止状態にす
る。同時に、優先度レジスタ76の有効ビットをクリア
する。タイミングt2で、セルフクリア信号がアサート
され、同時に優先度別順位レジスタ30の内容を更新す
る。
FIG. 31 shows a system call ext-ts
6 shows a timing chart of k (task0-id).
At timing t1, the state bit corresponding to task0 stored in the bit matrix storage unit 10 is set to the stop state. At the same time, the valid bit of the priority register 76 is cleared. At timing t2, the self-clear signal is asserted, and at the same time, the contents of the priority order register 30 are updated.

【0228】ビットマトリクス記憶部10の内容が更新
されたことで、プライオリティエンコーダ12の出力が
変わり、タイミングt3で、割り込み信号がアサートさ
れる。割り込み信号がアサートされると、旧タスクのス
タックへの退避処理がなされる。tnのクロックの立ち
上がりで、退避完了信号がアサートされ、tn+1のク
ロックの立ち上がりで、優先度レジスタ76、順位レジ
スタ87と、優先度別順位レジスタ30を更新する。Δ
*2がそのタイミングを示している。
The output of the priority encoder 12 changes due to the update of the contents of the bit matrix storage unit 10, and the interrupt signal is asserted at timing t3. When the interrupt signal is asserted, the old task is saved on the stack. At the rise of the clock at tn, the save completion signal is asserted, and at the rise of the clock at tn + 1, the priority register 76, the order register 87, and the priority order register 30 are updated. Δ
* 2 indicates the timing.

【0229】[ステップ(7)]CPU0状態を指して
いるtask1によってシステムコールsta−tsk
(task2−id)が発行される。ビットマトリクス
上のtask2−idである要素(3,4)に“01”
即ち実行可能状態の情報をライトする。プライオリティ
エンコーダ12の出力とMIN77の出力が比較器78
で比較される。両方とも同一の値なので、比較器78の
出力は“0”のままである。
[Step (7)] The system call "sta-tsk" is executed by task1 indicating the CPU0 state.
(Task2-id) is issued. “01” is added to the element (3, 4) that is task2-id on the bit matrix.
That is, the information of the executable state is written. The output of the priority encoder 12 and the output of the MIN 77
Are compared. Since both are the same value, the output of the comparator 78 remains "0".

【0230】[ステップ(8)]task3が自分自身
を停止状態にさせるext−tskシステムコールを発
行する。このとき、ビットマトリクス記憶部10上での
task0の要素(4,0)を“11”から“00”に
遷移させる。同時に、優先度レジスタ76のPRIR1
をクリアする。セルフクリア信号がオアゲート79から
選択器83に出力され、CPU1割り込みがアサートさ
れる。
[Step (8)] Task3 issues an ext-tsk system call for stopping itself. At this time, the element (4, 0) of task0 on the bit matrix storage unit 10 is changed from “11” to “00”. At the same time, PRIR1 of the priority register 76
Clear The self-clear signal is output from the OR gate 79 to the selector 83, and the CPU1 interrupt is asserted.

【0231】[ステップ(9)]優先度レジスタ76の
PRIR1がクリアされたことによって、MIN77は
“000”とCPU番号“1”を出力する。比較器78
は、プライオリティエンコーダ12の出力とMIN77
の出力を比較し、プライオリティエンコーダの出力が大
きいので、これまでと同様の要領で割り込み信号がアサ
ートされる。その後、ステップ(1)と同様に処理され
て、ビットマトリクス記憶部10の要素(3,4)のビ
ット状態が“01”から“11”に書き替えられる。
[Step (9)] Since PRIR1 of the priority register 76 is cleared, the MIN 77 outputs "000" and the CPU number "1". Comparator 78
Is the output of the priority encoder 12 and MIN77
And the output of the priority encoder is large, the interrupt signal is asserted in the same manner as before. Thereafter, the same processing as in step (1) is performed, and the bit state of the element (3, 4) in the bit matrix storage unit 10 is rewritten from “01” to “11”.

【0232】[ステップ(10)]task1が自分自
身を停止状態にさせるext−tskシステムコールを
発行する。このとき、ビットマトリクス記憶部10上で
のtask1の要素(3,1)を“11”の実行状態か
ら“00”の停止状態に遷移させる。同時に、優先度レ
ジスタ76のPRIR0をクリアする。セルフクリア信
号がこれによって選択器83に向け出力され、CPU0
割り込みがアサートされる。
[Step (10)] Task1 issues an ext-tsk system call for stopping itself. At this time, the element (3, 1) of task1 on the bit matrix storage unit 10 is changed from the execution state of “11” to the stop state of “00”. At the same time, PRIR0 of the priority register 76 is cleared. This outputs a self-clear signal to the selector 83, and the CPU 0
Interrupt is asserted.

【0233】[ステップ(11)]task2が自分自
身を停止状態にさせるext−tskシステムコールを
発行する。このとき、ビットマトリクス記憶部10上で
のtask2の要素(3,4)を“11”から“00”
に遷移させる。同時に、優先度レジスタ76のPRIR
1をクリアする。このクリア信号が選択器83を通じて
出力され、CPU1割り込みがアサートされる。
[Step (11)] Task2 issues an ext-tsk system call for stopping itself. At this time, the element (3, 4) of task2 on the bit matrix storage unit 10 is changed from “11” to “00”.
Transition to. At the same time, the PRIR of the priority register 76
Clear 1 This clear signal is output through the selector 83, and the CPU1 interrupt is asserted.

【0234】〈具体例5の効果〉以上のように、この具
体例では、各タスクの優先度と優先度別順位を示す情報
を記憶した記憶回路に、各タスクの停止状態と実行可能
状態と待ち状態と実行状態とを区別する情報を含めた。
従って、複数のCPUに対する割り込みについても、ビ
ットマトリクス記憶部への状態情報を詳細にし、いずれ
のタスクをいずれのCPUが実行しているかという情報
を一体化してCPU割り込みを発生させることによっ
て、ハードウェアによるタスクの実行順序制御が可能に
なる。その結果、優先度の低いタスクが動いているCP
Uに対してディスパッチすることが可能になる。従っ
て、マルチプロセッサ形式においても、具体例1で説明
した通りのスケジュール処理が実行可能になる。
<Effect of Specific Example 5> As described above, in this specific example, the stopped state and the executable state of each task are stored in the storage circuit storing the priority of each task and the information indicating the priority order. Includes information that distinguishes between waiting and running states.
Therefore, even for interrupts to a plurality of CPUs, hardware information is generated by refining the state information in the bit matrix storage unit and integrating information on which task is executing which CPU. Can control the execution order of tasks. As a result, the CP on which the lower priority task is running
It becomes possible to dispatch to U. Therefore, even in the multiprocessor format, the schedule processing as described in the first embodiment can be executed.

【0235】以上のように、本発明は、高速なスループ
ットが要求される組み込みCPUに広く利用することが
できる。更に、上記の各具体例では、MPUを想定して
説明を行ったが、プログラム実行のプロセッサであれば
他の様々なディジタルシグナルプロセッサを利用するこ
とが可能である。更に、イベントフラグの処理を変更し
てセマフォの処理でも容易に本発明を実施することがで
きる。
As described above, the present invention can be widely used for embedded CPUs requiring high throughput. Further, in each of the above specific examples, description has been made assuming an MPU, but any other digital signal processor can be used as long as it is a processor for executing a program. Further, the present invention can be easily implemented by changing semaphore processing by changing the processing of the event flag.

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

【図1】具体例1のリアルタイムOS装置主要部ブロッ
ク図である。
FIG. 1 is a block diagram of a main part of a real-time OS device according to a first embodiment.

【図2】一般的なレディキューの構成例説明図である。FIG. 2 is an explanatory diagram of a configuration example of a general ready queue.

【図3】一般的なウェイトキューの構成例説明図であ
る。
FIG. 3 is a diagram illustrating a configuration example of a general wait queue.

【図4】具体例1のリアルタイムOS装置ブロック図で
ある。
FIG. 4 is a block diagram of a real-time OS device according to a first embodiment;

【図5】スタックポインタアドレス生成回路のブロック
図である。
FIG. 5 is a block diagram of a stack pointer address generation circuit.

【図6】スタックポインタテーブルの構成説明図であ
る。
FIG. 6 is an explanatory diagram of a configuration of a stack pointer table.

【図7】タスクの初期割り付け状況説明図である。FIG. 7 is an explanatory diagram of the initial assignment status of tasks.

【図8】各タスクの内容とタスクの実行順序説明図であ
る。
FIG. 8 is a diagram illustrating the contents of each task and the execution order of the tasks.

【図9】タスク0のシステムコールslp−tsk(t
ask0−id)のタイミングチャートである。
FIG. 9 shows a system call slp-tsk (t
It is a timing chart of ask0-id).

【図10】一般的な割り込みコントローラのハードウェ
ア構成説明図である。
FIG. 10 is an explanatory diagram of a hardware configuration of a general interrupt controller.

【図11】割り込みハンドラの処理例説明図である。FIG. 11 is an explanatory diagram of a processing example of an interrupt handler.

【図12】具体例2のビットマトリクス記憶部ブロック
図である。
FIG. 12 is a block diagram of a bit matrix storage unit according to a specific example 2.

【図13】割り込みの初期割り付け状況説明図である。FIG. 13 is an explanatory diagram of the initial assignment status of interrupts.

【図14】割り込み処理のタイミングチャートである。FIG. 14 is a timing chart of interrupt processing.

【図15】一般のイベントフラグキューの構成例説明図
である。
FIG. 15 is an explanatory diagram of a configuration example of a general event flag queue.

【図16】イベントフラグ使用例説明図である。FIG. 16 is an explanatory diagram of an example of using an event flag.

【図17】イベントフラグハードウェアのブロック図で
ある。
FIG. 17 is a block diagram of event flag hardware.

【図18】ワークメモリ上のイベントフラグ情報の割り
付け例説明図である。
FIG. 18 is an explanatory diagram of an example of assignment of event flag information on a work memory.

【図19】周期起動ハンドラのハードウェアブロック図
である。
FIG. 19 is a hardware block diagram of a cyclically activated handler.

【図20】周期起動ハンドラキューの構成説明図であ
る。
FIG. 20 is a diagram illustrating the configuration of a cyclically activated handler queue.

【図21】周期起動ハードウェアのブロック図である。FIG. 21 is a block diagram of periodic activation hardware.

【図22】ワークメモリ上の周期起動ハンドラ情報の割
り付け例説明図である。
FIG. 22 is an explanatory diagram of an example of allocation of cyclically activated handler information on a work memory.

【図23】リアルタイムOS装置変形例のブロック図で
ある。
FIG. 23 is a block diagram of a modification of the real-time OS device.

【図24】具体例5のリアルタイムOS装置主要部ブロ
ック図である。
FIG. 24 is a block diagram of a main part of a real-time OS device according to a fifth embodiment;

【図25】具体例5の装置のスタックポインタアドレス
生成回路ブロック図である。
FIG. 25 is a block diagram of a stack pointer address generation circuit of the device of the fifth embodiment.

【図26】タスクの初期割り付け状況説明図である。FIG. 26 is an explanatory diagram of the initial assignment status of tasks.

【図27】各CPU上のタスクの実行順序説明図であ
る。
FIG. 27 is an explanatory diagram of the execution order of tasks on each CPU.

【図28】エンコーダからCPU割り込みまでのタイミ
ングチャートである。
FIG. 28 is a timing chart from an encoder to a CPU interrupt.

【図29】CPUのモードの切り替えとタイミング説明
図である。
FIG. 29 is a diagram illustrating switching of modes and timing of a CPU.

【図30】システムコールsta−tsk(task3
−id)動作のタイミングチャートである。
FIG. 30 shows a system call “sta-tsk (task3)”.
It is a timing chart of -id) operation | movement.

【図31】システムコールext−tsk(task0
−id)のタイミングチャートである。
FIG. 31 shows a system call ext-tsk (task0
It is a timing chart of -id).

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

10 ビットマトリクス記憶部 11 アドレスレジスタ 12 プライオリティエンコーダ 13 優先度レジスタ 14 比較器 15 デコーダ 16 フリップフロップ 17 オアゲート 18 マルチプレクサ 20 スタックポインタアドレス生成回路 10 bit matrix storage unit 11 address register 12 priority encoder 13 priority register 14 comparator 15 decoder 16 flip-flop 17 OR gate 18 multiplexer 20 stack pointer address generation circuit

Claims (8)

【特許請求の範囲】[Claims] 【請求項1】 スケジューリングの対象となる各タスク
の優先度と優先度別順位を示す情報を記憶した記憶回路
と、 この記憶回路に記憶された前記タスクの優先度と優先度
別順位のうちから、最も高い優先度のタスクの優先度を
読み出す回路と、読み出したタスクの優先度と実行中の
タスクの優先度とを比較する回路と、当該読み出した優
先度が実行中のタスクの優先度より高いときにプロセッ
サにタスク切り替えのための割り込み信号を出力する回
路とを含む割り込み信号出力用回路と、 前記記憶回路から読み出したタスクの優先度と、前記記
憶回路に記憶された該当する優先度のタスクのうちの優
先度別順位の高いタスクの優先度別順位とを受け入れ
て、タスク切り替えに使用するスタックポインタアドレ
スを生成するスタックポインタアドレス生成用回路とを
備えたことを特徴とするリアルタイムOS装置。
1. A storage circuit for storing information indicating the priority of each task to be scheduled and a priority order, and a task priority and a priority order of the tasks stored in the storage circuit. A circuit for reading the priority of the task having the highest priority, a circuit for comparing the priority of the task read and the priority of the task being executed, and a circuit for reading the priority which is higher than the priority of the task being executed. An interrupt signal output circuit including a circuit that outputs an interrupt signal for task switching to the processor when the priority is high; a priority of the task read from the storage circuit; and a corresponding priority stored in the storage circuit. A stack pointer that accepts the priority of tasks with higher priority among tasks and generates a stack pointer address used for task switching. Real-time OS apparatus characterized by comprising a circuit for generating address.
【請求項2】 請求項1に記載のリアルタイムOS装置
において、 前記スタックポインタアドレス生成用回路は、 前記割り込み信号出力用回路から、実行中のタスクの現
優先度を受け入れて、実行中のタスクの退避用スタック
ポインタアドレスを生成して出力し、 プロセッサから退避完了信号が入力したとき、前記記憶
回路から新たに読み出したタスクの次優先度を受け入れ
て、新たに実行されるタスクのスタックポインタアドレ
スを生成して出力する信号合成回路を備えたことを特徴
とするリアルタイムOS装置。
2. The real-time OS device according to claim 1, wherein the stack pointer address generation circuit receives the current priority of the task being executed from the interrupt signal output circuit, and receives the current priority of the task being executed. A save stack pointer address is generated and output. When a save completion signal is input from the processor, the next priority of the task newly read from the storage circuit is accepted, and the stack pointer address of the newly executed task is changed. A real-time OS device comprising a signal synthesizing circuit for generating and outputting.
【請求項3】 請求項1に記載のリアルタイムOS装置
において、 直前に退避したタスクまたは待ち状態に遷移したタスク
の優先度別順位を、優先度別に保持して、各タスクの優
先度と優先度別順位を示す情報を記憶した記憶回路から
読み出した優先度ラインビットの一部をマスクして、同
一優先度でキューの先頭にあるタスクを、次に実行する
タスクとして選択するキュー制御回路を備えたことを特
徴とするリアルタイムOS装置。
3. The real-time OS device according to claim 1, wherein the priorities of the tasks saved immediately before or the tasks that have transited to the waiting state are retained by priority, and the priority of each task and the priority of each task are retained. A queue control circuit that masks a part of the priority line bit read from the storage circuit storing the information indicating the different order and selects a task at the head of the queue with the same priority as a task to be executed next; A real-time OS device.
【請求項4】 請求項1に記載のリアルタイムOS装置
において、 各タスクの優先度と優先度別順位を示す情報を記憶した
記憶回路に割り込み信号を記憶させたことを特徴とする
リアルタイムOS装置。
4. The real-time OS device according to claim 1, wherein an interrupt signal is stored in a storage circuit storing information indicating the priority of each task and the priority order.
【請求項5】 請求項1に記載のリアルタイムOS装置
において、 各タスクの優先度と優先度別順位を示す情報を記憶した
記憶回路に割り込み信号と割り込み信号の有効性を示す
イネーブルビットとを記憶させたことを特徴とするリア
ルタイムOS装置。
5. The real-time OS device according to claim 1, wherein an interrupt signal and an enable bit indicating the validity of the interrupt signal are stored in a storage circuit storing information indicating the priority of each task and the order of priority. A real-time OS device, characterized in that it is made to operate.
【請求項6】 請求項1に記載のリアルタイムOS装置
において、 イベントフラグ待ち状態のタスクが存在した場合に、各
タスク毎の現状フラグパターンと待ちフラグパターンと
を含むイベントフラグ情報を記憶するメモリと、 前記現状フラグパターンと待ちフラグパターンとを比較
する回路と、 現状フラグパターンと待ちフラグパターンとが一致した
とき、前記待ち状態のタスクを実行可能状態に移すよう
に、各タスクの優先度と優先度別順位を示す情報を記憶
した記憶回路の内容を書き換えるデータと、書き込みア
ドレスを出力する回路を設けたことを特徴とするリアル
タイムOS装置。
6. The real-time OS device according to claim 1, wherein when there is a task in an event flag waiting state, a memory for storing event flag information including a current flag pattern and a waiting flag pattern for each task. A circuit for comparing the current flag pattern with the wait flag pattern, and when the current flag pattern and the wait flag pattern match, the priority and priority of each task are shifted to the executable state. A real-time OS device, comprising: a circuit for rewriting data in a memory circuit storing information indicating a rank order; and a circuit for outputting a write address.
【請求項7】 請求項1に記載のリアルタイムOS装置
において、 周期起動ハンドラが存在した場合に、各ハンドラ毎の残
り時間と周期時間とを含む周期起動ハンドラ情報を記憶
するメモリと、 前記現残り時間と周期時間とを比較する回路と、 現状フラグパターンと待ちフラグパターンとが一致した
とき、該当する周期起動ハンドラを実行可能状態に移す
ように、各タスクの優先度と優先度別順位を示す情報を
記憶した記憶回路の内容を書き換えるデータと、書き込
みアドレスを出力する回路を設けたことを特徴とするリ
アルタイムOS装置。
7. The real-time OS device according to claim 1, wherein when there is a cyclically activated handler, a memory for storing cyclically activated handler information including a remaining time and a cyclic time for each handler; A circuit that compares the time with the cycle time, and, when the current flag pattern and the wait flag pattern match, indicates the priority and priority order of each task so that the corresponding cyclically activated handler is shifted to the executable state. A real-time OS device comprising a circuit for rewriting data in a storage circuit storing information and a circuit for outputting a write address.
【請求項8】 請求項1に記載のリアルタイムOS装置
において、 各タスクの優先度と優先度別順位を示す情報を記憶した
記憶回路に、各タスクの停止状態と実行可能状態と待ち
状態と実行状態とを区別する情報を含めたことを特徴と
するリアルタイムOS装置。
8. The real-time OS device according to claim 1, wherein each of the tasks has a stop state, an executable state, a wait state, and an execution state in a storage circuit storing information indicating the priority of each task and the order of priority. A real-time OS device including information for distinguishing from a state.
JP25344999A 1999-09-07 1999-09-07 Real time os device Pending JP2001075820A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP25344999A JP2001075820A (en) 1999-09-07 1999-09-07 Real time os device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP25344999A JP2001075820A (en) 1999-09-07 1999-09-07 Real time os device

Publications (1)

Publication Number Publication Date
JP2001075820A true JP2001075820A (en) 2001-03-23

Family

ID=17251562

Family Applications (1)

Application Number Title Priority Date Filing Date
JP25344999A Pending JP2001075820A (en) 1999-09-07 1999-09-07 Real time os device

Country Status (1)

Country Link
JP (1) JP2001075820A (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008023426A1 (en) 2006-08-24 2008-02-28 Netcleus Systems Corporation Task processing device
WO2009022371A1 (en) * 2007-08-16 2009-02-19 Netcleus Systems Corporation Task processor
JP2010049700A (en) * 2009-10-21 2010-03-04 Net Kuriasu Systems Kk Task processing apparatus
JP5024899B2 (en) * 2006-03-27 2012-09-12 株式会社日立製作所 Data processing device
US8327379B2 (en) 2006-08-24 2012-12-04 Kernelon Silicon Inc. Method for switching a selected task to be executed according with an output from task selecting circuit
WO2013175610A1 (en) 2012-05-24 2013-11-28 カーネロンシリコン株式会社 Task processor
KR101366802B1 (en) 2007-01-05 2014-02-21 삼성전자주식회사 Method and apparatus for scheduling tasks in Real-Time Operating System
US8996761B2 (en) 2007-08-10 2015-03-31 Kernelon Silicon Inc. Virtual queue processing circuit and task processor
JP2021174366A (en) * 2020-04-28 2021-11-01 株式会社デンソー Real-time arithmetic processing unit

Cited By (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5024899B2 (en) * 2006-03-27 2012-09-12 株式会社日立製作所 Data processing device
US9753729B2 (en) 2006-08-24 2017-09-05 Renesas Electronics Corporation System for selecting a task to be executed according to an output from a task control circuit
WO2008023426A1 (en) 2006-08-24 2008-02-28 Netcleus Systems Corporation Task processing device
US8327379B2 (en) 2006-08-24 2012-12-04 Kernelon Silicon Inc. Method for switching a selected task to be executed according with an output from task selecting circuit
US9342350B2 (en) 2006-08-24 2016-05-17 Renesas Electronics Corporation System for selecting a task to be executed according to an output from a task control circuit
KR101366802B1 (en) 2007-01-05 2014-02-21 삼성전자주식회사 Method and apparatus for scheduling tasks in Real-Time Operating System
US9047120B2 (en) 2007-08-10 2015-06-02 Kernelon Silicon Inc. Virtual queue processing circuit and task processor
US8996761B2 (en) 2007-08-10 2015-03-31 Kernelon Silicon Inc. Virtual queue processing circuit and task processor
US10949249B2 (en) 2007-08-16 2021-03-16 Renesas Electronics Corporation Task processor
US9104470B2 (en) 2007-08-16 2015-08-11 Renesas Electronics Corporation Task processor
US8341641B2 (en) 2007-08-16 2012-12-25 Kernelon Silicon Inc. Task processor
WO2009022371A1 (en) * 2007-08-16 2009-02-19 Netcleus Systems Corporation Task processor
US9766924B2 (en) 2007-08-16 2017-09-19 Renesas Electronics Corporation Task processor
US10387191B2 (en) 2007-08-16 2019-08-20 Renesas Electronics Corporation Task processor
JPWO2009022371A1 (en) * 2007-08-16 2010-11-04 ネットクリアスシステムズ株式会社 Task processing device
US8776079B2 (en) 2007-08-16 2014-07-08 Kernelon Silicon Inc. Task processor
JP2010049700A (en) * 2009-10-21 2010-03-04 Net Kuriasu Systems Kk Task processing apparatus
WO2013175610A1 (en) 2012-05-24 2013-11-28 カーネロンシリコン株式会社 Task processor
US9753779B2 (en) 2012-05-24 2017-09-05 Renesas Electronics Corporation Task processing device implementing task switching using multiple state registers storing processor id and task state
JP7338548B2 (en) 2020-04-28 2023-09-05 株式会社デンソー Real-time processor
JP2021174366A (en) * 2020-04-28 2021-11-01 株式会社デンソー Real-time arithmetic processing unit

Similar Documents

Publication Publication Date Title
JP4088335B1 (en) Virtual queue processing circuit and task processing device
JP6153925B2 (en) Task processing device
US9342350B2 (en) System for selecting a task to be executed according to an output from a task control circuit
US8776079B2 (en) Task processor
US8516483B2 (en) Transparent support for operating system services for a sequestered sequencer
US20060150184A1 (en) Mechanism to schedule threads on OS-sequestered sequencers without operating system intervention
JP4127848B2 (en) Task processing device
JP2005284749A (en) Parallel computer
JP2001075820A (en) Real time os device
JP5155336B2 (en) Task processing device
JP2001249808A (en) Information processor
JP2002082815A (en) Task program control system
JP2017123190A (en) Task processing device
US7702836B2 (en) Parallel processing device and exclusive control method
JP5204740B2 (en) Task processing device
JP2008269597A (en) Task processor
JP2019003710A (en) Task processing device
CN115858132A (en) Thread scheduling method, thread scheduling device, thread scheduling chip, electronic equipment and storage medium
JPH02173828A (en) Interruption process system
JP2001125880A (en) Real time multi-processor system
JPS61234437A (en) Data prefetch device
JPH03179532A (en) Computer device

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20041101

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20041214

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20050412