JP5946566B2 - Scheduling method of hardware thread in multi-thread processor - Google Patents

Scheduling method of hardware thread in multi-thread processor Download PDF

Info

Publication number
JP5946566B2
JP5946566B2 JP2015126242A JP2015126242A JP5946566B2 JP 5946566 B2 JP5946566 B2 JP 5946566B2 JP 2015126242 A JP2015126242 A JP 2015126242A JP 2015126242 A JP2015126242 A JP 2015126242A JP 5946566 B2 JP5946566 B2 JP 5946566B2
Authority
JP
Japan
Prior art keywords
thread
hardware
processor
instruction
slot
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
JP2015126242A
Other languages
Japanese (ja)
Other versions
JP2015187888A (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 JP2015126242A priority Critical patent/JP5946566B2/en
Publication of JP2015187888A publication Critical patent/JP2015187888A/en
Application granted granted Critical
Publication of JP5946566B2 publication Critical patent/JP5946566B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明にかかるマルチスレッドプロセッサにおけるハードウェアスレッドのスケジュール方法に関し、特に複数のハードウェアスレッドの実行順序をスケジュールするスレッドスケジューラを有するマルチスレッドプロセッサにおけるハードウェアスレッドのスケジュール方法に関する。   More particularly, the present invention relates to a hardware thread scheduling method in 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のセレクタから出力される命令を実行する演算回路と、を有し、前記スレッドスケジューラは、第1の実行期間において前記複数のハードウェアスレッドのうちから固定的に選択された少なくとも1つの前記ハードウェアスレッドを選択し、第2の実行期間において任意の前記ハードウェアスレッドを選択し、前記第1の実行期間と前記第2の実行期間の比率、及び前記第1の実行期間に実行されるハードウェアスレッドの比率は、前記演算回路で実行される管理プログラムにより任意に設定されるものである。   One aspect of the multi-thread processor according to the present invention selects a plurality of hardware threads each generating an independent instruction stream and a hardware thread to be used in a next execution cycle from the plurality of hardware threads according to a schedule A thread scheduler that outputs a thread selection signal to be output, and a first one that selects any one of the plurality of hardware threads according to the thread selection signal and outputs an instruction generated by the selected hardware thread A selector, and an arithmetic circuit that executes an instruction output from the first selector, wherein the thread scheduler is fixedly selected from the plurality of hardware threads in a first execution period Selecting at least one said hardware thread; The arbitrary hardware thread is selected in the execution period of 2, the ratio of the first execution period and the second execution period, and the ratio of the hardware thread executed in the first execution period are It is arbitrarily set by a management program executed by the arithmetic circuit.

本発明にかかるマルチスレッドプロセッサによれば、第1の実行期間において実行されるハードウェアスレッドは、他のハードウェアスレッドの優先度にかかわらず実行される。また、第2の実行期間には、任意のハードウェアスレッドを実行することができる。これにより、本発明にかかるマルチスレッドプロセッサによれば、第1の実行期間に最低実行時間を保証したいハードウェアスレッドを定義し、第2の実行期間にはそのときの処理状況に応じた任意のハードウェアスレッドを定義することができる。   According to the multi-thread processor of the present invention, the hardware thread executed in the first execution period is executed regardless of the priority of other hardware threads. In addition, any hardware thread can be executed in the second execution period. Thereby, according to the multi-thread processor according to the present invention, the hardware thread for which the minimum execution time is desired to be guaranteed is defined in the first execution period, and an arbitrary value corresponding to the processing status at that time is defined in the second execution period Hardware threads can be defined.

本発明にかかるマルチスレッドプロセッサによれば、ハードウェアスレッドの最低実行時間を保証しながら、柔軟にハードウェアスレッドの実行時間を設定できる。   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. 3 is a schematic diagram illustrating a configuration of a slot according to the first embodiment. 実施の形態1にかかるマルチスレッドプロセッサの起動時の動作手順を示すフローチャートである。3 is a flowchart showing an operation procedure at the time of starting the multi-thread processor according to the first exemplary embodiment; 実施の形態1にかかるスレッドスケジューラの動作を示す表である。6 is a table showing an operation of the thread scheduler according to the first embodiment. 実施の形態1にかかるマルチスレッドプロセッサの動作を示すタイミングチャートである。3 is a timing chart showing an operation of the multithread processor according to the first exemplary 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に対して行う。   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.

命令フェッチコントローラ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の起動の直後に実行される管理プログラムにより設定する。   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.

本実施の形態にかかるマルチスレッドプロセッサ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は、第2のセレクタ(例えば、セレクタ30)、第1のスケジューラ31、第2のスケジューラ32を有する。セレクタ30は、実時間ビット信号の信号レベルに応じて第1のスケジューラ31が出力するスレッド番号Aと第2のスケジューラ32が出力するスレッド番号Bとのいずれか一方を選択して、選択したスレッド番号をスレッド選択信号TSELとして出力する。このスレッド選択信号TSELにおいて示されるスレッド番号が次の実行サイクルにおいて実行されるハードウェアスレッドの番号となる。   FIG. 2 shows a block diagram of the thread scheduler 19. As illustrated in FIG. 2, the thread scheduler 19 includes a second selector (for example, a selector 30), a first scheduler 31, and a second scheduler 32. The selector 30 selects one of the thread number A output from the first scheduler 31 and the thread number B output from the second scheduler 32 according to the signal level of the real-time bit signal, and selects the selected thread. The number is output as a thread selection signal TSEL. The thread number indicated in the thread selection signal TSEL becomes the hardware thread number to be executed in the next execution cycle.

第1のスケジューラ31は、第1の実行期間と第2の実行期間とを切り替える選択信号(例えば、実時間ビット信号)を出力すると共に、実時間ビット信号が第1の実行期間を指定している期間において予め設定された実行順序で実行されるハードウェアスレッドを指定する第1のハードウェアスレッド番号(例えばスレッド番号A)を出力する。ここで、第1の実行期間とは、後述する実時間ビット信号が1である期間であり、第2の実行期間とは、後述する実時間ビット信号が0である期間をいう。また、第1の実行期間においては、選択されるハードウェアスレッド番号が予め設定されており、第2の実行期間においては、選択されるハードウェアスレッド番号が例えば、第2のスケジューラ32により任意に設定される。この第1のスケジューラ31は、スレッド制御レジスタ33、カウンタ34、カウント最大値格納部35、一致比較回路36、第3のセレクタ(例えば、セレクタ37)を有する。   The first scheduler 31 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, thread number A) that specifies a hardware thread to be executed in a predetermined 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 second scheduler 32, for example. Is set. The first scheduler 31 includes a thread control register 33, a counter 34, a count maximum value storage unit 35, a coincidence comparison circuit 36, and a third selector (for example, a selector 37).

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

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

セレクタ37は、カウント値CNTに応じてスレッド制御レジスタ33内のスロットの1つを選択し、選択したスロットに格納される値に基づき実時間ビット信号とスレッド番号Aを出力する。より具体的には、セレクタ37は、カウント値CNTが0であればスロットSLT0を選択し、スロットSLT0の番号格納部に格納されたハードウェアスレッド番号をスレッド番号Aとし、スロットSLT0の実時間ビット格納部に格納される期間属性設定フラグの値を実時間ビット信号の論理レベルとする。   The selector 37 selects one of the slots in the thread control register 33 according to the count value CNT, and outputs a real time bit signal and a thread number A based on the value stored in the selected slot. More specifically, if the count value CNT is 0, the selector 37 selects the slot SLT0, sets the hardware thread number stored in the number storage unit of the slot SLT0 as the thread number A, and the real time bit of the slot SLT0. The value of the period attribute setting flag stored in the storage unit is set as the logical level of the real time bit signal.

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

第2のスケジューラ32は、例えば、ラウンドロビン方式やプライオリティ方式の手順に従って任意のハードウェアスレッドを選択する。この第2のスケジューラ32が出力するハードウェアスレッド番号をスレッド番号Bと称する。   The second scheduler 32 selects an arbitrary hardware thread in accordance with, for example, a round robin method or a priority method procedure. The hardware thread number output by the second scheduler 32 is referred to as thread number B.

続いて、スレッドスケジューラ19を用いたマルチスレッドプロセッサ1の動作について説明する。図4に、マルチスレッドプロセッサ1の電源投入時から通常処理の開始までの動作の手順を示すフローチャートを示す。図4に示すように、マルチスレッドプロセッサ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. 4 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. 4, 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は、スレッド制御レジスタ33内のスロットへの値の設定(ステップS4)、カウンタ34のカウント値CNTの初期化(ステップS5)、カウント最大値CNTMの設定(ステップS6)を行う。これらの各種レジスタの設定が完了すると、マルチスレッドプロセッサ1はマルチスレッドモードにて動作を開始する(ステップS7)。このシングルスレッドモードでは、例えば、スレッドプログラムカウンタ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 a value in a slot in the thread control register 33 (step S4), initializes a count value CNT of the counter 34 (step S5), and sets a count maximum value CNTM ( Step S6) is performed. When the setting of these various registers is completed, the multithread processor 1 starts operating in the multithread mode (step S7). 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の動作について説明する。なお、以下の説明では、設定の一例として、カウンタ34のカウント値CNTの初期値を0、カウント最大値CNTMを4とする。また、スレッド制御レジスタ33のスロットの各値は、スロットSLT0〜SLT2、SLT4、SLT5、SLT7の実時間ビットを1とし、スロットSLT3、SLT6の実時間ビットを0とする。さらに、スロットSLT0、SLT2、SLT5、SLT7のハードウェアスレッド番号を0、スロットSLT1、SLT4のハードウェアスレッド番号を1、スロットSLT3のハードウェアスレッド番号を2とする。   Next, the operation of the multithread processor 1 after the start of normal operation will be described. In the following description, the operation of the thread scheduler 19 will be described in particular. In the following description, as an example of setting, the initial value of the count value CNT of the counter 34 is 0, and the maximum count value CNTM is 4. Each value of the slot of the thread control register 33 is set to 1 for the real time bits of the slots SLT0 to SLT2, SLT4, SLT5, and SLT7, and to 0 for the real time bits of the slots SLT3 and SLT6. 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.

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

図5に示すように、まず時刻t1におけるカウント値CNTが0とすると、セレクタ37は、スロットSLT0を選択する。従って、セレクタ37は、実時間ビット信号の論理レベルを1とし、スレッド番号Aを0番とする。これにより、セレクタ30は、スレッド選択信号TSELとしてスレッド番号Aの0番を出力する。   As shown in FIG. 5, when the count value CNT at time t1 is first 0, the selector 37 selects the slot SLT0. Therefore, the selector 37 sets the logic level of the real-time bit signal to 1 and sets the thread number A to 0. As a result, the selector 30 outputs the thread number A, 0, as the thread selection signal TSEL.

続いて、時刻t2ではカウント値CNTが1にカウントアップされる。そのため、セレクタ37は、スロットSLT1を選択する。従って、セレクタ37は、実時間ビット信号の論理レベルを1とし、スレッド番号Aを1番とする。これにより、セレクタ30は、スレッド選択信号TSELとしてスレッド番号Aの1番を出力する。   Subsequently, at time t2, the count value CNT is incremented to 1. Therefore, the selector 37 selects the slot SLT1. Accordingly, the selector 37 sets the logic level of the real-time bit signal to 1 and sets the thread number A to 1. As a result, the selector 30 outputs the thread number A No. 1 as the thread selection signal TSEL.

