JPH11134203A - Micro controller, data processing system and control method for task switch - Google Patents

Micro controller, data processing system and control method for task switch

Info

Publication number
JPH11134203A
JPH11134203A JP23805798A JP23805798A JPH11134203A JP H11134203 A JPH11134203 A JP H11134203A JP 23805798 A JP23805798 A JP 23805798A JP 23805798 A JP23805798 A JP 23805798A JP H11134203 A JPH11134203 A JP H11134203A
Authority
JP
Japan
Prior art keywords
task
state
microcontroller
tasks
execution
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
JP23805798A
Other languages
Japanese (ja)
Other versions
JP3007612B2 (en
Inventor
Hiroshi Imanishi
浩 今西
Toshiyuki Araki
敏之 荒木
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 JP23805798A priority Critical patent/JP3007612B2/en
Publication of JPH11134203A publication Critical patent/JPH11134203A/en
Application granted granted Critical
Publication of JP3007612B2 publication Critical patent/JP3007612B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Image Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

PROBLEM TO BE SOLVED: To realize high speed task switching in a micro controller for controlling plural hardware engines. SOLUTION: A processor 300, a task management table 310 and a scheduler 330 are incorporated in the micro controller. The processor 300 sequentially executes plural tasks for controlling the allocated hardware engines (cores). The task management table 310 stores task management information containing state information (ST information) showing the respective execution situations of the plural tasks, priority information (PRI information) showing the execution priority of the plural tasks and core ID information (CID information) showing to which cores the plural tasks are allocated. The scheduler 330 causes the processor 300 to switch the task based on task management information when a specified instruction is decoded or the execution of any core terminates.

Description

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

【0001】[0001]

【発明の属する技術分野】本発明は、マルチタスキング
機能を備えたマイクロコントローラと、該マイクロコン
トローラが複数のハードウェアエンジンを制御するよう
に構成されたデータ処理システムとに関するものであ
る。また、本発明はタスクスイッチの制御方法に関する
ものである。
[0001] 1. Field of the Invention [0002] The present invention relates to a microcontroller having a multitasking function and a data processing system in which the microcontroller controls a plurality of hardware engines. The present invention also relates to a method for controlling a task switch.

【0002】[0002]

【従来の技術】マルチタスキング機能を備えたマイクロ
コントローラが知られている。この種のマイクロコント
ローラに内蔵された単一のプロセッサは、複数のタスク
をシーケンシャルに実行する。そのため、タスクスイッ
チを要求するタイマ割り込みをタスクタイマが定期的に
発行する。このタイマ割り込みをプロセッサが受理する
たびに、オペレーティングシステム(OS)内の割り込
み処理ルーチンが起動され、該割り込み処理ルーチンが
タスクスケジューリングと資源の退避及び復帰とを行
う。
2. Description of the Related Art Microcontrollers having a multitasking function are known. A single processor built into this type of microcontroller performs multiple tasks sequentially. Therefore, the task timer periodically issues a timer interrupt requesting the task switch. Each time the processor receives this timer interrupt, an interrupt processing routine in the operating system (OS) is started, and the interrupt processing routine performs task scheduling and resource saving and restoration.

【0003】[0003]

【発明が解決しようとする課題】上記従来のマイクロコ
ントローラは、割り込み処理ルーチンでタスクスケジュ
ーリングを行っていたことから、タスクスイッチにおけ
るオーバーヘッドが大きく、マイクロコントローラの実
質的な稼働率が低下するという問題があった。これは、
特に画像データのエンコードのようなリアルタイム性を
重視するアプリケーションにおいて深刻な問題である。
In the above-mentioned conventional microcontroller, task scheduling is performed in an interrupt processing routine. Therefore, there is a problem that overhead in a task switch is large and a substantial operation rate of the microcontroller is reduced. there were. this is,
In particular, this is a serious problem in an application that attaches importance to real-time properties such as encoding of image data.

【0004】本発明の目的は、マイクロコントローラに
おける高速のタスクスイッチを実現することにある。
An object of the present invention is to realize a high-speed task switch in a microcontroller.

【0005】本発明の他の目的は、マイクロコントロー
ラが複数のハードウェアエンジンを制御するように構成
されたデータ処理システムにおいて、該マイクロコント
ローラにおける高速のタスクスイッチを実現することに
ある。
It is another object of the present invention to realize a high-speed task switch in a microcontroller in a data processing system in which the microcontroller controls a plurality of hardware engines.

【0006】本発明の更に他の目的は、高速のタスクス
イッチを実現するためのタスクスイッチの制御方法を提
供することにある。
Another object of the present invention is to provide a task switch control method for realizing a high-speed task switch.

【0007】[0007]

【課題を解決するための手段】上記目的を達成するた
め、本発明のマイクロコントローラは、割り込み処理ル
ーチンでタスクスイッチを制御するのではなくて、複数
のタスクがそれぞれ対応するハードウェアエンジンに割
り当てられた環境下で、その割り当てを表す情報に基づ
いてハードウェアスケジューラでタスクスイッチを制御
することとしたものである。複数のハードウェアエンジ
ンの中には時間的にクリティカルな処理を実行するもの
と、そうでないものとがある。本発明によれば、このよ
うな複数のハードウェアエンジンの間の関係が複数のタ
スクの各々の実行優先度に反映される結果、いずれのハ
ードウェアエンジンが時間的にクリティカルな処理を実
行するのかをタスクスイッチ時にあらためて判断するこ
となく、次に実行すべきタスクを短時間のうちに選択で
きる。つまり、タスクスイッチにおけるオーバーヘッド
が小さくなり、高速のタスクスイッチが実現される。
In order to achieve the above object, a microcontroller according to the present invention does not control a task switch in an interrupt processing routine, but a plurality of tasks are assigned to corresponding hardware engines. Under such an environment, a task switch is controlled by a hardware scheduler based on information indicating the assignment. Some hardware engines perform processing that is time-critical, while others do not. According to the present invention, as a result of such a relationship between the plurality of hardware engines being reflected in the execution priority of each of the plurality of tasks, which of the hardware engines executes the time-critical processing is determined. Can be selected in a short time without re-judgment at the time of task switching. That is, overhead in the task switch is reduced, and a high-speed task switch is realized.

【0008】また、本発明のマイクロコントローラで
は、タスクタイマから定期的に発行される割り込みに応
答してタスクスイッチを行う時分割方式では無駄時間が
生じることに鑑み、各ハードウェアエンジンの実行終了
というイベントの発生に直ちに応答してタスクスイッチ
を行うイベントドリブン方式を採用した。複数のタスク
の各々は、実行待ちを表す第1のステート(READY
ステート)と、実行中を表す第2のステート(ACTI
VEステート)と、割り当てられたハードウェアエンジ
ンの実行終了待ちを表す第3のステート(SLEEPス
テート)とを有する。ACTIVEステートは、現在、
タスクがマイクロコントローラを使用している状態であ
り、そのタスクに割り当てられたハードウェアエンジン
の制御を行う。READYステートは、タスクがマイク
ロコントローラを使用可能な状態ではあるが、そのタス
クは選ばれておらず、選ばれるのを待っている状態であ
る。SLEEPステートは、割り当てられたハードウェ
アエンジンの実行終了を待っている状態であり、マイク
ロコントローラを使用可能でない状態である。割り当て
られたハードウェアエンジンの起動を終えたタスクは、
特定の命令(task_sleep命令)に応じて、A
CTIVEステートからSLEEPステートへ遷移す
る。あるハードウェアエンジンが実行終了したとき、該
ハードウェアエンジンに割り当てられたタスクはSLE
EPステートからREADYステートへ遷移し、実行中
のタスクはACTIVEステートからREADYステー
トへ遷移する。そして、READYステートにあるタス
クのうちで最も高い実行優先度を有するタスクが次に実
行すべきタスクとして選択され、該選択されたタスクが
READYステートからACTIVEステートへ遷移す
る。
Further, in the microcontroller of the present invention, in consideration of the useless time generated in the time division method in which the task switch is performed in response to an interrupt periodically issued from the task timer, execution of each hardware engine is terminated. An event-driven system that switches tasks immediately in response to an event has been adopted. Each of the plurality of tasks has a first state (READY indicating waiting for execution).
State), and a second state (ACTI)
VE state) and a third state (SLEEP state) indicating the end of execution of the assigned hardware engine. The ACTIVE state is currently
The task is using the microcontroller and controls the hardware engine assigned to the task. The READY state is a state in which a task can use the microcontroller, but the task has not been selected and is waiting to be selected. The SLEEP state is a state where the execution of the assigned hardware engine is awaited, and the microcontroller is not usable. Tasks that have finished running their assigned hardware engines
According to a specific instruction (task_sleep instruction), A
Transition from the CTIVE state to the SLEEP state. When a hardware engine finishes executing, the task assigned to the hardware engine is SLE
The state transitions from the EP state to the READY state, and the task being executed transitions from the ACTIVE state to the READY state. Then, the task having the highest execution priority among the tasks in the READY state is selected as the task to be executed next, and the selected task transits from the READY state to the ACTIVE state.

【0009】複数のハードウェアエンジンの各々が互い
に独立した作業領域として使用する複数のレジスタファ
イルをマイクロコントローラの中に用意しておけば、タ
スクスイッチ時にはプログラムカウンタなどのプロセッ
サ資源のみを退避すればよく、タスクスイッチにおける
オーバーヘッドが更に小さくなる。複数のハードウェア
エンジンに共通の設定パラメータを記憶するためのレジ
スタファイルをマイクロコントローラの中に用意してお
いてもよい。
If a plurality of register files used by each of the plurality of hardware engines as independent work areas are prepared in the microcontroller, only the processor resources such as the program counter need be saved at the time of the task switch. In addition, overhead in task switching is further reduced. A register file for storing setting parameters common to a plurality of hardware engines may be prepared in the microcontroller.

【0010】[0010]

【発明の実施の形態】図1は、本発明に係るデータ処理
システムの1つであるMPEG(Moving Picture Exper
ts Group)画像エンコーダの構成例を示している。図1
のエンコーダは、単一のマイクロコントローラ101
と、マクロブロックパイプラインを構成する5個のハー
ドウェアエンジン(以下、コアという。)111〜11
5と、3個のバッファメモリ116〜118とで構成さ
れている。5個のコアは、動き検出器(Motion Detecto
r:MD)111、動き補償器(Motion Compensator:
MC)112、離散コサイン変換器(Discrete Cosine
Transformer:DCT)113、量子化器(Quantizer:
Q)114及び可変長符号化器(Valiable LengthCode
r:VLC)115であって、マルチタスキング機能を
備えたマイクロコントローラ101によりそれぞれ制御
される。121はエンコードされるべき画像データ、1
22はエンコード結果を表す符号化データである。マイ
クロコントローラ101は、5個のコア111〜115
の各々へ起動信号123を供給し、かつ5個のコア11
1〜115の各々から終了信号124を受け取る。ま
た、マイクロコントローラ101は、信号線131〜1
35を介して5個のコア111〜115と個別に交信し
たり、信号線136を介して5個のコア111〜115
に共通のパラメータを与えたりすることができるように
なっている。
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS FIG. 1 shows an MPEG (Moving Picture Exper) which is one of the data processing systems according to the present invention.
ts Group) shows an example of the configuration of an image encoder. FIG.
Encoder is a single microcontroller 101
And five hardware engines (hereinafter, referred to as cores) 111 to 11 constituting a macroblock pipeline.
5 and three buffer memories 116 to 118. The five cores are Motion Detector
r: MD) 111, Motion Compensator:
MC) 112, Discrete Cosine Transformer (Discrete Cosine)
Transformer: DCT 113, Quantizer:
Q) 114 and Variable Length Coder (Variable Length Code)
r: VLC) 115, each of which is controlled by a microcontroller 101 having a multitasking function. 121 is image data to be encoded, 1
Reference numeral 22 denotes encoded data representing an encoding result. The microcontroller 101 has five cores 111 to 115
Supply the activation signal 123 to each of the five cores 11
An end signal 124 is received from each of 1 to 115. Further, the microcontroller 101 includes signal lines 131 to 1
35, and individually communicate with the five cores 111 to 115 via the signal line 136.
To give common parameters.

【0011】図2は、マイクロコントローラ101の詳
細構成を示している。マイクロコントローラ101は、
マルチタスキング機能を実現するためのタスクコントロ
ーラ201と、上記5個のコア111〜115の各々が
互いに独立した作業領域として使用する5個のコアレジ
スタファイル211〜215と、上記5個のコア111
〜115のうちの少なくとも2個のコアに共通の設定パ
ラメータを記憶するための1個の共通レジスタファイル
216と、タスクコントローラ201が作業領域として
使用する1個の汎用レジスタファイル217と、乗算器
221と、シフタ222と、算術論理演算ユニット(Ar
ithmetic and Logic Unit:ALU)223と、データ
メモリ224とを備えている。241はAバス、242
はBバス、243はCバス、231はこれらのバスとタ
スクコントローラ201とを接続するための信号線であ
る。タスクコントローラ201は、上記起動信号123
を供給し、かつ上記終了信号124を受け取る。レジス
タファイル211〜216の各々は、Cバス243と上
記信号線131〜136のうちの対応する信号線との間
に介在し、かつその各々の2出力がAバス241及びB
バス242にそれぞれ接続されている。汎用レジスタフ
ァイル217及びデータメモリ224の各々の入力はC
バス243に、その各々の2出力はAバス241及びB
バス242にそれぞれ接続されている。乗算器221、
シフタ222及びALU223の各々の2入力はAバス
241及びBバス242に、その各々の出力はCバス2
43にそれぞれ接続されている。なお、5個のコアレジ
スタファイル211〜215及び共通レジスタファイル
216の配設を省略して、上記信号線131〜136を
Cバス243から直接に引き出すようにしてもよい。
FIG. 2 shows a detailed configuration of the microcontroller 101. The microcontroller 101
A task controller 201 for realizing a multi-tasking function, five core register files 211 to 215 used by each of the five cores 111 to 115 as independent working areas,
To 115, one common register file 216 for storing setting parameters common to at least two cores, one general-purpose register file 217 used as a work area by the task controller 201, and a multiplier 221. , A shifter 222 and an arithmetic and logic unit (Ar
It has an ithmetic and logic unit (ALU) 223 and a data memory 224. 241 is A bus, 242
Is a B bus, 243 is a C bus, 231 is a signal line for connecting these buses and the task controller 201. The task controller 201 sends the start signal 123
And receives the end signal 124. Each of the register files 211 to 216 is interposed between the C bus 243 and the corresponding one of the signal lines 131 to 136, and two outputs of each of the register files 211 to 216 are A buses 241 and B
Each is connected to a bus 242. Each input of the general-purpose register file 217 and the data memory 224 is C
Bus 243 has two outputs on each of A buses 241 and B
Each is connected to a bus 242. A multiplier 221,
The two inputs of each of the shifter 222 and the ALU 223 are connected to the A bus 241 and the B bus 242, and the respective outputs are connected to the C bus 2
43 respectively. Note that the arrangement of the five core register files 211 to 215 and the common register file 216 may be omitted, and the signal lines 131 to 136 may be directly drawn from the C bus 243.

【0012】図1のMPEG画像エンコーダによれば、
16×16画素からなるマクロブロックを単位として画
像データ処理が進められる。まず、入力された画像デー
タ121に対してMDコア111で動きベクトルの候補
が求められる。これらの動きベクトルを用いてMCコア
112で画像の差分データが求められ、最適な動きベク
トルが選択される。選択された動きベクトルに対する差
分データは、DCTコア113で離散コサイン変換さ
れ、Qコア114で量子化され、求めた動きベクトルな
どのサイド情報とともにVLCコア115で可変長符号
化された後、符号化データ122として出力される。
According to the MPEG image encoder of FIG.
Image data processing proceeds in units of macroblocks of 16 × 16 pixels. First, the MD core 111 obtains a motion vector candidate for the input image data 121. The difference data of the image is obtained by the MC core 112 using these motion vectors, and an optimal motion vector is selected. The differential data for the selected motion vector is subjected to discrete cosine transform by the DCT core 113, quantized by the Q core 114, and variable-length coded by the VLC core 115 together with the obtained side information such as the motion vector. It is output as data 122.

【0013】図2を参照して詳細に説明すると、タスク
コントローラ201は、まず信号線231、ALU22
3及びCバス243を介してMDコアレジスタファイル
211に動作パラメータを設定し、起動信号123によ
りMDコア111を起動する。MDコア111は、MD
コアレジスタファイル211から信号線131を介して
動作パラメータを読み込むとともに、画像データ121
を入力する。MDコア111の実行が終了すると、求め
られた動きベクトルの候補が信号線131を介してMD
コアレジスタファイル211に書き込まれ、MDコア1
11から終了信号124が出力される。タスクコントロ
ーラ201は、この終了信号124を受け取ると、MD
コアレジスタファイル211から動きベクトルの候補を
読み出し、これに基づき乗算器221、シフタ222、
ALU223及び汎用レジスタファイル217を用いて
MCコア112のための動作パラメータを計算する。こ
の動作パラメータはMCコアレジスタファイル212に
設定され、起動信号123によりMCコア112が起動
される。MCコア112は、MCコアレジスタファイル
212から信号線132を介して動作パラメータを読み
込んだ後、画像の差分データを求める。MCコア112
の実行が終了すると、差分データの総和が信号線132
を介してMCコアレジスタファイル212に、画像の差
分データがバッファメモリ116にそれぞれ書き込ま
れ、MCコア112から終了信号124が出力される。
タスクコントローラ201は、この終了信号124を受
け取ると、MCコアレジスタファイル212から差分デ
ータの総和を読み出し、これに基づき乗算器221、シ
フタ222、ALU223及び汎用レジスタファイル2
17を用いて上記候補の中から最適な動きベクトルを選
択する。求められた動きベクトルに対応する差分データ
のアドレスがDCTコアレジスタファイル213に設定
され、起動信号123によりDCTコア113が起動さ
れる。DCTコア113は、DCTコアレジスタファイ
ル213に設定されたアドレスに基づいてバッファメモ
リ116から差分データを読み出し、これを離散コサイ
ン変換する。DCTコア113の実行が終了すると、離
散コサイン変換の結果がバッファメモリ117に書き込
まれ、DCTコア113から終了信号124が出力され
る。以下、Qコア114で量子化処理がなされ、その結
果がバッファメモリ118に書き込まれ、VLCコア1
15で可変長符号化処理がなされ、その結果が符号化デ
ータ122として出力される。なお、上記5個のコア1
11〜115のうちのいくつかのコアは、1マクロブロ
ックを処理する間に、マイクロコントローラ101と起
動信号123及び終了信号124のやりとりを複数回行
う。共通レジスタファイル216は、MPEG1とMP
EG2との切り替えのための共通パラメータを5個のコ
ア111〜115へ予め供給したり、動き評価モードを
指定するための共通パラメータをMDコア111及びM
Cコア112へ予め供給したりする際に用いられる。
More specifically, referring to FIG. 2, the task controller 201 first includes the signal line 231 and the ALU 22
3 and the operation parameters are set in the MD core register file 211 via the C bus 243, and the MD core 111 is activated by the activation signal 123. MD core 111 is MD
The operation parameters are read from the core register file 211 via the signal line 131 and the image data 121 is read.
Enter When the execution of the MD core 111 ends, the obtained motion vector candidate is
Written to the core register file 211, the MD core 1
11 outputs an end signal 124. Upon receiving the end signal 124, the task controller 201
The motion vector candidates are read from the core register file 211, and a multiplier 221, a shifter 222,
The operation parameters for the MC core 112 are calculated using the ALU 223 and the general-purpose register file 217. These operation parameters are set in the MC core register file 212, and the MC core 112 is activated by the activation signal 123. After reading the operation parameters from the MC core register file 212 via the signal line 132, the MC core 112 obtains image difference data. MC core 112
Is completed, the sum of the differential data is
, The difference data of the image is written to the buffer memory 116 in the MC core register file 212, and the end signal 124 is output from the MC core 112.
Upon receiving the end signal 124, the task controller 201 reads out the sum of the difference data from the MC core register file 212, and based on the read sum, the multiplier 221, the shifter 222, the ALU 223, and the general-purpose register file 2
17, the optimal motion vector is selected from the candidates. The address of the difference data corresponding to the obtained motion vector is set in the DCT core register file 213, and the DCT core 113 is activated by the activation signal 123. The DCT core 113 reads the difference data from the buffer memory 116 based on the address set in the DCT core register file 213, and performs a discrete cosine transform. When the execution of the DCT core 113 ends, the result of the discrete cosine transform is written into the buffer memory 117, and the end signal 124 is output from the DCT core 113. Thereafter, the quantization processing is performed in the Q core 114, and the result is written in the buffer memory 118, and the VLC core 1
At 15, the variable-length encoding process is performed, and the result is output as encoded data 122. The above five cores 1
Some of the cores 11 to 115 exchange the start signal 123 and the end signal 124 with the microcontroller 101 a plurality of times while processing one macroblock. The common register file 216 includes MPEG1 and MP
Common parameters for switching to EG2 are supplied in advance to the five cores 111 to 115, and common parameters for specifying the motion evaluation mode are set to MD cores 111 and M.
It is used when supplying to the C core 112 in advance.

【0014】図3は、タスクコントローラ201の詳細
構成を示している。タスクコントローラ201は、プロ
セッサ300と、タスク管理テーブル310と、スケジ
ューラ330とで構成されている。プロセッサ300
は、最大8個のタスクをシーケンシャルに実行すること
ができるRISC(Reduced Instruction Set Compute
r)型のプロセッサであって、命令アドレスを生成する
ためのプログラムカウンタ(PC)301と、一連の命
令からなるプログラムを格納するための命令メモリ30
2と、命令をデコードするための命令デコーダ303と
を備えている。各コアへの起動信号123は、命令デコ
ーダ303から供給される。また、命令デコーダ303
は、命令実行のための資源である上記乗算器221、シ
フタ222、ALU223などに信号線231を介して
接続されている。タスク管理テーブル310は、タスク
管理情報を記憶するための回路ブロックであって、タス
ク0からタスク7までの8個のタスクのそれぞれに対応
した8個のタスク管理レジスタファイル320〜327
を備えている。ここに、タスク管理情報は、複数のタス
クの各々の実行状況を表すステート情報(ST情報)
と、該複数のタスクの各々の実行優先度を表すプライオ
リティ情報(PRI情報)と、該複数のタスクの各々が
5個のコア111〜115のうちのいずれのコアに割り
当てられているかを表すコアID情報(CID情報)と
を含む。更に、タスク管理テーブル310は、プロセッ
サ300の資源すなわちPC301の内容を退避するた
めのタスク毎の領域を有する。この退避領域には、AL
U223(図2参照)の演算結果に係るフラグなども退
避される。スケジューラ330は、タスク管理テーブル
310に記憶されたタスク管理情報に基づいてプロセッ
サ300にタスクスイッチをさせるための回路ブロック
であって、ステートコントローラ331と、終了コア判
定ユニット332と、プライオリティエンコーダ333
と、セレクタ334とを備えている。終了コア判定ユニ
ット332は、5個のコア111〜115のうちのいず
れかのコアから終了信号124を受け取ったとき、実行
終了したコアに割り当てられたタスクを判定するための
ユニットである。この判定はタスク管理テーブル310
を参照して行われ、判定結果を表すタスク番号362が
ステートコントローラ331に知らされる。プライオリ
ティエンコーダ333は、次に実行すべきタスクを選択
するための回路ブロックである。この選択はタスク管理
テーブル310を参照して行われ、選択結果を表すタス
ク番号361がステートコントローラ331及びセレク
タ334に知らされる。ステートコントローラ331
は、タスク管理テーブル310の中のST情報を更新す
るための回路ブロックである。セレクタ334は、プロ
セッサ300への資源復帰を司る。
FIG. 3 shows a detailed configuration of the task controller 201. The task controller 201 includes a processor 300, a task management table 310, and a scheduler 330. Processor 300
Is a reduced instruction set computer (RISC) that can execute up to eight tasks sequentially.
An r) type processor comprising a program counter (PC) 301 for generating an instruction address and an instruction memory 30 for storing a program consisting of a series of instructions.
2 and an instruction decoder 303 for decoding the instruction. The activation signal 123 to each core is supplied from the instruction decoder 303. Also, the instruction decoder 303
Are connected to the multiplier 221, the shifter 222, the ALU 223, and the like, which are resources for executing instructions, via a signal line 231. The task management table 310 is a circuit block for storing task management information, and includes eight task management register files 320 to 327 corresponding to eight tasks from task 0 to task 7, respectively.
It has. Here, the task management information is state information (ST information) representing the execution status of each of the plurality of tasks.
And priority information (PRI information) indicating the execution priority of each of the plurality of tasks, and a core indicating which of the five cores 111 to 115 each of the plurality of tasks is assigned to ID information (CID information). Further, the task management table 310 has an area for each task for saving the resources of the processor 300, that is, the contents of the PC 301. In this save area, AL
Flags and the like relating to the calculation result of U223 (see FIG. 2) are also saved. The scheduler 330 is a circuit block for causing the processor 300 to perform a task switch based on the task management information stored in the task management table 310, and includes a state controller 331, an end core determination unit 332, and a priority encoder 333.
And a selector 334. The termination core determination unit 332 is a unit that, when receiving the termination signal 124 from any one of the five cores 111 to 115, determines the task assigned to the core that has finished executing. This determination is based on the task management table 310
The task number 362 indicating the determination result is notified to the state controller 331. The priority encoder 333 is a circuit block for selecting a task to be executed next. This selection is performed with reference to the task management table 310, and the task number 361 indicating the selection result is notified to the state controller 331 and the selector 334. State controller 331
Is a circuit block for updating the ST information in the task management table 310. The selector 334 is responsible for returning resources to the processor 300.

