JP2014041422A - Processor - Google Patents

Processor Download PDF

Info

Publication number
JP2014041422A
JP2014041422A JP2012182431A JP2012182431A JP2014041422A JP 2014041422 A JP2014041422 A JP 2014041422A JP 2012182431 A JP2012182431 A JP 2012182431A JP 2012182431 A JP2012182431 A JP 2012182431A JP 2014041422 A JP2014041422 A JP 2014041422A
Authority
JP
Japan
Prior art keywords
flag
instruction
register
data
unit
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2012182431A
Other languages
Japanese (ja)
Other versions
JP6024281B2 (en
Inventor
Kazuo Horio
一生 堀尾
Masatoshi Mori
真寿 毛利
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.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2012182431A priority Critical patent/JP6024281B2/en
Publication of JP2014041422A publication Critical patent/JP2014041422A/en
Application granted granted Critical
Publication of JP6024281B2 publication Critical patent/JP6024281B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Advance Control (AREA)
  • Executing Machine-Instructions (AREA)

Abstract

PROBLEM TO BE SOLVED: To protect data dependency between instructions even when instructions being exerted have access to the same register.SOLUTION: A processor comprises: registers in which data are stored; at least one flag table having, for each register, a flag group including the number of flags assignable to corresponding instructions being exerted; a flag set section configured to set a flag assigned to an instruction in the flag group corresponding to a register to which an instruction has access according to the issue of the instruction that has access to the register; a flag reset section configured such that in response to the termination of access to the register by the instruction, the flag set in accordance with the issue of the instruction is reset; and a determination section configured to determine whether to have access to the register on the basis of the state of the flag group corresponding to the register being accessed.

Description

本発明は、プロセッサに関する。   The present invention relates to a processor.

プロセッサは、命令間の依存関係を守って、命令を実行する。命令間のデータ依存には、例えば、RAW(Read After Write)依存、WAW(Write After Write)依存、WAR(Write After Read)依存等がある。RAW依存では、第1命令に先行する命令がレジスタにデータを書き込むまで、第1命令は、レジスタからデータを読み出さない。WAW依存では、第1命令に先行する命令がレジスタにデータを書き込むまで、第1命令は、レジスタにデータを書き込まない。WAR依存では、第1命令に先行する命令がレジスタからデータを読み出すまで、第1命令は、レジスタにデータ書き込まない。   The processor executes the instructions while keeping the dependency between the instructions. Data dependence between instructions includes, for example, RAW (Read After Write) dependence, WAW (Write After Write) dependence, and WAR (Write After Read) dependence. In RAW dependence, the first instruction does not read data from the register until the instruction preceding the first instruction writes data to the register. In the WAW dependency, the first instruction does not write data to the register until the instruction preceding the first instruction writes data to the register. In WAR dependence, the first instruction does not write data to the register until the instruction preceding the first instruction reads data from the register.

RAW依存等を守る技術として、スコアボード制御が提案されている(例えば、特許文献1、2参照。)。例えば、RAW依存に関するスコアボード制御では、プロセッサは、先ず、第1命令に先行する第2命令が発行される際に、第2命令がデータを書き込むレジスタ(以下、対象レジスタとも称する)に対応するフラグ(以下、対象フラグとも称する)をセットする。そして、プロセッサは、第2命令が対象レジスタにデータを書き込む際に、対象フラグをリセットする。   Scoreboard control has been proposed as a technique for protecting RAW dependence and the like (see, for example, Patent Documents 1 and 2). For example, in scoreboard control related to RAW dependence, when a second instruction preceding a first instruction is issued, the processor first corresponds to a register to which data is written by the second instruction (hereinafter also referred to as a target register). A flag (hereinafter also referred to as a target flag) is set. Then, the processor resets the target flag when the second instruction writes data to the target register.

第1命令は、対象レジスタからデータを読み出す際に、対象フラグを参照する。対象フラグがリセットされているときには、プロセッサは、対象レジスタからデータを読み出す。対象フラグがセットされているときには、プロセッサは、対象フラグがリセットされるまで、第1命令を待機させる。これにより、RAW依存が守られる。   The first instruction refers to the target flag when reading data from the target register. When the target flag is reset, the processor reads data from the target register. When the target flag is set, the processor waits for the first instruction until the target flag is reset. Thereby, RAW dependence is protected.

特開平5−2482号公報Japanese Patent Laid-Open No. 5-2482 特開2001−209537号公報JP 2001-209537 A

実行中の複数の命令が同じレジスタにデータを書き込む場合、複数の命令のうちのどの命令の実行状態をフラグが示しているか分らない。このため、プロセッサは、フラグを参照しても、処理対象の命令に先行する命令によるレジスタへのデータの書き込みが終了したか否かを適切に判定できない。この場合、RAW依存およびWAW依存を守ることは困難である。同様に、実行中の複数の命令が同じレジスタからデータを読み出す場合、WAR依存を守ることは困難である。   When a plurality of instructions being executed write data to the same register, it is not known which instruction of the plurality of instructions indicates the execution state. For this reason, the processor cannot appropriately determine whether or not the writing of data to the register by the instruction preceding the instruction to be processed is completed even if the flag is referred to. In this case, it is difficult to keep RAW dependency and WAW dependency. Similarly, when a plurality of instructions being executed read data from the same register, it is difficult to maintain WAR dependency.

1つの側面では、本発明の目的は、実行中の複数の命令が同じレジスタにアクセスするときにも、命令間のデータ依存を守ることである。   In one aspect, an object of the present invention is to protect data dependency between instructions even when multiple executing instructions access the same register.

本発明の一形態では、プロセッサは、データが格納されるレジスタと、実行中の複数の命令のそれぞれに割り当て可能な数のフラグを含むフラグ群を、レジスタ毎に有する少なくとも1つのフラグテーブルと、レジスタにアクセスする命令の発行に応じて、命令によりアクセスされるレジスタに対応するフラグ群のうちの命令に割り当てられるフラグを、セットするフラグセット部と、命令の発行に応じてセットされたフラグを、命令によるレジスタに対するアクセスの終了に応じてリセットするフラグリセット部と、アクセス対象のレジスタに対応するフラグ群の状態に基づいてレジスタにアクセスするか否かを判定する判定部とを有している。   In one form of the present invention, the processor includes at least one flag table having, for each register, a register in which data is stored and a flag group including a number of flags that can be assigned to each of the plurality of instructions being executed. A flag set unit for setting a flag assigned to an instruction in a flag group corresponding to a register accessed by the instruction according to the issue of the instruction for accessing the register, and a flag set according to the issue of the instruction. And a flag reset unit that resets upon completion of access to the register by the instruction, and a determination unit that determines whether to access the register based on the state of the flag group corresponding to the register to be accessed. .

実行中の複数の命令が同じレジスタにアクセスするときにも、命令間のデータ依存を守ることができる。   Even when a plurality of instructions being executed access the same register, data dependency between instructions can be protected.

一実施形態におけるプロセッサの例を示している。2 illustrates an example of a processor in one embodiment. 図1に示したフラグテーブルの一例を示している。An example of the flag table shown in FIG. 1 is shown. 図2に示した論理和部の一例を示している。3 illustrates an example of a logical sum unit illustrated in FIG. 2. 図1に示したプロセッサの動作の一例を示している。2 shows an example of the operation of the processor shown in FIG. 図1に示したプロセッサの動作の別の例を示している。6 shows another example of the operation of the processor shown in FIG. 命令パターンとフラグテーブルに対するアクセスとの関係の一例を示している。An example of a relationship between an instruction pattern and access to a flag table is shown. 別の実施形態におけるプロセッサの一例を示している。3 illustrates an example of a processor in another embodiment.

以下、実施形態を図面を用いて説明する。   Hereinafter, embodiments will be described with reference to the drawings.

図1は、一実施形態におけるプロセッサ10の例を示している。プロセッサ10は、複数の命令を並列に処理する。例えば、プロセッサ10は、パイプライン処理を実行する。なお、プロセッサ10は、複数の命令を複数の演算器等で並列に実行してもよい。さらに、プロセッサ10は、複数のパイプライン処理を複数の演算器等で並列に実行してもよい。   FIG. 1 illustrates an example of a processor 10 in one embodiment. The processor 10 processes a plurality of instructions in parallel. For example, the processor 10 performs pipeline processing. The processor 10 may execute a plurality of instructions in parallel by a plurality of arithmetic units. Further, the processor 10 may execute a plurality of pipeline processes in parallel by a plurality of arithmetic units.

プロセッサ10は、例えば、レジスタファイル20、フラグテーブル30、フラグセット部40、フラグリセット部50および判定部60を有している。レジスタファイル20は、データが格納されるレジスタR(R0−R15)を有している。レジスタRのビット数は、例えば、32ビット以上である。なお、レジスタRのビット数は、32ビットより少なくてもよい。また、レジスタRの数は、16個に限定されない。   The processor 10 includes, for example, a register file 20, a flag table 30, a flag set unit 40, a flag reset unit 50, and a determination unit 60. The register file 20 includes registers R (R0 to R15) that store data. The number of bits of the register R is, for example, 32 bits or more. Note that the number of bits of the register R may be less than 32 bits. Further, the number of registers R is not limited to 16.

フラグテーブル30は、フラグ群FG(FG0−FG15)をレジスタR毎に有している。フラグ群FGの符号の末尾の数字は、レジスタRの符号の末尾の数字に対応している。例えば、フラグ群FG0は、レジスタR0に対応している。各フラグ群FGは、対応するレジスタRの使用状態を示す複数(n+1個)のフラグFを有している。   The flag table 30 has a flag group FG (FG0 to FG15) for each register R. The number at the end of the sign of the flag group FG corresponds to the number at the end of the sign of the register R. For example, the flag group FG0 corresponds to the register R0. Each flag group FG has a plurality (n + 1) of flags F indicating the usage state of the corresponding register R.

例えば、フラグ群FG0は、レジスタR0の使用状態を示すn+1個のフラグF(F000−F00n)を有している。なお、フラグFの符号の末尾の3桁のうちの左側の2桁の数字は、フラグ群FGの符号の末尾の数字に対応している。各フラグ群FGのフラグFは、例えば、実行中の複数の命令のそれぞれに割り当て可能な数だけ用意される。例えば、同時実行可能な命令の最大数(インフライト命令の最大数)が8命令の場合、各フラグ群FGは、8個のフラグFを有する。   For example, the flag group FG0 has n + 1 flags F (F000-F00n) indicating the usage state of the register R0. Note that the left two digits of the last three digits of the flag F code correspond to the last digits of the flag group FG code. For example, as many flags F of each flag group FG are prepared as can be assigned to each of a plurality of instructions being executed. For example, when the maximum number of instructions that can be executed simultaneously (the maximum number of in-flight instructions) is 8, each flag group FG has 8 flags F.

フラグセット部40は、レジスタRにアクセスする命令の発行に応じて、命令によりアクセスされるレジスタRに対応するフラグ群FGのうちの命令に割り当てられるフラグFを、セットする。例えば、フラグセット部40は、セット信号SETCを用いて、セット対象のフラグFを“1”にセットする。なお、例えば、フラグセット部40は、命令を解読するデコード部等に含まれてもよい。   The flag setting unit 40 sets the flag F assigned to the instruction in the flag group FG corresponding to the register R accessed by the instruction in response to the issuance of the instruction for accessing the register R. For example, the flag setting unit 40 sets the flag F to be set to “1” using the set signal SETC. For example, the flag setting unit 40 may be included in a decoding unit that decodes an instruction.

フラグリセット部50は、命令の発行に応じてセットされたフラグFを、命令によるレジスタRに対するアクセスの終了に応じてリセットする。例えば、フラグリセット部50は、リセット信号RSTCを用いて、リセット対象のフラグFを“0”にリセットする。なお、例えば、フラグリセット部50は、レジスタRからデータを読み出すレジスタリード部、レジスタにデータを書き込むレジスタライト部等に含まれてもよい。   The flag reset unit 50 resets the flag F set according to the issuance of an instruction when the access to the register R by the instruction ends. For example, the flag reset unit 50 resets the reset target flag F to “0” using the reset signal RSTC. For example, the flag reset unit 50 may be included in a register read unit that reads data from the register R, a register write unit that writes data to the register, or the like.

判定部60は、アクセス対象のレジスタRに対応するフラグ群FGの状態に基づいて、レジスタRにアクセスするか否かを判定する。例えば、判定部60は、判定対象の命令が発行されたときのフラグテーブル30内のテールポインタ(図2に示すテールポインタTP)を示す信号CHKをフラグテーブル30に出力する。そして、判定部60は、判定対象の命令に先行する命令のレジスタRの使用状態を示す信号REPをフラグテーブル30から受ける。判定部60は、信号REPに基づいて、レジスタRにアクセスするか否かを判定する。   The determination unit 60 determines whether to access the register R based on the state of the flag group FG corresponding to the register R to be accessed. For example, the determination unit 60 outputs a signal CHK indicating the tail pointer (tail pointer TP shown in FIG. 2) in the flag table 30 when the instruction to be determined is issued to the flag table 30. Then, the determination unit 60 receives from the flag table 30 a signal REP indicating the usage state of the register R of the instruction preceding the instruction to be determined. The determination unit 60 determines whether to access the register R based on the signal REP.

なお、例えば、判定部60は、レジスタリード部、レジスタライト部等に含まれてもよい。判定部60がレジスタリード部に含まれる場合、例えば、判定部60は、読み出し対象のレジスタRに対応するフラグ群FGの状態に基づいて、レジスタRからデータを読み出してよいか否かを判定する。これにより、プロセッサ10は、RAW(Read After Write)依存を守って、命令を実行できる。なお、RAW依存では、第1命令に先行する命令(以下、先行命令とも称する)がレジスタにデータ書き込むまで、第1命令は、レジスタからデータを読み出さない。   For example, the determination unit 60 may be included in a register read unit, a register write unit, or the like. When the determination unit 60 is included in the register read unit, for example, the determination unit 60 determines whether data can be read from the register R based on the state of the flag group FG corresponding to the register R to be read. . Thereby, the processor 10 can execute the instruction while keeping RAW (Read After Write) dependence. In the RAW dependence, the first instruction does not read data from the register until an instruction preceding the first instruction (hereinafter also referred to as a preceding instruction) writes data to the register.

また、判定部60がレジスタライト部に含まれる場合、例えば、判定部60は、書き込み対象のレジスタRに対応するフラグ群FGの状態に基づいて、レジスタRにデータを書き込んでよいか否かを判定する。これにより、プロセッサ10は、WAW(Write After Write)依存、WAR(Write After Read)依存等を守って、命令を実行できる。なお、WAW依存では、第1命令に先行する命令がレジスタにデータを書き込むまで、第1命令は、レジスタにデータを書き込まない。また、WAR依存では、第1命令に先行する命令がレジスタからデータを読み出すまで、第1命令は、レジスタにデータ書き込まない。   When the determination unit 60 is included in the register write unit, for example, the determination unit 60 determines whether or not data can be written to the register R based on the state of the flag group FG corresponding to the register R to be written. judge. As a result, the processor 10 can execute the instruction while keeping WAW (Write After Write) dependency, WAR (Write After Read) dependency, and the like. Note that in the WAW dependency, the first instruction does not write data to the register until the instruction preceding the first instruction writes data to the register. In the WAR dependency, the first instruction does not write data to the register until the instruction preceding the first instruction reads data from the register.

ここで、RAW依存、WAW依存およびWAR依存の全てに対応させる場合、プロセッサ10は、RAW/WAW用フラグテーブル30とWAR用フラグテーブル30との2種類を有する。RAW/WAW用フラグテーブル30は、レジスタRに対する書き込みが終了したか否かを示すフラグFを有する。WAR用フラグテーブル30は、レジスタRに対する読み出しが終了したか否かを示すフラグFを有する。   Here, in the case of dealing with all of the RAW dependency, the WAW dependency, and the WAR dependency, the processor 10 has two types of a RAW / WAW flag table 30 and a WAR flag table 30. The RAW / WAW flag table 30 includes a flag F indicating whether or not writing to the register R has been completed. The WAR flag table 30 includes a flag F indicating whether or not reading to the register R is completed.

プロセッサ10は、フラグテーブル30を用いて確認する依存関係に応じて、RAW/WAW用フラグテーブル30およびWAR用フラグテーブル30のいずれか一方あるいは両方を有する。   The processor 10 has one or both of the RAW / WAW flag table 30 and the WAR flag table 30 according to the dependency relationship to be confirmed using the flag table 30.

図2は、図1に示したフラグテーブル30の一例を示している。なお、図2は、各フラグ群FGのフラグFの数が8個のときのフラグテーブル30の一例を示している。図2の網掛けは、ある時点での有効なフラグF(データ)の範囲を示している。例えば、フラグテーブル30は、実行中の複数の命令が同じレジスタRにアクセスするときにも、レジスタRの使用状態を示す情報を命令毎に保持している。図2の列Q(Q0−Q7)は、フラグ群FG内のフラグFの位置を示している。例えば、同じ列QのフラグFは、互いに同じ命令によるレジスタRの使用状態を示している。   FIG. 2 shows an example of the flag table 30 shown in FIG. FIG. 2 shows an example of the flag table 30 when the number of flags F in each flag group FG is eight. The shaded area in FIG. 2 indicates the range of valid flags F (data) at a certain time. For example, the flag table 30 holds information indicating the usage state of the register R for each instruction even when a plurality of instructions being executed access the same register R. A column Q (Q0 to Q7) in FIG. 2 indicates the position of the flag F in the flag group FG. For example, the flag F in the same column Q indicates the usage state of the register R by the same instruction.

フラグテーブル30は、フラグ群FG0−FG15、ポインタ制御部PCNTおよび論理和部ORU(ORU0−ORU15)を有している。フラグ群FGのフラグFは、例えば、命令の発行順にセットされる。フラグFの符号の末尾の1桁の数字は、列Qの符号の末尾の数字に対応している。すなわち、フラグFの符号の末尾の1桁の数字は、フラグ群FG内のフラグFの位置を示している。したがって、例えば、フラグFの符号の末尾の1桁の数字が互いに同じフラグFは、互いに同じ命令によるレジスタRの使用状態を示している。フラグ群FGに対しては、例えば、FIFOと同様の制御が実行される。   The flag table 30 includes flag groups FG0 to FG15, a pointer control unit PCNT, and a logical sum unit ORU (ORU0 to ORU15). The flag F of the flag group FG is set, for example, in the order in which instructions are issued. The one-digit number at the end of the sign of the flag F corresponds to the number at the end of the sign of the column Q. In other words, the last digit of the flag F sign indicates the position of the flag F in the flag group FG. Therefore, for example, flags F having the same one-digit number at the end of the sign of the flag F indicate the use state of the register R by the same instruction. For example, the same control as the FIFO is executed on the flag group FG.

ヘッドポインタHPは、有効なフラグFの先頭の位置(列Q)を示すポインタである。テールポインタTPは、有効なフラグFの最後の位置(列Q)の次の位置(列Q)を示すポインタである。すなわち、テールポインタTPは、新しい命令によりセットされるフラグFの列Qを示すポインタである。したがって、有効なフラグFの範囲(図2の網掛け部分)では、ヘッドポインタHP側のフラグFをセットした命令は、テールポインタTP側のフラグFをセットした命令に先行する命令である。   The head pointer HP is a pointer indicating the head position (column Q) of the valid flag F. The tail pointer TP is a pointer indicating the position (column Q) next to the last position (column Q) of the valid flag F. That is, the tail pointer TP is a pointer indicating the column Q of the flag F set by a new instruction. Therefore, in the range of the valid flag F (the shaded portion in FIG. 2), the instruction that sets the flag F on the head pointer HP side is an instruction that precedes the instruction that sets the flag F on the tail pointer TP side.

ポインタ制御部PCNTは、ヘッドポインタHPおよびテールポインタTPを制御する。例えば、ポインタ制御部PCNTは、ヘッドポインタHPで示される列QのフラグF(図2では、列Q1のフラグF)が全てリセットされたとき、セットされたフラグFが存在する列Qまで、ヘッドポインタHPをフラグ群FGの末尾側(図2の右側)に移動させる。なお、ヘッドポインタHPが列Q7を示している場合、ヘッドポインタHPは、例えば、列Q0に移動する。   The pointer control unit PCNT controls the head pointer HP and the tail pointer TP. For example, when all the flags F of the column Q indicated by the head pointer HP (in FIG. 2, the flag F of the column Q1) are reset, the pointer control unit PCNT heads up to the column Q where the set flag F exists. The pointer HP is moved to the end side (right side in FIG. 2) of the flag group FG. When the head pointer HP indicates the column Q7, the head pointer HP moves to the column Q0, for example.

また、ポインタ制御部PCNTは、例えば、レジスタRにアクセスする命令が発行される度に、テールポインタTPをフラグ群FGの末尾側(図2の右側)に移動させる。例えば、RAW/WAW用フラグテーブル30では、ポインタ制御部PCNTは、レジスタRにデータを書き込む命令が発行される度に、テールポインタTPをフラグ群FGの末尾側(図2の右側)に移動させる。あるいは、WAR用フラグテーブル30では、ポインタ制御部PCNTは、レジスタRからデータを読み出す命令が発行される度に、テールポインタTPをフラグ群FGの末尾側(図2の右側)に移動させる。なお、テールポインタTPが列Q7を示している場合、テールポインタTPは、例えば、列Q0に移動する。   The pointer control unit PCNT moves the tail pointer TP to the end side (right side in FIG. 2) of the flag group FG every time an instruction to access the register R is issued, for example. For example, in the RAW / WAW flag table 30, the pointer control unit PCNT moves the tail pointer TP to the end of the flag group FG (the right side in FIG. 2) every time an instruction to write data to the register R is issued. . Alternatively, in the WAR flag table 30, the pointer control unit PCNT moves the tail pointer TP to the tail side (right side in FIG. 2) of the flag group FG every time an instruction to read data from the register R is issued. When the tail pointer TP indicates the column Q7, the tail pointer TP moves to the column Q0, for example.

各論理和部ORU(ORU0−ORU15)は、各フラグ群FG(FG0−FG15)のフラグFの状態を示す信号、ヘッドポインタHP、テールポインタTPおよび信号CHKを受け、対応するレジスタRの使用状態を示す信号REP(REP0−REP15)を出力する。論理和部ORUおよび信号REPの符号の末尾の数字は、フラグ群FGの符号の末尾の数字に対応している。すなわち、論理和部ORUおよび信号REPの符号の末尾の数字は、レジスタRの符号の末尾の数字に対応している。   Each OR unit ORU (ORU0-ORU15) receives a signal indicating the state of the flag F of each flag group FG (FG0-FG15), the head pointer HP, the tail pointer TP, and the signal CHK, and uses the corresponding register R. A signal REP (REP0-REP15) is output. The numbers at the end of the signs of the logical sum ORU and the signal REP correspond to the numbers at the end of the signs of the flag group FG. That is, the numbers at the end of the signs of the logical sum ORU and the signal REP correspond to the numbers at the end of the signs of the register R.

信号CHKは、例えば、判定対象の命令が発行されたときのテールポインタTPを示す信号である。すなわち、信号CHKの示す位置よりヘッドポインタHP側のフラグFに割り当てられた命令は、判定対象の命令に先行する命令である。例えば、論理和部ORUは、有効なフラグFの範囲のうち、信号CHKが示す位置よりヘッドポインタHP側のフラグFを、論理和の対象として選択する。そして、論理和部ORUは、選択したフラグFの論理和結果を、レジスタRの使用状態を示す信号REPとして出力する。   The signal CHK is, for example, a signal indicating the tail pointer TP when a determination target instruction is issued. That is, the instruction assigned to the flag F on the head pointer HP side from the position indicated by the signal CHK is an instruction preceding the instruction to be determined. For example, the logical sum unit ORU selects the flag F on the head pointer HP side from the position indicated by the signal CHK as the target of the logical sum from the range of the valid flag F. Then, the logical sum unit ORU outputs the logical sum result of the selected flag F as a signal REP indicating the use state of the register R.

すなわち、論理和部ORUは、アクセス対象のレジスタRに対応するフラグ群FGから、判定対象の命令に先行する命令に対応するフラグFを選択する。そして、論理和部ORUは、選択したフラグFの論理和結果REPを判定部60に出力する。これにより、判定部60は、判定対象の命令に先行する命令によるレジスタRの使用状態を、適切に判定できる。   That is, the OR unit ORU selects the flag F corresponding to the instruction preceding the instruction to be determined from the flag group FG corresponding to the register R to be accessed. Then, the logical sum unit ORU outputs the logical sum result REP of the selected flag F to the determination unit 60. Thereby, the determination unit 60 can appropriately determine the usage state of the register R by the instruction preceding the instruction to be determined.

図3は、図2に示した論理和部ORUの一例を示している。なお、図3は、フラグ群FG0に対応する論理和部ORU0の一例を示している。図3では、フラグ群FG0の各フラグF(F000−F007)の状態を示す信号に、各フラグF(F000−F007)と同じ符号を使用する。論理和部ORU0以外の論理和部ORUの構成は、論理和部ORU0と同様である。例えば、論理和部ORU1−ORU15の構成は、論理和部ORU0と同じである。   FIG. 3 shows an example of the logical sum unit ORU shown in FIG. FIG. 3 shows an example of the logical sum unit ORU0 corresponding to the flag group FG0. In FIG. 3, the same reference numerals as those of the flags F (F000-F007) are used as signals indicating the states of the flags F (F000-F007) of the flag group FG0. The configuration of the logical sum unit ORU other than the logical sum unit ORU0 is the same as that of the logical sum unit ORU0. For example, the configuration of the logical sum units ORU1 to ORU15 is the same as that of the logical sum unit ORU0.

論理和部ORU0は、フラグ群FG0のフラグF(F000−F007)に対応する選択部SELU(SELU0−SELU7)と、論理和回路OR1とを有している。選択部SELUの符号の末尾の数字は、フラグFの符号の末尾の1桁の数字に対応している。例えば、選択部SELU0は、フラグF000に対応している。選択部SELU0−SELU7の構成は、互いに同様である。例えば、選択部SELU1−SELU7の構成は、選択部SELU0と同じである。このため、図3では、選択部SELU0について詳細に説明する。   The logical sum unit ORU0 includes a selection unit SELU (SELU0-SELU7) corresponding to the flag F (F000-F007) of the flag group FG0 and a logical sum circuit OR1. The number at the end of the code of the selection unit SELU corresponds to the number of the last digit of the code of the flag F. For example, the selection unit SELU0 corresponds to the flag F000. The configurations of the selection units SELU0 to SELU7 are the same as each other. For example, the configuration of the selection units SELU1 to SELU7 is the same as that of the selection unit SELU0. Therefore, in FIG. 3, the selection unit SELU0 will be described in detail.

選択部SELU0は、信号CHKおよびヘッドポインタHPに基づいて、フラグF000の値と論理値“0”の信号とのいずれかを論理和回路OR1に出力する。例えば、選択部SELU0は、比較部COMP1、COMP2および論理積回路AND1、AND2を有している。   Based on the signal CHK and the head pointer HP, the selection unit SELU0 outputs either the value of the flag F000 or the signal of the logic value “0” to the OR circuit OR1. For example, the selection unit SELU0 includes comparison units COMP1 and COMP2, and AND circuits AND1 and AND2.

比較部COMP1は、信号CHKの示す位置(値)とフラグF000の位置“0”とを比較し、比較結果を論理積回路AND1に出力する。例えば、比較部COMP1は、フラグF000の位置“0”が信号CHKの示す位置(値)より小さいとき、論理値“1”の信号を論理積回路AND1に出力する。また、比較部COMP1は、フラグF000の位置“0”が信号CHKの示す位置(値)以上のとき、論理値“0”の信号を論理積回路AND1に出力する。   The comparison unit COMP1 compares the position (value) indicated by the signal CHK with the position “0” of the flag F000, and outputs the comparison result to the AND circuit AND1. For example, when the position “0” of the flag F000 is smaller than the position (value) indicated by the signal CHK, the comparison unit COMP1 outputs a signal having a logical value “1” to the AND circuit AND1. Further, the comparison unit COMP1 outputs a signal having a logic value “0” to the AND circuit AND1 when the position “0” of the flag F000 is equal to or greater than the position (value) indicated by the signal CHK.

比較部COMP2は、ヘッドポインタHPの示す位置(値)とフラグF000の位置“0”とを比較し、比較結果を論理積回路AND1に出力する。例えば、比較部COMP2は、フラグF000の位置“0”がヘッドポインタHPの示す位置(値)以上のとき、論理値“1”の信号を論理積回路AND1に出力する。また、比較部COMP1は、フラグF000の位置“0”がヘッドポインタHPの示す位置(値)より小さいとき、論理値“0”の信号を論理積回路AND1に出力する。   The comparison unit COMP2 compares the position (value) indicated by the head pointer HP with the position “0” of the flag F000, and outputs the comparison result to the AND circuit AND1. For example, when the position “0” of the flag F000 is greater than or equal to the position (value) indicated by the head pointer HP, the comparison unit COMP2 outputs a signal having a logical value “1” to the AND circuit AND1. Further, when the position “0” of the flag F000 is smaller than the position (value) indicated by the head pointer HP, the comparison unit COMP1 outputs a signal having a logical value “0” to the AND circuit AND1.

論理積回路AND1は、比較部COMP1から受ける比較結果と比較部COMP2から受ける比較結果との論理積結果を、論理積回路AND2出力する。すなわち、比較部COMP1、COMP2および論理積回路AND1を含むブロックは、フラグF000の位置“0”が、ヘッドポインタHPの示す位置(値)以上で、かつ、信号CHKの示す位置(値)より小さいとき、論理値“1”の信号を論理積回路AND2に出力する。   The AND circuit AND1 outputs a logical product result of the comparison result received from the comparison unit COMP1 and the comparison result received from the comparison unit COMP2 to the AND circuit AND2. That is, in the block including the comparison units COMP1 and COMP2 and the AND circuit AND1, the position “0” of the flag F000 is equal to or larger than the position (value) indicated by the head pointer HP and smaller than the position (value) indicated by the signal CHK. At this time, a signal of logical value “1” is output to the AND circuit AND2.

換言すれば、比較部COMP1、COMP2および論理積回路AND1を含むブロックは、フラグF000の位置“0”が論理和の対象範囲のとき、論理値“1”の信号を論理積回路AND2に出力する。したがって、比較部COMP1、COMP2および論理積回路AND1を含むブロックは、フラグF000の位置“0”が論理和の対象範囲外のとき、論理値“0”の信号を論理積回路AND2に出力する。   In other words, the block including the comparison units COMP1 and COMP2 and the logical product circuit AND1 outputs a signal having the logical value “1” to the logical product circuit AND2 when the position “0” of the flag F000 is the logical sum target range. . Therefore, the block including the comparison units COMP1 and COMP2 and the logical product circuit AND1 outputs a signal having a logical value “0” to the logical product circuit AND2 when the position “0” of the flag F000 is outside the logical OR target range.

論理積回路AND2は、フラグF000および論理積回路AND1の出力信号を受ける。そして、論理積回路AND2は、フラグF000と論理積回路AND1の出力信号との論理積結果OUT0を、論理和回路OR1に出力する。すなわち、論理積回路AND2は、フラグF000の位置“0”が論理和の対象範囲のとき、フラグF000の値を信号OUT0として論理和回路OR1に出力する。また、論理積回路AND2は、フラグF000の位置“0”が論理和の対象範囲外のとき、フラグF000の値に拘わらず、論理値“0”の信号OUT0を論理和回路OR1に出力する。   The AND circuit AND2 receives the flag F000 and the output signal of the AND circuit AND1. Then, the logical product circuit AND2 outputs the logical product result OUT0 of the flag F000 and the output signal of the logical product circuit AND1 to the logical sum circuit OR1. That is, the AND circuit AND2 outputs the value of the flag F000 as the signal OUT0 to the OR circuit OR1 when the position “0” of the flag F000 is in the range of the logical sum. Further, when the position “0” of the flag F000 is outside the range of the logical sum, the logical product circuit AND2 outputs the signal OUT0 having the logical value “0” to the logical sum circuit OR1 regardless of the value of the flag F000.

このように、選択部SELU0は、フラグF000の位置“0”が論理和の対象範囲のとき、フラグF000の値を信号OUT0として論理和回路OR1に出力する。また、選択部SELU0は、フラグF000の位置“0”が論理和の対象範囲外のとき、論理値“0”の信号OUT0を論理和回路OR1に出力する。   As described above, the selection unit SELU0 outputs the value of the flag F000 to the logical sum circuit OR1 as the signal OUT0 when the position “0” of the flag F000 is the logical sum target range. The selection unit SELU0 outputs a signal OUT0 having a logical value “0” to the logical sum circuit OR1 when the position “0” of the flag F000 is outside the logical sum target range.

選択部SELU0と同様に、各選択部SELU1−SELU7は、各選択部SELU1−SELU7に対応するフラグFの位置が論理和の対象範囲のとき、フラグFの値を信号OUT(OUT1−OUT7)として論理和回路OR1に出力する。また、各選択部SELU1−SELU7は、各選択部SELU1−SELU7に対応するフラグFの位置が論理和の対象範囲外のとき、論理値“0”の信号OUT(OUT1−OUT7)を論理和回路OR1に出力する。   Similar to the selection unit SELU0, each of the selection units SELU1 to SELU7 uses the value of the flag F as a signal OUT (OUT1 to OUT7) when the position of the flag F corresponding to each selection unit SELU1 to SELU7 is within the logical OR target range. Output to the OR circuit OR1. Each of the selection units SELU1 to SELU7 outputs a signal OUT (OUT1 to OUT7) having a logical value “0” when the position of the flag F corresponding to each selection unit SELU1 to SELU7 is outside the logical sum target range. Output to OR1.

例えば、選択部SELU1は、フラグF001の位置“1”が論理和の対象範囲のとき、フラグF001の値を信号OUT1として論理和回路OR1に出力する。また、選択部SELU1は、フラグF001の位置“1”が論理和の対象範囲外のとき、論理値“0”の信号OUT1を論理和回路OR1に出力する。   For example, the selection unit SELU1 outputs the value of the flag F001 as the signal OUT1 to the logical sum circuit OR1 when the position “1” of the flag F001 is the logical sum target range. The selection unit SELU1 outputs a signal OUT1 having a logical value “0” to the logical sum circuit OR1 when the position “1” of the flag F001 is outside the logical sum target range.

なお、例えば、図2において、ヘッドポインタHPがテールポインタTPの右側に位置する場合、各選択部SELUの比較部COMP1等は、テールポインタTPの示す位置(値)以下のフラグFの位置等を補正して、比較する。すなわち、図2において、ヘッドポインタHPの示す位置(列Qの符号の末尾の数字)がテールポインタTPの示す位置(列Qの符号の末尾の数字)より大きい場合、各選択部SELUの比較部COMP1等は、テールポインタTPの示す位置以下のフラグFの位置等を補正して、比較する。   For example, in FIG. 2, when the head pointer HP is positioned on the right side of the tail pointer TP, the comparison unit COMP1 of each selection unit SELU indicates the position of the flag F below the position (value) indicated by the tail pointer TP. Correct and compare. That is, in FIG. 2, when the position indicated by the head pointer HP (the last digit of the code of the column Q) is larger than the position indicated by the tail pointer TP (the last digit of the code of the column Q), the comparison unit of each selection unit SELU. COMP1 or the like corrects and compares the position of the flag F below the position indicated by the tail pointer TP.

例えば、図2において、ヘッドポインタHPの示す位置がテールポインタTPの示す位置より大きい場合、テールポインタTPの示す位置以下のフラグFの位置は、フラグFの符号の末尾の1桁の数字に8を加算した値に換算して、比較される。同様に、ヘッドポインタHPの示す位置がテールポインタTPの示す位置より大きい場合、例えば、テールポインタTPの示す位置以下に対応する位置を示す信号CHKは、信号CHKの示す位置(値)に8を加算した値に換算して、比較される。   For example, in FIG. 2, when the position indicated by the head pointer HP is larger than the position indicated by the tail pointer TP, the position of the flag F below the position indicated by the tail pointer TP is 8 in the last digit of the sign of the flag F. It is converted into a value obtained by adding and compared. Similarly, when the position indicated by the head pointer HP is larger than the position indicated by the tail pointer TP, for example, the signal CHK indicating a position corresponding to the position indicated by the tail pointer TP or less indicates 8 at the position (value) indicated by the signal CHK. It is converted into the added value and compared.

論理和回路OR1は、選択部SELU0−SELU7から受ける信号OUT0−OUT7の論理和結果REP0を出力する。これにより、信号CHKの示す位置に対応する命令(判定対象の命令)に先行する命令によるレジスタR0の使用状態を示す信号REP0が、図1に示した判定部60に出力される。   The OR circuit OR1 outputs a logical sum result REP0 of the signals OUT0 to OUT7 received from the selection units SELU0 to SELU7. As a result, the signal REP0 indicating the usage state of the register R0 by the instruction preceding the instruction corresponding to the position indicated by the signal CHK (the instruction to be determined) is output to the determination unit 60 illustrated in FIG.

なお、論理和部ORUの構成は、この例に限定されない。また、プロセッサ10の構成は、図1−図3で説明した例に限定されない。例えば、判定部60は、図2および図3に示した論理和部ORUを有してもよい。この場合、論理和部ORUは、フラグテーブル30から省かれる。   The configuration of the logical sum unit ORU is not limited to this example. Further, the configuration of the processor 10 is not limited to the example described with reference to FIGS. For example, the determination unit 60 may include the logical sum unit ORU illustrated in FIGS. In this case, the logical sum unit ORU is omitted from the flag table 30.

図4は、図1に示したプロセッサ10の動作の一例を示している。なお、図4は、フラグテーブル30をRAW/WAW用フラグテーブル30として使用するプロセッサ10の動作の一例を示している。例えば、プロセッサ10は、RAW/WAW用フラグテーブル30を用いて、スコアボード制御と同様の制御を実行する。図4の例では、プロセッサ10は、命令発行ステージIS、レジスタ読み出しステージRR、実行ステージEXおよびレジスタ書き込みステージWBを有するパイプライン処理を実行する。図4では、図を見やすくするために、命令IS1、IS3とフラグ群FG0、FG15との間の信号を抜粋して記載している。   FIG. 4 shows an example of the operation of the processor 10 shown in FIG. FIG. 4 shows an example of the operation of the processor 10 that uses the flag table 30 as the RAW / WAW flag table 30. For example, the processor 10 uses the RAW / WAW flag table 30 to execute control similar to scoreboard control. In the example of FIG. 4, the processor 10 executes pipeline processing having an instruction issue stage IS, a register read stage RR, an execution stage EX, and a register write stage WB. In FIG. 4, in order to make the drawing easy to see, signals between the instructions IS1 and IS3 and the flag groups FG0 and FG15 are extracted and described.

命令IS1は、レジスタR0、R15以外のレジスタRからデータを読み出し、レジスタR0に実行結果(データ)を書き込む命令である。命令IS2は、レジスタR0、R15以外のレジスタRからデータを読み出し、レジスタR0、R15以外のレジスタRに実行結果(データ)を書き込む命令である。命令IS3は、レジスタR0からデータを読み出し、レジスタR15に実行結果(データ)を書き込む命令である。   The instruction IS1 is an instruction that reads data from a register R other than the registers R0 and R15 and writes an execution result (data) to the register R0. The instruction IS2 is an instruction that reads data from a register R other than the registers R0 and R15 and writes an execution result (data) to a register R other than the registers R0 and R15. The instruction IS3 is an instruction that reads data from the register R0 and writes an execution result (data) to the register R15.

例えば、命令IS1の命令発行ステージIDでは、プロセッサ10は、命令IS1を命令メモリから読み出す。そして、プロセッサ10は、命令メモリから読み出した命令IS1を解読し、命令IS1を発行する。さらに、プロセッサ10のフラグセット部40は、命令IS1の実行結果が書き込まれるレジスタR0に対応するフラグ群FG0のフラグF003を、セット信号SETCを用いて“1”にセットする。すなわち、フラグF003は、命令IS1が発行される際にセットされる。   For example, in the instruction issue stage ID of the instruction IS1, the processor 10 reads the instruction IS1 from the instruction memory. Then, the processor 10 decodes the instruction IS1 read from the instruction memory and issues the instruction IS1. Furthermore, the flag setting unit 40 of the processor 10 sets the flag F003 of the flag group FG0 corresponding to the register R0 into which the execution result of the instruction IS1 is written to “1” using the set signal SETC. That is, the flag F003 is set when the instruction IS1 is issued.

命令IS1のレジスタ読み出しステージRRでは、プロセッサ10は、命令IS1で使用するデータを、オペランドで指定されたレジスタRから読み出す。命令IS1の実行ステージEXでは、レジスタ読み出しステージRRで読み出したデータを用いて、命令IS1に基づく処理(演算等)を実行する。   In the register read stage RR of the instruction IS1, the processor 10 reads data used in the instruction IS1 from the register R specified by the operand. In the execution stage EX of the instruction IS1, processing (calculation or the like) based on the instruction IS1 is executed using the data read in the register read stage RR.

命令IS1のレジスタ書き込みステージWBでは、プロセッサ10の判定部60は、命令IS1の先行命令によるレジスタR0の使用状態を判定する。例えば、判定部60は、命令IS1に対応するフラグF003の位置“3”を示す信号CHKを、フラグテーブル30に出力する。そして、判定部60は、命令IS1の先行命令によるレジスタR0の使用状態を示す信号REP0を、フラグテーブル30から受ける。判定部60は、フラグテーブル30から受ける信号REP0に基づいて、命令IS1の先行命令によるレジスタR0へのデータの書き込みが終了したか否かを判定する。   In the register write stage WB of the instruction IS1, the determination unit 60 of the processor 10 determines the use state of the register R0 by the preceding instruction of the instruction IS1. For example, the determination unit 60 outputs a signal CHK indicating the position “3” of the flag F003 corresponding to the instruction IS1 to the flag table 30. Then, the determination unit 60 receives the signal REP0 indicating the usage state of the register R0 by the instruction preceding the instruction IS1 from the flag table 30. Based on signal REP0 received from flag table 30, determination unit 60 determines whether or not the writing of data to register R0 by the preceding instruction of instruction IS1 is completed.

例えば、ヘッドポイントHPがフラグF000の位置“0”を示している場合、フラグF000−F002の全てが“0”にリセットされているとき、命令IS1の先行命令によるレジスタR0へのデータの書き込みは、終了している。また、例えば、ヘッドポイントHPがフラグF000の位置“0”を示している場合、フラグF000−F002の少なくとも1つが“1”にセットされているとき、命令IS1の先行命令によるレジスタR0へのデータの書き込みは、終了していない。   For example, when the head point HP indicates the position “0” of the flag F000, when all of the flags F000-F002 are reset to “0”, data is written to the register R0 by the preceding instruction of the instruction IS1. Have finished. Further, for example, when the head point HP indicates the position “0” of the flag F000, when at least one of the flags F000-F002 is set to “1”, data to the register R0 by the preceding instruction of the instruction IS1 Writing has not been completed.

命令IS1の先行命令によるレジスタR0へのデータの書き込みが終了しているとき、プロセッサ10は、実行結果をレジスタR0に書き込む。さらに、プロセッサ10のフラグリセット部50は、命令発行ステージIDでセットしたフラグ群FG0のフラグF003を、リセット信号RSTCを用いて“0”にリセットする。すなわち、フラグF003は、命令IS1によりレジスタR0にデータが書き込まれる際に、リセットされる。   When the writing of data to the register R0 by the preceding instruction of the instruction IS1 is completed, the processor 10 writes the execution result to the register R0. Further, the flag reset unit 50 of the processor 10 resets the flag F003 of the flag group FG0 set at the instruction issue stage ID to “0” using the reset signal RSTC. That is, the flag F003 is reset when data is written to the register R0 by the instruction IS1.

なお、命令IS1の先行命令によるレジスタR0へのデータの書き込みが終了していないとき、プロセッサ10は、レジスタ書き込みステージWBおよびレジスタ書き込みステージWBより上流のステージ(ステージID、RR、EX)の処理をストールさせる。例えば、プロセッサ10は、命令IS1の先行命令によるレジスタR0へのデータの書き込みが終了するまで、命令発行ステージID、レジスタ読み出しステージRR、実行ステージEXおよびレジスタ書き込みステージWBの処理をストールさせる。   Note that when the writing of data to the register R0 by the preceding instruction of the instruction IS1 is not completed, the processor 10 performs processing of the register writing stage WB and the stages upstream of the register writing stage WB (stage ID, RR, EX). Stall. For example, the processor 10 stalls the processing of the instruction issue stage ID, the register read stage RR, the execution stage EX, and the register write stage WB until the writing of data to the register R0 by the instruction preceding the instruction IS1 is completed.

このように、判定部60は、実行中の複数の命令ISが同じレジスタR0にデータを書き込むときにも、命令IS1の先行命令によるレジスタR0のへのデータの書き込みが終了したか否かを、信号REP0に基づいて判定できる。これにより、プロセッサ10は、実行中の複数の命令ISが同じレジスタR0にデータを書き込むときにも、命令IS1を、WAW依存を守って実行できる。また、例えば、プロセッサ10は、命令の発行をアウト・オブ・オーダで実行するときにも、WAW依存を守ることができる。   In this way, the determination unit 60 determines whether or not the writing of data to the register R0 by the preceding instruction of the instruction IS1 is completed even when a plurality of currently executed instructions IS writes data to the same register R0. A determination can be made based on the signal REP0. As a result, the processor 10 can execute the instruction IS1 while keeping the WAW dependence, even when a plurality of instructions IS being executed writes data to the same register R0. In addition, for example, the processor 10 can protect WAW dependence when executing the issuance of instructions out of order.

命令IS2の各ステージID、RR、EX、WBは、命令IS1の各ステージID、RR、EX、WBが終了した後に実行される。例えば、命令IS2の命令発行ステージIDは、命令IS1の命令発行ステージIDが終了した後に、実行される。命令IS2の各ステージID、RR、EX、WBの処理は、アクセスするレジスタR、フラグF等を除いて、命令IS1の各ステージID、RR、EX、WBの処理と同様である。   Each stage ID, RR, EX, and WB of the instruction IS2 is executed after each stage ID, RR, EX, and WB of the instruction IS1 is completed. For example, the instruction issue stage ID of the instruction IS2 is executed after the instruction issue stage ID of the instruction IS1 is completed. The processing of each stage ID, RR, EX, and WB of the instruction IS2 is the same as the processing of each stage ID, RR, EX, and WB of the instruction IS1, except for the register R and flag F to be accessed.

命令IS3の各ステージID、RR、EX、WBは、命令IS2の各ステージID、RR、EX、WBが終了した後に実行される。例えば、命令IS3の命令発行ステージIDは、命令IS2の命令発行ステージIDが終了した後に、実行される。命令IS3の各ステージID、RR、EX、WBの処理は、アクセスするレジスタR、フラグF等を除いて、命令IS1の各ステージID、RR、EX、WBの処理と同様である。   Each stage ID, RR, EX, and WB of the instruction IS3 is executed after each stage ID, RR, EX, and WB of the instruction IS2 is completed. For example, the instruction issue stage ID of the instruction IS3 is executed after the instruction issue stage ID of the instruction IS2 is completed. The processing of each stage ID, RR, EX, and WB of the instruction IS3 is the same as the processing of each stage ID, RR, EX, and WB of the instruction IS1, except for the register R and flag F to be accessed.

例えば、命令IS3の命令発行ステージIDでは、プロセッサ10は、命令メモリから読み出した命令IS3を解読し、命令IS3を発行する。さらに、プロセッサ10のフラグセット部40は、命令IS3の実行結果が書き込まれるレジスタR15に対応するフラグ群FG15のフラグF155を、セット信号SETCを用いて“1”にセットする。すなわち、フラグF155は、命令IS3が発行される際にセットされる。   For example, in the instruction issue stage ID of the instruction IS3, the processor 10 decodes the instruction IS3 read from the instruction memory and issues the instruction IS3. Further, the flag setting unit 40 of the processor 10 sets the flag F155 of the flag group FG15 corresponding to the register R15 to which the execution result of the instruction IS3 is written to “1” using the set signal SETC. That is, the flag F155 is set when the instruction IS3 is issued.

命令IS3のレジスタ読み出しステージRRでは、プロセッサ10の判定部60は、命令IS3の先行命令によるレジスタR0の使用状態を判定する。例えば、判定部60は、命令IS3に対応するフラグFの位置“5”を示す信号CHKを、フラグテーブル30に出力する。そして、判定部60は、命令IS3の先行命令によるレジスタR0の使用状態を示す信号REP0を、フラグテーブル30から受ける。判定部60は、フラグテーブル30から受ける信号REP0に基づいて、命令IS3の先行命令によるレジスタR0へのデータの書き込みが終了したか否かを判定する。   In the register read stage RR of the instruction IS3, the determination unit 60 of the processor 10 determines the usage state of the register R0 by the preceding instruction of the instruction IS3. For example, the determination unit 60 outputs a signal CHK indicating the position “5” of the flag F corresponding to the instruction IS3 to the flag table 30. Then, the determination unit 60 receives the signal REP0 indicating the usage state of the register R0 by the preceding instruction of the instruction IS3 from the flag table 30. Based on signal REP0 received from flag table 30, determination unit 60 determines whether or not the writing of data to register R0 by the preceding instruction of instruction IS3 is completed.

例えば、ヘッドポイントHPがフラグF003の位置“3”を示している場合、フラグF003、F004の全てが“0”にリセットされているとき、命令IS3の先行命令によるレジスタR0へのデータの書き込みは、終了している。また、例えば、ヘッドポイントHPがフラグF003の位置“3”を示している場合、フラグF003、F004の少なくとも1つが“1”にセットされているとき、命令IS3の先行命令によるレジスタR0へのデータの書き込みは、終了していない。   For example, when the head point HP indicates the position “3” of the flag F003, when all of the flags F003 and F004 are reset to “0”, data is written to the register R0 by the preceding instruction of the instruction IS3. Have finished. Further, for example, when the head point HP indicates the position “3” of the flag F003, when at least one of the flags F003 and F004 is set to “1”, data to the register R0 by the preceding instruction of the instruction IS3 Writing has not been completed.

例えば、図4では、命令IS2がレジスタR0にデータを書き込まないため、フラグF004は、“0”にリセットされている。したがって、判定部60は、例えば、フラグF003が“0”にリセットされているとき、論理値“0”の信号REP0を受ける。すなわち、図4の例では、ヘッドポイントHPがフラグF003の位置“3”を示している場合、命令IS1によるレジスタR0へのデータの書き込みが終了したとき、判定部60は、論理値“0”の信号REP0を受ける。これにより、判定部60は、命令IS3の先行命令によるレジスタR0へのデータの書き込みが終了したと判定する。   For example, in FIG. 4, since the instruction IS2 does not write data to the register R0, the flag F004 is reset to “0”. Therefore, for example, when the flag F003 is reset to “0”, the determination unit 60 receives the signal REP0 having a logical value “0”. That is, in the example of FIG. 4, when the head point HP indicates the position “3” of the flag F003, when the writing of data to the register R0 by the instruction IS1 is completed, the determination unit 60 determines the logical value “0”. Signal REP0. As a result, the determination unit 60 determines that the writing of data to the register R0 by the preceding instruction of the instruction IS3 is completed.

なお、図4において、例えば、命令IS2がレジスタR0にデータを書き込む命令である場合、命令IS2に対応するフラグF004は、“1”にセットされる。したがって、フラグF003が“0”にリセットされても、フラグF004が“1”にセットされている期間は、判定部60は、論理値“1”の信号REP0を受ける。このため、判定部60は、命令IS3の先行命令によるレジスタR0へのデータの書き込みが終了していないと判定する。このように、判定部60は、実行中の複数の命令ISが同じレジスタR0にデータを書き込むときにも、命令IS3の先行命令によるレジスタR0へのデータの書き込みが終了したか否かを、信号REP0に基づいて判定できる。   In FIG. 4, for example, when the instruction IS2 is an instruction to write data to the register R0, the flag F004 corresponding to the instruction IS2 is set to “1”. Therefore, even if the flag F003 is reset to “0”, the determination unit 60 receives the signal REP0 having the logical value “1” during the period in which the flag F004 is set to “1”. For this reason, the determination unit 60 determines that the writing of data to the register R0 by the preceding instruction of the instruction IS3 is not completed. In this way, the determination unit 60 indicates whether or not the writing of data to the register R0 by the preceding instruction of the instruction IS3 is completed even when a plurality of currently executed instructions IS writes data to the same register R0. The determination can be made based on REP0.

命令IS3の先行命令によるレジスタR0へのデータの書き込みが終了しているとき、プロセッサ10は、命令IS3で使用するデータを、レジスタR0から読み出す。なお、命令IS3の先行命令によるレジスタR0へのデータの書き込みが終了していないとき、プロセッサ10は、レジスタ読み出しステージRRおよびレジスタ読み出しステージRRより上流の命令発行ステージISの処理をストールさせる。例えば、プロセッサ10は、命令IS3の先行命令によるレジスタR0へのデータの書き込みが終了するまで、命令発行ステージISおよびレジスタ読み出しステージRRの処理をストールさせる。   When the writing of data to the register R0 by the instruction preceding the instruction IS3 has been completed, the processor 10 reads data used by the instruction IS3 from the register R0. Note that when the writing of data to the register R0 by the preceding instruction of the instruction IS3 is not completed, the processor 10 stalls the processing of the register reading stage RR and the instruction issuing stage IS upstream from the register reading stage RR. For example, the processor 10 stalls the processing of the instruction issue stage IS and the register read stage RR until the writing of data to the register R0 by the instruction preceding the instruction IS3 is completed.

このように、プロセッサ10は、実行中の複数の命令ISが同じレジスタR0にデータを書き込むときにも、命令IS3の先行命令によるレジスタR0のへのデータの書き込みが終了したか否かを、信号REP0に基づいて判定できる。これにより、プロセッサ10は、実行中の複数の命令ISが同じレジスタR0にデータを書き込むときにも、命令IS3を、RAW依存を守って実行できる。また、例えば、プロセッサ10は、命令の発行をアウト・オブ・オーダで実行するときにも、RAW依存を守ることができる。   In this way, the processor 10 indicates whether or not the writing of data to the register R0 by the preceding instruction of the instruction IS3 is completed even when a plurality of instructions IS being written writes data to the same register R0. The determination can be made based on REP0. As a result, the processor 10 can execute the instruction IS3 while keeping the RAW dependence even when a plurality of instructions IS being executed writes data to the same register R0. In addition, for example, the processor 10 can protect the RAW dependency even when the instruction issuance is executed out of order.

命令IS3の実行ステージEXでは、レジスタ読み出しステージRRで読み出したデータを用いて、命令IS3に基づく処理(演算等)を実行する。命令IS3のレジスタ書き込みステージWBでは、プロセッサ10は、実行結果をレジスタR15に書き込む。さらに、プロセッサ10のフラグリセット部50は、命令発行ステージIDでセットしたフラグ群FG15のフラグF155を、リセット信号RSTCを用いて“0”にリセットする。すなわち、フラグF155は、命令IS3によりレジスタR15にデータが書き込まれる際に、リセットされる。   In the execution stage EX of the instruction IS3, processing (calculation or the like) based on the instruction IS3 is executed using the data read in the register read stage RR. In the register write stage WB of the instruction IS3, the processor 10 writes the execution result in the register R15. Further, the flag reset unit 50 of the processor 10 resets the flag F155 of the flag group FG15 set at the instruction issue stage ID to “0” using the reset signal RSTC. That is, the flag F155 is reset when data is written to the register R15 by the instruction IS3.

このように、RAW依存の確認処理およびWAW依存の確認処理の両方とも、命令発行ステージIDにフラグFがセットされ、レジスタ書き込みステージWBにフラグFがリセットされる。このため、この実施形態では、RAW依存およびWAW依存の両方を共通のフラグテーブル30を用いて確認できる。なお、RAW依存の確認処理とWAW依存の確認処理とでは、フラグFを参照するタイミング(パイプライン処理のステージ)が異なる。   Thus, in both the RAW-dependent confirmation process and the WAW-dependent confirmation process, the flag F is set in the instruction issue stage ID, and the flag F is reset in the register write stage WB. For this reason, in this embodiment, both the RAW dependency and the WAW dependency can be confirmed using the common flag table 30. Note that the timing for referencing the flag F (the stage of pipeline processing) differs between the RAW-dependent confirmation processing and the WAW-dependent confirmation processing.

例えば、1つの命令に対する処理でRAW依存およびWAW依存の両方を確認する場合、プロセッサ10は、フラグ群FG(より詳細には、判定対象の命令の先行命令に対応するフラグF)の状態を、レジスタRからデータを読み出す際およびレジスタRにデータを書き込む際にそれぞれ確認する。すなわち、1つの命令に対する処理でRAW依存およびWAW依存の両方を確認する場合、プロセッサ10は、フラグ群FGの状態を2回確認する。   For example, when confirming both RAW dependency and WAW dependency in the processing for one instruction, the processor 10 determines the state of the flag group FG (more specifically, the flag F corresponding to the preceding instruction of the instruction to be determined) This is confirmed when data is read from the register R and when data is written to the register R. That is, when confirming both RAW dependency and WAW dependency in the processing for one instruction, the processor 10 confirms the state of the flag group FG twice.

なお、RAW/WAW用フラグテーブル30は、レジスタ読み出しステージRRで送信された信号CHKとレジスタ書き込みステージWBで送信された信号CHKとをほぼ同時に受けたとき、例えば、先に発行された命令に対応する信号CHKに基づく処理を先に実行する。   When the RAW / WAW flag table 30 receives the signal CHK transmitted at the register read stage RR and the signal CHK transmitted at the register write stage WB almost simultaneously, for example, it corresponds to the previously issued instruction. The processing based on the signal CHK to be performed is executed first.

図5は、図1に示したプロセッサ10の動作の別の例を示している。なお、図5は、フラグテーブル30をWAR用フラグテーブル30として使用するプロセッサ10の動作の一例を示している。例えば、プロセッサ10は、WAR用フラグテーブル30を用いて、スコアボード制御と同様の制御を実行する。図5の例では、プロセッサ10は、命令発行ステージIS、レジスタ読み出しステージRR、実行ステージEXおよびレジスタ書き込みステージWBを有するパイプライン処理を実行する。   FIG. 5 shows another example of the operation of the processor 10 shown in FIG. FIG. 5 shows an example of the operation of the processor 10 that uses the flag table 30 as the WAR flag table 30. For example, the processor 10 uses the WAR flag table 30 to execute the same control as the scoreboard control. In the example of FIG. 5, the processor 10 executes pipeline processing having an instruction issue stage IS, a register read stage RR, an execution stage EX, and a register write stage WB.

各ステージID、RR、EX、WBの処理は、フラグFに関する動作やアクセスするレジスタ等を除いて、図4で説明した各ステージID、RR、EX、WBの処理と同様である。図4で説明した処理については、詳細な説明を省略する。図5では、図を見やすくするために、命令IS4、IS6とフラグ群FG0、FG15との間の信号を抜粋して記載している。   The processing of each stage ID, RR, EX, and WB is the same as the processing of each stage ID, RR, EX, and WB described with reference to FIG. 4 except for the operation related to the flag F and the register to be accessed. Detailed description of the processing described in FIG. 4 is omitted. In FIG. 5, signals between the instructions IS4 and IS6 and the flag groups FG0 and FG15 are extracted and described for easy understanding of the drawing.

命令IS4は、レジスタR0からデータを読み出し、レジスタR0、R15以外のレジスタRに実行結果(データ)を書き込む命令である。命令IS5は、レジスタR0、R15以外のレジスタRからデータを読み出し、レジスタR0、R15以外のレジスタRに実行結果(データ)を書き込む命令である。命令IS6は、レジスタR15からデータを読み出し、レジスタR0に実行結果(データ)を書き込む命令である。   The instruction IS4 is an instruction that reads data from the register R0 and writes an execution result (data) to a register R other than the registers R0 and R15. The instruction IS5 is an instruction that reads data from a register R other than the registers R0 and R15 and writes an execution result (data) to a register R other than the registers R0 and R15. The instruction IS6 is an instruction that reads data from the register R15 and writes an execution result (data) to the register R0.

例えば、命令IS4の命令発行ステージIDでは、プロセッサ10は、命令メモリから読み出した命令IS4を解読し、命令IS4を発行する。さらに、プロセッサ10のフラグセット部40は、命令IS4で使用するデータが読み出されるレジスタR0に対応するフラグ群FG0のフラグF003を、セット信号SETCを用いて“1”にセットする。すなわち、フラグF003は、命令IS4が発行される際にセットされる。   For example, in the instruction issue stage ID of the instruction IS4, the processor 10 decodes the instruction IS4 read from the instruction memory and issues the instruction IS4. Further, the flag setting unit 40 of the processor 10 sets the flag F003 of the flag group FG0 corresponding to the register R0 from which data used by the instruction IS4 is read to “1” using the set signal SETC. That is, the flag F003 is set when the instruction IS4 is issued.

命令IS4のレジスタ読み出しステージRRでは、プロセッサ10は、命令IS4で使用するデータを、レジスタR0から読み出す。さらに、プロセッサ10のフラグリセット部50は、命令発行ステージIDでセットしたフラグ群FG0のフラグF003を、リセット信号RSTCを用いて“0”にリセットする。すなわち、フラグF003は、命令IS4によりレジスタR0からデータが読み出される際に、リセットされる。   In the register read stage RR of the instruction IS4, the processor 10 reads data used in the instruction IS4 from the register R0. Further, the flag reset unit 50 of the processor 10 resets the flag F003 of the flag group FG0 set at the instruction issue stage ID to “0” using the reset signal RSTC. That is, the flag F003 is reset when data is read from the register R0 by the instruction IS4.

命令IS4の実行ステージEXでは、レジスタ読み出しステージRRで読み出したデータを用いて、命令IS4に基づく処理(演算等)を実行する。命令IS4のレジスタ書き込みステージWBでは、例えば、プロセッサ10は、オペランドで指定されたレジスタRに実行結果を書き込む。なお、レジスタRへの実行結果の書き込みは、命令IS6に示すように、実行結果が書き込まれるレジスタRの使用状態を確認した後に、実行される。   In the execution stage EX of the instruction IS4, processing (calculation or the like) based on the instruction IS4 is executed using the data read in the register read stage RR. In the register write stage WB of the instruction IS4, for example, the processor 10 writes the execution result in the register R specified by the operand. Note that the execution result is written to the register R after confirming the use state of the register R to which the execution result is written, as shown in the instruction IS6.

命令IS5の各ステージID、RR、EX、WBは、命令IS4の各ステージID、RR、EX、WBが終了した後に実行される。例えば、命令IS5の命令発行ステージIDは、命令IS4の命令発行ステージIDが終了した後に、実行される。命令IS5の各ステージID、RR、EX、WBの処理は、アクセスするレジスタR、フラグF等を除いて、命令IS4の各ステージID、RR、EX、WBの処理と同様である。   Each stage ID, RR, EX, and WB of the instruction IS5 is executed after each stage ID, RR, EX, and WB of the instruction IS4 is completed. For example, the instruction issue stage ID of the instruction IS5 is executed after the instruction issue stage ID of the instruction IS4 is completed. The processing of each stage ID, RR, EX, and WB of the instruction IS5 is the same as the processing of each stage ID, RR, EX, and WB of the instruction IS4, except for the register R and flag F to be accessed.

命令IS6の各ステージID、RR、EX、WBは、命令IS5の各ステージID、RR、EX、WBが終了した後に実行される。例えば、命令IS6の命令発行ステージIDは、命令IS5の命令発行ステージIDが終了した後に、実行される。命令IS6の各ステージID、RR、EX、WBの処理は、アクセスするレジスタR、フラグF等を除いて、命令IS4の各ステージID、RR、EX、WBの処理と同様である。   The stage ID, RR, EX, and WB of the instruction IS6 are executed after the stage ID, RR, EX, and WB of the instruction IS5 are completed. For example, the instruction issue stage ID of the instruction IS6 is executed after the instruction issue stage ID of the instruction IS5 is completed. The processing of each stage ID, RR, EX, and WB of the instruction IS6 is the same as the processing of each stage ID, RR, EX, and WB of the instruction IS4, except for the register R and the flag F that are accessed.

例えば、命令IS6の命令発行ステージIDでは、プロセッサ10は、命令メモリから読み出した命令IS6を解読し、命令IS6を発行する。さらに、プロセッサ10のフラグセット部40は、命令IS6で使用するデータが読み出されるレジスタR15に対応するフラグ群FG15のフラグF155を、セット信号SETCを用いて“1”にセットする。すなわち、フラグF155は、命令IS6が発行される際にセットされる。   For example, in the instruction issue stage ID of the instruction IS6, the processor 10 decodes the instruction IS6 read from the instruction memory and issues the instruction IS6. Further, the flag setting unit 40 of the processor 10 sets the flag F155 of the flag group FG15 corresponding to the register R15 from which data used by the instruction IS6 is read to “1” using the set signal SETC. That is, the flag F155 is set when the instruction IS6 is issued.

命令IS6のレジスタ読み出しステージRRでは、プロセッサ10は、命令IS6で使用するデータを、レジスタR15から読み出す。さらに、プロセッサ10のフラグリセット部50は、命令発行ステージIDでセットしたフラグ群FG15のフラグF115を、リセット信号RSTCを用いて“0”にリセットする。すなわち、フラグF115は、命令IS6によりレジスタR15からデータが読み出される際に、リセットされる。命令IS6の実行ステージEXでは、レジスタ読み出しステージRRで読み出したデータを用いて、命令IS6を実行する。   In the register read stage RR of the instruction IS6, the processor 10 reads data used in the instruction IS6 from the register R15. Further, the flag reset unit 50 of the processor 10 resets the flag F115 of the flag group FG15 set by the instruction issue stage ID to “0” using the reset signal RSTC. That is, the flag F115 is reset when data is read from the register R15 by the instruction IS6. In the execution stage EX of the instruction IS6, the instruction IS6 is executed using the data read in the register read stage RR.

命令IS6のレジスタ書き込みステージWBでは、プロセッサ10の判定部60は、命令IS6の先行命令によるレジスタR0の使用状態を判定する。例えば、判定部60は、命令IS6に対応するフラグFの位置“5”を示す信号CHKを、フラグテーブル30に出力する。そして、判定部60は、命令IS6の先行命令によるレジスタR0の使用状態を示す信号REP0を、フラグテーブル30から受ける。判定部60は、フラグテーブル30から受ける信号REP0に基づいて、命令IS6の先行命令によるレジスタR0からのデータの読み出しが終了したか否かを判定する。   In the register write stage WB of the instruction IS6, the determination unit 60 of the processor 10 determines the use state of the register R0 by the preceding instruction of the instruction IS6. For example, the determination unit 60 outputs a signal CHK indicating the position “5” of the flag F corresponding to the instruction IS6 to the flag table 30. Then, the determination unit 60 receives the signal REP0 indicating the usage state of the register R0 by the preceding instruction of the instruction IS6 from the flag table 30. Based on signal REP0 received from flag table 30, determination unit 60 determines whether or not reading of data from register R0 by the preceding instruction of instruction IS6 has been completed.

例えば、ヘッドポイントHPがフラグF003の位置“3”を示している場合、フラグF003、F004の全てが“0”にリセットされているとき、命令IS6の先行命令によるレジスタR0からのデータの読み出しは、終了している。また、例えば、ヘッドポイントHPがフラグF003の位置“3”を示している場合、フラグF003、F004の少なくとも1つが“1”にセットされているとき、命令IS6の先行命令によるレジスタR0からのデータの読み出しは、終了していない。   For example, when the head point HP indicates the position “3” of the flag F003, when all of the flags F003 and F004 are reset to “0”, reading of data from the register R0 by the preceding instruction of the instruction IS6 is performed. Have finished. Further, for example, when the head point HP indicates the position “3” of the flag F003, when at least one of the flags F003 and F004 is set to “1”, the data from the register R0 by the preceding instruction of the instruction IS6 The reading of is not completed.

例えば、図5では、命令IS5は、レジスタR0からデータを読み出さないため、フラグF004は、“0”にリセットされている。したがって、判定部60は、例えば、フラグF003が“0”にリセットされているとき、論理値“0”の信号REP0を受ける。すなわち、図5の例では、ヘッドポイントHPがフラグF003の位置“3”を示している場合、命令IS4によるレジスタR0からのデータの読み出しが終了したとき、判定部60は、論理値“0”の信号REP0を受ける。これにより、判定部60は、命令IS6の先行命令によるレジスタR0からのデータの読み出しが終了したと判定する。   For example, in FIG. 5, since the instruction IS5 does not read data from the register R0, the flag F004 is reset to “0”. Therefore, for example, when the flag F003 is reset to “0”, the determination unit 60 receives the signal REP0 having a logical value “0”. In other words, in the example of FIG. 5, when the head point HP indicates the position “3” of the flag F003, when the reading of data from the register R0 by the instruction IS4 is completed, the determination unit 60 sets the logical value “0”. Signal REP0. Thereby, the determination unit 60 determines that reading of data from the register R0 by the preceding instruction of the instruction IS6 is completed.

なお、図5において、例えば、命令IS5がレジスタR0からデータを読み出す命令である場合、命令IS5に対応するフラグF004は、“1”にセットされる。したがって、フラグF003が“0”にリセットされても、フラグF004が“1”にセットされている期間は、判定部60は、論理値“1”の信号REP0を受ける。このため、判定部60は、命令IS6の先行命令によるレジスタR0からのデータの読み出しが終了していないと判定する。このように、判定部60は、実行中の複数の命令ISが同じレジスタR0からデータを読み出すときにも、命令IS6の先行命令によるレジスタR0からのデータの読み出しが終了したか否かを、信号REP0に基づいて判定できる。   In FIG. 5, for example, when the instruction IS5 is an instruction for reading data from the register R0, the flag F004 corresponding to the instruction IS5 is set to “1”. Therefore, even if the flag F003 is reset to “0”, the determination unit 60 receives the signal REP0 having the logical value “1” during the period in which the flag F004 is set to “1”. For this reason, the determination unit 60 determines that reading of data from the register R0 by the preceding instruction of the instruction IS6 has not been completed. In this way, the determination unit 60 indicates whether or not the reading of data from the register R0 by the preceding instruction of the instruction IS6 is completed even when a plurality of currently executed instructions IS read data from the same register R0. The determination can be made based on REP0.

命令IS6の先行命令によるレジスタR0からのデータの読み出しが終了しているとき、プロセッサ10は、実行結果をレジスタR0に書き込む。なお、命令IS6の先行命令によるレジスタR0からのデータの読み出しが終了していないとき、プロセッサ10は、レジスタ書き込みステージWBおよびレジスタ書き込みステージWBより上流のステージ(ステージID、RR、EX)の処理をストールさせる。例えば、プロセッサ10は、命令IS6の先行命令によるレジスタR0からのデータの読み出しが終了するまで、命令発行ステージID、レジスタ読み出しステージRR、実行ステージEXおよびレジスタ書き込みステージWBの処理をストールさせる。   When the reading of data from the register R0 by the preceding instruction of the instruction IS6 is completed, the processor 10 writes the execution result in the register R0. Note that when the reading of data from the register R0 by the preceding instruction of the instruction IS6 has not been completed, the processor 10 performs processing of the register write stage WB and the stages upstream of the register write stage WB (stage ID, RR, EX). Stall. For example, the processor 10 stalls the processing of the instruction issue stage ID, the register read stage RR, the execution stage EX, and the register write stage WB until the reading of data from the register R0 by the preceding instruction of the instruction IS6 is completed.

このように、プロセッサ10は、実行中の複数の命令ISが同じレジスタR0からデータを読み出すときにも、命令IS6の先行命令によるレジスタR0からのデータの読み出しが終了したか否かを、信号REP0に基づいて判定できる。これにより、プロセッサ10は、実行中の複数の命令ISが同じレジスタR0からデータを読み出すときにも、命令IS6を、WAR依存を守って実行できる。また、例えば、プロセッサ10は、命令の発行をアウト・オブ・オーダで実行するときにも、WAR依存を守ることができる。   In this way, the processor 10 determines whether or not the reading of data from the register R0 by the preceding instruction of the instruction IS6 is completed even when a plurality of instructions IS being executed read data from the same register R0. Can be determined based on As a result, the processor 10 can execute the instruction IS6 while maintaining the WAR dependence even when a plurality of instructions IS being executed read data from the same register R0. In addition, for example, the processor 10 can protect the WAR dependence when executing the issuance of an instruction out of order.

WAR依存の確認処理では、セットされるフラグFは、RAW依存およびWAW依存の確認処理でセットされるフラグFと異なる。このため、この実施形態では、RAW依存、WAW依存およびWAR依存の全てを確認する場合、プロセッサ10は、RAW/WAW用フラグテーブル30とWAR用フラグテーブル30との2種類を有する。すなわち、RAW依存、WAW依存およびWAR依存の全てを確認する場合、プロセッサ10は、同時実行可能な命令の最大数(インフライト命令の最大数)の2倍の数のフラグFをレジスタR毎に有する。   In the WAR-dependent confirmation process, the flag F that is set is different from the flag F that is set in the RAW-dependent and WAW-dependent confirmation processes. For this reason, in this embodiment, when confirming all of RAW dependence, WAW dependence, and WAR dependence, the processor 10 has two types of the RAW / WAW flag table 30 and the WAR flag table 30. That is, when confirming all of the RAW dependency, WAW dependency, and WAR dependency, the processor 10 sets, for each register R, the number of flags F that is twice the maximum number of instructions that can be executed simultaneously (maximum number of in-flight instructions). Have.

なお、同時にプロセッサ中に存在する命令(インフライト命令)の数が少ないプロセッサ(例えば、ベクトルプロセッサ)では、フラグFの数の増加は、抑制される。例えば、1つの命令で大量のデータを扱うベクトルプロセッサでは、フラグFの数の増加によるデメリット(回路規模の増加等のデメリット)は、レジスタ・リネーミング用にレジスタRの数を増加させる構成に比べて、小さい。   Note that an increase in the number of flags F is suppressed in a processor (for example, a vector processor) in which the number of instructions (in-flight instructions) existing in the processor is small. For example, in a vector processor that handles a large amount of data with a single instruction, the disadvantages due to the increase in the number of flags F (disadvantages such as an increase in circuit scale) are compared to the configuration in which the number of registers R is increased for register renaming. Small.

図6は、命令パターンPTとフラグテーブル30に対するアクセスとの関係の一例を示している。図6の丸印は、フラグテーブル30に対する各項目の処理が実行されることを示している。   FIG. 6 shows an example of the relationship between the instruction pattern PT and access to the flag table 30. The circles in FIG. 6 indicate that the processing of each item for the flag table 30 is executed.

パターンPT1の命令は、レジスタリード(レジスタRからのデータの読み出し)とレジスタライト(レジスタRへのデータの書き込み)との両方を実行する命令である。命令パターンPT1では、WAR用フラグテーブル30のフラグFのセット/リセットと、WAR用フラグテーブル30のフラグFの参照と、RAW/WAW用フラグテーブル30のフラグFのセット/リセットと、RAW/WAW用フラグテーブル30のフラグFの参照とが実行される。   The instruction of the pattern PT1 is an instruction that executes both register read (reading data from the register R) and register write (writing data to the register R). In the instruction pattern PT1, the flag F in the WAR flag table 30 is set / reset, the flag F in the WAR flag table 30 is referenced, the flag F in the RAW / WAW flag table 30 is set / reset, and the RAW / WAW. The flag F in the use flag table 30 is referred to.

パターンPT2の命令は、レジスタリードおよびレジスタライトのうちのレジスタリードのみを実行する命令である。命令パターンPT2では、WAR用フラグテーブル30のフラグFのセット/リセットと、RAW/WAW用フラグテーブル30のフラグFの参照とが実行される。   The instruction of pattern PT2 is an instruction that executes only register read out of register read and register write. In the instruction pattern PT2, setting / resetting of the flag F of the WAR flag table 30 and reference of the flag F of the RAW / WAW flag table 30 are executed.

パターンPT3の命令は、レジスタリードおよびレジスタライトのうちのレジスタライトのみを実行する命令である。命令パターンPT3では、WAR用フラグテーブル30のフラグFの参照と、RAW/WAW用フラグテーブル30のフラグFのセット/リセットと、RAW/WAW用フラグテーブル30のフラグFの参照とが実行される。   The instruction of pattern PT3 is an instruction that executes only register write out of register read and register write. In the instruction pattern PT3, the flag F in the WAR flag table 30 is referred to, the flag F in the RAW / WAW flag table 30 is set / reset, and the flag F in the RAW / WAW flag table 30 is referred to. .

パターンPT4の命令は、レジスタリードおよびレジスタライトの両方とも実行されない命令である。したがって、命令パターンPT4では、WAR用フラグテーブル30およびRAW/WAW用フラグテーブル30の両方ともアクセスされない。このように、レジスタRにアクセスする命令(パターンPT1−PT3の命令)では、WAR用フラグテーブル30およびRAW/WAW用フラグテーブル30の少なくとも一方のフラグFはセットされる。   The instruction of pattern PT4 is an instruction in which neither register read nor register write is executed. Therefore, in the instruction pattern PT4, neither the WAR flag table 30 nor the RAW / WAW flag table 30 is accessed. As described above, in the instruction for accessing the register R (instructions of the patterns PT1 to PT3), at least one flag F of the WAR flag table 30 and the RAW / WAW flag table 30 is set.

なお、プロセッサ10がWAR用フラグテーブル30およびRAW/WAW用フラグテーブル30の両方を有する場合、WAR用フラグテーブル30とRAW/WAW用フラグテーブル30とで共通のヘッドポインタHPおよびテールポインタTPが使用される。すなわち、プロセッサ10は、WAR用フラグテーブル30とRAW/WAW用フラグテーブル30とで共通のポインタ制御部PCNTを有する。この場合、ポインタ制御部PCNTは、例えば、レジスタRにアクセスする命令(パターンPT1−PT3のいずれかの命令)が発行される度に、テールポインタTPをフラグ群FGの末尾側(図2の右側)に移動させる。   When the processor 10 has both the WAR flag table 30 and the RAW / WAW flag table 30, the common head pointer HP and tail pointer TP are used in the WAR flag table 30 and the RAW / WAW flag table 30. Is done. That is, the processor 10 has a pointer control unit PCNT common to the WAR flag table 30 and the RAW / WAW flag table 30. In this case, the pointer control unit PCNT, for example, sets the tail pointer TP to the tail side of the flag group FG (the right side in FIG. 2) every time an instruction to access the register R (any one of the patterns PT1 to PT3) is issued. ).

また、例えば、ポインタ制御部PCNTは、ヘッドポインタHPで示される位置のフラグFがWAR用フラグテーブル30とRAW/WAW用フラグテーブル30との両方で全てリセットされたとき、ヘッドポインタHPを更新する。例えば、ポインタ制御部PCNTは、セットされたフラグFが存在する位置まで、ヘッドポインタHPをフラグ群FGの末尾側(図2の右側)に移動させる。   For example, the pointer control unit PCNT updates the head pointer HP when the flag F at the position indicated by the head pointer HP is all reset in both the WAR flag table 30 and the RAW / WAW flag table 30. . For example, the pointer control unit PCNT moves the head pointer HP to the end side (right side in FIG. 2) of the flag group FG to the position where the set flag F exists.

以上、この実施形態では、プロセッサ10は、実行中の複数の命令のそれぞれに割り当て可能な数のフラグFを含むフラグ群FGをレジスタR毎に有している。プロセッサ10は、例えば、フラグ群FGのフラグFをレジスタRに対する読み出しが終了したか否かを示すフラグとして使用することにより、実行中の複数の命令ISが同じレジスタRからデータを読み出すときにも、WAR依存を守ることができる。例えば、プロセッサ10の判定部60は、実行中の複数の命令ISが同じレジスタRからデータを読み出すときにも、判定対象の命令に先行する命令によるレジスタRからのデータの読み出しが終了したか否かを、信号REPに基づいて判定できる。   As described above, in this embodiment, the processor 10 has, for each register R, a flag group FG including a number of flags F that can be assigned to each of the plurality of instructions being executed. For example, the processor 10 uses the flag F of the flag group FG as a flag indicating whether or not reading to the register R is completed, so that a plurality of instructions IS being executed can read data from the same register R. WAR dependency can be protected. For example, the determination unit 60 of the processor 10 determines whether or not reading of data from the register R by an instruction preceding the instruction to be determined is completed even when a plurality of currently executed instructions IS read data from the same register R. Can be determined based on the signal REP.

