JP2659603B2 - Arithmetic processing method and arithmetic processing device - Google Patents

Arithmetic processing method and arithmetic processing device

Info

Publication number
JP2659603B2
JP2659603B2 JP2096841A JP9684190A JP2659603B2 JP 2659603 B2 JP2659603 B2 JP 2659603B2 JP 2096841 A JP2096841 A JP 2096841A JP 9684190 A JP9684190 A JP 9684190A JP 2659603 B2 JP2659603 B2 JP 2659603B2
Authority
JP
Japan
Prior art keywords
task
tasks
executions
instruction
switching
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.)
Expired - Fee Related
Application number
JP2096841A
Other languages
Japanese (ja)
Other versions
JPH03294930A (en
Inventor
聡 田中
啓介 田中
勝彦 佐津川
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Panasonic Holdings Corp
Original Assignee
Matsushita Electric Industrial Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP2096841A priority Critical patent/JP2659603B2/en
Publication of JPH03294930A publication Critical patent/JPH03294930A/en
Application granted granted Critical
Publication of JP2659603B2 publication Critical patent/JP2659603B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Description

【発明の詳細な説明】 〔産業上の利用分野〕 この発明は、複数のタスクを時分割で実行することに
より複数のタスクを並列処理することが可能なハードウ
ェアのスワップ機能を有する演算処理装置を用いた演算
処理方法に関するものである。
Description: BACKGROUND OF THE INVENTION The present invention relates to an arithmetic processing unit having a hardware swap function capable of executing a plurality of tasks in a time-division manner and performing a plurality of tasks in parallel. The present invention relates to an arithmetic processing method using.

〔従来の技術〕[Conventional technology]

マイクロコンピュータに代表される演算処理装置で、
並列処理を行う方法の一つとして、ソフトウェアで、レ
ジスタおよびフラグの内容を退避し、タスクを切り替え
るという、割り込み処理によって実現する方法がある。
しかしながら、割り込み処理のオーバーヘッドのため、
タスクの高速切り替えは困難である。このため、ハード
ウェア上で、レジスタ,フラグ等を並列処理させるタス
クの数だけ用意し、これを切り替えることによって複数
のタスクを実行させるという方法が考えられた。
An arithmetic processing unit represented by a microcomputer.
As one of the methods of performing the parallel processing, there is a method of saving the contents of a register and a flag and switching tasks by software, which is realized by interrupt processing.
However, due to the overhead of interrupt processing,
Fast task switching is difficult. For this reason, a method has been conceived in which the number of tasks for which registers, flags, and the like are to be processed in parallel is prepared on hardware, and a plurality of tasks are executed by switching these.

第7図は従来のこの種の演算処理装置におけるスワッ
プ機能部分のブロック図を示している。第7図では、例
として4つのタスクを並列に実行可能な演算処理装置を
仮定している。
FIG. 7 is a block diagram of a swap function part in a conventional processor of this type. In FIG. 7, an arithmetic processing unit capable of executing four tasks in parallel is assumed as an example.

第7図において、ウェイトフラグ回路1は、動作させ
ないタスクを示すフラグを立てる回路である。タスクに
対してこのウェイトフラグが立っているときは、そのタ
スクの処理を行わず、つぎのタスクへ進む。
In FIG. 7, a wait flag circuit 1 sets a flag indicating a task not to be operated. When the wait flag is set for a task, the process proceeds to the next task without performing the processing of the task.

スワップコントロール回路2は、現在実行しているタ
スクとウェイトフラグ回路1におけるウェイトフラグの
情報とから、つぎに実行するタスクを決定する論理回路
である。このスワップコントロール回路2は、タスクの
状態を示す信号CPUS0,CPUS1を出力する。
The swap control circuit 2 is a logic circuit that determines the next task to be executed based on the currently executed task and the information of the wait flag in the wait flag circuit 1. The swap control circuit 2 outputs signals CPUS0 and CPUS1 indicating the state of the task.

第8図は従来の演算処理装置におけるスワップのタイ
ミングを示すタイミング図である。この図では、例とし
て4つのタスクA,B,C,Dが並列に実行できる演算処理装
置において、ウェイトフラグが立っていない場合のタイ
ミングを示しており、4つのタスクA,B,C,Dが1命令ず
つ順次時分割で実行されていることを示している。
FIG. 8 is a timing chart showing the timing of swap in a conventional arithmetic processing unit. In this figure, as an example, in an arithmetic processing unit that can execute four tasks A, B, C, and D in parallel, the timing when the wait flag is not set is shown, and the four tasks A, B, C, and D are shown. Are sequentially executed one by one in a time-division manner.

このように、ハードウェア制御でn個のタスクのスワ
ップを行うとき、全タスクを均等に実行できる。
Thus, when swapping n tasks under hardware control, all tasks can be executed equally.

上記のようにハードウェア制御でn個のタスクのスワ
ップを行うと、各タスクが同率に実行できることがメリ
ットとなる。また、命令毎のスワップは、各タスクを均
等に実行することができ、また、巨視的にはタスクが並
列に実行されているように見えリアルタイム性を維持す
ることができる。
When the n tasks are swapped by hardware control as described above, there is an advantage that each task can be executed at the same rate. In addition, the swap for each instruction can execute each task equally, and macroscopically, the tasks appear to be executed in parallel, and the real-time property can be maintained.

しかしながら、4つのタスクA,B,C,Dを同率で並列に
実行できる演算処理装置の場合を考えると、4つのタス
クA,B,C,Dの各々を構成する命令数が同一でない場合、
例えばタスクA,Cを構成する命令数がタスクB,Dを構成す
る命令数の2倍であって、タスクA,CがタスクB,Dに比べ
て2倍の処理をしなければならない場合において、同率
の実行比率では、第9図のように、前半は、見かけ上タ
スクA,B,CおよびDが並列に処理される。タスクB,Dは処
理の100パーセントがこの段階で終わっているが、タス
クA,Cについてはこの段階では処理の50パーセントしか
終わっていない。後半は、タスクB,Dの処理が終わって
いるので、タスクB,Dについてはウェイトフラグを立て
ることによりウェイトさせ、タスクA,Cの残りの50パー
セントを処理することになる。
However, considering an arithmetic processing unit that can execute the four tasks A, B, C, and D in parallel at the same rate, when the number of instructions constituting each of the four tasks A, B, C, and D is not the same,
For example, in the case where the number of instructions configuring tasks A and C is twice the number of instructions configuring tasks B and D, and tasks A and C must perform twice as many tasks as tasks B and D At the same execution ratio, tasks A, B, C and D are apparently processed in parallel in the first half as shown in FIG. For tasks B and D, 100% of the processing is completed at this stage, while for tasks A and C, only 50% of the processing is completed at this stage. In the latter half, the processing of tasks B and D has been completed, so that tasks B and D are set to wait by setting a wait flag, and the remaining 50% of tasks A and C are processed.

このように、従来の演算処理装置では、タスクA,B,C,
Dのうち、あるタスクだけ、例えばタスクA,Cの処理を特
に優先したい場合において、それ以外のタスクB,Dが処
理を終えて停止した後で、優先したいタスクA,Cの残っ
た処理を行わねばならず、その間はタスクB,Dにつづく
次のタスクの実行を行うことができず、並列処理のリア
ルタイム性が失われる。つまり、スワップの率が同率で
固定では、処理の優先の点から、あるタスクが終了した
後、すぐに次のタスクを実行することができず、待ちが
入って処理効率が悪くなる。
Thus, in the conventional arithmetic processing unit, tasks A, B, C,
Of D, only a certain task, for example, if you want to give priority to the processing of tasks A and C, and after the other tasks B and D finish processing and stop, the remaining processing of tasks A and C you want to give priority to It must be performed, during which time the next task following tasks B and D cannot be executed, and the real-time nature of parallel processing is lost. In other words, if the swap rate is fixed at the same rate, the next task cannot be executed immediately after one task is completed because of the priority of processing, and the processing efficiency is deteriorated due to waiting.

そこで、上記のような問題を解決することを目的とし
て、以下に示すような演算処理方法が提案されている。
Therefore, for the purpose of solving the above problems, the following arithmetic processing methods have been proposed.

第1図は提案例の演算処理方法を実施する演算処理装
置のスワップ機能部分のブロック図を示している。第1
図では、例として4つのタスクを並列に実行可能な演算
処理装置を仮定している。
FIG. 1 is a block diagram of a swap function part of an arithmetic processing unit that executes the arithmetic processing method of the proposed example. First
In the figure, an arithmetic processing unit capable of executing four tasks in parallel is assumed as an example.

第1図において、ウェイトフラグ回路1は、動作させ
ないタスクを示すフラグを立てる回路である。タスクに
対してこのウェイトフラグが立っているときは、そのタ
スクの処理を行わず、つぎのタスクへ進む。
In FIG. 1, a wait flag circuit 1 is a circuit for setting a flag indicating a task not to be operated. When the wait flag is set for a task, the process proceeds to the next task without performing the processing of the task.

カウンタ3,4,5,6は、レジスタに相当するもので、そ
れぞれタスクA,B,C,Dの命令実行回数を1命令が実行さ
れたときに発生する信号LASTによってカウントするダウ
ンカウンタ構成であり、各タスクA,B,C,Dの命令実行回
数の比率に応じて命令実行回数がプリセットされてい
て、各タスクA,B,C,Dについて所定の命令回数が終了し
てカウント値が0となった時に、オーバーフロー信号を
出力する。
Each of the counters 3, 4, 5, and 6 corresponds to a register. Each of the counters 3, 4, 5, and 6 has a down counter configuration that counts the number of instruction executions of tasks A, B, C, and D by a signal LAST generated when one instruction is executed. Yes, the number of instruction executions is preset according to the ratio of the number of instruction executions for each task A, B, C, D. When it becomes 0, an overflow signal is output.

スワップコントロール回路2は、現在実行しているタ
ククとウェイトフラグ回路1におけるウェイトフラグの
情報とカウンタ3,4,5,6のオーバーフロー信号とから、
つぎに実行するタスクを決定する論理回路である。この
スワップコントロール回路2は、タスクの状態を示す信
号CPUS0,CPUS1を出力する。
The swap control circuit 2 calculates the current execution timing, the information of the wait flag in the wait flag circuit 1 and the overflow signals of the counters 3, 4, 5, and 6,
This is a logic circuit that determines the task to be executed next. The swap control circuit 2 outputs signals CPUS0 and CPUS1 indicating the state of the task.

第2図と第3図は、従来例の第8図および第9図にそ
れぞれ対応するタイミング図である。これらの図では、
従来例と同じ処理量のタスクA,B,C,Dのスワップを行う
際に、タスクA,Cの実行比率をタスクB,Dの2倍に設定し
たときのスワップのタイミング図を第2図に示し、全体
のタイミング図を第3図に示している。
2 and 3 are timing charts corresponding to FIGS. 8 and 9 of the conventional example, respectively. In these figures,
FIG. 2 is a timing chart of swapping when the execution ratio of tasks A and C is set to twice that of tasks B and D when swapping tasks A, B, C, and D with the same processing amount as the conventional example. FIG. 3 shows an overall timing chart.

第2図は、タスクAを2命令実行し、タスクBを1命
令実行し、タスクCを2命令実行し、タスクDを1命令
実行するサイクルを繰り返している状態を示している。
第2図のように、各タスクA,B,C,Dの処理を時分割で行
うと、第3図のように各タスクA,B,C,Dの実行が略同じ
時期に終了することになる。なお、第3図において、処
理実行密度を斜線の密度に対応させている。
FIG. 2 shows a state in which a cycle in which task A executes two instructions, task B executes one instruction, task C executes two instructions, and task D executes one instruction.
As shown in FIG. 2, when the processes of the tasks A, B, C, and D are performed in a time-division manner, the execution of the tasks A, B, C, and D ends at substantially the same time as shown in FIG. become. In FIG. 3, the processing execution density is made to correspond to the shaded area density.

このような設定にすると、タスクB,Dが終了する時点
で、タスクA,Cの処理を終了することになり、全タスク
の処理が均一に行われることになり、並列処理のリアル
タイム性も維持することができる。
With this setting, when tasks B and D end, processing of tasks A and C ends, so that processing of all tasks is performed uniformly and real-time processing of parallel processing is maintained. can do.

以上のように、n個の各タスクについてカウンタを設
けることによって任意にタスクの実行比率を変えられる
ようにすると、各タスクの処理量の大小に係わらず並列
的に処理される各タスクの実行終了時点のタイミングを
揃えることが可能となり、特定のタスクを優先的に実行
したい場合においても、巨視的に見ると、リアルタイム
性を維持しつつ各タスクを均一に並列処理できることに
なる。
As described above, by providing a counter for each of the n tasks, if the execution ratio of the tasks can be changed arbitrarily, the execution end of each task processed in parallel regardless of the processing amount of each task is completed. The timings of the time points can be aligned, and even when it is desired to execute a specific task with priority, macroscopically, each task can be uniformly processed in parallel while maintaining real-time properties.

〔発明が解決しようとする課題〕[Problems to be solved by the invention]

上記提案例においては、タスクの実行比率を変えるこ
とによって、特定のタスクだけ優先的に実行させる場合
において、各タスクのカウンタに実行比率をセットする
ことによって、巨視的にみて、均一に実行させることが
できる。
In the above proposed example, by changing the execution ratio of tasks, when only a specific task is to be executed preferentially, by setting the execution ratio to the counter of each task, it is possible to execute uniformly and macroscopically Can be.

第5図は、4つのタスクA,B,C,Dが同時に実行できる
演算処理装置を仮定して、タスクAについては8命令、
タスクB,Cについては4命令、タスクDについては2命
令というように実行比率を設定した時の1サイクルのス
ワップのタイミングを示すものである。提案例の構成で
は、スワップは、タスクAを8命令実行し、タスクBを
4命令実行し、タスクCを4命令実行し、タスクDを2
命令実行するのが1サイクルとなり、このサイクルの繰
り返しで各タスクA,B,C,Dの処理が実行され、リアルタ
イム性の維持が図られる。
FIG. 5 shows an arithmetic processing unit that can execute four tasks A, B, C, and D at the same time.
It shows the timing of one cycle of swapping when the execution ratio is set such as four instructions for tasks B and C and two instructions for task D. In the configuration of the proposed example, the swap executes task A by 8 instructions, executes task B by 4 instructions, executes task C by 4 instructions, and executes task D by 2 instructions.
The execution of an instruction is one cycle, and the processing of each of the tasks A, B, C, and D is executed by repetition of this cycle, and real-time performance is maintained.

ところが、1サイクルという微視的な見方をすると、
各タスクA,B,C,Dの処理は、上記のように各タスクA,B,
C,Dで固まって実行されてしまい、処理の均一性という
観点から好ましくない。
However, from a microscopic perspective of one cycle,
The processing of each task A, B, C, D is performed as described above.
C and D are hardened and executed, which is not preferable from the viewpoint of processing uniformity.

例えば、割り込みの反応速度を考える。例えば、縦軸
の時間1のタスクAを実行しているときに、タスクDの
割り込み要求が発生した場合、つぎにタスクDが実行さ
れる時間17まで、16命令分待たなければ、割り込みが受
け付けられず、割り込みに対する反応速度が遅いという
問題があった。
For example, consider the reaction speed of an interrupt. For example, if the interrupt request of the task D occurs while the task A of the time 1 on the vertical axis is being executed, the interrupt is not accepted until the next time when the task D is executed is not waited for 16 instructions. However, there was a problem that the response speed to the interrupt was slow.

この発明の目的は、各タスクの処理を均一に行うこと
ができるとともに並列処理のリアルタイム性を維持する
ことができ、しかも割り込みに対する反応速度を高める
ことができる演算処理方法を提供することである。
SUMMARY OF THE INVENTION It is an object of the present invention to provide an arithmetic processing method capable of uniformly performing processing of each task, maintaining real-time properties of parallel processing, and increasing a response speed to an interrupt.

〔課題を解決するための手段〕[Means for solving the problem]

この発明の演算処理方法は、ハードウェア制御による
スワップ機能でn個のタスクを時分割で切り替えて実行
することにより前記n個のタスクを並列的に実行する演
算処理方法であって、 各タスク毎にその命令実行回数の比率をレジスタによ
って任意にプログラマブルに設定し、前記タスク毎の命
令実行回数の比率に従ってひとつの命令実行を単位とし
てタスクの切り替えを行い、かつ、 前記n個のタスクの実行・切り替えを、ひとつの命令
を切り替えの最小単位としてタスク1からタスクnまで
順次実行・切り替えを行い、要望の実行回数が終わった
タスクの実行を停止し、残りのタスクでひとつの命令を
切り替えの最小単位として実行・切り替えを行い、全タ
スクが要望の実行回数を終了するまでを1サイクルと
し、前記1サイクル内の各タスクの要望の実行回数をレ
ジスタに設定したタスク毎の命令実行回数の比率に従っ
て設定して行うことを特徴とする。
An arithmetic processing method according to the present invention is an arithmetic processing method for executing n tasks in parallel by switching and executing the n tasks in a time-sharing manner by a hardware controlled swap function. The ratio of the number of instruction executions is arbitrarily programmable by a register, and the task is switched in units of one instruction according to the ratio of the number of instruction executions for each task. Switching is performed with one instruction as the minimum unit of switching, and execution and switching are sequentially performed from task 1 to task n, execution of the task whose desired number of executions has been completed is stopped, and switching of one instruction is performed by the remaining tasks. Execution / switching is performed as a unit, and the cycle until all tasks complete the desired number of executions is defined as one cycle. And performing set according to a ratio of the instruction execution count for each task the number of executions of requests for each task was set in the register.

この発明の演算処理装置は、ハードウェア制御による
スワップ機能でn個のタスクを時分割で切り替えて実行
することにより前記n個のタスクを並列的に実行する演
算処理装置であって、 各タスク毎にその命令実行回数の比率が任意にプログ
ラブルに設定され、前記n個のタスクの命令実行回数を
各々カウントするn個のカウンタと、 動作させないタスクを示すフラグを立てるウェイトフ
ラグ回路と、 現在実行しているタスクと前記ウェイトフラグ回路に
おけるウェイトフラグの情報と前記n個のカウンタのオ
ーバーフロー信号とに基づいてつぎに実行するタスクを
決定することにより、前記タスク毎の命令実行回数の比
率に従ってひとつの命令実行を単位としてタスクの切り
替えを行うスワップコントロール回路とを備え、 前記スワップコントロール回路は、前記n個のタスク
の実行・切り替えを、ひとつの命令を切り替えの最小単
位としてタスク1からタスクnまで順次実行・切り替え
を行い、要望の実行回数が終わったタスクの実行を停止
し、残りのタスクでひとつの命令を切り替えの最小単位
として実行・切り替えを行い、全タスクが要望の実行回
数を終了するまでを1サイクルとし、前記1サイクル内
の各タスクの要望の実行回数をレジスタに設定したタス
ク毎の命令実行回数の比率に従って設定して行うように
したことを特徴とする。
An arithmetic processing unit according to the present invention is an arithmetic processing unit that executes n tasks in parallel by switching and executing the n tasks in a time-sharing manner by a hardware-controlled swap function. The number of instruction executions is arbitrarily set in a programmable manner, the n counters counting the number of instruction executions of the n tasks, a wait flag circuit for setting a flag indicating a task not to be operated, The next task to be executed is determined based on the task being executed, the information of the wait flag in the wait flag circuit, and the overflow signal of the n counters. A swap control circuit for switching tasks in units of instruction execution; The control circuit executes and switches the n tasks sequentially from task 1 to task n using one instruction as a minimum unit of switching, and stops the execution of the task after the desired number of executions. In the remaining tasks, execution / switching is performed with one instruction as a minimum unit of switching, and one cycle is defined as the time until all tasks finish the desired number of executions, and the number of executions of each task within the one cycle is registered. The setting is performed in accordance with the ratio of the number of instruction executions for each task set in (1).

〔作用〕[Action]

この発明によれば、ソウトウェアで各タスク毎にその
命令実行回数の比率をレジスタに指定、もしくはカウン
タにセットすることによって、タスク毎の命令実行回数
の比率に従ってひとつの命令実行を単位としてタスクの
切り替えが行われる。この結果、各タスクの処理量や処
理の優先の度合に応じてタスク毎の命令実行回数の比率
を適切に設定することにより、あるタスクだけ特に処理
を優先したい場合等においても各タスクの処理を均一に
行うことができるとともに並列処理のリアルタイム性を
維持することができる。
According to the present invention, by using software, the ratio of the number of instruction executions for each task is specified in a register or set in a counter, thereby switching tasks in units of one instruction according to the ratio of the number of instruction executions for each task. Is performed. As a result, by appropriately setting the ratio of the number of instruction executions for each task in accordance with the processing amount of each task and the degree of priority of the processing, the processing of each task can be performed even when a particular task only needs to be given priority. It is possible to perform the processing uniformly and to maintain the real-time property of the parallel processing.

しかも、1サイクル内において、ひとつの命令を切り
替えの最小単位としてタスク1からタスクnまで順次実
行・切り替えを行い、要望の実行回数が終わったタスク
の実行を停止し、残りのタスクでひとつの命令を切り替
えの最小単位として実行・切り替えを行うことで、各タ
スクの並列処理を実現しているので、1サイクル内にお
いても、各タスクの処理を均一に行うことができるとと
もにリアルタイム性を維持することができ、各タスクに
ついて割り込みがあったときの反応速度を高めることが
できる。
In addition, within one cycle, one instruction is the minimum unit of switching, and execution and switching are sequentially performed from task 1 to task n, execution of the task whose desired number of executions has been completed is stopped, and one instruction is executed for the remaining tasks. By executing / switching as the minimum unit of switching, parallel processing of each task is realized, so that even within one cycle, processing of each task can be performed uniformly and real-time property is maintained. And increase the reaction speed when there is an interruption for each task.

〔実施例〕〔Example〕

この発明の演算処理方法および演算処理装置の実施例
を第1図,第4図および第5図を参照して説明する。
An embodiment of an arithmetic processing method and an arithmetic processing device according to the present invention will be described with reference to FIGS. 1, 4, and 5. FIG.

上述の提案例の課題を解決できて、割り込みが待ち時
間が少なく早く受け付けられるためには、1サイクルの
中でも、各タスクA,B,C,Dが均一に実行されるように、
切り替える必要がある。そのため、この実施例の演算処
理方法では、1命令を切り替えの最小単位として各タス
クA,B,C,Dの実行・切り替えを行い、図1のカウンタ3
〜6にそれぞれ命令実行比率に応じて設定された要望の
実行回数が終わったタスクからウェイトし、残りのタス
クで同様の実行・切り替えを行い、全タスクが要望の実
行回数を終了した段階で1サイクルの実行を完了するよ
うなスワップを行うようにする。
In order to solve the problem of the above proposed example and to accept interrupts quickly with low waiting time, even in one cycle, tasks A, B, C, and D are uniformly executed.
Need to switch. Therefore, in the arithmetic processing method of this embodiment, execution / switching of each task A, B, C, D is performed using one instruction as a minimum unit of switching, and the counter 3 shown in FIG.
6 to 6 are waited from the task for which the desired number of executions set according to the instruction execution ratio has been completed, and the same execution and switching are performed for the remaining tasks. Swap to complete the execution of the cycle.

第4図は、第5図に示した1サイクルのスワップを、
上記のような手法によって実行・切り替えを行った場合
の1サイクルのスワップのタイミング図である。
FIG. 4 shows the one-cycle swap shown in FIG.
FIG. 9 is a timing chart of one-cycle swap when execution / switching is performed by the above method.

第4図のようなスワップを行った場合において、割り
込みの反応速度を考えると、一番遅いタイミングは、縦
軸の時間8のタスクDの2番目の実行終了後に、タスク
Dの割り込み要求が発生した場合であるが、つぎのサイ
クルの時間4のタスクDの実行までは14命令分であり、
第5図の場合の16命令分よりも改善されていることが明
らかである。
Considering the reaction speed of the interrupt when the swap as shown in FIG. 4 is performed, the slowest timing is when the interrupt request of the task D occurs after the end of the second execution of the task D at the time 8 on the vertical axis. However, it is 14 instructions until the execution of task D at time 4 of the next cycle.
It is clear that this is an improvement over the 16 instructions in the case of FIG.

第6図は、第4図のタイミングでスワップを行う場合
における各タスクのカウンタ3〜6のカウント値と、そ
のオーバーフローを示すものであり、記号A,B,C,Dはそ
れぞれ各タスクに対応している。
FIG. 6 shows the count values of the counters 3 to 6 of each task when the swap is performed at the timing shown in FIG. 4 and the overflows thereof. Symbols A, B, C, and D correspond to each task, respectively. doing.

以上のようにスワップを行うための回路構成として
は、ブロック的には第1図の構成とかわらず、内容的に
スワップコントロール回路2が1命令実行毎にタスクを
切り替えるということを考慮しながら、現在実行してい
るタスクとウェイト回路1におけるウェイトフラグの情
報とカウンタ3〜6のオーバーフロー信号とから、つぎ
のタスクを決定する論理回路であるというところが異な
る。
As a circuit configuration for performing the swap as described above, the block control is not limited to the configuration of FIG. The difference is that the current task is a logic circuit that determines the next task based on the information of the wait flag in the wait circuit 1 and the overflow signals of the counters 3 to 6.

このように、実行比率を考慮したときの1サイクルの
各タスク間のスワップについても、1命令毎に切り替え
ることによって、均一にタスクを処理できるとともにリ
アルタイム性を維持することができ、しかも割り込みに
対する反応速度を早くすることができる。
In this way, even when swapping between tasks in one cycle when the execution ratio is taken into account, by switching for each instruction, tasks can be processed uniformly and real-time performance can be maintained. Speed can be increased.

〔発明の効果〕〔The invention's effect〕

この発明によれば、並列処理されるn個のタスクにつ
いて、各タスク毎にその命令実行回数の比率を任意に設
定して各タスクを実行することで、特定のタスクを優先
的に処理させなければならないときでも、各タスクの均
一性を失わずにリアルタイム性を維持することができ
る。
According to the present invention, for n tasks to be processed in parallel, the ratio of the instruction execution count is set arbitrarily for each task, and each task is executed, so that a specific task must be processed preferentially. Even when it is necessary, the real-time property can be maintained without losing the uniformity of each task.

しかも、1サイクル内での各タスクの実行も分散させ
ているので、1サイクル内でも各タスクの均一性を失わ
ずにリアルタイム性を維持することができ、割り込みの
反応速度も向上させることができる。
In addition, since the execution of each task within one cycle is also distributed, the real-time property can be maintained without losing the uniformity of each task even within one cycle, and the reaction speed of an interrupt can be improved. .

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

第1図は提案例における演算処理装置の構成を示すブロ
ック図、第2図は第1図の提案例のタスク切り替えのタ
イミングを示すタイミング図、第3図は第1図の提案例
における全体の実行タイミング図、第4図はこの発明の
実施例における演算処理装置のタスク切り替えのタイミ
ング図、第5図は実施例におけるタスク切り替えのタイ
ミングを提案例の方式に合わせて描いたタイミング図、
第6図は第1図の演算処理装置におけるカウンタのタイ
ミングの一例を示したタイミング図、第7図は演算処理
装置の従来例の構成を示すブロック図、第8図は第7図
の装置でのタスク切り替えのタイミングを示すタイミン
グ図、第9図は全体の実行タイミング図である。 1……ウェイトフラグ回路、2……スワップコントロー
ル回路、3,4,5,6……カウンタ
FIG. 1 is a block diagram showing the configuration of an arithmetic processing unit in the proposed example, FIG. 2 is a timing chart showing the timing of task switching in the proposed example in FIG. 1, and FIG. 3 is an overall diagram in the proposed example in FIG. Execution timing diagram, FIG. 4 is a timing diagram of task switching of the arithmetic processing unit in the embodiment of the present invention, FIG. 5 is a timing diagram in which the task switching timing in the embodiment is drawn according to the method of the proposed example,
FIG. 6 is a timing chart showing an example of the timing of a counter in the arithmetic processing unit of FIG. 1, FIG. 7 is a block diagram showing the configuration of a conventional example of the arithmetic processing unit, and FIG. 9 is a timing chart showing the timing of task switching, and FIG. 9 is an overall execution timing chart. 1 ... Wait flag circuit, 2 ... Swap control circuit, 3,4,5,6 ... Counter

Claims (2)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】ハードウェア制御によるスワップ機能でn
個のタスクを時分割で切り替えて実行することにより前
記n個のタスクを並列的に実行する演算処理方法であっ
て、 各タスク毎にその命令実行回数の比率をレジスタによっ
て任意にプログラマブルに設定し、前記タスク毎の命令
実行回数の比率に従ってひとつの命令実行を単位として
タスクの切り替えを行い、かつ、 前記n個のタスクの実行・切り替えを、ひとつの命令を
切り替えの最小単位としてタスク1からタスクnまで順
次実行・切り替えを行い、要望の実行回数が終わったタ
スクの実行を停止し、残りのタスクでひとつの命令を切
り替えの最小単位として実行・切り替えを行い、全タス
クが要望の実行回数を終了するまでを1サイクルとし、
前記1サイクル内の各タスクの要望の実行回数をレジス
タに設定したタスク毎の命令実行回数の比率に従って設
定して行うことを特徴とする演算処理方法。
1. A hardware-controlled swap function for n
A task processing method in which the n tasks are executed in parallel by switching and executing the tasks in a time-division manner, wherein the ratio of the number of instruction executions for each task is arbitrarily programmable by a register. The task switching is performed in units of one instruction execution according to the ratio of the number of instruction executions for each task, and the execution / switching of the n tasks is performed using task 1 as the minimum unit of switching. n, execute and switch sequentially, stop the execution of the task for which the desired number of executions has been completed, execute and switch the remaining tasks with one instruction as the minimum unit of switching, and execute the desired number of executions for all tasks. One cycle is defined as the end
An arithmetic processing method, wherein a desired number of executions of each task in one cycle is set according to a ratio of the number of instruction executions for each task set in a register.
【請求項2】ハードウェア制御によるスワップ機能でn
個のタスクを時分割で切り替えて実行することにより前
記n個のタスクを並列的に実行する演算処理装置であっ
て、 各タスク毎にその命令実行回数の比率が任意にプログラ
マブルに設定され、前記n個のタスクの命令実行回数を
各々カウントするn個のカウンタと、 動作させないタスクを示すフラグを立てるウェイトフラ
グ回路と、 現在実行しているタスクと前記ウェイトフラグ回路にお
けるウェイトフラグの情報と前記n個のカウンタのオー
バーフロー信号とに基づいてつぎに実行するタスクを決
定することにより、前記タスク毎の命令実行回数の比率
に従ってひとつの命令実行を単位としてタスクの切り替
えを行うスワップコントロール回路とを備え、 前記スワップコントロール回路は、前記n個のタスクの
実行・切り替えを、ひとつの命令を切り替えの最小単位
としてタスク1からタスクnまで順次実行・切り替えを
行い、要望の実行回数が終わったタスクの実行を停止
し、残りのタスクでひとつの命令を切り替えの最小単位
として実行・切り替えを行い、全タスクが要望の実行回
数を終了するまでを1サイクルとし、前記1サイクル内
の各タスクの要望の実行回数をレジスタに設定したタス
ク毎の命令実行回数の比率に従って設定して行うように
したことを特徴とする演算処理装置。
2. A hardware controlled swap function for n
An arithmetic processing device that executes the n tasks in parallel by switching and executing the tasks in a time-division manner, wherein the ratio of the number of instruction executions is arbitrarily programmable for each task, n counters for counting the number of instruction executions of n tasks, a wait flag circuit for setting a flag indicating a task not to be operated, information on a task currently being executed, wait flag information in the wait flag circuit, and n A swap control circuit that switches tasks in units of one instruction execution in accordance with the ratio of the number of instruction executions for each task by determining a task to be executed next based on the overflow signals of the counters, The swap control circuit executes and switches the n tasks by one. Are executed and switched sequentially from task 1 to task n as the minimum unit of switching, execution of the task after the desired number of executions is stopped, and execution of one instruction is performed as the minimum unit of switching in the remaining tasks. Switching is performed, and the cycle until all tasks complete the desired number of executions is defined as one cycle. The desired number of executions of each task in the one cycle is set according to the ratio of the number of instruction executions for each task set in the register. An arithmetic processing device characterized by the above.
JP2096841A 1990-04-11 1990-04-11 Arithmetic processing method and arithmetic processing device Expired - Fee Related JP2659603B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2096841A JP2659603B2 (en) 1990-04-11 1990-04-11 Arithmetic processing method and arithmetic processing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2096841A JP2659603B2 (en) 1990-04-11 1990-04-11 Arithmetic processing method and arithmetic processing device

Publications (2)

Publication Number Publication Date
JPH03294930A JPH03294930A (en) 1991-12-26
JP2659603B2 true JP2659603B2 (en) 1997-09-30

Family

ID=14175744

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2096841A Expired - Fee Related JP2659603B2 (en) 1990-04-11 1990-04-11 Arithmetic processing method and arithmetic processing device

Country Status (1)

Country Link
JP (1) JP2659603B2 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06202887A (en) * 1992-12-28 1994-07-22 Matsushita Electric Ind Co Ltd Microcomputer
JPH06250856A (en) * 1993-02-26 1994-09-09 Nippondenso Co Ltd Microcomputer
EP0613085B1 (en) 1993-02-26 1999-06-09 Denso Corporation Multitask processing unit
JPH08328881A (en) * 1995-05-29 1996-12-13 Nec Corp Task scheduling system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0199132A (en) * 1987-10-12 1989-04-18 Matsushita Electric Ind Co Ltd Multi-task executing device

Also Published As

Publication number Publication date
JPH03294930A (en) 1991-12-26

Similar Documents

Publication Publication Date Title
JPH0454255B2 (en)
JP2659603B2 (en) Arithmetic processing method and arithmetic processing device
JPH0640314B2 (en) Multi-channel shared resource processor
JPH0199132A (en) Multi-task executing device
JP2591200B2 (en) Program prefetching device
JPH01154237A (en) Executing device for time-division task
JPH07160650A (en) Task execution controller
JPS62145435A (en) Microprocessor with concurrent processing instruction
JPH0520010A (en) Register file
JPS5819973A (en) Multiprocessor computer of time division bus system
JPH01154236A (en) Executing device for time-division task
JP2508026B2 (en) Timer control method
JPS61166631A (en) Microprogram control processor
JPH0679271B2 (en) Loop control circuit
JPS62164138A (en) Microprocessor with concurrent loop
JPS62145434A (en) Microprocessor with concurrent loop
JPS61150057A (en) Execution control circuit of microcomputer
JPH0298744A (en) Interruption processing system
JPH02113363A (en) Time slice controlling system for multiprocessor system
JPS6230452B2 (en)
JPS61136115A (en) Basic clock generating circuit of microcomputer system
JPH0340139A (en) Context switching method for multi-task system
JPH03188531A (en) Time-division multitask executing device
JPH0217541A (en) Stack system micro-computer
JPS6120139A (en) Interruption control system

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees