JP2003005955A - Data processor - Google Patents

Data processor

Info

Publication number
JP2003005955A
JP2003005955A JP2001187041A JP2001187041A JP2003005955A JP 2003005955 A JP2003005955 A JP 2003005955A JP 2001187041 A JP2001187041 A JP 2001187041A JP 2001187041 A JP2001187041 A JP 2001187041A JP 2003005955 A JP2003005955 A JP 2003005955A
Authority
JP
Japan
Prior art keywords
instruction
timing
register
value
inversion state
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.)
Withdrawn
Application number
JP2001187041A
Other languages
Japanese (ja)
Inventor
Kazuji Kurata
和司 蔵田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Panasonic Holdings Corp
Original Assignee
Matsushita Electric Industrial Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP2001187041A priority Critical patent/JP2003005955A/en
Publication of JP2003005955A publication Critical patent/JP2003005955A/en
Withdrawn legal-status Critical Current

Links

Landscapes

  • Executing Machine-Instructions (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide a data processor for executing instructions by successively reading those instructions according to a sequence capable of reducing the program size by reducing a redundant program code when there is an instruction group in a relation that a source operand and a destination operand are inverted. SOLUTION: There are a first instruction to explicitly designating an instruction to be inverted, and to directly control the execution order of instructions, a second instruction to directly control the execution order of the instructions, and a third instruction to directly control the execution order of the instructions by making a pair with the first or second instruction. Only when the first instruction is decoded, an instruction decoder 50 updates an inversion stage flag 110 in order to invert the data transfer origin and transfer destination, and when the first instruction is decoded, the instruction decoder 50 returns the inversion state flag 110 to the pre-updated original state in order not to invert the data transfer origin and transfer destination.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【発明の属する技術分野】 本発明は、CPUやマイク
ロプロセッサなどと称されるデータ処理装置に関するも
のである。
TECHNICAL FIELD The present invention relates to a data processing device called a CPU, a microprocessor, or the like.

【0002】[0002]

【従来の技術】近年、電子技術の発展により、CPUや
マイクロプロセッサ等のデータ処理装置が普及し、あら
ゆる分野で用いられている。従来の汎用レジスタを備え
たデータ処理装置では、汎用レジスタを任意の組合せで
演算対象とすることができるので、オペランドをメモリ
アドレスに限定する場合に比べて、命令数を比較的小さ
く抑えることができる。また、オペランドアドレスより
もビット長の短いレジスタ指定コードを用いるため、命
令語長も比較的短い。
2. Description of the Related Art In recent years, with the development of electronic technology, data processing devices such as CPUs and microprocessors have become widespread and used in all fields. In a conventional data processing device having a general-purpose register, the general-purpose registers can be operated in any combination, so that the number of instructions can be kept relatively small compared to the case where the operand is limited to a memory address. . Further, since the register specifying code having a bit length shorter than that of the operand address is used, the instruction word length is relatively short.

【0003】ここで、一般的なデータ処理では、科学技
術計算や制御などその用途に関わらず、ある一連の処理
とまったく相反する一連の処理を要する場合がある。図
15に、従来のデータ処理装置で実行されるプログラム
の一例を示す。これは、レジスタの退避、復帰で頻繁に
用いられるプログラム例である。以下、ニーモニック表
記された各命令について簡単な説明を付する。図中
の[]内に記された値はその命令のコードサイズであ
る。
Here, in general data processing, there are cases where a series of processing that is completely contrary to a certain series of processing is required regardless of its application such as scientific and technological calculation or control. FIG. 15 shows an example of a program executed by a conventional data processing device. This is an example of a program that is frequently used to save and restore registers. Below, a brief description is given for each instruction expressed in mnemonics. The value in [] in the figure is the code size of the instruction.

【0004】1行目:SUB 6,R3 (R3レジス
タの値から即値6を減算して結果をR3レジスタに格納
する。LABEL1:は番地を示している。)[2by
te] 2行目:MOV R0,@(4,R3) (R0レジス
タの値をR3レジスタと即値4を加算したアドレスのメ
モリにストアする。)[2byte] 3行目:MOV R1,@(2,R3) (R1レジス
タの値をR3レジスタと即値2を加算したアドレスのメ
モリにストアする。)[2byte] 4行目:MOV R2,@(0,R3) (R2レジス
タの値をR3レジスタと即値0を加算したアドレスのメ
モリにストアする。)[2byte] 5行目:SUB R0,R0 (R0レジスタの値とR
0レジスタの値を減算して、R0レジスタに格納す
る。)[1byte] 6行目:処理 (この処理は、複数命令からなるデータ
処理であって、R0レジスタ、R1レジスタ、R2レジ
スタを書き換える可能性があるものとする。) 7行目:MOV @(4,R3),R0 (R3レジス
タと即値4を加算したアドレスのメモリに格納された値
を、R0レジスタにロードする。)[2byte] 8行目:MOV @(2,R3),R1 (R3レジス
タと即値2を加算したアドレスのメモリに格納された値
を、R1レジスタにロードする。)[2byte] 9行目:MOV @(0,R3),R2 (R3レジス
タと即値0を加算したアドレスのメモリに格納された値
を、R2レジスタにロードする。)[2byte] 10行目:ADD 6,R3 (R3レジスタの値に即
値6を加算して結果をR3レジスタに格納する。)[2
byte] 11行目:RTS (サブルーチンからリターンする。
スタックポインタSPの内容をアドレスとしてメモリを
読出し、その内容をプログラムカウンタPCに格納す
る。スタックポインタに2加算し、SPを更新する。)
[1byte] このように、このLABEL1で示される番地からはじ
まるサブルーチンでは、6行目の処理で使用されるレジ
スタのデータを破壊しないために、データ転送命令が使
用されている。
First line: SUB 6, R3 (immediate value 6 is subtracted from the value in the R3 register and the result is stored in the R3 register. LABEL1: indicates an address.) [2by
te] Second line: MOV R0, @ (4, R3) (The value of the R0 register is stored in the memory at the address obtained by adding the immediate value 4 to the R3 register.) [2byte] Third line: MOV R1, @ (2 , R3) (The value of the R1 register is stored in the memory of the address obtained by adding the immediate value 2 to the R3 register.) [2 byte] Fourth line: MOV R2, @ (0, R3) (The value of the R2 register is set to the R3 register. It is stored in the memory at the address to which the immediate value 0 is added.) [2 byte] 5th line: SUB R0, R0 (value of R0 register and R
The value of the 0 register is subtracted and stored in the R0 register. ) [1 byte] Sixth line: Process (This process is a data process consisting of a plurality of instructions and the R0 register, R1 register, and R2 register may be rewritten.) Seventh line: MOV @ ( 4, R3), R0 (The value stored in the memory at the address obtained by adding the R3 register and the immediate value 4 is loaded to the R0 register.) [2 byte] 8th line: MOV @ (2, R3), R1 (R3 The value stored in the memory at the address obtained by adding the register and the immediate value 2 is loaded to the R1 register.) [2 byte] Line 9: MOV @ (0, R3), R2 (Address obtained by adding the R3 register and the immediate value 0) The value stored in the memory of R2 is loaded into the R2 register.) [2 byte] 10th line: ADD 6, R3 (immediate value 6 is added to the value of the R3 register and the result is R3 register And stores it in the data.) [2
byte] 11th line: RTS (Returns from the subroutine.
The memory is read by using the contents of the stack pointer SP as an address, and the contents are stored in the program counter PC. Add 2 to the stack pointer and update SP. )
[1 byte] As described above, in the subroutine starting from the address indicated by LABEL1, the data transfer instruction is used in order not to destroy the data of the register used in the processing of the sixth line.

【0005】[0005]

【発明が解決しようとする課題】しかしながら、上記従
来技術のデータ処理装置によれば、図15に一例を示し
たように、7行目から9行目に配置された命令群は、2
行目から4行目に配置された命令群のソースオペランド
とディスティネーションオペランドとを反転させた命令
群であるにも関わらず、プログラムコードとしてメモリ
領域を確保する必要があり、そのためにプログラムサイ
ズが増大するという問題があった。
However, according to the above-described conventional data processing apparatus, as shown in an example in FIG. 15, the instruction groups arranged in the 7th to 9th rows are 2
Although it is an instruction group in which the source operand and the destination operand of the instruction group arranged from the 4th line to the 4th line are inverted, it is necessary to secure a memory area as the program code, and therefore the program size is There was a problem of increase.

【0006】本発明は、係る問題点に鑑み、プログラム
サイズを小さく抑えることができるデータ処理装置の提
供を目的とする。
In view of the above problems, it is an object of the present invention to provide a data processing device which can keep the program size small.

【0007】[0007]

【課題を解決するための手段】上記の課題を解決するた
めに、本発明にかかるデータ処理装置は、命令を順に読
み込むフェッチ部と、読み込んだ命令を解読する解読部
と、解読した命令を実行する実行部とを備えたデータ処
理装置であって、データ転送元と転送先とを反転させる
対象命令を記憶する反転命令記憶部と、前記対象命令を
反転実行するか否かを表す反転状態識別子を記憶する反
転状態記憶部と、命令中に記述されているデータ転送元
と転送先とを反転させるオペランド制御部とを備えたこ
とを特徴とする。
In order to solve the above-mentioned problems, a data processing apparatus according to the present invention executes a fetch unit that sequentially reads instructions, a decoding unit that decodes the read instructions, and executes the decoded instructions. A data processing device comprising: an execution unit for executing a reverse instruction storage unit for storing a target instruction for inverting a data transfer source and a transfer destination; and a reverse state identifier indicating whether or not the target instruction is reversely executed. And an operand control unit for inverting the data transfer source and the transfer destination described in the instruction.

【0008】上記の構成により、データ転送元と転送先
を反転させる対象命令に限り、反転状態記憶手段に記憶
されている反転状態識別子の指示に応じて、オペランド
制御回路がデータ転送元と転送先を反転させることで、
一つの命令群で処理されるデータ転送処理が2通り実施
可能となる。
With the above arrangement, the operand control circuit causes the data transfer source and the transfer destination to respond to the instruction of the inversion state identifier stored in the inversion state storage means only for the target instruction for inverting the data transfer source and the transfer destination. By inverting
Two types of data transfer processing that can be executed by one instruction group can be implemented.

【0009】さらに、前記した構成にかかる本発明のデ
ータ処理装置は、前記対象命令を明示的に指定するとと
もに命令の実行順序を直接制御する第1の命令と、命令
の実行順序を直接制御する第2の命令と、第1の命令あ
るいは第2の命令と対をなして命令の実行順序を直接制
御する第3の命令とを記憶する命令記憶手段と、前記第
1の命令および前記第2の命令のうち、前記第1の命令
が解読されたときのみデータ転送元と転送先とを反転さ
せるものとして前記反転状態識別子を更新し、前記第3
の命令が解読されたときにデータ転送元と転送先を反転
させないものとして前記反転状態識別子を更新前に戻す
反転状態更新部とをさらに備えたことが好ましい。
Further, the data processing apparatus of the present invention having the above-mentioned configuration directly controls the execution order of the first instruction and the first instruction for directly designating the target instruction and directly controlling the execution order of the instructions. Instruction storage means for storing a second instruction, and a third instruction that pairs with the first instruction or the second instruction to directly control the execution order of the instructions; the first instruction and the second instruction Of the instructions, the inversion state identifier is updated to invert the data transfer source and the transfer destination only when the first instruction is decoded.
It is preferable to further include an inversion state updating unit for returning the inversion state identifier before updating so as not to invert the data transfer source and the transfer destination when the instruction is decoded.

【0010】この構成によれば、(1)前記第2の命令
が解読されたときは命令の実行順序を直接制御した後に
一つの命令群によるデータ処理をし、(2)データ転送
元と転送先を反転させる対象命令を明示的に指示すると
ともに命令の実行順序を直接制御する前記第1の命令が
解読されたときには同じく命令の実行順序を直接制御し
た後に一つの命令群による先とは異なるデータ処理を
し、(3)前記第3の命令が解読されたときには前記反
転状態によらず更新前に戻す操作をすることが可能とな
る。つまり、一つの命令群に命令の実行順序を移すとき
に、前記第1の命令と前記第2の命令のいずれかに応じ
て異なるデータ転送処理がなされ、かつ復帰時にはデー
タ転送元と転送先の扱いを通常に戻すことが可能とな
る。
According to this configuration, (1) when the second instruction is decoded, the instruction execution order is directly controlled, and then data processing is performed by one instruction group, and (2) data transfer source and transfer are performed. Directly controlling the instruction to be inverted and directly controlling the execution order of the instructions When the first instruction is decoded, the instruction execution order is directly controlled, and then the instruction group is different from the previous instruction. (3) When data is processed, (3) when the third instruction is decoded, it is possible to perform an operation of returning to the state before update regardless of the inverted state. That is, when the execution order of the instructions is transferred to one instruction group, different data transfer processing is performed depending on either the first instruction or the second instruction, and at the time of restoration, the data transfer source and the transfer destination are transferred. It is possible to return the treatment to normal.

【0011】また、前記した構成にかかる本発明のデー
タ処理装置は、前記対象命令を明示的に指定するととも
に命令の実行順序を直接制御する第1の命令と、前記第
1の命令と対をなして同じく命令の実行順序を直接制御
する第2の命令とを記憶する命令記憶手段と、前記第1
の命令が解読されたときにデータ転送元と転送先を反転
させるものとして前記反転状態識別子を更新し、前記第
2の命令が解読されたときに前記反転状態識別子がデー
タ転送元と転送先を反転させるものであるならば、命令
の実行順序を制御した後にデータ転送元と転送先を反転
させないものとして前記反転状態識別子を更新前に戻す
反転状態更新手段と、前記第2の命令が解読されたとき
に前記反転状態識別子がデータ転送元と転送先を反転さ
せないものであるならば前記第2の命令を無効化する命
令無効化制御手段とをさらに備えたことが好ましい。
Further, in the data processing apparatus of the present invention having the above-mentioned configuration, a pair of the first instruction and the first instruction for explicitly designating the target instruction and directly controlling the execution order of the instructions is formed. An instruction storing means for storing a second instruction for directly controlling the execution order of the instructions, and the first instruction
When the second instruction is decoded, the inversion state identifier is updated so as to invert the data transfer source and the transfer destination, and when the second instruction is decoded, the inversion state identifier indicates the data transfer source and the transfer destination. If it is to invert, the inversion state updating means for returning the inversion state identifier to before updating, assuming that the data transfer source and the transfer destination are not inverted after controlling the execution order of the instructions, and the second instruction are decoded. It is preferable to further include instruction invalidation control means for invalidating the second instruction if the inversion state identifier does not invert the data transfer source and the transfer destination.

【0012】この構成によれば、前記第1の命令が解読
され前記反転状態がデータ転送元と転送先を反転させる
ものとして更新中のときに限って前記第2の命令は有効
となる。これによって、前記第1の命令で反転状態が更
新されていないときには、前記第2の命令は無効化され
るので、不要な復帰処理をすることがなくなる。
According to this structure, the second instruction is valid only when the first instruction is decoded and the inversion state is being updated to invert the data transfer source and the transfer destination. As a result, when the inverted state is not updated by the first instruction, the second instruction is invalidated, and unnecessary return processing is not performed.

【0013】さらに、前記第1の命令で一つの命令群に
命令の実行順序を直接移したときに限って、通常とは異
なるデータ転送処理を要求するとともに、前記第2の命
令により復帰処理となる命令の実行順序を制御した後に
データ転送元と転送先を反転させないものとして前記反
転状態を更新前に戻すことができる。つまり、前記第1
の命令で一つの命令群に命令の実行順序を移すことで、
異なるデータ転送処理を要求するとともに復帰時には通
常に戻すことが可能となる。
Further, only when the execution order of the instructions is directly transferred to one instruction group by the first instruction, a data transfer process different from the normal one is requested, and a return process is executed by the second instruction. It is possible to return the inversion state to before the update by assuming that the data transfer source and the transfer destination are not inverted after controlling the execution order of the instruction. That is, the first
By moving the execution order of instructions to one instruction group with
It is possible to request a different data transfer process and return to the normal state when returning.

【0014】[0014]

【発明の実施の形態】[実施の形態1]以下、本発明の
実施形態1について、図1、図2、図3、図4、図6、
図8、図9、図10、図11、図12、図13、図16
を用いて説明する。なお、以下数値をx’00、x’0
1などと表すことがあるが、これは16進数による表記
である。
BEST MODE FOR CARRYING OUT THE INVENTION [First Embodiment] The first embodiment of the present invention will be described below with reference to FIGS. 1, 2, 3, 4, and 6.
8, FIG. 9, FIG. 10, FIG. 11, FIG. 12, FIG. 13, and FIG.
Will be explained. The following numerical values are x'00, x'0
It may be expressed as 1, etc., but this is a hexadecimal notation.

【0015】本実施形態1のデータ処理装置で実行され
るプログラム例を、図4に示す。このプログラム例で
は、各命令をニーモニック表記してある。以下、このプ
ログラムの各命令について簡単な説明を付する。なお、
各行の右端[]内に記された値はその命令のコードサイ
ズである。
FIG. 4 shows an example of a program executed by the data processing device of the first embodiment. In this program example, each instruction is represented by mnemonic. Hereinafter, each instruction of this program will be briefly described. In addition,
The value written in the right end [] of each line is the code size of the instruction.

【0016】1行目:SUB 6,R3 (R3レジス
タの値から即値6を減算して、結果をR3レジスタに格
納する。LABEL1:は番地を示している。)[2b
yte] 2行目:MOV R0,@(4,R3) (R0レジス
タの値をR3レジスタと即値4を加算したアドレスのメ
モリにストアする。LABEL2:は番地を示してい
る。)[2byte] 3行目:MOV R1,@(2,R3) (R1レジス
タの値をR3レジスタと即値2を加算したアドレスのメ
モリにストアする。)[2byte] 4行目:MOV R2,@(0,R3) (R2レジス
タの値をR3レジスタと即値0を加算したアドレスのメ
モリにストアする。)[2byte] 5行目:FRTS (反転状態フラグが0のとき無効化
される。反転状態フラグが1のときスタックポインタS
Pの内容をアドレスとしてメモリを読出し、その内容を
プログラムカウンタPCに格納する。スタックポインタ
に2加算しSPを更新する。反転状態フラグを0にリセ
ットする。)[1byte] 6行目:SUB R0,R0 (R0レジスタの値とR
0レジスタの値を減算し、R0レジスタに格納する。)
[1byte] 7行目:処理 (この処理とは、複数命令からなるデー
タ処理であって、R0レジスタ、R1レジスタ、および
R2レジスタを書き換える可能性があるものとする。) 8行目:FJSR @(LABEL2) (スタックポ
インタSPを2減算しSPを更新する。プログラムカウ
ンタPC+2(9行目の次命令を指す)をスタックポイ
ンタSPで示されるメモリアドレスに書き込む。反転状
態フラグを1とし、プログラムカウンタPCをLABE
L2に更新する。) [2byte] 9行目:ADD 6,R3 (R3レジスタの値に即値
6を加算して結果をR3レジスタに格納する。) [2
byte] 10行目:RTS (サブルーチンからリターンする。
スタックポインタSPの内容をアドレスとしてメモリを
読出し、その内容をプログラムカウンタPCに格納す
る。スタックポインタに2加算しSPを更新する。)
[1byte] 上述したFJSR @(LABEL2)とFRTSは、
それぞれサブルーチンをコールする命令と、サブルーチ
ンからリターンする命令である。
First line: SUB 6, R3 (immediate value 6 is subtracted from the value of the R3 register and the result is stored in the R3 register. LABEL1: indicates an address.) [2b
yte] Second line: MOV R0, @ (4, R3) (The value of the R0 register is stored in the memory at the address obtained by adding the R3 register and the immediate value 4. LABEL2: indicates the address.) [2byte] 3 Line: MOV R1, @ (2, R3) (The value of the R1 register is stored in the memory at the address obtained by adding the immediate value 2 to the R3 register.) [2byte] Line 4: MOV R2, @ (0, R3) (The value of the R2 register is stored in the memory at the address obtained by adding 0 to the R3 register.) [2 byte] Fifth line: FRTS (Invalid when the inversion state flag is 0. When the inversion state flag is 1 Stack pointer S
The memory is read by using the content of P as an address and the content is stored in the program counter PC. Add 2 to the stack pointer and update SP. Reset the inversion status flag to 0. ) [1 byte] Line 6: SUB R0, R0 (R0 register value and R
The value of the 0 register is subtracted and stored in the R0 register. )
[1 byte] 7th line: Process (This process is a data process consisting of a plurality of instructions and the R0 register, R1 register, and R2 register may be rewritten.) 8th line: FJSR @ (LABEL2) (The stack pointer SP is decremented by 2 and SP is updated. The program counter PC + 2 (indicating the next instruction on the 9th line) is written to the memory address indicated by the stack pointer SP. The inversion state flag is set to 1 and the program counter is set. LAB to PC
Update to L2. ) [2 byte] Line 9: ADD 6, R3 (immediate value 6 is added to the value of the R3 register and the result is stored in the R3 register.) [2
byte] 10th line: RTS (Returns from the subroutine.
The memory is read by using the contents of the stack pointer SP as an address, and the contents are stored in the program counter PC. Add 2 to the stack pointer and update SP. )
[1 byte] FJSR @ (LABEL2) and FRTS described above are
These are an instruction to call a subroutine and an instruction to return from a subroutine.

【0017】図2は、本実施形態のデータ処理装置の構
成を示すブロック図である。
FIG. 2 is a block diagram showing the configuration of the data processing apparatus of this embodiment.

【0018】このデータ処理装置は、命令読出しステー
ジ(以下、IFステージと称する)、解読ステージ(以
下、DECステージと称する)、演算実行ステージ(以
下、EXステージと称する)の3つのステージからなる
3段パイプライン構造をもつものとする。なお、DEC
ステージにてアドレス計算などの演算を実行することが
ある。
This data processing device is composed of three stages, that is, an instruction reading stage (hereinafter referred to as IF stage), a decoding stage (hereinafter referred to as DEC stage), and an operation execution stage (hereinafter referred to as EX stage). It shall have a staged pipeline structure. In addition, DEC
Operations such as address calculation may be executed at the stage.

【0019】図2において、106は命令が格納された
ROMである。125はROM106に格納された命令
を読み出す命令読出し回路である。108はフェッチし
た命令を格納しておく命令レジスタである。
In FIG. 2, reference numeral 106 is a ROM in which instructions are stored. Reference numeral 125 is an instruction read circuit for reading the instructions stored in the ROM 106. An instruction register 108 stores the fetched instruction.

【0020】123は命令読出し回路125により取り
込まれる命令を解読しデータ処理装置の各部を制御する
命令解読回路である。110は反転状態フラグであり、
0のときは未反転、1のときは反転の状態を示す。10
9はパイプラインの制御を司るパイプライン制御信号で
ある。
An instruction decoding circuit 123 decodes the instruction fetched by the instruction reading circuit 125 and controls each unit of the data processing device. 110 is a reverse state flag,
When it is 0, it is not inverted, and when it is 1, it is inverted. 10
Reference numeral 9 is a pipeline control signal for controlling the pipeline.

【0021】105はレジスタファイルであり、4本の
レジスタR0〜R3とスタックポインタSPとから構成
されている。レジスタ長は16ビットであるものとす
る。102は算術論理演算を行う演算器である。111
は、命令読出し回路125によって読み出される命令の
アドレスを指し示すプログラムカウンタ(以下、PC)
であって、PCに加えPC+2の値も出力できるものと
する。113はプログラムカウンタ111を読み出すP
Cバスである。
A register file 105 is composed of four registers R0 to R3 and a stack pointer SP. The register length is 16 bits. Reference numeral 102 denotes an arithmetic unit that performs arithmetic logic operation. 111
Is a program counter (hereinafter referred to as a PC) indicating the address of the instruction read by the instruction read circuit 125.
In addition to PC, the value of PC + 2 is also outputable. Reference numeral 113 is P for reading the program counter 111.
It is C bus.

【0022】112は、命令解読回路123の制御によ
り定数を発生させる定数発生器である。定数発生器11
2は、オペコードで明示的に示される定数や、命令コー
ドに付加されたd8などの定数を、命令レジスタ108
から命令解読回路123を介して記憶し、パイプライン
制御信号109に応じて発生させる。104は、演算器
102の出力を記憶するRLSTである。103はAB
USからの出力を記憶するOARである。114はRL
ST104とOAR103の出力を選択する第1セレク
タである。115はABUSとPCの出力を選択する第
2セレクタである。122は外部装置とのデータのやり
取りを制御するバスインタフェース回路(以下、BIB
と略す)である。
Reference numeral 112 is a constant generator for generating a constant under the control of the instruction decoding circuit 123. Constant generator 11
2 is a constant which is explicitly indicated by the operation code or a constant such as d8 added to the instruction code, which is stored in the instruction register 108.
Is stored via the instruction decoding circuit 123 and generated in response to the pipeline control signal 109. Reference numeral 104 is an RLST that stores the output of the arithmetic unit 102. 103 is AB
It is an OAR that stores the output from the US. 114 is RL
It is a first selector that selects the output of ST104 and OAR103. A second selector 115 selects the output of ABUS or PC. Reference numeral 122 denotes a bus interface circuit (hereinafter, referred to as BIB) that controls data exchange with an external device.
Abbreviated).

【0023】図3は、図2に示した命令解読回路123
の詳細な構成を示すブロック図である。50は命令レジ
スタ108のオペコードを解読し、命令を無効化するF
RTS命令無効化信号56と命令判定信号52と反転状
態フラグ110を更新、あるいは反転状態フラグ110
を読出しする、命令解読器である。命令解読器50は、
反転状態フラグ110を更新する手段(図示省略)を含
む。反転状態フラグ110は、前述したように、0のと
きは未反転、1のときは反転の状態を示す。
FIG. 3 shows the instruction decoding circuit 123 shown in FIG.
3 is a block diagram showing a detailed configuration of FIG. F decodes the operation code of the instruction register 108 and invalidates the instruction F
The RTS instruction invalidation signal 56, the instruction determination signal 52, and the inversion state flag 110 are updated or the inversion state flag 110 is updated.
Is an instruction decoder that reads out. The instruction decoder 50
It includes means (not shown) for updating the inversion state flag 110. As described above, the inversion state flag 110 indicates a non-inversion state when 0, and an inversion state when 1 is set.

【0024】52は命令解読器50により判定された命
令を示す複数の信号線から構成された命令判定信号であ
る。53はオペランドを制御するオペランド制御回路で
あり、反転状態フラグ110と命令レジスタ108と命
令判定信号52を入力とし、オペランドアクセス制御信
号54とパイプライン制御信号109を出力する。10
9はデータ処理装置のデータフローとパイプライン動作
を制御するパイプライン制御信号であって、オペランド
制御回路53から出力される。54はオペランドへのア
クセスを制御するオペランドアクセス制御信号であり、
複数の信号線からなる。
Reference numeral 52 is an instruction determination signal composed of a plurality of signal lines indicating the instruction determined by the instruction decoder 50. Reference numeral 53 is an operand control circuit for controlling the operand, which receives the inversion state flag 110, the instruction register 108 and the instruction determination signal 52 as inputs, and outputs the operand access control signal 54 and the pipeline control signal 109. 10
Reference numeral 9 is a pipeline control signal for controlling the data flow and pipeline operation of the data processing device, which is output from the operand control circuit 53. 54 is an operand access control signal for controlling access to the operand,
It consists of multiple signal lines.

【0025】オペランドアクセス制御信号54の各信号
は次のとおりである。MRDは、OAR103によって
示されるメモリアドレスからデータを読み出すために、
バスインタフェース回路122に出力されるメモリリー
ド制御信号である。MWTは、OAR103によって示
されるメモリアドレスにデータを書き込むために、バス
インタフェース回路122に出力されるメモリライト制
御信号である。RWTは、レジスタファイル105にデ
ータを格納するために、レジスタファイル105に出力
されるレジスタライト信号である。RRDは、レジスタ
ファイル105からデータを読み出すために、レジスタ
ファイル105に出力されるレジスタリード信号であ
る。SRC[1:0]は2ビットからなり、ソースオペ
ランドを構成するレジスタを示す信号、DEST[1:
0]は同じく2ビットからなり、ディスティネーション
オペランドを構成するレジスタを示す信号である。DI
R信号については後述する。
Each signal of the operand access control signal 54 is as follows. The MRD reads data from the memory address indicated by OAR 103,
This is a memory read control signal output to the bus interface circuit 122. MWT is a memory write control signal that is output to the bus interface circuit 122 to write data at the memory address indicated by the OAR 103. RWT is a register write signal output to the register file 105 to store data in the register file 105. RRD is a register read signal output to the register file 105 to read data from the register file 105. SRC [1: 0] is made up of 2 bits and is a signal indicating a register forming a source operand, DEST [1:].
[0] is also a signal consisting of 2 bits and indicating a register forming a destination operand. DI
The R signal will be described later.

【0026】パイプライン制御信号109とオペランド
アクセス制御信号54とが組み合わされて。データ処理
装置が制御される。なお、FRTS命令無効化信号56
は、本実施形態のデータ処理装置で使用する命令[FR
TS]が解読されるとき、反転状態フラグ110の値に
応じて命令解読器50から出力される(つまり、命令解
読器50がFRTS命令を無効化する手段を含む)。
The pipeline control signal 109 and the operand access control signal 54 are combined. The data processing device is controlled. The FRTS command invalidation signal 56
Is an instruction [FR used in the data processing apparatus of the present embodiment.
When TS] is decoded, it is output from the instruction decoder 50 according to the value of the inversion state flag 110 (that is, the instruction decoder 50 includes means for invalidating the FRTS instruction).

【0027】図1は、本実施形態のデータ処理装置の命
令コード例を示す説明図である。左の欄から順に、命令
タイプ(例えば、R−Rとはレジスタ−レジスタ間の処
理を表す)、命令フォーマット、および命令コードを表
している。
FIG. 1 is an explanatory view showing an example of an instruction code of the data processing apparatus of this embodiment. In order from the left column, the instruction type (for example, RR indicates processing between registers), the instruction format, and the instruction code are shown.

【0028】先の命令フォーマットを図16に示す。命
令フォーマットf1は、4ビットのオペコードと、それ
ぞれ2ビットの2つのレジスタ指定コードとからなる。
命令フォーマットf2は、4ビットのオペコードと、そ
れぞれ2ビットの2つのレジスタ指定コードと、8ビッ
トの即値(imm8)、アドレスのディスプレースメン
ト(d8)、または8ビットの絶対アドレス(abs
8)からなる。命令フォーマットf3は、8ビットのオ
ペコードと、2ビットのレジスタ指定コードと、8ビッ
トの即値(imm8)、アドレスのディスプレースメン
ト(d8)、または8ビットの絶対アドレス(abs
8)からなる。命令フォーマットf4は、8ビットのオ
ペコードと、8ビットの即値(imm8)、アドレスの
ディスプレースメント(d8)、または8ビットの絶対
アドレス(abs8)からなる。命令フォーマットf5
は、は8ビットのオペコードのみからなる命令である。
The above instruction format is shown in FIG. The instruction format f1 is composed of a 4-bit operation code and two 2-bit register designation codes.
The instruction format f2 includes a 4-bit operation code, two 2-bit register designation codes, an 8-bit immediate value (imm8), an address displacement (d8), or an 8-bit absolute address (abs).
It consists of 8). The instruction format f3 includes an 8-bit operation code, a 2-bit register designation code, an 8-bit immediate value (imm8), an address displacement (d8), or an 8-bit absolute address (abs).
It consists of 8). The instruction format f4 includes an 8-bit operation code, an 8-bit immediate value (imm8), an address displacement (d8), or an 8-bit absolute address (abs8). Instruction format f5
Is an instruction consisting of only an 8-bit opcode.

【0029】図1に示した命令コードは、命令レジスタ
108に格納され、その命令コードが命令解読器50に
よって解読され、命令タイプが判定される。実際には、
2ステージで処理される命令タイプ(例えばJSR)や
反転状態フラグ110の値に応じて異なる処理をする命
令タイプ(例えばFRTS)があるため、命令解読器5
0は、命令タイプを判定した結果を命令判定信号52と
して出力する。
The instruction code shown in FIG. 1 is stored in the instruction register 108, and the instruction code is decoded by the instruction decoder 50 to determine the instruction type. actually,
Since there are instruction types that are processed in two stages (for example, JSR) and instruction types that perform different processing depending on the value of the inversion state flag 110 (for example, FRTS), the instruction decoder 5
0 outputs the result of determining the instruction type as the instruction determination signal 52.

【0030】例えば、命令解読器50は、ロード命令で
あることを(そのとき信号LD=1)、ストア命令であ
ることを(そのとき信号ST=1)、レジスタ−レジス
タのデータ転送命令であることを(そのとき信号RR=
1)、レジスタ−即値のデータ転送命令であることを
(そのとき信号R−imm8=1)、サブルーチンをコ
ールする命令であることを(そのとき信号JSR−1=
1、JSR−2=1、FJSR−1=1、あるいはFJ
SR−2=1)、サブルーチンからリターンする命令で
あることを(そのとき信号RTS−1=1、RTS−2
=1、FRTS=1、FRTS−1=1、あるいはFR
TS−2=1)、それぞれ判定する。
For example, the instruction decoder 50 is a register-register data transfer instruction when it is a load instruction (at that time signal LD = 1) and when it is a store instruction (at that time signal ST = 1). (At that time the signal RR =
1) The register-immediate value data transfer instruction (signal R-imm8 = 1 at that time) and the instruction to call a subroutine (signal JSR-1 = at that time)
1, JSR-2 = 1, FJSR-1 = 1, or FJ
SR-2 = 1), an instruction to return from the subroutine (signals RTS-1 = 1, RTS-2 at that time)
= 1, FRTS = 1, FRTS-1 = 1, or FR
TS-2 = 1), respectively.

【0031】本実施形態1では、RTS、JSR、FR
TS、およびFJSRは、DECステージとEXステー
ジがそれぞれ2ステージで処理されるものとし(FRT
Sは無効化される場合があるが)、1回目のステージを
*−1、2回目のステージを*−2と表す。このステー
ジ切り替えは、命令解読器50によって処理されるもの
とする。
In the first embodiment, RTS, JSR, FR
For the TS and FJSR, it is assumed that the DEC stage and the EX stage are each processed in two stages (FRT
The first stage is represented by * -1, and the second stage is represented by * -2, although S may be invalidated. This stage switching shall be processed by the instruction decoder 50.

【0032】次に、本実施形態1によるオペランド制御
回路53の入出力信号を表す説明図を図6に示す。図6
ではRR、LD、STの各行に図示されたオペランドア
クセス制御信号54が、反転状態フラグ110の値が0
か1かによって異なることがわかる。つまり、オペラン
ド制御回路53は、データ転送元と転送先を反転させる
対象命令を記憶するとともに、前記対象命令を反転実行
するための手段を含む構成である。
Next, FIG. 6 is an explanatory diagram showing input / output signals of the operand control circuit 53 according to the first embodiment. Figure 6
Then, the operand access control signal 54 shown in each row of RR, LD, and ST has a value of the inversion state flag 110 of 0.
It turns out that it depends on whether it is 1 or 1. That is, the operand control circuit 53 is configured to include a target instruction for inverting the data transfer source and the transfer destination, and a means for inverting and executing the target instruction.

【0033】オペランドアクセス制御信号54のDIR
は、命令フォーマットf1、f2に該当する命令のre
g1[1:0]とreg2[1:0]で示されるフィー
ルドが、SRC[1:0]とDEST[1:0]のいず
れに該当するかを示す。DIR=1のときは、SRC
[1:0]=reg1[1:0]、DEST[1:0]
=reg2[1:0]に対応する。DIR=0のとき
は、SRC[1:0]=reg2[1:0]、DEST
[1:0]=reg1[1:0]に対応する。DIR=
*とは暗黙的に使用するレジスタを決定する命令であ
る。
DIR of operand access control signal 54
Is the re of the instruction corresponding to the instruction formats f1 and f2.
Indicates whether the fields indicated by g1 [1: 0] and reg2 [1: 0] correspond to SRC [1: 0] or DEST [1: 0]. When DIR = 1, SRC
[1: 0] = reg1 [1: 0], DEST [1: 0]
= Reg2 [1: 0]. When DIR = 0, SRC [1: 0] = reg2 [1: 0], DEST
This corresponds to [1: 0] = reg1 [1: 0]. DIR =
* Is an instruction that implicitly determines the register to be used.

【0034】また、図6のFJSR−2とFRTS−2
では、反転状態フラグ110の列に矢印を示している
が、これは後述するタイミングに従って、命令解読器5
0が、反転状態フラグ110を、矢印の左に記された値
から右に記された値へ変化させることを表す。
Further, FJSR-2 and FRTS-2 shown in FIG.
In the above, an arrow is shown in the column of the inversion state flag 110, but this is in accordance with the timing to be described later.
0 indicates that the inversion state flag 110 is changed from the value marked on the left of the arrow to the value marked on the right.

【0035】以上のように構成された本実施形態1のデ
ータ処理装置の動作を説明する。
The operation of the data processing apparatus of the first embodiment configured as above will be described.

【0036】まず、反転状態フラグ110が0のとき、
図15に示したプログラム例を本実施形態1のデータ処
理装置がどのように処理するかについて、プログラム実
行例1(図8にパイプライン動作を示す)とプログラム
実行例2(図9にパイプライン動作を示す)としてそれ
ぞれ説明する。次に、同じく反転状態フラグ110が0
のとき、サブルーチンをコールする命令(JSR)がど
のように処理されるか、プログラム実行例3(図10に
パイプライン動作を示す)として説明する。
First, when the inversion state flag 110 is 0,
Regarding how the data processing device of the first embodiment processes the program example shown in FIG. 15, a program execution example 1 (pipeline operation is shown in FIG. 8) and a program execution example 2 (pipeline in FIG. 9) are shown. Operation is shown). Next, the inversion state flag 110 is also 0.
At this time, how a command (JSR) that calls a subroutine is processed will be described as a program execution example 3 (a pipeline operation is shown in FIG. 10).

【0037】さらに、図15に示すプログラム例よりも
コードサイズが縮小されたプログラム例(図14)を本
実施形態1のデータ処理装置がどのように処理するか
を、プログラム実行例4(図11、図12、図13にパ
イプライン動作を示す)として説明する。
Furthermore, the program execution example 4 (FIG. 11) shows how the data processing apparatus of the first embodiment processes the program example (FIG. 14) whose code size is smaller than that of the program example shown in FIG. , FIG. 12 and FIG. 13 show the pipeline operation).

【0038】(図15に示すプログラム例の動作説明)
本実施形態1によるデータ処理装置が、図15に示した
プログラム例の前半部分である命令1[SUB 6,R
3]、命令2[MOV R0,@(4,R3)]、命令
3[MOV R1,@(2,R3)]、命令4[MOV
R2,@(0,R3)]、命令5[SUB R0,R
0]を順に処理する動作を、プログラム実行例1として
図8に示す。
(Explanation of the operation of the program example shown in FIG. 15)
The data processing device according to the first embodiment uses the instruction 1 [SUB 6, R, which is the first half of the program example shown in FIG.
3], instruction 2 [MOV R0, @ (4, R3)], instruction 3 [MOV R1, @ (2, R3)], instruction 4 [MOV
R2, @ (0, R3)], instruction 5 [SUB R0, R
0] is sequentially shown in FIG. 8 as a program execution example 1.

【0039】図8は、プログラム実行例1によるパイプ
ライン動作の説明図である。パイプライン動作の説明に
て、以下図示するb'00、b'01、b'10、b'11
とはレジスタ番号を2進数にて記載したものである。な
お、d8とは8ビットからなるディスプレースメントで
ある。以下、時間が経過する順にタイミング毎にその動
作を説明する。タイミングt1のとき反転状態フラグ1
10は0であるものとする。ステージの前半(例えばタ
イミングt11)と後半(タイミングt12)を表すタ
イミングがある。
FIG. 8 is an explanatory diagram of the pipeline operation according to the program execution example 1. In the description of the pipeline operation, b'00, b'01, b'10, and b'11 shown below are shown.
Is the register number in binary notation. Note that d8 is a displacement consisting of 8 bits. Hereinafter, the operation will be described for each timing in order of the passage of time. Inversion state flag 1 at timing t1
It is assumed that 10 is 0. There are timings that represent the first half (for example, timing t11) and the second half (timing t12) of the stage.

【0040】(プログラム実行例1:図15に示すプロ
グラム例の前半部分の説明) <タイミングt1> IFステージ:命令1[SUB 6,R3] タイミングt11:命令1がROM106から読出さ
れ、命令レジスタ108に格納される。
(Program Execution Example 1: Description of First Half of Program Example Shown in FIG. 15) <Timing t1> IF Stage: Instruction 1 [SUB 6, R3] Timing t11: Instruction 1 is read from ROM 106 and instruction register 108 Stored in.

【0041】<タイミングt2> DECステージ:命令1[SUB 6,R3] タイミングt21:命令レジスタ108に格納された命
令1が命令解読回路123により解読される。R−im
m8の命令判定信号52が出力される。反転状態フラグ
110の値0がオペランド制御回路53に入力される。
<Timing t2> DEC stage: Instruction 1 [SUB 6, R3] Timing t21: Instruction 1 stored in the instruction register 108 is decoded by the instruction decoding circuit 123. R-im
The instruction determination signal 52 of m8 is output. The value 0 of the inversion state flag 110 is input to the operand control circuit 53.

【0042】タイミングt22: 命令解読回路123
よりパイプライン制御信号109が出力される。
Timing t22: instruction decoding circuit 123
Then, the pipeline control signal 109 is output.

【0043】IFステージ:命令2[MOV R0,@
(4,R3)] タイミングt21:命令2がROM106から読出さ
れ、命令レジスタ108に格納される。
IF stage: Instruction 2 [MOV R0, @
(4, R3)] Timing t21: Instruction 2 is read from the ROM 106 and stored in the instruction register 108.

【0044】<タイミングt3> EXステージ:命令1[SUB 6,R3] タイミングt31: ABUSにDEST[1:0]で
示されるレジスタの値を読み出す(RRDによる制
御)。CBUSにimm8(このとき6)が定数発生器
112から読み出される。
<Timing t3> EX stage: Instruction 1 [SUB 6, R3] Timing t31: Read the value of the register indicated by DEST [1: 0] in ABUS (control by RRD). Imm8 (6 at this time) is read from the constant generator 112 in CBUS.

【0045】タイミングt32:ABUSとCBUSに
読み出された値が演算器102で減算された後、RLS
T104からABUSを介してDEST[1:0]で示
されるレジスタに格納される(RWTによる制御)。
Timing t32: After the values read to ABUS and CBUS are subtracted by the arithmetic unit 102, RLS
It is stored in the register indicated by DEST [1: 0] from T104 via ABUS (control by RWT).

【0046】DECステージ:命令2[MOV R0,
@(4,R3)] タイミングt31:命令レジスタ108に格納された命
令2が命令解読回路123により解読される。STの命
令判定信号52が出力される。反転状態フラグ110の
値0がオペランド制御回路53に入力される。
DEC stage: instruction 2 [MOV R0,
@ (4, R3)] Timing t31: The instruction 2 stored in the instruction register 108 is decoded by the instruction decoding circuit 123. The ST instruction determination signal 52 is output. The value 0 of the inversion state flag 110 is input to the operand control circuit 53.

【0047】タイミングt32:命令解読回路123よ
りパイプライン制御信号109が出力される。BBUS
にDEST[1:0]で示されるレジスタの値が読み出
される(RRDによる制御)。CBUSにd8(このと
き4)が定数発生器112より読み出される。
Timing t32: The pipeline control signal 109 is output from the instruction decoding circuit 123. BBUS
The value of the register indicated by DEST [1: 0] is read (control by RRD). D8 (4 at this time) is read from CBUS to the constant generator 112.

【0048】IFステージ:命令3[MOV R1,@
(2,R3)] タイミングt31:命令3がROM106から読出さ
れ、命令レジスタ108に格納される。
IF stage: Instruction 3 [MOV R1, @
(2, R3)] Timing t31: Instruction 3 is read from the ROM 106 and stored in the instruction register 108.

【0049】<タイミングt4> EXステージ:命令2[MOV R0,@(4,R
3)] タイミングt41:BBUSとCBUSにより読み出さ
れた値が加算された後、RLST104からABUSを
介してOAR103に格納される。
<Timing t4> EX stage: Instruction 2 [MOV R0, @ (4, R
3)] Timing t41: After the values read by BBUS and CBUS are added, the values are stored in the OAR 103 from the RLST 104 via ABUS.

【0050】タイミングt42:ABUSにSRC
[1:0]で示されるレジスタの値が読み出され、第1
セレクタ114を介してOAR103で示されるメモリ
アドレスにストアされる(MWTによる制御)。
Timing t42: SRC at ABUS
The value of the register indicated by [1: 0] is read out, and the first
It is stored in the memory address indicated by OAR 103 via the selector 114 (control by MWT).

【0051】DECステージ:命令3[MOV R1,
@(2,R3)] タイミングt41:命令レジスタ108に格納された命
令3が命令解読回路123により解読される。STの命
令判定信号52が出力される。反転状態フラグ110の
値0がオペランド制御回路53に入力される。
DEC stage: instruction 3 [MOV R1,
@ (2, R3)] Timing t41: The instruction decoding circuit 123 decodes the instruction 3 stored in the instruction register 108. The ST instruction determination signal 52 is output. The value 0 of the inversion state flag 110 is input to the operand control circuit 53.

【0052】タイミングt42:命令解読回路123よ
りパイプライン制御信号109が出力される。BBUS
にDEST[1:0]で示されるレジスタの値が読み出
される(RRDによる制御)。CBUSにd8(このと
き2)が定数発生器112より読み出される。
Timing t42: The pipeline control signal 109 is output from the instruction decoding circuit 123. BBUS
The value of the register indicated by DEST [1: 0] is read (control by RRD). D8 (2 at this time) is read from CBUS to the constant generator 112.

【0053】IFステージ:命令4[MOV R2,@
(0,R3)] タイミングt41:命令4がROM106から読出さ
れ、命令レジスタ108に格納される。
IF stage: Instruction 4 [MOV R2, @
(0, R3)] Timing t41: Instruction 4 is read from ROM 106 and stored in instruction register 108.

【0054】<タイミングt5> EXステージ:命令3[MOV R1,@(2,R
3)] タイミングt51:BBUSとCBUSにより読み出さ
れた値が加算された後、RLST104からABUSを
介してOAR103に格納される。
<Timing t5> EX stage: Instruction 3 [MOV R1, @ (2, R
3)] Timing t51: After the values read by BBUS and CBUS are added, the values are stored in the OAR 103 from the RLST 104 via ABUS.

【0055】タイミングt52:ABUSにSRC
[1:0]で示されるレジスタの値が読み出され、第1
セレクタ114を介してOAR103で示されるメモリ
アドレスにストアされる(MWTによる制御)。
Timing t52: SRC to ABUS
The value of the register indicated by [1: 0] is read out, and the first
It is stored in the memory address indicated by OAR 103 via the selector 114 (control by MWT).

【0056】DECステージ:命令4[MOV R2,
@(0,R3)] タイミングt51:命令レジスタ108に格納された命
令4が命令解読回路123により解読される。STの命
令判定信号52が出力される。反転状態フラグ110の
値0がオペランド制御回路53に入力される。
DEC stage: instruction 4 [MOV R2,
@ (0, R3)] Timing t51: The instruction decoding circuit 123 decodes the instruction 4 stored in the instruction register 108. The ST instruction determination signal 52 is output. The value 0 of the inversion state flag 110 is input to the operand control circuit 53.

【0057】タイミングt52:命令解読回路123よ
りパイプライン制御信号109が出力される。BBUS
にDEST[1:0]で示されるレジスタの値が読み出
される(RRDによる制御)。CBUSにd8(このと
き0)が定数発生器112より読み出される。
Timing t52: The pipeline control signal 109 is output from the instruction decoding circuit 123. BBUS
The value of the register indicated by DEST [1: 0] is read (control by RRD). D8 (0 at this time) is read from the constant generator 112 in CBUS.

【0058】IFステージ:命令5[SUB R0,R
0] タイミングt51:命令5がROM106から読出さ
れ、命令レジスタ108に格納される。
IF stage: Instruction 5 [SUB R0, R
0] Timing t51: Instruction 5 is read from ROM 106 and stored in instruction register 108.

【0059】<タイミングt6> EXステージ:命令4[MOV R2,@(0,R
3)] タイミングt61:BBUSとCBUSにより読み出さ
れた値が加算された後、RLST104からABUSを
介してOAR103に格納される。
<Timing t6> EX stage: Instruction 4 [MOV R2, @ (0, R
3)] Timing t61: The values read by BBUS and CBUS are added, and then stored in the OAR 103 from the RLST 104 via ABUS.

【0060】タイミングt62:ABUSにSRC
[1:0]で示されるレジスタの値が読み出され、第1
セレクタ114を介してOAR103で示されるメモリ
アドレスにストアされる(MWTによる制御)。
Timing t62: SRC to ABUS
The value of the register indicated by [1: 0] is read out, and the first
It is stored in the memory address indicated by OAR 103 via the selector 114 (control by MWT).

【0061】DECステージ:命令5[SUB R0,
R0] タイミングt61:命令レジスタ108に格納された命
令5が命令解読回路123により解読される。R−Rの
命令判定信号52が出力される。反転状態フラグ110
の値0がオペランド制御回路53に入力される。
DEC stage: instruction 5 [SUB R0,
R0] Timing t61: The instruction decoding circuit 123 decodes the instruction 5 stored in the instruction register 108. The RR command determination signal 52 is output. Inversion state flag 110
The value 0 of 0 is input to the operand control circuit 53.

【0062】タイミングt62:命令解読回路123よ
りパイプライン制御信号109が出力される。
Timing t62: The instruction decoding circuit 123 outputs the pipeline control signal 109.

【0063】IFステージ:命令6[NOP] タイミングt61:命令6がROM106から読出さ
れ、命令レジスタ108に格納される。NOPは何も実
行されずに次の命令に進む。
IF stage: Instruction 6 [NOP] Timing t61: Instruction 6 is read from ROM 106 and stored in instruction register 108. NOP does nothing and proceeds to the next instruction.

【0064】<タイミングt7> EXステージ:命令5[SUB R0,R0] タイミングt71:ABUSにSRC[1:0]で示さ
れるレジスタの値が読み出される(RRDによる制
御)。BBUSにDEST[1:0]で示されるレジス
タの値が読み出される(RRDによる制御)。
<Timing t7> EX stage: Instruction 5 [SUB R0, R0] Timing t71: The value of the register indicated by SRC [1: 0] is read at ABUS (control by RRD). The value of the register indicated by DEST [1: 0] is read into BBUS (control by RRD).

【0065】タイミングt72:ABUSとBBUSに
読み出された値が演算器102で減算された後、RLS
T104からABUSを介してDEST[1:0]で示
されるレジスタに格納される(RWTによる制御)。
Timing t72: RLS after the values read out to ABUS and BBUS are subtracted by the arithmetic unit 102.
It is stored in the register indicated by DEST [1: 0] from T104 via ABUS (control by RWT).

【0066】DECステージ:命令6[NOP] タイミングt71:何も解読されずに次のDECステー
ジに進む。
DEC stage: instruction 6 [NOP] timing t71: nothing is decoded and the process proceeds to the next DEC stage.

【0067】タイミングt72:何も解読されずに次の
DECステージに進む。
Timing t72: Nothing is decoded and the process proceeds to the next DEC stage.

【0068】IFステージ:命令7[NOP] タイミングt71:命令7がROM106から読出さ
れ、命令レジスタ108に格納される。NOPは何も実
行されずに次の命令に進む。
IF stage: Instruction 7 [NOP] Timing t71: Instruction 7 is read from ROM 106 and stored in instruction register 108. NOP does nothing and proceeds to the next instruction.

【0069】上述したとおりに、図15に示したプログ
ラム例の前半部分が、データ処理される。
As described above, the first half of the program example shown in FIG. 15 is data-processed.

【0070】次に、本実施形態1によるデータ処理装置
が、図15に示したプログラム例の後半部分である命令
1[MOV @(4,R3),R0]、命令2[MOV
@(2,R3),R1]、命令3[MOV @(0,
R3),R2]、命令4[ADD 6,R3]、命令5
[RTS]を順に処理する動作を、プログラム実行例2
として示す。図9は、プログラム実行例2によるパイプ
ライン動作の説明図である。以下、時間が経過する順に
タイミング毎にその動作を説明する。ここで、タイミン
グt1のとき反転状態フラグ110の値は0であるもの
とする。
Next, the data processing apparatus according to the first embodiment uses the instruction 1 [MOV @ (4, R3), R0] and the instruction 2 [MOV, which are the latter half of the program example shown in FIG.
@ (2, R3), R1], instruction 3 [MOV @ (0,
R3), R2], instruction 4 [ADD 6, R3], instruction 5
Program execution example 2 for the operation of sequentially processing [RTS]
Show as. FIG. 9 is an explanatory diagram of the pipeline operation according to the program execution example 2. Hereinafter, the operation will be described for each timing in order of the passage of time. Here, it is assumed that the value of the inversion state flag 110 is 0 at the timing t1.

【0071】(プログラム実行例2:図15に示すプロ
グラム例の後半部分) <タイミングt1> IFステージ:命令1[MOV @(4,R3),R
0] タイミングt11:命令1がROM106から読出さ
れ、命令レジスタ108に格納される。
(Program execution example 2: the latter half of the program example shown in FIG. 15) <Timing t1> IF stage: instruction 1 [MOV @ (4, R3), R
0] Timing t11: Instruction 1 is read from ROM 106 and stored in instruction register 108.

【0072】<タイミングt2> DECステージ:命令1[MOV @(4,R3),R
0] タイミングt21:命令レジスタ108に格納された命
令1が命令解読回路123により解読される。LDの命
令判定信号52が出力される。反転状態フラグ110の
値0がオペランド制御回路53に入力される。
<Timing t2> DEC stage: instruction 1 [MOV @ (4, R3), R
0] Timing t21: The instruction decoding circuit 123 decodes the instruction 1 stored in the instruction register 108. The LD command determination signal 52 is output. The value 0 of the inversion state flag 110 is input to the operand control circuit 53.

【0073】タイミングt22:命令解読回路123よ
りパイプライン制御信号109が出力される。BBUS
にSRC[1:0]で示されるレジスタの値が読み出さ
れる(RRDによる制御)。CBUSにd8(このとき
4)が定数発生器112より読み出される。
Timing t22: The pipeline control signal 109 is output from the instruction decoding circuit 123. BBUS
The value of the register indicated by SRC [1: 0] is read out (control by RRD). D8 (4 at this time) is read from CBUS to the constant generator 112.

【0074】IFステージ:命令2[MOV @(2,
R3),R1] タイミングt21:命令2がROM106から読出さ
れ、命令レジスタ108に格納される。
IF stage: Instruction 2 [MOV @ (2,
R3), R1] Timing t21: Instruction 2 is read from ROM 106 and stored in instruction register 108.

【0075】<タイミングt3> EXステージ:命令1[MOV @(4,R3),R
0] タイミングt31:BBUSとCBUSにより読み出さ
れた値が加算された後、RLST104からABUSを
介してOAR103に格納される。タイミングt32:
第1セレクタ114を介してOAR103で示されるメ
モリアドレスからデータがロードされる(MRDによる
制御)。ロードされたデータはABUSを介してDES
T[1:0]で示されるレジスタに格納される(RWT
による制御)。
<Timing t3> EX stage: Instruction 1 [MOV @ (4, R3), R
0] Timing t31: After the values read by BBUS and CBUS are added, the values are stored in the OAR 103 via the ABUS from the RLST 104. Timing t32:
Data is loaded from the memory address indicated by the OAR 103 via the first selector 114 (control by MRD). The loaded data is DES via ABUS
Stored in the register indicated by T [1: 0] (RWT
Control).

【0076】DECステージ:命令2[MOV @
(2,R3),R1] タイミングt31:命令レジスタ108に格納された命
令2が命令解読回路123により解読される。LDの命
令判定信号52が出力される。反転状態フラグ110の
値0がオペランド制御回路53に入力される。
DEC stage: instruction 2 [MOV @
(2, R3), R1] Timing t31: The instruction decoding circuit 123 decodes the instruction 2 stored in the instruction register 108. The LD command determination signal 52 is output. The value 0 of the inversion state flag 110 is input to the operand control circuit 53.

【0077】タイミングt32:命令解読回路123よ
りパイプライン制御信号109が出力される。BBUS
にSRC[1:0]で示されるレジスタの値が読み出さ
れる(RRDによる制御)。CBUSにd8(このとき
2)が定数発生器112より読み出される。
Timing t32: The instruction decoding circuit 123 outputs the pipeline control signal 109. BBUS
The value of the register indicated by SRC [1: 0] is read out (control by RRD). D8 (2 at this time) is read from CBUS to the constant generator 112.

【0078】IFステージ:命令3[MOV @(0,
R3),R2] タイミングt31:命令3がROM106から読出さ
れ、命令レジスタ108に格納される。
IF stage: Instruction 3 [MOV @ (0,
R3), R2] Timing t31: Instruction 3 is read from ROM 106 and stored in instruction register 108.

【0079】<タイミングt4> EXステージ:命令2[MOV @(2,R3),R
1] タイミングt41:BBUSとCBUSにより読み出さ
れた値が加算された後、RLST104からABUSを
介してOAR103に格納される。
<Timing t4> EX stage: Instruction 2 [MOV @ (2, R3), R
1] Timing t41: After the values read by BBUS and CBUS are added, the values are stored in the OAR 103 from the RLST 104 via ABUS.

【0080】タイミングt42:第1セレクタ114を
介してOAR103で示されるメモリアドレスからデー
タがロードされる(MRDによる制御)。ロードされた
データはABUSを介してDEST[1:0]で示され
るレジスタに格納される(RWTによる制御)。
Timing t42: Data is loaded from the memory address indicated by the OAR 103 via the first selector 114 (control by MRD). The loaded data is stored in the register indicated by DEST [1: 0] via ABUS (control by RWT).

【0081】DECステージ:命令3[MOV @
(0,R3),R2] タイミングt41:命令レジスタ108に格納された命
令3が命令解読回路123により解読される。LDの命
令判定信号52が出力される。反転状態フラグ110の
値0がオペランド制御回路53に入力される。
DEC stage: instruction 3 [MOV @
(0, R3), R2] Timing t41: The instruction decoding circuit 123 decodes the instruction 3 stored in the instruction register 108. The LD command determination signal 52 is output. The value 0 of the inversion state flag 110 is input to the operand control circuit 53.

【0082】タイミングt42:命令解読回路123よ
りパイプライン制御信号109が出力される。BBUS
にSRC[1:0]で示されるレジスタの値が読み出さ
れる(RRDによる制御)。CBUSにd8(このとき
0)が定数発生器112より読み出される。
Timing t42: The instruction decoding circuit 123 outputs the pipeline control signal 109. BBUS
The value of the register indicated by SRC [1: 0] is read out (control by RRD). D8 (0 at this time) is read from the constant generator 112 in CBUS.

【0083】IFステージ:命令4[ADD 6,R
3] タイミングt41:命令4がROM106から読出さ
れ、命令レジスタ108に格納される。
IF stage: Instruction 4 [ADD 6, R
3] Timing t41: Instruction 4 is read from ROM 106 and stored in instruction register 108.

【0084】<タイミングt5> EXステージ:命令3[MOV @(0,R3),R
2] タイミングt51:BBUSとCBUSにより読み出さ
れた値が加算された後、RLST104からABUSを
介してOAR103に格納される。
<Timing t5> EX stage: Instruction 3 [MOV @ (0, R3), R
2] Timing t51: After the values read by BBUS and CBUS are added, the values are stored in the OAR 103 from the RLST 104 via ABUS.

【0085】タイミングt52:第1セレクタ114を
介してOAR103で示されるメモリアドレスからデー
タがロードされる(MRDによる制御)。ロードされた
データはABUSを介してDEST[1:0]で示され
るレジスタに格納される(RWTによる制御)。
Timing t52: Data is loaded from the memory address indicated by the OAR 103 via the first selector 114 (control by MRD). The loaded data is stored in the register indicated by DEST [1: 0] via ABUS (control by RWT).

【0086】DECステージ:命令4[ADD 6,R
3] タイミングt51:命令レジスタ108に格納された命
令4が命令解読回路123により解読される。R−im
m8の命令判定信号52が出力される。反転状態フラグ
110の値0がオペランド制御回路53に入力される。
DEC stage: instruction 4 [ADD 6, R
3] Timing t51: The instruction decoding circuit 123 decodes the instruction 4 stored in the instruction register 108. R-im
The instruction determination signal 52 of m8 is output. The value 0 of the inversion state flag 110 is input to the operand control circuit 53.

【0087】タイミングt52: 命令解読回路123
よりパイプライン制御信号109が出力される。
Timing t52: instruction decoding circuit 123
Then, the pipeline control signal 109 is output.

【0088】IFステージ:命令5[RTS] タイミングt51:命令5がROM106から読出さ
れ、命令レジスタ108に格納される。
IF stage: Instruction 5 [RTS] Timing t51: Instruction 5 is read from ROM 106 and stored in instruction register 108.

【0089】<タイミングt6> EXステージ:命令4[ADD 6,R3] タイミングt61:ABUSにDEST[1:0]で示
されるレジスタの値を読み出す(RRDによる制御)。
CBUSにimm8(このとき6)が定数発生器112
から読み出される。
<Timing t6> EX stage: Instruction 4 [ADD 6, R3] Timing t61: The value of the register indicated by DEST [1: 0] is read in ABUS (control by RRD).
In CBUS, imm8 (6 at this time) is the constant generator 112.
Read from.

【0090】タイミングt62:ABUSとCBUSに
読み出された値が演算器102で加算された後、RLS
T104からABUSを介してDEST[1:0]で示
されるレジスタに格納される(RWTによる制御)。
Timing t62: After the values read out to ABUS and CBUS are added by the arithmetic unit 102, RLS
It is stored in the register indicated by DEST [1: 0] from T104 via ABUS (control by RWT).

【0091】DECステージ:命令5[RTS−1] タイミングt61:命令レジスタ108に格納された命
令5が命令解読回路123により解読される。RTS−
1の命令判定信号52が出力される。反転状態フラグ1
10の値0がオペランド制御回路53に入力される。
DEC stage: Instruction 5 [RTS-1] Timing t61: Instruction 5 stored in the instruction register 108 is decoded by the instruction decoding circuit 123. RTS-
The instruction determination signal 52 of 1 is output. Inversion status flag 1
The value 0 of 10 is input to the operand control circuit 53.

【0092】タイミングt62: 命令解読回路123
よりパイプライン制御信号109が出力される。
Timing t62: instruction decoding circuit 123
Then, the pipeline control signal 109 is output.

【0093】IFステージ:スキップ タイミングt61:RTS−1の命令判定信号52によ
り命令フェッチがスキップされる。
IF stage: Skip timing t61: Instruction fetch is skipped by the instruction determination signal 52 of RTS-1.

【0094】<タイミングt7> EXステージ:命令5[RTS−1] タイミングt71:BBUSに読み出されたSPの値が
演算器102をスルーされた後,RLST104からA
BUSを介してOAR103に格納される。
<Timing t7> EX stage: Instruction 5 [RTS-1] Timing t71: SP value read in BBUS is passed through the arithmetic unit 102, and then RLST 104 outputs A.
It is stored in the OAR 103 via the BUS.

【0095】タイミングt72:第1セレクタ114を
介してOAR103で示されるメモリアドレスからデー
タがロードされる(MRDによる制御)。ロードされた
データはABUSを介してPCに格納される。
Timing t72: Data is loaded from the memory address indicated by the OAR 103 via the first selector 114 (control by MRD). The loaded data is stored in the PC via ABUS.

【0096】DECステージ:命令5[RTS−2] タイミングt71:命令レジスタ108に格納された命
令5が命令解読回路123により解読される。RTS−
2の命令判定信号52が出力される。反転状態フラグ1
10の値0がオペランド制御回路53に入力される。
DEC stage: Instruction 5 [RTS-2] Timing t71: Instruction 5 stored in the instruction register 108 is decoded by the instruction decoding circuit 123. RTS-
The instruction determination signal 52 of 2 is output. Inversion status flag 1
The value 0 of 10 is input to the operand control circuit 53.

