JPH10207717A - Microcomputer - Google Patents

Microcomputer

Info

Publication number
JPH10207717A
JPH10207717A JP600797A JP600797A JPH10207717A JP H10207717 A JPH10207717 A JP H10207717A JP 600797 A JP600797 A JP 600797A JP 600797 A JP600797 A JP 600797A JP H10207717 A JPH10207717 A JP H10207717A
Authority
JP
Japan
Prior art keywords
task
register
memory
cpu
context
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP600797A
Other languages
Japanese (ja)
Other versions
JP3605978B2 (en
Inventor
Toshimichi Matsuzaki
敏道 松崎
Keisuke Tanaka
啓介 田中
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 JP00600797A priority Critical patent/JP3605978B2/en
Publication of JPH10207717A publication Critical patent/JPH10207717A/en
Application granted granted Critical
Publication of JP3605978B2 publication Critical patent/JP3605978B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Abstract

PROBLEM TO BE SOLVED: To attain high speed task switching. SOLUTION: A sequencer 55 controls the transfer of data between a context saving memory 3 and a data memory and a register file 1 according to the contents of a present task number register 60, next task number register 57, and previous task number register 61 by a start signal from a CPU, and saves/ restores a context. A new task to be switched at the time of requesting task switching is decided by a task permission flag 56 and the present task number register. The register file is constituted of two pairs of register sets in the same constitution, and switched by a register set A using flag 63. A register writing control part writes a context in the register set to be used by the next task, and a register reading control part 68 reads the register set to be used by the present task.

Description

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

【0001】[0001]

【発明の属する技術分野】本発明は、複数のタスクを切
り換えながら実行するマイクロコンピュータに関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a microcomputer that executes a plurality of tasks while switching the tasks.

【0002】[0002]

【従来の技術】近年、マイクロコンピュータはあらゆる
機器に利用されており、処理能力の向上に伴い、より広
い分野でより複雑な制御に応用されている。組み込み用
途ではより複雑な制御に応用できるように、マルチタス
ク処理などの高度な機能が望まれている。
2. Description of the Related Art In recent years, microcomputers have been used in all types of equipment, and have been applied to more complex controls in a wider field with the improvement in processing capability. In embedded applications, advanced functions such as multitask processing are desired so that they can be applied to more complicated controls.

【0003】図14は、第1の従来例におけるマルチタ
スク機能を有するマイクロコンピュータの説明図であ
る。同図において、CPU10は、演算部11とレジス
タセット12からなる。
FIG. 14 is an explanatory diagram of a microcomputer having a multitasking function in the first conventional example. In FIG. 1, a CPU 10 includes an operation unit 11 and a register set 12.

【0004】演算部11は、タスクを1つずつ実行し、
レジスタセット12は、タスク実行に必要なデータを保
持する。
The operation unit 11 executes tasks one by one,
The register set 12 holds data necessary for task execution.

【0005】メモリ13は、各タスク毎にコンテキスト
(レジスタセットのデータ、PCの内容、PSWの内容
等のタスクの実行によって変化するタスク固有のデー
タ)を退避する領域であるコンテキストブロック14を
有する。同図では、コンテキストブロック14中にタス
ク1〜3用のコンテキス退避領域が示されている。
[0005] The memory 13 has a context block 14 which is an area for saving a context (data unique to a task, such as data of a register set, contents of a PC, contents of a PSW, which is changed by execution of a task) for each task. In the figure, a context save area for tasks 1 to 3 is shown in the context block 14.

【0006】第1の従来例におけるタスクはソフトウェ
ア(OS)によって管理される。例えば、タスク1から
タスク2に切り換わる場合、OSは、タスク切り換えを
示すイベント(タイマ割込み等)を受け付けると、まず
CPU10からメモリ13にタスク1のコンテキストを
退避し、次にメモリ13からCPU10にタスク2のコ
ンテキストを復帰してからタスク2の実行を開始する。
[0006] The tasks in the first conventional example are managed by software (OS). For example, when switching from task 1 to task 2, upon receiving an event indicating task switching (such as a timer interrupt), the OS first saves the context of task 1 from the CPU 10 to the memory 13, and then transfers the context from the memory 13 to the CPU 10. After the context of task 2 is returned, execution of task 2 is started.

【0007】上記のように、第1の従来例では、ソフト
ウェア(OS)によりマルチタスクを実現しているの
で、ハードウェア規模が小さくて済むという利点があ
る。
As described above, in the first conventional example, since multitasking is realized by software (OS), there is an advantage that the hardware scale can be reduced.

【0008】図15は、第2の従来例におけるマルチタ
スク機能を有するマイクロコンピュータの説明図であ
る。同図においてCPU20は、演算部21、レジスタ
ファイル22、レジスタセット切り換え部23、制御部
24とからなる。
FIG. 15 is an explanatory diagram of a microcomputer having a multitasking function in the second conventional example. Referring to FIG. 1, a CPU 20 includes an operation unit 21, a register file 22, a register set switching unit 23, and a control unit 24.

【0009】演算部21は、タスクを1つずつ実行し、
レジスタファイル22は、タスクの実行に必要なデータ
を保持する複数のレジスタセットからなる。
The arithmetic unit 21 executes tasks one by one,
The register file 22 includes a plurality of register sets that hold data necessary for executing a task.

【0010】レジスタセット切り換え部23は、現在実
行中のタスクに対応するレジスタセットを有効にする。
この有効なレジスタセットのみが演算部21に使用され
る。制御部24は、タスクの切り換えを制御する。
[0010] The register set switching unit 23 makes the register set corresponding to the currently executed task valid.
Only this valid register set is used for the arithmetic unit 21. The control unit 24 controls task switching.

【0011】メモリ25は、レジスタセットのデータを
除くコンテキストの退避領域を有する。この第2の従来
例におけるタスクはハードウェアによって管理される。
例えば、タスク1からタスク2に切り換える場合、制御
部24は、タスク切り換えを指示するイベント(タイマ
割込み等)を受け付けると、レジスタセット切り換え部
23にタスク2に対応するレジスタセットを有効にする
ように指示すると共に、演算部21のPCの内容、PS
Wの内容等をメモリ25に退避し、タスク2のPCの内
容、PSWの内容等を演算部21に復帰する。その後、
演算部21は、有効なレジスタセット2を用いてタスク
2を実行する。
The memory 25 has a context save area excluding data of a register set. The task in the second conventional example is managed by hardware.
For example, when switching from task 1 to task 2, the control unit 24 causes the register set switching unit 23 to enable the register set corresponding to task 2 upon receiving an event instructing task switching (such as a timer interrupt). In addition to the instruction, the contents of the PC of
The contents of W and the like are saved in the memory 25, and the contents of the PC of the task 2, the contents of the PSW, and the like are returned to the arithmetic unit 21. afterwards,
The operation unit 21 executes the task 2 using the valid register set 2.

【0012】上記のように第2の従来例では、ハードウ
ェアによってマルチタスクを実現しているので、タスク
の切り換えが高速であるという利点がある。
As described above, in the second conventional example, since multitasking is realized by hardware, there is an advantage that task switching is fast.

【0013】[0013]

【発明が解決しようとする課題】しかしながら、上記従
来例によれば、組み込み用途のマイクロコンピュータに
おけるマルチタスク管理には適していないという問題が
あった。
However, according to the above conventional example, there is a problem that it is not suitable for multitask management in a microcomputer for embedded use.

【0014】第1の従来例によれば、タスク切り換えに
際してコンテキストの退避および復帰をソフトウェアに
よって実現するので切り換え速度が遅く、リアルタイム
性を要求される制御の組み込み用途のマイクロコンピュ
ータには適していない。また、第2の従来例によれば、
タスク数と同数のレジスタセットを必要とし、しかもタ
スク切り換えをハードウェアで実現するので制御部のハ
ードウェア規模が大きくなる。その結果コストが高くな
り組み込み用途のマイクロコンピュータには適していな
い。
According to the first conventional example, the task is switched and the context is saved and restored by software, so that the switching speed is slow, and it is not suitable for a microcomputer which is embedded in a control requiring a real-time property. According to the second conventional example,
Since the same number of register sets as the number of tasks are required, and the task switching is realized by hardware, the hardware scale of the control unit is increased. As a result, the cost is high, and the microcomputer is not suitable for embedded microcomputers.

【0015】本発明は上記の問題点に鑑み、コストを増
大させることなく高速にタスクを切り換えるマイクロコ
ンピュータを提供することを目的としている。
The present invention has been made in consideration of the above problems, and has as its object to provide a microcomputer that switches tasks at high speed without increasing cost.

【0016】[0016]

【課題を解決するための手段】上記課題を解決するた
め、請求項1の発明は、複数のタスクを順に切り換えな
がら実行するマイクロコンピュータであって、同一のレ
ジスタ構成で、タスクの実行に1つが使用される少なく
とも2つ以上のレジスタセットと、実行中でないタスク
のコンテキストデータを保持する第1のメモリと、CP
Uがデータ処理に使用する第2のメモリと、前記第1の
メモリおよび前記第2のメモリから次に実行するタスク
のコンテキストデータをレジスタセットに復帰した時点
で、レジスタセットを切り換えるレジスタ切り換え手段
と、前記レジスタセットと前記第1のメモリおよび前記
第2のメモリとに接続され、タスク切り換え時にタスク
のコンテキストデータの一部を前記第2のメモリに転送
し、切り換えられる前に使用していたレジスタセットの
内容を新規タスクの実行中に前記第1のメモリに退避す
る転送手段とを有する。
According to a first aspect of the present invention, there is provided a microcomputer for executing a plurality of tasks while sequentially switching the tasks. A set of at least two or more registers to be used, a first memory for holding context data of tasks not being executed,
A second memory used by U for data processing, and register switching means for switching the register set when context data of a task to be executed next is returned to the register set from the first memory and the second memory. A register connected to the register set, the first memory, and the second memory, for transferring a part of the context data of the task to the second memory when the task is switched, and using the register before switching; Transfer means for saving the contents of the set to the first memory during execution of the new task.

【0017】請求項2の発明は、請求項1において前記
転送手段が、CPUからの起動要求により動作を開始す
るシーケンサと、タスクが使用していたレジスタセット
のデータを読み出す読み出し手段と、レジスタ読み出し
手段により読み出したデータを前記第1のメモリに書き
込む書き込み手段と、次に実行するタスクのコンテキス
トデータを前記第1のメモリから読み出すメモリ読み出
し手段と、メモリ読み出し手段により読み出したデータ
を次に実行するタスクが使用するレジスタセットに書き
込むレジスタ書き込み手段と、前記シーケンサに接続さ
れ、前記メモリ書き込み手段または前記メモリ読み出し
手段がアクセスするアドレスを指定する第1のアドレス
レジスタと、前記シーケンサに接続され、前記第2のメ
モリのアドレスを指定する第2のアドレスレジスタと、
前記シーケンサに接続され、タスクが使用中のレジスタ
セットを指定するレジスタセット番号指定手段とを有す
る。
According to a second aspect of the present invention, in the first aspect, the transfer means starts operation in response to a start request from a CPU, a read means for reading data of a register set used by a task, and a register read. Writing means for writing data read by the means to the first memory; memory reading means for reading context data of a task to be executed next from the first memory; and data read by the memory reading means for next execution. Register writing means for writing to a register set used by a task; a first address register connected to the sequencer for specifying an address to be accessed by the memory writing means or the memory reading means; and a first address register connected to the sequencer, Address of memory 2 A second address register for a constant,
A register set number specification unit connected to the sequencer and specifying a register set used by the task.

【0018】請求項3の発明は、請求項2において前記
転送手段が、現在実行中のタスクの番号を指定する現タ
スク番号レジスタと、次に実行するタスクの番号を指定
する次タスク番号レジスタと、前回実行したタスクの番
号を指定する前タスク番号レジスタと、前記シーケンサ
のステートに基づいて、前記現タスク番号レジスタの内
容を前記前タスク番号レジスタに転送し、前記次タスク
番号レジスタの内容を前記現タスク番号レジスタに転送
するタスク番号制御手段とを有する。
According to a third aspect of the present invention, in the second aspect, the transfer means includes a current task number register for specifying a number of a task currently being executed, and a next task number register for specifying a number of a task to be executed next. Transferring the contents of the current task number register to the previous task number register based on the state of the sequencer and a previous task number register that specifies the number of the previously executed task; Task number control means for transferring the current task number to the current task number register.

【0019】請求項4の発明は、請求項1において前記
転送手段が、前記レジスタセットと前記第1のメモリと
に接続され、かつデータバスを介して前記第2のメモリ
とに接続される内部バスを有する。
According to a fourth aspect of the present invention, in the first aspect, the transfer means is connected to the register set and the first memory, and is connected to the second memory via a data bus. Has a bus.

【0020】請求項5の発明は、請求項1において記転
送手段が、コンテキストの一部を格納する前記第2のメ
モリのあらかじめ割り当てられた特定番地を有する。
According to a fifth aspect of the present invention, in the first aspect, the transfer means has a pre-assigned specific address of the second memory for storing a part of the context.

【0021】請求項6の発明は、請求項1において前記
転送手段が、コンテキストの一部を格納する前記第2の
メモリに割り当てられたスタック領域を有する。
According to a sixth aspect of the present invention, in the first aspect, the transfer means has a stack area allocated to the second memory for storing a part of a context.

【0022】請求項7の発明は、請求項6において前記
レジスタセットが、コンテキストを前記第2のメモリの
スタック領域に格納後、スタックの最終位置とは異なる
アドレスを保持するスタックポインタを有する。
According to a seventh aspect of the present invention, in the sixth aspect, the register set has a stack pointer for holding an address different from the last position of the stack after storing the context in the stack area of the second memory.

【0023】請求項8の発明は、複数のタスクを順に切
り換えながら実行するマイクロコンピュータであって、
同一のレジスタ構成で、タスクの実行に1つが使用され
る少なくとも2つ以上のレジスタセットと、実行中でな
いタスクのコンテキストデータを保持する第1のメモリ
と、CPUがデータ処理に使用する第2のメモリと、前
記第1のメモリおよび前記第2のメモリから次に実行す
るタスクのコンテキストデータをレジスタセットに復帰
した時点で、レジスタセットを切り換えるレジスタ切り
換え手段と、前記レジスタセットと前記第1のメモリお
よび前記第2のメモリとに接続され、タスク切り換え時
にタスクのコンテキストデータの一部を前記第2のメモ
リに転送し、切り換えられる前に使用していたレジスタ
セットの内容を新規タスクの実行中に前記第1のメモリ
に退避する転送手段と、命令を処理するマイクロ制御手
段と、前記マイクロ制御手段が出力する制御信号と内部
のバスとを出力するCPUと、CPU内部にあって、前
記マイクロ制御手段によりレジスタセットを内部バスに
読み出すレジスタ読み出し手段と、前記CPUの制御信
号と内部バスとに接続され、前記CPUと同一のレジス
タセットを備える拡張手段と、前記拡張手段が前記CP
Uに接続されていることを通知し、前記読み出し手段の
動作を停止させる拡張指定手段とを有する。
An eighth aspect of the present invention is a microcomputer which executes a plurality of tasks while sequentially switching the tasks,
At least two or more register sets, one of which is used for executing a task, a first memory for holding context data of a task which is not being executed, and a second memory which is used for data processing by the CPU. A memory, register switching means for switching a register set when context data of a task to be executed next is returned from the first memory and the second memory to the register set, and the register set and the first memory A part of context data of a task is transferred to the second memory when a task is switched, and the contents of a register set used before the task is switched during execution of a new task. Transfer means for saving to the first memory, micro-control means for processing instructions, and the microphone A CPU for outputting a control signal output from the control means and an internal bus; a register reading means inside the CPU for reading the register set to the internal bus by the microcontroller; a control signal for the CPU and the internal bus; Connected to the CPU and provided with the same register set as the CPU;
And an extension designating means for notifying that it is connected to U and stopping the operation of the reading means.

【0024】請求項9の発明は、請求項8においてCP
Uはデータを処理するデータパス部とデータパスを制御
する制御部とからなり、前記制御部はデータパス部のデ
ータ処理の流れとは垂直方向に配置されてデータパス部
および前記拡張部に入力される前記データパスを制御す
るデータパス制御信号と、データパス部のデータ処理の
流れと水平方向に配置されて制御部から出力された後
に、前記拡張部に入力される前記拡張部を制御する拡張
部制御信号を有する。
According to a ninth aspect of the present invention, there is provided the method of
U comprises a data path section for processing data and a control section for controlling the data path, and the control section is arranged in a direction perpendicular to the data processing flow of the data path section, and is input to the data path section and the extension section. A data path control signal for controlling the data path, and a data processing flow of the data path section, which is arranged in the horizontal direction and is output from the control section, and then controls the expansion section to be input to the expansion section. It has an extension control signal.

【0025】請求項10の発明は、複数のタスクを順に
切り換えながら実行するマイクロコンピュータであっ
て、n個のタスクの起動を許可するか禁止するかを示す
nビットの第1のフラグを有する。
According to a tenth aspect of the present invention, there is provided a microcomputer which executes a plurality of tasks while sequentially switching the tasks, and has an n-bit first flag indicating whether activation of the n tasks is permitted or prohibited.

【0026】請求項11の発明は、請求項10におい
て、次に実行する予定のタスク番号を示すmビットであ
ってかつ、mをべきとする2のべき乗値が前記第1のフ
ラグの値以下である第2のフラグと、前記第2のフラグ
に所望のタスク番号を設定することで、前記第1のフラ
グの該当するビットをセットするタスク許可フラグ制御
手段を有する。
According to an eleventh aspect of the present invention, in the tenth aspect, an m-bit indicating a task number to be executed next, and a power of 2 for exponentiating m is equal to or less than the value of the first flag. And a task permission flag control unit that sets a corresponding bit of the first flag by setting a desired task number in the second flag.

【0027】[0027]

【発明の実施の形態】図1は、本発明の実施例における
マイクロコンピュータの主要な構成を示すブロック図で
ある。実施例のマイクロコンピュータは、レジスタファ
イル1、CPU2、コンテキスト退避メモリ3、メモリ
4、転送部5を有する。
FIG. 1 is a block diagram showing a main configuration of a microcomputer according to an embodiment of the present invention. The microcomputer of the embodiment includes a register file 1, a CPU 2, a context saving memory 3, a memory 4, and a transfer unit 5.

【0028】レジスタファイル1は、レジスタセットA
(GRA)とレジスタセットB(GAB)とからなる。
レジスタセットA、Bはタスク切り換え毎に交互に切り
換えられ、常にどちらか一方がCPU2のタスク実行に
使用される。
Register file 1 contains register set A
(GRA) and register set B (GAB).
The register sets A and B are alternately switched every time the task is switched, and one of them is always used for the CPU 2 to execute the task.

【0029】CPU2は、複数のタスクを切り換えなが
ら実行する。CPU2が実行するタスクは、タスク切り
換えを指示するイベントが発生する毎に、転送部5のタ
スク許可フラグに基づいてタスク番号の昇順又は降順に
切り換えられる。タスク切り換えのイベントは例えば、
周期的なタイマー割込み、シリアル転送割込み、タスク
切り換え命令等である。
The CPU 2 executes a plurality of tasks while switching them. The tasks executed by the CPU 2 are switched in ascending or descending order of task numbers based on the task permission flag of the transfer unit 5 every time an event instructing task switching occurs. The task switching event is, for example,
Examples include a periodic timer interrupt, a serial transfer interrupt, and a task switching instruction.

【0030】コンテキスト退避メモリ3は、CPU2が
実行中でないタスクの情報を退避しておくメモリであ
る。タスクの情報はレジスタセットの内容、プロセッサ
ステータスワード(PSW)の内容、プログラムカウン
タ(PC)の内容等を含むコンテキストである。
The context save memory 3 is a memory for saving information on tasks that are not being executed by the CPU 2. The task information is a context including contents of a register set, contents of a processor status word (PSW), contents of a program counter (PC), and the like.

【0031】メモリ4は、CPU2がタスクの実行で処
理するデータ等を記憶する。転送部5は、タスク切り換
えイベントが発生する毎に、CPU2が次に実行するタ
スクのコンテキストをコンテキスト退避メモリ3から使
用中でないレジスタセットに復帰し、レジスタセットを
切り換える。切り換えたレジスタセットを使用してCP
U2が次のタスクを実行中に、切り換える前に使用中で
あったレジスタセットの内容をコンテキスト退避メモリ
3に退避する。
The memory 4 stores data processed by the CPU 2 in executing the task. Each time a task switching event occurs, the transfer unit 5 returns the context of the task to be executed next by the CPU 2 from the context save memory 3 to a register set that is not in use, and switches the register set. CP using switched register set
While U2 is executing the next task, the contents of the register set being used before switching are saved in the context saving memory 3.

【0032】図2は、図1に示したマイクロコンピュー
タの転送部の内部バスを含むより詳細な構成を示すブロ
ック図である。転送部5は、転送制御部51、ABUS
501、BBUS502、CBUS503、ARAMB
US504、DRAMBUS505から構成される。
FIG. 2 is a block diagram showing a more detailed configuration including the internal bus of the transfer unit of the microcomputer shown in FIG. The transfer unit 5 includes a transfer control unit 51, an ABUS
501, BBUS502, CBUS503, ARAMB
US504 and DRAMBUS505.

【0033】転送制御部51は、転送部5の各バスや各
バスに接続されたメモリ、レジスタファイル等を制御す
る。転送制御部51は、CPUがコンテキスト退避メモ
リ3をアクセスする際のアドレスをARAMBUS50
4から入力する。さらに、ABUS501にコンテキス
ト退避時の特定アドレスを出力する。
The transfer control unit 51 controls each bus of the transfer unit 5, a memory connected to each bus, a register file, and the like. The transfer control unit 51 stores the address when the CPU accesses the context save memory 3 in the ARAMBUS50.
Input from 4. Further, a specific address at the time of context saving is output to the ABUS 501.

【0034】図3は、図1に示したマイクロコンピュー
タのより詳細な構成を示すブロック図である。
FIG. 3 is a block diagram showing a more detailed configuration of the microcomputer shown in FIG.

【0035】同図に示すように、本マイクロコンピュー
タは、レジスタセットA101、レジスタセットB10
2、インクリメンタ201、命令アドレスバッファ20
2、プリフェッチカウンタ203、命令フェッチバッフ
ァ204、プロセッサステータスワード205、命令バ
ッファ206、命令レジスタ207、ステータスレジス
タ208、PLA209、マイクロ命令レジスタ21
0、ALU211、ALU出力バッファ212、オペラ
ンドアドレスバッファ213、ストアバッファ214、
ロードバッファ215、バス制御部216、タイミング
生成部217、ROM401、RAM402、転送制御
部51、タスクタイマ52、バススイッチ53、RAM
アドレス生成部54、シーケンサ55、タスク許可フラ
グ56、次タスク番号レジスタ57、コンテキスト退避
メモリアドレスレジスタ58、ABUS501、BBU
S502、CBUS503、ARAMBUS504、D
RAMBUS505、AROMBUS506、DROM
BUS507、COREBUS508とからなる。
As shown in the figure, the microcomputer includes a register set A101 and a register set B10.
2, incrementer 201, instruction address buffer 20
2. Prefetch counter 203, instruction fetch buffer 204, processor status word 205, instruction buffer 206, instruction register 207, status register 208, PLA 209, microinstruction register 21
0, ALU 211, ALU output buffer 212, operand address buffer 213, store buffer 214,
Load buffer 215, bus controller 216, timing generator 217, ROM 401, RAM 402, transfer controller 51, task timer 52, bus switch 53, RAM
Address generation unit 54, sequencer 55, task permission flag 56, next task number register 57, context save memory address register 58, ABUS 501, BBU
S502, CBUS503, ARAMBUS504, D
RAMBUS505, AROMBUS506, DROM
BUS507 and COREBUS508.

【0036】レジスタセット101とレジスタセット1
02とは、同一のレジスタ構成であり、それぞれ8ビッ
ト幅のデータレジスタ(D0、D1、D2、D3)と1
6ビット幅のアドレスレジスタ(A0、A1)と、16
ビット幅のスタックポインタ(SP)と、これらのデー
タを選択して出力するセレクタとを有する。インクリメ
ンタ201、命令アドレスバッファ202、プリフェッ
チカウンタ203、命令フェッチバッファ204からな
る回路は、ROM401から命令を順次プリフェッチす
る命令先読み準備部である。
Register set 101 and register set 1
02 has the same register configuration, and each has an 8-bit data register (D0, D1, D2, D3) and 1
A 6-bit width address register (A0, A1);
It has a bit-width stack pointer (SP) and a selector for selecting and outputting these data. A circuit including an incrementer 201, an instruction address buffer 202, a prefetch counter 203, and an instruction fetch buffer 204 is an instruction prefetch preparation unit that sequentially prefetches instructions from the ROM 401.

【0037】プロセッサステータスワード205は、A
LU211の演算フラグやCPU2の割込み状態等を記
憶する。
The processor status word 205 is A
The operation flag of the LU 211 and the interrupt status of the CPU 2 are stored.

【0038】命令バッファ206は、命令先読み準備部
によってプリフェッチされた複数の命令を保持する命令
キューである。
The instruction buffer 206 is an instruction queue for holding a plurality of instructions prefetched by the instruction prefetch preparation unit.

【0039】命令レジスタ207、ステータスレジスタ
208、PLA209、マイクロ命令レジスタ210か
らなる回路は、命令バッファ206から供給される命令
を解読し、実行を制御する命令制御部である。また、こ
の命令制御部はタスク切り換えを指示するイベントが発
生すると、タスクのコンテキストの一部を退避、復帰す
る制御および転送制御部51に転送の開始を通知する制
御を行う。本実施例では、上記イベントはタスクタイマ
ー52による割込みとする。また、命令制御部は、AB
US501、BBUS502のデータの入出力を制御す
る。
The circuit including the instruction register 207, the status register 208, the PLA 209, and the micro instruction register 210 is an instruction control unit that decodes an instruction supplied from the instruction buffer 206 and controls execution. When an event for instructing task switching occurs, the instruction control unit performs control to save and restore a part of the context of the task and control to notify the transfer control unit 51 of the start of transfer. In the present embodiment, the event is an interruption by the task timer 52. Further, the instruction control unit includes:
It controls input / output of data of US501 and BBUS502.

【0040】ALU211、ALU出力バッファ21
2、オペランドアドレスバッファ213、ストアバッフ
ァ214、ロードバッファ215からなる回路は、命令
制御部の制御に従って命令を実行する命令実行部であ
る。
ALU 211, ALU output buffer 21
2. The circuit including the operand address buffer 213, the store buffer 214, and the load buffer 215 is an instruction execution unit that executes an instruction under the control of the instruction control unit.

【0041】ROM401とRAM402は図1に示し
たメモリ4に相当し、複数のタスクのプログラム、スタ
ック領域、タスク開始アドレス退避領域を有する。各タ
スクのプログラムはROM401に記憶され、スタック
領域、タスク開始アドレス退避領域はRAM402に設
けられる。
The ROM 401 and the RAM 402 correspond to the memory 4 shown in FIG. 1, and have a plurality of task programs, a stack area, and a task start address saving area. The program of each task is stored in the ROM 401, and a stack area and a task start address saving area are provided in the RAM 402.

【0042】CPU内部バスはABUS501、BBU
S502、CBUS503の3本から構成され、CPU
外部のメモリバスは、ARAMBUS504、DRAM
BUS505、AROMBUS506、DROMBUS
507、COREBUS508の5本から構成される。
The CPU internal bus is ABUS501, BBU
S502, CBUS503, CPU
External memory bus is ARAMBUS504, DRAM
BUS505, AROMBUS506, DROMBUS
507 and COREBUS508.

【0043】ABUS501、BBUS502は、主に
レジスタファイル1に対してアクセスされるデータを伝
達する。
The ABUS 501 and the BBUS 502 mainly transmit data to be accessed for the register file 1.

【0044】CBUS503は、主にコンテキスト退避
メモリ3に対してアクセスするデータを伝達する。
The CBUS 503 mainly transmits data to be accessed to the context save memory 3.

【0045】ARAMBUS504とDRAMBUS5
05は、それぞれ主にRAM402に対してアクセスす
るアドレスとデータを伝達し、AROMBUS506と
DROMBUS507は、それぞれ主にROM401に
対してアクセスするアドレスとデータを伝達する。
ARAMBUS504 and DRAMBUS5
Reference numeral 05 mainly transmits an address and data for accessing the RAM 402, and AROMBUS 506 and DROMBUS 507 each transmit an address and data for mainly accessing the ROM 401.

【0046】COREBUS508は、主にマイクロコ
ンピュータの周辺機能に含まれるレジスタ等をアクセス
するアドレスとデータを伝達する。
The core bus 508 mainly transmits addresses and data for accessing registers and the like included in the peripheral functions of the microcomputer.

【0047】タスクタイマー52は、CPUが実行中の
タスクの時間を計測するタイマーで、タスク実行開始時
に設定され、一定時間間隔でタイマーの値がデクリメン
トされる。タスクタイマーの内容がゼロになると、CP
U2に対してタスク切り換えイベントの割込みを発生す
る。タスクタイマーに設定される値は、あらかじめコン
テキスト退避メモリに設定されている。また、タスク切
り換え時にはタスクタイマーの内容は常にゼロであるた
め、コンテキスト退避メモリには退避されない。
The task timer 52 is a timer for measuring the time of the task being executed by the CPU. The timer is set at the start of the task execution, and the value of the timer is decremented at regular time intervals. When the content of the task timer reaches zero, the CP
A task switching event interrupt is generated for U2. The value set in the task timer is set in the context save memory in advance. When the task is switched, the content of the task timer is always zero, so that the content is not saved in the context save memory.

【0048】バススイッチ53は、DRAMBUS50
5とCBUS503との間でデータの受け渡しをするバ
ッファである。
The bus switch 53 includes a DRAM BUS 50
5 is a buffer for transferring data between the CBUS 503 and the CBUS 503.

【0049】RAMアドレス生成部54は、タスク切り
換え時にCPUが退避、復帰するコンテキストの一部を
格納するRAM402のアドレスを生成する。
The RAM address generation unit 54 generates an address of the RAM 402 for storing a part of the context in which the CPU saves and returns when the task is switched.

【0050】シーケンサ55は、CPUからの起動要求
に応じて、CBUS503の制御や転送制御部内のレジ
スタの更新を制御する信号を出力し、タスクのコンテキ
ストを退避、復帰させる。
The sequencer 55 outputs a signal for controlling the CBUS 503 and updating the registers in the transfer control unit in response to a start request from the CPU, and saves and restores the task context.

【0051】タスク許可フラグ56は、CPUが実行す
るタスクの数と同数のビット数から構成され、各ビット
に対応するタスクの実行を許可するか、またはタスクの
実行を禁止するかを指定する。
The task permission flag 56 is composed of the same number of bits as the number of tasks executed by the CPU, and specifies whether the execution of the task corresponding to each bit is permitted or prohibited.

【0052】次タスク番号レジスタ57は、タスク切り
換えのイベントが発生したときに、次に切り換えて実行
するタスクの番号を格納するレジスタで、レジスタの内
容は、シーケンサがタスク許可フラグ56の内容に基づ
いて決められる。
The next task number register 57 stores the number of the next task to be switched and executed when a task switching event occurs. The content of the register is based on the content of the task permission flag 56 by the sequencer. Can be determined.

【0053】タスク許可レジスタ56および次タスク番
号レジスタ57は、COREBUS508にも接続され
ており、CPUのプログラム実行によって内容の読み出
しまたは書き込みが出来る。
The task permission register 56 and the next task number register 57 are also connected to the COREBUS 508, and the contents can be read or written by executing a program of the CPU.

【0054】コンテキスト退避メモリアドレスレジスタ
58は、コンテキスト退避メモリ3をアクセスする番地
を格納するレジスタで、シーケンサ55がコンテキスト
退避メモリをアクセスする際に参照される。
The context save memory address register 58 stores an address for accessing the context save memory 3 and is referred to when the sequencer 55 accesses the context save memory.

【0055】図4は、図2のマイクロコンピュータの転
送制御部51のより詳細な構成と、コンテキスト退避メ
モリ3のより詳細なデータ構成を示すブロック図であ
る。同図において、タスク許可フラグ制御部59は、次
タスク番号レジスタ57に格納されたタスクの番号をデ
コードし、タスク許可フラグ56のタスク番号に対応す
るビットを1にする。また、命令によりタスク許可フラ
グを変更する場合、タスク許可フラグ制御部59はCO
REBUS508のデータをタスク許可フラグ56に設
定する。
FIG. 4 is a block diagram showing a more detailed configuration of the transfer controller 51 of the microcomputer of FIG. 2 and a more detailed data configuration of the context save memory 3. In the figure, the task permission flag control section 59 decodes the task number stored in the next task number register 57 and sets the bit corresponding to the task number of the task permission flag 56 to 1. When the task permission flag is changed by an instruction, the task permission flag
The data of REBUS 508 is set in the task permission flag 56.

【0056】現タスク番号レジスタ60は、CPUが現
在実行中のタスクの番号を格納する。前タスク番号レジ
スタ61は、CPUが現在実行中のタスクに切り換わる
前に実行していたタスクの番号を格納する。
The current task number register 60 stores the number of the task currently being executed by the CPU. The previous task number register 61 stores the number of the task that was being executed before the CPU switched to the task that is currently being executed.

【0057】タスク番号制御部62は、タスク許可フラ
グ56の内容と現タスク番号レジスタ60の内容とシー
ケンサ55が出力するレジスタ書換信号とを入力し、次
タスク番号レジスタ57、現タスク番号レジスタ60、
前タスク番号レジスタ61の内容をそれぞれ更新する。
シーケンサ55が出力する書換信号のタイミングは、図
9に矢印で示されている。また、タスク番号制御部が次
タスク番号レジスタを更新する内容は、図11に示され
ている。
The task number control section 62 receives the contents of the task permission flag 56, the contents of the current task number register 60, and the register rewrite signal output by the sequencer 55, and receives the next task number register 57, the current task number register 60,
The contents of the previous task number register 61 are updated.
The timing of the rewrite signal output by the sequencer 55 is indicated by an arrow in FIG. FIG. 11 shows the contents of the task number control unit updating the next task number register.

【0058】図9によると、矢印で示されているよう
に、前タスク番号レジスタ61が書き換えられるのはシ
ーケンサ55のステート0であり、次タスク番号レジス
タ57および現タスク番号レジスタ60が書き換えられ
るのはシーケンサ55のステート9である。
According to FIG. 9, it is state 0 of the sequencer 55 that the previous task number register 61 is rewritten, as indicated by the arrow, and the next task number register 57 and the current task number register 60 are rewritten. Is state 9 of the sequencer 55.

【0059】レジスタセットA使用フラグ63は、CP
Uがタスク実行に使用するレジスタセットを指定するフ
ラグであり、レジスタセットA使用フラグが1の時、レ
ジスタセットAを使用し、0の時、レジスタBを使用す
る。
The register set A use flag 63 indicates that the CP
U is a flag for specifying a register set to be used for task execution. When the register set A use flag is 1, the register set A is used, and when it is 0, the register B is used.

【0060】メモリ制御部64は、コンテキスト退避メ
モリ3の読み出しおよび書き込みと、レジスタファイル
1の読み出しおよび書き込みを制御する。メモリ制御部
64は、コンテキスト退避メモリ3へのデータの書き込
みを制御するコンテキスト退避メモリ書き込み制御部6
5と、コンテキスト退避メモリ3からのデータの読み出
しを制御するコンテキスト退避メモリ読み出し制御部6
6と、レジスタファイルへのデータの書き込みを制御す
るレジスタ書き込み制御部67と、レジスタファイルか
らのデータの読み出しを制御するレジスタ読み出し制御
部68とを有する。
The memory control unit 64 controls reading and writing of the context saving memory 3 and reading and writing of the register file 1. The memory control unit 64 includes a context save memory write control unit 6 that controls writing of data to the context save memory 3.
5 and a context saving memory read control unit 6 for controlling reading of data from the context saving memory 3
6, a register write control unit 67 that controls writing of data to the register file, and a register read control unit 68 that controls reading of data from the register file.

【0061】図4に示すコンテキスト退避メモリ3は、
タスク数4までに対応する場合の構成を示し、64バイ
トの容量である。64バイトを4つに分割し、分割した
各領域のアドレスの若いほうから順に、スタックポイン
タ(SP)、データレジスタ(D0、D1、D2、D
3)、アドレスレジスタ(A0、A1)、プロセッサス
テータスワード(PSW)、タスクタイマー(TT)、
オペランドアドレスバッファ(OAB)を退避する。1
6ビット幅のレジスタは、下位の8ビットがアドレスの
若いほうに退避される。また、本実施例では分割した各
領域には、2バイトの予備の退避領域が存在する。
The context saving memory 3 shown in FIG.
The figure shows a configuration for handling up to four tasks, and has a capacity of 64 bytes. The 64 bytes are divided into four, and the stack pointer (SP) and the data registers (D0, D1, D2, D
3), address registers (A0, A1), processor status word (PSW), task timer (TT),
Save the operand address buffer (OAB). 1
In a 6-bit register, the lower 8 bits are saved in the lower address. In this embodiment, each of the divided areas has a 2-byte spare save area.

【0062】図5は、タスク切り換え時の処理のフロー
チャートである。同図において、「CPU、転送部」、
「転送部」はそれぞれ、タスク切り換え時にCPU2お
よび転送部5が同期して並行に処理するフローと転送部
5単独で処理するフローを示す。
FIG. 5 is a flowchart of a process at the time of task switching. In the figure, “CPU, transfer unit”,
The “transfer unit” indicates a flow in which the CPU 2 and the transfer unit 5 perform processing synchronously and in parallel at the time of task switching, and a flow in which the transfer unit 5 performs processing alone.

【0063】同図のフローチャートは、CPU2がレジ
スタセットAを使用してタスク1を実行中に、タスク切
り換え要求が発生し、タスク2に切り換わるフローを示
している。CPU2は、タスク切り換え要求が発生する
と、実行中のタスクを一次停止し、タスク切り換え処理
に移行する。このタスク切り換えは、CPU2は割込み
処理と同様にPLA209により処理され、転送部5は
シーケンサ55により処理される。
The flowchart in FIG. 11 shows a flow in which a task switching request is generated while the CPU 2 is executing the task 1 using the register set A, and the task 2 is switched to the task 2. When a task switching request is generated, the CPU 2 temporarily stops the task being executed, and shifts to a task switching process. In the task switching, the CPU 2 is processed by the PLA 209 in the same manner as the interrupt processing, and the transfer unit 5 is processed by the sequencer 55.

【0064】図6、図7、図8は、タスク切り換え処理
のタイミングチャートを示す図である。同図には、タイ
ミング(T2、T1)、IAB202、PFC203、
IR207、MIR210、ABUS501、BBUS
502、CBUS503、ALU211、ALB21
2、OAB213、STB214、LDB215、AR
AMBUS504、DRAMBUS505の内容が、各
サイクル毎にそれぞれ示されている。なお同図において
右方向が時間軸である。
FIGS. 6, 7, and 8 are timing charts of the task switching process. In the figure, timings (T2, T1), IAB202, PFC203,
IR207, MIR210, ABUS501, BBUS
502, CBUS503, ALU211 and ALB21
2, OAB213, STB214, LDB215, AR
The contents of AMBUS 504 and DRAMBUS 505 are shown for each cycle. In the figure, the right direction is the time axis.

【0065】また、ABUS、BBUS、CBUSの網
かけは転送部5により制御されていることを示してい
る。
Further, the shading of ABUS, BBUS and CBUS indicates that the transfer is controlled by the transfer unit 5.

【0066】図9は、転送部5のシーケンサ55による
各部の動作を示した図であり、シーケンサ55のステー
トおよびタイミング毎に、コンテキスト退避メモリ3の
アドレス(address)とデータ(data)と転
送方向(R/W)、バス(ABUS、BBUS、CBU
S)、タスク番号レジスタ(PRVTSK、CRNTT
SK、NEXTTSK)、レジスタファイルA使用フラ
グ(GRARUN)の状態がそれぞれ図示されている。
FIG. 9 is a diagram showing the operation of each unit by the sequencer 55 of the transfer unit 5. For each state and timing of the sequencer 55, the address (address), data (data), and transfer direction of the context save memory 3 are shown. (R / W), bus (ABUS, BBUS, CBU)
S), task number registers (PRVTSK, CRNTT)
SK, NEXTTSK), and the state of the register file A use flag (GRARUN) are shown in FIG.

【0067】転送方向のWはコンテキスト退避メモリへ
の書き込みを、Rはコンテキスト退避メモリからの読み
出しをそれぞれ示している。
W in the transfer direction indicates writing to the context saving memory, and R indicates reading from the context saving memory.

【0068】同図のバスの欄にカッコ付きで示されたも
のは、他のバスに出力された内容が転送されていること
を示す。また、「old」はタスク切り換え要求発生時
点で実行していたタスクのコンテキストを指し、「ne
w」はタスク切り換え要求により新しく切り換わるタス
クのコンテキストを指す。「address」の欄の
「crnttsk」、「nexttsk」、「prvt
sk」はそれぞれ、現タスク番号レジスタCRNTTS
K60、次タスク番号レジスタNEXTTSK57、前
タスク番号レジスタPRVTSK61の内容を16倍し
た値を示し、例えば、ステート0の「crnttsk+
12」はCRNTTSKの内容「1」を16倍した値に
12を加算した値「28」をコンテキスト退避メモリの
アドレスにすることを示している。
In the figure, parentheses in the bus column indicate that the content output to another bus is being transferred. “Old” indicates the context of the task that was being executed when the task switching request occurred, and “ned”
"w" indicates the context of the task newly switched by the task switching request. "Crnttsk", "nextsk", "prvt" in the column of "address"
sk ”is the current task number register CRNTTS.
K60, a value obtained by multiplying the contents of the next task number register NEXTTSK57 and the previous task number register PRVTSK61 by 16, for example, “crnttsk +
“12” indicates that the value “28” obtained by adding 12 to the value obtained by multiplying the content “1” of CRNTTSK by 16 is used as the address of the context save memory.

【0069】同図のステートおよびタイミングは、図6
Aから図6Cのサイクルの表示に一致している。従っ
て、例えば図7のステート0は、図6Aのサイクル0に
対応し、タイミングT2、タイミングT1は、図6のT
2の状態1、T1の状態1にそれぞれ対応している。
The states and timings shown in FIG.
6A to FIG. 6C. Therefore, for example, the state 0 in FIG. 7 corresponds to the cycle 0 in FIG. 6A, and the timing T2 and the timing T1 correspond to T0 in FIG.
2 corresponds to state 1 of T1, and state 1 of T1.

【0070】図10は、各タスクのプログラムカウンタ
を退避するRAM402の特定領域の構成を示した図で
ある。本実施例では4つのタスクのプログラムカウンタ
の内容を退避する領域が、アドレス0からアドレス7ま
での8バイトの特定領域に設けられている。
FIG. 10 is a diagram showing a configuration of a specific area of the RAM 402 for saving the program counter of each task. In this embodiment, an area for saving the contents of the program counters of the four tasks is provided in a specific area of 8 bytes from address 0 to address 7.

【0071】以下、図5、図6、図7、図8、図9に基
づいてタスク切り換え処理をステートに従って詳細に説
明する。
Hereinafter, the task switching process will be described in detail according to states with reference to FIGS. 5, 6, 7, 8 and 9.

【0072】<ステート0>CPU2はタスク切り換え
要求発生時のOAB213の内容をタイミングT2、T
1でそれぞれBBUSに出力する。
<State 0> The CPU 2 determines the contents of the OAB 213 at the time of the task switching request at timings T2 and T2.
1 outputs to each BBUS.

【0073】転送部5は、現タスク番号レジスタの内容
が1なので、ABUSにはPCの退避アドレス2番地の
下位8ビットをタイミングT2で、上位8ビットをタイ
ミングT1でそれぞれABUSに出力するとともに、C
PUがBBUSに出力したOABの内容をCBUSに転
送し、コンテキスト退避メモリの28番地と29番地に
書き込む(ステップ51)。また、CRNTTSKの内
容をPRVTSKに転送する。
Since the content of the current task number register is 1, the transfer section 5 outputs the lower 8 bits of the PC save address 2 to the ABUS at timing T2 and the upper 8 bits to the ABUS at timing T1. C
The PU transfers the contents of the OAB output to the BBUS to the CBUS, and writes the contents to the addresses 28 and 29 of the context save memory (step 51). Also, the contents of CRNTTSK are transferred to PRVTSK.

【0074】ABUSに出力された退避アドレスは、C
PUによりALUを通してALB212に転送される。
The save address output to ABUS is C
The PU transfers the data to the ALB 212 through the ALU.

【0075】<ステート1>CPUはALBに格納され
た退避アドレスをIAB202に転送するとともに、A
ROMBUSを通して、ARAMBUSに出力する。ま
た、ABUSにPFC203の内容を、BBUSに定数
「1」をそれぞれ出力し、実行中であったタスク1の戻
り番地(プログラムカウンタの値)をALUにより計算
する。計算結果の下位8ビットはSTB214に転送さ
れ、タイミングT2でDRAMBUSに出力される。計
算結果の上位8ビットはALBに格納される。従って、
CPUはRAM402の2番地に戻り番地の下位8ビッ
トを書き込む(ステップ52)。
<State 1> The CPU transfers the save address stored in the ALB to the IAB 202, and
Output to ARAMBUS through ROMBUS. Also, the contents of the PFC 203 are output to the ABUS and the constant "1" is output to the BBUS, and the return address (program counter value) of the task 1 being executed is calculated by the ALU. The lower 8 bits of the calculation result are transferred to STB 214 and output to DRAMBUS at timing T2. The upper 8 bits of the calculation result are stored in ALB. Therefore,
The CPU returns to address 2 of the RAM 402 and writes the lower 8 bits of the address (step 52).

【0076】転送部はステート1では何もしない。な
お、戻り番地の計算は、計算時の命令バッファ206の
先読み量によって制御されるが、本発明には関係ないの
で詳細な説明は省略する。
The transfer section does nothing in state 1. The calculation of the return address is controlled by the prefetch amount of the instruction buffer 206 at the time of calculation, but a detailed description is omitted because it is not related to the present invention.

【0077】<ステート2>CPUはサイクル1で使用
したIABの内容をインクリメンタ201により+1
し、AROMBUSを通してARAMBUSに出力する
とともに、サイクル1で計算したタスク1の戻り番地の
上位8ビットをDRAMBUSに出力して、RAM40
2の3番地に書き込む(ステップ52)。また、タスク
1のPSWの内容をABUSに出力する。
<State 2> The CPU increments the content of IAB used in cycle 1 by +1 by the incrementer 201.
Then, while outputting to ARAMBUS through AROMBUS, the upper 8 bits of the return address of task 1 calculated in cycle 1 are output to DRAMBUS,
The data is written to address 3 of step 2 (step 52). Also, the contents of the PSW of task 1 are output to ABUS.