また、プロセッサ10は、例えば、フラグ群FGのフラグFをレジスタRに対する書き込みが終了したか否かを示すフラグとして使用することにより、実行中の複数の命令ISが同じレジスタRにデータを書き込むときにも、RAW依存およびWAW依存を守ることができる。例えば、プロセッサ10の判定部60は、実行中の複数の命令ISが同じレジスタRにデータを書き込むときにも、判定対象の命令に先行する命令によるレジスタRへのデータの書き込みが終了したか否かを、信号REPに基づいて判定できる。   Further, the processor 10 uses, for example, the flag F of the flag group FG as a flag indicating whether or not the writing to the register R is completed, so that a plurality of instructions IS being executed writes data to the same register R. In addition, RAW dependency and WAW dependency can be protected. For example, the determination unit 60 of the processor 10 determines whether or not the writing of data to the register R by the instruction preceding the instruction to be determined is completed even when a plurality of currently executed instructions IS writes data to the same register R. Can be determined based on the signal REP.

さらに、この実施形態では、WAR用フラグテーブル30およびRAW/WAW用フラグテーブル30の両方を使用することにより、実行中の複数の命令が同じレジスタRにアクセスするときにも、WAR依存、RAW依存およびWAW依存を守ることができる。このように、この実施形態では、実行中の複数の命令が同じレジスタRにアクセスするときにも、命令間のデータ依存を守ることができる。   Further, in this embodiment, by using both the WAR flag table 30 and the RAW / WAW flag table 30, even when a plurality of executing instructions access the same register R, the WAR dependency and the RAW dependency And WAW dependency can be protected. Thus, in this embodiment, even when a plurality of instructions being executed access the same register R, data dependence between instructions can be protected.