【0015】図4は、図1のMPEG画像エンコーダに
おけるコアとタスクとの対応関係を示している。マイク
ロコントローラ101は、ここでは6個のタスク400
〜405を実行する。タスク400は、下位階層の5個
のタスク401〜405を制御し、かつエンコード処理
の全体を管理するためのメインタスク(タスク0)であ
る。このメインタスク400が割り当てられるべきコア
は存在しない。タスク401は、割り当てられたMDコ
ア111を制御するための動き検出タスク(タスク1)
である。タスク402は、割り当てられたMCコア11
2を制御するための動き補償タスク(タスク2)であ
る。タスク403は、割り当てられたDCTコア113
を制御するための離散コサイン変換タスク(タスク3)
である。タスク404は、割り当てられたQコア114
を制御するための量子化タスク(タスク4)である。タ
スク405は、割り当てられたVLCコア115を制御
するための可変長符号化タスク(タスク5)である。
FIG. 4 shows the correspondence between cores and tasks in the MPEG image encoder of FIG. The microcontroller 101 now has six tasks 400
405 is executed. The task 400 is a main task (task 0) for controlling the five tasks 401 to 405 in the lower hierarchy and managing the entire encoding process. There is no core to which this main task 400 should be assigned. The task 401 is a motion detection task (task 1) for controlling the assigned MD core 111.
It is. Task 402 is assigned to the assigned MC core 11
2 is a motion compensation task (task 2) for controlling the second task. Task 403 is performed by the assigned DCT core 113
Cosine transform task for controlling the task (task 3)
It is. Task 404 is assigned to the assigned Q core 114
Is a quantization task (task 4) for controlling. Task 405 is a variable-length encoding task (task 5) for controlling the assigned VLC core 115.

【0016】ここで、図4に示す少なくとも6個のタス
ク400〜405に係るタスク管理情報が図3中のタス
ク管理テーブル310に記憶されているものとする。図
3によれば、PRI情報はプライオリティ設定信号34
2に応じて、CID情報はコア設定信号343に応じて
それぞれ設定される。プライオリティ設定信号342は
命令デコーダ303がプライオリティ設定命令をデコー
ドした際に、コア設定信号343は命令デコーダ303
がコア設定命令をデコードした際にそれぞれ命令デコー
ダ303からタスク管理テーブル310へ供給される。
Here, it is assumed that task management information on at least six tasks 400 to 405 shown in FIG. 4 is stored in the task management table 310 in FIG. According to FIG. 3, the PRI information is a priority setting signal 34.
2, the CID information is set according to the core setting signal 343. The priority setting signal 342 is set when the instruction decoder 303 decodes the priority setting instruction, and the core setting signal 343 is set when the instruction decoder 303 decodes the priority setting instruction.
Are supplied from the instruction decoder 303 to the task management table 310 when decoding the core setting instruction.

【0017】図5は、各タスクのステート遷移を示す概
念図である。タスクは、停止を表すSTOPステート
と、実行待ちを表すREADYステートと、実行中を表
すACTIVEステートと、割り当てられたコアの実行
終了待ちを表すSLEEPステートとを有する。ただ
し、タスク0にはSLEEPステートがない。リセット
直後のタスクはSTOPステートにある。STOPステ
ートにあるタスクは、task_ready命令により
READYステートへ遷移させられる(遷移501)。
READYステートにあるタスクは、タスクスイッチを
要求するイベントの発生時にスケジューラ330により
選択されると、ACTIVEステートへ遷移させられる
(遷移511)。この際、その時点までACTIVEス
テートにあったタスクは、スケジューラ330によりR
EADYステートへ遷移させられる(遷移522)。A
CTIVEステートにあるタスクは、プロセッサ300
により実行され、task_sleep命令によりSL
EEPステートへ遷移させられたり(遷移521)、t
ask_stop命令によりSTOPステートへ遷移さ
せられたり(遷移523)することができる。SLEE
Pステートにあるタスクは、割り当てられたコアの実行
終了によりREADYステートへ遷移させられる(遷移
531)。
FIG. 5 is a conceptual diagram showing the state transition of each task. The task has a STOP state indicating stop, a READY state indicating waiting for execution, an ACTIVE state indicating executing, and a SLEEP state indicating waiting for completion of execution of the assigned core. However, task 0 has no SLEEP state. The task immediately after the reset is in the STOP state. The task in the STOP state is transited to the READY state by the task_ready instruction (transition 501).
When the task in the READY state is selected by the scheduler 330 when an event requiring a task switch occurs, the task is transitioned to the ACTIVE state (transition 511). At this time, the task that was in the ACTIVE state up to that point
A transition is made to the EADY state (transition 522). A
Tasks in the CTIVE state include the processor 300
Is executed by the task_sleep instruction.
The state is shifted to the EEP state (transition 521), and t
A transition to the STOP state can be made by the ask_stop instruction (transition 523). SLEE
The task in the P state is transited to the READY state when the execution of the assigned core is completed (transition 531).

【0018】ここで、図3のタスクコントローラ201
の詳細動作を説明する。命令デコーダ303がtask
_ready命令、task_sleep命令又はta
sk_stop命令をデコードすると、タスクスイッチ
が発生する。例えば、実行中のタスクにおいて該タスク
に割り当てられたコアのための動作パラメータの設定と
該コアの起動とを終えたタスクは、task_slee
p命令によりACTIVEステートからSLEEPステ
ートへ遷移させられる。また、5個のコア111〜11
5のうちのいずれかのコアが実行終了したときにもタス
クスイッチが発生する。タスクスイッチ時のタスクコン
トローラ201の動作シーケンスは、(1)スケジュー
ラの起動、(2)実行中のタスクの資源の退避、(3)
次に実行するタスクの選択、(4)退避されていた資源
の復帰である。
Here, the task controller 201 shown in FIG.
Will be described in detail. Instruction decoder 303 is task
_Ready instruction, task_sleep instruction or ta
When the sk_stop instruction is decoded, a task switch occurs. For example, in a task being executed, a task that has finished setting operation parameters for a core assigned to the task and activating the core is task_sleep.
A transition is made from the ACTIVE state to the SLEEP state by the p instruction. In addition, five cores 111 to 11
A task switch also occurs when any of the cores 5 has finished executing. The operation sequence of the task controller 201 at the time of task switching includes (1) activation of the scheduler, (2) saving of resources of the task being executed, and (3)
Selection of a task to be executed next, and (4) restoration of the saved resource.

【0019】まず、命令に基づくタスクスイッチのシー
ケンスを説明する。
First, a sequence of a task switch based on an instruction will be described.

【0020】(A−1)スケジューラの起動 task_ready命令、task_sleep命令
又はtask_stop命令がデコードされると、命令
デコーダ303からステート変更信号341が出力され
る。ステート変更信号341はステートコントローラ3
31に入力される。その結果、スケジューラ330が起
動される。
(A-1) Activation of Scheduler When a task_ready instruction, a task_sleep instruction, or a task_stop instruction is decoded, the instruction decoder 303 outputs a state change signal 341. The state change signal 341 is the state controller 3
31 is input. As a result, the scheduler 330 is activated.

【0021】(A−2)実行中のタスクの資源の退避 ステート変更信号341はタスク管理テーブル310に
も入力され、ST情報が更新される。同時にその時点ま
で実行されていたタスクのPC301の値が、信号線3
44を介してレジスタ管理テーブル310の中に退避さ
れる。
(A-2) Saving Resources of the Running Task The state change signal 341 is also input to the task management table 310, and the ST information is updated. At the same time, the value of the PC 301 of the task executed up to that
The data is saved in the register management table 310 via the register 44.

【0022】(A−3)次に実行するタスクの選択 プライオリティエンコーダ333は、タスク管理テーブ
ル310から信号線351を介してST情報を、信号線
352を介してPRI情報をそれぞれ受け取り、REA
DYステートにあるタスクのうちで最も高い実行優先度
を有するタスクを次に実行すべきタスクとして選択す
る。この選択の結果を表すタスク番号361は、ステー
トコントローラ331及びセレクタ334に知らされ
る。
(A-3) Selection of Next Task to be Executed The priority encoder 333 receives ST information from the task management table 310 via the signal line 351 and PRI information via the signal line 352, respectively.
The task having the highest execution priority among the tasks in the DY state is selected as the task to be executed next. The task number 361 indicating the result of this selection is notified to the state controller 331 and the selector 334.