次いで、時刻t3ではカウント値CNTが2にカウントアップされる。そのため、セレクタ37は、スロットSLT2を選択する。従って、セレクタ37は、実時間ビット信号の論理レベルを0とし、スレッド番号Aを1番とする。これにより、セレクタ30は、スレッド選択信号TSELとしてスレッド番号Bとして出力されるハードウェアスレッド番号の番号(例えばn番)を出力する。   Next, at time t3, the count value CNT is incremented to 2. Therefore, the selector 37 selects the slot SLT2. Therefore, the selector 37 sets the logic level of the real-time bit signal to 0 and sets the thread number A to 1. As a result, the selector 30 outputs a hardware thread number (for example, n) output as the thread number B as the thread selection signal TSEL.

次いで、時刻t4ではカウント値CNTが3にカウントアップされる。そのため、セレクタ37は、スロットSLT3を選択する。従って、セレクタ37は、実時間ビット信号の論理レベルを1とし、スレッド番号Aを2番とする。これにより、セレクタ30は、スレッド選択信号TSELとしてスレッド番号Aの2番を出力する。   Next, at time t4, the count value CNT is counted up to 3. Therefore, the selector 37 selects the slot SLT3. Therefore, the selector 37 sets the logic level of the real time bit signal to 1 and sets the thread number A to 2. As a result, the selector 30 outputs the thread number A No. 2 as the thread selection signal TSEL.

次いで、時刻t5ではカウント値CNTが4にカウントアップされる。そのため、セレクタ37は、スロットSLT4を選択する。従って、セレクタ37は、実時間ビット信号の論理レベルを1とし、スレッド番号Aを1番とする。これにより、セレクタ30は、スレッド選択信号TSELとしてスレッド番号Aの1番を出力する。   Next, the count value CNT is counted up to 4 at time t5. Therefore, the selector 37 selects the slot SLT4. Accordingly, the selector 37 sets the logic level of the real-time bit signal to 1 and sets the thread number A to 1. As a result, the selector 30 outputs the thread number A No. 1 as the thread selection signal TSEL.

そして、時刻t5では、カウント値CNTがカウント最大値CNTMに達するため、時刻t6の経過後にカウント値CNTはリセットされる。これにより、時刻t6〜t10の期間のスレッドスケジューラ19は、時刻t1〜t5の動作を繰り返すことになる。マルチスレッドプロセッサ1では。カウント値CNTがリセットされる周期をスレッド選択処理の一周期とする。   Since the count value CNT reaches the maximum count value CNTM at time t5, the count value CNT is reset after time t6 has elapsed. As a result, the thread scheduler 19 during the period from time t6 to t10 repeats the operation from time t1 to t5. In the multi-thread processor 1. A cycle in which the count value CNT is reset is defined as one cycle of the thread selection process.

続いて、上記スレッドスケジューラ19が出力するスレッド選択信号TSELに基づくマルチスレッドプロセッサ1の動作のタイミングチャートを図6に示す。この図6において選択されるハードウェアスレッド及び時刻は、図5において説明したスレッド選択信号TSEL及び時刻に基づくものである。   Next, FIG. 6 shows a timing chart of the operation of the multi-thread processor 1 based on the thread selection signal TSEL output from the thread scheduler 19. The hardware thread and time selected in FIG. 6 are based on the thread selection signal TSEL and time described in FIG.

