JP2006031329A - Data processor - Google Patents
Data processor Download PDFInfo
- Publication number
- JP2006031329A JP2006031329A JP2004208270A JP2004208270A JP2006031329A JP 2006031329 A JP2006031329 A JP 2006031329A JP 2004208270 A JP2004208270 A JP 2004208270A JP 2004208270 A JP2004208270 A JP 2004208270A JP 2006031329 A JP2006031329 A JP 2006031329A
- Authority
- JP
- Japan
- Prior art keywords
- instruction
- repeat
- fetch
- pipeline
- setting
- 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.)
- Pending
Links
Images
Landscapes
- Advance Control (AREA)
- Executing Machine-Instructions (AREA)
Abstract
Description
この発明はブロックリピート命令を有するデータ処理装置に関するものである。 The present invention relates to a data processing apparatus having a block repeat instruction.
ディジタル・シグナル・プロセッサ(DSP)等ディジタル信号処理を効率よく処理するデータ処理装置では、繰り返し演算/転送処理を行う頻度が非常に高い。このようなデータ処理装置では、繰り返し処理のループ処理のオーバーヘッドを削減するために、指定された繰り返し対象ブロックの命令を指定された回数だけ繰り返し実行するブロックリピート命令を実装しているものも多い。 In a data processing apparatus that efficiently processes digital signal processing such as a digital signal processor (DSP), the frequency of repeated calculation / transfer processing is very high. Many of such data processing apparatuses are equipped with a block repeat instruction that repeatedly executes a specified repeat target block instruction a specified number of times in order to reduce the loop processing overhead of the repeat process.
例えば、特許文献1で開示されているデータ処理装置は、ブロックリピート命令を備え、ループ制御のためのカウンタのデクリメント、カウンタ値の終了判定、条件分岐を繰り返し対象ブロックの命令実行と並列にハードウェア的に処理することにより、ループ制御のためのオーバーヘッドをなくしている。ブロックリピート命令の実行により繰り返しブロックの先頭アドレスや終了アドレス、繰り返し回数のカウンタ値等のリピート処理に必要な設定を行う。しかし、動作周波数向上のためパイプライン処理を行っているため、リピート命令の実行段階では既に後続命令のフェッチが進んでいる。従って、動作保証できるリピートブロックのサイズには、制限がある。この制約を守るために、ループ処理を展開するなどして繰り返し対象ブロックのサイズを大きくしなければならない場合もある。
For example, the data processing device disclosed in
繰り返し対象ブロックが大きくすることにより、コードサイズが大きくなる。また、繰り返し対象ブロックの1回の処理データ数が増加すると、リピート命令で対処できない端数処理を行う部分のオーバーヘッドも大きくなる場合がある。さらに、繰り返し回数がダイナミックに変化する場合などは、端数処理のためのオーバーヘッドは更に大きくなる。すなわち、繰り返し回数を条件判定するための処理サイクル数が増大する。また、繰り返し回数の条件判定および繰り返し回数に応じたコードが必要となるため、処理を実現するためのプログラムサイズが大きくなる。 By increasing the repetition target block, the code size increases. Further, when the number of processing data for one repetition target block increases, the overhead of the fraction processing that cannot be handled by the repeat instruction may also increase. Furthermore, when the number of repetitions changes dynamically, the overhead for fraction processing becomes even larger. That is, the number of processing cycles for determining the number of repetitions is increased. Further, since it is necessary to determine the number of repetitions and code according to the number of repetitions, the program size for realizing the processing increases.
ソフトウェアをROM化する場合には、プログラムサイズが大きくなると実装命令ROMサイズが大きくなり、ハードウェアのコストが高くなる。 In the case where software is implemented in ROM, as the program size increases, the mounted instruction ROM size increases and the hardware cost increases.
また、処理サイクル数が大きくなるということは高い性能が得られないと言うことであり、実装すべき機能を実現するための必要動作周波数が高くなるとともに、消費電力も増大する。 In addition, an increase in the number of processing cycles means that high performance cannot be obtained, and a necessary operating frequency for realizing a function to be mounted increases and power consumption also increases.
さらに、高速処理を行うために単純な繰り返し処理でも複雑なプログラムとなるため、プログラム開発負荷が大きく、バグ混入の可能性も高い。 Furthermore, since a high-speed process is performed, even a simple repetitive process results in a complicated program, the program development load is large, and there is a high possibility of bugs being mixed.
従来のデータ処理装置は以上のように構成されているので、ハードウェア処理(パイプライン処理)を考慮し、リピート命令の繰り返し対象ブロックのサイズの最小値に制限を設けざるを得ないため、コードサイズが大きくなり製品コストが上がったり、処理サイクル数が増え高い性能が得られず消費電力も増大するなどの問題点があった。 Since the conventional data processing apparatus is configured as described above, it is necessary to set a limit on the minimum size of the repeat target block of the repeat instruction in consideration of hardware processing (pipeline processing). There are problems such as an increase in size and product cost, an increase in the number of processing cycles, high performance cannot be obtained, and power consumption also increases.
さらに、プログラムが複雑になるため、ソフトウェアの開発効率が低下し、バグ混入の可能性も高くなるという問題点もあった。 Furthermore, since the program is complicated, there is a problem that the efficiency of software development is reduced and the possibility of bugs being mixed is increased.
この発明は上記のような問題点を解消するためになされたもので、パイプライン処理を行うデータ処理装置において、リピート命令の繰り返し対象ブロックのサイズが小さい場合にも正常動作を保証できるようすることにより、コード効率のよい高性能で低コストなデータ処理装置を実現することを目的とする。また、繰り返し処理単位を小さくすることにより、繰り返し処理のプログラムの開発効率を向上し、バグの混入を削減することを目的とする。 The present invention has been made to solve the above-described problems. In a data processing apparatus that performs pipeline processing, it is possible to guarantee normal operation even when the size of a repeat target block of a repeat instruction is small. Accordingly, an object of the present invention is to realize a high-performance and low-cost data processing apparatus with good code efficiency. Another object of the present invention is to improve the development efficiency of a program for repetitive processing by reducing the unit of repetitive processing and reduce bugs.
この発明における請求項1記載のデータ処理装置は、パイプライン処理機能を有するとともに、リピート関連の設定の少なくとも一部を規定したリピート設定命令に従い、少なくとも一つの命令を含み総コードサイズが所定のコードサイズとなるリピート対象ブロックをハードウェア的に繰り返し実行するリピート機能を有するデータ処理装置であって、パイプライン処理対象の命令をフェッチする命令フェッチ部と、前記命令フェッチ部から前記命令を受け、当該命令が前記リピート設定命令である場合に、前記リピート対象ブロックに関する前記リピート機能の設定内容が所定の条件を満足するか否かを判定する判定動作を実行するリピート設定命令用判定部と、前記リピート設定命令用判定部が前記所定の条件を満足すると判定した場合、前記パイプライン処理対象の命令の新規フェッチ開始を一時抑止させる命令フェッチ抑止制御を行うリピート時パイプライン制御手段とを備えている。 According to a first aspect of the present invention, there is provided a data processing apparatus having a pipeline processing function and a code having a predetermined total code size including at least one instruction in accordance with a repeat setting instruction defining at least a part of repeat-related settings. A data processing apparatus having a repeat function for repeatedly executing a repeat target block having a size in hardware, wherein the instruction fetch unit fetches an instruction to be pipeline processed, receives the instruction from the instruction fetch unit, When the instruction is the repeat setting instruction, a repeat setting instruction determination unit that executes a determination operation for determining whether or not the setting contents of the repeat function related to the repeat target block satisfy a predetermined condition; and the repeat If the setting command determination unit determines that the predetermined condition is satisfied , And a repeat time pipeline control means for performing an instruction fetch suppression control to temporarily suppress new fetch start instruction of the pipeline processing.
この発明における請求項7記載のデータ処理装置は、パイプライン処理機能を有するとともに、リピート関連の設定の少なくとも一部を規定したリピート設定命令に従い、少なくとも一つの命令を含み総コードサイズが所定のコードサイズとなるリピート対象ブロックをハードウェア的に繰り返し実行するリピート機能を有するデータ処理装置であって、パイプライン処理対象の命令をフェッチする命令フェッチ部と、前記命令フェッチ部から前記命令を受け、当該命令が前記リピート設定命令である場合に、前記リピート対象ブロックに関する前記リピート機能の設定内容が第1の条件を満足するか否かを判定する判定動作を実行するリピート設定命令用判定部と、前記リピート設定命令判定部が前記第1の条件を満足すると判定した場合、前記リピート設定命令に規定したリピート関連の設定動作が終了した後に前記リピート設定命令以降の命令のパイプライン処理をキャンセルするパイプラインキャンセル処理を実行するリピート時パイプライン制御手段とを備え、前記第1の条件は前記所定のコードサイズが第1の基準値以下である条件を含んでいる。 According to a seventh aspect of the present invention, there is provided a data processing device having a pipeline processing function and a code having a predetermined total code size including at least one instruction in accordance with a repeat setting instruction that defines at least a part of repeat-related settings. A data processing apparatus having a repeat function for repeatedly executing a repeat target block having a size in hardware, wherein the instruction fetch unit fetches an instruction to be pipeline processed, receives the instruction from the instruction fetch unit, When the instruction is the repeat setting instruction, a repeat setting instruction determination unit that executes a determination operation for determining whether or not the setting content of the repeat function related to the repeat target block satisfies a first condition; When the repeat setting command determination unit determines that the first condition is satisfied A repeat-time pipeline control means for executing pipeline cancel processing for canceling pipeline processing of instructions subsequent to the repeat setting command after completion of a repeat-related setting operation defined in the repeat setting command; This condition includes a condition that the predetermined code size is equal to or smaller than the first reference value.
この発明における請求項9記載のデータ処理装置は、パイプライン処理機能を有するとともに、リピート関連の設定の少なくとも一部を規定したリピート設定命令に従い、少なくとも一つの命令を含み総コードサイズが所定のコードサイズとなるリピート対象ブロックをハードウェア的に繰り返し実行するリピート機能を有するデータ処理装置であって、パイプライン処理対象の命令をフェッチする命令フェッチ部と、前記命令フェッチ部から前記命令を受け、当該命令が前記リピート設定命令である場合に、前記リピート対象ブロックに関する前記リピート機能の設定内容が所定のキャンセル条件を満足するか否かを判定する判定動作を実行するリピート設定命令用判定部と、前記リピート設定命令用判定部が前記所定のキャンセル条件を満足すると判定した場合、前記リピート設定命令以降の命令のパイプライン処理をキャンセルするパイプラインキャンセル処理を実行するリピート時パイプライン制御手段とを備え、前記少なくとも一つの命令は所定の制御基準命令コードを含み、前記所定のキャンセル条件は前記判定動作実行前状態の命令に前記所定の制御基準命令コードが存在する場合を含んでいる。 According to a ninth aspect of the present invention, there is provided a data processing device having a pipeline processing function and a code having a predetermined total code size including at least one instruction in accordance with a repeat setting instruction defining at least a part of repeat-related settings. A data processing apparatus having a repeat function for repeatedly executing a repeat target block having a size in hardware, wherein the instruction fetch unit fetches an instruction to be pipeline processed, receives the instruction from the instruction fetch unit, When the instruction is the repeat setting instruction, a repeat setting instruction determination unit that executes a determination operation for determining whether or not the setting content of the repeat function related to the repeat target block satisfies a predetermined cancellation condition; and The repeat setting command determination unit determines the predetermined cancellation condition. And a repeat pipeline control means for executing pipeline cancel processing for canceling pipeline processing of instructions subsequent to the repeat setting instruction, and wherein at least one instruction has a predetermined control reference instruction code. The predetermined cancellation condition includes a case where the predetermined control reference instruction code is present in the instruction before the execution of the determination operation.
この発明に係る請求項1記載のデータ処理装置は、リピート対象ブロックに関するリピート機能の設定内容が所定の条件を満足すると判定した場合、パイプライン処理対象の命令の新規フェッチ開始を一時抑止させることができる。 According to a first aspect of the present invention, when it is determined that the setting content of the repeat function related to the repeat target block satisfies a predetermined condition, the start of a new fetch of an instruction to be pipeline processed can be temporarily suppressed. it can.
したがって、リピート設定命令の設定動作完了前にリピート対象ブロックの命令が無条件に命令フェッチ部にフェッチされる場合に正常動作が保証できない場合を上記所定の条件に設定することにより、リピート対象ブロックの所定のコードサイズが比較的小さい場合にも正常にリピート動作を実行することができる。 Therefore, if the normal operation cannot be guaranteed when the instruction of the repeat target block is unconditionally fetched by the instruction fetch unit before the repeat setting instruction is set, the predetermined condition is set. Even when the predetermined code size is relatively small, the repeat operation can be normally executed.
この発明に係る請求項7記載のデータ処理装置は、所定のコードサイズが第1の基準値以下である場合であっても、パイプラインキャンセル処理を実行することにより、オーバーヘッドを最小限に抑えながら正常なリピート動作を実行することができる。 According to a seventh aspect of the present invention, there is provided the data processing device according to the seventh aspect of the present invention, by performing the pipeline canceling process even when the predetermined code size is equal to or smaller than the first reference value, while minimizing the overhead. Normal repeat operation can be executed.
この発明に係る請求項9記載のデータ処理装置は、判定実行前状態の命令に所定の制御基準命令コードが存在する場合である場合に、パイプラインキャンセル処理を実行することより、オーバーヘッドを最小限に抑えながら正常なリピート動作を実行することができる。 According to a ninth aspect of the present invention, in the data processing device according to the ninth aspect, the overhead is minimized by executing the pipeline canceling process when a predetermined control reference instruction code is present in the instruction in a state before execution of determination. A normal repeat operation can be executed while suppressing the number of times.
<実施の形態1>
本発明の実施の形態1のデータ処理装置について説明する。本データ処理装置は、16ビットプロセッサであり、アドレス及びデータのビット長は16ビットである。また、本データ処理装置は、ビット順、バイト順に関してビッグエンディアンを採用しており、ビット位置としてはMSBがビット0になる。実際、本データ処理装置は説明されていない多くの機能を含んでいるが、本発明の説明に関係ない部分は、簡単のため説明を省いている。
<
A data processing apparatus according to
図1から図3に本データ処理装置のレジスタセットを示す。 1 to 3 show a register set of the data processing apparatus.
図1は汎用レジスタを示しており、16本の汎用レジスタGR0〜GR15はデータやアドレス値を格納する。汎用レジスタGR14は、サブルーチンジャンプ時の戻り先アドレスを格納するためのリンク(LINK)レジスタとして割り当てられている。汎用レジスタGR15はスタックポインタ(SP)であり、割り込み用のスタックポインタ(SPI)GR15aとユーザ用のスタックポインタ(SPU)GR15bとが後で説明するプロセッサ・ステータス・ワード(PSW)によって切り替えられる。以後、SPIとSPUを総称して、スタックポインタ(SP)と呼ぶ。特別な場合を除き、4ビットのレジスタ指定フィールドでオペランドとなる各レジスタの番号が指定される。本データ処理装置では、例えば汎用レジスタGR0,GR1のように2つのレジスタをペアにして、処理する命令を備えている。この場合、偶数番号のレジスタを指定する。ペアのレジスタとして、レジスタ番号を1たした奇数番号のレジスタが暗に指定される。 FIG. 1 shows general-purpose registers, and the 16 general-purpose registers GR0 to GR15 store data and address values. The general-purpose register GR14 is assigned as a link (LINK) register for storing a return address at the time of a subroutine jump. The general-purpose register GR15 is a stack pointer (SP), and the stack pointer (SPI) GR15a for interrupt and the stack pointer (SPU) GR15b for user are switched by a processor status word (PSW) described later. Hereinafter, SPI and SPU are collectively referred to as a stack pointer (SP). Except for special cases, the number of each register as an operand is designated in a 4-bit register designation field. In this data processing device, for example, a general register GR0, GR1 is provided with an instruction to process two registers as a pair. In this case, an even-numbered register is designated. As a pair of registers, an odd-numbered register obtained by adding 1 to the register number is implicitly designated.
図2は、アキュムレータを示しており、各々40ビットのアキュムレータA0、A1が構成される。 FIG. 2 shows an accumulator, and 40-bit accumulators A0 and A1 are configured.
図3の制御レジスタCR0〜CR3,制御レジスタCR9〜CR11は各々16ビットの制御レジスタである。各制御レジスタも、汎用レジスタと同様、通常レジスタの番号が4ビットで示される。制御レジスタCR0は、プロセッサ・ステータス・ワード(PSW)であり、データ処理装置の動作モードを指定するビットや演算結果を示すフラグからなる。図4は制御レジスタCR0(PSW)の構成を示す図である。 The control registers CR0 to CR3 and control registers CR9 to CR11 in FIG. 3 are each 16-bit control registers. In each control register, as in the general-purpose register, the normal register number is indicated by 4 bits. The control register CR0 is a processor status word (PSW), and includes a bit that specifies an operation mode of the data processing apparatus and a flag that indicates an operation result. FIG. 4 is a diagram showing the configuration of the control register CR0 (PSW).
SMビット41(ビット0)はスタックモードを示すビットである。SMビット41が“0”の場合は割り込みモードであることを示し、汎用レジスタGR15としてSPIが用いられる。SMビット41が“1”の場合はユーザーモードであることを示し、汎用レジスタGR15としてSPUが用いられる。
The SM bit 41 (bit 0) is a bit indicating the stack mode. When the
IEビット42(ビット4)は割り込みイネーブルを指定するビットであり、IEビット42が“0”の場合は割り込みをマスク(アサートされても無視)し、“1”の場合は割り込みを受け付ける。
The IE bit 42 (bit 4) is a bit for specifying interrupt enable. When the
本データ処理装置では、ゼロオーバーヘッドのループ処理を実現するためのブロックリピート機能が実装されている。RPビット43(ビット5)はブロックリピート状態を示すビットであり、RPビット43が“0”の場合はブロックリピート中でないことを、“1”の場合はブロックリピート中であることを示す。
In this data processing apparatus, a block repeat function for realizing a zero overhead loop process is implemented. The RP bit 43 (bit 5) is a bit indicating a block repeat state. When the
F0フラグ44(ビット12)は実行制御フラグ(F0フラグ)であり、比較命令の比較結果などがこのフラグにセットされる。 The F0 flag 44 (bit 12) is an execution control flag (F0 flag), and the comparison result of the comparison instruction or the like is set in this flag.
キャリー・フラグ45(ビット15)は、加減算命令実行時のキャリーがセットされるフラグである。 The carry flag 45 (bit 15) is a flag in which the carry at the time of execution of the addition / subtraction instruction is set.
図3の制御レジスタCR2はプログラムカウンタ(PC)であり、実行中の命令アドレスを示す。本データ処理装置が処理する命令は、基本的に32ビット固定長であり、制御レジスタCR2(PC)は、32ビットを1ワードとした命令ワードアドレスを保持する。本レジスタは、読み出しのみ可能である。 The control register CR2 in FIG. 3 is a program counter (PC) and indicates an instruction address being executed. The instruction processed by this data processing apparatus is basically a 32-bit fixed length, and the control register CR2 (PC) holds an instruction word address with 32 bits as one word. This register can only be read.
制御レジスタCR1は、バックアップ・プロセッサ・ステータス・ワード(BPSW)、制御レジスタCR3は、バックアップ・プログラム・カウンタ(BPC)であり、各々例外や割り込みが検出された場合に実行中の制御レジスタCR0(PSW)の値と制御レジスタCR2(PC)の値を待避・保持するためのレジスタである。 The control register CR1 is a backup processor status word (BPSW), and the control register CR3 is a backup program counter (BPC). When an exception or an interrupt is detected, the control register CR0 (PSW) being executed is detected. ) And the value of the control register CR2 (PC) are saved and held.
制御レジスタCR9〜CR11は、ブロックリピート関連のレジスタであり、リピート中であっても割り込みを受け付けられるように、ユーザーが値を読み書きできるようになっている。制御レジスタCR9は、リピート・カウンタ(RPTC)であり、リピート回数を示すカウント値を保持する。制御レジスタCR10は、リピート・ブロック・スタート・アドレス・レジスタ(RPTS)であり、リピートを行うブロックの先頭の命令アドレスを保持する。制御レジスタCR11は、リピート・ブロック・エンド・アドレス・レジスタ(RPTE)であり、リピートを行うブロックの最後の命令のアドレスを保持する。 The control registers CR9 to CR11 are registers related to block repeat, and the user can read and write values so that an interrupt can be accepted even during repeat. The control register CR9 is a repeat counter (RPTC) and holds a count value indicating the number of repeats. The control register CR10 is a repeat block start address register (RPTS) and holds the instruction address at the head of the block to be repeated. The control register CR11 is a repeat block end address register (RPTE) and holds the address of the last instruction of the block to be repeated.
本データ処理装置は2ウェイのVLIW(Very Long Instruction Word)命令セットを処理する。図5は、本データ処理装置の命令フォーマットを示す。基本命令長は32ビット固定であり、32ビット境界に整置されている。各32ビットの命令コードは、命令のフォーマットを示す2ビットのフォーマット指定ビット(FMビット)101と、15ビットの左コンテナ102と右コンテナ103から構成される。各コンテナ102、103はそれぞれ15ビットからなるショートフォーマットのサブ命令を格納できるほか、2つで1つの30ビットのロングフォーマットのサブ命令を格納できる。今後、簡単のため、ショートフォーマットのサブ命令をショート命令、ロングフォーマットのサブ命令をロング命令と呼ぶ。
This data processing apparatus processes a 2-way VLIW (Very Long Instruction Word) instruction set. FIG. 5 shows an instruction format of the data processing apparatus. The basic instruction length is fixed at 32 bits and is aligned on a 32-bit boundary. Each 32-bit instruction code includes a 2-bit format designation bit (FM bit) 101 indicating the format of the instruction, a 15-bit
FMビット101は命令のフォーマット及び2つのショート命令の実行順序を指定する。図6に、FMビット101のフォーマット及び実行順序指定の詳細を示す。命令実行順序において、第1は先に実行される命令を、第2は後で実行される命令であることを示す。FMビット101が“11”の場合は、コンテナ102、103の30ビットで1つのロング命令を保持することを示し、それ以外の場合は各コンテナ102、103がそれぞれショート命令を保持することを示す。さらに、2つのショート命令を保持する場合、FMビット101で実行順序を指定する。FMビット101が“00”のときは、2つのショート命令を並列に実行することを示すR。FMビット101が“01”のときは、左コンテナ102に保持されているショート命令を実行した後に、右コンテナ103に保持されているショート命令を実行することを示す。FMビット101が“10”のときは、右コンテナ103に保持されているショート命令を実行した後に、左コンテナ102に保持されているショート命令を実行することを示す。このように、シーケンシャルに実行する2つのショート命令も含めて1つの32ビット命令にエンコード出来るようにして、コード効率の向上を図っている。
The
図7〜図10に典型的な命令のビット割り付けの例を示す。図7は2つのオペランドを持つショート命令のビット割り付けを示す。フィールド111、114は、オペレーションコードフィールドである。フィールド114は、アキュムレータ番号を指定する場合もある。フィールド112、113はオペランドとして参照あるいは更新されるデータの格納位置を、レジスタ番号やアキュムレータ番号で指定する。フィールド113は、4ビットの小さな即値を指定する場合もある。
FIGS. 7 to 10 show examples of bit allocation of typical instructions. FIG. 7 shows the bit assignment of a short instruction having two operands.
図8は、ショートフォーマットの分岐命令の割り付けを示しており、オペレーションコードフィールド121と8ビットの分岐変位フィールド122からなる。分岐変位は、PC値と同様、命令ワード(32ビット)のオフセットで指定される。
FIG. 8 shows allocation of a short format branch instruction, which includes an
図9は、16ビットの変位や即値を持つ3オペランド命令やロード/ストア命令のフォーマットを示しており、オペレーションコードフィールド131、ショートフォーマットと同様レジスタ番号等を指定するフィールド132、133と、16ビットの変位や即値等を指定する拡張データフィールド134からなる。
FIG. 9 shows the format of a 3-operand instruction or a load / store instruction having a 16-bit displacement or immediate value, and an
図10は、右コンテナ103側にオペレーションコードを持つロングフォーマットの命令のフォーマットを示しており、2ビットのフィールド141が“01”になっている。フィールド143,146はオペレーションコードフィールドで、フィールド144,145はレジスタ番号等を指定するフィールドである。フィールド142は予約フィールドであり必要に応じてオペレーションコードやレジスタ番号等の指定に使用される。
FIG. 10 shows the format of a long format instruction having an operation code on the
上述以外に、NOP(ノー・オペレーション)のように、15ビットすべてがオペレーションコードとなる命令や、1オペランド命令等、特殊な命令のビット割り付けを持つものもある。 In addition to the above, there are other types such as NOP (no operation) that have special instruction bit assignments such as an instruction in which all 15 bits are an operation code and a one-operand instruction.
本データ処理装置の各サブ命令は、RISCライクな命令セットとなっている。メモリデータのアクセスを行う命令はロード/ストア命令のみであり、演算命令はレジスタ/アキュムレータ中のオペランドや即値オペランドに対して演算を行う。オペランドデータのアドレッシングモードとしては、レジスタ間接モード、ポストインクリメント付きレジスタ間接モード、ポストデクリメント付きレジスタ間接モード、プッシュモード、レジスタ相対間接モードの5種類ある。各々のニーモニックは、“ Rsrc”、“ Rsrc+”、“ Rsrc−”、“ −SP”、“ (disp16、Rsrc)”で示される。Rsrcはベースアドレスを指定するレジスタ番号を、disp16は16ビットの変位値を示す。オペランドのアドレスはバイトアドレスで指定される。 Each sub-instruction of this data processing apparatus is a RISC-like instruction set. The only instruction for accessing memory data is a load / store instruction, and the arithmetic instruction performs an operation on an operand or an immediate operand in a register / accumulator. There are five types of operand data addressing modes: register indirect mode, register indirect mode with post-increment, register indirect mode with post-decrement, push mode, and register relative indirect mode. Each mnemonic is indicated by “Rsrc”, “Rsrc +”, “Rsrc−”, “−SP”, “(disp16, Rsrc)”. Rsrc indicates a register number for designating a base address, and disp16 indicates a 16-bit displacement value. The address of the operand is specified by a byte address.
レジスタ相対間接モード以外のロード/ストア命令は、図7に示す命令フォーマットとなる。フィールド113でベースレジスタ番号が指定され、フィールド112でメモリからロードしてきた値を書き込むレジスタの番号もしくはストアする値を保持するレジスタの番号が指定される。レジスタ間接モードは、ベースレジスタとして指定されたレジスタの値がオペランドアドレスとなる。ポストインクリメント付きレジスタ間接モードは、ベースレジスタとして指定されたレジスタの値がオペランドアドレスとなり、このベースレジスタの値がオペランドのサイズ(バイト数)分ポストインクリメントされて、書き戻される。ポストデクリメント付きレジスタ間接モードは、ベースレジスタとして指定されたレジスタの値がオペランドアドレスとなり、このベースレジスタの値がオペランドのサイズ(バイト数)分ポストデクリメントされて、書き戻される。プッシュモードは、ストア命令で、かつ、ベースレジスタがR15の場合にのみ使用可能であり、スタックポインタ(SP)値がオペランドのサイズ(バイト数)分プリデクリメントされた値が、オペランドアドレスとなり、デクリメントされた値がSPに書き戻される。
A load / store instruction other than the register relative indirect mode has the instruction format shown in FIG. The base register number is designated in the
レジスタ相対間接モードのロード/ストア命令は図9に示す命令フォーマットとなる。フィールド133でベースレジスタ番号が指定され、フィールド132でメモリからロードしてきた値を書き込むレジスタの番号もしくはストアする値を保持するレジスタの番号が指定される。フィールド134はオペランド格納位置のベースアドレスからの変位値を指定する。レジスタ相対間接モードは、ベースレジスタとして指定されたレジスタの値に16ビットの変位値を加算した値がオペランドアドレスとなる。
The register relative indirect mode load / store instruction has the instruction format shown in FIG. The base register number is designated in the
ジャンプ命令のジャンプ先アドレス指定には、ジャンプ先アドレスをレジスタ値で指定するレジスタ間接モードと、ジャンプ命令のプログラム・カウンタPCからの分岐変位で指定するPC相対間接モードとがある。PC相対間接モードについては、分岐変位を8ビットで指定するショートフォーマットと、分岐変位を16ビットで指定するロングフォーマットの2種類ある。また、オーバーヘッドなしにループ処理を実現するリピート機能を起動するためのブロックリピート命令も備える。 The jump destination address designation of the jump instruction includes a register indirect mode in which the jump destination address is designated by a register value and a PC relative indirect mode in which the jump instruction is designated by a branch displacement from the program counter PC. There are two types of PC relative indirect mode: a short format that specifies branch displacement with 8 bits and a long format that specifies branch displacement with 16 bits. Further, a block repeat instruction for starting a repeat function for realizing loop processing without overhead is also provided.
図11は本実施の形態のデータ処理装置200の機能ブロック構成を示すブロック図である。同図に示すように、データ処理装置200は、MPUコア部201、MPUコア部201からの要求により命令データのアクセスを行う命令フェッチ部202、内蔵命令メモリ203、MPUコア部201からの要求によりオペランドデータのアクセスを行うオペランドアクセス部204、内蔵データメモリ205、及び命令フェッチ部202とオペランドアクセス部204からの要求を調停し、データ処理装置200の外部のメモリアクセスを行う外部バスインターフェイス部206からなる。
FIG. 11 is a block diagram showing a functional block configuration of the
MPUコア部201は、制御部211、レジスタファイル221、第1演算部222、第2演算部223、PC部224からなる。
The
制御部211は、パイプライン処理制御、命令の実行制御、命令フェッチ部202やオペランドアクセス部204とのインターフェイス制御など、MPUコア部201のすべての制御を行う。
The
制御部211内の命令キュー212は、2エントリの32ビット命令バッファと有効ビット、及び入出力ポインタ等からなり、FIFO(先入れ先出し)方式で制御される。命令フェッチ部202でフェッチされた命令データを一時保持し、命令デコード部213に送る。
The
命令デコード部213は、主として2つのデコーダを含み、命令キュー212から送られる命令コードをデコードする。第1デコーダ214は、第1演算部222で実行する命令をデコードし、第2デコーダ215は、第2演算部223で実行する命令をデコードする。32ビットの命令のデコードの第1サイクルでは、必ず左コンテナ102の命令コードが第1デコーダ214で解析され、右コンテナ103の命令コードが第2デコーダ215で解析される。ただし、FMビット101及び左コンテナのビット0とビット1のデータは両方のデコーダで解析される。また、拡張データの切り出しを行うために、右コンテナ103のデータが第1デコーダ214に送られるが、解析は行われない。従って、最初に実行する命令はその命令を実行する演算器に対応した位置に置かれなければならない。2つのショート命令をシーケンシャルに実行する場合、先行して実行される命令のデコード中に後で実行する側の命令が図示していないプリデコーダでデコードされ、どちらのデコーダでデコードすべきかを判定する。先行する命令のデコード後、後で実行する命令の命令コードが選択されたデコーダに取り込まれ、解析される。後で実行される命令がどちらのデコーダでも処理できる命令の場合は第1デコーダ214でデコードする。
The
レジスタファイル221は、汎用レジスタGR0〜GR15の汎用レジスタ値を物理的に保持するレジスタからなり、第1演算部222、第2演算部223、PC部224、オペランドアクセス部204に複数のバスで結合されている。
The
図12は第1演算部222の詳細ブロック構成を示すブロック図である。第1演算部222は、レジスタファイル221と、16ビット幅のS1バス251、S2バス252、S3バス253で結合されており、この3つのバスでレジスタからデータを読み出し、演算器等にリードオペランドとなるデータやストアデータを転送する。また、第1演算部222は、レジスタファイル221と、16ビット幅のD1バス261、Wバス272で結合されており、D1バス261で演算結果や転送データを、Wバス272でロードしたバイトデータをレジスタファイル221に転送する。
FIG. 12 is a block diagram illustrating a detailed block configuration of the
さらに、第1演算部222及びレジスタファイル221は、オペランドアクセス部204と32ビットのODバス271で結合されており、1ワード、もしくは、2ワードのデータを転送することが可能である。
Further, the first
AAラッチ302、ABラッチ303は、ALU301の入力ラッチである。AAラッチ302は、S1バス251もしくはS3バス253を介して読み出されたレジスタ値を取り込む。ゼロクリアする機能も備えている。ABラッチ303は、S3バス253を介して読み出されたレジスタ値もしくは第1デコーダ214でデコードの結果生成された16ビットの即値を取り込む。ゼロクリアする機能も備えている。ALU301では、主として比較、算術論理演算、オペランドアドレスの計算/転送、オペランドアドレス値のインクリメント/デクリメント、ジャンプ先アドレスの計算/転送等が行われる。演算結果やアドレスモディファイの結果はセレクタ305、D1バス261を介して、レジスタファイル221中の命令で指定されたレジスタに書き戻される。OAラッチ306は、オペランドのアドレスを保持するラッチであり、ALU301でのアドレス計算結果もしくはAAラッチ302に保持されたベースアドレスの値を選択的に保持し、OAバス273を介してオペランドアクセス部204に出力する。また、ジャンプ先アドレスやリピートブロックエンドアドレスなどを計算した場合には、ALU301の出力が、JAバス274を介してPC部224に転送される。ラッチ304は、制御レジスタ値や汎用レジスタ値の転送時に転送する値を保持するラッチであり、S1バス251もしくはS3バス253を介して転送された値をセレクタ305に出力する。転送時にはラッチ304の値が、D1バス261を介して、レジスタファイル221中の命令で指定されたレジスタや、第1演算部222もしくはPC部224内の制御レジスタに書き込まれる。
An
ストアデータ(SD)レジスタ311は、32ビットのレジスタであり、S1バス251もしくはS2バス252の一方、もしくは、S1バス251とS2バス252の両方に出力されたストアデータを一時保持する。SDレジスタ311に保持されたデータは、ラッチ312を介して整置回路313に転送される。整置回路313では、オペランドのアドレスに従ってストアデータが32ビット境界に整置され、整置後のストアデータがラッチ314、ODバス271を介してオペランドアクセス部204に出力される。
The store data (SD) register 311 is a 32-bit register, and temporarily stores the store data output to one of the
また、オペランドアクセス部204でロードされたバイトデータは、ODバス271を介して、16ビットのロードデータ(LD)レジスタ315に取り込まれる。LDレジスタ315の値は、整置回路316に転送される。整置回路316では、バイト整置及びバイトデータのゼロ/符号拡張を行う。整置、拡張後のデータが、ラッチ317、Wバス272を介してレジスタファイル221中の指定されたレジスタに書き込まれる。1ワード(16ビット)、あるいは、2ワード(32ビット)ロードの場合には、LDレジスタ315を介さず、ODバス271からレジスタファイル221にロードした値が直接書き込まれる。
Further, the byte data loaded by the
制御部211中のPSW部323は図3の制御レジスタCR0(PSW)の値を物理的に保持するラッチや、PSW更新回路等からなり、演算結果や命令の実行によりPSWの値を更新する。制御部211中の制御レジスタに値を転送する場合、S3バス253に出力されたデータがCNTIFラッチ321を介して、PSW部323に転送される。また、制御部211中の制御レジスタの値を読み出す場合には、PSW部323から読み出し対象となる制御レジスタの値がD1バス261に出力され、レジスタファイル221に書き込まれる。BPSWレジスタ322は図3の制御レジスタCR1(BPSW)の値を物理的に保持するレジスタである。例外処理等の起動にともなうPSW値の待避時には、D1バス261に出力された制御レジスタCR0(PSW)の値がBPSWレジスタ322に書き込まれる。例外処理等からの復帰時には、BPSWレジスタ322の値は、直接CNTIFラッチ321を介して、PSW部323に転送される。また、BPSWレジスタ322はS3バス253への出力経路、及び、D1バス261からの入力経路を備える。
The
図13はPC部224の内部構成の詳細を示すブロック図である。同図に示すように、命令アドレス(IA)レジスタ337は、次にフェッチする命令のアドレスを保持し、次にフェッチする命令のアドレスを命令フェッチ部202に出力する。引き続き後続の命令をフェッチする場合には、IAレジスタ337からラッチ338を介して転送されたアドレス値がインクリメンタ339で1インクリメントされて、IAレジスタ337に書き戻される。ジャンプやブロックリピート等によりシーケンスが切り替わる場合には、IAレジスタ337はJAバス274を介して転送されるジャンプ先アドレスや、リピートブロックスタートアドレスを取り込む。
FIG. 13 is a block diagram showing details of the internal configuration of the
RPTSレジスタ341、RPTEレジスタ343、及びRPTCレジスタ345はブロックリピート制御用の制御レジスタであり、それぞれ図3の制御レジスタCR10、制御レジスタCR11、及び制御レジスタCR9に対応する値を物理的に保持する。RPTSレジスタ341、RPTEレジスタ343、及びRPTCレジスタ345は、D1バス261からの入力ポートとS3バス253への出力ポートを持ち、必要に応じてブロックリピート時の初期設定や待避、復帰が行なわれる。
The
RPTSレジスタ341はリピートブロックの開始命令アドレスを保持する。RPTSレジスタ341初期設定直後には、ラッチ342も更新される。ブロックリピート処理中で、リピートブロックの先頭命令に戻る場合は、ラッチ342の値が、JAバス274を介して、IAレジスタ337に転送される。
The
RPTEレジスタ343はリピートブロックの最終命令のアドレスを保持する。この最終アドレスは、ブロックリピート命令処理時に第1演算部222で計算され、JAバス274を介してRPTEレジスタ343に取り込まれる。比較器344は、RPTEレジスタ343の値と、命令フェッチアドレスを保持しているIAレジスタ337の値とを比較し、一致情報692を制御部211へ出力する。
The
RPTCレジスタ345及びTRPTCレジスタ348は、リピートブロックの実行回数を管理するためのカウント値を保持する。TRPTCレジスタ348は、パイプライン処理における命令フェッチ段階での先行更新情報を保持する。TRPTCレジスタ348はD1バス261からの入力ポートを備えており、RPTCレジスタ345の初期設定時に、同時に初期化される。リピートブロック最終命令のフェッチを行った場合、TRPTCレジスタ348の値がラッチ350を介してデクリメンタ351に転送され、デクリメントされてTRPTCレジスタ348に書き戻される。1検出回路(ONE)349は、TRPTCレジスタ348が“1”である事を検出し、検出結果情報693を制御部211へ出力する。RPTCレジスタ345は、マスタとなる実行段階でのカウント値を保持する。リピートブロック最終命令が実行されると、RPTCレジスタ345の値がラッチ346を介してデクリメンタ347に転送され、デクリメントされてRPTCレジスタ345に書き戻される。また、ジャンプが起こった場合にTRPTCレジスタ348の値を初期化するために、RPTCレジスタ345から、ラッチ352を介し、TRPTCレジスタ348へ転送する経路がある。
The
実行ステージPC(EPC)334は実行中の命令のPC値を保持し、次命令PC(NPC)331は次に実行する命令のPC値を保持する。NPC331は、実行段階でジャンプが起こった場合、JAバス274上のジャンプ先アドレス値を取り込む。リピートブロックの処理を繰り返す場合には、ラッチ342からリピートを行うブロックの先頭アドレスを取り込む。処理シーケンスの変更なく命令の実行が進むの場合には、1命令の実行が終了する毎にラッチ332を介して転送されたNPC331の値が、インクリメンタ333でインクリメントされ、NPC331に書き戻される。サブルーチンジャンプ命令の場合には、ラッチ332の値が戻り先アドレスとしてD1バス261に出力され、レジスタファイル221中のリンクレジスタとして定義されているR14に書き込まれる。
The execution stage PC (EPC) 334 holds the PC value of the instruction being executed, and the next instruction PC (NPC) 331 holds the PC value of the instruction to be executed next. The
次に実行する命令のPCを参照する場合には、NPC331の値がS3バス253に出力され、第1演算部222に転送される。また、次の命令が実行状態に入る場合には、ラッチ332の値がEPC334に転送される。実行中の命令のPC値を参照する場合には、EPC334の値がS3バス253に出力され、第1演算部222に転送される。BPC336は、図3の34のCR3に対応する値を物理的に保持する。例外や割り込み等が検出された場合には、EPC334の値がラッチ335を介してBPC336に転送される。BPC336は、D1バス261からの入力ポートとS3バス253への出力ポートを持ち、必要に応じて待避、復帰が行なわれる。
When referring to the PC of the instruction to be executed next, the value of the
第2演算部223は、レジスタファイル221と、複数のバスで接続されており、参照/更新するレジスタ値を転送する。第2演算部223は、ALU、バレルシフタ、プライオリティエンコーダ、積和演算器等を含み命令で指定された演算実行等を行う。図2で示したアキュムレータA0,A1の2本の40ビットアキュムレータを物理的に保持するアキュムレータも、第2演算部223に含まれる。
The second
次に本実施の形態におけるデータ処理装置のパイプライン処理について説明する。図14はパイプライン処理を示す説明図である。本データ処理装置は、命令データのフェッチを行う命令フェッチ(IF)ステージ401、命令の解析を行う命令デコード(D)ステージ402、演算実行を行う命令実行(E)ステージ403、データメモリのアクセスを行うメモリアクセス(M)ステージ404、メモリからロードしたバイトオペランドをレジスタへ書き込むライトバック(W)ステージ405の5段のパイプライン処理を行う。
Next, pipeline processing of the data processing apparatus in this embodiment will be described. FIG. 14 is an explanatory diagram showing pipeline processing. This data processing apparatus includes an instruction fetch (IF)
Eステージ403での演算結果のレジスタへの書き込みはEステージ403、ワード(2バイト)、2ワード(4バイト)ロード時のレジスタへの書き込みはMステージ404で完了する。積和/積差演算、倍精度演算に関しては、更に乗算と加算の2段のパイプラインで命令の実行を行う。後段の処理を命令実行2(E2)ステージ406と呼ぶ。連続する積和/積差演算を1回/1クロックサイクルのスループットで実行できる。
Writing of the operation result in the register in the
IFステージ401では、主として命令のフェッチ、命令キュー212の管理、ブロックリピート制御が行われる。命令フェッチ部202、内蔵命令メモリ203、外部バスインターフェイス部206、PC部224のIAレジスタ337、ラッチ338、インクリメンタ339、TRPTCレジスタ348、ラッチ350、デクリメンタ351、1検出回路349、比較器344等や制御部211のIFステージステージ制御、命令フェッチ制御、命令キュー212、PC部224制御等を行う部分が、このIFステージ401の制御で動作する。IFステージ401は、Eステージ403のジャンプで初期化される。
In the
命令フェッチアドレスは、IAレジスタ337で保持される。Eステージ403でジャンプが起こるとJAバス274を介してジャンプ先アドレスを取り込み、初期化を行う。シーケンシャルに命令データをフェッチする場合には、インクリメンタ339でアドレスをインクリメントする。ブロックリピート処理中で、リピートブロックの最終命令処理後リピートブロックの先頭に戻る場合、IFステージ401で命令処理シーケンスの切り替え制御が行われる。この際、RPTSレジスタ341に保持されているアドレスが、ラッチ342、JAバス274を介してIAレジスタ337に転送される。
The instruction fetch address is held in the
IAレジスタ337の値は命令フェッチ部202に送られ、命令フェッチ部202が命令データのフェッチを行う。対応する命令データが内蔵命令メモリ203にある場合には、内蔵命令メモリ203から命令コードを読み出す。この場合、1クロックサイクルで32ビットの命令のフェッチを完了する。対応する命令データが内蔵命令メモリ203にない場合には、外部バスインターフェイス部206に命令フェッチ要求を出す。外部バスインターフェイス部206は、オペランドアクセス部204からの要求とを調停し、命令の取り込みが可能になったら、外部のメモリから命令データを取り込み、命令フェッチ部202に送る。外部バスインターフェイス部206は、最小2クロックサイクルで外部メモリのアクセスを行うことが可能である。命令フェッチ部202は取り込まれた命令を、命令キュー212に転送する。
The value of the IA register 337 is sent to the instruction fetch
命令キュー212は2エントリのキューになっており、FIFO制御で取り込まれた命令コードを、命令デコード部213に出力する。ブロックリピート処理中で命令フェッチアドレスがRPTEレジスタ343と一致した事を示すリピートブロック最終命令情報と、ブロックリピート処理中で、命令フェッチアドレスがRPTEレジスタ343と一致し、かつ、更新前のTRPTCレジスタ348が“1”であった事を示すブロックリピート処理終了情報が、命令キューに対応する命令コードとともに保持され、対応する命令コードとともに命令デコード部213に出力される。以降のステージでは、この情報の基づき、ブロックリピート処理に関する命令非依存のハードウェア制御が行われる。
The
Dステージ402では、命令デコード部213でオペレーションコードの解析を行い、第1演算部222、第2演算部223、PC部224等で命令の実行を行うための制御信号群を生成する。Dステージ402は、Eステージ403のジャンプで初期化される。命令キュー212から送られてくる命令コードが無効な場合には、アイドルサイクルとなり、有効な命令コードが取り込まれるまで待つ。Eステージ403が次の処理を開始できない場合には、演算器等に送る制御信号を無効化し、Eステージ403での先行命令の処理の終了を待つ。例えば、Eステージ403で実行中の命令がメモリアクセスを行う命令であり、Mステージ404でのメモリアクセスが終了していない場合にこのような状態になる。
In the
Dステージ402では、シーケンシャル実行を行う2命令の分割や、2サイクル実行命令のシーケンス制御も行う。さらに、Eステージ403で参照もしくは更新するレジスタ値のロードが完了しているかどうかを判定するロードオペランドの干渉チェックや第2演算部223の演算器のE2ステージ406とEステージ403の干渉チェック等も行い、干渉が検出された場合には、干渉が解消されるまで制御信号の出力を抑止する。
The
第1デコーダ214は、主として第1演算部222のすべて、PC部224のIFステージ401で制御される部分以外、レジスタファイル221のS1バス251、S2バス252、S3バス253への読み出し制御とD1バス261からの書き込み制御に関する実行制御信号を生成する。命令に依存するMステージ404やWステージ405での処理に必要な制御信号もここで生成され、パイプラインの処理の流れに付随して転送される。第2デコーダ215は、主として第2演算部223での実行制御、レジスタファイル221の第2演算部223にデータを転送する複数のバスへの読み出し制御と第2演算部223から出力されるデータの書き込み制御に関する実行制御信号を生成する。
The
命令キュー212から取り込まれたリピートブロック最終命令情報とブロックリピート処理終了情報をもとに、命令に依存しないブロックリピート処理に関するNPC331の更新制御信号、RPTCレジスタ345の更新制御信号や、制御レジスタCR0(PSW)のRPビット43のクリアに関する更新制御信号などが生成される。
Based on the repeat block final instruction information and the block repeat process end information fetched from the
Eステージ403では、演算、比較、制御レジスタを含むレジスタ間転送、ロード/ストア命令のオペランドアドレス計算、ジャンプ命令のジャンプ先アドレスの計算、ジャンプ処理、EIT(例外、割り込み、トラップの総称)検出と各EITのベクタアドレスへのジャンプ等、メモリアクセスと積和/積差演算命令の加算処理を除く命令実行に関するほとんどすべての処理を行う。
In the
割り込みイネーブルの場合の割り込みの検出は、必ず32ビット命令の切れ目で行われる。32ビット命令の中にシーケンシャルに実行する2つのショート命令がある場合も、この2つのショート命令間で割り込みを受け付けることはない。 Detection of an interrupt when the interrupt is enabled is always performed at a break of a 32-bit instruction. Even when there are two short instructions to be executed sequentially in the 32-bit instruction, no interrupt is accepted between the two short instructions.
Eステージ403で処理中の命令がオペランドアクセスを行う命令であり、Mステージ404でメモリアクセスが完了しない場合には、Eステージ403での完了は待たされる。ステージ制御は制御部211で行われる。
If the instruction being processed in the
Eステージ403において、第1演算部222内のALU301で、算術論理演算、比較、転送、メモリオペランドのアドレスや分岐先のアドレス計算等が行われる。オペランドとして指定されたレジスタの値が、S1バス251、S2バス252、S3バス253に読み出され、必要に応じて別途取り込まれる即値、変位等の拡張データを使用して、ALU301で演算が行われ、演算結果がD1バス261を介してレジスタファイル221に書き戻される。ロード/ストア命令の場合には、演算結果はOAラッチ306、OAバス273を介して、オペランドアクセス部204に送られる。ジャンプ命令の場合には、ジャンプ先アドレスがJAバス274を介して、PC部224に送られる。ストアデータはS1バス251、S2バス252を介して、レジスタファイル221から読み出され、SDレジスタ311、ラッチ312を介して転送後、整置回路313で整置が行われる。また、PC部224では、実行中の命令のPC値の管理、次に実行する命令のアドレスの生成が行われる。第1演算部222、PC部224に含まれる制御レジスタ(アキュムレータを除く)とレジスタファイル221間の転送は、S3バス253、D1バス261を介して行われる。
In the
Eステージ403において、第2演算部223では、算術論理演算、比較、転送、シフト他、積和演算の加算以外のすべての演算実行が行われる。オペランドの値が、レジスタファイル221やアキュムレータ等からバスを介して各演算器に転送され、指定された演算を行い、演算結果がアキュムレータや、D2バス262を介してレジスタファイル221に書き戻される。
In the
第1演算部222及び第2演算部223での演算結果によるPSW中のフラグ値の更新制御も、Eステージ403で行われる。しかし、演算結果の確定がEステージ403の遅い時期になるため、実際のPSW値の更新は、次サイクルで行われる。データ転送によるPSWの更新は、対応するサイクルで完了する。
The
Eステージ403では、実行する命令に依存しないPC値の更新やブロックリピート制御も行われる。新しい32ビット命令の処理を開始するたびに、ラッチ332の値をEPC334に転送する。NPC331は次に処理する命令のアドレスを保持する。Eステージ403でジャンプが起こった場合には、ALU301で生成されるジャンプ先アドレスがJAバス274を介してNPC331に書き込まれ、初期化される。シーケンシャルに命令の処理が継続する場合には、32ビット命令の処理を開始するたびに、インクリメンタ333で1インクリメントされた値がNPC331に書き戻される。ブロックリピート継続でリピートブロック最終命令の処理を開始する際には、ラッチ342からリピートブロックの先頭アドレスを取り込む。リピートブロック最終命令の処理を終了するサイクルで、RPTCレジスタ345の値がラッチ346を介してデクリメンタ347でデクリメントして書き戻される。ブロックリピート処理を終了する場合、リピートブロック最終命令の処理を終了するサイクルで、PSWのRPビット43を“0”にクリアする。
In the
第1デコーダ214で生成されたロード/ストア命令のメモリアクセス関連情報、ロードレジスタ情報は、Eステージ403の制御のもとに保持され、Mステージ404に送られる。また、第2デコーダ215で生成された積和/積差演算の加減算実行のための演算制御信号は、Eステージ403の制御のもとに保持され、E2ステージ406に送られる。Eステージ403のステージ制御も制御部211で行われる。
Memory access related information and load register information of the load / store instruction generated by the
Mステージ404では、第1演算部222から送られたアドレスでオペランドのアクセスが行われる。オペランドアクセス部204は、オペランドが内蔵データメモリ205やチップ内IO(図示せず)にある場合には、内蔵データメモリ205やチップ内IOに対し、1クロックサイクルに1回のオペランドのリードもしくはライトを行う。オペランドが内蔵データメモリ205やチップ内IOでない場合には、外部バスインターフェイス部206にデータアクセス要求を出す。外部バスインターフェイス部206は、外部のメモリに対してデータアクセスを行い、ロードの場合には読み出されたデータをオペランドアクセス部204に転送する。
In the
外部バスインターフェイス部206は、最小2クロックサイクルで外部メモリのアクセスを行うことが可能である。ロードの場合には、オペランドアクセス部204は読み出されたデータを、ODバス271を介して転送する。バイトデータの場合はLDレジスタ315に、ワード、もしくは、2ワードデータの場合にはレジスタファイル221に直接書き込む。ストアの場合には、整置されたストアデータの値が、整置回路313からラッチ314、ODバス271を介してオペランドアクセス部204に転送され、対象となるメモリへの書き込みが行われる。Mステージ404のステージ制御も制御部211で行われる。
The external
Wステージ405において、LDレジスタ315に保持されたロードオペランド(バイト)は、整置回路316で整置、ゼロ/符号拡張された後に、ラッチ317へ転送され、Wバス272を介してレジスタファイル221へ書き込まれる。
In the
E2ステージ406では、積和/積差演算の加減算処理を行い、加減算結果をアキュムレータに書き戻す。
In the
本データ処理装置は、入力クロックに基づいて内部制御を行う。最短の場合、各パイプラインステージは、内部の1クロックサイクルで処理を終了する。ここでは、クロック制御の詳細については、本発明に直接関係ないので説明を省略する。 The data processing apparatus performs internal control based on the input clock. In the shortest case, each pipeline stage finishes processing in one internal clock cycle. Here, the details of the clock control are not directly related to the present invention, and the description thereof will be omitted.
各サブ命令の処理例について説明する。加減算、論理演算、比較等の演算命令やレジスタ間の転送命令は、IFステージ401、Dステージ402、Eステージ403の3段で処理を終了する。演算やデータ転送をEステージ403で行う。
A processing example of each sub instruction will be described. Processing operations such as addition / subtraction, logical operation, comparison, and transfer instruction between registers are completed in three stages of IF
積和/積差命令は、乗算を行うEステージ403と加減算を行うE2ステージ406の2クロックサイクルで演算実行を行うため、4段の処理となる。
The product-sum / product-difference instruction is a four-stage process because the operation is executed in two clock cycles of the
バイトロード命令は、IFステージ401、Dステージ402、Eステージ403、Mステージ404、Wステージ405の5段で処理を終了する。1ワード/2ワードのロードやストア命令は、IFステージ401、Dステージ402、Eステージ403、Mステージ404の4段で処理を終了する。
The byte load instruction ends in five stages of IF
非整置アクセスの場合には、オペランドアクセス部204でMステージ404の制御のもと整置された2回のアクセスに分割され、メモリアクセスが行われる。
In the case of non-arranged access, the
実行に2サイクルかかる命令では、第1、第2命令デコーダ214、215で、2サイクルかけて処理し、各サイクル毎に各々実行制御信号を出力し、2サイクルかけて演算実行を行う。
An instruction that takes two cycles to execute is processed by the first and
ロング命令は、1つの32ビット命令が1つのロング命令で構成されており、この1つのロング命令の処理で32ビット命令の実行が完了する。パラレル実行する2つの命令は、2つのショート命令のうち処理サイクルの大きい方の命令の処理に律速される。例えば、2サイクル実行の命令と1サイクル実行の命令の組み合わせの場合には、2サイクルかかる。シーケンシャル実行の2つのショート命令の場合には、各サブ命令の組み合わせになり、デコード段階で各命令がシーケンシャルにデコードされ、実行される。例えば、Eステージ403で1サイクルで実行が完了する加算命令が2つの場合には、Dステージ402、Eステージ403とも各命令に1サイクル、計2サイクルかけて処理する。Eステージ403における先行命令の実行と並列して、Dステージ402で後続命令のデコードが行われる。
In the long instruction, one 32-bit instruction is composed of one long instruction, and execution of the 32-bit instruction is completed by processing of the one long instruction. Two instructions to be executed in parallel are limited by the processing of the instruction having the longer processing cycle of the two short instructions. For example, in the case of a combination of a two-cycle execution instruction and a one-cycle execution instruction, two cycles are required. In the case of two short instructions for sequential execution, each sub-instruction is combined, and each instruction is sequentially decoded and executed at the decoding stage. For example, when there are two addition instructions that are completed in one cycle in the
次に、本実施の形態におけるデータ処理装置のブロックリピート処理の動作を詳細に説明する。本データ処理装置のリピート命令は2つ命令フォーマットを備えている。 Next, the operation of the block repeat process of the data processing apparatus in this embodiment will be described in detail. The repeat instruction of this data processing apparatus has two instruction formats.
図15及び図16はそれぞれリピート命令のビット割り付けを示す説明図である。繰り返し回数をレジスタ値で指定する“REP Rs,disp”のビット割り付けを図15に、繰り返し回数を8ビットの即値で指定する“REPI imm,disp”のビット割り付けを図16に示す。共に、ロング命令のフォーマットであり、図9に示したものに近い命令ビット割り付けとなっている。 FIG. 15 and FIG. 16 are explanatory diagrams showing bit allocation of repeat instructions, respectively. FIG. 15 shows the bit assignment of “REP Rs, disp” for designating the number of repetitions with a register value, and FIG. 16 shows the bit assignment of “REPI imm, disp” for designating the number of repetitions with an immediate value of 8 bits. Both are long instruction formats, and the instruction bit allocation is similar to that shown in FIG.
FMビット101はロングフォーマットを示す“11”となる。図15及び図16において、オペレーションコード501,511、予約フィールド502、disp504、disp513はリピートブロックの最終命令のアドレスを、リピート命令のアドレスからの変位(32ビットの命令ワード単位)で指定する。リピートブロック(繰り返し対象命令のブロック)は、リピート命令の次の命令から、disp504、513で指定される命令までとなる。Rs503はリピートブロックの繰り返し回数を指定するレジスタ番号である。imm512はリピートブロックの繰り返し回数を指定する即値フィールドである。なお、本実施の形態では、繰り返し回数が“0”の場合には、動作保証しないものとする。
The
基本的に、リピート命令はリピートブロックのサイズにより、3種類に分類され、異なった処理を行う。第1はリピートブロックのサイズが1命令(変位値が“1”)の場合であり、リピート命令の実行後ジャンプ処理を行い、パイプラインをキャンセルする。 Basically, repeat instructions are classified into three types according to the size of the repeat block, and different processes are performed. The first is a case where the repeat block size is 1 instruction (displacement value is “1”), and jump processing is executed after execution of the repeat instruction to cancel the pipeline.
第2はリピートブロックのサイズが2命令(変位値が“2”)の場合であり、リピート命令デコード時に命令フェッチを一旦停止(抑止)し、リピート命令の実行終了時に、命令フェッチの停止を解除する。 The second is when the repeat block size is 2 instructions (displacement value is “2”). Instruction fetch is temporarily stopped (suppressed) when the repeat instruction is decoded, and the instruction fetch stop is released when the repeat instruction is finished. To do.
第3はリピートブロックのサイズが3命令以上(変位値が“3”以上)の場合であり、リピート命令の実行後ジャンプをしたり、命令フェッチの一時停止制御を行ったりすることなく、パイプライン処理を継続する。 The third is the case where the repeat block size is 3 instructions or more (displacement value is "3" or more), and the pipeline does not jump after execution of the repeat instruction or does not perform pause control of instruction fetch. Continue processing.
図17は、本発明の実施の形態であるデータ処理装置の制御部211のうち、リピート制御の説明に必要な部分の一部のみを模式的に示したブロック図である。実際の論理はより複雑である。また、図17で示しているように明確にブロック分けできるようなものでないものもある。あくまでも、説明しやすいように示した概念的なブロック図である。
FIG. 17 is a block diagram schematically showing only a part of the
IFステージ制御部651は命令フェッチステージの制御を行う。IFステージ制御部651内に存在しリピート時パイプライン制御手段の一部としても機能する命令フェッチ要求生成部652は命令キューの空き状態やリピート関連の制御信号(命令フェッチ抑止信号681,命令フェッチ抑止解除信号682)に基づき、命令フェッチ要求信号691を生成する。
The IF
リピート制御部653はリピート制御を行い、PC部224から比較器344の出力である命令フェッチアドレス(IAアドレス337の値)とRPTE(RPTEレジスタ343の値)との一致情報692と、1検出回路349の出力であるTRPTCレジスタ348の値が“1”であるかどうかの検出結果情報693を入力する。TRPビット654は制御レジスタCR0(PSW)のRPビット43に対応する情報を保持するリピート状態ビットである。最終的なリピート状態は実行ステージで管理されている。このTRPビット654は、パイプライン処理において命令フェッチ段階で先行更新するために保持する情報である。命令キュー212は、命令フェッチ部202から取り込まれた命令データを保持するバッファであり、2つの32ビット命令をキューイングすることができる。
The
Dステージ制御部661は、命令デコードステージの制御を行う。命令デコード部213内の命令レジスタ662は命令デコード中の命令を保持する。リピート命令は第1デコーダ214のみで処理される。デコーダ663はオペレーションコードのデコードを行う。リピート設定用判定部としても機能するdisp判定部664はリピート命令の変位値の値が“1”であるか、“2”であるか、“3”以上であるかという、所定の条件を満足するか否かを判定する判定動作を実行する。
The D
リピート時パイプライン制御手段の一部としても機能する制御信号生成部665は、デコーダ663、disp判定部664、命令レジスタ662や図示していないその他の部分からの入力に基づき命令の実行に必要な制御信号等を生成する。リピート命令開始時で、変位値が“2”以下の場合には、活性状態の命令フェッチ抑止信号681を所定の信号線を介して命令フェッチ要求生成部652に出力する。
The control
Eステージ制御部671は、命令実行ステージの制御を行う。Eステージ制御部671内のジャンプ制御部672はジャンプの制御を行い、ジャンプ処理を行う場合には活性状態のジャンプ信号684を所定の信号線を介してIFステージ制御部651、Dステージ制御部661に送り、パイプライン処理における前処理をキャンセルする。すなわち、ジャンプ制御部672はリピート時パイプライン制御手段の一部として機能する。
The E
リピート時パイプライン制御手段の一部としても機能するEステージ制御信号ラッチ673は実行ステージでの制御に必要な制御信号を保持するラッチである。Eステージ制御信号ラッチ673は、リピート命令の終了時で、変位値が“2”(第1の基準値)の場合には、REPI(2)のEステージにおいて、Eステージ制御信号ラッチ673に保持された活性状態の命令フェッチ抑止解除信号682を所定の信号線を介して命令フェッチ要求生成部652に送る。また、リピート命令の終了時のEステージで、変位値が“1”(第2の基準値,所定の基準値)の場合には、ジャンプを要求するジャンプ要求信号683を所定の信号線を介してジャンプ制御部672に送る。
An E stage
PSW部323内のRPビット675は制御レジスタCR0(PSW)のRPビット43を物理的に保持するラッチであり、特に明示的に示している。ジャンプが起こった場合には、パイプライン前処理をキャンセルするために、RPビット675の値がTRPビット654に転送され、再設定される。
The
次に、プログラム例をいくつか挙げ、本実施の形態のデータ処理装置による、リピート命令実行時、及び、ブロックリピート処理中の動作について詳細に説明する。 Next, some examples of the program will be described, and operations during execution of a repeat instruction and during block repeat processing by the data processing apparatus according to the present embodiment will be described in detail.
図18はリピート(対象)ブロックの命令数(この命令数に対応する総コードサイズが所定のコードサイズとなる)が3命令の場合のプログラム例を示す説明図である。実行する命令は、本発明の説明においてそれほど重要ではないので、IaやI1など簡略的な表記で示している。各命令は、1サイクルで処理を終了するロング命令、もしくは、並列実行する2命令の場合を想定している。コマンド行701〜703に示す命令Ia〜Icは、リピート関連の設定を規定するリピート設定命令であるREPI(リピート)命令704の前に実行される命令である。コマンド行705〜707に示す命令I1〜I3がリピートブロック命令であり、2回繰り返し実行する。コマンド708以降の命令I4等がリピートブロックに引き続く後続命令である。
FIG. 18 is an explanatory diagram showing a program example when the number of instructions in a repeat (target) block (the total code size corresponding to the number of instructions is a predetermined code size) is three instructions. The instruction to be executed is not so important in the description of the present invention, and is therefore indicated by a simple notation such as Ia or I1. Each instruction is assumed to be a long instruction that ends processing in one cycle or two instructions that are executed in parallel. Instructions Ia to Ic shown in the
図19は実施の形態1のデータ処理装置が図18で示したプログラムを実行する場合のリピート処理中のパイプライン処理を示すタイミング図である。同図では、内蔵命令メモリ203に格納された命令を実行する場合を示している。
FIG. 19 is a timing chart showing pipeline processing during repeat processing when the data processing apparatus of the first embodiment executes the program shown in FIG. In the figure, a case where an instruction stored in the
同図において、上の部分は各パイプラインステージの処理(IFステージ、Dステージ、Eステージ、M/E2ステージ)の様子を、下の部分はリピート処理に関係するレジスタの値や信号の値を示している。命令フェッチ要求は図17の命令フェッチ要求信号691の値を示す。IAは図31のIAレジスタ337、RPTEはRPTEレジスタ343、RPTSはRPTSレジスタ341、TRPTCはTRPTCレジスタ348、RPTCはRPTCレジスタ345、NPCはNPC331、EPCはEPC334の値をそれぞれ意味する。
In the figure, the upper part shows the processing of each pipeline stage (IF stage, D stage, E stage, M / E2 stage), and the lower part shows register values and signal values related to repeat processing. Show. The instruction fetch request indicates the value of the instruction fetch
“IA==RPT_E”は図13、図17で示した一致情報692、“TRPTC==1”は図13、図17で示した検出結果情報693を意味する。RPビットは図17で示したRPビット675、TRPビットは図17で示したRPビット654の値をそれぞれ意味する。なお、図19において、“H”,“L”が重複する期間(一部ハッチングで示す)は不定期間を意味する。また、“IA==RPT_E”,“TRPTC==1”における丸印は認識されるタイミングを意味する。
“IA == RPT_E” means the
リピート命令は、Dステージ402で2つのステップに分解され、Eステージ403で各々1サイクル、計2サイクルかけて実行される。図19では、2つのステップを“REPI(1)”、“REPI(2)”と示している。第1ステップ(REPI(1))でRPTEレジスタ343、RPTSレジスタ341を設定し、第2ステップ(REPI(2))でRPTCレジスタ345、TRPTCレジスタ348、RPビット675、TRPビット654を設定する。REPI命令のデコード時にdisp判定部664によってリピート命令の変位値が判定される。変位値が“3”以上の場合は、後で説明する“2”以下の場合の命令フェッチの一時停止制御(命令フェッチ抑止及び解除機能)や、Eステージでのジャンプ制御(パイプラインキャンセル機能)等は行われない。
The repeat instruction is decomposed into two steps in the
T3サイクルで、REPI命令の第1ステップ(REPI(1))の実行を行う。REPI命令704のアドレスを保持しているEPC334の値がS3バス253を介してAAラッチ302に、REPI命令のdispフィールド513の値が第1デコーダ214からABラッチ303に各々取り込まれ、ALU301で両者の値を加算することによりリピートブロックエンドアドレスであるI3命令のアドレスが計算され、加算結果がJAバス274を介してRPTEレジスタ343に書き込まれる。また、NPC331に保持されているリピートブロックの先頭命令であるI1命令のアドレスがラッチ332、D1バス261を介して、RPTSレジスタ341に書き込まれ、その後ラッチ342にも書き込まれる。
In the T3 cycle, the first step (REPI (1)) of the REPI instruction is executed. The value of the
T4サイクルで、REPI命令の第2ステップ(REPI(2))の実行を行う。AAラッチ302は“0”にする。REPI命令のimmフィールド512の値が第1デコーダ214からABラッチ303に取り込まれ、ALU301で“0”と加算し、加算結果がD1バス261を介してRPTCレジスタ345、TRPTCレジスタ348に書き込まれる。また、リピート処理中であることを示すRPビット675、TRPビット654が“1”にセットされる。T4サイクルで、REPI命令の実行に伴うリピート関連の設定が終了し、T5サイクル以降でフェッチされる命令に関して、リピートによる命令フェッチシーケンスの切り替えが可能になる。
In the T4 cycle, the second step (REPI (2)) of the REPI instruction is executed. The
本プログラム例では、リピート設定命令としてREPI命令を用いているが、繰り返し回数をレジスタ値で指定するREP命令の場合、レジスタ番号フィールド503で指定されるレジスタの値(繰り返し回数)がレジスタファイル221からS3バス253に読み出され、ABラッチ303に転送される点のみが異なる。
In this example program, the REPI instruction is used as a repeat setting instruction. However, in the case of a REP instruction that specifies the number of repetitions as a register value, the register value (the number of repetitions) specified in the
本データ処理装置は、2本の命令キューを備えているため、REPI命令デコード中にI1、I2命令のフェッチが行われるが、I1命令のデコード処理が開始されるT4までは命令キュー212はフル状態となっているため、I3命令の命令フェッチ要求は出力されない。従って、T4サイクルでI1命令のデコード処理が開始されることにより、命令キュー212のI1命令が格納されていた領域が空くため、T5サイクルでI3命令のフェッチが行われる。この処理例は、最も命令キューが詰まる場合の例を示している。すなわち、リピートブロックが3命令上の場合には、特にパイプライン処理の前段処理の状態を配慮することなく、ブロックリピート処理を開始できる。
Since this data processing apparatus has two instruction queues, the I1 and I2 instructions are fetched during the REPI instruction decoding, but the
次に、実行する命令とは無関係にハードウェア的に行われるリピート制御について説明する。実行する命令処理シーケンスの切り替えは、IFステージ401で行われる。TRPビット654が“1”の状態で、リピートによるシーケンス制御が行われる。TRP654が“1”の状態時に、IAレジスタ337内の命令フェッチアドレスとRPTEレジスタ343のリピートブロック最終命令のアドレスとが比較器344で比較される。また、TRPビット654が“1”の状態で、TRPTCレジスタ348の値が“1”であるかどうかが、1検出回路349でチェックされる。
Next, repeat control performed in hardware regardless of the instruction to be executed will be described. The instruction processing sequence to be executed is switched at the
TRPビット654が“1”で、かつ、TRPTCレジスタ348の値が“1”でない状態時に、IAレジスタ337の値がRPTEレジスタ343と一致した場合、リピートブロックの最終命令のフェッチであり、かつ、リピート継続であることを示しており、処理シーケンスを切り替え、次にリピートブロックの先頭アドレスの命令(I1)をフェッチする。すなわち、T5サイクルでリピートブロック最終命令(I3)をフェッチ後、T6サイクルでI1命令をフェッチする。T5サイクルでは、ラッチ342に保持されているI1命令のアドレス値が、JAバス274を介して、IAレジスタ337に転送され、命令フェッチアドレスとして使用される。TRPビット654が“1”の状態で、IAレジスタ337の値がRPTEレジスタ343と一致した場合、TRPTCレジスタ348の値が“1”だけデクリメントされる。すなわち、T5サイクルでTRPTCレジスタ348の値が1デクリメントされる。
If the value of the IA register 337 matches the
TRPビット654が“1”で、かつ、TRPTCレジスタ348の値が“1”の状態時に、IAレジスタ337の値がRPTEレジスタ343と一致した場合、リピート処理が終了することを示す。この場合、リピートブロックの命令は指定された回数の繰り返し処理を終えたことになるので、命令フェッチのシーケンス切り替えは行われず、次にリピートブロックの次の命令(I4)をフェッチする。すなわち、T8サイクルでI3命令をフェッチ後、T9サイクルでI4命令をフェッチする。この場合も、T8サイクルでTRPTCレジスタ348の値はデクリメントされる。また、リピート処理の命令フェッチ段階での処理終了に伴い、T8サイクルでTRPビット654は“0”にクリアされる。その後、シーケンシャルな命令フェッチを継続する。
When the
ブロックリピート処理中で命令フェッチアドレスがRPTEレジスタ343と一致した事を示すリピートブロック最終命令情報と、ブロックリピート処理中で命令フェッチアドレスがRPTEレジスタ343と一致し、かつ、更新前のTRPTCレジスタ348が“1”であった事を示すブロックリピート処理終了情報が、命令コードとともに保持、転送され、この情報に基づき以降のステージで命令非依存のブロックリピート処理に関するハードウェア制御が行われる。
Repeat block final instruction information indicating that the instruction fetch address matches the
リピート処理を継続するリピートブロック最終命令(I3)処理時には、Eステージ403での処理実行前のT6サイクルで、次に実行する命令のアドレスとしてリピートブロック先頭命令(I1)のアドレスがラッチ342からNPC331に書き込まれる。リピートブロック最終命令(I3)実行時のT7、T10サイクルでは、RPTCレジスタ345の値がデクリメントされる。また、リピート処理を終了するリピートブロック最終命令(I3)実行時でT10サイクルで、RPビット675がゼロクリアされる。
At the time of repeat block final instruction (I3) processing to continue the repeat process, the address of the repeat block head instruction (I1) is latched from the
このようにして、実行する命令とは独立にリピート制御を行うことにより、オーバーヘッドのない繰り返し処理を実現している。しかし、リピートブロックの命令数が“2”以下の場合、リピート制御のための各種判定が正しく行えるT4サイクルにはすでにリピートブロックの最終命令のフェッチが終了するタイミングとなるため、無条件に命令フェッチ部にフェッチされる構成の場合、正しいリピート制御が実現できない。以下、リピートブロックの命令数が2以下の場合の本データ処理装置の実行制御について説明する。 In this way, iterative processing without overhead is realized by performing repeat control independently of the instruction to be executed. However, when the number of instructions in the repeat block is “2” or less, the fetch of the last instruction in the repeat block is already completed in the T4 cycle in which various determinations for repeat control can be correctly performed. In the case of a configuration fetched by a part, correct repeat control cannot be realized. Hereinafter, execution control of the data processing apparatus when the number of instructions in the repeat block is 2 or less will be described.
図20はリピートブロックの命令数が2命令の場合のプログラム例を示す説明図である。図21は本実施の形態のデータ処理装置が図20で示したプログラムを実行する場合のリピート処理中のパイプライン処理を示すタイミング図である。図20に示すように、I1、I2の2命令がリピートブロックは2となり、これらの命令(I1,I2)が2回繰り返して実行される。 FIG. 20 is an explanatory diagram showing a program example when the number of instructions in the repeat block is two. FIG. 21 is a timing chart showing pipeline processing during repeat processing when the data processing apparatus of the present embodiment executes the program shown in FIG. As shown in FIG. 20, two instructions I1 and I2 are 2 repeat blocks, and these instructions (I1 and I2) are executed twice.
以下、図18、図19に示したプログラム処理例と異なる点に着目して説明を行う。なお、図21において、“H”,“L”が重複する期間(一部ハッチングで示す)は不定期間を意味する。また、“IA==RPT_E”,“TRPTC==1”における丸印は認識されるタイミングを意味する。 Hereinafter, the description will be made focusing on differences from the program processing examples shown in FIGS. In FIG. 21, a period in which “H” and “L” overlap (partially indicated by hatching) means an indefinite period. Further, the circles in “IA == RPT_E” and “TRPTC == 1” mean the recognition timing.
リピート命令のデコードを開始するT2サイクルの最初では、命令キューにREPI命令とI1命令の2命令が格納されているため、それ以前のパイプライン処理状態に依存せずI2命令のフェッチは開始されていない。T2サイクルでREPI命令のデコードを開始する。リピート命令のデコード時にはdisp判定部664でリピートブロックの最終命令を指定するための変位値(所定のコードサイズ)が判定され、“2”であることが判定される。 At the beginning of the T2 cycle where decoding of the repeat instruction is started, since the REPI instruction and the I1 instruction are stored in the instruction queue, the fetch of the I2 instruction is started regardless of the previous pipeline processing state. Absent. In the T2 cycle, decoding of the REPI instruction is started. At the time of decoding the repeat instruction, the disp determination unit 664 determines a displacement value (predetermined code size) for designating the last instruction of the repeat block, and determines that it is “2”.
実施の形態1のデータ処理装置では、REPI命令の第1ステップ(REPI(1))のデコード時に、disp判定部664が変位値が“2”以下と判定した場合、判定結果を受けた制御信号生成部665は、“H”(活性状態)の命令フェッチ抑止信号681を所定の信号線を通して命令フェッチ要求生成部652に送る。このとき、命令フェッチ抑止解除信号682に関する信号がEステージ制御信号ラッチ673に送られる。
In the data processing apparatus according to the first embodiment, when the disp determination unit 664 determines that the displacement value is “2” or less during decoding of the first step (REPI (1)) of the REPI instruction, the control signal that has received the determination result. The
IFステージ制御部651内の命令フェッチ要求生成部652は“H”の命令フェッチ抑止信号681を受けると命令のフェッチを一時停止する命令フェッチ抑止制御を開始し、命令フェッチ要求信号691のアサートを停止する。その後、“H”(活性状態)の命令フェッチ抑止解除信号682、あるいは“H”のジャンプ信号684を受けるまで、命令フェッチ抑止状態を維持する。
Upon receiving the “H” instruction fetch
そして、REPI命令の第2ステップ(REPI(2))を実行するT4サイクルで、REPI命令の設定が完了する。T4サイクルでは、Eステージ制御信号ラッチ673から“H”の命令フェッチ抑止解除信号682が所定の信号線を介して命令フェッチ要求生成部652に送られる。IFステージ制御部651は、“H”の命令フェッチ抑止解除信号682に応答して、命令フェッチ抑止状態を解除し、T4サイクルでI2命令のフェッチ要求出力を行い、続くT5サイクルでI2命令のフェッチを行う。
Then, the setting of the REPI instruction is completed in the T4 cycle in which the second step (REPI (2)) of the REPI instruction is executed. In the T4 cycle, an “H” instruction fetch
このように、リピート設定命令(REPI)の設定が完了するまで、命令フェッチを一時停止する命令フェッチ抑止状態を設けることにより、I2命令のフェッチから命令フェッチ段階でのリピート関連の判定や制御が正しく行われることを保証する。 In this way, by providing an instruction fetch suppression state in which instruction fetch is temporarily stopped until the setting of the repeat setting instruction (REPI) is completed, repeat-related determination and control from the I2 instruction fetch to the instruction fetch stage are correctly performed. Guarantee that it will be done.
ただし、実施の形態1では、命令フェッチを一時停止することにより、図21の処理例の場合、I2命令の実行が開始されるまでに1クロックサイクルのオーバーヘッドを生じる。ただし、このオーバーヘッドは最初の1回目の実行に関してのみ生じるが、その後の繰り返し処理に関してはオーバーヘッドを生じない。また、パイプラインの状態によっては、オーバーヘッドを生じない場合もある。例えば、I1命令がシーケンシャル実行を行うショートサブ命令を2命令含む場合、I1命令の実行に2サイクルを要するため、オーバーヘッドは生じない。 However, in the first embodiment, by temporarily stopping the instruction fetch, in the case of the processing example of FIG. 21, an overhead of one clock cycle is generated before the execution of the I2 instruction is started. However, this overhead occurs only for the first execution of the first time, but no overhead occurs for the subsequent repetitive processing. Also, depending on the state of the pipeline, there may be no overhead. For example, when the I1 instruction includes two short sub-instructions that perform sequential execution, overhead is not generated because two cycles are required to execute the I1 instruction.
このようにリピート命令処理時に命令フェッチの一時停止制御を行うことにより、リピートブロックの命令数が2命令の場合も、低オーバーヘッドでリピート処理を実現できる。 By performing instruction fetch suspension control during repeat instruction processing in this manner, even when the number of instructions in a repeat block is two, repeat processing can be realized with low overhead.
すなわち、実施の形態1のデータ処理装置は、リピートブロックの命令数(所定のコードサイズ)が“2”(第1の基準値)以下である場合であっても、disp判定部664の判定動作によって上記命令数が“2”以下であることの判定時からリピート設定命令に規定したリピート関連の設定動作が終了するまでの期間、パイプライン処理対象の命令のフェッチを停止することにより、オーバーヘッドを最小限に抑えながら正常なリピート動作を実行することができる。 In other words, the data processing apparatus according to the first embodiment performs the determination operation of the disp determination unit 664 even when the number of repeat block instructions (predetermined code size) is “2” (first reference value) or less. By stopping the fetching of instructions subject to pipeline processing during the period from when it is determined that the number of instructions is “2” or less until the repeat-related setting operation specified in the repeat setting instruction is completed, overhead is reduced. Normal repeat operation can be executed while minimizing.
図22はリピートブロックの命令数が1命令の場合のプログラム例を示す説明図である。図23は本実施の形態のデータ処理装置が図22で示したプログラムを実行する場合のリピート処理中のパイプライン処理を示すタイミング図である。図22に示すように、I1命令のみがリピートブロックとなり、2回繰り返し実行される。以下、図18、図19に示したプログラム処理例と異なる点に着目して説明を行う。なお、図23において、“H”,“L”が重複する期間(一部ハッチングで示す)は不定期間を意味する。また、“IA==RPT_E”,“TRPTC==1”における丸印は認識されるタイミングを意味する。 FIG. 22 is an explanatory diagram showing a program example when the number of instructions in the repeat block is one. FIG. 23 is a timing chart showing pipeline processing during repeat processing when the data processing apparatus of the present embodiment executes the program shown in FIG. As shown in FIG. 22, only the I1 instruction becomes a repeat block and is repeatedly executed twice. Hereinafter, the description will be made focusing on differences from the program processing examples shown in FIGS. In FIG. 23, a period in which “H” and “L” overlap (partially indicated by hatching) means an indefinite period. Further, the circles in “IA == RPT_E” and “TRPTC == 1” mean the recognition timing.
リピート命令のデコードを開始するT2サイクルの最初では、リピート関連の設定が始まっていない状態ですでにI1命令のフェッチが完了しているため、そのまま継続して処理を続けても現状のハードウェア構成では正しい処理が行えない。以下、その理由について説明する。 At the beginning of the T2 cycle where decoding of the repeat instruction is started, since the fetch of the I1 instruction has already been completed in a state where the setting related to repeat has not started, the current hardware configuration is continued even if processing is continued as it is Then, correct processing cannot be performed. The reason will be described below.
本実施の形態相当のデータ処理装置では、命令フェッチ要求の出力サイクルの後半からリピート関連の判定を行う。すなわち、I1命令のフェッチ要求を出力するT1サイクルの後半から、アドレスの一致判定やカウント値の判定を行うことになる。 In the data processing apparatus corresponding to the present embodiment, the repeat-related determination is performed from the second half of the output cycle of the instruction fetch request. That is, address match determination and count value determination are performed from the latter half of the T1 cycle in which a fetch request for the I1 instruction is output.
ところが、その判定に必要なリピート関連の制御レジスタ等の設定は、リピート命令を実行するT3、T4サイクルで行われる。したがって、T1サイクルでは正しい判定を行うことができず、T2サイクルでのI1命令のフェッチ後、リピート処理により次にI1命令をフェッチするという判断も行えない。本来、最初のI1命令のフェッチに伴い、T2サイクルで行うべきTRPTCのデクリメント処理等も行えない。このように、正しいリピート関連の処理が行えないため、後続命令の正常な動作が保証できない。 However, the setting of repeat-related control registers and the like necessary for the determination is performed in the T3 and T4 cycles for executing the repeat instruction. Therefore, a correct determination cannot be made in the T1 cycle, and it cannot be determined that the I1 instruction is fetched next by repeat processing after the I1 instruction is fetched in the T2 cycle. Originally, the TRPTC decrement processing that should be performed in the T2 cycle cannot be performed with the fetch of the first I1 instruction. Thus, since correct repeat-related processing cannot be performed, normal operation of subsequent instructions cannot be guaranteed.
そこで、実施の形態1におけるデータ処理装置は、リピートブロックが1命令の場合は、リピート関連の設定終了後、パイプラインの前処理をキャンセルし、1回目のI1命令のフェッチから処理をやり直すように構成している。 Therefore, when the repeat block has one instruction, the data processing apparatus according to the first embodiment cancels the pipeline pre-processing after the repeat-related setting is completed, and repeats the processing from the first fetch of the I1 instruction. It is composed.
T2サイクルでREPI命令のデコードを開始する。リピート命令のデコード時にはdisp判定部664でリピートブロックの最終命令を指定するための変位値(所定のコードサイズ)が判定され、“1”であることが判定される。REPI命令の第1ステップ(REPI(1))のデコード時に、変位値が“2”以下の場合、前述したように、制御信号生成部665から、“H”の命令フェッチ抑止解除信号682が所定の信号線を通して命令フェッチ要求生成部652に送られる。このとき、ジャンプ要求信号683に関連する情報がEステージ制御信号ラッチ673にラッチされる。
In the T2 cycle, decoding of the REPI instruction is started. At the time of decoding the repeat instruction, the disp determination unit 664 determines a displacement value (predetermined code size) for designating the last instruction of the repeat block, and determines that it is “1”. When the displacement value is “2” or less at the time of decoding of the first step (REPI (1)) of the REPI instruction, as described above, the “H” instruction fetch
IFステージ制御部651は“H”の命令フェッチ抑止解除信号682に応答して、命令フェッチ抑止状態となる。したがって、IFステージ制御部651は、その後に“H”の命令フェッチ抑止解除信号を受けるか、“H”のジャンプ信号684を受けるまで、命令のフェッチを一時停止する。
The IF
なお、リピートブロックが1命令の場合、“H”のジャンプ信号684によってパイプライン処理をキャンセルすることになるため、命令フェッチを停止することは必須ではないが、なるべく不要な命令フェッチを行わないように命令フェッチを停止する制御を行っている。
When the repeat block is one instruction, the pipeline processing is canceled by the “H”
T4サイクルで、REPI命令の第2ステップ(REPI(2))の実行を行う。REPI命令の第2ステップの処理時に、リピートブロックの命令数が“3”命令以上の場合の処理に加え、リピートブロックの先頭命令へのジャンプ処理を行う。このとき、Eステージ制御信号ラッチ673からジャンプ要求を指示するジャンプ要求信号683がEステージ制御部671内のジャンプ制御部672に送られる。
In the T4 cycle, the second step (REPI (2)) of the REPI instruction is executed. During the processing of the second step of the REPI instruction, in addition to the processing when the number of instructions in the repeat block is “3” or more, jump processing to the head instruction of the repeat block is performed. At this time, a jump request signal 683 for instructing a jump request is sent from the E stage
その結果、リピートブロックの先頭命令であるI1の命令アドレスが、NPC331からラッチ332、JAバス274を介してIAレジスタ337に転送されるとともに、ジャンプ制御部672からH”のジャンプ信号684がIFステージ制御部651及び命令フェッチ要求生成部652に送られ、“H”のジャンプ信号684を受けたIFステージ制御部651及びDステージ制御部661はそれぞれパイプライン処理の前段処理をキャンセルする。
As a result, the instruction address of I1, which is the first instruction of the repeat block, is transferred from the
このように、IFステージ制御部651は、フェッチが完了しているI1命令のフェッチをやり直すことにより、リピート命令の設定後I1命令のフェッチが行われるようになり、正しいリピート制御が行われる。
As described above, the IF
ただし、この場合パイプラインの前段処理をキャンセルするので、図23の処理例の場合、I1命令の実行が開始されるまでに2クロックサイクルのオーバーヘッドを生じる。ただし、このオーバーヘッドは最初の1回目の実行に関してのみ生じるが、その後の繰り返し処理に関してはオーバーヘッドを生じない。 However, in this case, since the pre-stage processing of the pipeline is canceled, in the case of the processing example of FIG. 23, an overhead of 2 clock cycles is generated before the execution of the I1 instruction is started. However, this overhead occurs only for the first execution of the first time, but no overhead occurs for the subsequent repetitive processing.
このように、実施の形態1のデータ処理装置は、リピート設定命令の設定処理完了時にジャンプ処理を行うパイプラインキャンセル機能を有することにより、リピートブロックの命令数が1命令の場合も、リピート処理を実現できる。 As described above, the data processing apparatus according to the first embodiment has the pipeline cancel function that performs the jump process when the setting process of the repeat setting instruction is completed, so that the repeat process can be performed even when the number of instructions in the repeat block is one instruction. realizable.
すなわち、実施の形態1のデータ処理装置は、上記パイプラインキャンセル機能により、リピートブロックの命令数(所定のコードサイズ)が“1”(第2の基準値)である場合であっても、オーバーヘッドを最小限に抑えながら正常なリピート動作を実行することができる。 In other words, the data processing apparatus according to the first embodiment uses the pipeline cancel function, even if the number of repeat block instructions (predetermined code size) is “1” (second reference value). Normal repeat operation can be executed while minimizing the error.
上述のように、実施の形態1よるデータ処理装置は、リピート命令処理時に命令フェッチを一時停止する命令フェッチ抑止及び解除機能と、ジャンプ処理によりパイプライン処理の前段処理をキャンセルするパイプラインキャンセル機能とを有することにより、リピート命令の繰り返し対象ブロックのサイズが小さい場合にも正常動作を保証できるようになる。 As described above, the data processing apparatus according to the first embodiment includes an instruction fetch suppression and release function that temporarily stops instruction fetching during repeat instruction processing, and a pipeline cancel function that cancels the previous stage processing of pipeline processing by jump processing. Thus, normal operation can be ensured even when the size of the repeat target block of the repeat instruction is small.
その結果、プログラム作成に際して、リピート命令で実行できるリピートブロックのサイズに制限がなくなるため、不必要にループ処理を展開する必要もなく、繰り返し回数がダイナミックに変化する場合も含めリピート命令で対処できない端数処理を行う部分が単純化でき、コードサイズも処理サイクル数も削減できるという効果を奏する。 As a result, there is no limit on the size of repeat blocks that can be executed with repeat instructions when creating a program, so there is no need to unnecessarily expand loop processing, and fractions that cannot be handled with repeat instructions even when the number of repetitions changes dynamically The processing portion can be simplified, and the code size and the number of processing cycles can be reduced.
特にディジタル信号処理においては繰り返し処理の占める割合が非常に多く、繰り返し処理のコードサイズの削減は有効である。また、プログラムをROM化する場合には、プログラムのコード効率がチップサイズに直接影響を及ぼすため、コスト削減にも大きく寄与する。 In particular, in digital signal processing, the ratio of repetitive processing is very large, and it is effective to reduce the code size of repetitive processing. In addition, when the program is implemented in ROM, the code efficiency of the program directly affects the chip size, which greatly contributes to cost reduction.
このように、実施の形態1のデータ処理装置では、命令フェッチ抑止及び解除機能並びにパイプラインキャンセル機能を有することにより、リピート設定命令の第1ステップ(REPI(1))のDステージ402から命令フェッチを一時停止したり、リピート設定命令の第2ステップ(REPI(2))のEステージ403で命令フェッチの抑止解除あるいはジャンプ処理によりパイプライン処理の前段処理をキャンセルすることにより、コード効率のよい高性能、低消費電力で低コストなデータ処理装置を得ることができる。また、プログラム自体も単純になるため、プログラム開発の生産性が上がるとともに、バグの混入を低減できるという効果もある。
As described above, the data processing apparatus according to the first embodiment has the instruction fetch suppression and release function and the pipeline cancel function, so that the instruction fetch from the
上述した実施の形態1におけるデータ処理装置の構成例は、あくまでも一構成例を示したものであり、本発明の適用範囲を限定するものではない。基本的に、ハードウェアリピート機能を備えた、パイプライン処理を行うデータ処理装置であれば、どのようなものに本発明を適用しても同様の効果がある。上述の実施の形態に示した構成に限定されるものではない。 The above-described configuration example of the data processing apparatus according to the first embodiment is merely an example of the configuration, and does not limit the application range of the present invention. Basically, the present invention can be applied to any data processing apparatus having a hardware repeat function and performing pipeline processing. It is not limited to the configuration shown in the above embodiment.
上記実施の形態では、VLIWプロセッサに対して本発明の技術を適用した例を示しているが、RISCプロセッサ、CISCプロセッサやDSP等、基本的にどのようなアーキテクチャのデータ処理装置に関しても適用可能である。また、可変長命令セットアーキテクチャのプロセッサに適用してもよい。ただし、可変長命令セットを処理する場合は、整置を配慮する必要があり、制御は多少複雑になる。また、可変長命令セットを処理する場合は、命令数とコードサイズが1対1に対応しないため、リピートブロックのコードサイズで処理内容の判定を行うように制御する必要がある。 In the above embodiment, an example in which the technology of the present invention is applied to a VLIW processor is shown. However, the present invention can be applied to a data processing apparatus of basically any architecture such as a RISC processor, a CISC processor, or a DSP. is there. Further, the present invention may be applied to a processor having a variable length instruction set architecture. However, when processing a variable length instruction set, it is necessary to consider alignment, and the control is somewhat complicated. Also, when processing a variable length instruction set, the number of instructions and code size do not correspond one-to-one, so it is necessary to perform control so that the processing content is determined by the code size of the repeat block.
上記実施の形態では、命令フェッチ抑止信号681及び命令フェッチ抑止解除信号682に基づく命令フェッチ抑止及び解除機能とジャンプ信号684に基づくパイプラインキャンセル機能を共に実装した例を示しているが、各々の機能を単独で実装してもよい。例えば、上記パイプラインキャンセル機能のみを実装し、リピート命令の設定終了時における“H”のジャンプ信号684に基づくパイプラインキャンセルのみを行うように構成し、リピートブロックの命令が2命令以下の場合は常に上述したジャンプ処理を行うようにしてもよい。
In the above embodiment, an example is shown in which both the instruction fetch suppression and release function based on the instruction fetch
また、上記命令フェッチ抑止及び解除機能のみを実装し、リピートブロックの命令が2命令の場合には対処するが、リピートブロックの命令が1命令の場合は動作保証しないようにし構成してもよい。ただし、このように、上記命令フェッチ抑止及び解除機能並びに上記パイプラインキャンセル機能のうちの一方を単独で実装した場合、効果が小さくなったり、制限が増えたりするが、その点は設計時に開発コストと性能のトレードオフを考慮して判断すればよいことである。 Further, only the instruction fetch suppression and release function described above may be implemented to cope with the case where the repeat block instruction is two instructions, but the operation may not be guaranteed when the repeat block instruction is one instruction. However, when one of the instruction fetch suppression / cancellation function and the pipeline cancel function is implemented alone as described above, the effect is reduced or the restriction is increased. Judging from the trade-off between performance and performance.
また、実施の形態1では、簡単のため比較的浅いパイプラインで、命令キューが2本の単純な例を示しているが、上記実施の形態と異なるパイプライン処理構成のものに適用しても良い。高性能化のため、パイプライン1段の処理量は小さくして処理段数を増やすという狭ピッチパイプライン化によりリピート関連の設定を行うステージまでのパイプライン段数が多い場合や、命令キューのエントリ数が多い場合は、リピート関連の設定が完了するまでに取り込まれる命令数の最大値が大きくなり、対処を行わない場合に保証できるリピートブロックのサイズが増大するため、本発明の技術は特に有効である。 In the first embodiment, a simple example with a relatively shallow pipeline and two instruction queues is shown for the sake of simplicity. However, the first embodiment may be applied to a pipeline processing configuration different from that of the first embodiment. good. For high performance, if the number of pipeline stages to the stage where repeat-related settings are made by narrow-pitch pipeline that reduces the processing amount of one stage of pipeline and increases the number of processing stages, or the number of entries in the instruction queue When there is a large number of instructions, the maximum number of instructions fetched until the completion of repeat-related settings increases, and the size of the repeat block that can be guaranteed when no action is taken increases, so the technique of the present invention is particularly effective. is there.
実施の形態1では、1レベルのみリピート機能を実装した例を示したが、入れ子構造の複数レベルのリピートを実装している場合にも適用可能である。 In the first embodiment, an example in which the repeat function is implemented only at one level has been described. However, the present invention can be applied to a case where multiple levels of repeats are implemented.
また、条件分岐の分岐/非分岐両方向の複数の処理シーケンスの命令フェッチを行っておくような構成の場合でも、本発明は適用可能である。以下、この点について詳述する。高性能なプロセッサでは、条件分岐命令処理時の分岐ペナルティ(分岐によりパイプラインキャンセルが起こった場合に、分岐先命令のフェッチから実行に至るまでのEステージアイドルサイクル)を削減するために、分岐/非分岐の両方のシーケンスの命令をフェッチするような機能を実装するものがある(さらに3つ以上の場合もある)。そのような場合でも、リピート命令処理(命令デコード/実行)時に処理しているリピート命令が含まれるシーケンスの命令に関して、本実施の形態と同じ処理を行えばよい。すなわち、複数の処理シーケンスの命令フェッチを行っておくような構成の場合でも、各々1つの処理シーケンスに着目すれば同じ処理を行えばよいことになる。 The present invention can also be applied to a configuration in which instruction fetches of a plurality of processing sequences in both branch / non-branch directions of conditional branches are performed. Hereinafter, this point will be described in detail. In a high-performance processor, branch / penalty during conditional branch instruction processing (E stage idle cycle from fetch to execution of branch destination instruction when pipeline cancellation occurs due to branch) is reduced. Some implement functions that fetch both non-branch sequences of instructions (and may have more than two). Even in such a case, the same processing as in the present embodiment may be performed with respect to an instruction of a sequence including a repeat instruction being processed during repeat instruction processing (instruction decoding / execution). That is, even in the case of a configuration in which instruction fetches of a plurality of processing sequences are performed, the same processing may be performed if attention is paid to each processing sequence.
上記実施の形態では、リピート命令の実行を2サイクルかけて行っているが、1サイクルで行ってもよいし、3サイクル以上かけてもよい。また、上記実施の形態では、リピート命令実行後にジャンプを行う場合、第2ステップ(REPI(2))が実行される2サイクル目でジャンプ処理を行っているが、第3ステップを追加し、第3ステップでジャンプ処理を行うようにしてもよい。ジャンプ処理のタイミングは、命令フェッチ段階で正しいシーケンス制御が保証できるタイミング以降なら任意のタイミングで行ってもよい。例えば、リピート命令処理時にリピート関連の設定を実行ステージ以前に行う場合は、リピート関連の設定タイミングに応じてより早くリピート設定命令以降のパイプラインキャンセル(ジャンプ処理)を行っても問題ない。 In the above embodiment, the repeat instruction is executed over two cycles, but it may be executed in one cycle or over three cycles. In the above embodiment, when a jump is performed after execution of a repeat instruction, the jump process is performed in the second cycle in which the second step (REPI (2)) is executed. The jump process may be performed in three steps. The timing of the jump processing may be performed at any timing as long as it is after the timing at which correct sequence control can be guaranteed at the instruction fetch stage. For example, when the repeat-related setting is performed before the execution stage during the repeat instruction processing, there is no problem even if the pipeline cancel (jump processing) after the repeat setting instruction is performed earlier according to the repeat-related setting timing.
実施の形態1では、命令フェッチの抑止解除をリピート命令の実行の最終ステップの実行時に行っているが、ハードウェア的に動作が保証できるタイミングであれば、それ以降のどのタイミングで行ってもよい。例えば、リピート命令処理時にリピート関連の設定を実行ステージ以前に行う場合は、リピート関連の設定タイミングに応じてより早く命令フェッチの抑止解除を行っても問題ない。 In the first embodiment, the cancellation of instruction fetch suppression is performed at the time of execution of the final step of execution of a repeat instruction, but may be performed at any subsequent timing as long as the operation can be guaranteed in hardware. . For example, if repeat-related settings are made before the execution stage during repeat instruction processing, there is no problem even if instruction fetch suppression is canceled earlier according to the repeat-related setting timing.
実施の形態1では、ジャンプ処理によりパイプラインの前段処理をキャンセルする場合も命令のフェッチ抑止を行っているが、命令フェッチの抑止を行わなくてもよい。ただし、命令フェッチの抑止を行っておく方が無駄な命令のフェッチを抑えることが可能であり、ジャンプ処理時に命令フェッチ要求がすぐに受け付け可能な状態となる。なお、命令フェッチに複数サイクルがかかる場合など、ジャンプ要求がすぐに受け付けられない場合がある。この場合はフェッチ動作を止めれば命令フェッチがすぐに受け付けられるようになる。 In the first embodiment, instruction fetch suppression is performed even when the upstream processing of the pipeline is canceled by jump processing, but instruction fetch suppression may not be performed. However, it is possible to suppress fetching of useless instructions by suppressing instruction fetch, and an instruction fetch request can be immediately accepted during jump processing. In some cases, such as when an instruction fetch takes multiple cycles, a jump request may not be accepted immediately. In this case, if the fetch operation is stopped, the instruction fetch can be accepted immediately.
実施の形態1では、リピート関連の設定/リピート処理の起動を1つのリピート命令で全て行うようにしているが、複数の命令で設定/起動を行うようにしてもよいし、各設定値について異なる指定方法を採ってもかまわない。基本的に、どのような命令仕様や制御レジスタのハードウェア仕様であっても、リピート関連の最後の設定を行う命令の処理時に、その命令からリピート機能により処理シーケンスを切り替えるための判定に使用される命令フェッチアドレスの命令までのコードサイズ情報を判定するための手段を設け、パイプライン処理を考慮して、正しく動作保証できるように、上述した命令フェッチ抑止及び解除機能やパイプラインキャンセル機能を備えればよい。 In the first embodiment, the start of repeat-related setting / repeat processing is all performed with one repeat command. However, setting / startup may be performed with a plurality of commands, and each setting value is different. You can use the designation method. Basically, whatever instruction specifications and control register hardware specifications are used for the determination to switch the processing sequence from the instruction by the repeat function when processing the instruction for the last setting related to repeat. In order to ensure correct operation in consideration of pipeline processing, the above-mentioned instruction fetch suppression and release function and pipeline cancel function are provided. Just do it.
例えば、繰り返し回数は別命令で予め設定するようにしても、上記命令フェッチ抑止及び解除機能や上記パイプラインキャンセル機能の実行制御等のリピート命令の制御方法の判定に繰り返し回数は影響しないので、上記実施の形態と同様に制御できる。また、上記実施の形態では、繰り返し回数としてリピートブロックの実行回数を指定するようになっているが、繰り返し回数を“繰り返し回数−1”で設定し管理するなど、上記実施の形態と異なる命令仕様であってもかまわない。この場合、上記実施の形態ではリピートの終了のためカウント値が“1”であることを判定しているが、その代わりに“0”であることを判定すればよい。 For example, even if the number of repetitions is set in advance by another instruction, the number of repetitions does not affect the determination of the repeat instruction control method such as the execution control of the instruction fetch suppression and release function and the pipeline cancel function. Control can be performed in the same manner as in the embodiment. In the above embodiment, the repeat block execution count is specified as the repeat count. However, an instruction specification different from the above embodiment, such as setting and managing the repeat count as “repetition count−1”, is used. It doesn't matter. In this case, in the above-described embodiment, it is determined that the count value is “1” for the end of repeat, but instead, it may be determined that it is “0”.
また実施の形態1では、リピート命令はリピートブロックの直前で実行するようにしており、リピートブロックの先頭命令はリピート命令の次命令であることが暗黙で指定されている。例えば、リピートブロックの開始命令をリピート命令で明示的に指定、あるいは、暗黙的に数命令先に指定したり、予め別命令で指定しておくようにしてもよい。リピート命令とリピートブロックの最終命令までのコード量を判定するのにリピートブロックの先頭命令がどこであるかは、関連しない。 In the first embodiment, the repeat instruction is executed immediately before the repeat block, and it is implicitly specified that the head instruction of the repeat block is the next instruction of the repeat instruction. For example, the repeat block start instruction may be explicitly specified by a repeat instruction, may be implicitly specified by several instructions, or may be specified in advance by another instruction. The determination of the code amount from the repeat instruction to the last instruction of the repeat block is irrelevant as to where the start instruction of the repeat block is.
また実施の形態1では、リピートブロックの最終命令をリピート命令からの変位値で指定している。リピートブロックの開始命令や最終命令を変位値でなく絶対アドレスで指定してもよいし、リピートブロックの最終命令をリピート命令の次命令からの変位値等で指定してもよい。さらに、リピートブロックの最終命令のアドレス情報として、リピートブロックの最終命令の次命令への変位値で指定するようにしておくような命令仕様であってもかまわない。この場合、内部ハードウェア的にリピートブロックの最終命令のアドレスを計算、管理してもよいし、アドレス比較を行うタイミングを早め、フェッチアドレスとリピートブロックの最終命令の次命令アドレスと比較し、一致したらその命令のフェッチを行わずリピートブロックの先頭命令のアドレスの命令フェッチを行うようにすればよい。 In the first embodiment, the last instruction of the repeat block is designated by a displacement value from the repeat instruction. The repeat block start instruction and final instruction may be specified by an absolute address instead of the displacement value, or the repeat block final instruction may be specified by a displacement value from the instruction next to the repeat instruction. Furthermore, the address specification of the last instruction of the repeat block may be an instruction specification that is designated by a displacement value to the next instruction of the last instruction of the repeat block. In this case, the address of the last instruction of the repeat block may be calculated and managed by internal hardware, or the timing of address comparison is advanced, and the fetch address is compared with the next instruction address of the last instruction of the repeat block. Then, it is only necessary to fetch the instruction at the address of the first instruction of the repeat block without fetching the instruction.
また、リピートブロックの最終命令のアドレスが絶対アドレスで指定される場合、リピート命令のアドレスとリピートブロックの最終命令のアドレスの差分をとれば、リピートブロックの最終命令までのコードサイズ情報を判定できる。 Further, when the address of the last instruction of the repeat block is designated by an absolute address, the code size information up to the last instruction of the repeat block can be determined by taking the difference between the address of the repeat instruction and the address of the last instruction of the repeat block.
また、リピートブロックの最終命令のアドレスが予め別命令で設定が行われている場合には、既に設定が終わっているレジスタ等の値を参照して、リピートブロックの最終命令までのコードサイズを判定すればよい。 Also, if the address of the last instruction of the repeat block has been set in advance by another instruction, the code size up to the last instruction of the repeat block is determined by referring to the values of registers that have already been set. do it.
実施の形態1では、リピートブロックの最終命令フェッチ時にリピート関連の判定を行うようにしているが、早いタイミングで判定を行うため、リピートブロックの最終命令の1つ前の命令アドレスをハードウェア的に保持するようにしておき、そのアドレスとフェッチアドレスを比較を行うようにしてもよい。 In the first embodiment, the repeat-related determination is performed at the time of fetching the final instruction of the repeat block. However, in order to perform the determination at an early timing, the instruction address immediately before the final instruction of the repeat block is implemented in hardware. The address may be held, and the address and the fetch address may be compared.
また、フェッチ時に準備段階の次にフェッチする命令アドレス(例えばインクリメンタ339の出力)と比較するようにしてもよい。また、リピートブロックの最終命令のフェッチが受け付けられた後でもシーケンス制御の切り替えが正しく行えるハードウェア構成をとっているのであれば、それを配慮してリピートブロックのサイズを判定すればよい。以下、この点について詳述する。 Further, it may be compared with an instruction address (for example, an output of the incrementer 339) fetched after the preparation stage at the time of fetching. If the hardware configuration is such that the sequence control can be correctly switched even after the fetch of the last instruction of the repeat block is accepted, the size of the repeat block may be determined in consideration of this. Hereinafter, this point will be described in detail.
実施の形態1では、命令フェッチの要求出力時に判定を開始し、命令フェッチ中にTRPTCやTRPビットの更新を行うようにしている。したがって、図23で示した例ではI1の命令フェッチ(T2サイクル)がリピート関連の設定(T4サイクル)の前に終わっているため対処できなくなっている。 In the first embodiment, determination is started when an instruction fetch request is output, and the TRPTC and TRP bits are updated during instruction fetch. Therefore, in the example shown in FIG. 23, the instruction fetch of I1 (T2 cycle) is completed before the setting related to repeat (T4 cycle), so that it cannot be dealt with.
しかし、この場合、T4サイクルではI2の命令フェッチをまだ開始していないので、直前に命令フェッチしたI1のアドレスを別途保持しておき、リピート関連の設定が完了し正しい判定が可能となるT4サイクルで、別途保持しているアドレスとの判定を行い、T5サイクルでの処理シーケンスの切り替えやTRPTCやTRPビットの更新を行うことが可能となるようなハードウェア構成をとれば、T4サイクルでデコードしたI1命令をT5サイクルで実行することができるため、1サイクルアイドル期間を削減できる。したがって、リピートブロックの命令数が“1”の場合でも、命令数が“2”の場合と同様、命令フェッチ抑止及び解除機能により正常動作可能となり、パイプラインキャンセル機能は不要となる。上記した例に限らず、いずれの場合においても、正しく動作保証できるように、命令フェッチ抑止及び解除機能やパイプラインキャンセル機能を備えれば良い。 However, in this case, since the instruction fetch of I2 has not yet started in the T4 cycle, the address of the instruction I1 fetched immediately before is separately held, the repeat-related setting is completed, and the correct determination is possible. Then, if it is determined that the address is separately held, and the hardware configuration is such that the processing sequence can be switched and the TRPTC and TRP bits can be updated in the T5 cycle, decoding is performed in the T4 cycle. Since the I1 instruction can be executed in the T5 cycle, one cycle idle period can be reduced. Accordingly, even when the number of instructions in the repeat block is “1”, as in the case where the number of instructions is “2”, normal operation is possible by the instruction fetch suppression and release function, and the pipeline cancel function is not necessary. The present invention is not limited to the above example, and in any case, an instruction fetch suppression and release function and a pipeline cancel function may be provided so that correct operation can be guaranteed.
実施の形態1では、共にリピート設定命令の命令デコード段階で命令のフェッチ抑止制御を行っているが、命令フェッチ完了直後に取り込まれた命令のプリデコードを行い実施の形態1で行っていたリピート命令の命令フェッチ抑止制御をより早い段階で行うようにしてもよい。命令デコードステージまでのパイプライン段数が深く、命令キューのエントリ数が多くなると、リピート命令のフェッチ完了後、リピート命令の実行がすぐに行えない場合もあるが、命令フェッチ完了直後にリピート処理のための命令フェッチ抑止制御を行うことにより、パイプラインキャンセル処理を必要とするリピートブロック数を削減することができるため、さらなる性能向上を実現できる。また、命令フェッチ抑止及び解除に関する制御は行わず、単に動作保証できない場合にパイプラインキャンセル機能を実行するハードウェア構成の場合は、命令の実行段階でリピートブロックのサイズに関する判定を行ってもかまわない。このように、どの段階でリピート命令に関する処理内容の判定を行ってもかまわない。 In the first embodiment, instruction fetch suppression control is performed at the instruction decode stage of the repeat setting instruction, but the repeat instruction used in the first embodiment is performed by predecoding the instruction fetched immediately after the instruction fetch is completed. This instruction fetch suppression control may be performed at an earlier stage. If the number of pipeline stages to the instruction decode stage is deep and the number of entries in the instruction queue is large, the repeat instruction may not be executed immediately after the repeat instruction fetch is completed. By performing the instruction fetch suppression control, it is possible to reduce the number of repeat blocks that require pipeline cancel processing, and thus further improve performance. In addition, control regarding instruction fetch suppression and release is not performed, and if the hardware configuration simply executes the pipeline cancel function when operation cannot be guaranteed, determination regarding the size of the repeat block may be performed at the instruction execution stage. . In this way, the processing content regarding the repeat instruction may be determined at any stage.
<実施の形態2>
上述の実施の形態1では、リピートブロックの命令数の判定結果のみで、リピート命令の処理方法を決定している。上述の実施の形態1のように、命令キューのエントリ数も少なく比較的パイプライン段数が浅い場合には、制御が単純であり制御の複雑さを含む開発コストと製品コスト等の効果のトレードオフのバランスがよい。
<
In the first embodiment described above, the repeat instruction processing method is determined only by the determination result of the number of instructions in the repeat block. When the number of instruction queue entries is small and the number of pipeline stages is relatively small as in the first embodiment, the control is simple and the trade-off between effects such as development cost and product cost including control complexity is simple. Is well balanced.
しかし、パイプライン段数が多い場合や、命令キューのエントリ数が多い場合は、命令デコード時までにパイプライン処理を行う最大命令数に対応して、リピートブロックの命令数の判定結果のみでリピート命令の処理方法を決定すると、性能的にオーバーヘッドが大きくなる場合がある。このような場合は、リピートブロックの命令数の判定結果のみではなく、命令キューに取り込まれている命令数、すなわち、命令フェッチ段階後、命令デコード段階前のデコード待機状態の命令数の判定も行い、ダイナミックにリピート命令の処理方法を決定すればよい。 However, if the number of pipeline stages is large or the number of entries in the instruction queue is large, the repeat instruction is determined only by the result of determining the number of instructions in the repeat block, corresponding to the maximum number of instructions to be pipelined before instruction decoding. If the processing method is determined, overhead may increase in performance. In such a case, not only the determination result of the number of instructions in the repeat block, but also the number of instructions fetched into the instruction queue, that is, the number of instructions in the decode standby state after the instruction fetch stage and before the instruction decode stage is determined. The processing method of the repeat instruction may be determined dynamically.
この場合、制御方法が異なる実施の形態2の構成を図を用いて簡単に説明する。パイプライン構成や命令キューのエントリ数等は異なるが、全体的な制御は前述の実施の形態1と同様な構成を想定しており、詳細な説明は省略し、ポイントとなる点のみを簡単に説明する。 In this case, the configuration of the second embodiment having a different control method will be briefly described with reference to the drawings. Although the pipeline configuration and the number of instruction queue entries are different, the overall control assumes the same configuration as in the first embodiment, and a detailed description is omitted, and only the point is simplified. explain.
図24はパイプライン処理を模式的に示す説明図である。最大10段のパイプライン処理を行う例を示している。命令フェッチ1(IF1)ステージ801は命令フェッチ要求を出力するステージであり、命令フェッチ2(IF2)ステージ802は命令フェッチに関するメモリアクセスを行うステージであり、命令フェッチ3(IF3)ステージ803は命令フェッチ完了待ち、及び、完了時にフェッチデータの命令キューへの転送を行うステージである。これらのステージ801〜803は801〜803の順にパイプライン処理される。
FIG. 24 is an explanatory diagram schematically showing pipeline processing. An example of performing pipeline processing of up to 10 stages is shown. The instruction fetch 1 (IF1)
命令デコード1(D1)ステージ804は命令コードの前段デコードを行うステージであり、命令デコード2(D2)ステージ805は命令コードの後段デコード、及び、レジスタファイルからのオペランドデータ読み出しを行うステージであり、命令実行1ステージ806は1サイクルで演算実行を終了する命令の演算実行、及び、ロード/ストア/分岐命令等のアドレス計算等命令の実行を行うステージである。これらのステージ804〜806は804〜806の順にパイプライン処理される。
The instruction decode 1 (D1)
また、メモリアクセス1(M1)ステージ807はデータアクセス要求を出力するステージであり、メモリアクセス2(M2)ステージ808はデータアクセスに関するメモリアクセスを行うステージであり、メモリアクセス3(M3)ステージ809はデータアクセス完了待ち、及び、データアクセス完了時にロードデータを転送するステージであり、ライトステージ810はロードデータをレジスタファイルに書き込むライト(WM)ステージである。これらのステージ807〜810は、命令実行1ステージ806に続いて、807〜810の順にパイプライン処理される。
The memory access 1 (M1)
ライト1(W1)ステージ811は1サイクルで演算実行を終了する命令の演算結果をレジスタに書き込むステージである。このライト1ステージ811は命令実行1ステージ806に続いてパイプライン処理される。
The write 1 (W1)
命令実行2(E2)ステージ812は積和演算命令等演算実行に2サイクルを要する命令の後段実行を行うステージであり、ライト2(W2)ステージ813はE2ステージ812での演算結果をレジスタに書き込むステージである。これらのステージ812,813は、命令実行1ステージ806に続いて、812,813の順にパイプライン処理される。
The instruction execution 2 (E2)
図25は本発明の実施の形態2であるデータ処理装置の制御部のうち、リピート制御の説明に必要な部分を示したブロック図である。なお、概略構成は図17で示した実施の形態1と同様の構成を想定している。 FIG. 25 is a block diagram showing a part necessary for explanation of repeat control in the control unit of the data processing apparatus according to the second embodiment of the present invention. The schematic configuration assumes the same configuration as that of the first embodiment shown in FIG.
挿図に示すように、MPUコア部851は内部に制御部853を有しており、外部の命令フェッチ部852を介して命令を受ける。制御部853、内部に命令フェッチ制御部854、D1ステージ制御部856、D2ステージ制御部858、E1ステージ制御部860、命令キュー855、第1命令デコード部857、第2命令デコード部859、及び制御信号生成部861を有している。
As shown in the figure, the
リピート時パイプライン制御手段の一部としても機能する命令フェッチ制御部854はIF1ステージ801〜IF3ステージ803のステージ制御を含む命令フェッチの制御を行い、実施の形態1のIFステージ制御部651と同等の機能を有するとともに、さらに後述する機能を有する。
The instruction fetch
命令キュー855は8エントリの命令キューを含む命令キューであり、D1ステージ制御部856はD1ステージ804の制御を行い、第1命令デコード部857はD1ステージ804で命令の前段デコードを行い、D2ステージ制御部858はD2ステージ805の制御を行い、第2命令デコード部859はD2ステージ805で命令の後段デコードを行い、E1ステージ制御部860はE1ステージ806での命令実行制御を行い、制御信号生成部861はE1ステージ806での実行制御信号の生成等を行う。
The instruction queue 855 is an instruction queue including an 8-entry instruction queue, the D1
第1命令デコード部857は、命令レジスタ871、リピート処理判定部872,デコーダ873及び制御信号生成部874を内部に有する。
The first
命令レジスタ871は第1命令デコード部でデコードする命令を保持するレジスタであり、リピート設定命令用判定部として機能するリピート処理判定部872はリピート命令の処理方法を判定し、デコーダ873は命令をデコードする。
The instruction register 871 is a register for holding an instruction to be decoded by the first instruction decoding unit. The repeat
リピート時パイプライン制御手段の一部として機能する制御信号生成部874は主として命令フェッチ抑止情報884やD2ステージでの制御に使用する制御信号)やパイプラインの後段で必要となる情報(命令フェッチ抑止解除信号883、ジャンプ要求信号885に関する情報を含む)を生成する。実際は非常に複雑なブロック構成となるが、図25では説明容易化を考慮して単純化して示している。
The control
以下、前述の実施の形態1と異なる点に着目し、実施の形態2の相違点のみ簡単に説明する。この例では、命令キュー855が8エントリ存在するため、リピート命令デコード開始時には最大後続の7命令が命令キュー855に取り込まれている場合があり得る。しかし、パイプラインで処理される前後の命令、及び、命令の格納位置等に依存し命令キューにどの程度命令がたまっているかは大きく異なる。常に、最大の場合を想定して上述の実施の形態1と同様の制御を行うと、リピートブロックの命令数が7命令以下の場合には常に実行ステージでジャンプ処理を実行しないといけなくなる。また、パイプラインが深いので分岐によるサイクル数のペナルティも大きくなる。通常、そこまで命令キューが詰まることは少ない。 Hereinafter, focusing on the differences from the first embodiment, only the differences from the second embodiment will be described briefly. In this example, since there are eight entries in the instruction queue 855, there may be a case where up to seven subsequent instructions are taken into the instruction queue 855 at the start of repeat instruction decoding. However, the number of instructions stored in the instruction queue differs greatly depending on the instructions before and after being processed in the pipeline and the storage positions of the instructions. If the same control as in the first embodiment is performed assuming the maximum case, the jump process must always be executed in the execution stage when the number of instructions in the repeat block is 7 instructions or less. In addition, since the pipeline is deep, the penalty for the number of cycles due to branching also increases. Usually, the instruction queue is rarely clogged.
実施の形態2では、命令デコード開始時にデコード対象の命令の何命令後の命令のフェッチが受け付けられているか(すなわち、デコード実行前状態(デコード待ち状態もしくは命令フェッチ完了待ち状態とを含む)であるか)を示すフェッチ情報882が、命令フェッチ制御部854から所定の信号線を介して第1命令デコード部857内のリピート処理判定部872に出力される。なお、デコード実行前状態とはリピート処理判定部872による判定動作実行前にも該当する。
In the second embodiment, the instruction fetch instruction after the instruction to be decoded is accepted at the start of instruction decoding (that is, the pre-decode execution state (including the decode wait state or the instruction fetch completion wait state). Is fetched from the instruction fetch
リピート処理判定部872ではリピート命令処理時に、リピート命令で指定されるリピートブロックのサイズと、フェッチ情報882に基づき命令フェッチ処理を開始している後続の命令数を判定し、リピート命令の処理方法を決定する。
The repeat
すなわち、前述した実施の形態1のデータ処理装置と同様、そのサイクルで出力しようとしている命令フェッチ要求は抑止可能であり、リピートブロックの最終命令の命令フェッチ要求が受け付けられていなければ、パイプライン処理をキャンセルする必要はない。そこで、リピートブロックの最終命令(所定の制御基準命令)の命令フェッチ要求が既に受け付けられおりデコード実行前状態である場合には、リピート設定命令の実行によるリピート関連の設定後、後述するジャンプ処理が行われ、そうでない場合は、活性状態の命令フェッチ抑止情報884を命令フェッチ制御部854に送る。
That is, as with the data processing apparatus of the first embodiment described above, an instruction fetch request to be output in that cycle can be suppressed, and if the instruction fetch request for the last instruction of the repeat block is not accepted, pipeline processing is performed. There is no need to cancel. Therefore, when the instruction fetch request of the final instruction (predetermined control reference instruction) of the repeat block has already been received and is in a pre-decode execution state, the jump processing described later is performed after the repeat-related setting by executing the repeat setting instruction. If not, the active instruction fetch
このように、実施の形態2のデータ処理装置は、デコード実行前状態の命令数に基づく所定の条件に成立時に、デコード実行前状態の命令を有効活用し、オーバーヘッドを最小限に抑えながら正常なリピート動作を実行することができる。 As described above, the data processing apparatus according to the second embodiment normally uses instructions in the pre-decode execution state when the predetermined condition based on the number of instructions in the pre-decode execution state is satisfied, and minimizes overhead. Repeat operations can be performed.
命令フェッチ抑止情報884には命令フェッチを一時停止するまでにフェッチ可能な命令数の情報も含まれる。したがって、命令フェッチ制御部854は、命令フェッチ抑止情報884に基づくことにより、リピートブロックの最終命令の1つ前の命令までの命令フェッチの継続は許可することができる。このように制御することにより、命令プリフェッチの停止期間を最小限に抑え、性能低下を低減している。
The instruction fetch
したがって、命令フェッチ制御部854は命令フェッチ抑止情報884に基づき、指定された命令数の命令フェッチ後は、活性状態の命令フェッチ抑止解除信号883を受信するまで、命令のフェッチ要求の出力を抑止する。もちろん、活性状態の命令フェッチ抑止情報884を受けた時点で、リピートブロックの最終命令の1つ前の命令までフェッチが終わっている場合には、すぐに命令フェッチ要求の出力を抑止する。
Therefore, based on the instruction fetch
このように、実施の形態2のデータ処理装置は、所定の制御基準命令となるリピートブロックの最終命令がデコード実行前状態でない場合、当該最終命令の直前の命令の命令フェッチ部852によるフェッチ動作完了後に、命令フェッチ抑止制御を命令フェッチ部852に対して行うことにより、デコード実行前状態の命令を有効に活用しながら、正常なリピート動作を実行することができる。
As described above, in the data processing apparatus according to the second embodiment, when the last instruction of the repeat block that is a predetermined control reference instruction is not in the pre-decoding state, the fetch operation by the instruction fetch
E1ステージ806でリピート関連の設定が完了する。正しい命令フェッチシーケンスの制御が可能なタイミングにおいて、活性状態の命令フェッチ抑止解除信号883が所定の信号線を介して命令フェッチ部854に送られる。なお、命令フェッチ抑止解除信号883は第2命令デコード部859によるリピート命令のデコード終了後、当該リピート命令の実行時のタイミングで制御信号生成部861から出力される。この制御信号生成部861はリピート時パイプライン制御手段の一部としても機能する。
In the
その結果、命令フェッチ制御部854は、活性状態の命令フェッチ抑止解除信号883に応答して命令のフェッチを再開する。一方、活性状態の命令フェッチ抑止情報884を受けたものの、まだフェッチ抑止状態に入っていない時点において、活性状態の命令フェッチ抑止解除信号883を受けた場合、当該命令フェッチ抑止情報884は無効化され、フェッチは抑止されることなく継続される。
As a result, the instruction fetch
一方、上述したジャンプ処理は以下のように行われる。第2命令デコード部859によりリピート命令のデコード終了後、リピート命令の実行時のタイミングで制御信号生成部861からジャンプ要求信号885がE1ステージ制御部860に出力される。
On the other hand, the jump process described above is performed as follows. After decoding of the repeat instruction by the second
すると、リピート時パイプライン制御手段の一部としても機能するE1ステージ制御部860からジャンプ信号886が命令フェッチ制御部854、D1ステージ制御部856、D2ステージ制御部858に出力されることにより、IF1ステージ801〜IF3ステージ803、D1ステージ804及びD2ステージ805のパイプライン処理内容がキャンセルされる。
Then, the
このように、実施の形態2のデータ処理装置は、ジャンプ信号886に基づくパイプラインキャンセル機能を有することにより、所定の制御基準命令となるリピートブロックの最終命令が既にデコード実行前状態である場合であっても、オーバーヘッドを最小限に抑えながら正常なリピート動作を実行することができる。
As described above, the data processing apparatus according to the second embodiment has the pipeline cancel function based on the
また、ジャンプ処理を命令フェッチ抑止情報884のタイミングで出力させることも考えられる。すなわち、制御信号生成部874から命令フェッチ抑止情報884と共に命令フェッチ制御部854のみを初期化する(D1ステージ制御部856,D2ステージ制御部858は初期化しない)命令フェッチキャンセル信号に相当する信号を出力させ、命令フェッチに関するパイプラインキャンセル機能の効果を発揮させた上、命令フェッチ制御部854により、命令フェッチに関するリピートブロックの最終命令の1つ前の命令までの命令フェッチを改めて行った後、命令フェッチ抑止状態に移行するように制御することにより、オーバーヘッドを最小限に抑えることができる。
It is also conceivable to output jump processing at the timing of the instruction fetch
このように、実施の形態2のデータ処理装置では、パイプラインキャンセル処理を実行した後、所定の制御基準命令であるリピートブロックの最終命令の直前の命令の命令フェッチ部852によるフェッチ要求受け付け後に、命令フェッチ制御部854によって命令フェッチ抑止制御を行うことにより、オーバーヘッドを最小限に抑えながら正常なリピート動作を実行することができる。
As described above, in the data processing apparatus according to the second embodiment, after executing the pipeline cancel process, after receiving the fetch request by the instruction fetch
この実施の形態2では、リピートブロックの最終命令の1命令前の命令まで、フェッチを継続できるようにしているが、制御を簡単にするために実施の形態1と同様、単に、活性状態の命令フェッチ抑止情報884を受けた時点で命令フェッチを停止するような制御を行ってもよい。ただし、処理サイクル数のオーバーヘッドの削減効果はやや落ちる場合がある。
In the second embodiment, the fetch can be continued up to the instruction one instruction before the last instruction of the repeat block. However, in order to simplify the control, as in the first embodiment, the active instruction is simply used. Control may be performed such that instruction fetch is stopped when the fetch
このような構成をとった場合も、実施の形態1と同じ効果を得ることができる。また、実施の形態2は、パイプライン処理の命令フェッチの状態も絡めてリピート命令の処置方法を判断することにより、さらに処理サイクル数のオーバーヘッドを削減することが可能となるという実施の形態1以上の効果を奏する。 Even when such a configuration is adopted, the same effect as in the first embodiment can be obtained. Further, the second embodiment is more than the first embodiment in which it is possible to further reduce the overhead of the number of processing cycles by determining the processing method of the repeat instruction in connection with the instruction fetch state of the pipeline processing. The effect of.
この場合、パイプライン段数が多く、命令キューのサイズも大きいため、実施の形態1で説明したように命令フェッチ後命令キューに書き込む段階でプリデコードを行い、リピート命令の処理方法を決定し、早期に命令のフェッチ制御を行うようにすれば、更にパイプライン処理の乱れを抑えることができる。 In this case, since the number of pipeline stages is large and the size of the instruction queue is large, as described in the first embodiment, predecoding is performed at the stage of writing to the instruction queue after instruction fetching, and a repeat instruction processing method is determined. If instruction fetch control is performed at the same time, the disturbance of the pipeline processing can be further suppressed.
実施の形態2も、実施の形態1と同様、あくまでも一つの構成例を示したものであり、本発明の適用範囲を限定するものではない。基本的に、ハードウェアリピート機能を備えた、パイプライン処理を行うデータ処理装置であれば、どのようなものに適用しても同様の効果がある。図25で示した実施の形態2の構成に限定されるものではない。実施の形態1と同様、異なるアーキテクチャやハードウェア実装手法を採用した場合にも、適用可能である。 The second embodiment, like the first embodiment, shows only one configuration example, and does not limit the application range of the present invention. Basically, any data processing apparatus having a hardware repeat function and performing pipeline processing has the same effect. It is not limited to the configuration of the second embodiment shown in FIG. Similar to the first embodiment, the present invention can be applied even when a different architecture or hardware mounting method is adopted.
実施の形態2では、既にリピートブロックの最終命令の命令フェッチが受け付けられている場合には、一律リピート関連の設定完了後ジャンプを行うような制御を行っているが、この場合、命令フェッチ制御部854にリピートブロックの先頭命令からリピートブロックの最終命令の1命令前まで命令フェッチを再実行し、その後命令フェッチの抑止解除がまだ行われていなければ命令フェッチを一時停止するように制御してもよい。そうすれば、さらにパイプライン処理の乱れを低減できる。ただし、デコード中の命令の次命令のアドレスを管理する機能、及び、そのアドレスへ命令フェッチ段階でジャンプする機能が追加となり、制御も複雑になる。また、フェッチ済みの命令の一部(リピートブロックの最終命令以降の命令)のみを破棄する機能が有れば、さらに無駄な命令フェッチの再実行を削減できる。 In the second embodiment, when the instruction fetch of the final instruction of the repeat block has already been accepted, control is performed so as to perform a jump after completion of uniform repeat-related setting. In this case, the instruction fetch control unit Even if the instruction fetch is re-executed from the first instruction of the repeat block to one instruction before the last instruction of the repeat block in 854, and the instruction fetch suppression is not released yet, the instruction fetch is temporarily stopped. Good. By doing so, the disturbance of the pipeline processing can be further reduced. However, the function of managing the address of the instruction next to the instruction being decoded and the function of jumping to the address at the instruction fetch stage are added, and the control becomes complicated. Further, if there is a function of discarding only a part of fetched instructions (instructions after the last instruction of the repeat block), it is possible to further reduce wasteful instruction fetch re-execution.
201 MPUコア部、202 命令フェッチ部、211 制御部、212,855 命令キュー、213 命令デコード部、214 第1デコーダ、224 PC部、323 PSW部、651 IFステージ制御部、652 命令フェッチ要求生成部、653 リピート制御部、654 TRPビット、661 Dステージ制御部、662,871 命令レジスタ、663,873 デコーダ、664 disp判定部、665,674,861,874, 制御信号生成部、671 Eステージ制御部、672 ジャンプ制御部、673 Eステージ制御信号ラッチ、675 RPビット、681 命令フェッチ抑止信号、682 命令フェッチ抑止解除信号、684 ジャンプ信号、854 命令フェッチ制御部、856 D1ステージ制御部、858 D2ステージ制御部、860 E1ステージ制御部、872 リピート処理判定部。
201 MPU core unit, 202 instruction fetch unit, 211 control unit, 212,855 instruction queue, 213 instruction decode unit, 214 first decoder, 224 PC unit, 323 PSW unit, 651 IF stage control unit, 652 instruction fetch request generation unit , 653 repeat control unit, 654 TRP bit, 661 D stage control unit, 662, 871 instruction register, 663, 873 decoder, 664 disp determination unit, 665, 674, 861, 874, control signal generation unit, 671 E stage control unit , 672 Jump control unit, 673 E stage control signal latch, 675 RP bit, 681 Instruction fetch suppression signal, 682 Instruction fetch suppression release signal, 684 jump signal, 854 Instruction fetch control unit, 856 D1 stage control unit, 858 D2 stage control , 860 E1 stage control unit, 872 repeat determination unit.
Claims (10)
パイプライン処理対象の命令をフェッチする命令フェッチ部と、
前記命令フェッチ部から前記命令を受け、当該命令が前記リピート設定命令である場合に、前記リピート対象ブロックに関する前記リピート機能の設定内容が所定の条件を満足するか否かを判定する判定動作を実行するリピート設定命令用判定部と、
前記リピート設定命令用判定部が前記所定の条件を満足すると判定した場合、前記パイプライン処理対象の命令の新規フェッチ開始を一時抑止させる命令フェッチ抑止制御を行うリピート時パイプライン制御手段と、
を備えるデータ処理装置。 Repeated blocks that have a pipeline processing function and repeat at least one instruction and have a total code size of a predetermined code size in hardware according to a repeat setting instruction that defines at least a part of repeat-related settings A data processing apparatus having a repeat function,
An instruction fetch unit that fetches an instruction to be pipelined;
When the instruction is received from the instruction fetch unit and the instruction is the repeat setting instruction, a determination operation is performed to determine whether or not the setting content of the repeat function related to the repeat target block satisfies a predetermined condition A determination unit for a repeat setting command to perform,
When the repeat setting instruction determination unit determines that the predetermined condition is satisfied, a repeat pipeline control unit that performs instruction fetch suppression control for temporarily suppressing start of a new fetch of the pipeline processing target instruction;
A data processing apparatus comprising:
前記所定の条件は前記所定のコードサイズが第1の基準値以下である条件を含み、
前記リピート時パイプライン制御手段は、
前記リピート設定命令用判定部の前記判定動作によって前記所定の条件を満足すると判定した時に前記命令フェッチ抑止制御を開始し、前記リピート設定命令に規定したリピート関連の設定動作が終了した後に前記命令フェッチ抑止制御を解除する、
データ処理装置。 The data processing apparatus according to claim 1, wherein
The predetermined condition includes a condition that the predetermined code size is equal to or smaller than a first reference value;
The repeat pipeline control means includes:
The instruction fetch suppression control is started when it is determined that the predetermined condition is satisfied by the determination operation of the repeat setting instruction determination unit, and the instruction fetch is performed after a repeat-related setting operation defined in the repeat setting instruction is completed. Canceling suppression control,
Data processing device.
前記所定の条件は前記所定のコードサイズが第2の基準値以下である条件を含み、
前記リピート時パイプライン制御手段は、
前記リピート設定命令用判定部の前記判定動作によって前記所定の条件を満足すると判定した時に前記命令フェッチ抑止制御を開始し、前記リピート設定命令に規定したリピート関連の設定動作が終了した後に前記リピート設定命令以降の命令のパイプライン処理をキャンセルするパイプラインキャンセル処理を実行する、
データ処理装置。 The data processing apparatus according to claim 1, wherein
The predetermined condition includes a condition that the predetermined code size is equal to or smaller than a second reference value;
The repeat pipeline control means includes:
The instruction fetch suppression control is started when it is determined that the predetermined condition is satisfied by the determination operation of the determination unit for the repeat setting instruction, and the repeat setting is completed after a repeat-related setting operation specified in the repeat setting instruction is completed. Execute pipeline cancel processing to cancel the pipeline processing of instructions after the instruction,
Data processing device.
前記所定の条件は、前記リピート設定命令に引き続く、前記命令フェッチ開始後、前記判定動作実行前の状態の命令コードサイズに基づく条件を含み、
前記リピート時パイプライン制御手段は、
前記リピート設定命令用判定部の前記判定動作によって前記所定の条件を満足すると判定した時に前記命令フェッチ抑止制御を実行し、前記リピート設定命令に規定したリピート関連の設定動作が終了した後に前記命令フェッチ抑止制御を解除する、
データ処理装置。 The data processing apparatus according to claim 1, wherein
The predetermined condition includes a condition based on an instruction code size in a state after execution of the instruction fetch and before execution of the determination operation following the repeat setting instruction.
The repeat pipeline control means includes:
The instruction fetch suppression control is executed when it is determined that the predetermined condition is satisfied by the determination operation of the repeat setting instruction determination unit, and the instruction fetch is performed after a repeat-related setting operation defined in the repeat setting instruction is completed. Canceling suppression control,
Data processing device.
前記リピート対象ブロックにおける前記少なくとも一つの命令は所定の制御基準命令コードを含み、前記所定の条件は前記判定動作実行前状態の命令に前記所定の制御基準命令コードが存在しない場合を含み、
前記リピート時パイプライン制御手段は、
前記リピート設定命令用判定部が前記所定の条件を満足しないと判定した場合、前記リピート設定命令以降の命令のパイプライン処理をキャンセルするパイプラインキャンセル処理を実行する、
データ処理装置。 A data processing apparatus according to claim 4, wherein
The at least one instruction in the repeat target block includes a predetermined control reference instruction code, and the predetermined condition includes a case where the predetermined control reference instruction code does not exist in an instruction in a state before execution of the determination operation;
The repeat pipeline control means includes:
When the determination unit for the repeat setting instruction determines that the predetermined condition is not satisfied, a pipeline cancel process for canceling the pipeline process of the instruction after the repeat setting instruction is executed.
Data processing device.
前記リピート対象ブロックにおける前記少なくとも一つの命令は所定の制御基準命令コードを含み、前記所定の条件は前記判定動作実行前状態の命令に前記所定の制御基準命令コードが存在しない場合を含み、
前記リピート時パイプライン制御手段は、
前記リピート設定命令用判定部が前記所定の条件を満足すると判定した場合、前記所定の制御基準命令コードの直前の命令コードの前記フェッチ部によるフェッチ動作開始後に前記命令フェッチ抑止制御を開始し、前記リピート設定命令に規定したリピート関連の設定動作が終了した後に前記命令フェッチ抑止制御を解除し、
前記リピート設定命令用判定部が前記所定の条件を満足しないと判定した場合、前記リピート設定命令以降の命令のパイプライン処理をキャンセルするパイプラインキャンセル処理を実行する、
データ処理装置。 The data processing apparatus according to claim 1, wherein
The at least one instruction in the repeat target block includes a predetermined control reference instruction code, and the predetermined condition includes a case where the predetermined control reference instruction code does not exist in an instruction in a state before execution of the determination operation;
The repeat pipeline control means includes:
When the repeat setting instruction determination unit determines that the predetermined condition is satisfied, the instruction fetch suppression control is started after the fetch operation by the fetch unit of the instruction code immediately before the predetermined control reference instruction code is started, Release the instruction fetch suppression control after the repeat-related setting operation specified in the repeat setting instruction is completed,
When the determination unit for the repeat setting instruction determines that the predetermined condition is not satisfied, a pipeline cancel process for canceling the pipeline process of the instruction after the repeat setting instruction is executed.
Data processing device.
パイプライン処理対象の命令をフェッチする命令フェッチ部と、
前記命令フェッチ部から前記命令を受け、当該命令が前記リピート設定命令である場合に、前記リピート対象ブロックに関する前記リピート機能の設定内容が第1の条件を満足するか否かを判定する判定動作を実行するリピート設定命令用判定部と、
前記リピート設定命令判定部が前記第1の条件を満足すると判定した場合、前記リピート設定命令に規定したリピート関連の設定動作が終了した後に前記リピート設定命令以降の命令のパイプライン処理をキャンセルするパイプラインキャンセル処理を実行するリピート時パイプライン制御手段とを備え、
前記第1の条件は前記所定のコードサイズが第1の基準値以下である条件を含む、
データ処理装置。 Repeated blocks that have a pipeline processing function and repeat at least one instruction and have a total code size of a predetermined code size in hardware according to a repeat setting instruction that defines at least a part of repeat-related settings A data processing apparatus having a repeat function,
An instruction fetch unit that fetches an instruction to be pipelined;
When the instruction is received from the instruction fetch unit and the instruction is the repeat setting instruction, a determination operation is performed to determine whether or not the setting content of the repeat function related to the repeat target block satisfies a first condition. A repeat setting instruction determination unit to be executed;
A pipe that cancels pipeline processing of instructions subsequent to the repeat setting instruction after the repeat-related setting operation defined in the repeat setting instruction is completed when the repeat setting instruction determination unit determines that the first condition is satisfied; A repeat pipeline control means for executing line cancellation processing,
The first condition includes a condition that the predetermined code size is equal to or smaller than a first reference value.
Data processing device.
前記リピート設定命令用判定部は、前記リピート対象ブロックに関する前記リピート機能の設定内容として、前記所定のコードサイズが前記第1の基準値より大きく第2の基準値以下である第2の条件を満足するか否かをさらに判定し、
前記リピート時パイプライン制御手段は、
前記リピート設定命令用判定部が前記判定動作によって前記第2の条件を満足すると判定した時に、前記パイプライン処理対象の命令の新規フェッチ開始を一時抑止させる命令フェッチ抑止制御を開始し、前記リピート設定命令に規定したリピート関連の設定動作が終了した後に前記命令フェッチ抑止制御を解除する、
データ処理装置。 The data processing apparatus according to claim 7, wherein
The repeat setting command determination unit satisfies a second condition in which the predetermined code size is larger than the first reference value and smaller than or equal to a second reference value as the setting contents of the repeat function related to the repeat target block. Further determine whether or not to
The repeat pipeline control means includes:
When the determination unit for the repeat setting instruction determines that the second condition is satisfied by the determination operation, an instruction fetch suppression control for temporarily suppressing a new fetch start of the pipeline processing target instruction is started, and the repeat setting is started. Canceling the instruction fetch suppression control after the repeat-related setting operation defined in the instruction is completed;
Data processing device.
パイプライン処理対象の命令をフェッチする命令フェッチ部と、
前記命令フェッチ部から前記命令を受け、当該命令が前記リピート設定命令である場合に、前記リピート対象ブロックに関する前記リピート機能の設定内容が所定のキャンセル条件を満足するか否かを判定する判定動作を実行するリピート設定命令用判定部と、
前記リピート設定命令用判定部が前記所定のキャンセル条件を満足すると判定した場合、前記リピート設定命令以降の命令のパイプライン処理をキャンセルするパイプラインキャンセル処理を実行するリピート時パイプライン制御手段とを備え、
前記少なくとも一つの命令は所定の制御基準命令コードを含み、前記所定のキャンセル条件は前記判定動作実行前状態の命令に前記所定の制御基準命令コードが存在する場合を含む、
データ処理装置。 Repeated blocks that have a pipeline processing function and repeat at least one instruction and have a total code size of a predetermined code size in hardware according to a repeat setting instruction that defines at least a part of repeat-related settings A data processing apparatus having a repeat function,
An instruction fetch unit that fetches an instruction to be pipelined;
When the instruction is received from the instruction fetch unit and the instruction is the repeat setting instruction, a determination operation for determining whether or not the setting content of the repeat function related to the repeat target block satisfies a predetermined cancel condition A repeat setting instruction determination unit to be executed;
When the repeat setting instruction determination unit determines that the predetermined cancel condition is satisfied, the repeat setting instruction determining unit includes a repeat pipeline control unit that executes pipeline cancel processing for canceling pipeline processing of instructions subsequent to the repeat setting instruction. ,
The at least one instruction includes a predetermined control reference instruction code, and the predetermined cancellation condition includes a case where the predetermined control reference instruction code exists in an instruction in a state before execution of the determination operation.
Data processing device.
前記リピート時パイプライン制御手段は、
前記所定のキャンセル条件を満足する場合、前記パイプラインキャンセル処理を前記判定動作の実行タイミングで実行した後、前記所定の制御基準命令コードの直前の命令コードの前記フェッチ部によるフェッチ動作開始後に、前記パイプライン処理対象の命令の新規フェッチ開始を一時抑止させる命令フェッチ抑止制御を行い、前記リピート設定命令に規定したリピート関連の設定動作が終了した後に前記命令フェッチ抑止制御を解除する、
データ処理装置。
The data processing apparatus according to claim 9, wherein
The repeat pipeline control means includes:
When the predetermined cancellation condition is satisfied, after the pipeline cancel processing is executed at the execution timing of the determination operation, after the fetch operation of the instruction code immediately before the predetermined control reference instruction code is started by the fetch unit, Performing instruction fetch suppression control that temporarily suppresses the start of a new fetch of an instruction subject to pipeline processing, and canceling the instruction fetch suppression control after completion of a repeat-related setting operation defined in the repeat setting instruction;
Data processing device.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2004208270A JP2006031329A (en) | 2004-07-15 | 2004-07-15 | Data processor |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2004208270A JP2006031329A (en) | 2004-07-15 | 2004-07-15 | Data processor |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2006031329A true JP2006031329A (en) | 2006-02-02 |
Family
ID=35897606
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2004208270A Pending JP2006031329A (en) | 2004-07-15 | 2004-07-15 | Data processor |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2006031329A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2007207145A (en) * | 2006-02-06 | 2007-08-16 | Nec Electronics Corp | Loop control circuit and loop control method |
-
2004
- 2004-07-15 JP JP2004208270A patent/JP2006031329A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2007207145A (en) * | 2006-02-06 | 2007-08-16 | Nec Electronics Corp | Loop control circuit and loop control method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP3842474B2 (en) | Data processing device | |
US7434030B2 (en) | Processor system having accelerator of Java-type of programming language | |
US7490228B2 (en) | Processor with register dirty bit tracking for efficient context switch | |
JP3856737B2 (en) | Data processing device | |
JP3881763B2 (en) | Data processing device | |
US6016543A (en) | Microprocessor for controlling the conditional execution of instructions | |
US20090138685A1 (en) | Processor for processing instruction set of plurality of instructions packed into single code | |
US5881307A (en) | Deferred store data read with simple anti-dependency pipeline inter-lock control in superscalar processor | |
JP3670668B2 (en) | Data processing device | |
US20030061471A1 (en) | Data processor | |
JP2006004042A (en) | Data processor | |
JP2004171573A (en) | Coprocessor extension architecture built by using novel splint-instruction transaction model | |
JP2006313422A (en) | Calculation processing device and method for executing data transfer processing | |
JP3789583B2 (en) | Data processing device | |
JPH01214932A (en) | Data processor | |
JP2009508180A (en) | Efficient subprogram return in microprocessors. | |
JP6073392B2 (en) | System and method for evaluating data values as instructions | |
EP1770507A2 (en) | Pipeline processing based on RISC architecture | |
US6449712B1 (en) | Emulating execution of smaller fixed-length branch/delay slot instructions with a sequence of larger fixed-length instructions | |
US6055628A (en) | Microprocessor with a nestable delayed branch instruction without branch related pipeline interlocks | |
US6983359B2 (en) | Processor and method for pre-fetching out-of-order instructions | |
JP2002229779A (en) | Information processor | |
JP4502532B2 (en) | Data processing device | |
JP2004145454A (en) | Information processor and information processing method | |
US5737562A (en) | CPU pipeline having queuing stage to facilitate branch instructions |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20070524 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20090519 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20090929 |
|
RD04 | Notification of resignation of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7424 Effective date: 20091112 |
|
A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20100209 |