【0023】(A−4)退避されていた資源の復帰 ステートコントローラ331は、タスク番号361に応
じたステート変更信号364をタスク管理テーブル31
0へ供給する。その結果、プライオリティエンコーダ3
33により選択されたタスクのST情報が、READY
ステートからACTIVEステートに更新される。セレ
クタ334は、タスク番号361で指定されたタスクの
PCをタスク管理テーブル310から信号線353を介
して読み出し、該PCを信号線363へ供給する。その
結果、次に実行すべきタスクのPCの値がプロセッサ3
00に設定され、該タスクの実行が開始する。
(A-4) Restoration of Saved Resources The state controller 331 sends a state change signal 364 corresponding to the task number 361 to the task management table 31.
0. As a result, the priority encoder 3
33, the ST information of the task selected by READY
The state is updated to the ACTIVE state. The selector 334 reads the PC of the task specified by the task number 361 from the task management table 310 via the signal line 353, and supplies the PC to the signal line 363. As a result, the value of the PC of the task to be executed next is
00 is set, and the execution of the task starts.

【0024】次に、コアの実行終了に基づくタスクスイ
ッチのシーケンスを説明する。
Next, a sequence of task switching based on the completion of execution of the core will be described.

【0025】(B−1)スケジューラの起動 いずれかのコアが実行終了すると、終了コア判定ユニッ
ト332に終了信号124が入力される。終了コア判定
ユニット332は、いずれのコアが実行終了したかを終
了信号124に基づいて判定する。更に、終了コア判定
ユニット332は、信号線354を介してタスク管理テ
ーブル310の中のCID情報を読み出し、実行終了し
たコアにいずれのタスクが割り当てられているかを判定
する。この判定の結果を表すタスク番号362は、ST
情報から当該タスクがSLEEPステートにあることが
確認された場合に、ステートコントローラ331に知ら
される。その結果、スケジューラ330が起動される。
ステートコントローラ331は、タスク番号362に応
じたステート変更信号364をタスク管理テーブル31
0へ供給する。その結果、実行終了したタスクのST情
報が、SLEEPステートからREADYステートに更
新される。なお、実行終了したコアに割り当てられたタ
スクが存在しない場合には、スケジューラ330は起動
されない。
(B-1) Startup of the Scheduler When any of the cores has been executed, the end signal 124 is input to the end core determination unit 332. The end core determination unit 332 determines which core has been executed based on the end signal 124. Further, the terminated core determination unit 332 reads the CID information in the task management table 310 via the signal line 354, and determines which task is assigned to the core whose execution has been completed. The task number 362 representing the result of this determination is ST
When it is confirmed from the information that the task is in the SLEEP state, the state controller 331 is notified. As a result, the scheduler 330 is activated.
The state controller 331 sends a state change signal 364 corresponding to the task number 362 to the task management table 31.
0. As a result, the ST information of the task whose execution has been completed is updated from the SLEEP state to the READY state. If there is no task assigned to the core whose execution has been completed, the scheduler 330 is not activated.

【0026】(B−2)実行中のタスクの資源の退避 更に、ステートコントローラ331は、その時点まで実
行されていたタスクのST情報がACTIVEステート
からREADYステートに更新されるように、ステート
変更信号364をタスク管理テーブル310へ供給す
る。同時にその時点まで実行されていたタスクのPC3
01の値がタスク管理テーブル310の中に退避され
る。
(B-2) Saving the Resources of the Running Task Further, the state controller 331 issues a state change signal so that the ST information of the task being executed up to that point is updated from the ACTIVE state to the READY state. 364 to the task management table 310. PC3 of the task that was being executed up to that point
The value of 01 is saved in the task management table 310.

【0027】(B−3)次に実行するタスクの選択 プライオリティエンコーダ333は、タスク管理テーブ
ル310からST情報及びPRI情報を受け取り、RE
ADYステートにあるタスクのうちで最も高い実行優先
度を有するタスクを次に実行すべきタスクとして選択す
る。この選択の結果を表すタスク番号361は、ステー
トコントローラ331及びセレクタ334に知らされ
る。
(B-3) Selection of Task to be Executed Next The priority encoder 333 receives ST information and PRI information from the task management table 310,
The task having the highest execution priority among the tasks in the ADY state is selected as the task to be executed next. The task number 361 indicating the result of this selection is notified to the state controller 331 and the selector 334.

【0028】(B−4)退避されていた資源の復帰 ステートコントローラ331は、タスク番号361に応
じたステート変更信号364をタスク管理テーブル31
0へ供給する。その結果、プライオリティエンコーダ3
33により選択されたタスクのST情報が、READY
ステートからACTIVEステートに更新される。セレ
クタ334は、タスク番号361で指定されたタスクの
PCをタスク管理テーブル310から読み出し、該PC
をプロセッサ300へ供給する。その結果、次に実行す
べきタスクのPCの値がプロセッサ300に設定され、
該タスクの実行が開始する。
(B-4) Restoring Saved Resources The state controller 331 sends a state change signal 364 corresponding to the task number 361 to the task management table 31.
0. As a result, the priority encoder 3
33, the ST information of the task selected by READY
The state is updated to the ACTIVE state. The selector 334 reads the PC of the task specified by the task number 361 from the task management table 310, and
Is supplied to the processor 300. As a result, the PC value of the task to be executed next is set in the processor 300,
Execution of the task starts.

【0029】図6は、図1中の5個のコア111〜11
5によるマクロブロックパイプライン処理を示してい
る。パイプラインピッチは、各コアにおける1マクロブ
ロックの処理に要する時間の最大値に設定される。した
がって、個々のパイプラインピッチ期間において他のコ
アより早く実行終了するコアが存在するという特性があ
る。ここに、アイドル時間が生じる。しかも、アイドル
時間の長さが画像データに依存して変化するという特性
がある。図1の例では、これらの特性に適合したMPE
G画像エンコーダが、イベントドリブン方式のタスクス
イッチの採用により実現される。なお、個々のパイプラ
インピッチ期間におけるコアの起動回数は、そのコアで
行う処理の内容やデータによって異なる。例えば、DC
Tコア113は1パイプラインピッチ期間に1回起動さ
れる。MCコア112は、1マクロブロックのデータを
輝度成分と色差成分とに分け、各成分毎に処理を細分化
して実行するため、1パイプラインピッチ期間にデータ
に応じて複数回起動される。
FIG. 6 shows the five cores 111 to 11 in FIG.
5 shows the macroblock pipeline processing by No. 5. The pipeline pitch is set to the maximum value of the time required for processing one macroblock in each core. Therefore, there is a characteristic that there is a core whose execution ends earlier than other cores in each pipeline pitch period. Here, idle time occurs. Moreover, there is a characteristic that the length of the idle time changes depending on the image data. In the example of FIG.
The G image encoder is realized by employing an event-driven task switch. Note that the number of activations of a core in each pipeline pitch period differs depending on the content of processing performed by the core and data. For example, DC
The T core 113 is activated once in one pipeline pitch period. The MC core 112 is activated a plurality of times according to the data in one pipeline pitch period in order to divide the data of one macroblock into a luminance component and a chrominance component, and to execute the processing in a finely divided manner for each component.

【0030】図7は、図6中の破線で特定された一部期
間における3個のタスクの各々のステート遷移の具体例
を示している。タスク0はエンコード処理の全体を管理
するためのメインタスクであり、タスク1はMDコア1
11に割り当てられたタスクであり、タスク2はMCコ
ア112に割り当てられたタスクである(図4参照)。
これら3個のタスクのうちタスク1の実行優先度が最も
高く、タスク2の実行優先度が2番目に高く、タスク0
の実行優先度が最も低いものとする。また、時刻t0に
おいて、タスク1がACTIVEステートに、タスク0
及びタスク2がそれぞれREADYステートにあるもの
とする。
FIG. 7 shows a specific example of the state transition of each of the three tasks in the partial period specified by the broken line in FIG. Task 0 is a main task for managing the entire encoding process, and task 1 is an MD core 1
The task assigned to the MC core 112 is a task assigned to the MC core 112 (see FIG. 4).
Of these three tasks, task 1 has the highest execution priority, task 2 has the second highest execution priority, and task 0 has the highest execution priority.
Has the lowest execution priority. At time t0, task 1 enters the ACTIVE state and task 0
And task 2 are in the READY state.

【0031】図7によれば、時刻t1〜t7の各々にお
いてタスクスイッチが発生する。図中のΔtは、1回の
タスクスイッチにおけるオーバーヘッドを表している。
順を追って説明すると、時刻t1より前に、タスク1は
MDコア111を起動する。そして、時刻t1にtas
k_sleep命令によりタスク1がACTIVEステ
ートからSLEEPステートへ遷移する。この時点では
タスク0及びタスク2がREADYステートにあり、タ
スク2の実行優先度がタスク0の実行優先度より高いの
で、タスク2がREADYステートからACTIVEス
テートへ遷移する。タスク2はMCコア112を起動す
る。そして、時刻t2にtask_sleep命令によ
りタスク2がACTIVEステートからSLEEPステ
ートへ遷移する。この時点ではタスク0のみがREAD
Yステートにあるので、タスク0がREADYステート
からACTIVEステートへ遷移する。そして、時刻t
3にMCコア112の実行終了によりタスク2がSLE
EPステートからREADYステートへ遷移する。これ
に伴い、その時点までACTIVEステートにあったタ
スク0がREADYステートへ遷移する。この時点では
タスク0及びタスク2がREADYステートにあり、タ
スク2の実行優先度がタスク0の実行優先度より高いの
で、タスク2がREADYステートからACTIVEス
テートへ遷移する。タスク2はMCコア112を再起動
する。そして、時刻t4にtask_sleep命令に
よりタスク2がACTIVEステートからSLEEPス
テートへ遷移する。この時点ではタスク0のみがREA
DYステートにあるので、タスク0がREADYステー
トからACTIVEステートへ遷移する。そして、時刻
t5にMDコア111の実行終了によりタスク1がSL
EEPステートからREADYステートへ遷移する。こ
れに伴い、その時点までACTIVEステートにあった
タスク0がREADYステートへ遷移する。この時点で
はタスク0及びタスク1がREADYステートにあり、
タスク1の実行優先度がタスク0の実行優先度より高い
ので、タスク1がREADYステートからACTIVE
ステートへ遷移する。そして、時刻t6にMCコア11
2の実行終了によりタスク2がSLEEPステートから
READYステートへ遷移する。これに伴い、その時点
までACTIVEステートにあったタスク1がREAD
Yステートへ遷移する。この時点ではタスク0、タスク
1及びタスク2がREADYステートにあり、タスク1
の実行優先度がタスク0及びタスク2の各々の実行優先
度より高いので、タスク1がREADYステートからA
CTIVEステートへ戻る。タスク1はMDコア111
を再起動する。そして、時刻t7にtask_slee
p命令によりタスク1がACTIVEステートからSL
EEPステートへ遷移する。この時点ではタスク0及び
タスク2がREADYステートにあり、タスク2の実行
優先度がタスク0の実行優先度より高いので、タスク2
がREADYステートからACTIVEステートへ遷移
する。
According to FIG. 7, a task switch occurs at each of the times t1 to t7. Δt in the figure represents the overhead in one task switch.
Explaining in order, the task 1 activates the MD core 111 before time t1. Then, at time t1, tas
Task 1 transitions from the ACTIVE state to the SLEEP state by the k_sleep instruction. At this point, task 0 and task 2 are in the READY state, and the execution priority of task 2 is higher than the execution priority of task 0. Therefore, task 2 transitions from the READY state to the ACTIVE state. Task 2 activates the MC core 112. Then, at time t2, the task 2 transitions from the ACTIVE state to the SLEEP state by the task_sleep instruction. At this point, only task 0 is READ
Since it is in the Y state, task 0 transitions from the READY state to the ACTIVE state. And time t
Task 3 is SLE due to completion of execution of MC core 112
Transition from the EP state to the READY state. Accordingly, task 0, which was in the ACTIVE state up to that point, transitions to the READY state. At this point, task 0 and task 2 are in the READY state, and the execution priority of task 2 is higher than the execution priority of task 0. Therefore, task 2 transitions from the READY state to the ACTIVE state. Task 2 restarts the MC core 112. Then, at time t4, the task 2 transitions from the ACTIVE state to the SLEEP state by the task_sleep instruction. At this point, only task 0 is REA
Since it is in the DY state, task 0 transitions from the READY state to the ACTIVE state. At the time t5, the task 1 is set to the SL
Transition from the EEP state to the READY state. Accordingly, task 0, which was in the ACTIVE state up to that point, transitions to the READY state. At this point, task 0 and task 1 are in the READY state,
Since the execution priority of task 1 is higher than the execution priority of task 0, task 1 is changed from the READY state to ACTIVE.
Transition to the state. Then, at time t6, the MC core 11
Task 2 transitions from the SLEEP state to the READY state upon completion of execution of step 2. As a result, task 1 which was in the ACTIVE state up to that point becomes READ
Transition to the Y state. At this point, task 0, task 1 and task 2 are in the READY state and task 1
Is higher than the execution priority of each of task 0 and task 2, so that task 1 changes from the READY state to A
Return to the CTIVE state. Task 1 is MD core 111
To restart. Then, at a time t7, task_sleep
Task 1 changes from ACTIVE state to SL by p instruction
Transition to the EEP state. At this point, task 0 and task 2 are in the READY state, and the execution priority of task 2 is higher than the execution priority of task 0.
Transitions from the READY state to the ACTIVE state.

【0032】従来の割り込み処理ルーチンを用いた時分
割方式のタスクスイッチを採用した場合の1回のタスク
スイッチにおけるオーバーヘッドは10数マシンサイク
ルにもなるが、本発明に係るイベントドリブン方式のタ
スクスイッチを採用した場合の図7中のオーバーヘッド
Δtは数マシンサイクルですむ。図6中の個々のマクロ
パイプラインピッチ期間において最大20数回のタスク
スイッチが発生することを考えると、両方式間のオーバ
ーヘッドの差は更に大きくなる。本発明によるオーバー
ヘッドの短縮は、パイプラインピッチの短縮をも可能に
する。つまり、画像データの高速エンコードが達成可能
になるのである。
Although the overhead of one task switch in the case of employing the time-division type task switch using the conventional interrupt processing routine is as much as ten or more machine cycles, the event-driven type task switch according to the present invention is not used. In the case of adoption, the overhead Δt in FIG. 7 requires only several machine cycles. Considering that a maximum of 20 or more task switches occur in each macro pipeline pitch period in FIG. 6, the difference in overhead between the two methods is further increased. The reduction in overhead according to the present invention also allows for a reduction in pipeline pitch. That is, high-speed encoding of image data can be achieved.

【0033】以上のとおり、図1のMPEG画像エンコ
ーダでは高速のタスクスイッチが実現される。また、時
間的にクリティカルな処理を実行するタスクに高い実行
優先度を設定しておくことで、正常な画像エンコード処
理を保証できる。しかも、いずれかのコアが実行終了し
たとき、該実行終了したコアに割り当てられたタスクの
ステートと、その時点まで実行中であったタスクのステ
ートとをいずれもREADYステートに変更したうえ
で、READYステートにある全てのタスクのうちで最
も高い実行優先度を有するタスクを次に実行すべきタス
クとして選択することとしたので、プライオリティエン
コーダ333の内部構成が簡略化される。更に、各タス
ク毎にプログラムを独立して記述することができるの
で、プログラミングが効率化され、デバッグにも有利で
ある。
As described above, a high-speed task switch is realized in the MPEG image encoder of FIG. In addition, by setting a high execution priority to a task that executes a time-critical process, a normal image encoding process can be guaranteed. Moreover, when the execution of one of the cores is completed, the state of the task assigned to the core whose execution has been completed and the state of the task being executed up to that point are both changed to the READY state. Since the task having the highest execution priority among all the tasks in the state is selected as the task to be executed next, the internal configuration of the priority encoder 333 is simplified. Furthermore, since a program can be described independently for each task, programming is made more efficient, which is advantageous for debugging.

【0034】なお、本発明は画像デコーダなどの他のデ
ータ処理システムにも適用可能である。上記の例では全
てのハードウェアエンジン(コア)にタスクを1個ずつ
割り当てたが、タスクが割り当てられないコアがあって
もよいし、複数個のタスクを1個のコアに割り当てても
よい。1個のタスクが複数個のコアに同時に割り当てら
れることはない。
The present invention can be applied to other data processing systems such as an image decoder. In the above example, one task is assigned to all hardware engines (cores). However, there may be a core to which no task is assigned, or a plurality of tasks may be assigned to one core. One task is not assigned to a plurality of cores at the same time.

【0035】[0035]

【発明の効果】以上説明してきたとおり、本発明によれ
ば、複数のタスクがそれぞれ対応するハードウェアエン
ジン(コア)に割り当てられた環境下で、その割り当て
を表す情報に基づいてハードウェアスケジューラでタス
クスイッチを制御することとしたので、高速のタスクス
イッチを実現することができる。
As described above, according to the present invention, in an environment in which a plurality of tasks are respectively assigned to corresponding hardware engines (cores), a hardware scheduler is used based on information representing the assignment. Since the task switch is controlled, a high-speed task switch can be realized.

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

【図1】本発明に係るMPEG画像エンコーダの構成例
を示すブロック図である。
FIG. 1 is a block diagram illustrating a configuration example of an MPEG image encoder according to the present invention.

【図2】図1中のマイクロコントローラの詳細構成を示
すブロック図である。
FIG. 2 is a block diagram showing a detailed configuration of a microcontroller in FIG.

【図3】図2中のタスクコントローラの詳細構成を示す
ブロック図である。
FIG. 3 is a block diagram showing a detailed configuration of a task controller in FIG. 2;

【図4】図1のエンコーダにおけるコアとタスクとの対
応関係を示す概念図である。
FIG. 4 is a conceptual diagram showing a correspondence between cores and tasks in the encoder of FIG. 1;

【図5】図1のエンコーダにおけるタスクのステート遷
移を示す概念図である。
FIG. 5 is a conceptual diagram showing a state transition of a task in the encoder of FIG. 1;

【図6】図1中の5個のコアによるマクロブロックパイ
プライン処理を示すタイミング図である。
FIG. 6 is a timing chart showing macroblock pipeline processing by five cores in FIG. 1;

【図7】図6中の一部期間における3個のタスクの各々
のステート遷移の具体例を示すタイミング図である。
FIG. 7 is a timing chart showing a specific example of a state transition of each of three tasks in a partial period in FIG. 6;

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

101 マイクロコントローラ 111 動き検出器(MDコア) 112 動き補償器(MCコア) 113 離散コサイン変換器(DCTコア) 114 量子化器(Qコア) 115 可変長符号化器(VLCコア) 116〜118 バッファメモリ 201 タスクコントローラ 211〜215 コアレジスタファイル 216 共通レジスタファイル 300 プロセッサ 310 タスク管理テーブル 330 スケジューラ 331 ステートコントローラ 332 終了コア判定ユニット 333 プライオリティエンコーダ Reference Signs List 101 Microcontroller 111 Motion detector (MD core) 112 Motion compensator (MC core) 113 Discrete cosine transformer (DCT core) 114 Quantizer (Q core) 115 Variable length encoder (VLC core) 116 to 118 Buffer Memory 201 Task controller 211 to 215 Core register file 216 Common register file 300 Processor 310 Task management table 330 Scheduler 331 State controller 332 End core determination unit 333 Priority encoder

Claims (15)

【特許請求の範囲】[Claims] 【請求項1】 複数のタスクをシーケンシャルに実行す
るためのプロセッサと、 前記複数のタスクの各々の実行状況を表すステート情報
と、前記複数のタスクの各々の実行優先度を表すプライ
オリティ情報と、前記複数のタスクの各々がいずれのハ
ードウェアエンジンに割り当てられているかを表す割り
当て情報とを含むタスク管理情報を記憶するためのタス
ク管理テーブルと、 前記タスク管理情報に基づいて前記プロセッサにタスク
スイッチをさせるためのスケジューラとを備えたことを
特徴とするマイクロコントローラ。
A processor for sequentially executing a plurality of tasks; state information indicating an execution status of each of the plurality of tasks; priority information indicating an execution priority of each of the plurality of tasks; A task management table for storing task management information including assignment information indicating which hardware engine is assigned to each of the plurality of tasks; and causing the processor to perform a task switch based on the task management information. And a scheduler for the microcontroller.
【請求項2】 請求項1記載のマイクロコントローラに
おいて、 前記複数のタスクの各々は、実行待ちを表す第1のステ
ートと、実行中を表す第2のステートと、割り当てられ
たハードウェアエンジンの実行終了待ちを表す第3のス
テートとを有することを特徴とするマイクロコントロー
ラ。
2. The microcontroller according to claim 1, wherein each of the plurality of tasks has a first state indicating a waiting state, a second state indicating an executing state, and execution of an assigned hardware engine. A third state representing a wait for completion.
【請求項3】 請求項2記載のマイクロコントローラに
おいて、 前記プロセッサは、実行中のタスクにおいて該タスクに
割り当てられたハードウェアエンジンを起動した後に特
定の命令をデコードしたとき、該タスクのステートを前
記第2のステートから前記第3のステートへ変更するよ
うに前記ステート情報を更新する機能を有することを特
徴とするマイクロコントローラ。
3. The microcontroller according to claim 2, wherein the processor changes the state of the executing task when the processor decodes a specific instruction after activating a hardware engine assigned to the task. A microcontroller having a function of updating the state information so as to change from a second state to the third state.
【請求項4】 請求項2記載のマイクロコントローラに
おいて、 前記スケジューラは、 いずれかのハードウェアエンジンが実行終了したとき、
該ハードウェアエンジンに割り当てられたタスクを前記
タスク管理情報に基づいて判定するための判定ユニット
と、 前記判定ユニットにより起動されたとき、前記判定され
たタスクのステートを前記第3のステートから前記第1
のステートへ変更するように前記ステート情報を更新す
る機能を有するステートコントローラとを備えたことを
特徴とするマイクロコントローラ。
4. The microcontroller according to claim 2, wherein the scheduler is configured to execute when one of the hardware engines finishes executing.
A determination unit for determining a task assigned to the hardware engine based on the task management information; and, when activated by the determination unit, change a state of the determined task from the third state to the third state. 1
And a state controller having a function of updating the state information so as to change to the state of the microcontroller.
【請求項5】 請求項4記載のマイクロコントローラに
おいて、 前記ステートコントローラは、前記判定ユニットにより
起動されたとき、実行中のタスクのステートを前記第2
のステートから前記第1のステートへ変更するように前
記ステート情報を更新する機能を更に有することを特徴
とするマイクロコントローラ。
5. The microcontroller according to claim 4, wherein the state controller, when activated by the determination unit, changes a state of the task being executed to the second state.
A microcontroller further having a function of updating the state information so as to change the state from the first state to the first state.
【請求項6】 請求項2記載のマイクロコントローラに
おいて、 前記スケジューラは、前記タスク管理情報に基づき、前
記第1のステートにあるタスクのうちで最も高い実行優
先度を有するタスクを次に実行すべきタスクとして選択
するためのプライオリティエンコーダを更に備えたこと
を特徴とするマイクロコントローラ。
6. The microcontroller according to claim 2, wherein the scheduler should execute a task having the highest execution priority among tasks in the first state based on the task management information. A microcontroller further comprising a priority encoder for selecting as a task.
【請求項7】 請求項6記載のマイクロコントローラに
おいて、 前記ステートコントローラは、前記プライオリティエン
コーダにより選択されたタスクのステートを前記第1の
ステートから前記第2のステートへ変更するように前記
ステート情報を更新する機能を更に有することを特徴と
するマイクロコントローラ。
7. The microcontroller according to claim 6, wherein the state controller changes the state information so as to change the state of the task selected by the priority encoder from the first state to the second state. A microcontroller further having a function of updating.
【請求項8】 請求項1記載のマイクロコントローラに
おいて、 前記タスク管理テーブルは、前記タスクスイッチの時点
より前に実行されていたタスクに係る前記プロセッサの
資源を退避するための領域を有することを特徴とするマ
イクロコントローラ。
8. The microcontroller according to claim 1, wherein the task management table has an area for saving resources of the processor related to a task executed before the time of the task switch. And a microcontroller.
【請求項9】 請求項1記載のマイクロコントローラに
おいて、 前記複数のハードウェアエンジンの各々が互いに独立し
た作業領域として使用する複数のレジスタファイルを更
に備えたことを特徴とするマイクロコントローラ。
9. The microcontroller according to claim 1, further comprising: a plurality of register files used by each of the plurality of hardware engines as independent work areas.
【請求項10】 請求項1記載のマイクロコントローラ
において、 前記複数のハードウェアエンジンのうちの少なくとも2
個のハードウェアエンジンに共通の設定パラメータを記
憶するためのレジスタファイルを更に備えたことを特徴
とするマイクロコントローラ。
10. The microcontroller according to claim 1, wherein at least two of the plurality of hardware engines are provided.
A microcontroller further comprising a register file for storing setting parameters common to the hardware engines.
【請求項11】 各々データ処理を実行するための複数
のハードウェアエンジンと、 前記複数のハードウェアエンジンを制御するためのマイ
クロコントローラとを備えたデータ処理システムであっ
て、 前記マイクロコントローラは、 複数のタスクをシーケンシャルに実行するためのプロセ
ッサと、 前記複数のタスクの各々の実行状況を表すステート情報
と、前記複数のタスクの各々の実行優先度を表すプライ
オリティ情報と、前記複数のタスクの各々がいずれのハ
ードウェアエンジンに割り当てられているかを表す割り
当て情報とを含むタスク管理情報を記憶するためのタス
ク管理テーブルと、 前記タスク管理情報に基づいて前記プロセッサにタスク
スイッチをさせるためのスケジューラとを備えたことを
特徴とするデータ処理システム。
11. A data processing system comprising: a plurality of hardware engines each for executing data processing; and a microcontroller for controlling the plurality of hardware engines, wherein the microcontroller comprises: A processor for sequentially executing the tasks, state information indicating the execution status of each of the plurality of tasks, priority information indicating the execution priority of each of the plurality of tasks, and each of the plurality of tasks A task management table for storing task management information including assignment information indicating which hardware engine is assigned, and a scheduler for causing the processor to perform a task switch based on the task management information. A data processing system.
【請求項12】 請求項11記載のデータ処理システム
において、 前記複数のタスクの各々は、実行待ちを表す第1のステ
ートと、実行中を表す第2のステートと、割り当てられ
たハードウェアエンジンの実行終了待ちを表す第3のス
テートとを有することを特徴とするデータ処理システ
ム。
12. The data processing system according to claim 11, wherein each of the plurality of tasks has a first state indicating a waiting state, a second state indicating a running state, and an assigned hardware engine. A third state indicating execution completion wait.
【請求項13】 請求項11記載のデータ処理システム
において、 前記複数のハードウェアエンジンは、各々MPEG画像
データのエンコードのための部分処理コアであることを
特徴とするデータ処理システム。
13. The data processing system according to claim 11, wherein each of the plurality of hardware engines is a partial processing core for encoding MPEG image data.
【請求項14】 少なくとも1つのタスクがそれぞれ対
応するハードウェアエンジンに割り当てられ、その割り
当てを表す情報に基づいてスケジューラでタスクスイッ
チを制御するタスクスイッチの制御方法であって、 前記タスクは、実行待ちを表す第1のステートと、実行
中を表す第2のステートと、割り当てられたハードウェ
アエンジンの実行終了待ちを表す第3のステートとを有
し、 ハードウェアエンジンが実行終了したとき、そのハード
ウェアエンジンに割り当てられたタスクのステートを前
記第3のステートから前記第1のステートへ変更するこ
とを特徴とするタスクスイッチの制御方法。
14. A task switch control method in which at least one task is respectively assigned to a corresponding hardware engine, and the task switch is controlled by a scheduler based on information indicating the assignment, wherein the task is waiting to be executed. , A second state representing execution, and a third state representing the end of execution of the assigned hardware engine. When the hardware engine terminates execution, the hardware A task switch control method, comprising: changing a state of a task assigned to a wear engine from the third state to the first state.
【請求項15】 請求項14記載のタスクスイッチの制
御方法において、 ハードウェアエンジンが実行終了したとき、実行中のタ
スクのステートを前記第2のステートから前記第1のス
テートへ変更することを特徴とするタスクスイッチの制
御方法。
15. The task switch control method according to claim 14, wherein when the execution of the hardware engine ends, the state of the task being executed is changed from the second state to the first state. Task switch control method.
JP23805798A 1997-09-01 1998-08-25 Microcontroller, data processing system and control method of task switch Expired - Fee Related JP3007612B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP23805798A JP3007612B2 (en) 1997-09-01 1998-08-25 Microcontroller, data processing system and control method of task switch

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP9-235625 1997-09-01
JP23562597 1997-09-01
JP23805798A JP3007612B2 (en) 1997-09-01 1998-08-25 Microcontroller, data processing system and control method of task switch