【0097】タイミングt72: 命令解読回路123
よりパイプライン制御信号109が出力される。BBU
SにSPの値が読み出される(RRDによる制御)。C
BUSにx'02が定数発生器112から読み出され
る。
Timing t72: instruction decoding circuit 123
Then, the pipeline control signal 109 is output. BBU
The value of SP is read into S (control by RRD). C
X'02 is read from the constant generator 112 in BUS.

【0098】IFステージ:命令6[Next(次命
令)] タイミングt71:命令6がROM106から読出さ
れ、命令レジスタ108に格納される。
IF stage: instruction 6 [Next (next instruction)] Timing t71: instruction 6 is read from ROM 106 and stored in instruction register 108.

【0099】<タイミングt8> EXステージ:命令5[RTS−2] タイミングt81:BBUSとCBUSに読み出された
値が加算された後,RLST104からABUSを介し
て、SPに格納される(RWTによる制御)。
<Timing t8> EX stage: Instruction 5 [RTS-2] Timing t81: After the read values are added to BBUS and CBUS, they are stored in SP from RLST 104 via ABUS (by RWT). control).

【0100】タイミングt82:次命令による処理がな
される。
Timing t82: Processing by the next instruction is performed.

【0101】DECステージ:命令6[Next(次命
令)] タイミングt81:次命令による処理がなされる。
DEC stage: instruction 6 [Next (next instruction)] Timing t81: Processing by the next instruction is performed.

【0102】タイミングt82:次命令による処理がな
される。
Timing t82: Processing by the next instruction is performed.

【0103】IFステージ:命令7[NOP] タイミングt81:命令7がROM106から読出さ
れ、命令レジスタ108に格納される。NOPは何も実
行されずに次の命令に進む。
IF stage: Instruction 7 [NOP] Timing t81: Instruction 7 is read from ROM 106 and stored in instruction register 108. NOP does nothing and proceeds to the next instruction.

【0104】以上のプログラム実行例1,2のとおり、
本実施形態1のデータ処理装置は、反転状態フラグ11
0が0のとき、図15に示したプログラム例を処理す
る。
As shown in the above program execution examples 1 and 2,
The data processing device according to the first exemplary embodiment uses the inversion state flag 11
When 0 is 0, the program example shown in FIG. 15 is processed.

【0105】次に、同じく反転状態フラグ110が0の
とき、サブルーチンをコールする命令1[JSR @
(LABEL1)]がどのように処理されるか、プログ
ラム実行例3(図10にパイプライン動作図)で説明す
る。
Similarly, when the inversion state flag 110 is 0, the instruction 1 [JSR @
(LABEL1)] will be processed in a program execution example 3 (a pipeline operation diagram in FIG. 10).

【0106】ここで、JSR @(LABEL1)とい
う命令による動作は次のとおりである。まず、スタック
ポインタSPを2減算しSPを更新する。プログラムカ
ウンタ111(PC+2)をスタックポインタSPで示
されるメモリアドレスに書き込む。プログラムカウンタ
111(PC)を分岐先の番地に更新する。オペランド
反転状態を0とする。
Here, the operation by the command JSR @ (LABEL1) is as follows. First, the stack pointer SP is subtracted by 2 and SP is updated. The program counter 111 (PC + 2) is written to the memory address indicated by the stack pointer SP. The program counter 111 (PC) is updated to the branch destination address. The operand inversion state is set to 0.

【0107】図10は、プログラム実行例3によるパイ
プライン動作の説明図である。以下、時間が経過する順
にタイミング毎にその動作を説明する。
FIG. 10 is an explanatory diagram of the pipeline operation according to the program execution example 3. Hereinafter, the operation will be described for each timing in order of the passage of time.

【0108】(プログラム実行例3) <タイミングt1> IFステージ:命令1[JSR @(LABEL1)] タイミングt11:命令1がROM106から読出さ
れ、命令レジスタ108に格納される。
(Program Execution Example 3) <Timing t1> IF stage: Instruction 1 [JSR @ (LABEL1)] Timing t11: Instruction 1 is read from the ROM 106 and stored in the instruction register 108.

【0109】<タイミングt2> DECステージ:命令1[JSR−1] タイミングt21:命令レジスタ108に格納された命
令1が命令解読回路123により解読される。JSR−
1の命令判定信号52が出力される。反転状態フラグ1
10の値0がオペランド制御回路53に入力される。
<Timing t2> DEC Stage: Instruction 1 [JSR-1] Timing t21: Instruction 1 stored in the instruction register 108 is decoded by the instruction decoding circuit 123. JSR-
The instruction determination signal 52 of 1 is output. Inversion status flag 1
The value 0 of 10 is input to the operand control circuit 53.

【0110】タイミングt22:命令解読回路123よ
りパイプライン制御信号109が出力される。BBUS
にSPの値が読み出される(RRDによる制御)。CB
USにx'02が定数発生器112より読み出される。
Timing t22: The instruction decoding circuit 123 outputs the pipeline control signal 109. BBUS
The SP value is read out (control by RRD). CB
X'02 is read out from the constant generator 112 in the US.

【0111】IFステージ:スキップ タイミングt21:JSR−1の命令判定信号52によ
り命令フェッチがスキップされる。
IF stage: Skip timing t21: Instruction fetch is skipped by the instruction determination signal 52 of JSR-1.

【0112】<タイミングt3> EXステージ:命令1[JSR−1] タイミングt31:BBUSとCBUSにより読み出さ
れた値が減算された後、RLST104からABUSを
介してOAR103に格納される。さらにABUSを介
してSPにRLST104の値が格納される(RWTに
よる制御)。
<Timing t3> EX stage: Instruction 1 [JSR-1] Timing t31: After the value read by BBUS and CBUS is subtracted, it is stored in OAR 103 from RLST 104 via ABUS. Further, the value of RLST 104 is stored in SP via ABUS (control by RWT).

【0113】タイミングt32:第1セレクタ114を
介してOAR103で示されるメモリアドレスにデータ
がストアされる(MWTによる制御)。
Timing t32: Data is stored in the memory address indicated by the OAR 103 via the first selector 114 (control by MWT).

【0114】DECステージ:命令1[JSR−2] タイミングt31:命令レジスタ108に格納された命
令1が命令解読回路123により解読される。JSR−
2の命令判定信号52が出力される。反転状態フラグ1
10の値0がオペランド制御回路53に入力される。
DEC stage: Instruction 1 [JSR-2] Timing t31: Instruction 1 stored in the instruction register 108 is decoded by the instruction decoding circuit 123. JSR-
The instruction determination signal 52 of 2 is output. Inversion status flag 1
The value 0 of 10 is input to the operand control circuit 53.

【0115】命令解読回路123よりパイプライン制御
信号109が出力される。BBUSにプログラムカウン
タ111からPC+2の値が読み出される。CBUSに
d8(このとき、PC+2+d8がLABEL1番地と
なる相対値)が定数発生器112より読み出される。
The pipeline control signal 109 is output from the instruction decoding circuit 123. The value of PC + 2 is read from the program counter 111 to BBUS. D8 (at this time, PC + 2 + d8 is a relative value where LABEL1 is the address) is read from the constant generator 112.

【0116】タイミングt32:BBUSとCBUSの
値が加算された後、RLST104からABUSを介し
てPCに格納される。
Timing t32: After the values of BBUS and CBUS are added, the values are stored in the PC from RLST 104 via ABUS.

【0117】IFステージ:命令2[Next(次命
令)] タイミングt31:命令3がROM106から読出さ
れ、命令レジスタ108に格納される。
IF stage: Instruction 2 [Next (Next instruction)] Timing t31: Instruction 3 is read from ROM 106 and stored in instruction register 108.

【0118】<タイミングt4> EXステージ:命令1[JSR−2] タイミングt4:何も実行されない。<Timing t4> EX stage: Instruction 1 [JSR-2] Timing t4: nothing is executed.

【0119】DECステージ:命令2[Next(次命
令)] タイミングt41:次命令による処理がなされる。
DEC stage: instruction 2 [Next (next instruction)] Timing t41: Processing by the next instruction is performed.

【0120】タイミングt42:次命令による処理がな
される。
Timing t42: Processing by the next instruction is performed.

【0121】IFステージ:命令3[NOP] タイミングt41:命令3がROM106から読出さ
れ、命令レジスタ108に格納される。NOPは何も実
行されずに次の命令に進む。
IF stage: Instruction 3 [NOP] Timing t41: Instruction 3 is read from ROM 106 and stored in instruction register 108. NOP does nothing and proceeds to the next instruction.

【0122】以上、反転状態フラグ110が0のとき、
サブルーチンをコールする命令(JSR)が本実施形態
1のデータ処理装置でどのように処理されるか説明し
た。上述したとおり、先のプログラム実行例1とプログ
ラム実行例2の説明と合わせて、本実施形態1のデータ
処理装置によれば、図15に示したプログラム例を実行
可能である。
As described above, when the inverted state flag 110 is 0,
It has been described how the instruction (JSR) for calling the subroutine is processed by the data processing device according to the first embodiment. As described above, the data processing apparatus according to the first embodiment can execute the program example shown in FIG. 15 together with the description of the program execution example 1 and the program execution example 2 described above.

【0123】次に、本発明の機構を使って、図15に示
したプログラム例に比べてコードサイズが3バイト縮小
されたプログラム例(図4)を、本実施形態1のデータ
処理装置がどのように処理するかを説明する。
Next, by using the mechanism of the present invention, the data processing apparatus of the first embodiment will find a program example (FIG. 4) in which the code size is reduced by 3 bytes as compared with the program example shown in FIG. Will be described.

【0124】まず、プログラム実行例4として、反転状
態フラグ110が0であるとき、FRTSがFRTS命
令無効化信号56の出力によって無効化され、反転状態
フラグ110を変更しないで次命令の処理が継続される
動作を説明する。具体的には本実施形態1によるデータ
処理装置が、命令1[MOV R2,@(0,R
3)]、命令2[FRTS]、および命令3[SUB
R0,R0]を順に処理する動作である。なお、図4の
1行目から4行目に配置された命令1[SUB 6,R
3]、命令2[MOV R0,@(4,R3)]、命令
3[MOV R1,@(2,R3)]、命令4[MOV
R2,@(0,R3)]を処理する動作に関しては、
すでにプログラム実行例1で図8(タイミングt1〜t
6)を用いて説明されているので省略する。図11は、
プログラム実行例4によるパイプライン動作の説明図で
ある。以下、時間が経過する順にタイミング毎にその動
作を説明する。なお、反転状態フラグ110はタイミン
グt1のとき0である。
First, as the program execution example 4, when the inversion state flag 110 is 0, FRTS is invalidated by the output of the FRTS instruction invalidation signal 56, and the processing of the next instruction is continued without changing the inversion state flag 110. The operation performed will be described. Specifically, the data processing device according to the first embodiment uses the instruction 1 [MOV R2, @ (0, R
3)], instruction 2 [FRTS], and instruction 3 [SUB
R0, R0] are sequentially processed. It should be noted that the instruction 1 [SUB 6, R] arranged in the first to fourth lines in FIG.
3], instruction 2 [MOV R0, @ (4, R3)], instruction 3 [MOV R1, @ (2, R3)], instruction 4 [MOV
Regarding the operation of processing R2, @ (0, R3)],
FIG. 8 (timings t1 to t
Since it has been described using 6), it will be omitted. FIG. 11 shows
FIG. 8 is an explanatory diagram of pipeline operation according to program execution example 4. Hereinafter, the operation will be described for each timing in order of the passage of time. The inversion state flag 110 is 0 at the timing t1.

【0125】(プログラム実行例4:FRTS命令の無
効化) <タイミングt1> IFステージ:命令1[MOV R2,@(0,R
3)] タイミングt11:命令1がROM106から読出さ
れ、命令レジスタ108に格納される。
(Program execution example 4: invalidation of FRTS instruction) <Timing t1> IF stage: instruction 1 [MOV R2, @ (0, R
3)] Timing t11: Instruction 1 is read from ROM 106 and stored in instruction register 108.

【0126】<タイミングt2> DECステージ:命令1[MOV R2,@(0,R
3)] タイミングt21:命令レジスタ108に格納された命
令1が命令解読回路123により解読される。STの命
令判定信号52が出力される。反転状態フラグ110の
値0がオペランド制御回路53に入力される。
<Timing t2> DEC stage: instruction 1 [MOV R2, @ (0, R
3)] Timing t21: The instruction 1 stored in the instruction register 108 is decoded by the instruction decoding circuit 123. The ST instruction determination signal 52 is output. The value 0 of the inversion state flag 110 is input to the operand control circuit 53.

【0127】タイミングt22: 命令解読回路123
よりパイプライン制御信号109が出力される。BBU
SにDEST[1:0]で示されるレジスタの値が読み
出される(RRDによる制御)。CBUSにd8(この
とき0)が定数発生器112より読み出される。
Timing t22: instruction decoding circuit 123
Then, the pipeline control signal 109 is output. BBU
The value of the register indicated by DEST [1: 0] is read into S (control by RRD). D8 (0 at this time) is read from the constant generator 112 in CBUS.

【0128】IFステージ:命令2[FRTS] タイミングt21:命令2がROM106から読出さ
れ、命令レジスタ108に格納される。
IF stage: Instruction 2 [FRTS] Timing t21: Instruction 2 is read from the ROM 106 and stored in the instruction register 108.

【0129】<タイミングt3> EXステージ:命令1[MOV R2,@(0,R
3)] タイミングt31:BBUSとCBUSにより読み出さ
れた値が加算された後、RLST104からABUSを
介してOAR103に格納される。
<Timing t3> EX stage: Instruction 1 [MOV R2, @ (0, R
3)] Timing t31: The values read by BBUS and CBUS are added, and then stored in the OAR 103 from the RLST 104 via ABUS.

【0130】タイミングt32:ABUSにSRC
[1:0]で示されるレジスタの値が読み出され、第1
セレクタ114を介してOAR103で示されるメモリ
アドレスにストアされる(MWTによる制御)。
Timing t32: SRC to ABUS
The value of the register indicated by [1: 0] is read out, and the first
It is stored in the memory address indicated by OAR 103 via the selector 114 (control by MWT).

【0131】DECステージ:命令2[FRTS] タイミングt31:命令レジスタ108に格納された命
令2が命令解読回路123により解読される。命令とと
もに反転状態フラグ110の値0が命令解読器50に入
力され、FRTSの命令判定信号52が出力される。反
転状態フラグ110の値0がオペランド制御回路53に
入力される。
DEC stage: instruction 2 [FRTS] Timing t31: instruction 2 stored in the instruction register 108 is decoded by the instruction decoding circuit 123. The value 0 of the inversion state flag 110 is input to the instruction decoder 50 together with the instruction, and the FRTS instruction determination signal 52 is output. The value 0 of the inversion state flag 110 is input to the operand control circuit 53.

【0132】タイミングt32:命令解読回路123よ
りFRTS命令無効化信号56が出力される。
Timing t32: The FRTS instruction invalidation signal 56 is output from the instruction decoding circuit 123.

【0133】IFステージ:命令3[SUB R0,R
0] タイミングt31:命令3がROM106から読出さ
れ、命令レジスタ108に格納される。
IF stage: Instruction 3 [SUB R0, R
0] Timing t31: Instruction 3 is read from ROM 106 and stored in instruction register 108.

【0134】<タイミングt4> EXステージ:命令2[FRTS] タイミングt41:FRTS命令無効化信号56により
何も実行されない。
<Timing t4> EX stage: instruction 2 [FRTS] Timing t41: nothing is executed by the FRTS instruction invalidation signal 56.

【0135】タイミングt42:FRTS命令無効化信
号56により何も実行されない。
Timing t42: Nothing is executed by the FRTS instruction invalidation signal 56.

【0136】DECステージ:命令3[SUB R0,
R0] タイミングt41:命令レジスタ108に格納された命
令3が命令解読回路123により解読される。R−Rの
命令判定信号52が出力される。反転状態フラグ110
の値0がオペランド制御回路53に入力される。
DEC stage: instruction 3 [SUB R0,
R0] Timing t41: The instruction decoding circuit 123 decodes the instruction 3 stored in the instruction register 108. The RR command determination signal 52 is output. Inversion state flag 110
The value 0 of 0 is input to the operand control circuit 53.

【0137】タイミングt42:命令解読回路123よ
りパイプライン制御信号109が出力される。
Timing t42: The instruction decoding circuit 123 outputs the pipeline control signal 109.

【0138】IFステージ:命令4[NOP] タイミングt41:命令4がROM106から読出さ
れ、命令レジスタ108に格納される。NOPは何も実
行されずに次の命令に進む。
IF stage: Instruction 4 [NOP] Timing t41: Instruction 4 is read from ROM 106 and stored in instruction register 108. NOP does nothing and proceeds to the next instruction.

【0139】<タイミングt5> EXステージ:命令3[SUB R0,R0] タイミングt51:ABUSにSRC[1:0]で示さ
れるレジスタの値が読み出される(RRDによる制
御)。BBUSにDEST[1:0]で示されるレジス
タの値が読み出される(RRDによる制御)。
<Timing t5> EX stage: Instruction 3 [SUB R0, R0] Timing t51: The value of the register indicated by SRC [1: 0] is read at ABUS (control by RRD). The value of the register indicated by DEST [1: 0] is read into BBUS (control by RRD).

【0140】タイミングt52:ABUSとBBUSに
読み出された値が演算器102で減算された後、RLS
T104からABUSを介してDEST[1:0]で示
されるレジスタに格納される(RWTによる制御)。
Timing t52: After the values read out to ABUS and BBUS are subtracted by the arithmetic unit 102, RLS
It is stored in the register indicated by DEST [1: 0] from T104 via ABUS (control by RWT).

【0141】DECステージ:命令4[NOP] タイミングt51:何も処理されない。DEC stage: instruction 4 [NOP] Timing t51: No processing is performed.

【0142】タイミングt52:何も処理されない。Timing t52: No processing is performed.

【0143】IFステージ:命令5[NOP] タイミングt51:命令5がROM106から読出さ
れ、命令レジスタ108に格納される。NOPは何も実
行されずに次の命令に進む。
IF stage: Instruction 5 [NOP] Timing t51: Instruction 5 is read from ROM 106 and stored in instruction register 108. NOP does nothing and proceeds to the next instruction.

【0144】上述したように、プログラム実行例4では
反転状態フラグ110が0であるので、FRTSはFR
TS命令無効化信号56の出力によって無効化され、反
転状態フラグ110を変更しないで次命令の処理が継続
される。
As described above, in the program execution example 4, since the inversion state flag 110 is 0, FRTS becomes FR.
It is invalidated by the output of the TS command invalidation signal 56, and the processing of the next instruction is continued without changing the inversion state flag 110.

【0145】次に、プログラム実行例5として、本実施
形態1によるデータ処理装置が命令1[FJSR @
(LABEL2)]でサブルーチンコールしてから命令
5[FRTS]によってサブルーチンリターンする動作
を引き続き説明する。具体的には、命令1[FJSR
@(LABEL2)]が解読されるとき、反転状態フラ
グ110を1にセットすることによって、後続の命令2
[MOV R0,@(4,R3)]、命令3[MOV
R1,@(2,R3)]、命令4[MOV R2,@
(0,R3)]のデータ転送先とデータ転送元を反転さ
せるオペランドアクセス制御信号54が出力される。さ
らに命令5[FRTS]が命令解読器50により解読さ
れるとき、命令解読器50の入力である反転状態フラグ
110が1であるため、FRTS−1の命令判定信号5
2が出力され、命令5[FRTS]が無効化されること
がなく実行される。その過程で反転状態フラグ110が
0にリセットされ、命令6[ADD 6,R3]から後
の命令を順に反転状態フラグ110を0として処理する
過程が説明される。
Next, as a program execution example 5, the data processing apparatus according to the first embodiment executes the instruction 1 [FJSR @
The operation of making a subroutine call with (LABEL2)] and then returning with a subroutine by an instruction 5 [FRTS] will be described. Specifically, command 1 [FJSR
@ (LABEL2)] is decoded, a subsequent instruction 2 is set by setting the inversion state flag 110 to 1.
[MOV R0, @ (4, R3)], instruction 3 [MOV
R1, @ (2, R3)], instruction 4 [MOV R2, @
An operand access control signal 54 for inverting the data transfer destination and the data transfer source of (0, R3)] is output. Further, when the instruction 5 [FRTS] is decoded by the instruction decoder 50, since the inversion state flag 110 which is the input of the instruction decoder 50 is 1, the instruction determination signal 5 of FRTS-1
2 is output and the instruction 5 [FRTS] is executed without being invalidated. In the process, the inversion state flag 110 is reset to 0, and a process of sequentially processing the instructions subsequent to the instruction 6 [ADD 6, R3] with the inversion state flag 110 set to 0 will be described.

【0146】このプログラム実行例5での説明の範囲
は、本実施形態1によるデータ処理装置が命令1[FJ
SR @(LABEL2)]、命令2[MOV R0,
@(4,R3)]、命令3[MOV R1,@(2,R
3)]、命令4[MOV R2,@(0,R3)]、命
令5[FRTS]、命令6[ADD 6,R3]を順に
処理する動作であるが、命令6[ADD 6,R3]に
続く命令7[RTS]のパイプライン動作は、すでにプ
ログラム実行例2(タイミングt4〜t8)で説明して
いるものと同一であるため、ここでは説明を省略する。
The range of the explanation in this program execution example 5 is that the data processor according to the first embodiment executes the instruction 1 [FJ.
SR @ (LABEL2)], instruction 2 [MOV R0,
@ (4, R3)], instruction 3 [MOV R1, @ (2, R
3)], instruction 4 [MOV R2, @ (0, R3)], instruction 5 [FRTS], and instruction 6 [ADD 6, R3] are sequentially processed, but instruction 6 [ADD 6, R3] is processed. The pipeline operation of the succeeding instruction 7 [RTS] is the same as that already described in the program execution example 2 (timing t4 to t8), and therefore the description thereof is omitted here.