図6に示すように、マルチスレッドプロセッサ1は、時刻t1においては、スレッド選択信号TSELが0番のハードウェアスレッドを選択するため、0番のハードウェアスレッドに属する命令0を実行する。次いで、時刻t2においては、スレッド選択信号TSELが1番のハードウェアスレッドを選択するため、1番のハードウェアスレッドに属する命令0を実行する。次いで、時刻t3においては、スレッド選択信号TSELが第2のスケジューラ32が選択した任意のハードウェアスレッド(例えばn番)を選択するため、n番のハードウェアスレッドに属する命令0を実行する。次いで、時刻t4においては、スレッド選択信号TSELが2番のハードウェアスレッドを選択するため、2番のハードウェアスレッドに属する命令0を実行する。次いで、時刻t5においては、スレッド選択信号TSELが1番のハードウェアスレッドを選択するため、1番のハードウェアスレッドに属する命令1を実行する。そして、マルチスレッドプロセッサ1は、時刻t5が経過する時点でスレッド選択の周期を1つ終了させ、次のスレッド選択処理の周期を開始する。   As shown in FIG. 6, the multi-thread processor 1 executes the instruction 0 belonging to the 0th hardware thread in order to select the 0th hardware thread whose thread selection signal TSEL is at the time t1. Next, at time t2, since the thread selection signal TSEL selects the first hardware thread, the instruction 0 belonging to the first hardware thread is executed. Next, at time t3, the thread selection signal TSEL selects an arbitrary hardware thread (for example, n) selected by the second scheduler 32, and therefore the instruction 0 belonging to the nth hardware thread is executed. Next, at time t4, since the thread selection signal TSEL selects the second hardware thread, the instruction 0 belonging to the second hardware thread is executed. Next, at time t5, since the thread selection signal TSEL selects the first hardware thread, the instruction 1 belonging to the first hardware thread is executed. Then, the multi-thread processor 1 ends one thread selection cycle when the time t5 elapses, and starts the next thread selection processing cycle.

次のスレッド選択処理の周期(時刻t6〜t10)では、時刻t1〜t5の周期と同様の順序でハードウェアスレッドを選択するが、選択されたハードウェアスレッドにおいて処理される命令は、前の周期の続きの命令群となる。   In the next thread selection processing cycle (time t6 to t10), the hardware thread is selected in the same order as the cycle of time t1 to t5, but the instruction processed in the selected hardware thread is the previous cycle. It becomes the instruction group that continues.

例えば、時刻t6においては、スレッド選択信号TSELが0番のハードウェアスレッドを選択するため、0番のハードウェアスレッドに属する命令1を実行する。次いで、時刻t7においては、スレッド選択信号TSELが1番のハードウェアスレッドを選択するため、1番のハードウェアスレッドに属する命令2を実行する。次いで、時刻t8においては、スレッド選択信号TSELが第2のスケジューラ32が選択した任意のハードウェアスレッド(例えばn番)を選択するため、n番のハードウェアスレッドに属する命令1を実行する。次いで、時刻t9においては、スレッド選択信号TSELが2番のハードウェアスレッドを選択するため、2番のハードウェアスレッドに属する命令1を実行する。次いで、時刻t10においては、スレッド選択信号TSELが1番のハードウェアスレッドを選択するため、1番のハードウェアスレッドに属する命令3を実行する。   For example, at time t6, the thread selection signal TSEL selects the 0th hardware thread, so the instruction 1 belonging to the 0th hardware thread is executed. Next, at time t7, since the thread selection signal TSEL selects the first hardware thread, the instruction 2 belonging to the first hardware thread is executed. Next, at time t8, since the thread selection signal TSEL selects an arbitrary hardware thread (for example, n) selected by the second scheduler 32, the instruction 1 belonging to the nth hardware thread is executed. Next, at time t9, since the thread selection signal TSEL selects the second hardware thread, the instruction 1 belonging to the second hardware thread is executed. Next, at time t10, since the thread selection signal TSEL selects the first hardware thread, the instruction 3 belonging to the first hardware thread is executed.