Publications (2)

Publication Number Publication Date
JPH11134203A true JPH11134203A (en) 1999-05-21
JP3007612B2 JP3007612B2 (en) 2000-02-07

Family

ID=26532242

Family Applications (1)

Application Number Title Priority Date Filing Date
JP23805798A Expired - Fee Related JP3007612B2 (en) 1997-09-01 1998-08-25 Microcontroller, data processing system and control method of task switch

Country Status (1)

Country Link
JP (1) JP3007612B2 (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005198289A (en) * 2003-12-30 2005-07-21 Samsung Electronics Co Ltd Data processing system and method
KR100705956B1 (en) 2004-12-30 2007-04-11 지멘스 오토모티브 주식회사 Method for controlling engin of car
KR100705955B1 (en) 2004-12-30 2007-04-11 지멘스 오토모티브 주식회사 Method for controlling engin of car
US7302688B2 (en) 2001-12-11 2007-11-27 Nec Corporation Portable data-processing terminal including a program competition manager
JP2007336023A (en) * 2006-06-13 2007-12-27 Oki Electric Ind Co Ltd Motion picture processing apparatus
JP2009510817A (en) * 2005-09-26 2009-03-12 深▲せん▼市朗科科技有限公司 Multitasking method in media player
JP2009060224A (en) * 2007-08-30 2009-03-19 Canon Inc Coding processor
JP2009302597A (en) * 2008-06-10 2009-12-24 Fujitsu Ltd Image decoder
JP2016537845A (en) * 2013-09-27 2016-12-01 アップル インコーポレイテッド Parallel hardware and software block processing pipeline
US9843813B2 (en) 2013-09-25 2017-12-12 Apple Inc. Delayed chroma processing in block processing pipelines

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7302688B2 (en) 2001-12-11 2007-11-27 Nec Corporation Portable data-processing terminal including a program competition manager
US7986734B2 (en) 2003-12-30 2011-07-26 Samsung Electronics Co., Ltd. Video codecs, data processing systems and methods for the same
JP2005198289A (en) * 2003-12-30 2005-07-21 Samsung Electronics Co Ltd Data processing system and method
KR100705955B1 (en) 2004-12-30 2007-04-11 지멘스 오토모티브 주식회사 Method for controlling engin of car
KR100705956B1 (en) 2004-12-30 2007-04-11 지멘스 오토모티브 주식회사 Method for controlling engin of car
JP2009510817A (en) * 2005-09-26 2009-03-12 深▲せん▼市朗科科技有限公司 Multitasking method in media player
JP2007336023A (en) * 2006-06-13 2007-12-27 Oki Electric Ind Co Ltd Motion picture processing apparatus
JP4610523B2 (en) * 2006-06-13 2011-01-12 Okiセミコンダクタ株式会社 Movie processing device
KR101378804B1 (en) * 2006-06-13 2014-03-27 라피스 세미컨덕터 가부시키가이샤 Moving picture processing device
JP2009060224A (en) * 2007-08-30 2009-03-19 Canon Inc Coding processor
JP2009302597A (en) * 2008-06-10 2009-12-24 Fujitsu Ltd Image decoder
US9843813B2 (en) 2013-09-25 2017-12-12 Apple Inc. Delayed chroma processing in block processing pipelines
JP2016537845A (en) * 2013-09-27 2016-12-01 アップル インコーポレイテッド Parallel hardware and software block processing pipeline

Also Published As

Publication number Publication date
JP3007612B2 (en) 2000-02-07

Similar Documents

Publication Publication Date Title
KR100526213B1 (en) Microcontroller, data processing system and task switching control method
KR100649107B1 (en) Method and system for performing real-time operation
US6389446B1 (en) Multi-processor system executing a plurality of threads simultaneously and an execution method therefor
JP3776449B2 (en) Multitasking low power controller
KR20050016170A (en) Method and system for performing real-time operation
US20030014472A1 (en) Thread ending method and device and parallel processor system
JP5173712B2 (en) Multithreaded processor
KR20050030871A (en) Method and system for performing real-time operation
WO2008023426A1 (en) Task processing device
JP3007612B2 (en) Microcontroller, data processing system and control method of task switch
JPH06250853A (en) Management method and system for process scheduling
JP2003263331A (en) Multiprocessor system
WO2008023427A1 (en) Task processing device
JP2002530734A (en) Job parallel processor
JP2000207202A (en) Controller and data processor
EP2282265A1 (en) A hardware task scheduler
US8042116B2 (en) Task switching based on the execution control information held in register groups
KR100564010B1 (en) Image processor
US5148542A (en) Multitask processing apparatus utilizing a central processing unit equipped with a micro-program memory which contains no software instructions
JP2001117786A (en) Process scheduling device and process scheduling method
JPH08241213A (en) Decentralized control system in microprocessor
US20060095719A1 (en) Microcontroller having partial-twin structure
JP3356677B2 (en) Processor that can execute asynchronous event tasks efficiently even if there are many tasks to be executed asynchronously
JP2008269597A (en) Task processor
JPH02254544A (en) Multitask sequence processor and its starting method

Legal Events

Date Code Title Description
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 19991109

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

Free format text: PAYMENT UNTIL: 20071126

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20081126

Year of fee payment: 9

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

Free format text: PAYMENT UNTIL: 20091126

Year of fee payment: 10

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

Free format text: PAYMENT UNTIL: 20091126

Year of fee payment: 10

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

Free format text: PAYMENT UNTIL: 20101126

Year of fee payment: 11

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

Free format text: PAYMENT UNTIL: 20111126

Year of fee payment: 12

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

Free format text: PAYMENT UNTIL: 20121126

Year of fee payment: 13

LAPS Cancellation because of no payment of annual fees