【0078】転送部はタイミングT2でABUSに出力
されたPSWの内容を、CBUSに転送し、コンテキス
ト退避メモリの26番地に書き込み(ステップ53)、
タイミングT1でコンテキスト退避メモリの32番地を
読み出す。また、転送部がアクセスするレジスタセット
は、レジスタセットA使用フラグの内容を反転した値が
示すレジスタセットを使用する。従って、図7の例で
は、ステート2よりステート8の間では、転送部はレジ
スタセットBに対してアクセスし、ステート9よりステ
ート14の間では、レジスタセットAに対してアクセス
する。
The transfer unit transfers the contents of the PSW output to the ABUS at the timing T2 to the CBUS, and writes the contents into the address 26 of the context save memory (step 53).
At timing T1, address 32 of the context save memory is read. The register set accessed by the transfer unit uses a register set indicated by a value obtained by inverting the content of the register set A use flag. Therefore, in the example of FIG. 7, the transfer unit accesses the register set B between the state 2 and the state 8 and accesses the register set A between the state 9 and the state 14.

【0079】<ステート3>CPUは、ABUSに出力
されたタスク2の戻り番地が退避されているRAM40
2のアドレスをALUを通してALBに格納する。
<State 3> The CPU returns to the RAM 40 in which the return address of the task 2 output to the ABUS is saved.
2 is stored in the ALB through the ALU.

【0080】転送部は、次タスク番号レジスタの内容
「2」に基づいて、タスク2の戻り番地が退避されてい
るRAM402のアドレス4番地の下位8ビットをタイ
ミングT2で、上位8ビットをタイミングT1でそれぞ
れABUSに出力するとともに、前サイクルのタイミン
グT1で読み出したタスク2のSPLを、タイミングT
2でCBUSに出力する。また、タイミングT2ではコ
ンテキスト退避メモリの33番地を読み出し、タイミン
グT1でCBUSに出力する。CBUSに出力されたS
PLの内容およびSPHの内容はBBUSに転送され、
レジスタセットBのSPLおよびSPHに格納される
(ステップ54)。
Based on the content “2” of the next task number register, the transfer unit sets the lower 8 bits of the address 4 of the RAM 402 in which the return address of the task 2 is saved to the timing T2 and the upper 8 bits to the timing T1. At the timing T1 of the previous cycle, and outputs the SPL of the task 2 read at the timing T1 of the previous cycle.
2 to output to CBUS. At the timing T2, the address 33 of the context save memory is read, and is output to the CBUS at the timing T1. S output to CBUS
The contents of PL and the contents of SPH are transferred to BBUS,
It is stored in SPL and SPH of register set B (step 54).

【0081】<ステート4>CPUは、ALBに格納さ
れたアドレスをIABに転送するとともに、AROMB
USを通してARAMBUSに出力し、RAM402の
4番地からタスク2の戻り番地の下位8ビットを読み出
して、LDBに格納する。
<State 4> The CPU transfers the address stored in the ALB to the IAB,
The data is output to ARAMBUS through the US, and the lower 8 bits of the return address of task 2 are read from address 4 of RAM 402 and stored in LDB.

【0082】転送部は、前サイクルのタイミングT1で
コンテキスト退避メモリの34番地から読み出したD0
の内容を、CBUSに出力し、BBUSを通してレジス
タセットBのD0に格納するとともに、タイミングT1
でコンテキスト退避メモリの35番地のD1の内容を読
み出してCBUSに出力し、BBUSを通してレジスタ
セットBのD1に格納する(ステップ54)。
At the timing T1 of the previous cycle, the transfer unit reads D0 read from the address 34 of the context save memory.
Is output to the CBUS and stored in D0 of the register set B through the BBUS, and at the timing T1
Read the contents of D1 at address 35 of the context save memory, output it to CBUS, and store it in D1 of register set B through BBUS (step 54).

【0083】<ステート5>CPUは、LDBの内容を
ABUSに出力し、ALUを通してALBに格納すると
共に、前サイクルのIABの内容をインクリメンタによ
り+1したアドレスをARAMBUSに出力して、RA
M401の5番地からタスク2の戻り番地の上位8ビッ
トを読み出し、LDBに格納する(ステップ55)。
<State 5> The CPU outputs the contents of the LDB to the ABUS, stores it in the ALB through the ALU, and outputs an address obtained by incrementing the contents of the IAB of the previous cycle by an incrementer to the ARAMBUS.
The upper 8 bits of the return address of task 2 are read from address 5 of M401 and stored in LDB (step 55).

【0084】転送部は、ステート4と同様に、D2の内
容およびD3の内容をコンテキスト退避メモりから読み
出して、レジスタセットBのD2、D3にそれぞれ格納
する(ステップ54)。
The transfer unit reads the contents of D2 and D3 from the context save memory in the same manner as in the state 4, and stores them in D2 and D3 of the register set B (step 54).

【0085】<ステート6>CPUは、ALBに格納さ
れたタスク2の戻り番地の下位8ビットの内容をIAB
の下位8ビットに格納すると共に、LDBの内容をAB
USに出力し、ALUを通して再度ABUSに出力す
る。CPUはABUSに出力したタスク2の戻り番地の
上位8ビットをALUを通してALBに格納する。
<State 6> The CPU stores the contents of the lower 8 bits of the return address of task 2 stored in the ALB in IAB.
And the contents of the LDB as AB
Output to US and output to ABUS again through ALU. The CPU stores the upper 8 bits of the return address of task 2 output to the ABUS to the ALB through the ALU.

【0086】転送部は、ステート4と同様に、A0の下
位8ビットの内容および上位8ビットの内容をコンテキ
スト退避メモりから読み出して、レジスタセットBのA
0L、A0Hにそれぞれ格納する(ステップ54)。
The transfer unit reads the contents of the lower 8 bits and the contents of the upper 8 bits of A0 from the context save memory as in state 4,
0L and A0H are stored (step 54).

【0087】<ステート7>CPUは、ALBに格納さ
れたタスク2の戻り番地の上位8ビットの内容をIAB
の上位8ビットに格納し(ステップ55)、IABの内
容をAROMBUSに出力してタスク2の戻り番地から
命令をフェッチしてIFBに格納する。
<State 7> The CPU sets the contents of the upper 8 bits of the return address of task 2 stored in the ALB to IAB.
The contents of IAB are output to AROMBUS, an instruction is fetched from the return address of task 2 and stored in IFB (step 55).

【0088】転送部は、ステート4と同様に、A1の下
位8ビットの内容および上位8ビットの内容をコンテキ
スト退避メモりから読み出して、レジスタセットBのA
1L、A1Hにそれぞれ格納する。
The transfer unit reads the contents of the lower 8 bits and the contents of the upper 8 bits of A1 from the context save memory in the same manner as in state 4,
1L and A1H respectively.

【0089】<ステート8>CPUは、BBUSに出力
されたタスク2のPSWの内容をALUを通してABU
Sに出力し、PSW205に格納する(ステップ5
6)。また、前サイクルでフェッチした命令を命令バッ
ファ206に転送すると共に、タスク2の戻り番地を+
1したアドレスから続けて命令をフェッチし、IFBに
格納する。
<State 8> The CPU transfers the contents of the PSW of task 2 output to BBUS to the ABU through the ALU.
S, and store it in the PSW 205 (step 5).
6). The instruction fetched in the previous cycle is transferred to the instruction buffer 206, and the return address of the task 2 is set to +
Instructions are fetched continuously from the set address and stored in the IFB.

【0090】転送部は、前サイクルのタイミングT1で
コンテキスト退避メモリの42番地から読み出したタス
ク2のPSWの内容を、タイミングT2でCBUSに出
力すると共にBBUSに転送する。また、タイミングT
2で読み出した43番地の内容を、タスクの実行時間を
決めるタスクタイマ52に格納する(ステップ57)。
The transfer unit outputs the contents of the PSW of the task 2 read from the address 42 of the context save memory at the timing T1 of the previous cycle to the CBUS at the timing T2 and transfers it to the BBUS. The timing T
The contents of the address 43 read in step 2 are stored in the task timer 52 which determines the execution time of the task (step 57).

【0091】<ステート9>CPUは、タスク2の命令
をIR207に格納して命令の解読を開始すると共に、
BBUSに出力されたタスク2のOABの内容をALU
を通してALBに格納する(ステップ58)。
<State 9> The CPU stores the instruction of task 2 in the IR 207 and starts decoding the instruction.
ALU contents of OAB of task 2 output to BBUS
Is stored in the ALB (step 58).

【0092】転送部は、前サイクルのタイミングT1で
コンテキスト退避メモリの44番地から読み出したタス
ク2のOABLの内容を、タイミングT2でCBUSに
出力すると共にBBUSに転送する。また、タイミング
T2で読み出した45番地の内容を、タイミングT1で
CBUSに出力すると共にBBUSに転送する。さら
に、次タスク番号レジスタNEXTTSKの内容を現タ
スク番号レジスタCRNTTSKに転送し、NEXTT
SKの内容を更新する。
The transfer section outputs the contents of the OABL of the task 2 read from the address 44 of the context save memory at the timing T1 of the previous cycle to the CBUS at the timing T2 and transfers it to the BBUS. Further, the content of the address 45 read at the timing T2 is output to the CBUS and transferred to the BBUS at the timing T1. Further, the contents of the next task number register NEXTTSK are transferred to the current task number register CRNTTSK, and NEXTT
Update the contents of SK.

【0093】転送部はさらに、レジスタセットA使用フ
ラグ63を「0」にして、以降でCPUがタスクの実行
に使用するレジスタセットをB側にする(ステップ5
9)。
The transfer unit further sets the register set A use flag 63 to “0”, and sets the register set used by the CPU for executing the task thereafter to the B side (step 5).
9).

【0094】<ステート10>CPUは、ALBに格納
された内容をタスク2のOABに格納し、タスク2の命
令を転送部とは独立して実行する(ステップ61)。従
って、ステート11以降は、転送部のみの動作を説明す
る。
<State 10> The CPU stores the content stored in the ALB in the OAB of the task 2, and executes the instruction of the task 2 independently of the transfer unit (step 61). Therefore, after the state 11, the operation of only the transfer unit will be described.

【0095】転送部は、タスク切り換え要求発生時のタ
スク1のコンテキストであるSPLおよびSPHをレジ
スタセットAから読み出してCBUSに出力し、コンテ
キスト退避メモリの16番地および17番地に格納する
(ステップ62)。
The transfer unit reads SPL and SPH, which are the contexts of task 1 at the time of the task switching request, from register set A, outputs them to CBUS, and stores them in addresses 16 and 17 of the context save memory (step 62). .

【0096】<ステート11>転送部は、ステート10
と同様にタスク切り換え要求発生時のタスク1のコンテ
キストであるD0およびD1をレジスタセットAから読
み出してCBUSに出力し、コンテキスト退避メモリの
18番地および19番地に格納する(ステップ62)。
<State 11> The transfer unit performs state 10
Similarly to the above, D0 and D1, which are the contexts of task 1 at the time of the task switching request, are read from register set A, output to CBUS, and stored in addresses 18 and 19 of the context save memory (step 62).

【0097】<ステート12>転送部は、ステート10
と同様にタスク切り換え要求発生時のタスク1のコンテ
キストであるD2およびD3をレジスタセットAから読
み出してCBUSに出力し、コンテキスト退避メモリの
20番地および21番地に格納する(ステップ62)。
<State 12> The transfer unit performs state 10
Similarly to the above, D2 and D3, which are contexts of task 1 when a task switching request occurs, are read from register set A, output to CBUS, and stored in addresses 20 and 21 of the context save memory (step 62).

【0098】<ステート13>転送部は、ステート10
と同様にタスク切り換え要求発生時のタスク1のコンテ
キストであるA0LおよびA0HをレジスタセットAか
ら読み出してCBUSに出力し、コンテキスト退避メモ
リの22番地および23番地に格納する(ステップ6
2)。
<State 13> The transfer unit performs state 10
Similarly to the above, A0L and A0H, which are the contexts of task 1 when a task switching request occurs, are read from register set A, output to CBUS, and stored in addresses 22 and 23 of the context save memory (step 6).
2).