このように、スレッドスケジューラ19が循環的に選択するハードウェアスレッドを切り替えた場合、1つのスレッド選択処理周期において処理されるハードウェアスレッドの実行時間は所定の比率となる。図6に示す例では、第1の実行期間において0番のハードウェアスレッドは1回、1番のハードウェアスレッドは2回、2番のハードウェアスレッドは1回実行される。また、第2の実行期間において任意(n番)のハードウェアスレッドが1回実行されることになる。つまり、第1の実行期間と第2の実行期間とのプロセッサ占有時間の比率は80:20である。また、0番のハードウェアスレッドは少なくとも20%のプロセッサ占有時間を確保し、1番のハードウェアスレッドは少なくとも40%のプロセッサ占有時間を確保し、2番のハードウェアスレッドは少なくとも20%のプロセッサ占有時間を確保する。また、第2の実行期間として割り当てられた20%のプロセッサ占有時間の間は、マルチスレッドプロセッサ1におけるスレッドの処理状況に応じた任意のハードウェアスレッドを実行される。   As described above, when the hardware thread to be cyclically selected by the thread scheduler 19 is switched, the execution time of the hardware thread processed in one thread selection processing cycle becomes a predetermined ratio. In the example shown in FIG. 6, the first hardware thread is executed once, the first hardware thread is executed twice, and the second hardware thread is executed once in the first execution period. In addition, any (nth) hardware thread is executed once in the second execution period. That is, the ratio of the processor occupation time between the first execution period and the second execution period is 80:20. The 0th hardware thread secures at least 20% processor occupation time, the 1st hardware thread secures at least 40% processor occupation time, and the 2nd hardware thread at least 20% processor. Ensure occupation time. In addition, during the 20% processor occupation time allocated as the second execution period, an arbitrary hardware thread corresponding to the thread processing status in the multi-thread processor 1 is executed.

上記説明より、本実施の形態にかかるマルチスレッドプロセッサ1では、スレッドスケジューラ19が実時間ビット信号の論理レベルが1となる第1の実行期間において予め設定された順序により予め設定されたハードウェアスレッドを選択し、実時間ビット信号の論理レベルが0となる第2の実行期間は、任意のハードウェアスレッドを選択する。これにより、マルチスレッドプロセッサ1は、第1の実行期間において選択されるハードウェアスレッドのプロセッサ占有時間の最低時間を保証する。また、第2の実行期間において任意のハードウェアスレッドを選択することで、マルチスレッドプロセッサ1は、その処理状況に応じて任意のハードウェアスレッドのプロセッサ占有時間を増加させることができる。   From the above description, in the multi-thread processor 1 according to the present embodiment, the hardware thread preset by the thread scheduler 19 in the preset order in the first execution period in which the logical level of the real-time bit signal is 1. In the second execution period in which the logic level of the real-time bit signal is 0, an arbitrary hardware thread is selected. Thereby, the multi-thread processor 1 guarantees the minimum time of the processor occupation time of the hardware thread selected in the first execution period. Further, by selecting an arbitrary hardware thread in the second execution period, the multi-thread processor 1 can increase the processor occupation time of an arbitrary hardware thread according to the processing status.

また、本実施の形態におけるマルチスレッドプロセッサ1では、第1の実行期間と第2の実行期間との比率、及び、第1の実行期間の間に実行されるハードウェアスレッドの比率を管理プログラムにより任意に設定することができる。つまり、管理プログラムにより設定されるスレッド制御レジスタ33内のスロットへの値及びカウント最大値CNTMの値を、マルチスレッドプロセッサ1に対する処理要求に応じて変更することで柔軟なハードウェアスレッドの選択方法を選ぶことが可能になる。より具体的には、スレッド制御レジスタ33内のスロットの実時間ビットの値及びハードウェアスレッド番号の値を変更することで第1の実行時間中に実行されるべきハードウェアスレッドを選択することができ、さらに、第1の実行時間と第2の実行時間との比率を変更することができる。また、カウント最大値CNTMにどのような値を設定するかにより、一スレッド選択処理周期の長さを変更することができる。   In the multithread processor 1 according to the present embodiment, the ratio between the first execution period and the second execution period and the ratio of hardware threads executed during the first execution period are determined by the management program. It can be set arbitrarily. That is, a flexible hardware thread selection method can be obtained by changing the value to the slot in the thread control register 33 and the value of the maximum count value CNTM set by the management program according to the processing request to the multi-thread processor 1. It becomes possible to choose. More specifically, it is possible to select a hardware thread to be executed during the first execution time by changing the value of the real time bit of the slot in the thread control register 33 and the value of the hardware thread number. In addition, the ratio between the first execution time and the second execution time can be changed. Also, the length of one thread selection processing cycle can be changed depending on what value is set for the maximum count value CNTM.