【0147】図12と図13は、プログラム実行例5に
よるパイプライン動作の説明図である。図12と図13
では、連続するタイミングt1〜t10によってプログ
ラム実行例5が図示されており、図12のタイミングt
6、t7、t8と図13のタイミングt6、t7、t8
はそれぞれ同一タイミングを表すものである。以下、時
間が経過する順にタイミング毎にその動作を説明する。
なお、反転状態フラグ110はタイミングt1で0であ
る。
12 and 13 are explanatory diagrams of the pipeline operation according to the program execution example 5. 12 and 13
In FIG. 12, the program execution example 5 is illustrated at successive timings t1 to t10.
6, t7, t8 and the timings t6, t7, t8 in FIG.
Represents the same timing. Hereinafter, the operation will be described for each timing in order of the passage of time.
The inversion state flag 110 is 0 at the timing t1.

【0148】(プログラム実行例5:FJSRからFR
TSまでの説明) <タイミングt1> IFステージ:命令1[FJSR @(LABEL
2)] タイミングt11:命令1がROM106から読出さ
れ、命令レジスタ108に格納される。
(Program execution example 5: FJSR to FR
Explanation up to TS) <Timing t1> IF stage: instruction 1 [FJSR @ (LABEL
2)] Timing t11: Instruction 1 is read from ROM 106 and stored in instruction register 108.

【0149】<タイミングt2> DECステージ:命令2[FJSR−1] タイミングt21:命令レジスタ108に格納された命
令1が命令解読回路123により解読される。FJSR
−1の命令判定信号52が出力される。反転状態フラグ
110の値0がオペランド制御回路53に入力される。
<Timing t2> DEC Stage: Instruction 2 [FJSR-1] Timing t21: Instruction 1 stored in the instruction register 108 is decoded by the instruction decoding circuit 123. FJSR
The instruction determination signal 52 of -1 is output. The value 0 of the inversion state flag 110 is input to the operand control circuit 53.

【0150】タイミングt22:命令解読回路123よ
りパイプライン制御信号109が出力される。BBUS
にSPの値が読み出される(RRDによる制御)。CB
USにx'02が定数発生器112より読み出される。
Timing t22: The instruction decoding circuit 123 outputs the pipeline control signal 109. BBUS
The SP value is read out (control by RRD). CB
X'02 is read out from the constant generator 112 in the US.

【0151】IFステージ:スキップ タイミングt21:FJSR−1の命令判定信号52に
より命令フェッチがスキップされる。
IF stage: Skip timing t21: Instruction fetch is skipped by the instruction determination signal 52 of FJSR-1.

【0152】<タイミングt3> EXステージ:命令1[FJSR−1] タイミングt31:BBUSとCBUSにより読み出さ
れた値が減算された後、RLST104からABUSを
介してOAR103に格納される。さらにABUSを介
してSPにRLST104の値が格納される(RWTに
よる制御)。
<Timing t3> EX stage: Instruction 1 [FJSR-1] Timing t31: After the values read by BBUS and CBUS are subtracted, they are stored in the OAR 103 from the RLST 104 via ABUS. Further, the value of RLST 104 is stored in SP via ABUS (control by RWT).

【0153】タイミングt32:第1セレクタ114を
介してOAR103で示されるメモリアドレスにデータ
がストアされる(MWTによる制御)。
Timing t32: Data is stored in the memory address indicated by the OAR 103 via the first selector 114 (control by MWT).

【0154】DECステージ:命令1[FJSR−2] タイミングt31:命令レジスタ108に格納された命
令1が命令解読回路123により解読される。FJSR
−2の命令判定信号52が出力される。命令解読回路1
23よりパイプライン制御信号109が出力される。B
BUSにプログラムカウンタ111からPC+2の値が
読み出される。CBUSにd8(このとき、PC+2+
d8がLABEL2番地となる相対値)が定数発生器1
12より読み出される。
DEC stage: Instruction 1 [FJSR-2] Timing t31: Instruction 1 stored in the instruction register 108 is decoded by the instruction decoding circuit 123. FJSR
-2 instruction determination signal 52 is output. Instruction decoding circuit 1
23, the pipeline control signal 109 is output. B
The value of PC + 2 is read from the program counter 111 to BUS. D8 on CBUS (at this time, PC + 2 +
The constant generator 1 is the relative value where d8 is LABEL2.
12 is read.

【0155】タイミングt32:BBUSとCBUSの
値が加算された後、RLST104からABUSを介し
てPCに格納される。反転状態フラグ110の値が命令
解読器50により0から1に更新される。
Timing t32: After the values of BBUS and CBUS are added, the values are stored in the PC from the RLST 104 via ABUS. The value of the inverted state flag 110 is updated by the instruction decoder 50 from 0 to 1.

【0156】IFステージ:命令2[MOV R0,@
(4,R3)] タイミングt31:命令2がROM106から読出さ
れ、命令レジスタ108に格納される。
IF stage: Instruction 2 [MOV R0, @
(4, R3)] Timing t31: Instruction 2 is read from the ROM 106 and stored in the instruction register 108.

【0157】<タイミングt4> DECステージ:命令2[MOV R0,@(4,R
3)] タイミングt41:命令レジスタ108に格納された命
令2が命令解読回路123により解読される。STの命
令判定信号52が出力される。反転状態フラグ110の
値1がオペランド制御回路53と命令解読器50に入力
される。
<Timing t4> DEC stage: instruction 2 [MOV R0, @ (4, R
3)] Timing t41: The instruction 2 stored in the instruction register 108 is decoded by the instruction decoding circuit 123. The ST instruction determination signal 52 is output. The value 1 of the inversion state flag 110 is input to the operand control circuit 53 and the instruction decoder 50.

【0158】タイミングt42:命令解読回路123よ
りパイプライン制御信号109が出力される(反転状態
フラグ110の値が1であるのでLDの命令タイプに相
当するパイプライン制御がなされる)。オペランド制御
回路53から命令判定信号52がSTで反転状態フラグ
110が1である行に応じてオペランドアクセス制御信
号54が出力される。BBUSにSRC[1:0]で示
されるレジスタの値が読み出される(RRDによる制
御)。CBUSにd8(このとき4)が定数発生器11
2より読み出される。
Timing t42: The pipeline control signal 109 is output from the instruction decoding circuit 123 (since the value of the inversion state flag 110 is 1, pipeline control corresponding to the LD instruction type is performed). Operand control circuit 53 outputs an operand access control signal 54 in response to a row in which instruction determination signal 52 is ST and inversion state flag 110 is 1. The value of the register indicated by SRC [1: 0] is read into BBUS (control by RRD). D8 (4 at this time) is a constant generator 11 in CBUS
2 is read.

【0159】IFステージ:命令3[MOV R1,@
(2,R3)] タイミングt41:命令3がROM106から読出さ
れ、命令レジスタ108に格納される。
IF stage: Instruction 3 [MOV R1, @
(2, R3)] Timing t41: Instruction 3 is read from the ROM 106 and stored in the instruction register 108.

【0160】<タイミングt5> EXステージ:命令2[MOV R0,@(4,R
3)] タイミングt51:BBUSとCBUSにより読み出さ
れた値が加算された後、RLST104からABUSを
介してOAR103に格納される。
<Timing t5> EX stage: Instruction 2 [MOV R0, @ (4, R
3)] Timing t51: After the values read by BBUS and CBUS are added, the values are stored in the OAR 103 from the RLST 104 via ABUS.

【0161】タイミングt52:第1セレクタ114を
介してOAR103で示されるメモリアドレスからデー
タがロードされる(MRDによる制御)。ロードされた
データはABUSを介してDEST[1:0]で示され
るレジスタに格納される(RWTによる制御)。
Timing t52: Data is loaded from the memory address indicated by the OAR 103 via the first selector 114 (control by MRD). The loaded data is stored in the register indicated by DEST [1: 0] via ABUS (control by RWT).

【0162】DECステージ:命令3[MOV R1,
@(2,R3)] タイミングt51:命令レジスタ108に格納された命
令3が命令解読回路123により解読される。STの命
令判定信号52が出力される。反転状態フラグ110の
値1がオペランド制御回路53と命令解読器50に入力
される。
DEC stage: instruction 3 [MOV R1,
@ (2, R3)] Timing t51: The instruction 3 stored in the instruction register 108 is decoded by the instruction decoding circuit 123. The ST instruction determination signal 52 is output. The value 1 of the inversion state flag 110 is input to the operand control circuit 53 and the instruction decoder 50.

【0163】タイミングt52:命令解読回路123よ
りパイプライン制御信号109が出力される(反転状態
フラグ110の値が1であるのでLDの命令タイプに相
当するパイプライン制御がなされる)。オペランド制御
回路53から命令判定信号52がSTで反転状態フラグ
110が1である行に応じてオペランドアクセス制御信
号54が出力される。BBUSにSRC[1:0]で示
されるレジスタの値が読み出される(RRDによる制
御)。CBUSにd8(このとき2)が定数発生器11
2より読み出される。
Timing t52: The pipeline control signal 109 is output from the instruction decoding circuit 123 (since the value of the inversion state flag 110 is 1, pipeline control corresponding to the LD instruction type is performed). Operand control circuit 53 outputs an operand access control signal 54 in response to a row in which instruction determination signal 52 is ST and inversion state flag 110 is 1. The value of the register indicated by SRC [1: 0] is read into BBUS (control by RRD). D8 (2 at this time) is a constant generator 11 in CBUS
2 is read.

【0164】IFステージ:命令4[MOV R2,@
(0,R3)] タイミングt31:命令4がROM106から読出さ
れ、命令レジスタ108に格納される。
IF stage: Instruction 4 [MOV R2, @
(0, R3)] Timing t31: Instruction 4 is read from ROM 106 and stored in instruction register 108.

【0165】<タイミングt6> EXステージ:命令3[MOV R1,@(2,R
3)] タイミングt61:BBUSとCBUSにより読み出さ
れた値が加算された後、RLST104からABUSを
介してOAR103に格納される。
<Timing t6> EX stage: Instruction 3 [MOV R1, @ (2, R
3)] Timing t61: The values read by BBUS and CBUS are added, and then stored in the OAR 103 from the RLST 104 via ABUS.

【0166】タイミングt62:第1セレクタ114を
介してOAR103で示されるメモリアドレスからデー
タがロードされる(MRDによる制御)。ロードされた
データはABUSを介してDEST[1:0]で示され
るレジスタに格納される(RWTによる制御)。
Timing t62: Data is loaded from the memory address indicated by OAR 103 via the first selector 114 (control by MRD). The loaded data is stored in the register indicated by DEST [1: 0] via ABUS (control by RWT).

【0167】DECステージ:命令4[MOV R2,
@(0,R3)] タイミングt61:命令レジスタ108に格納された命
令3が命令解読回路123により解読される。STの命
令判定信号52が出力される。反転状態フラグ110の
値1がオペランド制御回路53と命令解読器50に入力
される。
DEC stage: instruction 4 [MOV R2,
@ (0, R3)] Timing t61: The instruction decoding circuit 123 decodes the instruction 3 stored in the instruction register 108. The ST instruction determination signal 52 is output. The value 1 of the inversion state flag 110 is input to the operand control circuit 53 and the instruction decoder 50.

【0168】タイミングt62:命令解読回路123よ
りパイプライン制御信号109が出力される(反転状態
フラグ110の値が1であるのでLDの命令タイプに相
当するパイプライン制御がなされる)。オペランド制御
回路53から命令判定信号52がSTで反転状態フラグ
110が1である行に応じてオペランドアクセス制御信
号54が出力される。BBUSにSRC[1:0]で示
されるレジスタの値が読み出される(RRDによる制
御)。CBUSにd8(このとき0)が定数発生器11
2より読み出される。
Timing t62: The pipeline control signal 109 is output from the instruction decoding circuit 123 (since the value of the inversion state flag 110 is 1, pipeline control corresponding to the LD instruction type is performed). Operand control circuit 53 outputs an operand access control signal 54 in response to a row in which instruction determination signal 52 is ST and inversion state flag 110 is 1. The value of the register indicated by SRC [1: 0] is read into BBUS (control by RRD). D8 (0 at this time) is a constant generator 11 in CBUS
2 is read.

【0169】IFステージ:命令5[FRTS] タイミングt61:命令5がROM106から読出さ
れ、命令レジスタ108に格納される。
IF stage: Instruction 5 [FRTS] Timing t61: Instruction 5 is read from ROM 106 and stored in instruction register 108.

【0170】<タイミングt7> EXステージ:命令4[MOV R2,@(0,R
3)] タイミングt71:BBUSとCBUSにより読み出さ
れた値が加算された後、RLST104からABUSを
介してOAR103に格納される。
<Timing t7> EX stage: Instruction 4 [MOV R2, @ (0, R
3)] Timing t71: After the values read by BBUS and CBUS are added, the values are stored in the OAR 103 via the ABUS from the RLST 104.

【0171】タイミングt72:第1セレクタ114を
介してOAR103で示されるメモリアドレスからデー
タがロードされる(MRDによる制御)。ロードされた
データはABUSを介してDEST[1:0]で示され
るレジスタに格納される(RWTによる制御)。
Timing t72: Data is loaded from the memory address indicated by the OAR 103 via the first selector 114 (control by MRD). The loaded data is stored in the register indicated by DEST [1: 0] via ABUS (control by RWT).

【0172】DECステージ:命令5[FRTS−1] タイミングt71:命令レジスタ108に格納された命
令5が命令解読回路123により解読される。命令とと
もに反転状態フラグ110の値1が命令解読器50に入
力される。このとき反転状態フラグ110の値が1であ
るので、FRTS−1の命令判定信号52が出力され
る。反転状態フラグ110の値1がオペランド制御回路
53に入力される。
DEC stage: Instruction 5 [FRTS-1] Timing t71: Instruction 5 stored in the instruction register 108 is decoded by the instruction decoding circuit 123. The value 1 of the inversion status flag 110 is input to the instruction decoder 50 together with the instruction. At this time, since the value of the inverted state flag 110 is 1, the instruction determination signal 52 of FRTS-1 is output. The value 1 of the inversion state flag 110 is input to the operand control circuit 53.

【0173】タイミングt72: 命令解読回路123
よりパイプライン制御信号109が出力される。オペラ
ンド制御回路53からFRTS−1の命令に相当するオ
ペランドアクセス制御信号54が出力される。
Timing t72: instruction decoding circuit 123
Then, the pipeline control signal 109 is output. Operand control circuit 53 outputs an operand access control signal 54 corresponding to the FRTS-1 instruction.

【0174】IFステージ:スキップ タイミングt71:FRTS−1の命令判定信号52に
より命令フェッチがスキップされる。
IF stage: Skip timing t71: Instruction fetch is skipped by the instruction determination signal 52 of FRTS-1.

【0175】<タイミングt8> EXステージ:命令5[FRTS−1] タイミングt81:BBUSに読み出されたSPの値が
演算器102をスルーされた後、RLST104からA
BUSを介してOAR103に格納される。
<Timing t8> EX stage: Instruction 5 [FRTS-1] Timing t81: SP value read out in BBUS is passed through the arithmetic unit 102, and then RLST 104 outputs A.
It is stored in the OAR 103 via the BUS.

【0176】タイミングt82:第1セレクタ114を
介してOAR103で示されるメモリアドレスからデー
タがロードされる(MRDによる制御)。ロードされた
データはABUSを介してPCに格納される。
Timing t82: Data is loaded from the memory address indicated by the OAR 103 via the first selector 114 (control by MRD). The loaded data is stored in the PC via ABUS.

【0177】DECステージ:命令5[FRTS−2] タイミングt81:命令レジスタ108に格納された命
令5が再び命令解読回路123により解読される。FR
TS−2の命令判定信号52が出力される。反転状態フ
ラグ110の値が、オペランド制御回路53と命令解読
器50に入力される。
DEC stage: Instruction 5 [FRTS-2] Timing t81: Instruction 5 stored in the instruction register 108 is decoded again by the instruction decoding circuit 123. FR
The instruction determination signal 52 of TS-2 is output. The value of the inversion state flag 110 is input to the operand control circuit 53 and the instruction decoder 50.

【0178】タイミングt82: 命令解読回路123
よりパイプライン制御信号109が出力される。オペラ
ンド制御回路53から、FRTS−2の命令に相当する
オペランドアクセス制御信号54が出力される。BBU
SにSPの値が読み出される(RRDによる制御)。C
BUSにx'02が定数発生器112から読み出され
る。さらに反転状態フラグ110の値が1から0にリセ
ットされる。
Timing t82: instruction decoding circuit 123
Then, the pipeline control signal 109 is output. Operand control circuit 53 outputs an operand access control signal 54 corresponding to the FRTS-2 instruction. BBU
The value of SP is read into S (control by RRD). C
X'02 is read from the constant generator 112 in BUS. Further, the value of the inversion state flag 110 is reset from 1 to 0.

【0179】IFステージ:命令6[ADD 6,R
3] タイミングt81:命令6がROM106から読出さ
れ、命令レジスタ108に格納される。
IF stage: Instruction 6 [ADD 6, R
3] Timing t81: Instruction 6 is read from ROM 106 and stored in instruction register 108.

【0180】<タイミングt9> EXステージ:命令5[FRTS−2] タイミングt91:BBUSとCBUSに読み出された
値が加算された後,RLST104からABUSを介し
て、SPに格納される(RWTによる制御)。
<Timing t9> EX stage: Instruction 5 [FRTS-2] Timing t91: After the values read to BBUS and CBUS are added, they are stored in SP from RLST 104 via ABUS (by RWT). control).

【0181】タイミングt92:何も実行されない。Timing t92: Nothing is executed.

【0182】DECステージ:命令6[ADD 6,R
3] タイミングt91:命令レジスタ108に格納された命
令6が命令解読回路123により解読される。R−im
m8の命令判定信号52が出力される。反転状態フラグ
110の値0がオペランド制御回路53に入力される。
DEC stage: instruction 6 [ADD 6, R
3] Timing t91: The instruction decoding circuit 123 decodes the instruction 6 stored in the instruction register 108. R-im
The instruction determination signal 52 of m8 is output. The value 0 of the inversion state flag 110 is input to the operand control circuit 53.

【0183】タイミングt92: 命令解読回路123
よりパイプライン制御信号109が出力される。
Timing t92: instruction decoding circuit 123
Then, the pipeline control signal 109 is output.

【0184】IFステージ:命令7[次命令] タイミングt91:説明を省略する。IF stage: Instruction 7 [next instruction] Timing t91: Description is omitted.

【0185】<タイミングt10> EXステージ:命令6[ADD 6,R3] タイミングt101:ABUSにDEST[1:0]で
示されるレジスタの値を読み出す(RRDによる制
御)。CBUSにimm8(このとき6)が定数発生器
112から読み出される。
<Timing t10> EX stage: Instruction 6 [ADD 6, R3] Timing t101: The value of the register indicated by DEST [1: 0] is read in ABUS (control by RRD). Imm8 (6 at this time) is read from the constant generator 112 in CBUS.

【0186】タイミングt102:ABUSとCBUS
に読み出された値が演算器102で加算された後、RL
ST104からABUSを介してDEST[1:0]で
示されるレジスタに格納される(RWTによる制御)。
Timing t102: ABUS and CBUS
After the value read out to the
It is stored in the register indicated by DEST [1: 0] from ST104 via ABUS (control by RWT).

【0187】DECステージ:命令7[次命令] タイミングt101:説明を省略する。DEC stage: instruction 7 [next instruction] Timing t101: Description is omitted.

【0188】タイミングt102:説明を省略する。Timing t102: Description is omitted.

【0189】IFステージ:説明を省略する。IF stage: Description is omitted.

【0190】タイミングt101:説明を省略する。Timing t101: Description is omitted.

【0191】以上のようにプログラム実行例5では、本
実施形態1によるデータ処理装置が命令1[FJSR
@(LABEL2)]を実行する過程(DECステージ
タイミングt32)で反転状態フラグ110を1にセッ
トすることによって、命令2[MOV R0,@(4,
R3)]、命令3[MOV R1,@(2,R3)]、
命令4[MOV R2,@(0,R3)]のデータ転送
先とデータ転送元を反転させるオペランドアクセス制御
信号54を出力している。さらに命令5[FRTS]が
命令解読器50により解読されるとき(タイミングt7
1)、命令解読器50の入力である反転状態フラグ11
0が1であるのでFRTS−1の命令判定信号52が出
力され、プログラム実行例4の命令2[FRTS]で説
明したように本命令は無効化されることがなく実行され
る。その実行過程で反転状態フラグ110が0にリセッ
トされ(タイミングt82)、命令6[ADD 6,R
3]から後の命令を順に反転状態フラグ110の値0に
て処理している。
As described above, in the program execution example 5, the data processing apparatus according to the first embodiment has the instruction 1 [FJSR.
@ (LABEL2)] is executed (DEC stage timing t32) to set the inversion state flag 110 to 1, so that the instruction 2 [MOV R0, @ (4,
R3)], instruction 3 [MOV R1, @ (2, R3)],
The operand access control signal 54 for inverting the data transfer destination and the data transfer source of the instruction 4 [MOV R2, @ (0, R3)] is output. Further, when the instruction 5 [FRTS] is decoded by the instruction decoder 50 (timing t7
1), the inversion state flag 11 which is the input of the instruction decoder 50
Since 0 is 1, the instruction determination signal 52 of FRTS-1 is output, and this instruction is executed without being invalidated as described in the instruction 2 [FRTS] of the program execution example 4. In the execution process, the inversion state flag 110 is reset to 0 (timing t82), and the instruction 6 [ADD 6, R
3] and subsequent instructions are sequentially processed with the value 0 of the inversion state flag 110.