また、この実施形態では、フラグテーブル30が複数のフラグFを含むフラグ群FGをレジスタR毎に有しているため、フラグFのセットとフラグFのリセットとを、パイプライン処理の互いに異なるステージで実行できる。これにより、この実施形態では、パイプライン処理の段数(ステージの数)を適切に設計できる。   In this embodiment, since the flag table 30 includes a flag group FG including a plurality of flags F for each register R, the setting of the flag F and the resetting of the flag F are performed at different stages in the pipeline processing. It can be executed with. Thereby, in this embodiment, the number of pipeline processing stages (the number of stages) can be appropriately designed.

図7は、別の実施形態におけるプロセッサ12の一例を示している。図1−図6で説明した要素と同様の要素については、同様の符号を付し、これ等については、詳細な説明を省略する。プロセッサ12は、複数の命令を並列に処理する。例えば、プロセッサ12は、2つの処理系統により、2つのパイプライン処理を並列に実行する。レジスタリード部RGR1、演算器ALU1およびレジスタライト部RGW1は、2つの処理系統のうちの一方の処理系統に含まれる。また、レジスタリード部RGR2、演算器ALU2およびレジスタライト部RGW2は、2つの処理系統のうちの他方の処理系統に含まれる。なお、プロセッサ12は、3つ以上のパイプライン処理を並列に実行するように設計されてもよいし、1つのパイプライン処理を実行するように設計されてもよい。   FIG. 7 shows an example of the processor 12 in another embodiment. Elements similar to those described in FIGS. 1 to 6 are denoted by the same reference numerals, and detailed description thereof will be omitted. The processor 12 processes a plurality of instructions in parallel. For example, the processor 12 executes two pipeline processes in parallel by two processing systems. The register read unit RGR1, the arithmetic unit ALU1, and the register write unit RGW1 are included in one of the two processing systems. Further, the register read unit RGR2, the arithmetic unit ALU2, and the register write unit RGW2 are included in the other processing system of the two processing systems. The processor 12 may be designed to execute three or more pipeline processes in parallel, or may be designed to execute one pipeline process.

