JP5536862B2 - Multithreaded processor - Google Patents

Multithreaded processor Download PDF

Info

Publication number
JP5536862B2
JP5536862B2 JP2012284003A JP2012284003A JP5536862B2 JP 5536862 B2 JP5536862 B2 JP 5536862B2 JP 2012284003 A JP2012284003 A JP 2012284003A JP 2012284003 A JP2012284003 A JP 2012284003A JP 5536862 B2 JP5536862 B2 JP 5536862B2
Authority
JP
Japan
Prior art keywords
thread
hardware
instruction
dispatch
priority
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.)
Active
Application number
JP2012284003A
Other languages
Japanese (ja)
Other versions
JP2013080509A (en
Inventor
浩次 安達
鉄平 大本
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Renesas Electronics Corp
Original Assignee
Renesas Electronics Corp
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 Renesas Electronics Corp filed Critical Renesas Electronics Corp
Priority to JP2012284003A priority Critical patent/JP5536862B2/en
Publication of JP2013080509A publication Critical patent/JP2013080509A/en
Application granted granted Critical
Publication of JP5536862B2 publication Critical patent/JP5536862B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明にかかるマルチスレッドプロセッサに関し、特に複数のハードウェアスレッドの実行順序をスケジュールするスレッドスケジューラを有するマルチスレッドプロセッサに関する。   The present invention relates to a multithread processor according to the present invention, and more particularly to a multithread processor having a thread scheduler that schedules the execution order of a plurality of hardware threads.

近年、プロセッサの処理能力を向上させるためにマルチスレッドプロセッサが提案されている。マルチスレッドプロセッサは、それぞれが独立した命令流を生成するスレッドを有する。そして、マルチスレッドプロセッサは、パイプライン処理により命令を処理する演算回路に対していずれのスレッドにより生成された命令流を処理させるかを切り替えながら演算処理を実行する。このとき、マルチスレッドプロセッサは、1つのスレッドにより生成された命令をパイプライン中の1つの実行ステージで実行しながら、他の実行ステージにおいて他のスレッドにより生成された命令を処理することができる。つまり、マルチスレッドプロセッサの演算回路では、互いに独立関係にある命令がそれぞれ異なる実行ステージで実行されることになる。これにより、マルチスレッドプロセッサは、それぞれの命令流を円滑に処理しながら、パイプラインの実行ステージが何も処理しない時間を削減し、プロセッサの処理能力を向上させる。   In recent years, a multi-thread processor has been proposed in order to improve the processing capability of the processor. Multi-thread processors have threads that generate independent instruction streams. Then, the multi-thread processor executes arithmetic processing while switching which thread the instruction stream generated by the arithmetic circuit that processes the instruction by pipeline processing is processed. At this time, the multi-thread processor can process an instruction generated by another thread in another execution stage while executing an instruction generated by one thread in one execution stage in the pipeline. That is, in the arithmetic circuit of the multithread processor, instructions that are independent of each other are executed in different execution stages. As a result, the multi-thread processor reduces the time during which the execution stage of the pipeline does not process anything while smoothly processing each instruction stream, and improves the processing capacity of the processor.

このようなマルチスレッドプロセッサの一例が特許文献1に開示されている。特許文献1に記載のマルチスレッドプロセッサでは、複数のプロセッサエレメントと、各プロセッサエレメントのスレッドを切り替える並列プロセッサ制御部とを備える。そして、並列プロセッサ制御部は、プロセッサエレメントにおいて実行されているスレッドの実行時間をカウントし、カウントした時間がスレッドの割り当て時間に達したときにタイムアウト信号を出力し、タイムアウト信号と実行順序レジスタに保持された実行順序情報とに基づきプロセッサエレメントが実行すべきスレッドを切り替える。   An example of such a multi-thread processor is disclosed in Patent Document 1. The multi-thread processor described in Patent Literature 1 includes a plurality of processor elements and a parallel processor control unit that switches threads of each processor element. The parallel processor control unit counts the execution time of the thread being executed in the processor element, outputs a timeout signal when the counted time reaches the thread allocation time, and holds it in the timeout signal and the execution order register. The thread to be executed by the processor element is switched based on the executed execution order information.

このようにマルチスレッドプロセッサでは、演算回路においていずれのスレッドが生成する命令流を処理させるかをスケジュールに従って切り替える。このレッドのスケジュール方法の一例が特許文献2において開示されている。特許文献2に記載のマルチスレッドプロセッサでは、複数のスレッドを巡回的に、そのスレッドに割り当てられた時間ずつ実行する。つまり、特許文献2では、固定的に定められたスケジュールを巡回的に実行することで所定の実行時間比で各スレッドが実行される。   As described above, in the multi-thread processor, the instruction circuit generated by which thread is processed in the arithmetic circuit is switched according to the schedule. An example of this red schedule method is disclosed in Patent Document 2. In the multi-thread processor described in Patent Document 2, a plurality of threads are cyclically executed for each time allocated to the threads. That is, in Patent Literature 2, each thread is executed at a predetermined execution time ratio by cyclically executing a fixed schedule.

また、スレッドの別のスケジュール方法が特許文献3に開示されている。特許文献3では、スレッドのスケジューリングの方法としてラウンドロビン方式とプライオリティ方式とが記載されている。ラウンドロビン方式では、待ち行列に入っているスレッドを一定時間毎に順番に選んで実行する。そのため、ラウンドロビン方式では、待ち行列にあるスレッドが一定時間毎に公平にCPUに割り当てられて実行される。また、プライオリティ方式は、スレッドの優先度の順にスレッドを実行する。より具体的には、プライオリティ方式では、優先度毎に設けられた待ち行列に各優先度のスレッドがキューイングされ、優先度の高い待ち行列から順にスレッドが選択されCPUに割り当てられて実行される。   Another scheduling method for threads is disclosed in Patent Document 3. Patent Document 3 describes a round robin method and a priority method as thread scheduling methods. In the round robin method, the queued threads are selected and executed in order at regular intervals. For this reason, in the round robin method, threads in the queue are assigned to the CPUs at regular intervals and executed. In the priority method, threads are executed in the order of thread priority. More specifically, in the priority method, threads of each priority are queued in a queue provided for each priority, and threads are selected in order from the queue with the highest priority, assigned to the CPU, and executed. .

特開2007−317171号公報JP 2007-317171 A 特開2008−52750号公報JP 2008-52750 A 特開2006−155480号公報JP 2006-155480 A

しかしながら、ラウンドロビン方式及びプライオリティ方式に共通する問題として、スレッドの最低実行時間を保証しながら、柔軟にスレッドの実行時間を設定できない問題がある。例えば、ラウンドロビン方式では、スレッド数が増加した場合、各スレッドの実行時間が均等に減少し、優先度の高いスレッドに十分な実行時間が割り当てられない問題がある。また、プライオリティ方式では、優先度の高いスレッドの処理が続いた場合、優先度の低いスレッドが処理できない問題がある。   However, as a problem common to the round robin method and the priority method, there is a problem that the execution time of the thread cannot be set flexibly while guaranteeing the minimum execution time of the thread. For example, in the round robin method, when the number of threads increases, the execution time of each thread decreases evenly, and there is a problem that a sufficient execution time cannot be assigned to a high priority thread. In addition, the priority method has a problem that a thread with a low priority cannot be processed when processing of a thread with a high priority continues.

本発明にかかるマルチスレッドプロセッサの一態様は、それぞれが独立した命令流を生成する複数のハードウェアスレッドと、予め前記複数のハードウェアスレッドのそれぞれに対して設定された優先順位に応じて、前記複数のハードウェアスレッドのうち次実行サイクルにおいて選択されるハードウェアスレッドを指定する第1のスレッドスケジューラと、前記指定に応じて前記複数のハードウェアスレッドのいずれか1つを選択し、選択したハードウェアスレッドにより生成された命令を実行する演算回路と、を有し、前記第1のスレッドスケジューラは、前記優先順位が高い前記ハードウェアスレッドを優先的に選択し、前記選択されたハードウェアスレッドにより生成される前記命令が前記演算回路において実行される度に、実行された前記命令を生成した前記ハードウェアスレッドに対する前記優先順位の更新し、最も優先順位が高いハードウェアスレッドの優先順位が最低になるまでの間に少なくとも一つの他のハードウェアスレッドを選択するものである。   According to one aspect of the multi-thread processor according to the present invention, a plurality of hardware threads each generating an independent instruction stream, and a priority set in advance for each of the plurality of hardware threads, A first thread scheduler that designates a hardware thread selected in the next execution cycle among the plurality of hardware threads, and selects one of the plurality of hardware threads according to the designation, and selects the selected hardware thread. An arithmetic circuit that executes an instruction generated by a wear thread, wherein the first thread scheduler preferentially selects the hardware thread having a high priority, and the selected hardware thread Each time the generated instruction is executed in the arithmetic circuit, it is executed. The priority of the hardware thread that generated the instruction is updated, and at least one other hardware thread is selected until the priority of the hardware thread with the highest priority becomes the lowest. is there.

本発明にかかるマルチスレッドプロセッサによれば、実行されたハードウェアスレッドの優先順位を更新し、更新後の優先順位に従って次に選択するハードウェアスレッドを決定する。これにより、所定のハードウェアスレッドが固定的に選択されることを防止することができる。   According to the multi-thread processor of the present invention, the priority of the executed hardware thread is updated, and the hardware thread to be selected next is determined according to the updated priority. As a result, it is possible to prevent a predetermined hardware thread from being fixedly selected.

本発明にかかるマルチスレッドプロセッサによれば、ハードウェアスレッドの最低実行時間を保証しながら、柔軟にハードウェアスレッドの実行時間を設定できる。   The multi-thread processor according to the present invention can flexibly set the execution time of the hardware thread while guaranteeing the minimum execution time of the hardware thread.

実施の形態1にかかるマルチスレッドプロセッサのブロック図である。1 is a block diagram of a multithread processor according to a first embodiment; 実施の形態1にかかるスレッドスケジューラのブロック図である。FIG. 3 is a block diagram of a thread scheduler according to the first exemplary embodiment. 実施の形態1にかかるディスパッチカウンタのブロック図である。FIG. 2 is a block diagram of a dispatch counter according to the first exemplary embodiment. 実施の形態1にかかるマルチスレッドプロセッサにおいて実行される命令群の一例を示す図である。FIG. 3 is a diagram illustrating an example of an instruction group executed in the multithread processor according to the first embodiment; 実施の形態1にかかるマルチスレッドプロセッサにおいてマスク信号を用いない場合の命令の処理フローを示す図である。FIG. 5 is a diagram illustrating a processing flow of instructions when a mask signal is not used in the multithread processor according to the first embodiment. 実施の形態1にかかるマルチスレッドプロセッサにおいてマスク信号を用いた場合の命令の処理フローを示す図である。FIG. 6 is a diagram illustrating a processing flow of instructions when a mask signal is used in the multithread processor according to the first embodiment. 実施の形態1にかかるマルチスレッドプロセッサの起動時の動作手順を示すフローチャートである。4 is a flowchart showing an operation procedure when the multithread processor according to the first embodiment is started up; 実施の形態1にかかるスレッドスケジューラの動作手順を示すフローチャートである。3 is a flowchart illustrating an operation procedure of the thread scheduler according to the first embodiment; 実施の形態1にかかるスレッドスケジューラの動作を示す表である。6 is a table showing an operation of the thread scheduler according to the first embodiment. 実施の形態1にかかるスレッドスケジューラの動作を示す表である。6 is a table showing an operation of the thread scheduler according to the first embodiment. 実施の形態2にかかるマルチスレッドプロセッサのブロック図である。FIG. 3 is a block diagram of a multi-thread processor according to a second exemplary embodiment. 実施の形態2にかかるスレッドスケジューラのブロック図である。FIG. 6 is a block diagram of a thread scheduler according to a second embodiment. 実施の形態2にかかる第2のスレッドスケジューラ内のスロットの構成を示す模式図である。FIG. 10 is a schematic diagram illustrating a configuration of slots in a second thread scheduler according to the second embodiment; 実施の形態2にかかる第2のスレッドスケジューラの動作を示す表である。10 is a table showing an operation of a second thread scheduler according to the second exemplary embodiment. 実施の形態2にかかるスレッドスケジューラの動作を示す表である。10 is a table showing the operation of the thread scheduler according to the second embodiment.

実施の形態1
以下、図面を参照して本発明の実施の形態について説明する。図1に本実施の形態にかかるマルチスレッドプロセッサ1を含むプロセッサシステムのブロック図を示す。本実施の形態にかかるプロセッサシステムでは、システムバスを介してマルチスレッドプロセッサ1とメモリ2が接続される。なお、図示はしていないが、システムバスには、入出力インタフェースなどの他の回路も接続されるものとする。
Embodiment 1
Embodiments of the present invention will be described below with reference to the drawings. FIG. 1 shows a block diagram of a processor system including a multi-thread processor 1 according to the present embodiment. In the processor system according to the present embodiment, the multi-thread processor 1 and the memory 2 are connected via a system bus. Although not shown, it is assumed that other circuits such as an input / output interface are also connected to the system bus.

まず、本実施の形態にかかるマルチスレッドプロセッサ1について説明する。マルチスレッドプロセッサ1は、複数のハードウェアスレッドを備える。ハードウェアスレッドは、スレッドプログラムカウンタ、命令メモリ、汎用レジスタ、及び制御レジスタ(本実施の形態ではパイプライン制御回路16に内蔵されるものとする)等の回路群により構成される。そして、ハードウェアスレッドとは、マルチスレッドプロセッサ1に内蔵されるスレッドプログラムカウンタにより出力される命令フェッチアドレスに従って命令メモリから読み出される一連の命令群により構成される命令流を生成する系のことをいう。つまり、1つのハードウェアスレッドにより生成される命令流に含まれる命令は、互いに関連性の高い命令である。本実施の形態では、マルチスレッドプロセッサ1が複数のスレッドプログラムカウンタを備えることでその数に応じた数のハードウェアスレッドが実装される。以下では、マルチスレッドプロセッサ1についてさらに詳細に説明する。   First, the multithread processor 1 according to the present embodiment will be described. The multi-thread processor 1 includes a plurality of hardware threads. The hardware thread is composed of a circuit group such as a thread program counter, an instruction memory, a general-purpose register, and a control register (in the present embodiment, it is incorporated in the pipeline control circuit 16). The hardware thread is a system that generates an instruction stream including a series of instructions read from the instruction memory in accordance with an instruction fetch address output by a thread program counter built in the multi-thread processor 1. . That is, the instructions included in the instruction stream generated by one hardware thread are highly related to each other. In the present embodiment, the multi-thread processor 1 includes a plurality of thread program counters, so that the number of hardware threads corresponding to the number is mounted. Hereinafter, the multithread processor 1 will be described in more detail.

図1に示すようにマルチスレッドプロセッサ1は、演算回路10、割り込みコントローラ11、PC生成回路12、スレッドプログラムカウンタTPC0〜TPC3、セレクタ13、18、命令メモリ14、命令バッファ15、パイプライン制御回路16、命令フェッチコントローラ17、スレッドスケジューラ19を有する。   As shown in FIG. 1, the multi-thread processor 1 includes an arithmetic circuit 10, an interrupt controller 11, a PC generation circuit 12, thread program counters TPC0 to TPC3, selectors 13 and 18, an instruction memory 14, an instruction buffer 15, and a pipeline control circuit 16. An instruction fetch controller 17 and a thread scheduler 19.

演算回路10は、セレクタ18によって選択されたハードウェアスレッドが生成する命令に基づき演算処理を実行する。より具体的には、演算回路10は、命令デコーダ21、実行ユニット22、データレジスタ23を有する。命令デコーダ21は受信した命令をデコードして、実行ユニット22に対して演算制御信号SCを出力する。また、命令デコーダ21は、命令のデコード結果に基づきデータの格納位置を示すデータレジスタアドレスRaddの出力を行う。実行ユニット22は、演算制御信号SCに応じて各種の演算を実行する。なお、実行ユニット22は、複数の実行ステージを有し、パイプライン処理により演算を行う。また、実行ユニット22において実行された演算結果は、その演算結果の種類に応じてPC生成回路12、メモリ2、データレジスタ23に送信される。データレジスタ23は、実行ユニット22において用いられるデータが格納される。そして、データレジスタ23は、データレジスタアドレスRaddにより指定したアドレスのデータを出力する。図1に示す例では、データレジスタ23は、データレジスタアドレスRaddに応じてデータaとデータbとを出力する形態となる。また、データレジスタ23は、データレジスタアドレスRaddにより指定されるアドレスに実行ユニット22が出力する演算結果を格納する。   The arithmetic circuit 10 executes arithmetic processing based on an instruction generated by the hardware thread selected by the selector 18. More specifically, the arithmetic circuit 10 includes an instruction decoder 21, an execution unit 22, and a data register 23. The instruction decoder 21 decodes the received instruction and outputs an operation control signal SC to the execution unit 22. The instruction decoder 21 outputs a data register address Radd indicating the data storage position based on the instruction decoding result. The execution unit 22 executes various calculations according to the calculation control signal SC. The execution unit 22 has a plurality of execution stages and performs operations by pipeline processing. The calculation result executed in the execution unit 22 is transmitted to the PC generation circuit 12, the memory 2, and the data register 23 according to the type of the calculation result. The data register 23 stores data used in the execution unit 22. The data register 23 outputs data at an address designated by the data register address Radd. In the example shown in FIG. 1, the data register 23 is configured to output data a and data b according to the data register address Radd. Further, the data register 23 stores the calculation result output by the execution unit 22 at an address specified by the data register address Radd.

割り込みコントローラ11は、割り込み要求信号を受けて、マルチスレッドプロセッサ1内に割り込み処理の実行を指示する割り込み指示信号を出力する。より具体的には、割り込みコントローラ11は、割り込み要求信号を受信すると、割り込み要因や割り込み処理の優先度等を判定し、当該割り込み要因に関連した処理を行うようにPC生成回路12及びパイプライン制御回路16に割り込み処理の実行を指示する。この割り込み要求は、マルチスレッドプロセッサ1が出力するものの他に、マルチスレッドプロセッサ1以外の回路からも出力される。   The interrupt controller 11 receives the interrupt request signal and outputs an interrupt instruction signal instructing execution of interrupt processing in the multithread processor 1. More specifically, when receiving the interrupt request signal, the interrupt controller 11 determines the interrupt factor, the priority of the interrupt processing, and the like, and performs the PC generation circuit 12 and the pipeline control so as to perform processing related to the interrupt factor. The circuit 16 is instructed to execute interrupt processing. This interrupt request is output from circuits other than the multithread processor 1 in addition to those output from the multithread processor 1.

PC生成回路12は、システムバスを介して入力される新たなプログラム命令信号、割り込みコントローラ11が出力する割り込み指示信号及び実行ユニット22における処理に基づき出力される分岐指示信号を受けて、プログラムカウント更新値を生成する。そして、PC生成回路12は、プログラムカウント更新値をスレッドプログラムカウンタTPC0〜TPC3のいずれかに与える。なお、PC生成回路12は、生成したプログラムカウント更新値をいずれのスレッドプログラムカウンタに与えるかを判断する機能も有する。   The PC generation circuit 12 receives a new program instruction signal input via the system bus, an interrupt instruction signal output from the interrupt controller 11, and a branch instruction signal output based on processing in the execution unit 22, and updates the program count. Generate a value. Then, the PC generation circuit 12 gives the program count update value to any one of the thread program counters TPC0 to TPC3. The PC generation circuit 12 also has a function of determining to which thread program counter the generated program count update value is to be given.

スレッドプログラムカウンタTPC0〜TPC3は、処理すべき命令が格納される命令メモリ14のアドレス(このアドレスを命令フェッチアドレスIMaddと称す)を生成する。また、スレッドプログラムカウンタTPC0〜TPC3は、PC生成回路12からプログラムカウント更新値が与えられた場合は、命令フェッチアドレスIMaddをプログラムカウント更新値に応じて更新する。一方、スレッドプログラムカウンタTPC0〜TPC3は、プログラムカウント更新値の入力がない場合は、アドレスを昇順に計算し、連続する次の命令フェッチアドレスを算出する。なお、図1においては、スレッドプログラムカウンタの数を4つとしたが、プログラムスレッドカウンタの数は、マルチスレッドプロセッサの仕様に応じて任意に設定することができる。   The thread program counters TPC0 to TPC3 generate an address of the instruction memory 14 in which an instruction to be processed is stored (this address is referred to as an instruction fetch address IMadd). When the program count update value is given from the PC generation circuit 12, the thread program counters TPC0 to TPC3 update the instruction fetch address IMadd according to the program count update value. On the other hand, when no program count update value is input, the thread program counters TPC0 to TPC3 calculate addresses in ascending order and calculate the next consecutive instruction fetch addresses. In FIG. 1, the number of thread program counters is four, but the number of program thread counters can be arbitrarily set according to the specifications of the multi-thread processor.

セレクタ13は、命令フェッチコントローラが出力するスレッド指定信号に応じてスレッドプログラムカウンタTPC0〜TPC3のうちいずれか1つを選択し、選択したスレッドプログラムカウンタが出力する命令フェッチアドレスIMaddを出力する。なお、図1のセレクタ13において入力端子に0〜4の数字を付したが、この数字は、ハードウェアスレッドの番号を示すものである。   The selector 13 selects any one of the thread program counters TPC0 to TPC3 according to the thread designation signal output from the instruction fetch controller, and outputs the instruction fetch address IMadd output from the selected thread program counter. In the selector 13 shown in FIG. 1, numbers 0 to 4 are assigned to the input terminals, and these numbers indicate the numbers of hardware threads.

命令メモリ14は、複数のハードウェアスレッドにより共通して用いられるメモリ領域である。命令メモリ14は、マルチスレッドプロセッサ1において実行される演算で用いられる各種命令が格納される。そして、命令メモリ14は、セレクタ13を介して入力される命令フェッチアドレスIMaddにより指定された命令を出力する。このとき、命令メモリ14は、セレクタ13がスレッドプログラムカウンタTPC0〜TPC3のいずれが出力した命令フェッチアドレスIMaddであるかを判別し、判別結果に応じて命令の出力先を振り分ける。本実施の形態では、命令バッファ15は、スレッドプログラムカウンタTPC0〜TPC3に対応した命令バッファ領域BUF0〜BUF3を有する。そこで、命令メモリ14は、命令フェッチアドレスIMaddの出力元に応じて命令バッファ領域BUF0〜BUF3のいずれかに読み出された命令を振り分ける。なお、命令メモリ14は、メモリ2に含まれる所定のメモリ領域であっても良い。また、命令バッファ領域BUF0〜BUF3は、FIFO(First In First Out)形式のバッファ回路である。また、命令バッファ領域BUF0〜BUF3は、1つのバッファ内において領域分割されたものでも良く、分離された領域に形成されたものであっても良い。   The instruction memory 14 is a memory area that is commonly used by a plurality of hardware threads. The instruction memory 14 stores various instructions used in operations executed in the multithread processor 1. Then, the instruction memory 14 outputs an instruction specified by the instruction fetch address IMadd input via the selector 13. At this time, the instruction memory 14 determines which one of the thread program counters TPC0 to TPC3 is the instruction fetch address IMadd output by the selector 13, and distributes the output destination of the instruction according to the determination result. In the present embodiment, the instruction buffer 15 has instruction buffer areas BUF0 to BUF3 corresponding to the thread program counters TPC0 to TPC3. Therefore, the instruction memory 14 distributes the read instruction to one of the instruction buffer areas BUF0 to BUF3 according to the output source of the instruction fetch address IMadd. The instruction memory 14 may be a predetermined memory area included in the memory 2. The instruction buffer areas BUF0 to BUF3 are FIFO (First In First Out) type buffer circuits. The instruction buffer areas BUF0 to BUF3 may be divided into areas in one buffer or may be formed in separated areas.

パイプライン制御回路16は、命令バッファ15の先頭に格納された命令と実行ユニット22において実行されている命令とをモニタする。そして、パイプライン制御回路16は、割り込みコントローラ11から割り込み指示信号が入力された場合には、割り込み処理に関係するハードウェアスレッドに属する命令を廃棄する指示を命令バッファ15及び実行ユニット22に対して行う。また、パイプライン制御回路16は、命令バッファ15の先頭に格納された命令と実行ユニット22において実行されている命令との依存関係を確認する。そして、命令間の依存関係が高いと判断した場合は、その命令が属するハードウェアスレッドのハードウェアスレッド番号を通知するマスク信号MSKを出力する。   The pipeline control circuit 16 monitors the instruction stored at the head of the instruction buffer 15 and the instruction being executed in the execution unit 22. Then, when an interrupt instruction signal is input from the interrupt controller 11, the pipeline control circuit 16 instructs the instruction buffer 15 and the execution unit 22 to discard an instruction belonging to a hardware thread related to interrupt processing. Do. Further, the pipeline control circuit 16 confirms the dependency relationship between the instruction stored at the head of the instruction buffer 15 and the instruction being executed in the execution unit 22. If it is determined that the dependency between instructions is high, a mask signal MSK that notifies the hardware thread number of the hardware thread to which the instruction belongs is output.

命令フェッチコントローラ17は、命令バッファ15に格納されている命令の個数に応じていずれのハードウェアスレッドに属する命令をフェッチすべきかを判断し、その判断結果に基づきスレッド指定信号を出力する。例えば、命令フェッチコントローラ17は、命令バッファ領域BUF0に格納される命令キューの数が他の命令バッファ領域に格納される命令キューの数よりも少なければ、0番のハードウェアスレッドに属する命令をフェッチすべきと判断し、0番のハードウェアスレッドを示すスレッド指定信号を出力する。これにより、セレクタ13は、スレッドプログラムカウンタTPC0を選択する。なお、命令フェッチコントローラ17は、ラウンドロビン方式による手順で選択するハードウェアスレッドを決定しても良い。   The instruction fetch controller 17 determines which hardware thread should be fetched according to the number of instructions stored in the instruction buffer 15, and outputs a thread designation signal based on the determination result. For example, if the number of instruction queues stored in the instruction buffer area BUF0 is smaller than the number of instruction queues stored in other instruction buffer areas, the instruction fetch controller 17 fetches an instruction belonging to the 0th hardware thread. A thread designation signal indicating the 0th hardware thread is output. Thereby, the selector 13 selects the thread program counter TPC0. Note that the instruction fetch controller 17 may determine a hardware thread to be selected by a round robin procedure.

セレクタ18は、第1のセレクタとして機能するセレクタである。セレクタ18は、スレッドスケジューラ19が出力するスレッド選択信号TSELに応じて命令バッファ領域BUF0〜BUF3のいずれか1つを選択し、選択した命令バッファ領域から読み出した命令を演算回路10に出力する。つまり、セレクタ18は、スレッド選択信号TSELに応じて複数のハードウェアスレッドから1つのハードウェアスレッドを選択し、選択したハードウェアスレッドが出力する命令を演算回路10に出力する。なお、セレクタ18においても、入力端子に0〜4の数字を付したが、この数字は、ハードウェアスレッドの番号を示すものである。   The selector 18 is a selector that functions as a first selector. The selector 18 selects any one of the instruction buffer areas BUF0 to BUF3 according to the thread selection signal TSEL output from the thread scheduler 19, and outputs the instruction read from the selected instruction buffer area to the arithmetic circuit 10. That is, the selector 18 selects one hardware thread from a plurality of hardware threads according to the thread selection signal TSEL, and outputs an instruction output from the selected hardware thread to the arithmetic circuit 10. In the selector 18 as well, numbers 0 to 4 are assigned to the input terminals, and these numbers indicate the numbers of hardware threads.

スレッドスケジューラ19は、予め設定されたスケジュールに従って、複数のハードウェアスレッドのうち次の実行サイクルにおいて実行される1つのハードウェアスレッドを指定するスレッド選択信号TSELを出力する。つまり、スレッドスケジューラ19は、複数のハードウェアスレッドのどのような順序で処理するかをスケジュールにより管理し、そのスケジュールに沿った順序でハードウェアスレッドにより生成される命令が実行されるようにスレッド選択信号TSELを出力する。なお、本実施の形態にかかるマルチスレッドプロセッサ1では、このスケジュールをマルチスレッドプロセッサ1の起動の直後に実行される管理プログラムにより設定する。また、スレッドスケジューラ19は、パイプライン制御回路16からマスク信号MSKを受信した場合、受信したマスク信号MSKにより示されるハードウェアスレッド番号に該当するハードウェアスレッド以外のハードウェアスレッドを選択する。さらに、スレッドスケジューラ19は、命令デコーダ21からディスパッチ信号DPTを受信する。ディスパッチ信号DPTは、命令デコーダ21が処理(ディスパッチ)した命令が属するハードウェアスレッドの番号を通知するものである。   The thread scheduler 19 outputs a thread selection signal TSEL that designates one hardware thread to be executed in the next execution cycle among the plurality of hardware threads in accordance with a preset schedule. In other words, the thread scheduler 19 manages in what order the plurality of hardware threads are processed according to the schedule, and selects the thread so that the instructions generated by the hardware threads are executed in the order according to the schedule. The signal TSEL is output. In the multithread processor 1 according to the present embodiment, this schedule is set by a management program executed immediately after the multithread processor 1 is activated. When the thread scheduler 19 receives the mask signal MSK from the pipeline control circuit 16, the thread scheduler 19 selects a hardware thread other than the hardware thread corresponding to the hardware thread number indicated by the received mask signal MSK. Further, the thread scheduler 19 receives the dispatch signal DPT from the instruction decoder 21. The dispatch signal DPT notifies the number of the hardware thread to which the instruction processed (dispatched) by the instruction decoder 21 belongs.

本実施の形態にかかるマルチスレッドプロセッサ1では、特にスレッドスケジューラ19において行われるハードウェアスレッドのスケジューリング方法に特徴を有する。以下では、スレッドスケジューラ19及びそのスケジューリングの方法について説明を行う。   The multi-thread processor 1 according to the present embodiment is particularly characterized in the hardware thread scheduling method performed in the thread scheduler 19. Hereinafter, the thread scheduler 19 and the scheduling method will be described.

図2にスレッドスケジューラ19のブロック図を示す。図2に示すように、スレッドスケジューラ19は、ディスパッチカウンタ30a〜30d、優先順位判定部31、スレッド番号選択部32、初期化判定部33を有する。なお、本実施の形態では、マルチスレッドプロセッサ1が4つのハードウェアスレッドを有すため、スレッドスケジューラ19は、4つのハードウェアスレッドの順序決定を行うための構成とするが、ハードウェアスレッドの個数を変更する場合は、ディスパッチカウンタの個数をハードウェアスレッドの個数に合わせれば良い。また、他の回路ブロックについてもディスパッチカウンタの個数に合わせてその構成を変更すれば良い。   FIG. 2 shows a block diagram of the thread scheduler 19. As shown in FIG. 2, the thread scheduler 19 includes dispatch counters 30a to 30d, a priority order determination unit 31, a thread number selection unit 32, and an initialization determination unit 33. In the present embodiment, since the multi-thread processor 1 has four hardware threads, the thread scheduler 19 is configured to determine the order of the four hardware threads. Is changed, the number of dispatch counters may be matched with the number of hardware threads. The configuration of other circuit blocks may be changed according to the number of dispatch counters.

ディスパッチカウンタ30a〜30dは、複数のハードウェアスレッドのうちのいずれか1つに対応して設けられる。ディスパッチカウンタ30a〜30dは、それぞれ、対応するハードウェアスレッドに対する優先順位に相当するディスパッチカウント値DCNT(図2におけるディスパッチカウント値DCNT0〜DCNT3を含む)を保持する。そして、ディスパッチカウンタ30a〜30dは、それぞれ、ディスパッチ信号DPTを受け、自ディスパッチカウンタに対応するハードウェアスレッドに属する命令の実行回数(ディスパッチ回数)をカウントする。より具体的には、ディスパッチカウンタ30a〜30dは、ディスパッチ信号DPTにより通知されるハードウェアスレッド番号を通知が対応するハードウェアスレッドを示すものである場合、ディスパッチカウント値DCNTをデクリメントする。このディスパッチカウント値DCNTの初期値は、マルチスレッドプロセッサ1の起動時に実行される管理プログラムにより設定される。また、ディスパッチカウント値DCNTの初期値は、管理プログラムによりメモリから読み出され、その読み出された値が設定されるものとする。   The dispatch counters 30a to 30d are provided corresponding to any one of a plurality of hardware threads. Each of the dispatch counters 30a to 30d holds a dispatch count value DCNT (including the dispatch count values DCNT0 to DCNT3 in FIG. 2) corresponding to the priority order for the corresponding hardware thread. Each of the dispatch counters 30a to 30d receives the dispatch signal DPT and counts the number of executions (dispatch times) of instructions belonging to the hardware thread corresponding to the own dispatch counter. More specifically, the dispatch counters 30a to 30d decrement the dispatch count value DCNT when the notification indicates the hardware thread corresponding to the hardware thread number notified by the dispatch signal DPT. The initial value of the dispatch count value DCNT is set by a management program executed when the multi-thread processor 1 is activated. In addition, the initial value of the dispatch count value DCNT is read from the memory by the management program, and the read value is set.

また、ディスパッチカウンタ30a〜30dには、マスク信号MSK(マスク信号MSK0〜MSK3を含む)と初期化信号CNTintが入力され、カウント現在値Vnow(カウント現在値Vnow0〜Vnow3を含む)を出力する。ディスパッチカウンタ30a〜30dは、対応するハードウェアスレッドに対応するマスク信号MSKが入力されるとディスパッチカウント値DCNTを最低優先順位(例えば0)とする。ディスパッチカウンタ30a〜30dは、初期化信号CNTintが入力されるとディスパッチカウント値DCNTを初期値にリセットする。なお、初期化信号CNTintは、初期化判定部33から出力される。ディスパッチカウンタ30a〜30dは、内部で保持するカウント値CNTに基づきディスパッチカウント値DCNTを出力するが、このカウント値CNTそのものの値をカウント現在値Vnowとして出力する。このディスパッチカウンタ30a〜30dの詳細な構成については後述する。   The dispatch counters 30a to 30d receive the mask signal MSK (including the mask signals MSK0 to MSK3) and the initialization signal CNTint, and output the current count value Vnow (including the current count value Vnow0 to Vnow3). The dispatch counters 30a to 30d set the dispatch count value DCNT to the lowest priority (for example, 0) when the mask signal MSK corresponding to the corresponding hardware thread is input. The dispatch counters 30a to 30d reset the dispatch count value DCNT to the initial value when the initialization signal CNTint is input. The initialization signal CNTint is output from the initialization determination unit 33. The dispatch counters 30a to 30d output the dispatch count value DCNT based on the count value CNT held therein, and output the value of the count value CNT itself as the count current value Vnow. The detailed configuration of the dispatch counters 30a to 30d will be described later.

優先順位判定部31は、ディスパッチカウンタ30a〜30dが出力するディスパッチカウント値DCNTを参照し、最も高い優先順位を示すディスパッチカウント値DCNTを判定することで、最も高い優先順位のハードウェアスレッドを判定する。より具体的には、優先順位判定部31は、比較器34〜36を有する。比較器34〜36は、それぞれ、2つの値が入力され、2つの値のうち大きな値を選択して出力する。このとき比較器34〜36は、選択した値を出力したディスパッチカウンタの情報も合わせて出力する。また、比較器34〜36は、入力される2つの値が同じ値である場合、予め決められたルールに従いいずれか一方の値を選択して出力する。   The priority determination unit 31 refers to the dispatch count value DCNT output from the dispatch counters 30a to 30d, and determines the dispatch count value DCNT indicating the highest priority, thereby determining the hardware thread with the highest priority. . More specifically, the priority order determination unit 31 includes comparators 34 to 36. The comparators 34 to 36 each receive two values and select and output a larger value from the two values. At this time, the comparators 34 to 36 also output the information of the dispatch counter that has output the selected value. Further, when the two input values are the same value, the comparators 34 to 36 select and output one of the values according to a predetermined rule.

より具体的には、比較器34は、ディスパッチカウンタ30aが出力するディスパッチカウント値DCNT0とディスパッチカウンタ30bが出力するディスパッチカウント値DCNT1とが入力され、2つのディスパッチカウント値のうち大きな値のディスパッチカウント値を高優先ハードウェアスレッド値M1として出力する。比較器35は、ディスパッチカウンタ30cが出力するディスパッチカウント値DCNT2とディスパッチカウンタ30dが出力するディスパッチカウント値DCNT3とが入力され、2つのディスパッチカウント値のうち大きな値のディスパッチカウント値を高優先ハードウェアスレッド値M2として出力する。比較器36は、比較器34が出力する高優先ハードウェアスレッド値M1と比較器35が出力する高優先ハードウェアスレッド値M2とが入力され、2つの高優先ハードウェアスレッド値のうち大きな値の高優先ハードウェアスレッド値を高優先ハードウェアスレッド値MAXとして出力する。なお、高優先ハードウェアスレッド値M1、M2、MAXには、その値を出力したディスパッカウンタを示す値が付加される。   More specifically, the comparator 34 receives the dispatch count value DCNT0 output from the dispatch counter 30a and the dispatch count value DCNT1 output from the dispatch counter 30b, and has a larger dispatch count value of the two dispatch count values. Is output as the high-priority hardware thread value M1. The comparator 35 receives the dispatch count value DCNT2 output from the dispatch counter 30c and the dispatch count value DCNT3 output from the dispatch counter 30d, and assigns a larger one of the two dispatch count values to the high priority hardware thread. Output as value M2. The comparator 36 receives the high-priority hardware thread value M1 output from the comparator 34 and the high-priority hardware thread value M2 output from the comparator 35, and has a larger value between the two high-priority hardware thread values. The high priority hardware thread value is output as the high priority hardware thread value MAX. The high priority hardware thread values M1, M2, and MAX are added with values indicating the dispatcher that outputs the values.

スレッド番号選択部32は、優先順位判定部31が出力する高優先ハードウェアスレッド値MAXを出力したディスパッチカウンタに対応付けられたハードウェアスレッドを選択し、選択したハードウェアスレッドを示すハードウェアスレッド番号をスレッド選択信号TSELとして出力する。   The thread number selection unit 32 selects a hardware thread associated with the dispatch counter that has output the high-priority hardware thread value MAX output by the priority order determination unit 31, and the hardware thread number indicating the selected hardware thread Is output as a thread selection signal TSEL.

初期化判定部33は、カウント現在値Vnow0〜Vnow3(ディスパッチカウント値DCNTを出力するためにディスパッチカウンタ内で保持されるカウント値CNT)を受けて、カウント現在値Vnow0〜Vnow3の組み合わせが予め設定された所定の条件を満たしたときに初期化信号CNTintを出力する。本実施の形態における所定の条件は、カウント現在値Vnow0〜Vnow3がすべて0となる条件であるものとする。   Initialization determination unit 33 receives count current values Vnow0 to Vnow3 (count value CNT held in the dispatch counter to output dispatch count value DCNT), and combinations of count current values Vnow0 to Vnow3 are preset. When the predetermined condition is satisfied, the initialization signal CNTint is output. The predetermined condition in the present embodiment is a condition in which the count current values Vnow0 to Vnow3 are all 0.

次に、ディスパッチカウンタ30a〜30dの構成について詳細に説明する。なお、ディスパッチカウンタ30a〜30dは同一の構成であるため、ディスパッチカウンタ30aを例にディスパッチカウンタの構成について説明する。ディスパッチカウンタ30aのブロック図を図3に示す。図3に示すように、ディスパッチカウンタ30aは、カウンタ初期設定値格納部40、カウント値格納部41、デクリメンタ42、第2のセレクタ(例えば、セレクタ43)を有する。   Next, the configuration of the dispatch counters 30a to 30d will be described in detail. Since the dispatch counters 30a to 30d have the same configuration, the configuration of the dispatch counter will be described taking the dispatch counter 30a as an example. A block diagram of the dispatch counter 30a is shown in FIG. As shown in FIG. 3, the dispatch counter 30a includes a counter initial set value storage unit 40, a count value storage unit 41, a decrementer 42, and a second selector (for example, a selector 43).

カウンタ初期設定値格納部40は、ディスパッチカウンタ30aが出力するディスパッチカウント値DCNTのカウンタ初期設定値INIT0を格納する。このカウンタ初期設定値INIT0は、管理プログラムによりメモリ2から読み出される値である。カウント値格納部41は、カウント値CNT0を格納する。また、カウント値格納部41は、初期化信号CNTintに応じてカウンタ初期設定値INIT0を読み出し、カウント値CNT0の初期値とする。このカウント値CNT0は、セレクタ43に対して出力される他、カウント現在値Vnow0として初期化判定部33に出力され、さらに、デクリメンタ42にも出力される。デクリメンタ42は、ディスパッチ信号DPT0が入力される度にカウント値CNT0をデクリメントする。そして、デクリメンタ42は、デクリメント後のカウント値を書き戻し値DCR0として出力し、書き戻し値DCR0によりカウント値CNT0を更新する。セレクタ43は、マスク信号MSKに応じて最低優先順位を示すマスク値(例えば0)とカウント値CNT0のいずれか一方を選択し、選択した値をディスパッチ信号DPT0として出力する。   The counter initial set value storage unit 40 stores a counter initial set value INIT0 of the dispatch count value DCNT output from the dispatch counter 30a. The counter initial setting value INIT0 is a value read from the memory 2 by the management program. The count value storage unit 41 stores the count value CNT0. Further, the count value storage unit 41 reads the counter initial setting value INIT0 in accordance with the initialization signal CNTint and sets it as the initial value of the count value CNT0. In addition to being output to the selector 43, the count value CNT0 is output to the initialization determination unit 33 as the current count value Vnow0, and is also output to the decrementer 42. The decrementer 42 decrements the count value CNT0 every time the dispatch signal DPT0 is input. Then, the decrementer 42 outputs the count value after decrement as a write-back value DCR0, and updates the count value CNT0 with the write-back value DCR0. The selector 43 selects one of the mask value (for example, 0) indicating the lowest priority and the count value CNT0 according to the mask signal MSK, and outputs the selected value as the dispatch signal DPT0.

ここで、マスク信号MSKについて説明する。マスク信号MSKは、パイプライン制御回路16が命令バッファ15の先頭に格納された命令と実行ユニット22において実行されている命令との依存関係を確認し、この命令間の依存関係が高いと判断した場合に出力される。そして、パイプライン制御回路16は、このマスク信号MSKにより、実行ユニット22において実行される命令の処理が十分に完了される前に実行ユニット22において実行されている命令と依存関係の高い命令が読み出されることを防止する。   Here, the mask signal MSK will be described. The mask signal MSK confirms the dependency between the instruction stored in the head of the instruction buffer 15 and the instruction being executed in the execution unit 22 by the pipeline control circuit 16, and determines that the dependency between the instructions is high. Is output if. Then, the pipeline control circuit 16 reads out an instruction having a high dependency relationship with the instruction being executed in the execution unit 22 before the processing of the instruction executed in the execution unit 22 is sufficiently completed by the mask signal MSK. To prevent it.

このマスク信号MSKが出力される状態を説明するために、1つのハードウェアスレッドにおいて生成される命令群の一例を図4に示す。図4に示す命令群は、命令1〜命令3により構成され、このうち命令2と命令3の依存関係が高い例を示すものである。命令1は、レジスタa1の値とレジスタb1の値とを加算し、加算した結果得られた値をレジスタc1に格納する加算命令である。命令2は、メモリ2の0x0(a1)番地のアドレスのデータをレジスタd1にロードするロード命令である。命令3は、レジスタe1の値からレジスタd1の値を減算し、減算した結果をレジスタb1に格納する加算命令である。   In order to describe the state in which the mask signal MSK is output, an example of an instruction group generated in one hardware thread is shown in FIG. The instruction group shown in FIG. 4 is composed of instructions 1 to 3 and shows an example in which the dependency relationship between the instruction 2 and the instruction 3 is high. The instruction 1 is an addition instruction for adding the value of the register a1 and the value of the register b1 and storing the value obtained as a result of the addition in the register c1. The instruction 2 is a load instruction for loading the data at the address 0x0 (a1) in the memory 2 into the register d1. The instruction 3 is an addition instruction that subtracts the value of the register d1 from the value of the register e1 and stores the result of the subtraction in the register b1.

そして、マスク信号MSKが出力されることなく、図4に示した命令群が続けて発行された場合に生じる問題を図5を用いて説明する。図5は、命令1〜3が続けて発行された場合における命令処理フローを示すタイミングチャートである。命令1〜3は、デコードステージID、実行ステージEX、書き戻しステージWBにより処理される。さらに、命令2には、メモリ2へのアクセスを実行するメモリアクセス待ちステージMMを有する。図5に示す例では、まず、命令1は、時刻P1においてデコードされ、時刻P2において処理され、時刻P3において演算の結果値をレジスタc1に書き戻す。続いて、命令2は、命令1よりも一時刻遅れた時刻P2においてデコードされ、時刻P3において処理され、時刻P4〜P6の期間にメモリアクセス待ちを行い、時刻P7において演算の結果値をレジスタd1に書き戻す。   A problem that occurs when the instruction group shown in FIG. 4 is issued without the mask signal MSK being output will be described with reference to FIG. FIG. 5 is a timing chart showing an instruction processing flow when instructions 1 to 3 are issued in succession. Instructions 1 to 3 are processed by the decode stage ID, the execution stage EX, and the write back stage WB. Further, the instruction 2 has a memory access waiting stage MM for executing access to the memory 2. In the example shown in FIG. 5, instruction 1 is first decoded at time P1, processed at time P2, and the result value of the operation is written back to register c1 at time P3. Subsequently, instruction 2 is decoded at time P2 which is one time later than instruction 1, is processed at time P3, waits for memory access during the period of time P4 to P6, and stores the result value of the operation at register P1 at time P7. Write back to

また、命令3は、命令2よりも一時刻遅れた時刻P3においてデコードされ、時刻P4において処理され、時刻P5において演算の結果値をレジスタe1に書き戻す。ここで、この命令3の処理において参照されるレジスタd1の値は時刻P7まで待たなければ確定しない。そのため、時刻P5において命令3が読み出したレジスタd1の値は本来意図したものとは異なる値となり、命令3の演算が正しく行われない結果を招く。   The instruction 3 is decoded at a time P3 that is one time later than the instruction 2, is processed at a time P4, and writes the operation result value back to the register e1 at a time P5. Here, the value of the register d1 referred to in the processing of the instruction 3 is not fixed unless it waits until the time P7. Therefore, the value of the register d1 read by the instruction 3 at the time P5 becomes a value different from the originally intended value, resulting in the result that the operation of the instruction 3 is not performed correctly.

このように、実行ユニット22で実行された命令の結果を後続の命令が利用する場合、パイプライン制御回路16は、命令間の依存関係が高いと判断し、マスク信号MSKを出力する。そして、パイプライン制御回路16は、先に実行ユニット22で実行されている命令の処理が完了し、後続の命令を実行できる十分な準備ができるまで、マスク信号MSKにより後続の命令の発行を防止する。   As described above, when the subsequent instruction uses the result of the instruction executed by the execution unit 22, the pipeline control circuit 16 determines that the dependency between the instructions is high, and outputs the mask signal MSK. Then, the pipeline control circuit 16 prevents the subsequent instruction from being issued by the mask signal MSK until the processing of the instruction previously executed by the execution unit 22 is completed and sufficient preparation for executing the subsequent instruction is made. To do.

そこで、図5に示したタイミングチャートの処理においてマスク信号MSKが出力される場合の処理のタイミングチャートを図6に示す。図6に示すように、マスク信号MSKが出力される(マスク信号MSK=1となる)ことによって、命令3の実行ステージEXは、時刻P4〜P6の間待機の状態となり、時刻P7で実行される。これにより、命令2の書き戻しステージWBが行われる時刻P7を待って、命令3の実行ステージEXが行われる。これにより、命令3は、実行ステージEXにおいて本来意図した値をレジスタd1から読み出すことができる。   Therefore, FIG. 6 shows a timing chart of processing when the mask signal MSK is output in the processing of the timing chart shown in FIG. As shown in FIG. 6, when the mask signal MSK is output (mask signal MSK = 1), the execution stage EX of the instruction 3 is in a standby state between times P4 and P6 and is executed at time P7. The As a result, the execution stage EX of the instruction 3 is performed after the time P7 when the write back stage WB of the instruction 2 is performed. Thereby, the instruction 3 can read the value originally intended in the execution stage EX from the register d1.

このように、パイプライン制御回路16は、マスク信号MSKを用いることで、実行ユニット22において各演算が正しく行われるように、1つのハードウェアスレッド内の命令発行タイミングを制御する。なお、命令間の依存関係は、メモリ2へのロード/ストア命令以外の命令においても存在する場合がある。   In this manner, the pipeline control circuit 16 controls the instruction issue timing in one hardware thread so that each operation is correctly performed in the execution unit 22 by using the mask signal MSK. Note that there may be a dependency relationship between instructions even in an instruction other than a load / store instruction to the memory 2.

続いて、スレッドスケジューラ19を用いたマルチスレッドプロセッサ1の動作について説明する。図7に、マルチスレッドプロセッサ1の電源投入時から通常処理の開始までの動作の手順を示すフローチャートを示す。図7に示すように、マルチスレッドプロセッサ1は、電源が投入されるとまずハードウェアリセットにより回路の状態を初期化する(ステップS1)。続いて、マルチスレッドプロセッサ1は、シングルスレッドモードにおいて動作を開始する(ステップS2)。このシングルスレッドモードでは、例えば、スレッドプログラムカウンタTPC0、命令メモリ14、命令バッファ領域BUF0が活性化され、他のスレッドプログラムカウンタTPC1〜TPC3及び命令バッファ領域BUF1〜BUF3はスタンバイ状態のまま待機する。   Next, the operation of the multithread processor 1 using the thread scheduler 19 will be described. FIG. 7 is a flowchart showing a procedure of operations from when the multi-thread processor 1 is powered on until the start of normal processing. As shown in FIG. 7, when the power is turned on, the multi-thread processor 1 first initializes the circuit state by hardware reset (step S1). Subsequently, the multi-thread processor 1 starts operation in the single thread mode (step S2). In this single thread mode, for example, the thread program counter TPC0, the instruction memory 14, and the instruction buffer area BUF0 are activated, and the other thread program counters TPC1 to TPC3 and the instruction buffer areas BUF1 to BUF3 stand by in a standby state.

そして、マルチスレッドプロセッサ1は、管理プログラムをメモリ2又は図示しない他の記憶装置から読み出し、管理プログラムを実行する(ステップS3)。その後、管理プログラムに従って、マルチスレッドプロセッサ1は、カウンタ初期設定値格納部40にカウンタ初期設定値INITを設定(ステップS4)する。そして、ディスパッチカウンタ30a〜30dは、カウント値格納部41に格納されるカウント値CNTをカウンタ初期設定値INITにより初期化(ステップS5)する。これらの各種レジスタの設定が完了すると、マルチスレッドプロセッサ1はマルチスレッドモードにて動作を開始する(ステップS6)。このシングルスレッドモードでは、例えば、スレッドプログラムカウンタTPC0〜TCP3、命令メモリ14、命令バッファ領域BUF0〜BUF3が活性化される。そして、マルチスレッドプロセッサ1は、マルチスレッドモードにて通常動作を開始する。   Then, the multithread processor 1 reads the management program from the memory 2 or another storage device (not shown) and executes the management program (step S3). Thereafter, according to the management program, the multi-thread processor 1 sets the counter initial setting value INIT in the counter initial setting value storage unit 40 (step S4). Then, the dispatch counters 30a to 30d initialize the count value CNT stored in the count value storage unit 41 with the counter initial setting value INIT (step S5). When the setting of these various registers is completed, the multi-thread processor 1 starts operating in the multi-thread mode (step S6). In this single thread mode, for example, the thread program counters TPC0 to TCP3, the instruction memory 14, and the instruction buffer areas BUF0 to BUF3 are activated. Then, the multi-thread processor 1 starts normal operation in the multi-thread mode.

続いて、マルチスレッドプロセッサ1の通常動作時のスレッドスケジューラ19の動作について説明する。図8にスレッドスケジューラ19の通常動作時の動作を示すフローチャートを示す。なお、図8に示すフローチャートはディスパッチカウンタ30aの動作を中心に説明するものであるが、ディスパッチカウンタ30b〜30dも同様の動作となる。   Next, the operation of the thread scheduler 19 during normal operation of the multithread processor 1 will be described. FIG. 8 is a flowchart showing the operation of the thread scheduler 19 during normal operation. Note that the flowchart shown in FIG. 8 is described mainly with respect to the operation of the dispatch counter 30a, but the dispatch counters 30b to 30d also have the same operation.

図8に示すように、スレッドスケジューラ19は、まず、初期化判定部33において、カウント現在値Vnow0〜Vnow3が初期化条件を満たすか否かを判断する(ステップS10)。そして、ステップS10においてカウント現在値Vnow0〜Vnow3が初期か条件を満たすと判断された場合(ステップS10のYesの枝)、カウンタ初期設定値INIT0をカウント値CNT0とし、カウント値CNT0を初期化する(ステップS11)。一方、ステップS10においてカウント現在値Vnow0〜Vnow3が初期か条件を満たさないと判断された場合(ステップS10のNoの枝)、ステップS11の処理は行わずに次の処理に進む。   As shown in FIG. 8, the thread scheduler 19 first determines whether or not the count current values Vnow0 to Vnow3 satisfy the initialization condition in the initialization determination unit 33 (step S10). If it is determined in step S10 that the current count values Vnow0 to Vnow3 are initial or satisfy the condition (Yes in step S10), the counter initial setting value INIT0 is set to the count value CNT0, and the count value CNT0 is initialized ( Step S11). On the other hand, if it is determined in step S10 that the current count values Vnow0 to Vnow3 are initial or do not satisfy the condition (No branch in step S10), the process proceeds to the next process without performing the process in step S11.

次のステップでは、対応するマスク信号MSK0の値が0か否かを判断する(ステップS12)。このとき、マスク信号MSK0が0であった場合(ステップS12のYesの枝)、ディスパッチカウンタ30aは、ディスパッチカウント値DCNTとしてカウント値CNT0の値を出力する(ステップS13)。一方、ステップS12においてマスク信号MSK0が1であった場合(ステップS12のNoの枝)、ディスパッチカウンタ30aは、ディスパッチカウント値DCNTとしてマスク値の値を出力する(ステップS14)。   In the next step, it is determined whether or not the value of the corresponding mask signal MSK0 is 0 (step S12). At this time, if the mask signal MSK0 is 0 (Yes in step S12), the dispatch counter 30a outputs the count value CNT0 as the dispatch count value DCNT (step S13). On the other hand, when the mask signal MSK0 is 1 in step S12 (No branch in step S12), the dispatch counter 30a outputs the mask value as the dispatch count value DCNT (step S14).

次いで、スレッドスケジューラ19は、優先順位判定部31において、最も高い優先順位のディスパッチカウント値DCNTを出力しているディスパッチカウンタを判定し、高優先ハードウェアスレッド値MAXを出力する(ステップS15)。次いで、スレッドスケジューラ19は、スレッド番号選択部32において、高優先ハードウェアスレッド値MAXを出力するディスパッチカウンタに対応するハードウェアスレッドを選択し、選択したハードウェアスレッドを指定するスレッド選択信号TSELを出力する(ステップS16)。   Next, the thread scheduler 19 determines the dispatch counter that outputs the dispatch count value DCNT having the highest priority in the priority determination unit 31, and outputs the high priority hardware thread value MAX (step S15). Next, the thread scheduler 19 selects a hardware thread corresponding to the dispatch counter that outputs the high priority hardware thread value MAX in the thread number selection unit 32, and outputs a thread selection signal TSEL that designates the selected hardware thread. (Step S16).

次いで、マルチスレッドプロセッサ1は、スレッド選択信号TSELにより指定されたハードウェアスレッドに属する命令を実行し、実行された命令が属するハードウェアスレッドをディスパッチ信号DPTによりスレッドスケジューラ19に通知する。そして、ディスパッチカウンタ30aがディスパッチ信号DPT0を受け取った場合(ステップS17のYesの枝)には、ディスパッチカウンタ30aはカウント値CNT0をデクリメントする(ステップS18)。その後、スレッドスケジューラ19は、処理をステップS10に戻す。一方、ディスパッチカウンタ30aがディスパッチ信号DPT0を受け取らなかった場合(ステップS17のNoの枝)には、ディスパッチカウンタ30aはカウント値CNT0を更新しない。その後、スレッドスケジューラ19は、処理をステップS10に戻す。   Next, the multi-thread processor 1 executes an instruction belonging to the hardware thread designated by the thread selection signal TSEL, and notifies the thread scheduler 19 of the hardware thread to which the executed instruction belongs by the dispatch signal DPT. When the dispatch counter 30a receives the dispatch signal DPT0 (Yes in step S17), the dispatch counter 30a decrements the count value CNT0 (step S18). Thereafter, the thread scheduler 19 returns the process to step S10. On the other hand, when the dispatch counter 30a does not receive the dispatch signal DPT0 (No in step S17), the dispatch counter 30a does not update the count value CNT0. Thereafter, the thread scheduler 19 returns the process to step S10.

続いて、スレッドスケジューラ19が選択するスレッド番号がどのように切り替わるかを説明する表を図9に示す。図9に示す例では、スレッドの切り替わりタイミングを一時刻としている。また、ディスパッチカウンタ30a〜30dのカウンタ初期設定値をそれぞれ3、4、2、1とした。また、図9に示す例では、マスク信号MSKが常に0を示すものとする。図9に示す例では、時刻t1を初期状態とし、この時刻t1を処理の開始時刻とする。   Next, FIG. 9 shows a table for explaining how the thread number selected by the thread scheduler 19 is switched. In the example shown in FIG. 9, the thread switching timing is one time. In addition, the counter initial setting values of the dispatch counters 30a to 30d are 3, 4, 2, and 1, respectively. In the example shown in FIG. 9, it is assumed that the mask signal MSK always indicates 0. In the example shown in FIG. 9, the time t1 is set as an initial state, and the time t1 is set as the processing start time.

時刻t1では、ディスパッチカウント値DCNT0〜DCNT3はカウント値CNT0〜CNT3の値と同じ値となる。このとき、最大のディスパッチカウント値は、ディスパッチカウント値DCNT1が示す4である。そのため、スレッド番号選択部32は、ディスパッチカウント値DCNT1を出力するディスパッチカウンタ30bに対応する1番のハードウェアスレッドを示すスレッド選択信号TSELを出力する。そして、マルチスレッドプロセッサ1は、1番のハードウェアスレッドに属する命令を実行し、1番のハードウェアスレッドがディスパッチされたことを通知するディスパッチ信号DPT1を出力する。そのため、時刻t2では1番のハードウェアスレッドに対応するカウント値CNT1及びディスパッチカウント値DCNT1の値が1つデクリメントされる。   At time t1, the dispatch count values DCNT0 to DCNT3 are the same as the count values CNT0 to CNT3. At this time, the maximum dispatch count value is 4 indicated by the dispatch count value DCNT1. Therefore, the thread number selection unit 32 outputs a thread selection signal TSEL indicating the first hardware thread corresponding to the dispatch counter 30b that outputs the dispatch count value DCNT1. The multi-thread processor 1 executes an instruction belonging to the first hardware thread and outputs a dispatch signal DPT1 notifying that the first hardware thread has been dispatched. Therefore, at time t2, the count value CNT1 and the dispatch count value DCNT1 corresponding to the first hardware thread are decremented by one.

時刻t2では、ディスパッチカウント値DCNT0〜DCNT3はカウント値CNT0〜CNT3の値と同じ値となる。このとき、最大のディスパッチカウント値は、ディスパッチカウント値DCNT0及びディスパッチカウント値DCNT1が示す3である。このような場合、優先順位判定部31の比較器34は、より番号の小さなハードウェアスレッドに対応したディスパッチカウンタが出力するディスパッチカウント値を出力する。そのため、スレッド番号選択部32は、ディスパッチカウント値DCNT0を出力するディスパッチカウンタ30aに対応する0番のハードウェアスレッドを示すスレッド選択信号TSELを出力する。そして、マルチスレッドプロセッサ1は、0番のハードウェアスレッドに属する命令を実行し、0番のハードウェアスレッドがディスパッチされたことを通知するディスパッチ信号DPT0を出力する。そのため、時刻t3では0番のハードウェアスレッドに対応するカウント値CNT0及びディスパッチカウント値DCNT0の値が1つデクリメントされる。   At time t2, the dispatch count values DCNT0 to DCNT3 are the same as the count values CNT0 to CNT3. At this time, the maximum dispatch count value is 3 indicated by the dispatch count value DCNT0 and the dispatch count value DCNT1. In such a case, the comparator 34 of the priority determination unit 31 outputs a dispatch count value output by a dispatch counter corresponding to a hardware thread having a smaller number. Therefore, the thread number selection unit 32 outputs a thread selection signal TSEL indicating the 0th hardware thread corresponding to the dispatch counter 30a that outputs the dispatch count value DCNT0. The multi-thread processor 1 executes an instruction belonging to the 0th hardware thread and outputs a dispatch signal DPT0 notifying that the 0th hardware thread has been dispatched. Therefore, at time t3, the count value CNT0 and the dispatch count value DCNT0 corresponding to the 0th hardware thread are decremented by one.

以降、時刻t3〜t10においては、カウント値CNT及びディスパッチカウント値DCNTに応じて上記のような動作を繰り返す。そして、時刻t10の処理が行われることで、カウント値CNT0〜CNT3の値がすべて0になる。そのため、時刻t10の経過後に初期化判定部33による初期化処理が行われ、時刻t11のスレッドスケジューラ19の状態は時刻t1の状態にリセットされる。   Thereafter, at times t3 to t10, the above operation is repeated according to the count value CNT and the dispatch count value DCNT. Then, when the process at time t10 is performed, the count values CNT0 to CNT3 all become zero. Therefore, initialization processing by the initialization determination unit 33 is performed after the elapse of time t10, and the state of the thread scheduler 19 at time t11 is reset to the state of time t1.

続いて、スレッドスケジューラ19が選択するスレッド番号がどのように切り替わるかを説明する別の例を示す表を図10に示す。図10に示す例は、図9に示す例においてマスク信号MSKが1になる期間がある場合である。図10に示す例では時刻t1で選択された1番のハードウェアスレッドが実行されることで時刻t2〜t4において1番のハードウェアスレッドに対応するマスク信号MSK1が1となる。そのため、時刻t2〜t4の期間は1番のハードウェアスレッドの優先順位を示すディスパッチカウント値DCNT1が0(最低優先順位)となる。そのため、時刻t2〜t4の期間におけるスレッドスケジューラ19は、1番のハードウェアスレッド以外のハードウェアスレッドをそのときのディスパッチカウント値DCNTに応じて選択する。   Next, FIG. 10 shows a table showing another example for explaining how the thread number selected by the thread scheduler 19 is switched. The example shown in FIG. 10 is a case where there is a period in which the mask signal MSK is 1 in the example shown in FIG. In the example shown in FIG. 10, the first hardware thread selected at time t1 is executed, so that the mask signal MSK1 corresponding to the first hardware thread becomes 1 at times t2 to t4. Therefore, the dispatch count value DCNT1 indicating the priority order of the first hardware thread is 0 (lowest priority order) during the period from time t2 to time t4. Therefore, the thread scheduler 19 in the period from time t2 to t4 selects a hardware thread other than the first hardware thread according to the dispatch count value DCNT at that time.

また、図10に示す例では、時刻t12で選択された0番のハードウェアスレッドが実行されることで時刻t13〜t14において0番のハードウェアスレッドに対応するマスク信号MSK0が1となる。そのため、時刻t12〜t13の期間は0番のハードウェアスレッドの優先順位を示すディスパッチカウント値DCNT0が0(最低優先順位)となる。そのため、時刻t13〜t14の期間におけるスレッドスケジューラ19は、0番のハードウェアスレッド以外のハードウェアスレッドをそのときのディスパッチカウント値DCNTに応じて選択する。   In the example shown in FIG. 10, the mask signal MSK0 corresponding to the 0th hardware thread becomes 1 at times t13 to t14 by executing the 0th hardware thread selected at time t12. Therefore, during the period from time t12 to t13, the dispatch count value DCNT0 indicating the priority order of the 0th hardware thread is 0 (lowest priority order). Therefore, the thread scheduler 19 in the period from time t13 to t14 selects a hardware thread other than the 0th hardware thread according to the dispatch count value DCNT at that time.

また、図10に示す例では、時刻t13で選択された1番のハードウェアスレッドが実行されることで時刻t14〜t15において1番のハードウェアスレッドに対応するマスク信号MSK1が1となる。そのため、時刻t13〜t13の期間は1番のハードウェアスレッドの優先順位を示すディスパッチカウント値DCNT1が0(最低優先順位)となる。そのため、時刻t14〜t15の期間におけるスレッドスケジューラ19は、1番のハードウェアスレッド以外のハードウェアスレッドをそのときのディスパッチカウント値DCNTに応じて選択する。つまり、時刻t14の期間は0番のハードウェアスレッド及び1番のハードウェアスレッドが選択肢から除外される。   In the example shown in FIG. 10, the first hardware thread selected at time t13 is executed, so that the mask signal MSK1 corresponding to the first hardware thread becomes 1 at times t14 to t15. Therefore, during the period from time t13 to t13, the dispatch count value DCNT1 indicating the priority order of the first hardware thread is 0 (lowest priority order). Therefore, the thread scheduler 19 in the period from time t14 to t15 selects a hardware thread other than the first hardware thread according to the dispatch count value DCNT at that time. That is, the 0th hardware thread and the 1st hardware thread are excluded from the choices during the period of time t14.

上記説明より、本実施の形態にかかるマルチスレッドプロセッサ1において用いられるスレッドスケジューラ19は、各ハードウェアスレッドに対応した優先順位をディスパッチカウント値DCNTとして有する。そして、スレッドスケジューラ19は、ハードウェアスレッドの優先順位に応じていずれか1つのハードウェアスレッドを選択し、選択したハードウェアスレッドを示すスレッド選択信号TSELを出力する。さらに、スレッドスケジューラ19は、選択したハードウェアスレッドが実行されたことをディスパッチ信号DPTにより認識し、ディスパッチ信号DPTに応じてハードウェアスレッドの優先順位を更新する。より具体的には、スレッドスケジューラ19は、最も高い優先順位のハードウェアスレッドを選択し、選択したハードウェアスレッドを示すスレッド選択信号TSELを出力する。そして、スレッドスケジューラ19は、選択したハードウェアスレッドが実行されたことをディスパッチ信号DPTにより認識し、ディスパッチ信号DPTに応じてハードウェアスレッドの優先順位を下げる。   From the above description, the thread scheduler 19 used in the multi-thread processor 1 according to the present embodiment has the priority corresponding to each hardware thread as the dispatch count value DCNT. Then, the thread scheduler 19 selects any one of the hardware threads according to the priority order of the hardware threads, and outputs a thread selection signal TSEL indicating the selected hardware thread. Further, the thread scheduler 19 recognizes that the selected hardware thread has been executed by the dispatch signal DPT, and updates the priority order of the hardware thread in accordance with the dispatch signal DPT. More specifically, the thread scheduler 19 selects a hardware thread with the highest priority, and outputs a thread selection signal TSEL indicating the selected hardware thread. The thread scheduler 19 recognizes that the selected hardware thread has been executed by the dispatch signal DPT, and lowers the priority of the hardware thread in accordance with the dispatch signal DPT.

これにより、本実施の形態にかかるスレッドスケジューラ19は、初期状態において高い優先順位のハードウェアスレッドを優先的に選択しながら、その後も高い優先順位を維持させることがない。そのため、スレッドスケジューラ19は、初期状態において優先順位の高いハードウェアスレッドを実行しながら他のハードウェアスレッドの実行期間も確保することができる。つまり、本実施の形態にかかるスレッドスケジューラ19を用いたマルチスレッドプロセッサ1は、複数の優先順位を有するハードウェアスレッドを交互に実行しながら、優先順位の高いハードウェアスレッドに対してはより多くの処理時間を割り当てることができる。言い換えると、本実施の形態にかかるマルチスレッドプロセッサ1は、ハードウェアスレッドの優先順位の初期状態に関わりなく複数のハードウェアスレッドを滞りなく実行することができる。   Thereby, the thread scheduler 19 according to the present embodiment preferentially selects a hardware thread with a high priority in the initial state, and does not maintain a high priority thereafter. Therefore, the thread scheduler 19 can secure the execution period of other hardware threads while executing the hardware threads with high priority in the initial state. That is, the multi-thread processor 1 using the thread scheduler 19 according to the present embodiment alternately executes hardware threads having a plurality of priorities, and more hardware threads having higher priorities. Processing time can be assigned. In other words, the multi-thread processor 1 according to the present embodiment can execute a plurality of hardware threads without delay regardless of the initial state of the priority order of the hardware threads.

図9において示した例について説明すると、初期状態において高い優先度を有する1番のハードウェアスレッドは、時刻t1〜t10の期間のうち40%の処理時間を有し、他のハードウェアスレッドよりも多くの処理時間を確保する。このとき、本実施の形態にかかるマルチスレッドプロセッサ1では、1番のハードウェアスレッドの実行時間が続くことなく、1番のハードウェアスレッドと他のハードウェアスレッドが交互に実行される。つまり、本実施の形態にかかるマルチスレッドプロセッサ1では、処理時間がいずれか1つのハードウェアスレッドの時間に偏ることなく、複数のハードウェアスレッドが滞りなく実行される。   The example shown in FIG. 9 will be described. The first hardware thread having a high priority in the initial state has a processing time of 40% in the period from the time t1 to the time t10, and more than the other hardware threads. A lot of processing time is secured. At this time, in the multi-thread processor 1 according to the present embodiment, the first hardware thread and other hardware threads are alternately executed without the execution time of the first hardware thread continuing. That is, in the multi-thread processor 1 according to the present embodiment, a plurality of hardware threads are executed without delay without the processing time being biased to the time of any one hardware thread.

また、本実施の形態にかかるマルチスレッドプロセッサ1では、実行ユニット22の実行ステージの利用効率(又は、パイプラインの利用効率)を高めることができる。より具体的には、本実施の形態にかかるスレッドスケジューラ19は、パイプラインの状態に起因して本来予定していたハードウェアスレッドを選択できない場合、パイプラインの状態をマスク信号MSKにより認識する。そして、スレッドスケジューラ19は、マスク信号MSKにより通知されたハードウェアスレッドとは異なるハードウェアスレッドを選択する。これにより、パイプラインに空きステージが生じる可能性がある箇所に他のハードウェアスレッドに属する命令を与えることができるため、本実施の形態にかかるマルチスレッドプロセッサ1ではパイプラインの利用効率を高めることができる。   Further, in the multithread processor 1 according to the present embodiment, the utilization efficiency of the execution stage of the execution unit 22 (or the utilization efficiency of the pipeline) can be improved. More specifically, when the originally scheduled hardware thread cannot be selected due to the pipeline state, the thread scheduler 19 according to the present embodiment recognizes the pipeline state by the mask signal MSK. Then, the thread scheduler 19 selects a hardware thread different from the hardware thread notified by the mask signal MSK. Thereby, since an instruction belonging to another hardware thread can be given to a place where an empty stage may occur in the pipeline, the multi-thread processor 1 according to the present embodiment increases the utilization efficiency of the pipeline. Can do.

実施の形態2
実施の形態2にかかるマルチスレッドプロセッサ1aのブロック図を図11に示す。図11に示すようにマルチスレッドプロセッサ1aは、実施の形態1におけるスレッドスケジューラ19をスレッドスケジューラ19の変形例となるスレッドスケジューラ19aに置き換えたものである。そのため、以下の説明では、スレッドスケジューラ19aを中心に説明し、他の構成要素の説明は省略する。
Embodiment 2
FIG. 11 is a block diagram of the multithread processor 1a according to the second embodiment. As shown in FIG. 11, the multi-thread processor 1 a is obtained by replacing the thread scheduler 19 in the first embodiment with a thread scheduler 19 a that is a modification of the thread scheduler 19. Therefore, in the following description, the thread scheduler 19a will be mainly described, and description of other components will be omitted.

図12にスレッドスケジューラ19aのブロック図を示す。図12に示すように、スレッドスケジューラ19aは、第3のセレクタ(例えば、セレクタ50)、第1のスレッドスケジューラ19、第2のスレッドスケジューラ51を有する。セレクタ50は、実時間ビット信号の信号レベルに応じて第1のスレッドスケジューラ19が出力する第1のスレッド選択信号TSELaと第2のスレッドスケジューラ51が出力する第1のスレッド選択信号TSELbとのいずれか一方を選択して、選択したスレッド選択信号を第1のセレクタ18に与えるスレッド選択信号TSELとして出力する。なお、第1のスレッド選択信号TSELaは、実施の形態1において説明したスレッド選択信号TSELと同じものである。ここでは、スレッド選択信号を区別するために、便宜的に第1のスレッドスケジューラ19が出力するスレッド選択信号を第1のスレッド選択信号TSELaと称す。第1のスレッドスケジューラは、実施の形態1におけるスレッドスケジューラ19と同じものであるため、ここでは説明を省略する。   FIG. 12 shows a block diagram of the thread scheduler 19a. As illustrated in FIG. 12, the thread scheduler 19 a includes a third selector (for example, the selector 50), the first thread scheduler 19, and the second thread scheduler 51. The selector 50 selects either the first thread selection signal TSELa output from the first thread scheduler 19 or the first thread selection signal TSELb output from the second thread scheduler 51 according to the signal level of the real-time bit signal. One of them is selected, and the selected thread selection signal is output as a thread selection signal TSEL to be supplied to the first selector 18. The first thread selection signal TSELa is the same as the thread selection signal TSEL described in the first embodiment. Here, in order to distinguish the thread selection signals, for convenience, the thread selection signal output by the first thread scheduler 19 is referred to as a first thread selection signal TSELa. Since the first thread scheduler is the same as the thread scheduler 19 in the first embodiment, the description thereof is omitted here.

第2のスレッドスケジューラ51は、第1の実行期間と第2の実行期間とを切り替える選択信号(例えば、実時間ビット信号)を出力すると共に、実時間ビット信号が第1の実行期間を指定している期間において予め設定された実行順序で実行されるハードウェアスレッドを指定する第1のハードウェアスレッド番号(例えば第2のスレッド選択信号TSELb)を出力する。ここで、第1の実行期間とは、後述する実時間ビット信号が1である期間であり、第2の実行期間とは、後述する実時間ビット信号が0である期間をいう。また、第1の実行期間においては、選択されるハードウェアスレッド番号が予め設定されており、第2の実行期間においては、選択されるハードウェアスレッド番号が例えば、第1のスレッドスケジューラ19により任意に設定される。この第2のスレッドスケジューラ51は、スレッド制御レジスタ52、カウンタ53、カウント最大値格納部54、一致比較回路55、セレクタ56を有する。   The second thread scheduler 51 outputs a selection signal (for example, a real-time bit signal) for switching between the first execution period and the second execution period, and the real-time bit signal specifies the first execution period. A first hardware thread number (for example, a second thread selection signal TSELb) that designates a hardware thread that is executed in a preset execution order in a certain period is output. Here, the first execution period is a period in which a real-time bit signal described later is 1, and the second execution period is a period in which a real-time bit signal described later is 0. In the first execution period, the hardware thread number to be selected is set in advance, and in the second execution period, the hardware thread number to be selected is arbitrarily set by the first thread scheduler 19, for example. Set to The second thread scheduler 51 includes a thread control register 52, a counter 53, a maximum count value storage unit 54, a coincidence comparison circuit 55, and a selector 56.

スレッド制御レジスタ52は、複数のスロット(例えば、スロットSLT0〜SLT7)を備える。このスロットの構成を図13に示す。図13に示すように、スロットSLT0〜SLT7は、それぞれハードウェアスレッド番号HWTが格納される番号格納部と、当該スロットが選択された場合における実時間ビット信号の論理レベルを決定する期間属性設定フラグ(例えば実時間ビットRT)が格納される実時間ビット格納部とを有する。   The thread control register 52 includes a plurality of slots (for example, slots SLT0 to SLT7). The structure of this slot is shown in FIG. As shown in FIG. 13, the slots SLT0 to SLT7 each have a number storage unit in which the hardware thread number HWT is stored, and a period attribute setting flag that determines the logical level of the real-time bit signal when the slot is selected. A real-time bit storage unit (for example, real-time bit RT).

カウンタ53は、所定の間隔でカウント値CNTを更新する。より具体的には、本実施の形態におけるカウンタ53は、図示しないマルチスレッドプロセッサ1の動作クロックに同期してカウント値CNTaをカウントアップする。カウント最大値格納部54は、カウンタ53のカウント値CNTaの上限値を定めるカウント最大値CNTMを格納する。一致比較回路55は、カウント値CNTaとカウント最大値CNTMとを比較し、カウント値CNTとカウント最大値CNTMが一致した場合に、カウンタ53のカウント値CNTaをリセットするリセット信号RSTを出力する。つまり、カウンタ53は、所定の周期でカウント値CNTaを初期化しながら、カウントアップ動作を繰り返すことで、循環的に値が更新されるカウント値CNTaを出力する。   The counter 53 updates the count value CNT at a predetermined interval. More specifically, the counter 53 in the present embodiment counts up the count value CNTa in synchronization with an operation clock of the multi-thread processor 1 (not shown). The count maximum value storage unit 54 stores a count maximum value CNTM that defines an upper limit value of the count value CNTa of the counter 53. The coincidence comparison circuit 55 compares the count value CNTa with the maximum count value CNTM, and outputs a reset signal RST that resets the count value CNTa of the counter 53 when the count value CNT matches the maximum count value CNTM. That is, the counter 53 outputs the count value CNTa whose value is cyclically updated by repeating the count-up operation while initializing the count value CNTa at a predetermined cycle.

セレクタ56は、カウント値CNTaに応じてスレッド制御レジスタ52内のスロットの1つを選択し、選択したスロットに格納される値に基づき実時間ビット信号と第2のスレッド選択信号TSELbを出力する。より具体的には、セレクタ56は、カウント値CNTaが0であればスロットSLT0を選択し、スロットSLT0の番号格納部に格納されたハードウェアスレッド番号を第2のスレッド選択信号TSELbとし、スロットSLT0の実時間ビット格納部に格納される実時間ビットRTの値を実時間ビット信号の論理レベルとする。   The selector 56 selects one of the slots in the thread control register 52 according to the count value CNTa, and outputs a real-time bit signal and the second thread selection signal TSELb based on the value stored in the selected slot. More specifically, if the count value CNTa is 0, the selector 56 selects the slot SLT0, sets the hardware thread number stored in the number storage unit of the slot SLT0 as the second thread selection signal TSELb, and sets the slot SLT0. The value of the real-time bit RT stored in the real-time bit storage unit is used as the logic level of the real-time bit signal.

なお、第2のスレッドスケジューラ51のスレッド制御レジスタ52のスロットに格納される値、カウンタ53のカウント値CNTaの初期値、カウント最大値格納部54のカウント最大値CNTMは、マルチスレッドプロセッサ1の起動時に実行される管理プログラムにより設定される。また、管理プログラムは、メモリ2からこれら設定値を読み込むものとする。   Note that the value stored in the slot of the thread control register 52 of the second thread scheduler 51, the initial value of the count value CNTa of the counter 53, and the maximum count value CNTM of the maximum count value storage unit 54 are the activation of the multi-thread processor 1. It is set by a management program that is sometimes executed. The management program reads these setting values from the memory 2.

次に、通常動作開始後のスレッドスケジューラ19aの動作について説明する。まず、第2のスレッドスケジューラ51のみの動作について説明する。なお、以下の説明では、設定の一例として、カウンタ53のカウント値CNTの初期値を0、カウント最大値CNTMを4とする。また、スレッド制御レジスタ52のスロットの各値は、スロットSLT0〜SLT2、SLT4、SLT5、SLT7の実時間ビットを1とし、スロットSLT3、SLT6の実時間ビットを0とする。さらに、スロットSLT0、SLT2、SLT5、SLT7のハードウェアスレッド番号を0、スロットSLT1、SLT4のハードウェアスレッド番号を1、スロットSLT3のハードウェアスレッド番号を2とする。   Next, the operation of the thread scheduler 19a after starting the normal operation will be described. First, the operation of only the second thread scheduler 51 will be described. In the following description, as an example of the setting, the initial value of the count value CNT of the counter 53 is 0, and the maximum count value CNTM is 4. Each value of the slot of the thread control register 52 sets the real time bits of the slots SLT0 to SLT2, SLT4, SLT5, and SLT7 to 1, and sets the real time bits of the slots SLT3 and SLT6 to 0. Furthermore, the hardware thread number of the slots SLT0, SLT2, SLT5, and SLT7 is 0, the hardware thread number of the slots SLT1 and SLT4 is 1, and the hardware thread number of the slot SLT3 is 2.

上記条件において第2のスレッドスケジューラ51が出力する第2のスレッド選択信号TSELbが選択するハードウェアスレッド番号を図14の表に示す。図14の表では、第2のスレッドスケジューラ51が選択するハードウェアスレッドを切り替える一タイミングを一時刻とし、時刻の経過と共に第2のスレッド選択信号TSELbがどのように切り替わるかを示した。   The hardware thread numbers selected by the second thread selection signal TSELb output from the second thread scheduler 51 under the above conditions are shown in the table of FIG. In the table of FIG. 14, one timing for switching the hardware thread selected by the second thread scheduler 51 is defined as one time, and the second thread selection signal TSELb is switched as time passes.

図15に示すように、まず時刻t1におけるカウント値CNTが0とすると、セレクタ56は、スロットSLT0を選択する。従って、セレクタ56は、実時間ビット信号の論理レベルを1とし、第2のスレッド選択信号TSELbを0番とする。続いて、時刻t2ではカウント値CNTが1にカウントアップされる。そのため、セレクタ56は、スロットSLT1を選択する。従って、セレクタ56は、実時間ビット信号の論理レベルを1とし、第2のスレッド選択信号TSELbを1番とする。次いで、時刻t3ではカウント値CNTが2にカウントアップされる。そのため、セレクタ56は、スロットSLT2を選択する。従って、セレクタ56は、実時間ビット信号の論理レベルを0とし、第2のスレッド選択信号TSELbを1番とする。次いで、時刻t4ではカウント値CNTが3にカウントアップされる。そのため、セレクタ56は、スロットSLT3を選択する。従って、セレクタ56は、実時間ビット信号の論理レベルを1とし、第2のスレッド選択信号TSELbを2番とする。次いで、時刻t5ではカウント値CNTが4にカウントアップされる。そのため、セレクタ56は、スロットSLT4を選択する。従って、セレクタ56は、実時間ビット信号の論理レベルを1とし、第2のスレッド選択信号TSELbを1番とする。そして、時刻t5では、カウント値CNTaがカウント最大値CNTMに達するため、時刻t6の経過後にカウント値CNTaはリセットされる。これにより、時刻t6〜t10の期間の第2のスレッドスケジューラ51は、時刻t1〜t5の動作を繰り返すことになる。   As shown in FIG. 15, when the count value CNT at time t1 is first 0, the selector 56 selects the slot SLT0. Accordingly, the selector 56 sets the logic level of the real-time bit signal to 1 and sets the second thread selection signal TSELb to 0. Subsequently, at time t2, the count value CNT is incremented to 1. Therefore, the selector 56 selects the slot SLT1. Accordingly, the selector 56 sets the logic level of the real-time bit signal to 1 and sets the second thread selection signal TSELb to No. 1. Next, at time t3, the count value CNT is incremented to 2. Therefore, the selector 56 selects the slot SLT2. Accordingly, the selector 56 sets the logic level of the real-time bit signal to 0 and sets the second thread selection signal TSELb to No. 1. Next, at time t4, the count value CNT is counted up to 3. Therefore, the selector 56 selects the slot SLT3. Therefore, the selector 56 sets the logic level of the real-time bit signal to 1 and sets the second thread selection signal TSELb to No. 2. Next, the count value CNT is counted up to 4 at time t5. Therefore, the selector 56 selects the slot SLT4. Accordingly, the selector 56 sets the logic level of the real-time bit signal to 1 and sets the second thread selection signal TSELb to No. 1. At time t5, the count value CNTa reaches the maximum count value CNTM, so that the count value CNTa is reset after the elapse of time t6. As a result, the second thread scheduler 51 in the period from time t6 to t10 repeats the operation from time t1 to t5.

実施の形態2では、第1のスレッドスケジューラ19は、第2のスレッドスケジューラ51により指定される第2の実行期間において実行するハードウェアスレッドの選択を行う。そこで、実施の形態2にかかるスレッドスケジューラ19aの動作を示す表を図15に示す。なお、図15に示した例は、第2のスレッドスケジューラ51の設定値として図14において示した条件を用いる。また、第1のスレッドスケジューラ19のカウンタ初期設定値は、0番のハードウェアスレッドから3番のハードウェアスレッドの順に2、1、3、4とする。つまり、この例における第1のスレッドスケジューラでは、第2のスレッドスケジューラ51において実行が予定されていないハードウェアスレッドの優先順位を他のハードウェアスレッドよりも高くする。   In the second embodiment, the first thread scheduler 19 selects a hardware thread to be executed in the second execution period specified by the second thread scheduler 51. Therefore, FIG. 15 shows a table showing the operation of the thread scheduler 19a according to the second embodiment. The example shown in FIG. 15 uses the condition shown in FIG. 14 as the setting value of the second thread scheduler 51. In addition, the counter initial setting values of the first thread scheduler 19 are 2, 1, 3, and 4 in order from the 0th hardware thread to the 3rd hardware thread. That is, in the first thread scheduler in this example, the priority of the hardware thread that is not scheduled to be executed in the second thread scheduler 51 is set higher than that of other hardware threads.

図15に示すように、第2のスレッドスケジューラ51は、時刻t3、t9、t13、t18において実時間ビット信号(図中のRT)を0とする。そのため、スレッドスケジューラ19aは、時刻t3、t9、t13、t18において第1のスレッドスケジューラ19が出力する第1のスレッド選択信号TSELaを用いる。このとき、時刻t3、t9、t13、t18のいずれのタイミングにおいても3番目のハードウェアスレッドに対応するディスパッチカウント値が最も大きくなるため、第1のスレッド選択信号TSELaは、時刻t3、t9、t13、t18のいずれ他のタイミングにおいても3番のハードウェアスレッドを指定する。   As shown in FIG. 15, the second thread scheduler 51 sets the real-time bit signal (RT in the figure) to 0 at times t3, t9, t13, and t18. Therefore, the thread scheduler 19a uses the first thread selection signal TSELa output from the first thread scheduler 19 at times t3, t9, t13, and t18. At this time, since the dispatch count value corresponding to the third hardware thread becomes the largest at any timing of times t3, t9, t13, and t18, the first thread selection signal TSELa is set at times t3, t9, and t13. , T18 designates the third hardware thread at any other timing.

なお、第1のスレッドスケジューラ19には、第2のスレッドスケジューラ51が出力する第2のスレッド選択信号TSELbに基づき実行されたハードウェアスレッドがディスパッチ信号DPTにより通知される。そのため、時刻t1〜t18の期間においてカウント値CNT0〜CNT3が減少する。このときカウント値CNT0〜CNT3は0を下限としてそれ以上減少しないものとする。   The first thread scheduler 19 is notified of the hardware thread executed based on the second thread selection signal TSELb output from the second thread scheduler 51 by the dispatch signal DPT. Therefore, the count values CNT0 to CNT3 decrease during the period from time t1 to t18. At this time, the count values CNT <b> 0 to CNT <b> 3 do not decrease any more with 0 as the lower limit.

上記説明より、実施の形態2にかかるスレッドスケジューラ19aでは、第1のスレッドスケジューラ19を、第2のスレッドスケジューラ51において第2の実行期間が指定された場合のスレッド選択信号を生成するために用いる。このとき、第1のスレッドスケジューラでは、第2のスレッドスケジューラ51の動作に基づき実行されたハードウェアスレッドの回数を反映してハードウェアスレッドの優先順位が変動する。そのため、第2のスレッドスケジューラ51に第1のスレッドスケジューラ19を組み合わせることで、第2のスレッドスケジューラ51において実行回数の少ないハードウェアスレッドを第1のスレッドスケジューラ19により指定することができる。   From the above description, in the thread scheduler 19a according to the second embodiment, the first thread scheduler 19 is used to generate a thread selection signal when the second execution period is designated in the second thread scheduler 51. . At this time, in the first thread scheduler, the priority order of the hardware threads changes reflecting the number of hardware threads executed based on the operation of the second thread scheduler 51. Therefore, by combining the first thread scheduler 19 with the second thread scheduler 51, the first thread scheduler 19 can specify a hardware thread with a small number of executions in the second thread scheduler 51.

また、第2のスレッドスケジューラ19では、第1の実行期間において実行されるハードウェアスレッドが固定されているため、ハードウェアスレッドの優先順位にかかわらずハードウェアスレッドの最低実行時間を保証することができる。つまり、実施の形態2にかかるマルチスレッドプロセッサ1aによれば、第2のスレッドスケジューラ51により第1の実行期間を指定することでハードウェアスレッドの最低実行時間を保証する。そして、第2の実行期間において第1のスレッドスケジューラ19によるハードウェアスレッドの選択を行うことで、第2の実行期間に実行頻度の低いハードウェアスレッドを優先的に選択することができる。つまり、実施の形態2にかかるマルチスレッドプロセッサ1aによれば、ハードウェアスレッドの最低実行時間を保証しながら、処理が滞るハードウェアスレッドの発生を防止することができる。   Further, in the second thread scheduler 19, since the hardware thread executed in the first execution period is fixed, the minimum execution time of the hardware thread can be guaranteed regardless of the priority order of the hardware thread. it can. That is, according to the multithread processor 1a according to the second embodiment, the first execution period is designated by the second thread scheduler 51 to guarantee the minimum execution time of the hardware thread. Then, by selecting a hardware thread by the first thread scheduler 19 in the second execution period, it is possible to preferentially select a hardware thread having a low execution frequency in the second execution period. That is, according to the multithread processor 1a according to the second embodiment, it is possible to prevent the occurrence of hardware threads that are delayed in processing while guaranteeing the minimum execution time of the hardware threads.

なお、本発明は上記実施の形態に限られたものではなく、趣旨を逸脱しない範囲で適宜変更することが可能である。例えば、第2のスケジューラにおけるスレッドのスケジューリング方法は、マルチスレッドプロセッサの仕様に応じて適宜変更することが可能である。   Note that the present invention is not limited to the above-described embodiment, and can be changed as appropriate without departing from the spirit of the present invention. For example, the thread scheduling method in the second scheduler can be appropriately changed according to the specifications of the multi-thread processor.

1、1a マルチスレッドプロセッサ
2 メモリ
10 演算回路
11 コントローラ
12 PC生成回路
13、18、43、50、56 セレクタ
14 命令メモリ
15 命令バッファ
16 パイプライン制御回路
17 命令フェッチコントローラ
19、19a、51 スレッドスケジューラ
21 命令デコーダ
22 実行ユニット
23 データレジスタ
30a〜30d ディスパッチカウンタ
31 優先順位判定部
32 スレッド番号選択部
33 初期化判定部
34〜36 比較器
40 カウンタ初期設定値格納部
41 カウント値格納部
42 デクリメンタ
52 スレッド制御レジスタ
53 カウンタ
54 カウント最大値格納部
55 一致比較回路
TPC0〜TCP3 スレッドプログラムカウンタ
BUF0〜BUF3 命令バッファ領域
IMadd 命令フェッチアドレス
Radd データレジスタアドレス
SC 演算制御信号
TSEL、TSELa、TSELb スレッド選択信号
DPT、DPT0〜DPT3 ディスパッチ信号
MSK、MSK0〜MSK3 マスク信号
M1、M2、MAX 高優先ハードウェアスレッド値
CNTint 初期化信号
Vnow0〜Vnow3 カウント現在値
CNT、CNT0〜CNT3、CNTa カウント値
DCNT、DCNT0〜DCNT3 ディスパッチカウント値
INIT0 カウンタ初期設定値
DCR0 書き戻し値
CNTM カウント最大値
RST リセット信号
HWT ハードウェアスレッド番号
RT 実時間ビット
SLT0〜SLT7 スロット
1, 1a Multi-thread processor 2 Memory 10 Arithmetic circuit 11 Controller 12 PC generation circuit 13, 18, 43, 50, 56 Selector 14 Instruction memory 15 Instruction buffer 16 Pipeline control circuit 17 Instruction fetch controller 19, 19a, 51 Thread scheduler 21 Instruction decoder 22 Execution unit 23 Data registers 30a-30d Dispatch counter 31 Priority determination unit 32 Thread number selection unit 33 Initialization determination unit 34-36 Comparator 40 Counter initial setting value storage unit 41 Count value storage unit 42 Decrementer 52 Thread control Register 53 Counter 54 Count maximum value storage 55 Match comparison circuits TPC0 to TCP3 Thread program counter BUF0 to BUF3 Instruction buffer area IMadd Instruction fetch address R dd Data register address SC Operation control signal TSEL, TSELa, TSELb Thread selection signal DPT, DPT0-DPT3 Dispatch signal MSK, MSK0-MSK3 Mask signal M1, M2, MAX High priority hardware thread value CNTint Initialization signal Vnow0-Vnow3 Count Current Value CNT, CNT0 to CNT3, CNTa Count value DCNT, DCNT0 to DCNT3 Dispatch count value INIT0 Counter initial setting value DCR0 Write back value CNTM Count maximum value RST Reset signal HWT Hardware thread number RT Real time bits SLT0 to SLT7 Slot

Claims (8)

それぞれが独立した命令流を生成する複数のハードウェアスレッドと、
予め前記複数のハードウェアスレッドのそれぞれに対して設定された優先順位に応じて、前記複数のハードウェアスレッドのうち次実行サイクルにおいて選択されるハードウェアスレッドを指定するスレッド選択信号を出力する第1のスレッドスケジューラと、
前記スレッド選択信号に応じて前記複数のハードウェアスレッドのいずれか1つを選択して選択したハードウェアスレッドにより生成された命令を出力する第1のセレクタと、
前記第1のセレクタから出力される命令を実行する演算回路と、を有し、
前記第1のスレッドスケジューラは、
前記優先順位に従ってハードウェアスレッドを決定する第2のスレッドスケジューラと、
各スロットが前記複数のハードウェアスレッドうちの1つを指定する第1の情報又は前記第2のスレッドスケジューラを指定する第2の情報を保持する複数のスロットを含むスレッド制御レジスタと、
前記複数のスロットのうちの1つを指定する第3の情報を格納する格納部と、を有し、
前記スレッド制御レジスタの前記複数のスロットの第1のスロットからスロットを順々に選択し、前記格納部により指定されたスロットを選択したときには、前記第1のスロットに戻ってスロットを再び順次選択し、
選択されたスロットが前記第1の情報を保持しているときは当該第1の情報の指定するハードウェアスレッドを選択して前記スレッド選択信号を出力し、
選択されたスロットが前記第2の情報を保持しているときは前記第2のスレッドスケジューラにより決定されるハードウェアスレッドを選択して前記スレッド選択信号を出力し、
前記第2のスレッドスケジューラは
前記優先順位が高い前記ハードウェアスレッドを優先的に選択して前記スレッド選択信号を出力し、
前記スレッド選択信号により選択されたハードウェアスレッドにより生成される前記命令が前記演算回路において実行される度に、実行された前記命令を生成した前記ハードウェアスレッドに対する前記優先順位を低下させる更新を行い
更新後の前記優先順位に従って前記スレッド選択信号を出力するマルチスレッドプロセッサ。
Multiple hardware threads, each generating independent instruction streams;
A first thread selection signal for designating a hardware thread to be selected in the next execution cycle from among the plurality of hardware threads in accordance with a priority set in advance for each of the plurality of hardware threads. Thread scheduler,
A first selector that selects one of the plurality of hardware threads according to the thread selection signal and outputs an instruction generated by the selected hardware thread;
An arithmetic circuit that executes an instruction output from the first selector ,
The first thread scheduler is
A second thread scheduler that determines hardware threads according to the priority;
A thread control register including a plurality of slots each holding first information designating one of the plurality of hardware threads or second information designating the second thread scheduler;
A storage unit for storing third information for designating one of the plurality of slots;
When a slot is sequentially selected from the first slots of the plurality of slots of the thread control register and a slot designated by the storage unit is selected, the slot is returned to the first slot and the slot is sequentially selected again. ,
When the selected slot holds the first information, select a hardware thread designated by the first information and output the thread selection signal;
When the selected slot holds the second information, the hardware thread determined by the second thread scheduler is selected and the thread selection signal is output,
The second thread scheduler,
Preferentially select the hardware thread with the higher priority and output the thread selection signal;
Each time the instruction generated by the hardware thread selected by the thread selection signal is executed in the arithmetic circuit, an update is performed to lower the priority for the hardware thread that generated the executed instruction. ,
A multi-thread processor that outputs the thread selection signal in accordance with the updated priority order .
前記第2のスレッドスケジューラは、前記優先順位の更新処理を行う毎に前記優先順位を1段階ずつ低下させる請求項に記載のマルチスレッドプロセッサ。 2. The multi-thread processor according to claim 1 , wherein the second thread scheduler lowers the priority by one step each time the priority update processing is performed. 前記第2のスレッドスケジューラは、同一の前記優先順位を有する前記ハードウェアスレッドが複数存在する場合、予め設定されたルールに従っていずれか1つの前記ハードウェアスレッドを選択し、選択した前記ハードウェアスレッドを指定する前記スレッド選択信号を出力する請求項1又は2に記載のマルチスレッドプロセッサ。 When there are a plurality of hardware threads having the same priority, the second thread scheduler selects any one of the hardware threads according to a preset rule, and selects the selected hardware thread. multithreaded processor according to claim 1 or 2 outputs the thread selection signal designating. 前記第2のスレッドスケジューラは、前記複数のハードウェアスレッドにおいて準備されている前記命令が前記演算回路において実行されている前記命令の処理結果を利用する依存関係の高い命令であった場合、前記依存関係の高い命令を含む前記ハードウェアスレッドの前記優先順位を最低優先順位とする請求項1乃至3のいずれか1項に記載のマルチスレッドプロセッサ。 The second thread scheduler, when the instruction prepared in the plurality of hardware threads is a highly dependent instruction using a processing result of the instruction being executed in the arithmetic circuit, The multithread processor according to any one of claims 1 to 3 , wherein the priority of the hardware thread including a highly related instruction is set to the lowest priority . 前記第2のスレッドスケジューラは、
それぞれが対応する前記ハードウェアスレッドに対する前記優先順位に相当するディスパッチカウント値を保持する複数のディスパッチカウンタと、
前記複数のディスパッチカウンタで保持される前記ディスパッチカウント値を参照し、最も優先順位の高い前記ハードウェアスレッドを判定する優先順位判定部と、
前記優先順位判定部において最も優先順位が高いと判定されたハードウェアスレッドを指定する前記スレッド選択信号を出力するスレッド番号選択部と、を備え、
前記演算回路は、実行された前記命令を生成した前記ハードウェアスレッドを通知するディスパッチ信号を前記ハードウェアスレッドが生成した前記命令を実行する度に出力し、
前記複数のディスパッチカウンタは、前記ディスパッチ信号が自ディスパッチカウンタに対応する前記ハードウェアスレッドを示す場合に自ディスパッチカウンタが出力する前記ディスパッチカウント値を更新する請求項1乃至4のいずれか1項に記載のマルチスレッドプロセッサ。
The second thread scheduler is
A plurality of dispatch counters each holding a dispatch count value corresponding to the priority for the corresponding hardware thread;
A priority determination unit that refers to the dispatch count value held by the plurality of dispatch counters and determines the hardware thread having the highest priority;
A thread number selection unit that outputs the thread selection signal that specifies a hardware thread that is determined to have the highest priority in the priority determination unit, and
The arithmetic circuit outputs a dispatch signal that notifies the hardware thread that generated the executed instruction each time the hardware thread generates the instruction,
Wherein the plurality of dispatch counter according to any one of claims 1 to 4 wherein the dispatch signal to update the dispatch count value own dispatch counter outputs to indicate the hardware thread corresponding to its own dispatch counter Multi-threaded processor.
前記複数のディスパッチカウンタにおいて保持されるディスパッチカウント値が予め定められた初期化条件を満たす場合、前記ディスパッチカウント値を初期設定値にリセットする初期化判定部を有する請求項に記載のマルチスレッドプロセッサ。 6. The multithread processor according to claim 5 , further comprising an initialization determination unit that resets the dispatch count value to an initial set value when dispatch count values held in the plurality of dispatch counters satisfy a predetermined initialization condition. . 前記複数のディスパッチカウンタは、それぞれ、対応する前記ハードウェアスレッドの優先順位に対応するカウンタ初期設定値を格納するカウンタ初期設定値格納部と、
前記カウンタ初期設定値をカウント値の初期値として格納するカウント値格納部と、
前記ディスパッチ信号を受けて、前記カウント値格納部に格納される前記カウント値を更新するデクリメンタと、
前記複数のハードウェアスレッドにおいて準備されている前記命令が前記演算回路において実行されている前記命令の処理結果を利用する依存関係が高い命令であるか否かモニタするパイプライ制御回路が、前記依存関係の高い命令を含む前記ハードウェアスレッドに対して出力するマスク信号を受けて、前記マスク信号に応じて前記カウント値と最低優先順位の前記カウント値に対応するマスク値とのいずれかを選択し、選択した値を前記ディスパッチカウント値として出力する第3のセレクタと、
を有する請求項5又は6に記載のマルチスレッドプロセッサ。
Each of the plurality of dispatch counters includes a counter initial setting value storage unit that stores a counter initial setting value corresponding to the priority order of the corresponding hardware thread;
A count value storage unit that stores the counter initial setting value as an initial value of the count value;
A decrementer that receives the dispatch signal and updates the count value stored in the count value storage;
A pipeline control circuit that monitors whether or not the instruction prepared in the plurality of hardware threads is a highly dependent instruction using a processing result of the instruction being executed in the arithmetic circuit, Receiving a mask signal output to the hardware thread including a high instruction, and selecting either the count value or the mask value corresponding to the count value of the lowest priority according to the mask signal; A third selector for outputting the selected value as the dispatch count value;
The multi-thread processor according to claim 5 or 6 .
前記複数のハードウェアスレッドの優先順位の初期値は、前記マルチスレッドプロセッサの起動時に実行される管理プログラムにより設定される請求項1乃至のいずれか1項に記載のマルチスレッドプロセッサ。 The multithread processor according to any one of claims 1 to 7 , wherein initial values of priorities of the plurality of hardware threads are set by a management program executed when the multithread processor is activated.
JP2012284003A 2012-12-27 2012-12-27 Multithreaded processor Active JP5536862B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012284003A JP5536862B2 (en) 2012-12-27 2012-12-27 Multithreaded processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012284003A JP5536862B2 (en) 2012-12-27 2012-12-27 Multithreaded processor

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2008252234A Division JP5173713B2 (en) 2008-09-30 2008-09-30 Multi-thread processor and hardware thread scheduling method

Related Child Applications (1)

Application Number Title Priority Date Filing Date
JP2014090606A Division JP5770334B2 (en) 2014-04-24 2014-04-24 Multithreaded processor

Publications (2)

Publication Number Publication Date
JP2013080509A JP2013080509A (en) 2013-05-02
JP5536862B2 true JP5536862B2 (en) 2014-07-02

Family

ID=48526776

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012284003A Active JP5536862B2 (en) 2012-12-27 2012-12-27 Multithreaded processor

Country Status (1)

Country Link
JP (1) JP5536862B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101805462B1 (en) 2017-06-29 2018-01-10 주식회사 티맥스소프트 Method and computing device for increasing throughput of services in threads

Also Published As

Publication number Publication date
JP2013080509A (en) 2013-05-02

Similar Documents

Publication Publication Date Title
JP5173713B2 (en) Multi-thread processor and hardware thread scheduling method
JP5173711B2 (en) Multi-thread processor and hardware thread scheduling method
US10467053B2 (en) Multi-thread processor with rescheduling when threads are nondispatchable
JP5173712B2 (en) Multithreaded processor
JP5173714B2 (en) Multi-thread processor and interrupt processing method thereof
JP5536862B2 (en) Multithreaded processor
JP5770334B2 (en) Multithreaded processor
JP5536863B2 (en) Multithreaded processor
JP5946566B2 (en) Scheduling method of hardware thread in multi-thread processor
JP5770333B2 (en) Multithreaded processor
JP5838237B2 (en) Multithreaded processor
JP5536864B2 (en) Multithreaded processor
JP2012059195A (en) Multi-thread processor
JP2015064861A (en) Multithreaded processor
JP2014211890A (en) Multi-thread processor and interrupt processing method of the same
JP2014067248A (en) Processor, interrupt handling method, and interrupt control device
JP2013058265A (en) Multi-thread processor and interrupt processing method of the same

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20131127

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20131203

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20140203

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20140325

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20140424

R150 Certificate of patent or registration of utility model

Ref document number: 5536862

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350