なお、本発明は上記実施の形態に限られたものではなく、趣旨を逸脱しない範囲で適宜変更することが可能である。例えば、第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 マルチスレッドプロセッサ
2 メモリ
10 演算回路
11 割り込みコントローラ
12 PC生成回路
13、18、30、37 セレクタ
14 命令メモリ
15 命令バッファ
16 パイプライン制御回路
17 命令フェッチコントローラ
19 スレッドスケジューラ
21 命令デコーダ
22 実行ユニット
23 データレジスタ
31 第1のスケジューラ
32 第2のスケジューラ
33 スレッド制御レジスタ
34 カウンタ
35 カウント最大値格納部
36 一致比較回路
a、b データ
BUF0〜BUF0 命令バッファ領域
IMadd 命令フェッチアドレス
Radd データレジスタアドレス
SC 演算制御信号
TSEL スレッド選択信号
CNT カウント値
CNTM カウント最大値
RST リセット信号
SLT0〜SLT7 スロット
TPC0〜TCP3 スレッドプログラムカウンタ
DESCRIPTION OF SYMBOLS 1 Multithread processor 2 Memory 10 Arithmetic circuit 11 Interrupt controller 12 PC generation circuit 13, 18, 30, 37 Selector 14 Instruction memory 15 Instruction buffer 16 Pipeline control circuit 17 Instruction fetch controller 19 Thread scheduler 21 Instruction decoder 22 Execution unit 23 Data Register 31 First scheduler 32 Second scheduler 33 Thread control register 34 Counter 35 Count maximum value storage unit 36 Match comparison circuits a and b Data BUF0 to BUF0 Instruction buffer area IMadd Instruction fetch address Radd Data register address SC Operation control signal TSEL Thread selection signal CNT Count value CNTM Count maximum value RST Reset signal SLT0 to SLT7 Slot TPC0 to TCP3 Thread Program counter

Claims (5)