【0192】上述したように、本実施形態1のデータ処
理装置によれば、図15に示した従来のデータ処理装置
で実行されるプログラム例を、プログラム実行例1とプ
ログラム実行例2に示したとおりに実行できることに加
えて、図4のプログラム例を、プログラム実行例4とプ
ログラム実行例5に示したとおりに実行できる。つま
り、図15のプログラム例よりもコードサイズの小さい
プログラム例(図4)を選択する自由度が増える。
As described above, according to the data processing device of the first embodiment, program execution examples 1 and 2 show examples of programs executed by the conventional data processing device shown in FIG. In addition to being executed as described above, the program example of FIG. 4 can be executed as shown in the program execution examples 4 and 5. That is, the degree of freedom in selecting a program example (FIG. 4) having a smaller code size than that of the program example of FIG. 15 is increased.

【0193】これは、命令の実行順序を制御する命令
[FJSR]が解読されたときにデータ転送元と転送先
を反転させるものとして反転状態フラグ110を更新
し、同じく命令の実行順序を制御する命令[FRTS]
が解読されたときに反転状態フラグ110を0とし、反
転状態フラグ110が0のときに限り命令[FRTS]
を無効化することによって、プログラムコードサイズの
縮小化を図っているからである。
This is to invert the data transfer source and the transfer destination when the instruction [FJSR] for controlling the instruction execution order is decoded, update the inversion state flag 110, and similarly control the instruction execution order. Order [FRTS]
When the reverse state flag 110 is 0, the instruction [FRTS] is set only when the reverse state flag 110 is 0.
This is because the program code size is reduced by disabling.

【0194】より具体的には、図15のプログラム例で
示したプログラム記述からの変更を少なくして、サブル
ーチン化されていない再利用すべき命令群(図4に示す
プログラム例の2行目から4行目)を、命令[FJS
R]と命令[FRTS]で効率的に再利用できる(冗長
なプログラムコードを2命令で置き換えることができ
る)。
More specifically, with a small change from the program description shown in the program example of FIG. 15, an instruction group to be reused that is not a subroutine (from the second line of the program example shown in FIG. 4th line), the command [FJS
R] and instruction [FRTS] can be efficiently reused (redundant program code can be replaced by two instructions).

【0195】さらには、前記の図4のプログラム例の2
行目から4行目に配置された命令を別のプログラムから
FJSRによってサブルーチンコールすることも可能で
あるように構成されているため、これを利用することで
プログラムサイズの縮小効果がよりいっそう高まる。
[0195] Furthermore, 2 of the program example of FIG.
Since the instructions arranged on the 4th to 4th lines can be called as a subroutine by FJSR from another program, the effect of reducing the program size is further enhanced by using this.

【0196】[実施の形態2]以下、本発明の実施形態
2について、図1、図2、図3、図5、図7、図8、図
9、図10、図12、図14を用いて説明する。なお、
実施形態1と同様の構成をとるものについては、同じ番
号を付して説明を省略する。
[Embodiment 2] Referring to FIG. 1, FIG. 2, FIG. 3, FIG. 5, FIG. 7, FIG. 8, FIG. 9, FIG. 10, FIG. Explain. In addition,
The same components as those in the first embodiment are designated by the same reference numerals and the description thereof will be omitted.

【0197】本実施形態2のデータ処理装置で実行され
るプログラム例を図5に示す。このプログラム例では各
命令をニーモニック表記してある。以下、図5に示すプ
ログラム例の各命令について、簡単な説明を付する。な
お、[]内に記された値はその命令のコードサイズであ
る。
FIG. 5 shows an example of a program executed by the data processing device of the second embodiment. In this program example, each instruction is represented by mnemonic. Below, a brief description is given for each instruction of the program example shown in FIG. The value in [] is the code size of the instruction.

【0198】1行目:SUB 6,R3 (R3レジス
タの値から即値6を減算して結果をR3レジスタに格納
する。LABEL1:は番地を示す。) [2byt
e] 2行目:JSR @(LABEL2) (スタックポイ
ンタSPを2減算しSPを更新する。プログラムカウン
タ111(PC+2)をスタックポインタSPで示され
るメモリアドレスに書き込む。反転状態フラグ110を
0とし、プログラムカウンタ111(PC)[3行目の
次命令を指す]をLABEL2に更新する。) [2b
yte] 3行目:SUB R0,R0 (R0レジスタの値とR
0レジスタの値を減算し、R0レジスタに格納する。)
[1byte] 4行目:処理 (この処理とは、複数命令からなるデー
タ処理であって、R0レジスタ、R1レジスタ、および
R2レジスタを書き換える可能性があるものとする。) 5行目:FJSR @(LABEL2) (スタックポ
インタSPを2減算しSPを更新する。プログラムカウ
ンタ111(PC+2)[6行目の次命令を指す]をス
タックポインタSPで示されるメモリアドレスに書き込
む。反転状態フラグ110を1とし、プログラムカウン
タ111(PC)をLABEL2に更新する。) [2
byte] 6行目:ADD 6,R3 (R3レジスタの値に即値
6を加算して結果をR3レジスタに格納する。) [2
byte] 7行目:RTS (サブルーチンからリターンする。ス
タックポインタSPの内容をアドレスとしてメモリを読
出し、その内容をプログラムカウンタ111(PC)に
格納する。スタックポインタに2加算しSPを更新す
る。反転状態フラグ110を0にリセットする。)
[1byte] 8行目:MOV R0,@(4,R3) (R0レジス
タの値をR3レジスタと即値4を加算したアドレスのメ
モリにストアする。LABEL2:は番地を示してい
る。) [2byte] 9行目:MOV R1,@(2,R3) (R1レジス
タの値をR3レジスタと即値2を加算したアドレスのメ
モリにストアする。) [2byte] 10行目:MOV R2,@(0,R3) (R2レジ
スタの値をR3レジスタと即値0を加算したアドレスの
メモリにストアする。) [2byte] 11行目:RTS (サブルーチンからリターンする。
スタックポインタSPの内容をアドレスとしてメモリを
読出し、その内容をプログラムカウンタ111(PC)
に格納する。スタックポインタに2加算しSPを更新す
る。反転状態フラグ110を0にリセットする。)
[1byte] このプログラム例では、命令[JSR @(LABEL
2)]と命令[FJSR @(LABEL2)]の2つ
を使い分けることによって、8行目から11行目までの
サブルーチンによるデータ処理が2通り実現できる。
First line: SUB 6, R3 (immediate value 6 is subtracted from the value in the R3 register and the result is stored in the R3 register. LABEL1: indicates an address.) [2byt
e] Second line: JSR @ (LABEL2) (Decrement stack pointer SP by 2 to update SP. Write program counter 111 (PC + 2) to the memory address indicated by stack pointer SP. Set inversion state flag 110 to 0, The program counter 111 (PC) [points to the next instruction on the third line] is updated to LABEL 2.) [2b
yte] third line: SUB R0, R0 (value of R0 register and R
The value of the 0 register is subtracted and stored in the R0 register. )
[1 byte] Fourth line: Process (This process is a data process consisting of a plurality of instructions, and the R0 register, the R1 register, and the R2 register may be rewritten.) The fifth line: FJSR @ (LABEL2) (The stack pointer SP is decremented by 2 and SP is updated. The program counter 111 (PC + 2) [points to the next instruction on the sixth line] is written to the memory address indicated by the stack pointer SP. Then, the program counter 111 (PC) is updated to LABEL2.) [2
byte] 6th line: ADD 6, R3 (immediate value 6 is added to the value of the R3 register and the result is stored in the R3 register.) [2
byte] 7th line: RTS (Return from subroutine. Memory is read by using the contents of stack pointer SP as an address and the contents are stored in program counter 111 (PC). 2 is added to the stack pointer and SP is updated. The status flag 110 is reset to 0.)
[1 byte] 8th line: MOV R0, @ (4, R3) (The value of the R0 register is stored in the memory at the address obtained by adding the R3 register and the immediate value 4. LABEL2: indicates the address.) [2 byte] 9th line: MOV R1, @ (2, R3) (The value of the R1 register is stored in the memory at the address obtained by adding the R3 register and the immediate value 2.) [2byte] 10th line: MOV R2, @ (0, R3 (The value of the R2 register is stored in the memory of the address obtained by adding the R3 register and the immediate value 0.) [2 byte] 11th line: RTS (Return from the subroutine.
The memory is read by using the contents of the stack pointer SP as an address, and the contents are read by the program counter 111 (PC).
To store. Add 2 to the stack pointer and update SP. The inversion state flag 110 is reset to 0. )
[1 byte] In this program example, the instruction [JSR @ (LABEL
2)] and the instruction [FJSR @ (LABEL2)], the data processing by the subroutine from the 8th line to the 11th line can be realized in two ways.

【0199】本実施形態2による命令解読回路の構成
は、図3に示したとおりであり、実施形態1において説
明済みである。本実施形態2によるオペランド制御回路
53の入出力信号を表す説明図を図7に示す。ここで
は、RTS−1とRTS−2の命令判定信号52の行が
図6と異なる。つまり、反転状態フラグ110が1のと
きでもRTS−1とRTS−2の実行がなされ、RTS
−2の解読によって反転状態フラグ110が1から0に
リセットされることを示している。
The structure of the instruction decoding circuit according to the second embodiment is as shown in FIG. 3 and has been described in the first embodiment. FIG. 7 is an explanatory diagram showing input / output signals of the operand control circuit 53 according to the second embodiment. Here, the rows of the instruction determination signal 52 of RTS-1 and RTS-2 are different from those in FIG. That is, even when the inversion state flag 110 is 1, RTS-1 and RTS-2 are executed and RTS-1 and RTS-2 are executed.
It is shown that the inversion state flag 110 is reset from 1 to 0 by decoding -2.

【0200】また、図7のFJSR−2、FRTS−
2、およびRTS−2では、反転状態フラグ110の列
で矢印を示しているが、これは、実施形態1で述べたタ
イミングと後述するタイミング(RTS−2)に従っ
て、反転状態フラグ110を矢印の左に記された値から
右に記された値に変化させることを表す。
In addition, FJSR-2 and FRTS- in FIG.
2 and RTS-2, an arrow is shown in the column of the inversion state flag 110, but the inversion state flag 110 is indicated by an arrow according to the timing described in the first embodiment and a timing (RTS-2) described later. It means changing from the value shown on the left to the value shown on the right.

【0201】上述した構成を備えた本実施形態2のデー
タ処理装置が、プログラム例1に比べてコードサイズが
2バイト縮小されたプログラム例(図5)を、どのよう
に処理するかを説明する。
How the data processing device of the second embodiment having the above-mentioned configuration processes the program example (FIG. 5) in which the code size is reduced by 2 bytes compared to the program example 1 will be described. .

【0202】まず、このプログラム例の前半である命令
1[SUB 6,R3]、命令2[JSR @(LAB
EL2)]、命令3[MOV R0,@(4,R
3)]、命令4[MOV R1,@(2,R3)]、命
令5[MOV R2,@(0,R3)]、命令6[RT
S]、命令7[SUB R0,R0]までの一連の動作
を説明する。
First, the first half of this program example, instruction 1 [SUB 6, R3], instruction 2 [JSR @ (LAB
EL2)], instruction 3 [MOV R0, @ (4, R
3)], instruction 4 [MOV R1, @ (2, R3)], instruction 5 [MOV R2, @ (0, R3)], instruction 6 [RT
S] and instruction 7 [SUB R0, R0].

【0203】命令1のとき反転状態フラグ110は0で
ある。次に命令2[JSR @(LABEL2)]では
(LABEL2で示される命令に実行順序を移す)、J
SR−1、JSR−2、かつ反転状態フラグ110が0
の行(図7)に従って制御される。このとき反転状態フ
ラグ110は0のままである。さらに、命令3〜命令5
までが、反転状態フラグ110を0として実行される。
In the case of instruction 1, the inversion state flag 110 is 0. Next, in the instruction 2 [JSR @ (LABEL2)] (the execution order is shifted to the instruction indicated by LABEL2), J
SR-1, JSR-2, and the inversion state flag 110 is 0
(FIG. 7). At this time, the inversion state flag 110 remains 0. Furthermore, instruction 3 to instruction 5
Are executed with the inversion state flag 110 set to 0.

【0204】次に命令6[RTS]では(命令7に実行
順序を移す)、RTS−1、RTS−2かつ反転状態フ
ラグ110が0の行(図7)に従って制御される。この
とき反転状態フラグ110は0のままであって更新され
ることはない。そして命令7が反転状態フラグ110を
0として実行される。つまり、命令1は図8(タイミン
グt1〜t3)に、命令2は図10(タイミングt1〜
t4)に、命令3〜命令5は図8(タイミングt2〜t
6)に、命令6は図9(タイミングt5〜t8)に、命
令7は図8(タイミングt5〜t7)によって、すでに
説明した動作をするものである。
Next, in the instruction 6 [RTS] (moving the execution order to the instruction 7), RTS-1, RTS-2 and the inversion state flag 110 are controlled in accordance with the line of 0 (FIG. 7). At this time, the inversion state flag 110 remains 0 and is not updated. Then, the instruction 7 is executed with the inversion state flag 110 set to 0. That is, the instruction 1 is shown in FIG. 8 (timings t1 to t3), and the instruction 2 is shown in FIG. 10 (timings t1 to t3).
At t4), the instruction 3 to the instruction 5 are shown in FIG.
6), the instruction 6 performs the operation already described with reference to FIG. 9 (timing t5 to t8) and the instruction 7 with reference to FIG. 8 (timing t5 to t7).

【0205】次に、図5のプログラム例の後半である命
令1[FJSR @(LABEL2)]、命令2[MO
V R0,@(4,R3)]、命令3[MOV R1,
@(2,R3)]、命令4[MOV R2,@(0,R
3)]、命令5[RTS]、命令6[ADD 6,R
3]、命令7[RTS]までの一連の動作を説明する。
Next, the second half of the program example of FIG. 5 is instruction 1 [FJSR @ (LABEL2)], instruction 2 [MO.
V R0, @ (4, R3)], instruction 3 [MOV R1,
@ (2, R3)], instruction 4 [MOV R2, @ (0, R
3)], instruction 5 [RTS], instruction 6 [ADD 6, R
3], a series of operations up to the instruction 7 [RTS] will be described.

【0206】命令1[FJSR @(LABEL2)]
では(LABEL2で示される命令に実行順序を移
す)、FJSR−1、FJSR−2かつ反転状態フラグ
110が0の行(図7)に従って制御される。このとき
反転状態フラグ110はFRTS−2で0から1に更新
される。さらに命令2〜命令4までが反転状態フラグ1
10を1として実行される。次に命令5[RTS]では
(命令6に実行順序を移す)、RTS−1、RTS−2
かつ反転状態フラグ110が1の行(図7)に従って制
御される。このとき反転状態フラグ110はRTS−2
で1から0にリセットされる。この動作は本実施形態2
によるデータ処理装置に備わる機能であるが、反転状態
フラグ110の値に関係なく命令5[RTS]は実行さ
れRTS−2で0にリセットされるものと考えてよい。
つぎに、命令6と命令7が反転状態フラグ110を0と
して実行される。
Instruction 1 [FJSR @ (LABEL2)]
Then (moving the execution order to the instruction indicated by LABEL2), the FJSR-1, FJSR-2, and the inversion state flag 110 are controlled according to the row of 0 (FIG. 7). At this time, the inversion state flag 110 is updated from 0 to 1 in FRTS-2. Further, the instruction 2 to the instruction 4 are in the inverted state flag 1
10 is executed as 1. Next, in the instruction 5 [RTS] (moving the execution order to the instruction 6), RTS-1, RTS-2
And the inversion state flag 110 is controlled according to the row of 1 (FIG. 7). At this time, the inversion state flag 110 is set to RTS-2.
Is reset from 1 to 0. This operation is the second embodiment.
It is possible to consider that the command 5 [RTS] is executed and reset to 0 by RTS-2 regardless of the value of the inversion state flag 110, although it is a function provided in the data processing device according to.
Next, the instructions 6 and 7 are executed with the inversion state flag 110 set to 0.

【0207】なお、命令1〜命令4は図12(タイミン
グt1〜t7)に、命令6と命令7は図9(タイミング
t4〜t8)によって、すでに説明した動作をするもの
である。従って、ここでは反転状態フラグ110の値が
1のときに、命令5[RTS]がどのように処理される
かのみを説明するものとする。
It should be noted that the instructions 1 to 4 operate as already described with reference to FIG. 12 (timings t1 to t7) and the instructions 6 and 7 with FIG. 9 (timings t4 to t8). Therefore, here, only how the instruction 5 [RTS] is processed when the value of the inversion state flag 110 is 1 will be described.

【0208】プログラム実行例6として、反転状態フラ
グ110の値が1のとき命令5[RTS]をどのように
処理するかを説明するために、命令4[MOV R2,
@(0,R3)]から命令5[RTS]、命令6[AD
D 6,R3]を、本実施形態2によるデータ処理装置
によって順に処理する場合の動作を示す(ただし、命令
4はEXステージのみ説明を付する)。
As a sixth program execution example, in order to explain how to process the instruction 5 [RTS] when the value of the inversion state flag 110 is 1, the instruction 4 [MOV R2,
@ (0, R3)] to command 5 [RTS], command 6 [AD
D 6, R 3] are sequentially processed by the data processing device according to the second embodiment (however, for instruction 4, only the EX stage is described).

【0209】図14は、プログラム実行例6によるパイ
プライン動作の説明図である。以下、時間が経過する順
にタイミング毎にその動作を説明する。なお、反転状態
フラグ110は命令1[FJSR @(LABEL
2)]により更新された後であるため、タイミングt1
のとき1である。
FIG. 14 is an explanatory diagram of the pipeline operation according to the program execution example 6. Hereinafter, the operation will be described for each timing in order of the passage of time. The inversion state flag 110 is set to the instruction 1 [FJSR @ (LABEL
2)], the timing is t1.
Is 1 when.

【0210】(プログラム実行例6:反転状態フラグ1
10をリセットするRTS動作) <タイミングt1> IFステージ:命令5[RTS] タイミングt11:命令5がROM106から読出さ
れ、命令レジスタ108に格納される。
(Program execution example 6: Inversion state flag 1)
RTS operation for resetting 10) <Timing t1> IF stage: instruction 5 [RTS] Timing t11: Instruction 5 is read from the ROM 106 and stored in the instruction register 108.

【0211】<タイミングt2> EXステージ:命令4[MOV R2,@(0,R
3)] タイミングt21:BBUSとCBUSにより読み出さ
れた値が加算された後、RLST104からABUSを
介してOAR103に格納される。
<Timing t2> EX stage: Instruction 4 [MOV R2, @ (0, R
3)] Timing t21: After the values read by BBUS and CBUS are added, the values are stored in the OAR 103 from the RLST 104 via ABUS.

【0212】タイミングt22:第1セレクタ114を
介してOAR103で示されるメモリアドレスからデー
タがロードされる(MRDによる制御)。ロードされた
データはABUSを介してDEST[1:0]で示され
るレジスタに格納される(RWTによる制御)。
Timing t22: Data is loaded from the memory address indicated by OAR 103 via the first selector 114 (control by MRD). The loaded data is stored in the register indicated by DEST [1: 0] via ABUS (control by RWT).

【0213】DECステージ:命令5[RTS−1] タイミングt21:命令レジスタ108に格納された命
令5が命令解読回路123により解読される。反転状態
フラグ110の値1がオペランド制御回路53と命令解
読器50に入力される。RTS−1の命令判定信号52
が出力される。
DEC stage: Instruction 5 [RTS-1] Timing t21: Instruction 5 stored in the instruction register 108 is decoded by the instruction decoding circuit 123. The value 1 of the inversion state flag 110 is input to the operand control circuit 53 and the instruction decoder 50. Command determination signal 52 of RTS-1
Is output.

【0214】タイミングt22: 命令解読回路123
よりパイプライン制御信号109が出力される。オペラ
ンド制御回路53からRTS−1の命令に相当するオペ
ランドアクセス制御信号54が出力される。
Timing t22: instruction decoding circuit 123
Then, the pipeline control signal 109 is output. Operand control circuit 53 outputs an operand access control signal 54 corresponding to the RTS-1 instruction.

【0215】IFステージ:スキップ タイミングt21:RTS−1の命令判定信号52によ
り命令フェッチがスキップされる。
IF stage: Skip timing t21: Instruction fetch is skipped by the instruction determination signal 52 of RTS-1.

【0216】<タイミングt3> EXステージ:命令5[RTS−1] タイミングt31:BBUSに読み出されたSPの値が
演算器102をスルーされた後、RLST104からA
BUSを介してOAR103に格納される。
<Timing t3> EX stage: Instruction 5 [RTS-1] Timing t31: SP value read in BBUS is passed through the arithmetic unit 102, and then RLST 104 outputs A.
It is stored in the OAR 103 via the BUS.

【0217】タイミングt32:第1セレクタ114を
介してOAR103で示されるメモリアドレスからデー
タがロードされる(MRDによる制御)。ロードされた
データはABUSを介してPCに格納される。
Timing t32: Data is loaded from the memory address indicated by the OAR 103 via the first selector 114 (control by MRD). The loaded data is stored in the PC via ABUS.

【0218】DECステージ:命令5[RTS−2] タイミングt31:命令レジスタ108に格納された命
令5が再び命令解読回路123により解読される。RT
S−2の命令判定信号52が出力される。反転状態フラ
グ110の値が、オペランド制御回路53と命令解読器
50に入力される。
DEC stage: Instruction 5 [RTS-2] Timing t31: Instruction 5 stored in the instruction register 108 is decoded again by the instruction decoding circuit 123. RT
The instruction determination signal 52 of S-2 is output. The value of the inversion state flag 110 is input to the operand control circuit 53 and the instruction decoder 50.

【0219】タイミングt32: 命令解読回路123
よりパイプライン制御信号109が出力される。オペラ
ンド制御回路53からRTS−2の命令に相当するオペ
ランドアクセス制御信号54が出力される。BBUSに
SPの値が読み出される(RRDによる制御)。CBU
Sにx'02が定数発生器112から読み出される。さ
らに反転状態フラグ110の値が1から0にリセットさ
れる。
Timing t32: instruction decoding circuit 123
Then, the pipeline control signal 109 is output. The operand control circuit 53 outputs an operand access control signal 54 corresponding to the RTS-2 instruction. The SP value is read into BBUS (control by RRD). CBU
X'02 is read from S from the constant generator 112. Further, the value of the inversion state flag 110 is reset from 1 to 0.

【0220】IFステージ:命令6[ADD 6,R
3] タイミングt31:命令6がROM106から読出さ
れ、命令レジスタ108に格納される。
IF stage: Instruction 6 [ADD 6, R
3] Timing t31: Instruction 6 is read from ROM 106 and stored in instruction register 108.

【0221】<タイミングt4> EXステージ:命令5[RTS−2] タイミングt41:BBUSとCBUSに読み出された
値が加算された後,RLST104からABUSを介し
て、SPに格納される(RWTによる制御)。タイミン
グt42:何も実行されない。
<Timing t4> EX stage: Instruction 5 [RTS-2] Timing t41: After the values read to BBUS and CBUS are added, the values are stored in SP from RLST 104 via ABUS (by RWT). control). Timing t42: Nothing is executed.

【0222】DECステージ:命令6[ADD 6,R
3] タイミングt41:命令レジスタ108に格納された命
令6が命令解読回路123により解読される。R−im
m8の命令判定信号52が出力される。反転状態フラグ
110の値0がオペランド制御回路53に入力される。
DEC stage: instruction 6 [ADD 6, R
3] Timing t41: The instruction 6 stored in the instruction register 108 is decoded by the instruction decoding circuit 123. R-im
The instruction determination signal 52 of m8 is output. The value 0 of the inversion state flag 110 is input to the operand control circuit 53.

【0223】タイミングt42: 命令解読回路123
よりパイプライン制御信号109が出力される。
Timing t42: instruction decoding circuit 123
Then, the pipeline control signal 109 is output.

【0224】IFステージ:命令7[次命令] タイミングt41:説明を省略する。IF stage: Instruction 7 [next instruction] Timing t41: Description is omitted.

【0225】<タイミングt5> EXステージ:命令6[ADD 6,R3] タイミングt51:ABUSにDEST[1:0]で示
されるレジスタの値を読み出す(RRDによる制御)。
CBUSにimm8(このとき6)が定数発生器112
から読み出される。
<Timing t5> EX stage: Instruction 6 [ADD 6, R3] Timing t51: The value of the register indicated by DEST [1: 0] is read in ABUS (control by RRD).
In CBUS, imm8 (6 at this time) is the constant generator 112.
Read from.

【0226】タイミングt52:ABUSとCBUSに
読み出された値が演算器102で加算された後、RLS
T104からABUSを介してDEST[1:0]で示
されるレジスタに格納される(RWTによる制御)。
Timing t52: The values read out to ABUS and CBUS are added by the arithmetic unit 102, and then RLS is passed.
It is stored in the register indicated by DEST [1: 0] from T104 via ABUS (control by RWT).

【0227】DECステージ:命令7[次命令] タイミングt51:説明を省略する。DEC stage: instruction 7 [next instruction] Timing t51: Description is omitted.

【0228】タイミングt52:説明を省略する。Timing t52: Description is omitted.

【0229】IFステージ:説明を省略する。IF stage: Description is omitted.

【0230】タイミングt51:説明を省略する。Timing t51: Description is omitted.

【0231】以上のようにプログラム実行例6では、反
転状態フラグ110が1として命令5[RTS]が解読
されたとき、RTS−2の命令判定信号52の解読とと
もに、タイミングt32のDECステージで、反転状態
フラグ110が1から0にリセットされている。この動
作は本実施形態2によるデータ処理装置に備わる機能で
あるが、反転状態フラグ110の値に関係なく命令5
[RTS]は実行されRTS−2で0にリセットされる
こととなる。
As described above, in the program execution example 6, when the inversion state flag 110 is set to 1 and the instruction 5 [RTS] is decoded, along with the decoding of the instruction determination signal 52 of RTS-2, the DEC stage of timing t32 The inversion state flag 110 is reset from 1 to 0. This operation is a function provided in the data processing device according to the second embodiment, but the command 5 is executed regardless of the value of the inversion state flag 110.
[RTS] will be executed and reset to 0 by RTS-2.

【0232】これによって、命令[JSR @(LAB
EL2)]と命令[FJSR @(LABEL2)]
で、プログラム例3の8行目から11行目までのサブル
ーチンによるデータ処理が2通りとなる。ここで先の図
4に示したプログラム例では、その2行目から4行目に
配置された命令を、別のプログラムからFJSRのみを
使用してサブルーチンコールすることが可能であった。
これに対して、本実施形態2のデータ処理装置によれ
ば、FJSRとJSRを使い分けてサブルーチンコール
することが可能である。これによりサブルーチン再利用
の可能性が高まり、プログラムサイズの縮小効果が向上
する。
As a result, the command [JSR @ (LAB
EL2)] and command [FJSR @ (LABEL2)]
Then, there are two types of data processing by the subroutine from the 8th line to the 11th line of the program example 3. Here, in the program example shown in FIG. 4, it is possible to make a subroutine call to the instructions arranged in the second to fourth lines from another program by using only FJSR.
On the other hand, according to the data processing device of the second embodiment, it is possible to selectively use FJSR and JSR and make a subroutine call. This increases the possibility of reusing the subroutine and improves the effect of reducing the program size.

【0233】[実施の形態3]以下、本発明の実施形態
3について図3、図7、図17、図18、図19、図2
0、図21を用いて説明する。本実施形態3によるデー
タ処理装置では実施形態2によるデータ処理装置に命令
[MOV @(R0,R1),@(R0,R2)]を処
理する機能が追加されている。そのため、上述した実施
形態2と同様の構成をとるものについては、同じ番号を
付して説明を省略する。なお、命令[MOV @(R
0,R1),@(R0,R2)]は、レジスタR0の値
とレジスタR1の値を加算したアドレスからデータをロ
ードして、レジスタR0の値とレジスタR2の値を加算
したアドレスにデータをストアする動作を指示するもの
である。
[Third Embodiment] The third embodiment of the present invention will be described below with reference to FIGS. 3, 7, 17, 18, 19, and 2.
0 will be described with reference to FIG. In the data processing device according to the third embodiment, the data processing device according to the second embodiment is added with a function of processing an instruction [MOV @ (R0, R1), @ (R0, R2)]. Therefore, components having the same configurations as those of the second embodiment described above are designated by the same reference numerals and description thereof will be omitted. The instruction [MOV @ (R
0, R1), @ (R0, R2)] loads data from an address where the value of register R0 and the value of register R1 are added, and data is added to the address where the value of register R0 and the value of register R2 are added. This is an instruction to store.

【0234】図19に、本実施形態3によるデータ処理
装置の構成を示す。116はロードデータを一時記憶す
るLDBである。このデータ処理装置は、図2で説明し
たデータ処理装置とは、LDB116が追加されている
点で異なっており、LDB116はロードされたデータ
を一時記憶し、ストアするときに第2セレクタ115を
介してデータを出力する。
FIG. 19 shows the configuration of the data processing device according to the third embodiment. Reference numeral 116 is an LDB for temporarily storing load data. This data processing device is different from the data processing device described with reference to FIG. 2 in that an LDB 116 is added, and the LDB 116 temporarily stores the loaded data and stores the loaded data via the second selector 115. And output the data.

【0235】図17は、本実施形態3で追加される命令
の説明図である。ここで図17(a)の命令フォーマッ
トf6は、2byteからなる。また、reg1[1:
0]とdreg[1:0]を加算したアドレスがロード
のメモリアドレスであり、reg2[1:0]とdre
g[1:0]を加算したアドレスがストアするメモリア
ドレスとなる。命令解読回路123により命令が解読さ
れると、reg1[1:0]、reg2[1:0]、d
reg[1:0]のフィールドが既知となるものとす
る。
FIG. 17 is an explanatory diagram of instructions added in the third embodiment. Here, the instruction format f6 in FIG. 17A is composed of 2 bytes. Also, reg1 [1:
0] and dreg [1: 0] are added to be the load memory address, and reg2 [1: 0] and dre [1: 0] are added.
The address to which g [1: 0] is added becomes the memory address to be stored. When the instruction decoding circuit 123 decodes the instruction, reg1 [1: 0], reg2 [1: 0], d
It is assumed that the field of reg [1: 0] is known.

【0236】図17(b)には、命令タイプ、命令フォ
ーマット、および命令コードが示されている。図17
(b)の命令コードが命令解読器50により解読される
と、命令タイプLDSTとして判定され、ステージに応
じた命令判定信号52が出力される。
FIG. 17B shows the instruction type, instruction format, and instruction code. FIG. 17
When the instruction code of (b) is decoded by the instruction decoder 50, it is determined as the instruction type LDST, and the instruction determination signal 52 corresponding to the stage is output.

【0237】図18は、本実施形態3により追加される
オペランド制御回路の入出力信号を表す説明図である。
図7に図18の各行が追加され、機能追加される。命令
判定信号52[LDST−1]と[LDST−2]は、
命令[MOV @(R0,R1),@(R0,R2)]
を命令解読器50が解読したときに出力される命令判定
信号52であって、図3の説明で前述した命令の判定種
類に追加されるものであり、DECステージとEXステ
ージがそれぞれ2ステージで処理される。
FIG. 18 is an explanatory diagram showing input / output signals of the operand control circuit added according to the third embodiment.
18 is added to FIG. 7 to add a function. The command determination signals 52 [LDST-1] and [LDST-2] are
Instruction [MOV @ (R0, R1), @ (R0, R2)]
Is an instruction decision signal 52 that is output when the instruction decoder 50 decodes, and is added to the instruction decision types described in the description of FIG. 3, and the DEC stage and the EX stage each have two stages. It is processed.

【0238】ここで、DIRの値が1のとき、reg1
[1:0]とdreg[1:0]を加算したアドレスが
転送元となり、reg2[1:0]とdreg[1:
0]を加算したアドレスが転送先となる。反対に、DI
Rの値が0のとき、reg2[1:0]とdreg
[1:0]を加算したアドレスが転送元となり、reg
1[1:0]とdreg[1:0]を加算したアドレス
が転送先となる。
Here, when the value of DIR is 1, reg1
The address obtained by adding [1: 0] and dreg [1: 0] is the transfer source, and reg2 [1: 0] and dreg [1:
0] is added to the transfer destination. On the contrary, DI
When the value of R is 0, reg2 [1: 0] and dreg
The address to which [1: 0] is added becomes the transfer source, and reg
The address obtained by adding 1 [1: 0] and dreg [1: 0] is the transfer destination.

【0239】上述した本実施形態3による構成では、図
17(b)で示した命令コードを処理することができ、
それを解読するときに、図18に示したとおり、反転状
態フラグ110の値に応じてオペランドアクセス制御信
号54を出力するよう構成されている。以下、反転状態
フラグ110が0のとき本実施形態3の追加命令を処理
する動作(プログラム実行例7)と、反転状態フラグ1
10が1のとき同じく追加命令を処理する動作(プログ
ラム実行例)を、それぞれ説明する。
With the configuration according to the third embodiment described above, the instruction code shown in FIG. 17B can be processed.
When it is decoded, as shown in FIG. 18, the operand access control signal 54 is output according to the value of the inversion state flag 110. Hereinafter, the operation of processing the additional instruction of the third embodiment when the inversion state flag 110 is 0 (program execution example 7), and the inversion state flag 1
The operation (program execution example) of processing the additional instruction when 10 is 1 will be described respectively.

【0240】最初に、プログラム実行例7として、本実
施形態3によるデータ処理装置によって命令[MOV
@(R0,R1),@(R0,R2)]を反転状態フラ
グ110の値0にて処理する動作を説明する。図20
は、プログラム実行例7によるパイプライン動作の説明
図である。以下、時間が経過する順にタイミング毎にそ
の動作を説明する(タイミングt1のとき反転状態フラ
グ110が0)。
First, as a program execution example 7, an instruction [MOV is executed by the data processing device according to the third embodiment.
The operation of processing @ (R0, R1), @ (R0, R2)] with the value 0 of the inversion state flag 110 will be described. Figure 20
FIG. 14 is an explanatory diagram of pipeline operation according to program execution example 7. Hereinafter, the operation will be described for each timing in order of the passage of time (the inversion state flag 110 is 0 at the timing t1).

【0241】(プログラム実行例7:反転状態フラグ1
10が0のときの追加命令動作) <タイミングt1> IFステージ:命令[MOV @(R0,R1),@
(R0,R2)] タイミングt11:命令がROM106から読出され、
命令レジスタ108に格納される。
(Program execution example 7: Inversion state flag 1)
Operation of additional instruction when 10 is 0) <Timing t1> IF stage: instruction [MOV @ (R0, R1), @
(R0, R2)] Timing t11: The instruction is read from the ROM 106,
It is stored in the instruction register 108.

【0242】<タイミングt2> DECステージ:命令[LDST−1 : MOV @
(R0,R1),@(R0,R2)] タイミングt21:命令レジスタ108に格納された命
令が命令解読回路123により解読される。反転状態フ
ラグ110の値0がオペランド制御回路53と命令解読
器50に入力される。LDST−1の命令判定信号52
が出力される。
<Timing t2> DEC stage: instruction [LDST-1: MOV @
(R0, R1), @ (R0, R2)] Timing t21: The instruction stored in the instruction register 108 is decoded by the instruction decoding circuit 123. The value 0 of the inversion state flag 110 is input to the operand control circuit 53 and the instruction decoder 50. LDST-1 instruction determination signal 52
Is output.

【0243】タイミングt72:命令解読回路123よ
りパイプライン制御信号109が出力される。オペラン
ド制御回路53からLDST−1の命令判定信号かつ反
転状態フラグ110の値が0に対応したオペランドアク
セス制御信号54が出力される。BBUSにSRC
[1:0]で示されるレジスタの値が読み出される(R
RDによる制御)。ABUSにdreg[1:0]に相
当するレジスタR0の値が読み出される。
Timing t72: The instruction decoding circuit 123 outputs the pipeline control signal 109. The operand control circuit 53 outputs an LDST-1 instruction determination signal and an operand access control signal 54 in which the value of the inversion state flag 110 is 0. BBUS to SRC
The value of the register indicated by [1: 0] is read (R
Control by RD). The value of the register R0 corresponding to dreg [1: 0] is read to ABUS.

【0244】<タイミングt3> EXステージ:命令[LDST−1 : MOV @
(R0,R1),@(R0,R2)] タイミングt31:ABUSとBBUSに読み出された
値が加算された後、RLST104からABUSを介し
てOAR103に格納される。
<Timing t3> EX stage: instruction [LDST-1: MOV @
(R0, R1), @ (R0, R2)] Timing t31: The read values are added to ABUS and BBUS, and then stored in the OAR 103 from the RLST 104 via ABUS.

【0245】タイミングt32:第1セレクタ114を
介してOAR103で示されるメモリアドレスからデー
タがロードされる(MRDによる制御)。ロードされた
データはABUSを介してLDB116に格納される。
Timing t32: Data is loaded from the memory address indicated by the OAR 103 via the first selector 114 (control by MRD). The loaded data is stored in the LDB 116 via ABUS.

【0246】DECステージ:命令[LDST−2 :
MOV @(R0,R1),@(R0,R2)] タイミングt31:命令レジスタ108に格納された命
令が再び命令解読回路123により解読される。LDS
T−2の命令判定信号52が出力される。反転状態フラ
グ110の値0が、オペランド制御回路53と命令解読
器50に入力される。
DEC stage: instruction [LDST-2:
MOV @ (R0, R1), @ (R0, R2)] Timing t31: The instruction stored in the instruction register 108 is decoded again by the instruction decoding circuit 123. LDS
The instruction determination signal 52 of T-2 is output. The value 0 of the inversion state flag 110 is input to the operand control circuit 53 and the instruction decoder 50.

【0247】タイミングt32:命令解読回路123よ
りパイプライン制御信号109が出力される。オペラン
ド制御回路53からLDST−1の命令判定信号かつ反
転状態フラグ110の値が0に対応したオペランドアク
セス制御信号54が出力される。BBUSにDEST
[1:0]で示されるレジスタの値が読み出される(R
RDによる制御)。ABUSにdreg[1:0]に相
当するレジスタR0の値が読み出される。
Timing t32: The instruction decoding circuit 123 outputs the pipeline control signal 109. The operand control circuit 53 outputs an LDST-1 instruction determination signal and an operand access control signal 54 in which the value of the inversion state flag 110 is 0. BBUS to DEST
The value of the register indicated by [1: 0] is read (R
Control by RD). The value of the register R0 corresponding to dreg [1: 0] is read to ABUS.

【0248】<タイミングt4> EXステージ:命令[LDST−2 : MOV @
(R0,R1),@(R0,R2)] タイミングt41:ABUSとBBUSに読み出された
値が加算された後、RLST104からABUSを介し
てOAR103に格納される。
<Timing t4> EX stage: instruction [LDST-2: MOV @
(R0, R1), @ (R0, R2)] Timing t41: The values read out to ABUS and BBUS are added, and then stored in the OAR 103 from the RLST 104 via ABUS.

【0249】タイミングt42:第1セレクタ114を
介してOAR103で示されるメモリアドレスにLDB
116に格納されたデータがストアされる(MWTによ
る制御)。
Timing t42: LDB to the memory address indicated by OAR 103 via the first selector 114.
The data stored in 116 is stored (control by MWT).

【0250】次に、プログラム実行例8として、本実施
形態3によるデータ処理装置によって命令[MOV @
(R0,R1),@(R0,R2)]を反転状態フラグ
110の値1にて処理する動作を説明する。図21は、
プログラム実行例8によるパイプライン動作の説明図で
ある。以下、時間が経過する順にタイミング毎にその動
作を説明する(タイミングt1のとき反転状態フラグ1
10が1)。
Next, as a program execution example 8, an instruction [MOV @ is issued by the data processing device according to the third embodiment.
The operation of processing (R0, R1), @ (R0, R2)] with the value 1 of the inversion state flag 110 will be described. FIG. 21 shows
FIG. 16 is an explanatory diagram of pipeline operation according to program execution example 8. Hereinafter, the operation will be described for each timing in the order in which time elapses (inversion state flag 1 at timing t1
10 is 1).

【0251】(プログラム実行例8:反転状態フラグ1
10が1のときの追加命令動作) <タイミングt1> IFステージ:命令[MOV @(R0,R1),@
(R0,R2)] タイミングt11:命令がROM106から読出され、
命令レジスタ108に格納される。
(Program execution example 8: Inversion state flag 1)
Operation of additional instruction when 10 is 1) <Timing t1> IF stage: instruction [MOV @ (R0, R1), @
(R0, R2)] Timing t11: The instruction is read from the ROM 106,
It is stored in the instruction register 108.

【0252】<タイミングt2> DECステージ:命令[LDST−1 : MOV @
(R0,R1),@(R0,R2)] タイミングt21:命令レジスタ108に格納された命
令が命令解読回路123により解読される。反転状態フ
ラグ110の値1がオペランド制御回路53と命令解読
器50に入力される。LDST−1の命令判定信号52
が出力される。
<Timing t2> DEC stage: instruction [LDST-1: MOV @
(R0, R1), @ (R0, R2)] Timing t21: The instruction stored in the instruction register 108 is decoded by the instruction decoding circuit 123. The value 1 of the inversion state flag 110 is input to the operand control circuit 53 and the instruction decoder 50. LDST-1 instruction determination signal 52
Is output.

【0253】タイミングt72: 命令解読回路123
よりパイプライン制御信号109が出力される。オペラ
ンド制御回路53からLDST−1の命令判定信号かつ
反転状態フラグ110の値が1に対応するオペランドア
クセス制御信号54が出力される。BBUSにSRC
[1:0]で示されるレジスタの値が読み出される(R
RDによる制御)。ABUSにdreg[1:0]に相
当するレジスタR0の値が読み出される。
Timing t72: instruction decoding circuit 123
Then, the pipeline control signal 109 is output. The operand control circuit 53 outputs an instruction determination signal of LDST-1 and an operand access control signal 54 in which the value of the inversion state flag 110 corresponds to 1. BBUS to SRC
The value of the register indicated by [1: 0] is read (R
Control by RD). The value of the register R0 corresponding to dreg [1: 0] is read to ABUS.

【0254】<タイミングt3> EXステージ:命令[LDST−1 : MOV @
(R0,R1),@(R0,R2)] タイミングt31:ABUSとBBUSに読み出された
値が加算された後、RLST104からABUSを介し
てOAR103に格納される。
<Timing t3> EX stage: instruction [LDST-1: MOV @
(R0, R1), @ (R0, R2)] Timing t31: The read values are added to ABUS and BBUS, and then stored in the OAR 103 from the RLST 104 via ABUS.