プロセッサ12で実行するパイプライン処理は、例えば、パイプラインレジスタPRGにより、命令発行ステージ、レジスタ読み出しステージ、実行ステージおよびレジスタ書き込みステージに分けられる。命令発行ステージ、レジスタ読み出しステージ、実行ステージおよびレジスタ書き込みステージの処理は、図4および図5で説明した命令発行ステージID、レジスタ読み出しステージRR、実行ステージEXおよびレジスタ書き込みステージWBの処理と同様である。   Pipeline processing executed by the processor 12 is divided into, for example, an instruction issue stage, a register read stage, an execution stage, and a register write stage by the pipeline register PRG. The processing of the instruction issue stage, the register read stage, the execution stage, and the register write stage is the same as the process of the instruction issue stage ID, register read stage RR, execution stage EX, and register write stage WB described with reference to FIGS. .

プロセッサ12は、例えば、レジスタファイル20、RAW/WAW用フラグテーブル30A、WAR用フラグテーブル30B、命令メモリMEM、デコード部DEC、レジスタリード部RGR1、RGR2、演算器ALU1、ALU2、レジスタライト部RGW1、RGW2およびパイプラインレジスタPRG11、PRG12、PRG21、PRG22、PRG31、PRG32を有している。   The processor 12 includes, for example, a register file 20, a RAW / WAW flag table 30A, a WAR flag table 30B, an instruction memory MEM, a decode unit DEC, register read units RGR1, RGR2, arithmetic units ALU1, ALU2, register write units RGW1, RGW2 and pipeline registers PRG11, PRG12, PRG21, PRG22, PRG31, and PRG32 are included.