複数のハードウェアスレッドを有し、前記ハードウェアスレッドを所定のスケジュールに従って切り替えながら、前記ハードウェアスレッドにより生成される命令流を実行するマルチスレッドプロセッサにおけるハードウェアスレッドのスケジュール方法であって、
前記マルチスレッドプロセッサは、
前記複数のハードウェアスレッドのうち次実行サイクルにおいて使用するハードウェアスレッドを選択するスレッド選択信号を出力するスレッドスケジューラと、
前記スレッド選択信号に応じて前記複数のハードウェアスレッドのいずれか1つを選択して、選択したハードウェアスレッドにより生成された命令を出力するセレクタと、
を有し、
前記スレッドスケジューラは、
各スロットが第1の情報を保持し、この第1の情報を書き換え可能とする複数のスロットを含むスレッド制御レジスタと、
前記複数のスロットのうち1つを指定する第2の情報を格納し、この第2の情報を書き換え可能とする格納部と、
をさらに有し、
前記スレッド制御レジスタの前記複数のスロットの第1のスロットからスロットを順々に選択し、
前記複数のスロットの中から前記第2の情報により指定された第2のスロットを選択したときには、前記第1のスロットに戻ってスロットを再び順次選択し、
順次選択されたスロットが保持する前記第1の情報に基づき、ハードウェアスレッドを前記セレクタに選択させ、
前記第1のスロットから前記第2のスロットが選択されるまでのスレッド選択処理の長さが前記第2の情報を書き換えることにより変更可能なマルチスレッドプロセッサにおけるハードウェアスレッドのスケジュール方法。
A hardware thread scheduling method in a multi-thread processor that has a plurality of hardware threads and executes an instruction stream generated by the hardware thread while switching the hardware thread according to a predetermined schedule,
The multi-thread processor is:
A thread scheduler that outputs a thread selection signal for selecting a hardware thread to be used in a next execution cycle among the plurality of hardware threads;
A selector that selects any one of the plurality of hardware threads according to the thread selection signal and outputs an instruction generated by the selected hardware thread;
Have
The thread scheduler
A thread control register including a plurality of slots in which each slot holds first information and the first information can be rewritten;
Storing second information for designating one of the plurality of slots, and rewriting the second information;
Further comprising
Selecting a slot sequentially from a first slot of the plurality of slots of the thread control register;
When the second slot designated by the second information is selected from the plurality of slots, the slot is returned to the first slot and the slots are sequentially selected again.
Based on the first information held by the sequentially selected slots, let the selector select a hardware thread,
A method of scheduling a hardware thread in a multi-thread processor in which a length of a thread selection process from the first slot until the second slot is selected can be changed by rewriting the second information.
前記第1の情報、及び前記第2の情報は、前記セレクタから出力される命令を実行する演算回路で実行される管理プログラムにより前記スロット及び前記格納部に設定される請求項1に記載のマルチスレッドプロセッサにおけるハードウェアスレッドのスケジュール方法。   The multiplicity according to claim 1, wherein the first information and the second information are set in the slot and the storage unit by a management program executed by an arithmetic circuit that executes an instruction output from the selector. A method of scheduling hardware threads in a thread processor. 前記スレッドスケジューラは、前記スロットの番号を示すカウント値を所定の周期でカウントアップし、前記カウント値が前記第2の情報で示される値に達したことに応じて前記カウント値がリセットされるカウンタを有する請求項1又は2に記載のマルチスレッドプロセッサにおけるハードウェアスレッドのスケジュール方法。   The thread scheduler counts up a count value indicating the slot number at a predetermined period, and the counter is reset when the count value reaches the value indicated by the second information A hardware thread scheduling method in a multi-thread processor according to claim 1, comprising: 前記第1の情報が、ハードウェアスレッド番号を含む請求項1乃至3のいずれか1項に記載のマルチスレッドプロセッサにおけるハードウェアスレッドのスケジュール方法。   The hardware thread scheduling method for a multithread processor according to any one of claims 1 to 3, wherein the first information includes a hardware thread number. 前記管理プログラムは、前記マルチスレッドプロセッサの起動後に実行される請求項2に記載のマルチスレッドプロセッサにおけるハードウェアスレッドのスケジュール方法。   The hardware thread scheduling method in the multithread processor according to claim 2, wherein the management program is executed after the multithread processor is started.
JP2015126242A 2015-06-24 2015-06-24 Scheduling method of hardware thread in multi-thread processor Active JP5946566B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2015126242A JP5946566B2 (en) 2015-06-24 2015-06-24 Scheduling method of hardware thread in multi-thread processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2015126242A JP5946566B2 (en) 2015-06-24 2015-06-24 Scheduling method of hardware thread in multi-thread processor

Related Parent Applications (1)

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

Publications (2)

Publication Number Publication Date
JP2015187888A JP2015187888A (en) 2015-10-29
JP5946566B2 true JP5946566B2 (en) 2016-07-06

Family

ID=54430051

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2015126242A Active JP5946566B2 (en) 2015-06-24 2015-06-24 Scheduling method of hardware thread in multi-thread processor

Country Status (1)

Country Link
JP (1) JP5946566B2 (en)

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007317171A (en) * 2006-04-27 2007-12-06 Matsushita Electric Ind Co Ltd Multi-thread computer system and multi-thread execution control method
JP2008123045A (en) * 2006-11-08 2008-05-29 Matsushita Electric Ind Co Ltd Processor

Also Published As

Publication number Publication date
JP2015187888A (en) 2015-10-29

Similar Documents

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

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: 20160510

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20160531

R150 Certificate of patent or registration of utility model

Ref document number: 5946566

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150