【0099】<ステート14>転送部は、ステート10
と同様にタスク切り換え要求発生時のタスク1のコンテ
キストであるA1LおよびA1HをレジスタセットAか
ら読み出してCBUSに出力し、コンテキスト退避メモ
リの24番地および25番地に格納する(ステップ6
2)。
<State 14> The transfer unit performs state 10
Similarly to the above, A1L and A1H, which are the contexts of task 1 when a task switching request occurs, are read from register set A, output to CBUS, and stored in addresses 24 and 25 of the context save memory (step 6).
2).

【0100】図11は、タスク番号制御部62が次タス
ク番号レジスタNEXTTSKの値を決定するための動
作を示した図である。
FIG. 11 is a diagram showing an operation for the task number control unit 62 to determine the value of the next task number register NEXTTSK.

【0101】次タスク番号レジスタの値は、タスク許可
フラグTSKEN56の内容と現タスク番号レジスタC
RNTTSK60の内容とによって決定する。タスク許
可フラグのLSB側が番号の若いタスクに対応してお
り、本実施例では、タスク許可フラグのLSB側が高い
優先度となっている。従って、タスク許可フラグの複数
のビットがセットされている場合には、番号の若いタス
クから先に実行される。例えば、TSKEN=’001
1’はタスク0とタスク1を許可することを示し、現タ
スク番号が「0」であれば次タスク番号は「1」にな
り、現タスク番号が「1」、「2」、「3」であれば次
タスク番号は「0」になる。この例ではTSKENのビ
ット2、ビット3は「0」になっているので、タスク2
およびタスク3の許可フラグが命令の実行等でクリアさ
れたことを示している。
The value of the next task number register is determined by the contents of the task enable flag TSKEN56 and the current task number register C.
It is determined according to the contents of RNTTSK60. The LSB side of the task permission flag corresponds to the task with the lower number, and in this embodiment, the LSB side of the task permission flag has a higher priority. Therefore, when a plurality of bits of the task permission flag are set, the task with the lower number is executed first. For example, TSKEN = '001
1 'indicates that task 0 and task 1 are permitted. If the current task number is "0", the next task number is "1", and the current task numbers are "1", "2", and "3". Then, the next task number becomes “0”. In this example, since the bits 2 and 3 of TSKEN are “0”, the task 2
And that the permission flag of task 3 has been cleared by execution of an instruction or the like.

【0102】他の組み合わせ状態も同様であるので、詳
細な説明は省略する。なお、上記実施例の説明ではタス
クの数を4にしたが、これに限定されるものではない。
また、コンテキスト退避メモリやRAMへのタスクの退
避領域のアドレスも限定されるものではない。
The same applies to other combination states, and a detailed description will be omitted. In the description of the above embodiment, the number of tasks is four, but the number is not limited to four.
Also, the address of the task save area in the context save memory or RAM is not limited.

【0103】上記実施例では、タスクのコンテキストの
うちプログラムカウンタのみをRAMに退避したが、プ
ログラムカウンタ以外にPSW等をRAMに退避しても
よい。
In the above embodiment, only the program counter of the task context is saved in the RAM, but PSW and the like other than the program counter may be saved in the RAM.

【0104】上記実施例では、RAMへの退避領域は特
定番地としたが、実行中であったタスクのSPが指すス
タック領域にコンテキストを退避してもよい。その場
合、退避するSPはタスクの実行を停止した時点の値の
ままでもよい。
In the above embodiment, the save area in the RAM is a specific address. However, the context may be saved in the stack area indicated by the SP of the task being executed. In this case, the value of the SP to be saved may be the value at the time when the execution of the task is stopped.

【0105】図12は、本発明の第2の実施例における
転送部とCPUとの接続を説明する図である。
FIG. 12 is a diagram for explaining the connection between the transfer unit and the CPU according to the second embodiment of the present invention.

【0106】同図においてマイコンコア1は、CPU2
とレジスタセット3とからなり、CPU2は、マイクロ
制御部21と、コアレジスタ読み出し制御部22とバッ
ファ23とを含む。拡張部4は、転送部5と2つのレジ
スタセットGRA6およびレジスタセットGRB7とか
らなり、転送部5は、拡張指定部51と拡張レジスタ読
み出し制御部52とバッファ53とバッファ54とを含
む。マイコンコア1と拡張部4とはABUSとBBUS
からなる2本の内部バスで接続されている。マイコンコ
ア1は、拡張部4が接続されていない状態でも命令の実
行が可能である。以下では、マイコンコア1に拡張部4
が接続されている場合の動作を説明する。
In the figure, a microcomputer core 1 is a CPU 2
The CPU 2 includes a microcontroller 21, a core register read control unit 22, and a buffer 23. The extension unit 4 includes a transfer unit 5 and two register sets GRA6 and GRB7. The transfer unit 5 includes an extension designation unit 51, an extension register read control unit 52, a buffer 53, and a buffer 54. The microcomputer core 1 and the extension unit 4 are ABUS and BBUS
Are connected by two internal buses. The microcomputer core 1 can execute an instruction even when the extension unit 4 is not connected. In the following, the extension unit 4
The operation when is connected will be described.

【0107】拡張指定部51により、拡張部4がマイコ
ンコア1に接続されていることをCPU2に通知する
と、コアレジスタ読み出し制御部22は、レジスタセッ
トの読み出しをマイクロ制御部21から指示されても、
バッファ23を動作させず、ABUSおよびBBUSに
は何も読み出さないようにする。一方、マイクロ制御部
からのレジスタセット読み出しの指示は、拡張レジスタ
読み出し制御部52に対しても出される。拡張部4に含
まれる転送部5の動作は、2つのレジスタセットを有す
る本発明の第1の実施例と同様であるので詳細は省略す
る。
When the extension designating section 51 notifies the CPU 2 that the extension section 4 is connected to the microcomputer core 1, the core register read control section 22 receives the instruction from the microcontroller 21 to read the register set. ,
The buffer 23 is not operated, and nothing is read to ABUS and BBUS. On the other hand, the instruction to read the register set from the microcontroller is also issued to the extension register read controller 52. The operation of the transfer unit 5 included in the extension unit 4 is the same as that of the first embodiment of the present invention having two register sets, and thus the details are omitted.

【0108】図13は、図12に示された本発明の第2
の実施例における回路配置を説明する図である。
FIG. 13 shows the second embodiment of the present invention shown in FIG.
FIG. 6 is a diagram for explaining a circuit arrangement in the example of FIG.

【0109】マイコンコア1はビット当りの回路の繰り
返しから構成されるデータパス部と不規則回路から構成
される制御部とからなり、データパス部は制御部から出
力されるデータパス制御信号により制御される。データ
パス部で処理するデータの流れの方向をX軸とすると、
データパス制御信号はY軸方向である。制御部、データ
パス部、拡張部の順にY軸方向に配置し、データパス制
御信号をデータパス部を貫通させてY軸方向に延長する
ことで、同一のデータパス制御信号をデータパス部と拡
張部とに接続する。
The microcomputer core 1 is composed of a data path section composed of a repetition of a circuit per bit and a control section composed of an irregular circuit. The data path section is controlled by a data path control signal output from the control section. Is done. When the direction of the flow of data processed in the data path unit is the X axis,
The data path control signal is in the Y-axis direction. By arranging the control section, the data path section, and the extension section in the Y-axis direction in order, and extending the data path control signal in the Y-axis direction by penetrating the data path section, the same data path control signal is transmitted to the data path section. Connect to extension.

【0110】また、拡張部を制御する拡張部制御信号
は、制御部から一旦X軸方向に出力した後、データパス
を通らずに拡張部に接続する。
The extension control signal for controlling the extension is output from the control unit in the X-axis direction, and then connected to the extension without passing through the data path.

【0111】図13には省略しているが、ABUSおよ
びBBUSは、データパス部からY軸方向に延ばして拡
張部に接続する。
Although not shown in FIG. 13, ABUS and BBUS extend from the data path section in the Y-axis direction and are connected to the extension section.

【0112】なお、ABUSおよびBBUSは拡張部制
御信号と同様に一旦X軸方向に延ばした後、拡張部に接
続してもよい。
ABUS and BBUS may be once extended in the X-axis direction, like the extension control signal, and then connected to the extension.

【0113】[0113]

【発明の効果】以上説明したように、請求項1の発明に
よれば、コンテキストの退避処理と切り換えた後のタス
クの実行を並行処理できるという効果がある。特に、組
み込み用途のマイクロコンピュータにおいては、ハード
ウェア規模の制約があっても、タスク切り換えを高速に
実現できるので、リアルタイム制御を可能にする。
As described above, according to the first aspect of the present invention, there is an advantage that the context saving processing and the execution of the task after switching can be performed in parallel. In particular, in a microcomputer for embedded use, task switching can be performed at high speed even if there is a restriction on the hardware scale, so that real-time control is possible.

【0114】請求項2の発明によれば、請求項1の効果
に加えて、コンテキストの退避処理を高速に実現できる
という効果がある。
According to the invention of claim 2, in addition to the effect of claim 1, there is an effect that the context saving processing can be realized at high speed.

【0115】請求項3の発明によれば、請求項1または
請求項2の効果に加えて、タスク切り換え要求が発生し
た後に、次に実行すべきタスクを決定できるという効果
がある。これにより、リアルタイムOS等でタスク処理
の順序を制御する応用においても柔軟に対応できる。
According to the third aspect of the invention, in addition to the effects of the first or second aspect, after a task switching request is generated, the next task to be executed can be determined. This makes it possible to flexibly cope with an application in which the order of task processing is controlled by a real-time OS or the like.

【0116】請求項4の発明によれば、請求項1の効果
に加えて、コンテキストの退避処理と切り換えた後のタ
スクの実行との並行処理の時間を短縮する効果がある。
これにより、並行処理中に命令によりコンテキスト退避
メモリをアクセスするような場合の、タスクの待ち時間
が短縮できる。
According to the fourth aspect of the present invention, in addition to the effect of the first aspect, there is an effect that the time of the parallel processing of the context saving processing and the execution of the task after switching is shortened.
As a result, the task waiting time in the case where the context save memory is accessed by the instruction during the parallel processing can be reduced.

【0117】請求項5の発明によれば、請求項1の効果
に加えて、コンテキストを退避するメモリのアドレス計
算時間を短縮するという効果がある。
According to the invention of claim 5, in addition to the effect of claim 1, there is an effect that the address calculation time of the memory for saving the context is shortened.

【0118】請求項6の発明によれば、請求項1の効果
に加えて、コンテキストの退避処理する時間を短縮する
という効果がある。
According to the invention of claim 6, in addition to the effect of claim 1, there is an effect that the time for the context saving processing is shortened.

【0119】請求項7の発明によれば、請求項6の効果
に加えて、コンテキストの退避処理の量を減少するとい
う効果がある。
According to the invention of claim 7, in addition to the effect of claim 6, there is an effect that the amount of context saving processing is reduced.

【0120】請求項8の発明によれば、タスク切り換え
の機能をCPUに容易に追加して、機能拡張できるとい
う効果がある。
According to the invention of claim 8, there is an effect that the function of task switching can be easily added to the CPU and the function can be extended.

【0121】請求項9の発明によれば、請求項8の効果
に加えて、回路の配置をコンパクトにでき、チップの面
積を小さくするという効果がある。
According to the ninth aspect of the present invention, in addition to the effects of the eighth aspect, the circuit arrangement can be made compact, and the chip area can be reduced.

【0122】請求項10の発明によれば、タスク切り換
えの順序をプログラムで柔軟に変更できるという効果が
ある。
According to the tenth aspect, there is an effect that the order of task switching can be flexibly changed by a program.

【0123】請求項11の発明によれば、請求項10の
効果に加えて、任意のタスクの起動をプログラムで柔軟
に指定できるという効果がある。
According to the eleventh aspect of the present invention, in addition to the effect of the tenth aspect, there is an effect that activation of an arbitrary task can be flexibly designated by a program.

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

【図1】本発明の実施例におけるマイクロコンピュータ
の主要な概略構成を示すブロック図
FIG. 1 is a block diagram showing a main schematic configuration of a microcomputer according to an embodiment of the present invention.

【図2】同実施例における転送部5の詳細な構成を示す
ブロック図
FIG. 2 is a block diagram showing a detailed configuration of a transfer unit 5 in the embodiment.

【図3】同実施例におけるマイクロコンピュータのより
詳細な構成を示すブロック図
FIG. 3 is a block diagram showing a more detailed configuration of the microcomputer in the embodiment.

【図4】同実施例における転送制御部51のより詳細な
構成と、コンテキスト退避メモリ3のより詳細なデータ
構成を示すブロック図
FIG. 4 is a block diagram showing a more detailed configuration of a transfer control unit 51 and a more detailed data configuration of a context saving memory 3 in the embodiment.

【図5】同実施例におけるタスク切り換え時の処理のC
PU2および転送部5の動作を示すフローチャート
FIG. 5 is a diagram illustrating processing C at the time of task switching in the embodiment.
Flowchart showing operations of PU 2 and transfer unit 5

【図6】同実施例におけるタスク切り換え時の処理のC
PU2および転送部5の動作を示すタイミングチャート
FIG. 6 is a diagram illustrating processing C at the time of task switching in the embodiment.
Timing chart showing operation of PU 2 and transfer unit 5

【図7】同実施例におけるタスク切り換え時の処理のC
PU2および転送部5の動作を示すタイミングチャート
FIG. 7 is a diagram illustrating processing C at the time of task switching in the embodiment.
Timing chart showing operation of PU 2 and transfer unit 5

【図8】同実施例におけるタスク切り換え時の処理のC
PU2および転送部5の動作を示すタイミングチャート
FIG. 8 is a diagram illustrating processing C at the time of task switching in the embodiment.
Timing chart showing operation of PU 2 and transfer unit 5

【図9】同実施例における転送部5のシーケンサ55に
よる各部の動作を示した図
FIG. 9 is a diagram showing an operation of each unit by a sequencer 55 of the transfer unit 5 in the embodiment.

【図10】同実施例における各タスクのプログラムカウ
ンタを退避するRAM402の特定領域の構成を示した
FIG. 10 is a diagram showing a configuration of a specific area of a RAM 402 for saving a program counter of each task in the embodiment.

【図11】同実施例におけるタスク番号制御部62が、
次タスク番号レジスタNEXTTSKの値を決定するた
めの動作を示した図
FIG. 11 shows a task number control unit 62 according to the embodiment.
The figure which showed the operation | movement for determining the value of the next task number register NEXTTSK.

【図12】本発明の第2の実施例におけるマイクロコン
ピュータの転送部とCPUとの接続を説明する図
FIG. 12 illustrates a connection between a transfer unit and a CPU of a microcomputer according to a second embodiment of the present invention.

【図13】同実施例における回路配置を説明する図FIG. 13 is a view for explaining a circuit arrangement in the embodiment.

【図14】第1の従来技術におけるマルチタスク処理機
能を有するマイクロコンピュータの説明図
FIG. 14 is an explanatory diagram of a microcomputer having a multitask processing function in the first related art.

【図15】第2の従来技術におけるマルチタスク処理機
能を有するマイクロコンピュータの説明図
FIG. 15 is an explanatory diagram of a microcomputer having a multitask processing function in the second related art.

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

1 レジスタファイル 2 CPU 3 コンテキスト退避メモリ 4 メモリ 5 転送部 51 転送制御部 52 タスクタイマ 53 バススイッチ 54 RAMアドレス生成部 55 シーケンサ 56 タスク許可フラグ 57 次タスク番号レジスタ 58 コンテキスト退避メモリアドレスレジスタ 59 タスク許可フラグ制御部 60 現タスク番号レジスタ 61 前タスク番号レジスタ 62 タスク番号制御部 63 レジスタセットA使用フラグ 64 メモリ制御部 65 コンテキスト退避メモリ書き込み制御部 66 コンテキスト退避メモリ読み出し制御部 67 レジスタ書き込み制御部 68 レジスタ読み出し制御部 1 register file 2 CPU 3 context save memory 4 memory 5 transfer unit 51 transfer control unit 52 task timer 53 bus switch 54 RAM address generation unit 55 sequencer 56 task enable flag 57 next task number register 58 context save memory address register 59 task enable flag Control unit 60 Current task number register 61 Previous task number register 62 Task number control unit 63 Register set A use flag 64 Memory control unit 65 Context save memory write control unit 66 Context save memory read control unit 67 Register write control unit 68 Register read control Department

Claims (11)

【特許請求の範囲】[Claims] 【請求項1】複数のタスクを順に切り換えながら実行す
るマイクロコンピュータであって、 同一のレジスタ構成で、タスクの実行に1つが使用され
る少なくとも2つ以上のレジスタセットと、 実行中でないタスクのコンテキストデータを保持する第
1のメモリと、 CPUがデータ処理に使用する第2のメモリと、 前記第1のメモリおよび前記第2のメモリから次に実行
するタスクのコンテキストデータをレジスタセットに復
帰した時点で、レジスタセットを切り換えるレジスタ切
り換え手段と、 前記レジスタセットと前記第1のメモリおよび前記第2
のメモリとに接続され、タスク切り換え時にタスクのコ
ンテキストデータの一部を前記第2のメモリに転送し、
切り換えられる前に使用していたレジスタセットの内容
を新規タスクの実行中に前記第1のメモリに退避する転
送手段とを備えることを特徴とするマイクロコンピュー
タ。
1. A microcomputer for executing a plurality of tasks while sequentially switching the tasks, wherein at least two or more register sets having the same register configuration, one of which is used for executing a task, and a context of a task not being executed. A first memory for holding data, a second memory used by the CPU for data processing, and a point in time when context data of a task to be executed next is returned from the first memory and the second memory to a register set Register switching means for switching the register set; the register set, the first memory, and the second
And transfers a part of the context data of the task to the second memory when the task is switched,
Transfer means for saving the contents of a register set used before switching to the first memory during execution of a new task.
【請求項2】前記転送手段は、CPUからの起動要求に
より動作を開始するシーケンサと、 タスクが使用していたレジスタセットのデータを読み出
す読み出し手段と、 レジスタ読み出し手段により読み出したデータを前記第
1のメモリに書き込む書き込み手段と、 次に実行するタスクのコンテキストデータを前記第1の
メモリから読み出すメモリ読み出し手段と、 メモリ読み出し手段により読み出したデータを次に実行
するタスクが使用するレジスタセットに書き込むレジス
タ書き込み手段と、 前記シーケンサに接続され、前記メモリ書き込み手段ま
たは前記メモリ読み出し手段がアクセスするアドレスを
指定する第1のアドレスレジスタと、 前記シーケンサに接続され、前記第2のメモリのアドレ
スを指定する第2のアドレスレジスタと、 前記シーケンサに接続され、タスクが使用中のレジスタ
セットを指定するレジスタセット番号指定手段とを備え
ることを特徴とする請求項1記載のマイクロコンピュー
タ。
2. The transfer means includes: a sequencer for starting operation in response to a start request from a CPU; reading means for reading data of a register set used by a task; Writing means for writing to the memory of the following; memory reading means for reading context data of a task to be executed next from the first memory; Writing means; a first address register connected to the sequencer for specifying an address to be accessed by the memory writing means or the memory reading means; and a first address register connected to the sequencer for specifying an address of the second memory. 2 address registers , Which is connected to the sequencer, the microcomputer according to claim 1, characterized in that it comprises a register set number designating means for designating the task register set in use.
【請求項3】前記転送手段は、 現在実行中のタスクの番号を指定する現タスク番号レジ
スタと、 次に実行するタスクの番号を指定する次タスク番号レジ
スタと、 前回実行したタスクの番号を指定する前タスク番号レジ
スタと、 前記シーケンサのステートに基づいて、前記現タスク番
号レジスタの内容を前記前タスク番号レジスタに転送
し、前記次タスク番号レジスタの内容を前記現タスク番
号レジスタに転送するタスク番号制御手段とを備えるこ
とを特徴とする請求項2記載のマイクロコンピュータ。
3. The transfer means includes: a current task number register for specifying a number of a task currently being executed; a next task number register for specifying a number of a task to be executed next; and a number of a previously executed task. A task number for transferring the contents of the current task number register to the previous task number register and transferring the contents of the next task number register to the current task number register based on the state of the sequencer. 3. The microcomputer according to claim 2, further comprising control means.
【請求項4】前記転送手段は、 前記レジスタセットと前記第1のメモリとに接続され、
かつデータバスを介して前記第2のメモリとに接続され
る内部バスを備え、CPUが前記第2のメモリを使用中
にレジスタセットの読み出しと前記第1のメモリへの書
き込みを並行処理することを特徴とする請求項1記載の
マイクロコンピュータ。
4. The transfer means is connected to the register set and the first memory,
And an internal bus connected to the second memory via a data bus, wherein a CPU concurrently processes reading of a register set and writing to the first memory while the CPU is using the second memory. The microcomputer according to claim 1, wherein:
【請求項5】前記転送手段は、コンテキストの一部を前
記第2のメモリのあらかじめ割り当てられた特定番地に
格納することを特徴とする請求項1記載のマイクロコン
ピュータ。
5. The microcomputer according to claim 1, wherein said transfer means stores a part of the context at a pre-assigned specific address of said second memory.
【請求項6】前記転送手段は、コンテキストの一部を前
記第2のメモリに割り当てられたスタック領域に格納す
ることを特徴とする請求項1記載のマイクロコンピュー
タ。
6. The microcomputer according to claim 1, wherein said transfer means stores a part of the context in a stack area allocated to said second memory.
【請求項7】前記レジスタセットは、CPUが使用する
スタックの最終位置を示すスタックポインタを備え、前
記スタックポインタは、コンテキストを前記第2のメモ
リのスタック領域に格納後、スタックの最終位置とは異
なるアドレスを保持することを特徴とする請求項6記載
のマイクロコンピュータ。
7. The register set includes a stack pointer indicating a last position of a stack used by a CPU. The stack pointer stores a context in a stack area of the second memory, 7. The microcomputer according to claim 6, wherein different microcomputers hold different addresses.
【請求項8】複数のタスクを順に切り換えながら実行す
るマイクロコンピュータであって、 同一のレジスタ構成で、タスクの実行に1つが使用され
る少なくとも2つ以上のレジスタセットと、 実行中でないタスクのコンテキストデータを保持する第
1のメモリと、 CPUがデータ処理に使用する第2のメモリと、 前記第1のメモリおよび前記第2のメモリから次に実行
するタスクのコンテキストデータをレジスタセットに復
帰した時点で、レジスタセットを切り換えるレジスタ切
り換え手段と、 前記レジスタセットと前記第1のメモリおよび前記第2
のメモリとに接続され、タスク切り換え時にタスクのコ
ンテキストデータの一部を前記第2のメモリに転送し、
切り換えられる前に使用していたレジスタセットの内容
を新規タスクの実行中に前記第1のメモリに退避する転
送手段と、 命令を処理するマイクロ制御手段と、 前記マイクロ制御手段が出力する制御信号と内部のバス
とを出力するCPUと、 CPU内部にあって、前記マイクロ制御手段によりレジ
スタセットを内部バスに読み出すレジスタ読み出し手段
と、 前記CPUの制御信号と内部バスとに接続され、前記C
PUと同一のレジスタセットを備える拡張手段と、 前記拡張手段が前記CPUに接続されていることを通知
し、前記読み出し手段の動作を停止させる拡張指定手段
とを備えたことを特徴とするマイクロコンピュータ。
8. A microcomputer for executing a plurality of tasks while sequentially switching the tasks, wherein at least two or more register sets having the same register configuration, one of which is used for execution of a task, and a context of a task not being executed. A first memory for holding data, a second memory used by the CPU for data processing, and a point in time when context data of a task to be executed next is returned from the first memory and the second memory to a register set Register switching means for switching the register set; the register set, the first memory, and the second
And transfers a part of the context data of the task to the second memory when the task is switched,
Transfer means for saving the contents of a register set used before being switched to the first memory during execution of a new task; microcontroller processing instructions; control signals output by the microcontroller; A CPU for outputting an internal bus; a register reading means inside the CPU for reading a register set to the internal bus by the microcontroller; a CPU connected to a control signal of the CPU and an internal bus;
A microcomputer comprising: extension means having the same register set as a PU; and extension designation means for notifying that the extension means is connected to the CPU and stopping the operation of the reading means. .
【請求項9】前記CPUはデータを処理するデータパス
部と前記データパスを制御する制御部とからなり、前記
制御部は前記データパスを制御するデータパス制御信号
と、前記拡張部を制御する拡張部制御信号を出力し、デ
ータパス制御信号はデータパス部のデータ処理の流れと
は垂直方向に配置されてデータパス部および前記拡張部
に入力され、 拡張部制御信号は、データパス部のデータ処理の流れと
水平方向に配置されて制御部から出力された後に、前記
拡張部に入力されることを特徴とする請求項8記載のマ
イクロコンピュータ。
9. The CPU comprises a data path unit for processing data and a control unit for controlling the data path, wherein the control unit controls a data path control signal for controlling the data path and the extension unit. An extension unit control signal is output, and the data path control signal is arranged in a direction perpendicular to the data processing flow of the data path unit and input to the data path unit and the extension unit. 9. The microcomputer according to claim 8, wherein the microcomputer is arranged in a horizontal direction with the flow of data processing, outputted from the control unit, and then inputted to the extension unit.
【請求項10】複数のタスクを順に切り換えながら実行
するマイクロコンピュータであって、 n個のタスクの起動を許可するか禁止するかを示すnビ
ットの第1のフラグを備え、前記第1のフラグが許可さ
れたタスクのみをタスク番号の昇順または降順に順次実
行することを特徴とするマイクロコンピュータ。
10. A microcomputer for executing a plurality of tasks while sequentially switching the tasks, comprising: an n-bit first flag indicating whether activation of the n tasks is permitted or prohibited; A microcomputer that sequentially executes only the tasks for which task numbers are permitted in ascending or descending order of task numbers.
【請求項11】次に実行する予定のタスク番号を示すm
ビットであってかつ、mをべきとする2のべき乗値が前
記第1のフラグの値以下である第2のフラグと、 前記第2のフラグに所望のタスク番号を設定すること
で、前記第1のフラグの該当するビットをセットするタ
スク許可フラグ制御手段とを備え、 所望のタスクを直接起動することを特徴とする請求項1
0記載のマイクロコンピュータ。
11. m indicating a task number to be executed next
A second flag, which is a bit and a power of 2 that is a power of m is equal to or less than a value of the first flag; and setting a desired task number to the second flag, 2. A task permission flag control means for setting a corresponding bit of a flag of 1 to directly start a desired task.
0. The microcomputer according to 0.
JP00600797A 1997-01-17 1997-01-17 Microcomputer Expired - Fee Related JP3605978B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP00600797A JP3605978B2 (en) 1997-01-17 1997-01-17 Microcomputer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP00600797A JP3605978B2 (en) 1997-01-17 1997-01-17 Microcomputer

Publications (2)

Publication Number Publication Date
JPH10207717A true JPH10207717A (en) 1998-08-07
JP3605978B2 JP3605978B2 (en) 2004-12-22

Family

ID=11626679

Family Applications (1)

Application Number Title Priority Date Filing Date
JP00600797A Expired - Fee Related JP3605978B2 (en) 1997-01-17 1997-01-17 Microcomputer

Country Status (1)

Country Link
JP (1) JP3605978B2 (en)

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2000023891A1 (en) * 1998-10-22 2000-04-27 Telefonaktiebolaget Lm Ericsson (Publ) A processor
EP1192533A1 (en) * 1999-01-27 2002-04-03 Clearwater Networks, Inc. Register transfer unit for electronic processor
US7020879B1 (en) 1998-12-16 2006-03-28 Mips Technologies, Inc. Interrupt and exception handling for multi-streaming digital processors
US7035997B1 (en) 1998-12-16 2006-04-25 Mips Technologies, Inc. Methods and apparatus for improving fetching and dispatch of instructions in multithreaded processors
US7237093B1 (en) 1998-12-16 2007-06-26 Mips Technologies, Inc. Instruction fetching system in a multithreaded processor utilizing cache miss predictions to fetch instructions from multiple hardware streams
US7257814B1 (en) 1998-12-16 2007-08-14 Mips Technologies, Inc. Method and apparatus for implementing atomicity of memory operations in dynamic multi-streaming processors
US7386707B2 (en) 2002-01-09 2008-06-10 Matsushita Electric Industrial Co., Ltd. Processor and program execution method capable of efficient program execution
US7529907B2 (en) 1998-12-16 2009-05-05 Mips Technologies, Inc. Method and apparatus for improved computer load and store operations
JP2009104611A (en) * 2002-01-09 2009-05-14 Panasonic Corp Processor
US7707391B2 (en) 1998-12-16 2010-04-27 Mips Technologies, Inc. Methods and apparatus for improving fetching and dispatch of instructions in multithreaded processors
US7735087B2 (en) 2003-03-13 2010-06-08 Panasonic Corporation Task switching apparatus, method and program
US7765546B2 (en) 1998-12-16 2010-07-27 Mips Technologies, Inc. Interstream control and communications for multi-streaming digital processors
US8327122B2 (en) 2006-03-02 2012-12-04 Samsung Electronics Co., Ltd. Method and system for providing context switch using multiple register file
JP2013164791A (en) * 2012-02-13 2013-08-22 Denso Corp Data processor
US9588817B2 (en) 2011-01-21 2017-03-07 Fujitsu Limited Scheduling method and scheduling system for assigning application to processor

Cited By (27)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2000023891A1 (en) * 1998-10-22 2000-04-27 Telefonaktiebolaget Lm Ericsson (Publ) A processor
US7707391B2 (en) 1998-12-16 2010-04-27 Mips Technologies, Inc. Methods and apparatus for improving fetching and dispatch of instructions in multithreaded processors
US7020879B1 (en) 1998-12-16 2006-03-28 Mips Technologies, Inc. Interrupt and exception handling for multi-streaming digital processors
US7765546B2 (en) 1998-12-16 2010-07-27 Mips Technologies, Inc. Interstream control and communications for multi-streaming digital processors
US7900207B2 (en) 1998-12-16 2011-03-01 Mips Technologies, Inc. Interrupt and exception handling for multi-streaming digital processors
US7237093B1 (en) 1998-12-16 2007-06-26 Mips Technologies, Inc. Instruction fetching system in a multithreaded processor utilizing cache miss predictions to fetch instructions from multiple hardware streams
US7257814B1 (en) 1998-12-16 2007-08-14 Mips Technologies, Inc. Method and apparatus for implementing atomicity of memory operations in dynamic multi-streaming processors
US7926062B2 (en) 1998-12-16 2011-04-12 Mips Technologies, Inc. Interrupt and exception handling for multi-streaming digital processors
US7467385B2 (en) 1998-12-16 2008-12-16 Mips Technologies, Inc. Interrupt and exception handling for multi-streaming digital processors
US7529907B2 (en) 1998-12-16 2009-05-05 Mips Technologies, Inc. Method and apparatus for improved computer load and store operations
US7035997B1 (en) 1998-12-16 2006-04-25 Mips Technologies, Inc. Methods and apparatus for improving fetching and dispatch of instructions in multithreaded processors
US7650605B2 (en) 1998-12-16 2010-01-19 Mips Technologies, Inc. Method and apparatus for implementing atomicity of memory operations in dynamic multi-streaming processors
EP1192533A4 (en) * 1999-01-27 2005-06-08 Mips Tech Inc Register transfer unit for electronic processor
EP1192533A1 (en) * 1999-01-27 2002-04-03 Clearwater Networks, Inc. Register transfer unit for electronic processor
US8719827B2 (en) 2002-01-09 2014-05-06 Panasonic Corporation Processor and program execution method capable of efficient program execution
US9823946B2 (en) 2002-01-09 2017-11-21 Socionext Inc. Processor and program execution method capable of efficient program execution
US7930520B2 (en) 2002-01-09 2011-04-19 Panasonic Corporation Processor and program execution method capable of efficient program execution
US7921281B2 (en) 2002-01-09 2011-04-05 Panasonic Corporation Processor and program execution method capable of efficient program execution
US7386707B2 (en) 2002-01-09 2008-06-10 Matsushita Electric Industrial Co., Ltd. Processor and program execution method capable of efficient program execution
JP2009104611A (en) * 2002-01-09 2009-05-14 Panasonic Corp Processor
US8006076B2 (en) 2002-01-09 2011-08-23 Panasonic Corporation Processor and program execution method capable of efficient program execution
US7950016B2 (en) 2003-03-13 2011-05-24 Panasonic Corporation Apparatus for switching the task to be completed in a processor by switching to the task assigned time slot
US8276156B2 (en) 2003-03-13 2012-09-25 Panasonic Corporation Task switching based on assigned time slot
US7735087B2 (en) 2003-03-13 2010-06-08 Panasonic Corporation Task switching apparatus, method and program
US8327122B2 (en) 2006-03-02 2012-12-04 Samsung Electronics Co., Ltd. Method and system for providing context switch using multiple register file
US9588817B2 (en) 2011-01-21 2017-03-07 Fujitsu Limited Scheduling method and scheduling system for assigning application to processor
JP2013164791A (en) * 2012-02-13 2013-08-22 Denso Corp Data processor

Also Published As

Publication number Publication date
JP3605978B2 (en) 2004-12-22

Similar Documents

Publication Publication Date Title
US5696989A (en) Microcomputer equipped with DMA controller allowed to continue to perform data transfer operations even after completion of a current data transfer operation
US7590774B2 (en) Method and system for efficient context swapping
JPH10207717A (en) Microcomputer
JP3619939B2 (en) Central processing unit
JPH08305585A (en) Interruption controller
JPS62197830A (en) Data processing system
JP3619532B2 (en) Semiconductor integrated circuit device
JP2734468B2 (en) Processor
KR970003321B1 (en) System using microprocessor address lines coprocessor selection within a multi-coprocessor apparatus
JPH0991134A (en) Information processor
KR20010040919A (en) Microprocessor including multiple register files occupying the same logical space
JPH07120338B2 (en) Method for a data processor to coordinate the execution of instructions by a coprocessor and the data processor
JPH0916409A (en) Microcomputer
JPS63268033A (en) Data processing system
JP3562215B2 (en) Microcomputer and electronic equipment
JPS6290728A (en) Interruption processing method
US20050216708A1 (en) Processor for performing context switching, a method for performing context switching, a computer program for perform context switching
JPH06324861A (en) System and method for controlling cpu
JP2847729B2 (en) Information processing device
JP3077807B2 (en) Microcomputer system
JP2918570B2 (en) Central processing unit
JP2965045B2 (en) Semiconductor integrated circuit device
JP2696578B2 (en) Data processing device
JPH02214938A (en) Data processor
JP3345050B2 (en) Two-dimensional array type memory system

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20040316

A521 Written amendment

Effective date: 20040415

Free format text: JAPANESE INTERMEDIATE CODE: A523

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Effective date: 20040914

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20040927

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

Free format text: PAYMENT UNTIL: 20081015

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20091015

Year of fee payment: 5

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

Year of fee payment: 5

Free format text: PAYMENT UNTIL: 20091015

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

Year of fee payment: 6

Free format text: PAYMENT UNTIL: 20101015

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

Year of fee payment: 7

Free format text: PAYMENT UNTIL: 20111015

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

Year of fee payment: 8

Free format text: PAYMENT UNTIL: 20121015

LAPS Cancellation because of no payment of annual fees