レジスタファイル20は、図1−図6で説明した実施形態のレジスタファイル20と同様である。また、RAW/WAW用フラグテーブル30A、WAR用フラグテーブル30Bは、図1−図6で説明した実施形態のフラグテーブル30と同様である。例えば、各フラグテーブル30A、30Bは、実行中の複数の命令のそれぞれに割り当て可能な数のフラグFを含むフラグ群FGをレジスタR毎に有している。なお、図2に示したポインタ制御部PCNTは、RAW/WAW用フラグテーブル30AおよびWAR用フラグテーブル30Bの一方に含まれる。また、各フラグテーブル30A、30Bは、例えば、2つの処理系統にそれぞれ対応する論理和部ORUを有している。   The register file 20 is the same as the register file 20 of the embodiment described with reference to FIGS. The RAW / WAW flag table 30A and the WAR flag table 30B are the same as the flag table 30 of the embodiment described with reference to FIGS. For example, each flag table 30A, 30B has a flag group FG including a number of flags F that can be assigned to each of a plurality of instructions being executed for each register R. The pointer controller PCNT shown in FIG. 2 is included in one of the RAW / WAW flag table 30A and the WAR flag table 30B. Each flag table 30A, 30B has, for example, a logical sum unit ORU corresponding to each of two processing systems.