【0255】タイミングt32:第1セレクタ114を
介してOAR103で示されるメモリアドレスからデー
タがロードされる(MRDによる制御)。ロードされた
データはABUSを介してLDB116に格納される。
Timing t32: Data is loaded from the memory address indicated by OAR 103 via the first selector 114 (control by MRD). The loaded data is stored in the LDB 116 via ABUS.

【0256】DECステージ:命令[LDST−2 :
MOV @(R0,R1),@(R0,R2)] タイミングt31:命令レジスタ108に格納された命
令が再び命令解読回路123により解読される。LDS
T−2の命令判定信号52が出力される。反転状態フラ
グ110の値0が、オペランド制御回路53と命令解読
器50に入力される。
DEC stage: instruction [LDST-2:
MOV @ (R0, R1), @ (R0, R2)] Timing t31: The instruction stored in the instruction register 108 is decoded again by the instruction decoding circuit 123. LDS
The instruction determination signal 52 of T-2 is output. The value 0 of the inversion state flag 110 is input to the operand control circuit 53 and the instruction decoder 50.

【0257】タイミングt32:命令解読回路123よ
りパイプライン制御信号109が出力される。オペラン
ド制御回路53からLDST−2の命令判定信号かつ反
転状態フラグ110の値が1に対応するオペランドアク
セス制御信号54が出力される。BBUSにDEST
[1:0]で示されるレジスタの値が読み出される(R
RDによる制御)。ABUSにdreg[1:0]に相
当するレジスタR0の値が読み出される。
Timing t32: The instruction decoding circuit 123 outputs the pipeline control signal 109. The operand control circuit 53 outputs an LDST-2 instruction determination signal and an operand access control signal 54 corresponding to the value of the inversion state flag 110 being 1. BBUS to DEST
The value of the register indicated by [1: 0] is read (R
Control by RD). The value of the register R0 corresponding to dreg [1: 0] is read to ABUS.

【0258】<タイミングt4> EXステージ:命令[LDST−2 : MOV @
(R0,R1),@(R0,R2)] タイミングt41:ABUSとBBUSに読み出された
値が加算された後、RLST104からABUSを介し
てOAR103に格納される。
<Timing t4> EX stage: instruction [LDST-2: MOV @
(R0, R1), @ (R0, R2)] Timing t41: The values read out to ABUS and BBUS are added, and then stored in the OAR 103 from the RLST 104 via ABUS.

【0259】タイミングt42:第1セレクタ114を
介してOAR103で示されるメモリアドレスにLDB
116に格納されたデータがストアされる(MWTによ
る制御)。
Timing t42: LDB to the memory address indicated by the OAR 103 via the first selector 114.
The data stored in 116 is stored (control by MWT).

【0260】上述したプログラム実行例7では、転送元
であるレジスタR0とレジスタR1の加算値をアドレス
とするメモリから、転送先であるレジスタR0とレジス
タR2の加算値をアドレスとするメモリへのデータ転送
がなされている。一方、プログラム実行例8では、転送
元であるレジスタR0とレジスタR2の加算値をアドレ
スとするメモリから、転送先であるレジスタR0とレジ
スタR1の加算値をアドレスとするメモリへのデータ転
送がなされている。これは図18に示したとおり反転状
態フラグ110の値に応じて、SRC[1:0]とDE
ST[1:0]のオペランドアクセス制御信号54を反
転させるように構成したからである。
In the above program execution example 7, data is transferred from the memory whose address is the added value of the register R0 and register R1 which is the transfer source to the memory whose address is the added value of the register R0 and register R2 which is the transfer destination. Transfers are being made. On the other hand, in Program Execution Example 8, data is transferred from a memory whose address is the added value of the register R0 and register R2 which is the transfer source to a memory whose address is the added value of the register R0 and register R1 which is the transfer destination. ing. As shown in FIG. 18, this corresponds to SRC [1: 0] and DE depending on the value of the inversion state flag 110.
This is because the ST [1: 0] operand access control signal 54 is configured to be inverted.

【0261】この命令を用いて、一例としてR0の値を
インクリメントしながら先頭番地をR1とするメモリ領
域から先頭番地をR2とするメモリ領域への一括データ
転送処理をする命令群を構成できる。なお、R0の値を
加算する命令は反転させる特定命令には含まれておら
ず、インクリメントの動作を妨げるものではない。本実
施形態3によるデータ処理装置によれば、このようなメ
モリからメモリへのデータ転送においても、データ転送
元と転送先を反転させる制御機構を備えており、実施形
態1、実施形態2で示した機構と組み合わせることによ
って、より実用的となりプログラムコードサイズを縮小
化することができる。
Using this instruction, as an example, it is possible to construct an instruction group for performing batch data transfer processing from the memory area having the leading address R1 to the memory area having the leading address R2 while incrementing the value of R0. The instruction to add the value of R0 is not included in the specific instruction to invert, and does not hinder the increment operation. The data processing apparatus according to the third embodiment includes the control mechanism that reverses the data transfer source and the transfer destination even in the data transfer from the memory to the memory as described in the first and second embodiments. It becomes more practical and the program code size can be reduced by combining with this mechanism.

【0262】なお、本発明にかかる反転対象命令は、特
に実施形態1〜3によるオペランド制御回路(反転命令
記憶手段を含む構成)によって明示された反転対象命令
に限定されるものではない。また、FJSRに相当する
命令が複数あって、前記複数の命令それぞれに該当する
反転対象命令が定められており、反転命令記憶手段が前
記複数の命令に応じた反転対象命令を記憶して、該当す
る反転対象命令に限り反転制御する構成としても良い。
The inversion target instruction according to the present invention is not particularly limited to the inversion target instruction specified by the operand control circuit (including the inversion instruction storage means) according to the first to third embodiments. Further, there are a plurality of instructions corresponding to FJSR, and the inversion target instructions corresponding to each of the plurality of instructions are defined, and the inversion instruction storage means stores the inversion target instructions according to the plurality of instructions, and It is also possible to adopt a configuration in which the inversion control is performed only for the inversion target instruction.

【0263】[0263]

【発明の効果】これまで述べてきたように、本発明のデ
ータ処理装置は、データ転送元と転送先を反転させる対
象命令に限り、反転状態記憶手段による指示に応じて、
オペランド制御回路がデータ転送元と転送先を反転させ
て、一つの命令群で処理されるデータ転送処理が2通り
実施可能となるので、冗長なプログラムコードを減らす
ことができ、プログラムコードサイズの小容量化に貢献
する。
As described above, according to the data processing device of the present invention, only the target instruction for inverting the data transfer source and the transfer destination is in accordance with the instruction from the inversion state storage means.
Since the operand control circuit inverts the data transfer source and the transfer destination and two types of data transfer processing that can be processed by one instruction group can be performed, redundant program codes can be reduced and the program code size can be reduced. Contributes to capacity.

【0264】また、本発明のデータ処理装置によれば、
第2の命令が解読されたときは命令の実行順序を直接制
御した後に一つの命令群によるデータ処理をし、データ
転送元と転送先を反転させる対象命令を明示的に指示す
るとともに命令の実行順序を直接制御する第1の命令が
解読されたときには同じく命令の実行順序を直接制御し
た後に一つの命令群による先とは異なるデータ処理を
し、さらに、第3の命令が解読されたときには反転状態
によらず更新前に戻す操作をすることが可能となる。つ
まり、一つの命令群に命令の実行順序を移すときに、第
1の命令と第2の命令のいずれかに応じて異なるデータ
転送処理がなされ、かつ復帰時にはデータ転送元と転送
先の扱いを通常に戻すことが可能となるので、冗長なプ
ログラムコードを削減するとともに、一つの命令群によ
るサブルーチンを2通りの処理で何度でもコールするこ
とができるようになるため、プログラミングの自由度が
高まる。
Further, according to the data processor of the present invention,
When the second instruction is decoded, the instruction execution order is directly controlled, and then data processing is performed by one instruction group, the target instruction whose data transfer source and transfer destination are inverted is explicitly indicated, and the instruction is executed. When the first instruction that directly controls the order is decoded, similarly, the execution order of the instructions is directly controlled, and then data processing different from the above is performed by one instruction group, and when the third instruction is decoded, it is inverted. It is possible to perform the operation of returning to the state before the update regardless of the state. That is, when the instruction execution order is transferred to one instruction group, different data transfer processing is performed depending on either the first instruction or the second instruction, and the data transfer source and the transfer destination are treated at the time of return. Since it is possible to return to the normal state, redundant program code can be reduced and a subroutine by one instruction group can be called any number of times by two kinds of processing, which increases the degree of freedom in programming. .

【0265】さらに、本発明のデータ処理装置によれ
ば、第1の命令が解読され反転状態がデータ転送元と転
送先を反転させるものとして更新中のときに限って第2
の命令は有効となる。これによって、第1の命令で反転
状態が更新されていないときには、第2の命令は無効化
されるので、不要な復帰処理をすることがなくなる。ま
た、第1の命令で一つの命令群に命令の実行順序を直接
制御したときに限って、通常とは異なるデータ転送処理
を要求するとともに、第2の命令により復帰処理となる
命令の実行順序を制御した後にデータ転送元と転送先を
反転させないものとして前記反転状態を更新前に戻すこ
とができる。つまり、第1の命令で一つの命令群に命令
の実行順序を移すことで、異なるデータ転送処理を要求
するとともに復帰時には通常に戻すことが可能となる。
本構成によれば、従来のプログラム記述からの変更を少
なくして、サブルーチン化されていない再利用すべき命
令群を第1の命令と第2の命令で効率的に再利用できる
(冗長なプログラムコードを2つの命令で置き換えるこ
とができる)。さらには、第1の命令により再度サブル
ーチンコールすることも可能であるように構成されてい
るため、これを利用することでプログラムサイズの縮小
効果がよりいっそう高まる。
Further, according to the data processing apparatus of the present invention, the second instruction is read only when the first instruction is decoded and the inversion state is inversion for inversion of the data transfer source and the transfer destination.
Command is valid. As a result, when the inverted state is not updated by the first instruction, the second instruction is invalidated, and unnecessary return processing is not performed. Further, only when the execution order of the instructions is directly controlled by one instruction group by the first instruction, a data transfer processing different from the normal one is requested, and the execution order of the instruction which becomes the return processing by the second instruction. It is possible to return the inversion state to the state before the update, assuming that the data transfer source and the transfer destination are not inverted after the control. In other words, by shifting the instruction execution order to one instruction group by the first instruction, it becomes possible to request different data transfer processing and return to normal when returning.
According to this configuration, it is possible to efficiently reuse a non-subroutine instruction group to be reused by the first instruction and the second instruction by reducing changes from the conventional program description (redundant program). You can replace the code with two instructions). Further, since the subroutine can be called again by the first instruction, the effect of reducing the program size is further enhanced by utilizing this.

【0266】上述したように、本発明によるデータ処理
装置はプログラムコードサイズの小容量化に貢献するも
のであって、その実用的効果は大きい。
As described above, the data processing device according to the present invention contributes to the reduction in the capacity of the program code size, and its practical effect is great.

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

【図1】 本発明にかかるデータ処理装置の命令コード
例を示す説明図
FIG. 1 is an explanatory diagram showing an example of an instruction code of a data processing device according to the present invention.

【図2】 本発明にかかるデータ処理装置の構成を示す
ブロック図
FIG. 2 is a block diagram showing a configuration of a data processing device according to the present invention.

【図3】 本発明にかかる命令解読回路の構成を示すブ
ロック図
FIG. 3 is a block diagram showing a configuration of an instruction decoding circuit according to the present invention.

【図4】 本発明の実施形態1のデータ処理装置で実行
されるプログラム例を示す説明図
FIG. 4 is an explanatory diagram showing an example of a program executed by the data processing device according to the first embodiment of the present invention.

【図5】 本発明の実施形態2のデータ処理装置で実行
されるプログラム例を示す説明図
FIG. 5 is an explanatory diagram showing an example of a program executed by the data processing device according to the second embodiment of the present invention.

【図6】 本発明の実施形態1にかかるオペランド制御
回路の入出力信号を表す説明図
FIG. 6 is an explanatory diagram showing input / output signals of the operand control circuit according to the first embodiment of the present invention.

【図7】 本発明の実施形態2にかかるオペランド制御
回路の入出力信号を表す説明図
FIG. 7 is an explanatory diagram showing input / output signals of the operand control circuit according to the second embodiment of the present invention.

【図8】 プログラム実行例1によるパイプライン動作
の説明図
FIG. 8 is an explanatory diagram of pipeline operation according to program execution example 1.

【図9】 プログラム実行例2によるパイプライン動作
の説明図
FIG. 9 is an explanatory diagram of a pipeline operation according to program execution example 2.

【図10】 プログラム実行例3によるパイプライン動
作の説明図
FIG. 10 is an explanatory diagram of a pipeline operation according to a program execution example 3.

【図11】 プログラム実行例4によるパイプライン動
作の説明図
FIG. 11 is an explanatory diagram of pipeline operation according to program execution example 4.

【図12】 プログラム実行例5(前半)によるパイプ
ライン動作の説明図
FIG. 12 is an explanatory diagram of pipeline operation according to program execution example 5 (first half).

【図13】 プログラム実行例5(後半)によるパイプ
ライン動作の説明図
FIG. 13 is an explanatory diagram of pipeline operation according to program execution example 5 (second half).

【図14】 プログラム実行例6によるパイプライン動
作の説明図
FIG. 14 is an explanatory diagram of pipeline operation according to program execution example 6;

【図15】 従来のデータ処理装置で実行されるプログ
ラム例の説明図
FIG. 15 is an explanatory diagram of a program example executed by a conventional data processing device.

【図16】 本発明のデータ処理装置による命令フォー
マットを表す説明図
FIG. 16 is an explanatory diagram showing an instruction format by the data processing device of the present invention.

【図17】 本発明の実施形態3で追加される命令の説
明図
FIG. 17 is an explanatory diagram of instructions added in the third embodiment of the present invention.

【図18】 本発明の実施形態3により追加されるオペ
ランド制御回路の入出力信号を表す説明図
FIG. 18 is an explanatory diagram showing input / output signals of an operand control circuit added according to the third embodiment of the present invention.

【図19】 本発明の実施形態3によるデータ処理装置
の構成を示すブロック図
FIG. 19 is a block diagram showing the configuration of a data processing device according to a third embodiment of the present invention.

【図20】 プログラム実行例7によるパイプライン動
作の説明図
FIG. 20 is an explanatory diagram of a pipeline operation according to the program execution example 7.

【図21】 プログラム実行例8によるパイプライン動
作の説明図
FIG. 21 is an explanatory diagram of a pipeline operation according to the program execution example 8.

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

50 命令解読器 52 命令判定信号 53 オペランド制御回路 54 オペランドアクセス制御信号 56 FRTS命令無効化信号 102 演算器 103 OAR 104 RSLT 105 レジスタファイル 106 ROM 108 命令レジスタ 109 パイプライン制御信号 110 反転状態フラグ 111 プログラムカウンタ 112 定数発生器 113 PCバス 114 第1セレクタ 115 第2セレクタ 116 LDB 122 バスインタフェース回路 123 命令解読回路 125 命令読出し回路 50 Instruction Decoder 52 Command judgment signal 53 Operand control circuit 54 Operand access control signal 56 FRTS command invalidation signal 102 arithmetic unit 103 OAR 104 RSLT 105 register file 106 ROM 108 Instruction register 109 Pipeline control signal 110 Inversion status flag 111 program counter 112 Constant generator 113 PC bus 114 first selector 115 Second selector 116 LDB 122 Bus interface circuit 123 Instruction decoding circuit 125 instruction read circuit

Claims (3)

【特許請求の範囲】[Claims] 【請求項1】 命令を順に読み込むフェッチ部と、読み
込んだ命令を解読する解読部と、解読した命令を実行す
る実行部とを備えたデータ処理装置であって、 データ転送元と転送先とを反転させる対象命令を記憶す
る反転命令記憶部と、前記対象命令を反転実行するか否
かを表す反転状態識別子を記憶する反転状態記憶部と、
命令中に記述されているデータ転送元と転送先とを反転
させるオペランド制御部とを備えたことを特徴とするデ
ータ処理装置。
1. A data processing device comprising: a fetch unit for sequentially reading instructions; a decoding unit for decoding the read instructions; and an execution unit for executing the decoded instructions, wherein a data transfer source and a transfer destination are provided. An inversion instruction storage unit that stores a target instruction to be inverted; an inversion state storage unit that stores an inversion state identifier that indicates whether or not the target instruction is inverted and executed;
A data processing device, comprising: an operand control unit for inverting a data transfer source and a transfer destination described in an instruction.
【請求項2】 前記対象命令を明示的に指定するととも
に命令の実行順序を直接制御する第1の命令と、命令の
実行順序を直接制御する第2の命令と、第1の命令ある
いは第2の命令と対をなして命令の実行順序を直接制御
する第3の命令とを記憶する命令記憶手段と、 前記第1の命令および前記第2の命令のうち、前記第1
の命令が解読されたときのみデータ転送元と転送先とを
反転させるものとして前記反転状態識別子を更新し、前
記第3の命令が解読されたときにデータ転送元と転送先
を反転させないものとして前記反転状態識別子を更新前
に戻す反転状態更新部とをさらに備えた、請求項1に記
載のデータ処理装置。
2. A first instruction that directly specifies the target instruction and directly controls the execution order of the instructions, a second instruction that directly controls the execution order of the instructions, and the first instruction or the second instruction. An instruction storing unit that stores a third instruction that directly controls the execution order of the instruction in pair with the instruction of, and the first instruction of the first instruction and the second instruction.
The inversion state identifier is updated so as to invert the data transfer source and the transfer destination only when the instruction is decoded, and the data transfer source and the transfer destination are not inverted when the third instruction is decoded. The data processing device according to claim 1, further comprising an inversion state updating unit that returns the inversion state identifier before updating.
【請求項3】 前記対象命令を明示的に指定するととも
に命令の実行順序を直接制御する第1の命令と、前記第
1の命令と対をなして同じく命令の実行順序を直接制御
する第2の命令とを記憶する命令記憶手段と、 前記第1の命令が解読されたときにデータ転送元と転送
先を反転させるものとして前記反転状態識別子を更新
し、前記第2の命令が解読されたときに前記反転状態識
別子がデータ転送元と転送先を反転させるものであるな
らば、命令の実行順序を制御した後にデータ転送元と転
送先を反転させないものとして前記反転状態識別子を更
新前に戻す反転状態更新手段と、 前記第2の命令が解読されたときに前記反転状態識別子
がデータ転送元と転送先を反転させないものであるなら
ば前記第2の命令を無効化する命令無効化制御手段とを
さらに備えた、請求項1に記載のデータ処理装置。
3. A first instruction that explicitly specifies the target instruction and directly controls the execution order of the instruction, and a second instruction that pairs with the first instruction and directly controls the execution order of the instruction. And an instruction storing means for storing the instruction, and the inversion state identifier is updated so as to invert the data transfer source and the transfer destination when the first instruction is decoded, and the second instruction is decoded. At this time, if the inversion state identifier is to invert the data transfer source and the transfer destination, the inversion state identifier is returned to the state before the update assuming that the data transfer source and the transfer destination are not inverted after controlling the execution order of the instructions. Inversion state updating means, and instruction invalidation control means for invalidating the second instruction if the inversion state identifier does not invert the data transfer source and the transfer destination when the second instruction is decoded. Further comprising data processing apparatus according to claim 1.
JP2001187041A 2001-06-20 2001-06-20 Data processor Withdrawn JP2003005955A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2001187041A JP2003005955A (en) 2001-06-20 2001-06-20 Data processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2001187041A JP2003005955A (en) 2001-06-20 2001-06-20 Data processor

Publications (1)

Publication Number Publication Date
JP2003005955A true JP2003005955A (en) 2003-01-10

Family

ID=19026397

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001187041A Withdrawn JP2003005955A (en) 2001-06-20 2001-06-20 Data processor

Country Status (1)

Country Link
JP (1) JP2003005955A (en)

Similar Documents

Publication Publication Date Title
KR100328162B1 (en) Information Processing Circuits and Microcomputers and Electronic Devices
JP3619939B2 (en) Central processing unit
JPH03218523A (en) Data processor
KR20010043826A (en) Microcontroller instruction set
US7546442B1 (en) Fixed length memory to memory arithmetic and architecture for direct memory access using fixed length instructions
KR100465388B1 (en) Eight-bit microcontroller having a risc architecture
JPH04233640A (en) Microcontroller having pseudo-linear bank which switches memory expanding scheme
JP3789583B2 (en) Data processing device
JP3578883B2 (en) Data processing device
CN111782270A (en) Data processing method and device and storage medium
US5991872A (en) Processor
JP3556252B2 (en) Data processing system and method for calculating offset total
JP2748957B2 (en) Data processing device
KR100188374B1 (en) Central processing unit and an arithmetic operation processing unit
JPH1091395A (en) Processor
JP2003005955A (en) Data processor
JP3332606B2 (en) Microprocessor
JP2001216136A (en) Addition circuit and processor
JP2013539882A (en) Conditional selection of data elements
JP4645369B2 (en) CPU
JP2000112754A (en) Data processor
EP0650614B1 (en) Digital signal processor architecture
JPH04195629A (en) Arithmetic flag generation device
JP2008083762A (en) Microcomputer
JPH06149563A (en) Data processor

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20080418

A761 Written withdrawal of application

Free format text: JAPANESE INTERMEDIATE CODE: A761

Effective date: 20100107