命令メモリMEMは、例えば、プロセッサ12で実行する命令を記憶している。命令メモリMEMに記憶されている命令は、例えば、命令発行ステージにおいて、デコード部DECにより読み出される。   The instruction memory MEM stores an instruction to be executed by the processor 12, for example. The instruction stored in the instruction memory MEM is read by the decoding unit DEC, for example, at the instruction issue stage.

例えば、命令発行ステージでは、デコード部DECは、命令メモリMEMから読み出した命令を解読し、命令を発行する。また、デコード部DECは、フラグセット部40を有している。デコード部DECのフラグセット部40は、図1−図6で説明した実施形態のフラグセット部40と同様である。例えば、フラグセット部40は、命令メモリMEMから読み出した命令に対し、命令の発行順に、各フラグテーブル30A、30Bのエントリ(図2に示したテールポイントTPが示す位置のフラグF)を割り当てる。そして、フラグセット部40は、割り当てたエントリ上の特定のフラグF(命令によりアクセスされるレジスタRに対応するフラグF)を、信号SETCを用いてセットする。   For example, at the instruction issue stage, the decode unit DEC decodes the instruction read from the instruction memory MEM and issues the instruction. The decoding unit DEC has a flag setting unit 40. The flag setting unit 40 of the decoding unit DEC is the same as the flag setting unit 40 of the embodiment described with reference to FIGS. For example, the flag set unit 40 assigns an entry (flag F at the position indicated by the tail point TP shown in FIG. 2) in each flag table 30A, 30B to the instruction read from the instruction memory MEM in the order in which the instructions are issued. Then, the flag setting unit 40 sets a specific flag F (flag F corresponding to the register R accessed by the instruction) on the assigned entry using the signal SETC.

これにより、RAW/WAW用フラグテーブル30Aでは、例えば、テールポイントTPが示す位置のフラグFのうち、命令によりデータが書き込まれるレジスタRに対応するフラグFがセットされる。また、WAR用フラグテーブル30Bでは、例えば、テールポイントTPが示す位置のフラグFのうち、命令によりデータが読み出されるレジスタRに対応するフラグFがセットされる。   Thereby, in the RAW / WAW flag table 30A, for example, the flag F corresponding to the register R into which data is written by the instruction is set out of the flags F at the position indicated by the tail point TP. In the WAR flag table 30B, for example, the flag F corresponding to the register R from which data is read by an instruction is set out of the flags F at the position indicated by the tail point TP.

デコード部DECからの出力データ(命令の解読結果等)は、パイプラインレジスタPRG1(PRG11、PRG12)に保持される。パイプラインレジスタPRG1(PRG11、PRG12)に保持されているデータは、例えば、レジスタ読み出しステージにおいて、レジスタリード部RGR(RGR1、RGR2)に転送される。   Output data (decoding result of the instruction, etc.) from the decoding unit DEC is held in the pipeline register PRG1 (PRG11, PRG12). The data held in the pipeline register PRG1 (PRG11, PRG12) is transferred to the register read unit RGR (RGR1, RGR2) at the register read stage, for example.

レジスタ読み出しステージでは、レジスタリード部RGR(RGR1、RGR2)は、命令のオペランドで指定されたレジスタRからデータを読み出す。また、レジスタリード部RGRは、フラグリセット部50および判定部60を有している。レジスタリード部RGRのフラグリセット部50および判定部60は、図1−図6で説明した実施形態のフラグリセット部50および判定部60と同様である。したがって、レジスタリード部RGRは、レジスタRからデータを読み出す際に、RAW依存を守ることができる。   In the register read stage, the register read unit RGR (RGR1, RGR2) reads data from the register R designated by the instruction operand. The register read unit RGR includes a flag reset unit 50 and a determination unit 60. The flag reset unit 50 and the determination unit 60 of the register read unit RGR are the same as the flag reset unit 50 and the determination unit 60 of the embodiment described with reference to FIGS. Therefore, the register read unit RGR can keep RAW dependence when reading data from the register R.

例えば、レジスタリード部RGRの判定部60は、データをレジスタファイル20から読み出す前に、RAW/WAW用フラグテーブル30Aを参照し、命令によりデータが読み出されるレジスタRに対応するフラグFを調べる。RAW/WAW用フラグテーブル30Aは、判定部60から受ける信号CHKに基づく範囲のフラグFの状態を示す信号REPを、判定部60に出力する。判定部60は、信号REPに基づいて、判定対象の命令に先行する命令によるレジスタRへのデータの書き込みが終了したか否かを判定する。   For example, before reading data from the register file 20, the determination unit 60 of the register read unit RGR refers to the RAW / WAW flag table 30A and checks the flag F corresponding to the register R from which data is read by an instruction. The RAW / WAW flag table 30 </ b> A outputs a signal REP indicating the state of the flag F in a range based on the signal CHK received from the determination unit 60 to the determination unit 60. Based on the signal REP, the determination unit 60 determines whether the writing of data to the register R by the instruction preceding the instruction to be determined has been completed.

信号CHKに基づく範囲のフラグFがセットされている場合(処理対象の命令に先行する命令によるレジスタRへのデータの書き込みが終了していない場合)、レジスタリード部RGRは、レジスタRからのデータの読み出しを待機する。すなわち、プロセッサ12は、処理対象の命令に先行する命令によるレジスタRへのデータの書き込みが終了していない場合、レジスタ読み出しステージの処理をストールさせる。さらに、プロセッサ12は、レジスタ読み出しステージより上流のステージの処理をストールさせる。   When the flag F in the range based on the signal CHK is set (when writing of data to the register R by an instruction preceding the instruction to be processed has not been completed), the register read unit RGR receives data from the register R. Wait for reading. That is, the processor 12 stalls the processing of the register read stage when the data writing to the register R by the instruction preceding the instruction to be processed has not been completed. Furthermore, the processor 12 stalls the processing of the stage upstream from the register read stage.

信号CHKに基づく範囲のフラグFがリセットされている場合(処理対象の命令に先行する命令によるレジスタRへのデータの書き込みが終了している場合)、レジスタリード部RGRは、レジスタRからデータを読み出すとともに、WAR用フラグテーブル30Bを更新する。例えば、レジスタリード部RGRのフラグリセット部50は、命令が割り当てられたエントリのフラグFのうち、命令によりデータが読み出されるレジスタRに対応するWAR用フラグテーブル30BのフラグFを、信号RSTCを用いてリセットする。   When the flag F in the range based on the signal CHK is reset (when writing of data to the register R by the instruction preceding the instruction to be processed has been completed), the register read unit RGR receives data from the register R. While reading, the WAR flag table 30B is updated. For example, the flag reset unit 50 of the register read unit RGR uses the flag F of the WAR flag table 30B corresponding to the register R from which data is read by the instruction among the flags F of the entry to which the instruction is assigned, using the signal RSTC. To reset.

レジスタリード部RGR(RGR1、RGR2)で読み出したデータ等は、パイプラインレジスタPRG2(PRG21、PRG22)に保持される。パイプラインレジスタPRG2(PRG21、PRG22)に保持されているデータ等は、例えば、実行ステージにおいて、演算器ALU(ALU1、ALU2)に転送される。   Data read by the register read unit RGR (RGR1, RGR2) is held in the pipeline register PRG2 (PRG21, PRG22). The data held in the pipeline register PRG2 (PRG21, PRG22) is transferred to the arithmetic unit ALU (ALU1, ALU2) in the execution stage, for example.

実行ステージでは、演算器ALU(ALU1、ALU2)は、デコード部DECで解読された命令に基づいて、演算を実行する。例えば、演算器ALUは、レジスタリード部RGRで読み出したデータを用いた演算を実行する。演算器ALU(ALU1、ALU2)からの出力データ(演算結果等)は、パイプラインレジスタPRG3(PRG31、PRG32)に保持される。パイプラインレジスタPRG3(PRG31、PRG32)に保持されているデータは、例えば、レジスタ書き込みステージにおいて、レジスタライト部RGW(RGW1、RGW2)に転送される。   In the execution stage, the arithmetic units ALU (ALU1, ALU2) execute an operation based on the instruction decoded by the decoding unit DEC. For example, the arithmetic unit ALU performs an operation using the data read by the register read unit RGR. Output data (calculation results, etc.) from the arithmetic units ALU (ALU1, ALU2) is held in the pipeline register PRG3 (PRG31, PRG32). The data held in the pipeline register PRG3 (PRG31, PRG32) is transferred to the register write unit RGW (RGW1, RGW2) at the register write stage, for example.

レジスタ書き込みステージでは、レジスタライト部RGW(RGW1、RGW2)は、命令の実行結果(演算結果等)を、命令のオペランドで指定されたレジスタRに書き込む。また、レジスタライト部RGWは、フラグリセット部50および判定部60を有している。レジスタライト部RGWのフラグリセット部50および判定部60は、図1−図6で説明した実施形態のフラグリセット部50および判定部60と同様である。したがって、レジスタライト部RGWは、レジスタRにデータを書き込む際に、WAR依存およびWAW依存を守ることができる。   In the register write stage, the register write unit RGW (RGW1, RGW2) writes the execution result (operation result, etc.) of the instruction to the register R specified by the instruction operand. The register write unit RGW includes a flag reset unit 50 and a determination unit 60. The flag reset unit 50 and the determination unit 60 of the register write unit RGW are the same as the flag reset unit 50 and the determination unit 60 of the embodiment described with reference to FIGS. Therefore, the register write unit RGW can protect WAR dependency and WAW dependency when writing data to the register R.

例えば、レジスタライト部RGWの判定部60は、データをレジスタファイル20に書き込む前に、RAW/WAW用フラグテーブル30Aを参照し、命令によりデータが書き込まれるレジスタRに対応するフラグFを調べる。RAW/WAW用フラグテーブル30Aは、判定部60から受ける信号CHKに基づく範囲のフラグFの状態を示す信号REPを、判定部60に出力する。判定部60は、信号REPに基づいて、判定対象の命令に先行する命令によるレジスタRへのデータの書き込みが終了したか否かを判定する。   For example, before writing data to the register file 20, the determination unit 60 of the register write unit RGW refers to the RAW / WAW flag table 30A and checks the flag F corresponding to the register R into which data is written by an instruction. The RAW / WAW flag table 30 </ b> A outputs a signal REP indicating the state of the flag F in a range based on the signal CHK received from the determination unit 60 to the determination unit 60. Based on the signal REP, the determination unit 60 determines whether the writing of data to the register R by the instruction preceding the instruction to be determined has been completed.

信号CHKに基づく範囲のフラグFがセットされている場合(処理対象の命令に先行する命令によるレジスタRへのデータの書き込みが終了していない場合)、レジスタライト部RGWは、レジスタRへのデータの書き込みを待機する。すなわち、プロセッサ12は、処理対象の命令に先行する命令によるレジスタRへのデータの書き込みが終了していない場合、レジスタ書き込みステージの処理をストールさせる。さらに、プロセッサ12は、レジスタ書き込みステージより上流のステージの処理をストールさせる。   When the flag F in the range based on the signal CHK is set (when writing of data to the register R by the instruction preceding the instruction to be processed has not been completed), the register write unit RGW performs data transfer to the register R. Wait for writing. That is, the processor 12 stalls the processing of the register writing stage when the data writing to the register R by the instruction preceding the instruction to be processed has not been completed. Furthermore, the processor 12 stalls the processing of the stage upstream from the register write stage.

さらに、レジスタライト部RGWの判定部60は、データをレジスタファイル20に書き込む前に、WAR用フラグテーブル30Bを参照し、命令によりデータが書き込まれるレジスタRに対応するフラグFを調べる。WAR用フラグテーブル30Bは、判定部60から受ける信号CHKに基づく範囲のフラグFの状態を示す信号REPを、判定部60に出力する。判定部60は、信号REPに基づいて、判定対象の命令に先行する命令によるレジスタRからのデータの読み出しが終了したか否かを判定する。   Further, before writing data into the register file 20, the determination unit 60 of the register write unit RGW refers to the WAR flag table 30B and checks the flag F corresponding to the register R into which data is written by an instruction. The WAR flag table 30 </ b> B outputs a signal REP indicating the state of the flag F in the range based on the signal CHK received from the determination unit 60 to the determination unit 60. Based on the signal REP, the determination unit 60 determines whether reading of data from the register R by the instruction preceding the instruction to be determined has been completed.

信号CHKに基づく範囲のフラグFがセットされている場合(処理対象の命令に先行する命令によるレジスタRからのデータの読み出しが終了していない場合)、レジスタライト部RGWは、レジスタRへのデータの書き込みを待機する。すなわち、プロセッサ12は、処理対象の命令に先行する命令によるレジスタRからのデータの読み出しが終了していない場合、レジスタ書き込みステージの処理をストールさせる。さらに、プロセッサ12は、レジスタ書き込みステージより上流のステージの処理をストールさせる。   When the flag F in the range based on the signal CHK is set (when reading of data from the register R by an instruction preceding the instruction to be processed has not been completed), the register write unit RGW performs data transfer to the register R. Wait for writing. That is, the processor 12 stalls the processing of the register write stage when the reading of data from the register R by the instruction preceding the instruction to be processed has not been completed. Furthermore, the processor 12 stalls the processing of the stage upstream from the register write stage.

RAW/WAW用フラグテーブル30AおよびWAR用フラグテーブル30Bの両方で、信号CHKに基づく範囲のフラグFがリセットされている場合、レジスタライト部RGWは、レジスタRにデータを書き込むとともに、RAW/WAW用フラグテーブル30Aを更新する。例えば、レジスタライト部RGWのフラグリセット部50は、命令が割り当てられたエントリのフラグFのうち、命令によりデータが書き込まれるレジスタRに対応するRAW/WAW用フラグテーブル30AのフラグFを、信号RSTCを用いてリセットする。   When the flag F in the range based on the signal CHK is reset in both the RAW / WAW flag table 30A and the WAR flag table 30B, the register write unit RGW writes data into the register R and also for the RAW / WAW Update the flag table 30A. For example, the flag reset unit 50 of the register write unit RGW uses the flag F of the RAW / WAW flag table 30A corresponding to the register R to which data is written by the instruction, among the flags F of the entry to which the instruction is assigned, as a signal RSTC. Use to reset.

このように、レジスタライト部RGWは、処理対象の命令に先行する命令によるレジスタRへのデータの書き込みが終了し、かつ、処理対象の命令に先行する命令によるレジスタRからのデータの読み出しが終了している場合、レジスタRにデータを書き込む。これにより、プロセッサ12は、同一レジスタRを更新する複数の命令が同時にプロセッサ12中に存在することを許しても、命令間の依存関係を守ってプログラムを正しく実行することができる。   In this way, the register write unit RGW finishes writing data to the register R by the instruction preceding the instruction to be processed, and ends reading data from the register R by the instruction preceding the instruction to be processed. If so, write data to register R. As a result, the processor 12 can correctly execute the program while keeping the dependency relationship between the instructions, even if a plurality of instructions for updating the same register R are allowed to exist in the processor 12 at the same time.

なお、プロセッサ12の構成および動作は、この例に限定されない。例えば、各フラグテーブル30A、30Bは、2つの処理系統で共通に使用される論理和部ORUを有してもよい。この場合、各フラグテーブル30A、30Bは、2つの処理系統から受ける信号CHKのうちの一方を選択して論理和部ORUに転送する調停回路を有してもよい。例えば、調停回路は、2つの処理系統から受ける信号CHKのうち、先に発行された命令に対応する信号CHKを選択する。また、調停回路は、例えば、選択した信号CHKを送信した判定部60に、信号REPを転送する。   The configuration and operation of the processor 12 are not limited to this example. For example, each of the flag tables 30A and 30B may include a logical sum unit ORU that is commonly used in two processing systems. In this case, each of the flag tables 30A and 30B may include an arbitration circuit that selects one of the signals CHK received from the two processing systems and transfers the selected signal to the OR unit ORU. For example, the arbitration circuit selects the signal CHK corresponding to the previously issued command from the signals CHK received from the two processing systems. Further, the arbitration circuit transfers the signal REP to, for example, the determination unit 60 that has transmitted the selected signal CHK.

以上、この実施形態においても、上述した図1−図6で説明した実施形態と同様の効果を得ることができる。例えば、この実施形態では、プロセッサ12は、RAW/WAW用フラグテーブル30AおよびWAR用フラグテーブル30Bを有している。各フラグテーブル30A、30Bは、実行中の複数の命令のそれぞれに割り当て可能な数のフラグFを含むフラグ群FGをレジスタR毎に有している。このため、この実施形態では、実行中の複数の命令が同じレジスタRにアクセスするときにも、WAR依存、RAW依存およびWAW依存を守ることができる。すなわち、この実施形態では、実行中の複数の命令が同じレジスタRにアクセスするときにも、命令間のデータ依存を守ることができる。   As described above, also in this embodiment, the same effect as that of the embodiment described with reference to FIGS. 1 to 6 can be obtained. For example, in this embodiment, the processor 12 includes a RAW / WAW flag table 30A and a WAR flag table 30B. Each flag table 30A, 30B has, for each register R, a flag group FG including a number of flags F that can be assigned to each of the plurality of instructions being executed. For this reason, in this embodiment, even when a plurality of instructions being executed access the same register R, WAR dependency, RAW dependency, and WAW dependency can be protected. That is, in this embodiment, even when a plurality of instructions being executed access the same register R, data dependence between instructions can be protected.

以上の詳細な説明により、実施形態の特徴点および利点は明らかになるであろう。これは、特許請求の範囲がその精神および権利範囲を逸脱しない範囲で前述のような実施形態の特徴点および利点にまで及ぶことを意図するものである。また、当該技術分野において通常の知識を有する者であれば、あらゆる改良および変更に容易に想到できるはずであり、発明性を有する実施形態の範囲を前述したものに限定する意図はなく、実施形態に開示された範囲に含まれる適当な改良物および均等物に拠ることも可能である。   From the above detailed description, features and advantages of the embodiments will become apparent. This is intended to cover the features and advantages of the embodiments described above without departing from the spirit and scope of the claims. Further, any person having ordinary knowledge in the technical field should be able to easily come up with any improvements and modifications, and there is no intention to limit the scope of the embodiments having the invention to those described above. It is also possible to rely on suitable improvements and equivalents within the scope disclosed in.

10、12‥プロセッサ;20‥レジスタファイル;30、30A、30B‥フラグテーブル;40‥フラグセット部;50‥フラグリセット部;60‥判定部;AND1、AND2‥論理積回路;COMP1、COMP2‥比較部;DEC‥デコード部;F、F000−F157‥フラグ;FG、FG0−FG15‥フラグ群;MEM‥命令メモリ;OR1‥論理和回路;ORU0−ORU15‥論理和部;PCNT‥ポインタ制御部;PRG11、PRG12、PRG21、PRG22、PRG31、PRG32‥パイプラインレジスタ;R、R0−R15‥レジスタ;RGR1、RGR2‥レジスタリード部;RGW1、RGW2‥レジスタライト部;SELU0−SELU7‥選択部   10, 12 ... Processor; 20 ... Register file; 30, 30A, 30B ... Flag table; 40 ... Flag set part; 50 ... Flag reset part; 60 ... Judgment part; AND1, AND2 ... AND circuit; Unit: DEC: decode unit; F, F000-F157: flag; FG, FG0-FG15: flag group; MEM: instruction memory; OR1: logical OR circuit; ORU0-ORU15: logical sum unit; , PRG12, PRG21, PRG22, PRG31, PRG32 Pipeline register; R, R0-R15, register; RGR1, RGR2, Register read section; RGW1, RGW2, Register write section;

Claims (4)

データが格納されるレジスタと、
実行中の複数の命令のそれぞれに割り当て可能な数のフラグを含むフラグ群を、前記レジスタ毎に有する少なくとも1つのフラグテーブルと、
前記レジスタにアクセスする命令の発行に応じて、前記命令によりアクセスされる前記レジスタに対応する前記フラグ群のうちの前記命令に割り当てられるフラグを、セットするフラグセット部と、
前記命令の発行に応じてセットされた前記フラグを、前記命令による前記レジスタに対するアクセスの終了に応じてリセットするフラグリセット部と、
アクセス対象の前記レジスタに対応する前記フラグ群の状態に基づいて前記レジスタにアクセスするか否かを判定する判定部と
を備えていることを特徴とするプロセッサ。
A register in which data is stored;
At least one flag table having, for each register, a flag group including a number of flags that can be assigned to each of a plurality of instructions being executed;
A flag set unit for setting a flag assigned to the instruction in the flag group corresponding to the register accessed by the instruction in response to the issuance of an instruction to access the register;
A flag reset unit that resets the flag set in response to the issuance of the instruction in response to the end of access to the register by the instruction;
And a determination unit that determines whether to access the register based on a state of the flag group corresponding to the register to be accessed.
前記フラグテーブルは、少なくとも2つであり、
前記フラグテーブルの1つの前記フラグテーブルの前記フラグは、前記レジスタに対する書き込みが終了したか否かを示し、
前記フラグテーブルの残りの1つの前記フラグテーブルの前記フラグは、前記レジスタに対する読み出しが終了したか否かを示すこと
を特徴とする請求項1記載のプロセッサ。
The flag table is at least two,
The flag of one of the flag tables indicates whether writing to the register is complete,
The processor according to claim 1, wherein the flag of the remaining one flag table of the flag table indicates whether or not reading from the register is completed.
前記フラグのセットと前記フラグのリセットとは、パイプライン処理の互いに異なるステージで実行されること
を特徴とする請求項1または請求項2に記載のプロセッサ。
The processor according to claim 1 or 2, wherein the setting of the flag and the resetting of the flag are executed at different stages of pipeline processing.
前記アクセス対象の前記レジスタに対応する前記フラグ群から、前記判定部の判定対象の前記命令に先行する命令に対応する前記フラグを選択し、選択した前記フラグの論理和結果を前記判定部に出力する論理和部を有し、
前記判定部は、前記論理和部から受ける前記論理和結果に基づいて、前記レジスタにアクセスするか否かを判定すること
を特徴とする請求項1ないし請求項3のいずれか1項に記載のプロセッサ。
The flag corresponding to the instruction preceding the instruction to be determined by the determination unit is selected from the flag group corresponding to the register to be accessed, and the logical sum result of the selected flag is output to the determination unit A logical sum part,
4. The determination unit according to claim 1, wherein the determination unit determines whether to access the register based on the logical sum result received from the logical sum unit. 5. Processor.
JP2012182431A 2012-08-21 2012-08-21 Processor Expired - Fee Related JP6024281B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012182431A JP6024281B2 (en) 2012-08-21 2012-08-21 Processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012182431A JP6024281B2 (en) 2012-08-21 2012-08-21 Processor

Publications (2)

Publication Number Publication Date
JP2014041422A true JP2014041422A (en) 2014-03-06
JP6024281B2 JP6024281B2 (en) 2016-11-16

Family

ID=50393650

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012182431A Expired - Fee Related JP6024281B2 (en) 2012-08-21 2012-08-21 Processor

Country Status (1)

Country Link
JP (1) JP6024281B2 (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS63307535A (en) * 1987-06-09 1988-12-15 Mitsubishi Electric Corp Pipeline control circuit
JPH0218621A (en) * 1988-07-07 1990-01-22 Mitsubishi Electric Corp Data processor
JPH02240735A (en) * 1989-02-03 1990-09-25 Digital Equip Corp <Dec> Multiple instruction processing system with data redundancy resolutions
JPH052482A (en) * 1991-06-24 1993-01-08 Fujitsu Ltd Data processor
JPH06508704A (en) * 1991-07-04 1994-09-29 アーム リミテッド Condition detection in asynchronous pipelines
JP2001209537A (en) * 2000-01-24 2001-08-03 Hewlett Packard Co <Hp> Data hazard detection sytsem

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS63307535A (en) * 1987-06-09 1988-12-15 Mitsubishi Electric Corp Pipeline control circuit
JPH0218621A (en) * 1988-07-07 1990-01-22 Mitsubishi Electric Corp Data processor
JPH02240735A (en) * 1989-02-03 1990-09-25 Digital Equip Corp <Dec> Multiple instruction processing system with data redundancy resolutions
JPH052482A (en) * 1991-06-24 1993-01-08 Fujitsu Ltd Data processor
JPH06508704A (en) * 1991-07-04 1994-09-29 アーム リミテッド Condition detection in asynchronous pipelines
JP2001209537A (en) * 2000-01-24 2001-08-03 Hewlett Packard Co <Hp> Data hazard detection sytsem

Also Published As

Publication number Publication date
JP6024281B2 (en) 2016-11-16

Similar Documents

Publication Publication Date Title
JP5646656B2 (en) Mapping between registers used by multiple instruction sets
JP6163171B2 (en) Sort acceleration processor, method, system and instruction
JP6526175B2 (en) Bit shuffle processor, method, system and instruction
US5522051A (en) Method and apparatus for stack manipulation in a pipelined processor
EP3329362A1 (en) An apparatus and method for transferring a plurality of data structures between memory and a plurality of vector registers
KR101655713B1 (en) Systems and methods for flag tracking in move elimination operations
JP5789319B2 (en) Multiple data element versus multiple data element comparison processor, method, system, and instructions
CN108885551B (en) Memory copy instruction, processor, method and system
JP5834997B2 (en) Vector processor, vector processor processing method
JPH11194939A (en) Data processor
JP2018500657A5 (en)
JPS62197830A (en) Data processing system
TWI733825B (en) An apparatus and method for performing a rearrangement operation
TW202416123A (en) Hardware processor and processor
JP2017509064A (en) Processor, method, system, and instructions for storing source elements in corresponding unmasked result elements that propagate to masked result elements
JPH0673105B2 (en) Instruction pipeline type microprocessor
CN107851015A (en) Vector operations numerical digit size controls
JP6024281B2 (en) Processor
TWI818894B (en) Adjoining data element pairwise swap processors, methods, systems, and instructions
US8910181B2 (en) Divided central data processing
JPS63268033A (en) Data processing system
US11550584B1 (en) Implementing specialized instructions for accelerating Smith-Waterman sequence alignments
US11822541B2 (en) Techniques for storing sub-alignment data when accelerating Smith-Waterman sequence alignments
JP5720111B2 (en) Information processing device
US20110010529A1 (en) Instruction execution control method, instruction format, and processor

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20150512

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20160118

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20160223

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20160415

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20160926

R150 Certificate of patent or registration of utility model

Ref document number: 6024281

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees