JP4498338B2 - Data processing device - Google Patents

Data processing device Download PDF

Info

Publication number
JP4498338B2
JP4498338B2 JP2006286815A JP2006286815A JP4498338B2 JP 4498338 B2 JP4498338 B2 JP 4498338B2 JP 2006286815 A JP2006286815 A JP 2006286815A JP 2006286815 A JP2006286815 A JP 2006286815A JP 4498338 B2 JP4498338 B2 JP 4498338B2
Authority
JP
Japan
Prior art keywords
instruction
register
address
bit
data
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.)
Expired - Fee Related
Application number
JP2006286815A
Other languages
Japanese (ja)
Other versions
JP2007048317A (en
Inventor
直幹 三ッ石
真一 芝原
貴裕 大久保
ひろみ 永山
健 片岡
正博 海永
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Renesas Technology Corp
Original Assignee
Renesas Technology Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Renesas Technology Corp filed Critical Renesas Technology Corp
Priority to JP2006286815A priority Critical patent/JP4498338B2/en
Publication of JP2007048317A publication Critical patent/JP2007048317A/en
Application granted granted Critical
Publication of JP4498338B2 publication Critical patent/JP4498338B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions
    • G06F9/30007Arrangements for executing specific machine instructions to perform operations on data operands
    • G06F9/30036Instructions to perform operations on packed data, e.g. vector, tile or matrix operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30145Instruction analysis, e.g. decoding, instruction word fields
    • G06F9/3016Decoding the operand specifier, e.g. specifier format
    • G06F9/30167Decoding the operand specifier, e.g. specifier format of immediate specifier, e.g. constants

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Executing Machine-Instructions (AREA)

Description

本発明は、マイクロコンピュータ、データプロセッサ又はマイクロプロセッサ等のように称されるデータ処理装置に関し、例えば中央処理装置(CPU)に利用してそのプログラム効率もしくはコード効率の向上に有効な技術に関するものである。   The present invention relates to a data processing device referred to as a microcomputer, a data processor, or a microprocessor, and more particularly to a technique that is effective for improving the program efficiency or code efficiency of a central processing unit (CPU). is there.

半導体集積回路化されたマイクロコンピュータは、アドレス空間の拡張や、命令セットの拡大、高速化などが図られてきた。オブジェクトレベルで互換性を保ちつつ、アドレス空間の拡張や、命令セット拡大を実現した例として、例えば、特許文献1並びに特許文献2等がある。それによれば、32ビットの汎用レジスタは、アドレスレジスタとしては、32ビットレジスタとして使用可能である。データレジスタは、32ビットレジスタとして使用するか、分割して16ビットレジスタとして使用するか、下位側の16ビットレジスタを更に分割して、8ビットレジスタとして使用するかを選択できる。また、特許文献3にはアドレス空間の大きさを示すレジスタを設け、その値によってアドレスデータを格納する汎用レジスタの大きさを可変にするプロセッサについて記載が有る。プログラム用のメモリであるROMを内蔵した、シングルチップ型のものにあっては、内蔵ROMの容量が、外部に接続可能なメモリに比較して、少ないから、プログラム容量を削減することが望ましい。   A microcomputer integrated with a semiconductor integrated circuit has been attempted to expand an address space, expand an instruction set, and increase speed. Examples of realizing address space expansion and instruction set expansion while maintaining compatibility at the object level include, for example, Patent Document 1 and Patent Document 2. According to this, a 32-bit general-purpose register can be used as a 32-bit register as an address register. The data register can be selected to be used as a 32-bit register, divided and used as a 16-bit register, or further divided into a lower-order 16-bit register and used as an 8-bit register. Further, Patent Document 3 describes a processor in which a register indicating the size of an address space is provided, and the size of a general-purpose register that stores address data is variable depending on the value. In the case of a single-chip type having a built-in ROM as a program memory, the capacity of the built-in ROM is less than that of a memory that can be connected to the outside, so it is desirable to reduce the program capacity.

また、近年、シングルチップ型のマイクロコンピュータのROMとして、電気的に書込み消去が可能なフラッシュメモリ、EEPROM(電気的に書込み消去可能なROM)が用いられることが多い。これらの電気的に書込み消去が可能なメモリは、記憶素子が大きく、また、書込み消去用の高電圧発生回路などが必要であって、その物理的規模が大きくなってしまうため、より一層、プログラム容量の削減が望ましい。内蔵RAMについても同様であり、使用するデータの容量を小さくできる方が望ましい。   In recent years, flash memories and EEPROMs (electrically erasable and erasable ROM) are often used as ROMs for single-chip microcomputers. These electrically erasable and erasable memories have a large storage element and require a high voltage generation circuit for writing and erasing, which increases the physical scale. Capacity reduction is desirable. The same applies to the built-in RAM, and it is desirable that the capacity of data to be used can be reduced.

一方、マイクロコンピュータのプログラムを、C言語などの高級言語で記述することが増えてきている。高級言語で記述する場合、アセンブリ言語で記述する場合に比較して、プログラム容量および使用するデータの容量が大きくなりやすい。   On the other hand, it is increasing that a microcomputer program is described in a high-level language such as C language. When written in a high-level language, the program capacity and the volume of data to be used tend to be larger than when written in assembly language.

レジスタ間接などのアドレシングモードについて記載された文献の例として特許文献4及び特許文献5がある。特許文献4にはディスプレースメント付きレジスタ間接アドレシングモードを持つデータ処理装置につての記載が有る。特許文献5にはディスプレースメント付きレジスタ間接アドレス指定モードを持つデータ処理装置につての記載が有る。   Examples of documents describing addressing modes such as register indirect include Patent Document 4 and Patent Document 5. Patent Document 4 describes a data processing apparatus having a register indirect addressing mode with displacement. Patent document 5 describes a data processing apparatus having a register indirect addressing mode with displacement.

特開平5−241826号公報JP-A-5-241826 特開平6−51981号公報JP-A-6-51981 特開平6−103063号公報JP-A-6-103063 特開平4−333153号公報JP-A-4-333153 特開平10−49369号公報JP 10-49369 A

本発明者らは、プログラム容量および使用するデータの容量の削減について以下の観点で検討を行った。   The present inventors have studied the reduction of program capacity and the capacity of data to be used from the following viewpoints.

第1の観点は配列などの実効アドレス計算の観点である。ディスプレースメント付きレジスタ間接と称し、汎用レジスタに保持されたアドレスに、命令コード中に含まれるディスプレースメントを加算して実効アドレスを生成し、この実効アドレスのリード/ライトを行うアドレッシングモードがある。これを用いて、所定のアドレス(TOP)から始まる領域に配置されたワードサイズデータの配列に対し、汎用レジスタ(R0L)に格納された番号のデータ(例えばn番目を意味するデータ)をリードする場合、配列の番号をアドレスレジスタとして使用するため、その番号データを32ビットにゼロ拡張(命令EXTU.Wにより8ビットから16ビット、EXTU.Lにより16ビットから32ビットの2回に分けて実行)し、さらに、ワードサイズデータに対応して×2(命令SHLLによる左1ビットシフト)した後、命令MOV.Wによりメモリアクセスを行う必要がある。これは例えば、
EXTU.W R0
EXTU.L ER0
SHLL.L ER0
MOV.W @(TOP:16,ER0),E0
のように記述される。
The first viewpoint is the viewpoint of calculating effective addresses such as arrays. There is an addressing mode called register indirect with displacement, in which an effective address is generated by adding a displacement included in an instruction code to an address held in a general-purpose register, and this effective address is read / written. Using this, the data of the number stored in the general-purpose register (R0L) (for example, data indicating the nth) is read with respect to the array of word size data arranged in the area starting from the predetermined address (TOP). In this case, since the array number is used as an address register, the number data is zero-extended to 32 bits (8 bits to 16 bits by the instruction EXTU.W and 16 bits to 32 bits by the EXTU.L). Further, after × 2 (left 1-bit shift by the instruction SHLL) corresponding to the word size data, the instruction MOV. It is necessary to perform memory access by W. For example,
EXTU. W R0
EXTU. L ER0
SHLL. L ER0
MOV. W @ (TOP: 16, ER0), E0
It is described as follows.

同様に、汎用レジスタに保持されたアドレスに、インデックスを付加することも考えられる。   Similarly, it is conceivable to add an index to the address held in the general-purpose register.

第2の観点は実効アドレス計算の繰返しに関する。配列アクセスにおいて同じアドレスを複数回使用する場合があり、このとき同じ実効アドレス計算を何回も繰返していては非能率的である。   The second aspect relates to repetition of effective address calculation. In the case of array access, the same address may be used several times. At this time, it is inefficient to repeat the same effective address calculation many times.

第3の観点はプログラムカウンタ相対のような分岐命令に関する。この分岐命令はプログラムカウンタ相対と称し、プログラムカウンタの内容に、命令コード中に含まれるディスプレースメントを加算して実効アドレスを生成し、この実効アドレスに分岐するアドレッシングモードを有する。このとき、複数の分岐先があるような場合には、分岐先毎に別々にプログラムカウンタ相対の分岐命令の記述が必要になる。   A third aspect relates to branch instructions such as program counter relative. This branch instruction is referred to as program counter relative, and has an addressing mode in which an effective address is generated by adding a displacement included in the instruction code to the contents of the program counter, and branching to this effective address. At this time, when there are a plurality of branch destinations, it is necessary to separately describe a branch instruction relative to the program counter for each branch destination.

第4の観点はメモリ間接のような分岐命令に関する。同一のアドレスに複数箇所から分岐される場合がある。この場合、分岐先アドレスをテーブルとして格納し、分岐命令自体の命令コードを短縮することが考えられる。メモリ間接と称し、16ビット(2バイト)の命令コード中に、8ビットのアドレス情報を持ち、このアドレス情報で分岐先アドレスのテーブルを参照し、この分岐テーブルをリードし、リードした内容に基づいて、分岐を行うアドレッシングモードがある。一方、分岐先アドレス(例えば24ビット)を、命令コード中に持つ分岐命令は32ビット長(4バイト)などとなってしまうから、分岐テーブルを32ビット単位とすれば、同一のアドレスに分岐する分岐命令があれば、前記メモリ間接を使用した方が効率的である。しかしながら、その方式は、用意できる分岐テーブルの数や容量に制限を受け、また、分岐テーブルは例外処理のベクタと共通になることが考えられ、使い勝手が悪くなることも想定される。   A fourth aspect relates to branch instructions such as memory indirection. There are cases where the same address is branched from multiple locations. In this case, it is conceivable to store the branch destination address as a table and shorten the instruction code of the branch instruction itself. This is called memory indirect, and it has 8-bit address information in a 16-bit (2 bytes) instruction code. A branch destination address table is referred to by this address information, and this branch table is read. Based on the read contents There is an addressing mode for branching. On the other hand, a branch instruction having a branch destination address (for example, 24 bits) in the instruction code has a length of 32 bits (4 bytes). Therefore, if the branch table is set to 32 bits, the branch is made to the same address. If there is a branch instruction, it is more efficient to use the memory indirect. However, this method is limited by the number and capacity of the branch tables that can be prepared, and the branch table may be used in common with the exception processing vector.

第5の観点はRAMの効率的な使用の観点である。3ビットで表現されるなど、8ビットに満たないデータがある場合、1つのアドレス(バイト単位)に、複数のデータを格納できれば、RAMエリアの使用効率が上がる。例えば、1つのアドレスに下位から、3ビット、3ビット、2ビットのデータを格納することができる。これらの3ビット、3ビット、2ビットのデータを、C言語でソースプログラムを記述する場合、ビットフィールドで宣言する。例えば、上記の例では、
struct {
unsigend char cc:2;
unsigend char bb:3;
unsigend char aa:3;
} abc;
などと定義される。
The fifth viewpoint is an efficient use of RAM. If there is data that is less than 8 bits, such as expressed in 3 bits, the use efficiency of the RAM area increases if a plurality of data can be stored in one address (byte unit). For example, 3-bit, 3-bit, and 2-bit data can be stored in one address from the lower order. These 3 bits, 3 bits, and 2 bits of data are declared in a bit field when a source program is described in C language. For example, in the above example:
struct {
unsigend char cc: 2;
unsigend char bb: 3;
unsigend char aa: 3;
} Abc;
And so on.

このビットフィールドデータbbを操作する場合、通常汎用レジスタに取り出す。このプログラム例は、
MOV.B @abc,R0L
AND.B #8’b00111000,R0L
SHLR.B #3,R0L
などとされる。つまり、一旦、メモリから、バイト単位で、汎用レジスタにリードし、所望のビットフィールド以外を0にクリアし、所望のビットフィールドが下位詰めになるように3ビットシフトを行う。1ビットシフトしかサポートされていない命令セットでは、SHLR命令は3個必要である。
When this bit field data bb is manipulated, it is normally taken out to a general purpose register. This example program
MOV. B @abc, R0L
AND. B # 8'b00111000, R0L
SHLR. B # 3, R0L
And so on. In other words, the general purpose register is once read from the memory in units of bytes, the bits other than the desired bit field are cleared to 0, and a 3-bit shift is performed so that the desired bit field becomes lower-ordered. In an instruction set that supports only 1-bit shift, three SHLR instructions are required.

操作後、メモリに格納する場合は、
MOV.B @abc,R1L
AND.B #8’b11000111,R1L
SHLL.B #3,R0L
OR.B R1L,R0L
MOV.B R0L,@abc
などの命令実行が必要とされる。つまり、一旦、格納すべきメモリのデータを汎用レジスタにリードし、所望のビットフィールドを0にクリアする。一方、格納すべきデータを、所望のビットフィールド位置になるようにシフトを行う。両者の論理和をとり、結果をメモリに格納する。
If you want to store in memory after the operation,
MOV. B @abc, R1L
AND. B # 8'b11000111, R1L
SHLL. B # 3, R0L
OR. B R1L, R0L
MOV. B R0L, @abc
Instruction execution is required. That is, once the memory data to be stored is read into the general-purpose register, the desired bit field is cleared to zero. On the other hand, the data to be stored is shifted so as to be in a desired bit field position. The logical sum of the two is taken and the result is stored in the memory.

ビットフィールドによって、メモリ(RAM)の使用量は節約できるものの、プログラム容量が増加してしまう。8ビットに満たないデータもバイト単位(例えば、下位詰めで、上位は0とする)で扱えば、操作は容易になり、プログラム容量は増えないが、メモリ(RAM)の使用量が増えてしまう。   Bit fields can save memory (RAM) usage but increase program capacity. If data less than 8 bits is handled in units of bytes (for example, lower-ordered and upper-order is 0), the operation becomes easy and the program capacity does not increase, but the memory (RAM) usage increases. .

本発明は上記検討内容に鑑みてなされたものである。本発明の目的は、プログラム容量(使用するROM容量)を削減可能にすることである。   The present invention has been made in view of the above examination contents. An object of the present invention is to make it possible to reduce the program capacity (ROM capacity to be used).

本発明の別の目的は、使用するデータ容量(使用するRAM容量)を削減可能にすることである。   Another object of the present invention is to make it possible to reduce the data capacity to be used (RAM capacity to be used).

本発明の更に別の目的は、論理的・物理的規模の増大を最小限とし、処理速度を向上することである。   Still another object of the present invention is to minimize the increase in logical and physical scale and improve the processing speed.

本発明の前記並びにその他の目的と新規な特徴は本明細書の記述及び添付図面から明らかになるであろう。   The above and other objects and novel features of the present invention will be apparent from the description of this specification and the accompanying drawings.

本願において開示される発明のうち代表的なものの概要を簡単に説明すれば下記の通りである。   The following is a brief description of an outline of typical inventions disclosed in the present application.

〔1〕[配列などの実効アドレス計算]
本発明に係るデータ処理装置は、命令を読み込んで解読し、その解読結果に従って命令を実行する命令実行手段を有し、前記命令実行手段は、情報保持にその記憶領域の全体又は一部の利用が可能にされる汎用レジスタを有し、前記汎用レジスタの記憶領域の一部を利用する第1の命令を読み込んだとき、情報のアクセスサイズに応じて、前記第1の命令で指定された汎用レジスタの保持情報をシフトし、シフト結果をその他の情報と加算して実効アドレスの演算を行なう。
[1] [Effective address calculation for arrays, etc.]
The data processing apparatus according to the present invention has an instruction execution means for reading and decoding an instruction and executing the instruction according to the decoding result, and the instruction execution means uses all or part of the storage area for information holding The general-purpose register specified by the first instruction is read according to the access size of the information when the first instruction using a part of the storage area of the general-purpose register is read. The information held in the register is shifted, and the effective result is calculated by adding the shift result to other information.

詳しくは、例えば、命令中に記述されている基準となるアドレス情報即ち基準アドレス(例えば命令中のディスプレースメントにより与えられる)と、汎用レジスタに割当てられるインデックスレジスタの情報(例えば配列上で第何番目かを示す情報)とから実効アドレスを計算して、メモリをアクセスするアドレッシングモード(ディスプレースメント付きインデックスレジスタ間接アドレシングモード)を設ける。メモリをアクセスするサイズに応じて、バイトであればインデックスレジスタ(アドレスに加算される値を保有するレジスタ)の値を×1とし、ワードであれば×2とし、ロングワードであれば×4というようにシフトする。また、独立に、インデックスレジスタのサイズを、32ビット、16ビット、8ビットから選択可能にしてよい。例えば、配列の大きさが256以下であれば、インデックスレジスタは8ビットあればよく、同一の汎用レジスタの上位は、別のデータレジスタとして使用可能になる。要するに、汎用レジスタに格納されたデータのうち、アクセスサイズによって指定されたデータのみを演算対象とし、汎用レジスタの上位側は元の情報を保持(若しくは維持)することが可能である。   Specifically, for example, reference address information described in an instruction, that is, a reference address (given by a displacement in the instruction, for example), and information on an index register assigned to a general-purpose register (for example, what number on the array) The effective address is calculated from the above information), and an addressing mode for accessing the memory (index register indirect addressing mode with displacement) is provided. According to the memory access size, the value of the index register (register holding the value added to the address) is x1 for bytes, x2 for words, and x4 for longwords. To shift. Independently, the size of the index register may be selectable from 32 bits, 16 bits, and 8 bits. For example, if the size of the array is 256 or less, the index register may be 8 bits, and the upper part of the same general-purpose register can be used as another data register. In short, of the data stored in the general-purpose register, only the data specified by the access size is targeted for calculation, and the upper side of the general-purpose register can hold (or maintain) the original information.

ディスプレースメント付きインデックスレジスタ間接アドレシングモードを採用する第1の命令は、例えば
MOV.W E0,@(d:16,R0L)
と表記される転送である。CPUは、このアドレシングモードに対して、汎用レジスタをゼロ拡張し、シフトし、ディスプレースメントなどと、加算し、この結果をアドレスとして利用可能にする機能を持つ。
The first instruction that employs the index register indirect addressing mode with displacement is, for example, MOV. W E0, @ (d: 16, R0L)
It is a transfer written as For this addressing mode, the CPU has a function of zero-extending a general-purpose register, shifting, adding displacement, etc., and making the result available as an address.

実効アドレスの計算に、前記ゼロ拡張およびシフトを含むことによって、命令数を削減し、実行ステート数も短縮できる。配列の大きさは、アドレス空間の大きさより小さいから、汎用レジスタの上位を、別のデータレジスタとして使用し、汎用レジスタに配置できるデータの量を増加でき、メモリとのリードライトの回数を削減することによって、命令数を更に削減し、プログラム容量を削減することができる。従来、複数の命令を組合せて、配列のアクセスをしている場合に比較して、処理速度を向上させることができる。   By including the zero extension and shift in the effective address calculation, it is possible to reduce the number of instructions and the number of execution states. Since the size of the array is smaller than the size of the address space, the upper part of the general-purpose register can be used as another data register, the amount of data that can be placed in the general-purpose register can be increased, and the number of read / write operations with the memory can be reduced. As a result, the number of instructions can be further reduced, and the program capacity can be reduced. Conventionally, the processing speed can be improved as compared with the case where an array is accessed by combining a plurality of instructions.

〔2〕[配列などの実効アドレス計算用MOVA命令]
また、本発明の望ましい一つの態様として、前記命令実行手段は、前記汎用レジスタの記憶領域の一部を利用する第3の命令を読み込んだとき、情報のアクセスサイズに応じて、その情報をシフトし、シフト結果をその他の情報と加算して演算した実効アドレスを、別の汎用レジスタに格納する処理を実行する。即ち、上記実効アドレスの計算を行って、メモリをアクセスせずに、その実効アドレスを汎用レジスタに格納する実効アドレス転送命令(MOVA)を設ける。実効アドレスの計算時点では、データのサイズが分からないため、データのサイズに対応する命令を複数用意する。例えば、前記同様の実効アドレス計算を行って、汎用レジスタ(ER1)に格納する命令は、
MOVA/W @(d:16,R0L),ER1
のように記述する。上記記述において、/Wが、実効アドレスを使用してメモリをアクセスするときの、即ち、配列の、データサイズである。
[2] [MOVA instruction for effective address calculation such as array]
As another desirable aspect of the present invention, when the instruction execution means reads a third instruction that uses a part of the storage area of the general-purpose register, the instruction execution means shifts the information according to the access size of the information. Then, a process of storing the effective address calculated by adding the shift result with other information in another general-purpose register is executed. That is, the effective address is calculated and an effective address transfer instruction (MOVA) for storing the effective address in the general-purpose register without accessing the memory is provided. Since the data size is not known at the time of calculating the effective address, a plurality of instructions corresponding to the data size are prepared. For example, the same effective address calculation as described above and the instruction stored in the general-purpose register (ER1) is
MOVA / W @ (d: 16, R0L), ER1
Write like this. In the above description, / W is the data size when accessing the memory using the effective address, that is, in the array.

同じアドレスを複数回使用する場合もあるので、汎用レジスタに格納しておけば、2回目以降はディスプレースメントを必要としないので、プログラム容量を削減でき、また、実行ステート数も短縮できる。   Since the same address may be used a plurality of times, if it is stored in a general-purpose register, a displacement is not required after the second time, so that the program capacity can be reduced and the number of execution states can be reduced.

CPUの演算機能としては、前記ディスプレースメント付きインデックスレジスタ間接アドレシングモードと同様であり、汎用レジスタを拡張し、シフトし、加算し、この結果を汎用レジスタに格納する機能を持つようにする。本命令は、実質的には、演算命令であって、直接的にメモリをアクセスしない。このため、インデックスとして使用するデータを、メモリ上からリードしてもさほど、命令実行シーケンスは複雑にならない。上記ディスプレースメント付きインデックスレジスタ間接アドレシングモードの実効アドレス計算と共通の演算とすることができ、配列などの実効アドレス計算用MOVA命令を追加しても其れによる論理的規模の増加はない。   The calculation function of the CPU is the same as that of the index register indirect addressing mode with displacement, and the general-purpose register is expanded, shifted, added, and the result is stored in the general-purpose register. This instruction is substantially an arithmetic instruction and does not directly access the memory. For this reason, even if the data used as an index is read from the memory, the instruction execution sequence is not so complicated. It can be the same operation as the effective address calculation in the index register indirect addressing mode with displacement, and even if an MOVA instruction for effective address calculation such as an array is added, the logical scale does not increase.

〔3〕[PC相対分岐命令]
前記ディスプレースメント付きインデックスレジスタ間接のようなアドレシングモードを採用する第1の命令はPC相対分岐命令としても適用可能である。即ち、インデックスレジスタを、8ビット、16ビット、32ビットとし、所定の定数倍(命令が16ビット単位の場合は×2)をした後、プログラムカウンタ(PC)と加算して、分岐アドレスを得るようにする、プログラムカウンタインデックスレジスタ相対分岐の実効アドレス生成をサポートする。複数の分岐先がある場合、分岐条件を評価した後、その評価結果に従って、インデックスレジスタに値を設定することにより、分岐命令自体は1個で共通化できる。
[3] [PC relative branch instruction]
The first instruction that employs an addressing mode such as indirect index register with displacement can also be applied as a PC relative branch instruction. That is, the index register is 8 bits, 16 bits, 32 bits, multiplied by a predetermined constant (× 2 if the instruction is in 16-bit units), and then added to the program counter (PC) to obtain the branch address To support the effective address generation of the program counter index register relative branch. When there are a plurality of branch destinations, after branch conditions are evaluated, by setting a value in the index register according to the evaluation result, one branch instruction itself can be shared.

CPUの命令実行機能として、汎用レジスタを拡張し、シフトし、加算し、この結果をアドレスとして利用可能にする機能は、前記と共通化できる。加算対象の他方の値は、PC値の代わりにディスプレースメントであってもよい。   As the instruction execution function of the CPU, the function of expanding, shifting, adding, and making the result available as an address can be shared with the above. The other value to be added may be a displacement instead of the PC value.

例えば、Cソースプログラム上のケース文(case)などを評価し、評価結果に基づき、分岐先アドレスを計算するためのインデックスを汎用レジスタに格納することによって、プログラム容量を削減することができる。   For example, by evaluating a case sentence (case) on a C source program and storing an index for calculating a branch destination address in a general-purpose register based on the evaluation result, the program capacity can be reduced.

〔4〕[メモリ間接アドレシングモードによる分岐命令]
第2の観点による本発明は、命令を読み込んで解読し、その解読結果に従って命令を実行する命令実行手段を有し、前記命令実行手段は、命令の所定フィールドの値(vec)にオフセット(H’80)を組合わせ、これに情報のアクセスサイズに応じたビット数のシフトを行い、シフトされた値にその他の情報(VBRの値)を加算して実効アドレスを演算し、演算された実効アドレスでメモリをリードし、リードした内容を分岐先アドレスとする分岐命令を実行可能である。前記シフト動作は、例えば、プログラムカウンタ等による命令フェッチサイズに対応して、×2または×4などとされる。
[4] [Branch instruction in memory indirect addressing mode]
The present invention according to the second aspect has instruction execution means for reading and decoding an instruction and executing the instruction according to the result of the decoding, and the instruction execution means is offset (Hec) into a value (vec) of a predetermined field of the instruction. '80) is combined, and the number of bits is shifted in accordance with the access size of the information, and other information (VBR value) is added to the shifted value to calculate the effective address, and the calculated effective It is possible to read a memory by an address and execute a branch instruction using the read contents as a branch destination address. The shift operation is, for example, x2 or x4 corresponding to the instruction fetch size by a program counter or the like.

ベクタベースレジスタを基準に、例外処理ベクタテーブルの範囲を超えるように前記オフセットの値を決めれば、その超えた範囲にマッピングされたサブルーチンベクタテーブルを参照して、サブルーチンに分岐することができる。 上記メモリ間接アドレシングモードによる分岐命令を採用すれば、それを短い命令コードとし、同一のアドレスに分岐する分岐命令が多数ある場合に、分岐テーブルと合わせても、プログラム容量を削減することができる。また、プログラムカウンタ若しくはアドレス空間の大きさに対応して、前記命令コード中のデータ(vec)にオフセットを加えて×2又は×4などとすることにより、命令コードのベクタ番号フィールド等の情報を有効に利用でき、多数の分岐アドレスを指定することができる。また、前記命令コード中のデータ(vec)を例外処理ベクタ領域(例外処理ベクタテーブル)の番号と共通化されないように、その使用時に、前記命令コード中のデータ(vec)の前に、所定のオフセット(例えば固定値H’80)を設け、更に、その上位側を例えばベクタベースレジスタ(VBR)の保持値で埋めることにより、命令コード中のデータ(vec)で指定可能にされる領域を例外処理ベクタ領域と重ならないようにすることができる。ベクタベースレジスタを更に加えることにより、ブートメモリからプログラムメモリへの再配置(所要のプログラムを、高速なメモリ上で使用するために最初に実行すべき処理)などを容易に行うことができる。   If the offset value is determined so as to exceed the range of the exception processing vector table on the basis of the vector base register, it is possible to branch to the subroutine by referring to the subroutine vector table mapped to the range exceeding the range. If a branch instruction in the memory indirect addressing mode is employed, the program capacity can be reduced even if it is combined with the branch table when a short instruction code is used and there are many branch instructions that branch to the same address. Further, by adding an offset to the data (vec) in the instruction code corresponding to the size of the program counter or the address space, the information such as the vector number field of the instruction code is obtained. It can be used effectively and a large number of branch addresses can be specified. Further, in order to prevent the data (vec) in the instruction code from being shared with the number of the exception processing vector area (exception processing vector table), a predetermined amount is used before the data (vec) in the instruction code when used. Provide an offset (for example, fixed value H'80) and fill the upper side with, for example, the stored value of the vector base register (VBR), thereby excluding the area that can be specified by the data (vec) in the instruction code. It can be prevented from overlapping the processing vector area. By further adding the vector base register, relocation from the boot memory to the program memory (processing to be executed first in order to use a required program on the high-speed memory) can be easily performed.

ベクタベースレジスタに代えてサブルーチンコールに専用化されたサブルーチンベクタテーブルレジスタのような第1レジスタを採用してサブルーチンコールを可能にする構成を採用することも可能である。即ち、命令実行手段は、例外処理ベクタテーブルの参照に利用可能なベクタベースレジスタ(VBR)と、サブルーチンベクタテーブルの参照に利用可能な第1レジスタ(TBR)を有し、前記命令実行手段は、命令の所定フィールドの値(disp)を、情報のアクセスサイズに応じたビット数でシフトし、シフトされた値に前記第1レジスタ(TBR)の値を加算してアドレスを演算し、演算されたアドレスで前記サブルーチンベクタテーブルをリードし、リードした内容を分岐先サブルーチンアドレスとする、サブルーチンコール命令を実行可能である。   Instead of the vector base register, it is possible to adopt a configuration in which a first register such as a subroutine vector table register dedicated to a subroutine call is employed to enable the subroutine call. That is, the instruction execution means includes a vector base register (VBR) that can be used for referring to the exception processing vector table and a first register (TBR) that can be used for reference to the subroutine vector table. The value (disp) of a predetermined field of the instruction is shifted by the number of bits corresponding to the access size of the information, and the address is calculated by adding the value of the first register (TBR) to the shifted value. It is possible to execute a subroutine call instruction that reads the subroutine vector table by address and uses the read contents as a branch destination subroutine address.

ソースプログラムからオブジェクトプログラムを生成するときのリンク時最適化などにおいて、最も使用頻度の高い分岐先の分岐命令を、本命令の分岐命令に置き換えればよい。   In optimization at the time of link when generating an object program from a source program, the branch instruction that is most frequently used may be replaced with the branch instruction of this instruction.

上述したように、サブルーチンコールの先頭アドレステーブルをポイントする第1レジスタを、例外処理用のベクタベースレジスタとは別に導入する事により、命令コード内のdisp(ディスプレースメント)のような所定フィールドの値に基づいてサブルーチンコールでき、更に、サブルーチンベースレジスタのような第2レジスタを導入し、第2レジスタで指定される先頭アドレスから64KBのような範囲内をサブルーチンベクタテーブルの16ビットのようなエントリアドレスで分岐できるようにすれば、サブルーチンベクタテーブルのサイズを小さくすることができる。要するに、命令実行手段は、例外処理ベクタテーブルの参照に利用可能なベクタベースレジスタと、サブルーチンへの分岐に利用可能な第1レジスタ及び第2レジスタを有し、命令の所定フィールドの値を、情報のアクセスサイズに応じたビット数でシフトし、シフトされた値に前記第1レジスタの値を加算してアドレスを演算し、演算されたアドレスでサブルーチンベクタテーブルをリードし、リードした内容に前記第2レジスタの値を加算して分岐先サブルーチンアドレスとする、サブルーチンコール命令を実行可能にする。   As described above, the value of a predetermined field such as disp (displacement) in the instruction code is introduced by introducing the first register pointing to the head address table of the subroutine call separately from the vector base register for exception processing. In addition, a second register such as a subroutine base register is introduced, and an entry address such as 16 bits in the subroutine vector table within a range of 64 KB from the start address specified by the second register. If the branching can be performed, the size of the subroutine vector table can be reduced. In short, the instruction execution means has a vector base register that can be used for referring to the exception processing vector table, and a first register and a second register that can be used for branching to the subroutine. Is shifted by the number of bits according to the access size, the value of the first register is added to the shifted value, the address is calculated, the subroutine vector table is read with the calculated address, and the contents read The subroutine call instruction that adds the values of the two registers to obtain the branch destination subroutine address is made executable.

〔5〕[ビットフィールド命令]
第3の観点による本発明では、イミディエイトデータで、メモリ上のビットフィールドの位置を指定(イミディエイトデータの論理値“1”のビットの存在するフィールドをビットフィールドとする)し、当該ビットフィールドと汎用レジスタ(下位詰め)との間のデータ転送を可能にする。すなわち、メモリから汎用レジスタへ転送するロード命令(BFLD)の場合は、メモリ上のデータと、イミディエイトデータの論理積をとり、イミディエイトデータの最下位の1がビット0となるように、右シフトを行った後に、汎用レジスタに格納する。汎用レジスタからメモリへ転送するストア命令の場合(BFST)は、イミディエイトデータの最下位の1のビットまで、汎用レジスタの内容を左シフトした後に、イミディエイトデータが1のビット位置のデータは前記シフトした汎用レジスタ上のデータとし、それ以外の論理値“0”のビット位置のデータはメモリ上のデータとして組合せて、メモリにライトする。
[5] [Bit field instruction]
In the present invention according to the third aspect, the position of the bit field on the memory is designated by the immediate data (the field in which the bit of the logical value “1” of the immediate data exists is a bit field), Enables data transfer to and from registers (lower justified). In other words, in the case of a load instruction (BFLD) for transferring from the memory to the general-purpose register, the right shift is performed so that the least significant 1 of the immediate data becomes bit 0 by taking the logical product of the data on the memory and the immediate data. After doing so, store it in a general-purpose register. In the case of a store instruction (BFST) for transferring from a general-purpose register to a memory, after shifting the contents of the general-purpose register to the least significant 1 bit of the immediate data, the data at the bit position where the immediate data is 1 is shifted as described above. The data in the general-purpose register is used, and the other data at the bit position of the logical value “0” is combined as data on the memory and written to the memory.

これにより、RAMの1個のアドレス(1バイト)の記憶エリアに、複数のビットフィールドを格納できるので、プログラム容量を増やすことなく、内蔵RAMの容量を節約でき、かつ、この処理を行うプログラム容量を小さくでき、シングルチップマイクロコンピュータに好適である。従来、複数の命令を組合せて、ビットフィールドを使用している場合に比較して、処理速度を向上することができる。   Thereby, a plurality of bit fields can be stored in the storage area of one address (1 byte) of the RAM, so that the capacity of the built-in RAM can be saved without increasing the program capacity, and the program capacity for performing this processing. This is suitable for a single chip microcomputer. Conventionally, the processing speed can be improved as compared with a case where a bit field is used by combining a plurality of instructions.

本願において開示される発明のうち代表的なものによって得られる効果を簡単に説明すれば下記の通りである。   The effects obtained by the representative ones of the inventions disclosed in the present application will be briefly described as follows.

すなわち、従来複数の命令を使用して実現していた処理に対応する命令を実行する機能を有することにより、使い勝手を向上するとともに、プログラム容量を縮小し、処理速度を向上することができる。プログラム容量を縮小することによって、ひいては、プログラム格納用のROMなどのメモリ容量を縮小し、費用を節約することができる。   In other words, by having a function of executing an instruction corresponding to a process realized by using a plurality of instructions in the past, it is possible to improve usability, reduce the program capacity, and improve the processing speed. By reducing the program capacity, it is possible to reduce the memory capacity of the ROM for storing the program, thereby saving costs.

図2に、本発明の適用されたシングルチップマイクロコンピュータのブロック図を示す。   FIG. 2 is a block diagram of a single chip microcomputer to which the present invention is applied.

同図に示されるシングルチップマイクロコンピュータ1は、全体の制御を司るCPU2、割込コントローラ(INT)3、主に、CPU2の処理プログラムなどを格納するメモリであるROM4、主に、CPU2の作業領域並びにデータの一時記憶用のメモリであるRAM5、タイマ6、シリアルコミュニケーションインタフェース(SCI)7、A/D変換器8、第1乃至第9入出力ポート(IOP1〜IOP9)9A〜9I、クロック発振器(CPG)10の機能ブロック乃至はモジュールから構成され、公知の半導体製造技術により1つの半導体基板上に形成される。ROM4は、フラッシュメモリ、EEPROM(電気的に書込み消去可能なROM)、或いはマスクROMなどである。   A single chip microcomputer 1 shown in FIG. 1 includes a CPU 2 that controls the entire system, an interrupt controller (INT) 3, a ROM 4 that is a memory that mainly stores a processing program of the CPU 2, and a work area of the CPU 2. In addition, a RAM 5 which is a memory for temporary storage of data, a timer 6, a serial communication interface (SCI) 7, an A / D converter 8, first to ninth input / output ports (IOP1 to IOP9) 9A to 9I, a clock oscillator ( CPG) 10 functional blocks or modules, which are formed on one semiconductor substrate by a known semiconductor manufacturing technique. The ROM 4 is a flash memory, an EEPROM (electrically erasable / erasable ROM), a mask ROM, or the like.

前記シングルチップマイクロコンピュータ1は、電源端子として、グランドレベル(Vss)、電源電圧レベル(Vcc)、アナロググランドレベル(AVss)、アナログ電源電圧レベル(AVcc)、の電源端子、その他の専用制御端子として、リセット(RES)、スタンバイ(STBY)、モード制御(MD0、MD1)、クロック入力(EXTAL、XTAL)端子を有する。   The single-chip microcomputer 1 has, as power supply terminals, a ground level (Vss), a power supply voltage level (Vcc), an analog ground level (AVss), an analog power supply voltage level (AVcc), and other dedicated control terminals. , Reset (RES), standby (STBY), mode control (MD0, MD1), and clock input (EXTAL, XTAL) terminals.

CPG10の端子EXTAL、XTALに接続される水晶発振子またはEXTAL端子に入力される外部クロックに基づいて生成される基準クロック(システムクロック)に同期して、シングルチップマイクロコンピュータ1は動作を行う。この基準クロック1周期をステートと呼ぶ。   The single chip microcomputer 1 operates in synchronization with a reference clock (system clock) generated based on a crystal oscillator connected to the terminals EXTAL and XTAL of the CPG 10 or an external clock input to the EXTAL terminal. One cycle of this reference clock is called a state.

シングルチップマイクロコンピュータ1の機能ブロックは、内部バス11によって相互に接続される。バスの制御を行う、図示はされないバスコントローラを内蔵している。内部バス11はアドレスバス・データバスの他、リード信号・ライト信号・バスサイズ信号をエンコードしたバスコマンドが伝達されるコントロールバスを含む。   The functional blocks of the single chip microcomputer 1 are connected to each other by an internal bus 11. A bus controller (not shown) that controls the bus is incorporated. The internal bus 11 includes, in addition to an address bus and a data bus, a control bus through which a bus command encoding a read signal, a write signal, and a bus size signal is transmitted.

前記機能ブロックやモジュールは内部バス11を介して、CPU2によってリード/ライトさる。内部バス11のデータバス幅は32ビットとする。内蔵ROM4やRAM5のリード/ライトは1ステートで可能にされる。   The functional blocks and modules are read / written by the CPU 2 via the internal bus 11. The data bus width of the internal bus 11 is 32 bits. Reading / writing of the built-in ROM 4 and RAM 5 is made possible in one state.

なお、前記タイマ6、SCI7、A/D変換器8、入出力ポート(IOP1〜IOP9)9A〜9I、CPG11が有する制御レジスタを総称して、内部I/Oレジスタと呼ぶ。各入出力ポート9A〜9Iは、アドレスバス、データバス、バス制御信号あるいはタイマ6、SCI7、A/D変換器8の入出力端子と兼用されている。   The control registers included in the timer 6, the SCI 7, the A / D converter 8, the input / output ports (IOP1 to IOP9) 9A to 9I, and the CPG 11 are collectively referred to as an internal I / O register. Each of the input / output ports 9A to 9I is also used as an address bus, a data bus, a bus control signal, or an input / output terminal of the timer 6, the SCI 7, and the A / D converter 8.

上記シングルチップマイクロコンピュータ1にリセット信号RESが与えられると、CPU2を始めとし、シングルチップマイクロコンピュータ1はリセット状態になる。このリセットが解除されると、CPU2は所定のアドレスからスタートアドレスをリードして、このスタートアドレスから命令のリードを開始するリセット例外処理を行う。この後、CPUは逐次、ROM4などから命令をリードし、解読して、その解読内容に基づいてデータの処理やRAM5のアクセスを行う。   When a reset signal RES is given to the single chip microcomputer 1, the single chip microcomputer 1 including the CPU 2 is reset. When the reset is released, the CPU 2 reads a start address from a predetermined address, and performs a reset exception process that starts reading an instruction from the start address. Thereafter, the CPU sequentially reads and decodes instructions from the ROM 4 and the like, and processes data and accesses the RAM 5 based on the decoded contents.

前記タイマ6、SCI7、外部信号などの状態を割込み信号12として、CPU2に伝達することができる。割込信号12は、A/D変換器8、タイマ6、SCI7、入出力ポート9A〜9Iが出力し、割込コントローラ3はこれを入力して、所定のレジスタなどの指定に基づいて、CPU2に割込要求信号intfと受付けた割込みに対応したベクタVECを与える。割込要因が発生すると、CPU2に割込要求が発生され、CPU2は実行中の処理を中断して、例外処理状態を経て、前記ベクタVECに対応したアドレスから、分岐先アドレスをリードして、所定の処理ルーチンに分岐し、所望の処理を行い、割込要因をクリアしたりする。所定の処理ルーチンの最後には、通常復帰命令が置かれ、この命令を実行することによって前記中断した処理を再開する。   The states of the timer 6, SCI 7, and external signal can be transmitted to the CPU 2 as an interrupt signal 12. The interrupt signal 12 is output from the A / D converter 8, the timer 6, the SCI 7, and the input / output ports 9A to 9I. The interrupt controller 3 inputs the interrupt signal 12, and the CPU 2 based on the designation of a predetermined register or the like. Are given the interrupt request signal intf and the vector VEC corresponding to the accepted interrupt. When an interrupt factor occurs, an interrupt request is generated in the CPU 2, the CPU 2 interrupts the processing being executed, passes through the exception processing state, reads the branch destination address from the address corresponding to the vector VEC, Branches to a predetermined processing routine, performs desired processing, and clears an interrupt factor. A normal return instruction is placed at the end of the predetermined processing routine, and the interrupted process is resumed by executing this instruction.

図3に、CPU2に内蔵されている汎用レジスタ及び制御レジスタの構成例(プログラミングモデル)を示す。   FIG. 3 shows a configuration example (programming model) of general-purpose registers and control registers built in the CPU 2.

CPU2は、夫々32ビット長の8本の汎用レジスタER0〜ER7を持っている。汎用レジスタER0〜ER7は、すべて同機能を持っており、アドレスレジスタとしてもデータレジスタとしても使用することができる。使用方法については、後述する。汎用レジスタER7には、汎用レジスタとしての機能に加えて、スタックポインタ(SP)としての機能が割当てられており、例外処理やサブルーチン分岐などで暗黙的に使用される。例外処理は前記割込み処理を含む。   The CPU 2 has eight general-purpose registers ER0 to ER7 each having a 32-bit length. The general-purpose registers ER0 to ER7 all have the same function and can be used as an address register and a data register. The usage method will be described later. The general-purpose register ER7 is assigned a function as a stack pointer (SP) in addition to a function as a general-purpose register, and is used implicitly in exception handling, subroutine branching, and the like. Exception handling includes the interrupt handling.

プログラムカウンタPCは32ビットのカウンタで、CPU2が次に実行する命令のアドレスを示す。特に制限されないもののCPU2の命令は、すべて2バイト(ワード)を単位としているため、最下位ビットは無効であり、命令リード時には最下位ビットは0とみなされる。   The program counter PC is a 32-bit counter and indicates an address of an instruction to be executed next by the CPU 2. Although not particularly limited, since all instructions of the CPU 2 are in units of 2 bytes (words), the least significant bit is invalid, and the least significant bit is regarded as 0 when the instruction is read.

コンディションコードレジスタCCRは8ビットのレジスタで、CPU2の内部状態を示している。割込みマスクビット(I)とハーフキャリ(H)、ネガティブ(N)、ゼロ(Z)、オーバフロー(V)、キャリ(C)の各フラグを含む8ビットで構成されている。   The condition code register CCR is an 8-bit register and indicates the internal state of the CPU 2. It consists of 8 bits including interrupt mask bit (I) and half carry (H), negative (N), zero (Z), overflow (V) and carry (C) flags.

ベクタベースレジスタVBRは、32ビットのレジスタで、下位12ビットは0とされ、上位20ビットが例外処理ベクタテーブルおよび拡張メモリ間接の分岐先テーブル(サブルーチンベクタテーブル)のリード時に、アドレスの上位として利用される。サブルーチンベクタテーブルレジスタ(第1レジスタ)TBRは、サブルーチンのエントリアドレスが格納されたサブルーチンベクタテーブルの所在を指し示す。   The vector base register VBR is a 32-bit register, the lower 12 bits are set to 0, and the upper 20 bits are used as the upper address when reading the exception processing vector table and the extended memory indirect branch destination table (subroutine vector table). Is done. The subroutine vector table register (first register) TBR indicates the location of the subroutine vector table in which the entry address of the subroutine is stored.

図4には汎用レジスタの使用形態が例示される。アドレスレジスタ及び32ビットレジスタの場合、一括して汎用レジスタER(ER0〜ER7)として使用される。インデックスレジスタとしては、汎用レジスタER(ER0〜ER7)、汎用レジスタR(R0〜R7)、汎用レジスタRL(R0L〜R7L)を使用する。何れを使用するかはアドレッシングモード中のインデックスレジスタのサイズで指定される。   FIG. 4 illustrates a usage form of the general-purpose register. In the case of an address register and a 32-bit register, they are used collectively as general purpose registers ER (ER0 to ER7). As the index registers, general purpose registers ER (ER0 to ER7), general purpose registers R (R0 to R7), and general purpose registers RL (R0L to R7L) are used. Which one is used is specified by the size of the index register in the addressing mode.

16ビットレジスタの場合は、汎用レジスタERを分割して汎用レジスタE(E0〜E7)、汎用レジスタR(R0〜R7)として使用する。これらは同等の機能を持っており、16ビットレジスタを最大16本まで使用することができる。   In the case of a 16-bit register, the general-purpose register ER is divided and used as general-purpose registers E (E0 to E7) and general-purpose registers R (R0 to R7). These have equivalent functions, and up to 16 16-bit registers can be used.

8ビットレジスタの場合は、汎用レジスタRを分割して汎用レジスタRH(R0H〜R7H)、汎用レジスタRL(R0L〜R7L)として使用する。これらは同等の機能を持っており、8ビットレジスタを最大16本まで使用することができる。汎用レジスタの使用形態は、各レジスタ独立に選択することができる。   In the case of an 8-bit register, the general-purpose register R is divided and used as general-purpose registers RH (R0H to R7H) and general-purpose registers RL (R0L to R7L). These have equivalent functions, and up to 16 8-bit registers can be used. The usage form of the general-purpose register can be selected independently for each register.

メモリ上のアドレスを指定する場合は、アドレスレジスタとして、32ビット長で、シフトせずに使用するか、インデックスレジスタとして、32ビットまたは16ビットまたは8ビット長で、データのサイズに応じて、シフトなし/1ビットシフト/2ビットシフトして使用するか、がある。   When specifying an address in the memory, use it as an address register with a 32-bit length without shifting, or as an index register with a 32-bit, 16-bit, or 8-bit length, and shift according to the size of the data. None / 1 bit shift / 2 bit shift.

図5にはCPUのアドレス空間が例示される。アドレス空間64キロバイト(kバイト)のミニマムモードと、アドレス空間4ギガバイト(Gバイト)のマキシマムモードを持つ。   FIG. 5 illustrates a CPU address space. It has a minimum mode with an address space of 64 kilobytes (k bytes) and a maximum mode with an address space of 4 gigabytes (G bytes).

ミニマムモードの場合は、16ビットのアドレスで全空間を指定できる。例外処理ベクタテーブルや分岐テーブル(サブルーチンベクタテーブル)は16ビットでよい。   In the minimum mode, the entire space can be specified by a 16-bit address. The exception processing vector table and branch table (subroutine vector table) may be 16 bits.

マキシマムモードの場合は、32ビットのアドレスで全空間を指定する。ベクタや分岐テーブルは32ビットでよい。ディスプレースメントや絶対アドレス16ビットで指定できるのは、H’00000000〜H’00007FFFとH’FFFF8000〜H’FFFFFFFFである。特に制限はされないものの、内蔵RAM5はこの領域に配置することにより、比較的短いディスプレースメントや絶対アドレス16ビットを使用できるので、プログラム容量の削減が可能になる。   In the maximum mode, the entire space is specified by a 32-bit address. The vector and branch table may be 32 bits. H'00000000 to H'00007FFF and H'FFFF8000 to H'FFFFFFFF can be specified by a displacement or an absolute address of 16 bits. Although not particularly limited, by placing the internal RAM 5 in this area, a relatively short displacement and an absolute address of 16 bits can be used, so that the program capacity can be reduced.

図6及び図7には転送/演算命令の実効アドレスの計算方法が例示される。図8、図9及び図25には分岐命令の実効アドレスの計算方法が例示される。   6 and 7 illustrate a method for calculating the effective address of the transfer / arithmetic instruction. 8, 9 and 25 illustrate a method for calculating the effective address of a branch instruction.

(1)レジスタ直接〔Rn〕
これは、命令コードのレジスタフィールドで指定されるレジスタ(8ビット、16ビットまたは32ビット)がオペランドとなる。8ビットレジスタとしてはR0H〜R7H、R0L〜R7Lを指定可能である。16ビットレジスタとしてはR0〜R7、E0〜E7を指定可能である。32ビットレジスタとしてはER0〜ER7を指定可能である。
(1) Register direct [Rn]
In this case, a register (8 bits, 16 bits, or 32 bits) designated in the register field of the instruction code is an operand. As the 8-bit register, R0H to R7H and R0L to R7L can be designated. As the 16-bit register, R0 to R7 and E0 to E7 can be designated. ER0 to ER7 can be specified as the 32-bit register.

(2)レジスタ間接〔@ERn〕
これは、命令コードのレジスタフィールドで指定されるアドレスレジスタ(ERn)の内容をアドレスとしてメモリ上のオペランドを指定する。アドバンストモードのとき、分岐命令では、下位24ビットが有効になり、上位8ビットはすべて0(H’00)とみなされる。
(2) Register indirect [@ERn]
This specifies an operand on the memory using the contents of the address register (ERn) specified in the register field of the instruction code as an address. In the advanced mode, in the branch instruction, the lower 24 bits are valid, and the upper 8 bits are all regarded as 0 (H'00).

(3)ディスプレースメント付レジスタ間接〔@(d:2,ERn)/@(d:16,ERn)/@(d:32,ERn)〕
これは、命令コードのレジスタフィールドで指定されるアドレスレジスタ(ERn)の内容に命令コード中に含まれる16ビットディスプレースメントまたは32ビットディスプレースメントを加算した内容をアドレスとしてメモリ上のオペランドを指定する。加算に際して、16ビットディスプレースメントは符号拡張される。また、データのサイズがバイトの場合は、ディスプレースメントが1、2、3のとき、短縮形@(d:2,ERn)が用意されている。同様に、ワードの場合は、2、4、6のとき、ロングワードの場合は、4、8、12のとき、それぞれ短縮形@(d:2,ERn)が用意されている。
(3) Register indirect with displacement [@ (d: 2, ERn) / @ (d: 16, ERn) / @ (d: 32, ERn)]
This designates an operand on the memory using the contents of the address register (ERn) specified in the register field of the instruction code plus the 16-bit displacement or 32-bit displacement included in the instruction code as an address. Upon addition, the 16-bit displacement is sign extended. When the data size is bytes, the short form @ (d: 2, ERn) is prepared when the displacement is 1, 2, or 3. Similarly, the shortened form @ (d: 2, ERn) is prepared when the word is 2, 4, and 6 and when the long word is 4, 8, and 12, respectively.

(4)ディスプレースメント付インデックスレジスタ間接〔@(d:16/32,ERn.B/W/L)〕
これは、命令コードのレジスタフィールドで指定されるアドレスレジスタの指定されたビット数(RnL、Rn、ERn)の内容を、32ビットにゼロ拡張し、1、2または4を乗算し(実際にはシフトを行う)、乗算結果と命令コード中に含まれる16ビットディスプレースメントまたは32ビットディスプレースメントを加算した内容をアドレスとしてメモリ上のオペランドを指定する。データのサイズに応じて、バイトサイズでは1、ワードサイズでは2、ロングワードサイズでは4がそれぞれ乗算される。加算に際して、16ビットディスプレースメントは符号拡張される。要するに、情報保持に前記汎用レジスタの一部を利用するとき、アクセスする情報のサイズに応じて、前記汎用レジスタの一部を利用する情報をシフトし、シフト結果をその他の情報と加算して実効アドレスの演算を行なう。
(4) Index register indirect with displacement [@ (d: 16/32, ERn.B / W / L)]
This means that the contents of the specified number of bits (RnL, Rn, ERn) of the address register specified in the register field of the instruction code are zero-extended to 32 bits and multiplied by 1, 2 or 4 (actually And an operand on the memory is designated with the address obtained by adding the multiplication result and the 16-bit displacement or 32-bit displacement included in the instruction code. Depending on the size of the data, the byte size is multiplied by 1, the word size is multiplied by 2, and the long word size is multiplied by 4. Upon addition, the 16-bit displacement is sign extended. In short, when using a part of the general-purpose register for holding information, the information using the part of the general-purpose register is shifted according to the size of the information to be accessed, and the shift result is added to the other information. Performs address calculation.

(5)プリ/ポストインクリメント/デクリメントレジスタ間接〔@ERn+/@−ERn/@+ERn/@ERn−〕
(a)ポストインクリメントレジスタ間接〔@ERn+〕は、命令コードのレジスタフィールドで指定されるアドレスレジスタ(ERn)の内容をアドレスとしてメモリ上のオペランドを指定する。その後、アドレスレジスタの内容に1、2または4が加算され、加算結果がアドレスレジスタに格納される。バイトサイズでは1、ワードサイズでは2、ロングワードサイズでは4がそれぞれ加算される。
(b)プリデクリメントレジスタ間接〔@−ERn〕は、命令コードのレジスタフィールドで指定されるアドレスレジスタ(ERn)の内容から1、2または4を減算した内容をアドレスとしてメモリ上のオペランドを指定する。その後、減算結果がアドレスレジスタに格納される。バイトサイズでは1、ワードサイズでは2、ロングワードサイズでは4がそれぞれ減算される。
(c)プリインクリメントレジスタ間接〔@+ERn〕は、命令コードのレジスタフィールドで指定されるアドレスレジスタ(ERn)の内容から1、2または4を加算した内容をアドレスとしてメモリ上のオペランドを指定する。その後、加算結果がアドレスレジスタに格納される。バイトサイズでは1、ワードサイズでは2、ロングワードサイズでは4がそれぞれ加算される。
(d)ポストデクリメントレジスタ間接〔@ERn−〕は、命令コードのレジスタフィールドで指定されるアドレスレジスタ(ERn)の内容をアドレスとしてメモリ上のオペランドを指定する。その後、アドレスレジスタの内容に1、2または4が減算され、減算結果がアドレスレジスタに格納される。バイトサイズでは1、ワードサイズでは2、ロングワードサイズでは4がそれぞれ減算される。
(5) Pre / post increment / decrement register indirect [@ERn + / @-ERn / @ + ERn / @ ERn-]
(A) Post-increment register indirect [@ ERn +] designates an operand on the memory using the contents of the address register (ERn) designated in the register field of the instruction code as an address. Thereafter, 1, 2 or 4 is added to the contents of the address register, and the addition result is stored in the address register. 1 is added for the byte size, 2 is added for the word size, and 4 is added for the long word size.
(B) Pre-decrement register indirect [@ -ERn] designates an operand on the memory using the contents obtained by subtracting 1, 2 or 4 from the contents of the address register (ERn) designated in the register field of the instruction code. . Thereafter, the subtraction result is stored in the address register. 1 is subtracted for the byte size, 2 for the word size, and 4 for the long word size.
(C) Pre-increment register indirect [@ + ERn] designates an operand on the memory with the contents obtained by adding 1, 2, or 4 from the contents of the address register (ERn) designated in the register field of the instruction code as an address. . Thereafter, the addition result is stored in the address register. 1 is added for the byte size, 2 is added for the word size, and 4 is added for the long word size.
(D) Post-decrement register indirect [@ ERn-] designates an operand on the memory using the contents of the address register (ERn) designated in the register field of the instruction code as an address. Thereafter, 1, 2 or 4 is subtracted from the contents of the address register, and the subtraction result is stored in the address register. 1 is subtracted for the byte size, 2 for the word size, and 4 for the long word size.

(6)絶対アドレス〔@aa:8/@aa:16/@aa:24/@aa:32〕
これは、命令コード中に含まれる絶対アドレスで、メモリ上のオペランドを指定する。絶対アドレスは8ビット(@aa:8)、16ビット(@aa:16)、24ビット(@aa:24)、または32ビット(@aa:32)である。データ領域としては、8ビット(@aa:8)、16ビット(@aa:16)、または32ビット(@aa:32)を使用する。8ビット絶対アドレスの場合、上位24ビットはすべて1(H’FFFF)となる。16ビット絶対アドレスの場合、上位16ビットは符号拡張される。32ビット絶対アドレスの場合、全アドレス空間をアクセスできる。プログラム領域としては24ビット(@aa:24)、または32ビット(@aa:32)を使用する。24ビット(@aa:24)のとき上位8ビットはすべて0(H’00)となる。
(6) Absolute address [@aa: 8 / @ aa: 16 / @ aa: 24 / @ aa: 32]
This is an absolute address included in the instruction code and designates an operand on the memory. The absolute address is 8 bits (@aa: 8), 16 bits (@aa: 16), 24 bits (@aa: 24), or 32 bits (@aa: 32). As the data area, 8 bits (@aa: 8), 16 bits (@aa: 16), or 32 bits (@aa: 32) are used. In the case of an 8-bit absolute address, all the upper 24 bits are 1 (H'FFFF). In the case of a 16-bit absolute address, the upper 16 bits are sign-extended. In the case of a 32-bit absolute address, the entire address space can be accessed. As a program area, 24 bits (@aa: 24) or 32 bits (@aa: 32) are used. In the case of 24 bits (@aa: 24), the upper 8 bits are all 0 (H'00).

(7)イミディエイト〔#xx:8/#xx:16/#xx:32〕
これは、命令コード中に含まれる8ビット(#xx:8)、16ビット(#xx:16)、または32ビット(#xx:32)のデータを直接オペランドとして使用する。
(7) Immediate [#xx: 8 / # xx: 16 / # xx: 32]
This uses 8-bit (#xx: 8), 16-bit (#xx: 16), or 32-bit (#xx: 32) data included in the instruction code directly as an operand.

(8)プログラムカウンタ相対〔@(d:8, PC)/@(d:16, PC)〕
これは、Bcc(条件分岐命令)、BSR(サブルーチン分岐命令)等の命令で使用される。PCの内容で指定される32ビットのアドレスに、命令コード中に含まれる8ビット、または16ビットディスプレースメントを加算して32ビットの分岐アドレスを生成する。加算に際して、ディスプレースメントは32ビットに符号拡張される。
(8) Program counter relative [@ (d: 8, PC) / @ (d: 16, PC)]
This is used in instructions such as Bcc (conditional branch instruction) and BSR (subroutine branch instruction). An 8-bit or 16-bit displacement included in the instruction code is added to a 32-bit address specified by the contents of the PC to generate a 32-bit branch address. Upon addition, the displacement is sign-extended to 32 bits.

(9)プログラムカウンタインデックスレジスタ相対〔@(ERn.B, PC)/@(ERn.W, PC)/@(ERn.L, PC)〕
これは、Bcc、BSR命令で使用される。命令コードのレジスタフィールドで指定されるアドレスレジスタの指定されたビット数(RnL、Rn、ERn)の内容を、32ビットにゼロ拡張し、2を乗算し(実際にはシフトを行う)、乗算結果と、PCの内容で指定される32ビットのアドレスを加算して32ビットの分岐アドレスを生成する。要するに、情報保持に前記汎用レジスタの一部を利用するとき、アクセスする情報のサイズに応じて、前記汎用レジスタの一部を利用する情報をシフトし、シフト結果をその他の情報であるプログラムカウント手段が保有する命令アドレス情報と加算して実効アドレスの演算を行ない、演算された実効アドレスを分岐先アドレスとする。
(9) Program counter index register relative [@ (ERn.B, PC) / @ (ERn.W, PC) / @ (ERn.L, PC)]
This is used in Bcc and BSR instructions. The contents of the specified number of bits (RnL, Rn, ERn) of the address register specified in the register field of the instruction code are zero-extended to 32 bits, multiplied by 2 (actually shifted), and the multiplication result Then, a 32-bit address specified by the contents of the PC is added to generate a 32-bit branch address. In short, when a part of the general-purpose register is used for holding information, the information that uses a part of the general-purpose register is shifted according to the size of the information to be accessed, and the shift result is a program count means that is other information. The effective address is calculated by adding it to the instruction address information held by, and the calculated effective address is set as the branch destination address.

(10)メモリ間接〔@@aa:8〕
これはJMP(指定アドレスへの無条件分岐命令)、JSR(指定アドレスへのサブルーチン分岐命令)等の命令で使用される。命令コード中に含まれる8ビット絶対アドレスでメモリ上のオペランドを指定し、この内容を分岐アドレスとして分岐する。8ビット絶対アドレスの上位のビットは、ベクタベースレジスタVBRで指定される。ミニマムモードの場合は、メモリ上のオペランドはワードサイズで指定し、16ビットの分岐アドレスを生成する。マキシマムモードの場合は、メモリ上のオペランドはロングワードサイズで指定する。
(10) Memory indirect [@@ aa: 8]
This is used in instructions such as JMP (unconditional branch instruction to a specified address), JSR (subroutine branch instruction to a specified address), and the like. An operand on the memory is designated by an 8-bit absolute address included in the instruction code, and the contents are branched as a branch address. The upper bits of the 8-bit absolute address are specified by the vector base register VBR. In the minimum mode, the operand on the memory is specified by the word size, and a 16-bit branch address is generated. In the maximum mode, the operand on the memory is specified with a long word size.

(11)拡張メモリ間接〔@@vec:7〕
これは、命令コード中に含まれる7ビットなどのデータ(vec)にオフセット例えば固定値H’80を組合わせた値に、プログラムカウンタないしアドレス空間の大きさに対応して、×2(2倍)または×4(4倍)などのシフトを行い、シフトされた値に例えばベクタベースレジスタVBRなどのレジスタで指定されるような分岐テーブルの先頭アドレスを加算し、この加算結果をアドレスとして、分岐テーブルをリードし、リードした内容を分岐先アドレスとして分岐するようにする。従って、ベクタベースレジスタVBRを基準に、例外処理ベクタテーブルの範囲を超えるように前記オフセットの値が決められている(要するに、vecの上位に固定値H’80が付加されている)ので、その超えた範囲にマッピングされたサブルーチンベクタテーブルを参照して、サブルーチンに分岐することができる。
(11) Extended memory indirect [@@ vec: 7]
This is a combination of data such as 7-bit data (vec) included in the instruction code and an offset, for example, a fixed value H'80, corresponding to the size of the program counter or address space, x2 (doubled). ) Or × 4 (4 times), add the start address of the branch table as specified by the register such as the vector base register VBR to the shifted value, and branch using this addition result as the address Read the table and branch the read contents as the branch destination address. Therefore, the offset value is determined so as to exceed the range of the exception processing vector table on the basis of the vector base register VBR (in short, a fixed value H′80 is added to the upper part of vec). It is possible to branch to a subroutine by referring to the subroutine vector table mapped in the range exceeding the range.

図9にはベクタベースレジスタVBRの値を加算する処理について図示はない。この点を更に明確に表現した図面として図25の(6a)がある。   FIG. 9 does not illustrate the process of adding the value of the vector base register VBR. FIG. 25 (6a) is a diagram that expresses this point more clearly.

図25の(6b)には、ベクタベースレジスタVBRに代えてサブルーチンコールに専用化されたサブルーチンベクタテーブルレジスタTBRを採用してサブルーチンコールを可能にする拡張メモリ間接アドレシングモードが例示される。即ち、命令の所定フィールドの値dispを、情報のアクセスサイズに応じたビット数例えば2ビット又は4ビットでシフトし、シフトされた値にサブルーチンベクタテーブルレジスタTBRの値を加算してアドレスを演算し、演算されたアドレスで前記サブルーチンベクタテーブルをリードし、リードした内容を分岐先サブルーチンアドレスとする。特に図示はしないが、図25の(6a)においてVBRの代わりTBRの値を用いるアドレシングモードを追加して採用することも可能である。   (6b) of FIG. 25 illustrates an extended memory indirect addressing mode that employs a subroutine vector table register TBR dedicated to a subroutine call instead of the vector base register VBR and enables the subroutine call. That is, the value disp of the predetermined field of the instruction is shifted by the number of bits according to the access size of information, for example, 2 bits or 4 bits, and the address is calculated by adding the value of the subroutine vector table register TBR to the shifted value. Then, the subroutine vector table is read at the calculated address, and the read content is set as a branch destination subroutine address. Although not specifically shown, it is also possible to add an addressing mode that uses the value of TBR instead of VBR in (6a) of FIG.

図25の(6b)に例示される命令フォーマットの命令は例えばサブルーチンコール命令であり、16ビット命令とされ、dispは8ビットとされる。 図10にはCPUの機械語の命令フォーマットが例示される。CPUの命令は、2バイト(ワード)を単位にしている。各命令はオペレーションフィード(op)、レジスタフィールド(r)、EA拡張部(EA)、およびコンディションフィールド(cc)を含む。   The instruction in the instruction format illustrated in (6b) of FIG. 25 is, for example, a subroutine call instruction, which is a 16-bit instruction, and disp is 8 bits. FIG. 10 illustrates an instruction format of the CPU machine language. CPU instructions are in units of 2 bytes (words). Each instruction includes an operation feed (op), a register field (r), an EA extension (EA), and a condition field (cc).

前記オペレーションフィールド(op)は、命令の機能を表し、アドレッシングモードの指定オペランドの処理内容を指定する。命令の先頭4ビットを必ず含む。2つのオペレーションフィールドを持つ場合もある。   The operation field (op) represents the function of the instruction, and specifies the processing contents of the specified operand of the addressing mode. Always include the first 4 bits of the instruction. There may be two operation fields.

前記レジスタフィールド(r)は汎用レジスタを指定する。レジスタフィールド(r)はアドレスレジスタのとき3ビット、データレジスタのとき3ビット(32ビットレジスタ)又は4ビット(8または16ビットレジスタ)である。2つのレジスタフィールドを持つ場合、またはレジスタフィールドを持たない場合もある。   The register field (r) specifies a general purpose register. The register field (r) is 3 bits for the address register and 3 bits (32 bit register) or 4 bits (8 or 16 bit register) for the data register. There may be two register fields or no register fields.

前記EA拡張部(EA)は、イミディエイトデータ、絶対アドレスまたはディスプレースメンを指定する。8ビット、16ビット、または32ビットのフィールドである。コンディションフィールド(cc)は条件分岐命令(Bcc命令)の分岐条件を指定する。   The EA extension unit (EA) designates immediate data, an absolute address, or a displacement. It is an 8-bit, 16-bit, or 32-bit field. The condition field (cc) specifies the branch condition of the conditional branch instruction (Bcc instruction).

図11には本発明に関する命令フォーマットが例示される。   FIG. 11 illustrates an instruction format related to the present invention.

[配列などの実効アドレス計算]
MOV.L @(d:16,rs),rdは、2ワードの命令で、第1ワードのビット6〜4でインデックスレジスタ(rs)を、ビット3〜0でデータレジスタ(rd)を指定し、第2ワードがディスプレースメント(d)である。この命令は図6の(5)(a)に示される16ビットディスプレースメント付きインデックスレジスタ間接のアドレシングモードを用いる。この命令は第1の命令の一つである。図6の(4)に示されるディスプレースメント付きレジスタ間接のアドレシングモードを用いる転送命令等は第2の命令に分類される。
[Effective address calculation for arrays, etc.]
MOV. L @ (d: 16, rs), rd is a two-word instruction that specifies the index register (rs) with bits 6-4 of the first word, the data register (rd) with bits 3-0, Two words are displacement (d). This instruction uses the index register indirect addressing mode with 16-bit displacement shown in (5) (a) of FIG. This instruction is one of the first instructions. A transfer instruction or the like using the register indirect addressing mode with displacement shown in (4) of FIG. 6 is classified as a second instruction.

[配列などの実効アドレス計算用MOVA命令]
MOVA/L @(d:16,rd),rdは、2ワードの命令で、第1ワードのビット2〜0でインデックスレジスタとデータレジスタ共通の汎用レジスタ(rd)を指定し、第2ワードがディスプレースメント(d)である。この命令も図6の(5)(a)に示される16ビットディスプレースメント付きインデックスレジスタ間接のアドレシングモードを用いる。この命令は第3の命令の一つである。
[MOVA instruction for effective address calculation such as array]
MOVA / L @ (d: 16, rd), rd is a two-word instruction, and the general register (rd) common to the index register and the data register is designated by bits 2 to 0 of the first word, and the second word is Displacement (d). This instruction also uses the index register indirect addressing mode with 16-bit displacement shown in (5) (a) of FIG. This instruction is one of the third instructions.

[分岐命令1]
BRA rsは、1ワードの命令で、ビット6〜4でインデックスレジスタ(rs)を指定する。この命令は図8の(3)に示されるプログラムカウンタインデックスレジスタ相対のアドレシングモードを用いる。この分岐命令は第1の命令の別の例となる。
[Branch instruction 1]
BRA rs is a one-word instruction that designates the index register (rs) with bits 6-4. This instruction uses an addressing mode relative to the program counter index register shown in (3) of FIG. This branch instruction is another example of the first instruction.

[分岐命令2]
JMP @@aa:7は、1ワードの命令で、ビット7〜0に分岐テーブルを指定するアドレス情報(aa)を含む。この命令は図9の(6)及び図25の(6a)に示される拡張メモリ間接のアドレシングモードを用いる。
[Branch instruction 2]
JMP @@ aa: 7 is a one-word instruction and includes address information (aa) for designating a branch table in bits 7-0. This instruction uses the extended memory indirect addressing mode shown in (6) of FIG. 9 and (6a) of FIG.

[分岐命令3]
図26には図25の(6b)に示されるアドレシングモードによるサブルーチン命令による動作が示される。ここで説明するサブルーチンコール命令(16ビット命令)の書式は、“JSR/N @@(disp8,TBR)”とされる。disp8は8ビットのdisp(ディスプレースメント)を意味する。命令コードは“10000011dddddddd”となり、ddddddddは8ビットのdisp(ディスプレースメント)である。動作の概略は以下の通りである。〔1〕復帰のためにプログラムカウンタPCをPR(プロシジャレジスタ)に退避する。〔2〕TBR(サブルーチンベクタテーブルレジスタ)の値とdisp8×4(2ビット左シフト)の値とを加算して、32ビットのテーブルエントリアドレスを生成する。〔3〕前記〔2〕で生成されたアドレスのテーブルエントリから32ビットのアドレスをプログラムカウンタPCにロードする。〔4〕前記〔3〕でロードしたアドレス(全空間をカバー)へジャンプする。
[Branch instruction 3]
FIG. 26 shows an operation by a subroutine instruction in the addressing mode shown in (6b) of FIG. The format of the subroutine call instruction (16-bit instruction) described here is “JSR / N @@ (disp8, TBR)”. disp8 means 8-bit disp (displacement). The instruction code is “10000011dddddddd”, and dddddddd is an 8-bit disp (displacement). The outline of the operation is as follows. [1] The program counter PC is saved in a PR (Procedure Register) for restoration. [2] The value of TBR (subroutine vector table register) and the value of disp8 × 4 (2 bits left shift) are added to generate a 32-bit table entry address. [3] A 32-bit address is loaded into the program counter PC from the table entry of the address generated in [2]. [4] Jump to the address (covering the entire space) loaded in [3].

[分岐命令4]
図27にはサブルーチンコール群の先頭アドレスを示す専用サブルーチンベースレジスタSBRをさらに導入し、そこから64KB以内は16ビットのテーブルアドレスで分岐できるような命令を混在させることで、テーブルサイズの最適化を図る例について説明する。動作の概略を説明する。〔1〕プログラムカウンタPCの値を復帰アドレスとしてPR(プロシジャレジスタ)に退避する。〔2〕TBR(サブルーチンベクタテーブルレジスタ)の値とdisp8×2の値とを加算して、32ビットのテーブルエントリアドレスを生成する。〔3〕前記〔2〕で生成されたアドレスのテーブルエントリから16ビットのアドレスをロードしゼロ拡張し、SBR(サブルーチンベースアドレスレジスタ)を加算してアドレスを生成する。〔4〕前記〔3〕で生成したアドレス(64KBをカバー)へジャンプする。
[Branch instruction 4]
In FIG. 27, a dedicated subroutine base register SBR indicating the start address of a subroutine call group is further introduced, and an instruction that can branch at a 16-bit table address within 64 KB is mixed to optimize the table size. An example of this will be described. An outline of the operation will be described. [1] The value of the program counter PC is saved in the PR (procedure register) as a return address. [2] The value of TBR (subroutine vector table register) and the value of disp8 × 2 are added to generate a 32-bit table entry address. [3] A 16-bit address is loaded from the table entry of the address generated in [2], zero-extended, and SBR (subroutine base address register) is added to generate an address. [4] Jump to the address (64 KB covered) generated in [3] above.

上述したように、サブルーチンコールの先頭アドレステーブルをポイントする専用サブルーチンベクタテーブルレジスタTBRを、例外処理用のベクタベースレジスタVBRとは別に導入し、上記分岐命令3の場合には、命令コード内のdisp(ディスプレースメント)により、32ビットアドレステーブルを16ビット命令1つで参照して、サブルーチンコールでき、また、上記分岐命令4の場合のようにサブルーチンベースレジスタSBRをさらに導入し、そこから64KB以内は16ビットのテーブルアドレスで分岐できるようにすれば、サブルーチンベクタテーブルのサイズを小さくすることができる。   As described above, the dedicated subroutine vector table register TBR that points to the head address table of the subroutine call is introduced separately from the vector base register VBR for exception processing. In the case of the branch instruction 3, the disp in the instruction code is used. (Displacement) allows a subroutine call by referring to the 32-bit address table with one 16-bit instruction, and further introduces a subroutine base register SBR as in the case of the branch instruction 4, and within 64 KB from there If it is possible to branch at a 16-bit table address, the size of the subroutine vector table can be reduced.

上記分岐命令3、4によれば、命令はコードサイズが16ビットであり、自由に配置できる専用アドレステーブルエリアを持ち、且つジャンプ先のアドレスの範囲に制限はない。上記により、サブルーチンの配置アドレスおよびアドレステーブルエリアに制限を与えること無く、コード効率を向上させることができる。要するに、1)コード効率(サイズ)、2)ジャンプ可能な範囲の全アドレス空間対応、3)自由に配置できる専用サブルーチンベクタテーブルエリアによるプログラミングの容易化、を全て満たすことができる。   According to the branch instructions 3 and 4, the instruction has a code size of 16 bits, has a dedicated address table area that can be freely arranged, and has no restriction on the range of jump destination addresses. As described above, the code efficiency can be improved without restricting the arrangement address of the subroutine and the address table area. In short, 1) code efficiency (size), 2) all address space within a jumpable range, and 3) easy programming by a dedicated subroutine vector table area that can be freely arranged can be satisfied.

[ビットフィールド命令]
BFLD #xx,@aa:16,rdは、3ワードの命令で、第2ワードが絶対アドレス(aa)であり、第3ワードのビット7〜0にイミディエイト(xx)を含み、第3ワードのビット11〜8でデスティネーションレジスタ(rd)を指定する。
[Bit field instruction]
BFLD # xx, @ aa: 16, rd is a 3-word instruction, the second word is an absolute address (aa), bits 7 to 0 of the third word include immediate (xx), and the third word Bits 11 to 8 designate the destination register (rd).

BFST rd,#xx,@rsは、2ワードの命令で、第2ワードのビット7〜0にイミディエイト(xx)を含み、第1ワードのビット6〜4でアドレスレジスタ(rd)を、第2ワードのビット11〜8でソースレジスタ(rs)を指定する。   BFST rd, #xx, @rs is a two-word instruction that includes an immediate (xx) in bits 7-0 of the second word, and an address register (rd) in bits 6-4 of the first word. The source register (rs) is designated by bits 11 to 8 of the word.

図12にはビットフィールド命令によるデータ処理機能が例示される。   FIG. 12 illustrates a data processing function by a bit field instruction.

BFLD(ビットフィールドロード)命令は、ソースオペランドにおいて指定されたフィールド(ハッチングされたフィールド)を、下位詰めで、8ビットレジスタRdに転送する(上位ビットは0になる)命令である。ビットフィールドは、8ビットのイミディエイトデータ(マスクデータ)の1がセットされているビットで指定される。要するに、BFLD命令は、メモリ上のデータをリードし、命令コード中に含まれるイミディエイトデータとの論理積をとり、その論理積の結果に対し、前記イミディエイトデータの下位ビット側の論理値“1”のビットが、最下位ビットになるように右シフトし、右シフトの結果を汎用レジスタに格納する処理を規定する。   The BFLD (bit field load) instruction is an instruction for transferring a field (hatched field) specified in a source operand to the 8-bit register Rd in the lower order (the upper bit is 0). The bit field is designated by a bit in which 1 of 8-bit immediate data (mask data) is set. In short, the BFLD instruction reads the data on the memory, takes a logical product with the immediate data contained in the instruction code, and, for the result of the logical product, the logical value “1” on the lower bit side of the immediate data. The right shift is performed so that the first bit becomes the least significant bit, and the result of the right shift is stored in the general-purpose register.

BFST(ビットフィールドストア)命令は、デスティネーションオペランドにおいてイミディエイトデータで指定されたフィールド(ハッチングされたフィールド)へ、8ビットレジスタRsの内容(下位詰め)を転送する。ビットフィールドは、8ビットのイミディエイトデータの1がセットされているビットで指定される。要するに、BFST命令は、汎用レジスタの内容を、命令コード中に含まれるイミディエイトデータの下位ビット側の論理値“1”のビットまで左シフトし、前記イミディエイトデータの論理値“1”のビットは、前記シフトした内容を選択し、論理値“0”のビットは前記リードしたメモリの内容を選択し、その結果を前記メモリに格納する処理を規定する。   The BFST (bit field store) instruction transfers the contents (lower padding) of the 8-bit register Rs to the field (hatched field) designated by the immediate data in the destination operand. The bit field is designated by a bit in which 1 of 8-bit immediate data is set. In short, the BFST instruction shifts the contents of the general-purpose register to the bit of the logical value “1” on the lower bit side of the immediate data included in the instruction code, and the bit of the logical value “1” of the immediate data is The shifted contents are selected, and the bit of logical value “0” defines the process of selecting the contents of the read memory and storing the result in the memory.

図1には前記CPUの詳細が例示される。命令実行手段としてのCPU2は、制御部2Aと実行部2Bから構成される。   FIG. 1 illustrates details of the CPU. The CPU 2 as the instruction execution means includes a control unit 2A and an execution unit 2B.

制御部2Aは、命令レジスタIR、命令変更部CHG、命令デコーダDEC、レジスタセレクタRESL、割込み制御部INTCを含む。   The control unit 2A includes an instruction register IR, an instruction change unit CHG, an instruction decoder DEC, a register selector RESL, and an interrupt control unit INTC.

命令デコーダDECは、例えば、マイクロROM或はPLA(Programmable Logic Array)または布線論理で構成される。命令デコーダDECの出力の一部が命令デコーダDECにフィードバックされている。これは各命令コード内の遷移に用いるステージコード(TMG)を含む。   The instruction decoder DEC is configured by, for example, a micro ROM, PLA (Programmable Logic Array), or a wiring logic. Part of the output of the instruction decoder DEC is fed back to the instruction decoder DEC. This includes a stage code (TMG) used for transitions within each instruction code.

命令デコーダDECは、実行部2Bの制御を行う。詳細を後述する制御信号gbbyte、gbword、gbsft1、gbsft2、bfld、bfst、aluabは算術論理演算器ALUの制御用に出力される。また、別の制御信号aa,aa7rd,vecrdはメモリアドレスバッファABの制御用に出力される。   The instruction decoder DEC controls the execution unit 2B. The control signals gbbyte, gbword, gbsft1, gbsft2, bfld, bfst, alaba, which will be described in detail later, are output for controlling the arithmetic logic unit ALU. Further, other control signals aa, aa7rd, and vecrd are output for controlling the memory address buffer AB.

レジスタセレクタRESLは、命令デコーダDECの指示と、命令コード中に含まれるレジスタフィールドの情報に基づいて、レジスタ選択信号rsgb[n]、wbrd[n]などを出力し、汎用レジスタの入出力を制御する。[n]は汎用レジスタに対応した0〜7の番号を意味する。   The register selector RESL outputs a register selection signal rsgb [n], wbrd [n], etc. based on an instruction from the instruction decoder DEC and information on a register field included in the instruction code, and controls input / output of the general-purpose register. To do. [N] means a number from 0 to 7 corresponding to the general-purpose register.

命令レジスタIRは、リードした命令を一旦格納する。実行すべき命令は、命令デコーダDECに出力される。命令変更部CHGは、リードした命令以外の命令コードを、命令デコーダDECに与える場合に動作し、そのほかの場合は、命令レジスタIRの内容を命令デコーダDECに与える。リードした命令以外の命令コードは、割込み制御部INTCの指示によって、割込みなどの例外処理を実行するとき、などに用いる。割込み制御部INTCは、図2の割込みコントローラ3の出力する割込み要求信号intfを受付け、また、命令デコーダDECの出力する割込みマスク信号21を参照し、割込みがマスクされていなければ、命令変更部CHGに信号20にて割込みを指示する。   The instruction register IR temporarily stores the read instruction. The instruction to be executed is output to the instruction decoder DEC. The instruction change unit CHG operates when an instruction code other than the read instruction is given to the instruction decoder DEC, and in other cases, the contents of the instruction register IR are given to the instruction decoder DEC. The instruction code other than the read instruction is used when an exception process such as an interrupt is executed according to an instruction from the interrupt control unit INTC. The interrupt control unit INTC receives the interrupt request signal intf output from the interrupt controller 3 in FIG. 2, and refers to the interrupt mask signal 21 output from the instruction decoder DEC. If the interrupt is not masked, the instruction change unit CHG An interrupt is instructed by a signal 20.

前記実行部(EXEC)2Bには、汎用レジスタER0〜ER7、プログラムカウンタPC、コンディションコードレジスタCCR、テンポラリレジスタTR、算術論理演算器ALU、インクリメンタINC、リードデータバッファDBR、ライトデータバッファDBW、アドレスバッファAB、ベクタベースレジスタVBR、TBRを含む。これらの回路ブロックは内部バスab、gb、db、wb1、wb2によって相互に接続されている。   The execution unit (EXEC) 2B includes general-purpose registers ER0 to ER7, a program counter PC, a condition code register CCR, a temporary register TR, an arithmetic logic unit ALU, an incrementer INC, a read data buffer DBR, a write data buffer DBW, an address It includes a buffer AB and vector base registers VBR and TBR. These circuit blocks are connected to each other by internal buses ab, gb, db, wb1, and wb2.

算術論理演算器ALUは、命令によって指定される各種の演算や実効アドレスの計算などに用いる。インクリメンタINCは、主にプログラムカウンタPCの加算に用いられる。   The arithmetic and logic unit ALU is used for various operations designated by instructions and calculation of effective addresses. The incrementer INC is mainly used for addition of the program counter PC.

図3に示される汎用レジスタER0〜ER7、プログラムカウンタPC、コンディションコードレジスタCCR以外は、プログラミング上は参照できず、マイクロコンピュータ1内部の動作にのみ用いられる。即ち、リードデータバッファDBR、ライトデータバッファDBW、アドレスバッファABなどは、内部バスIAB、IDBとのインタフェースをとるために、一時的なデータのラッチやバッファリングに使用する。テンポラリレジスタTRは、マイクロコンピュータ1内部の動作に適宜用いられる。内部バスIAB、IDBは前記内部バス11に含まれる内部アドレスバス、内部データバスを意味する。   Other than the general-purpose registers ER0 to ER7, the program counter PC, and the condition code register CCR shown in FIG. 3, they cannot be referred to for programming, and are used only for the operation inside the microcomputer 1. That is, the read data buffer DBR, the write data buffer DBW, the address buffer AB, and the like are used for temporary data latching and buffering in order to interface with the internal buses IAB and IDB. The temporary register TR is appropriately used for the operation inside the microcomputer 1. The internal buses IAB and IDB mean an internal address bus and an internal data bus included in the internal bus 11.

リードデータバッファDBRは、前記ROM4、RAM5、内部I/Oレジスタ、或は図示はされない外部メモリから、リードした命令コード(EA拡張部)やデータを一時的に格納する。ライトデータバッファDBWはROM4、RAM5、内部I/Oレジスタ、或は外部メモリへのライトデータを一時的に格納する。アドレスバッファABは、CPU2がリード/ライトするアドレスをバッファリングするほか、例外処理ベクタテーブル(ベクタテーブル)やサブルーチンベクタテーブル(分岐テーブル)のリードアドレスを生成するのに利用される。アドレスバッファABは、割込みコントローラから入力されたベクタ、命令コードに含まれる値vec、および内部バスab上の値等を入力とし、アドレス出力を行う。前記の通り、ベクタベースレジスタVBRの値は、例外処理のベクタVECを用いるテーブル参照、拡張メモリ間接におけるベクタフィールドの値vecを用いるテーブル参照の上位アドレスとして使用される。   The read data buffer DBR temporarily stores the instruction code (EA extension unit) and data read from the ROM 4, RAM 5, internal I / O register, or external memory (not shown). The write data buffer DBW temporarily stores write data to the ROM 4, RAM 5, internal I / O register, or external memory. The address buffer AB is used for buffering addresses read / written by the CPU 2 and for generating read addresses for exception processing vector tables (vector tables) and subroutine vector tables (branch tables). The address buffer AB receives a vector input from the interrupt controller, a value vec included in the instruction code, a value on the internal bus ab, and the like, and outputs an address. As described above, the value of the vector base register VBR is used as an upper address of a table reference using the vector VEC for exception processing and a table reference using the vector field value vec in the extended memory indirect.

アドレスバッファABの機能を表す論理記述は図13に示されるように表現することができる。同図の論理記述は、RTL(Register Transfer Level)若しくはHDL(Hardware Description Language)記述と呼ばれ、公知の論理合成ツールによって、論理回路に論理展開できる。HDLはIEEE1364として標準化されている。これに示される論理記述の構文は、ケース(case)文に準拠しており、always@の次の()内で定義された値若しくは信号に変化が有ったとき、それ以下の記述行の処理を行う、という記述内容になっている。尚、記号「|」は論理和を示し、「&」は論理積を示す。「2’b01」は2ビット長のバイナリコード01を意味する。図13の論理記述において、mode=0のときマキシマムモード、mode=1のときミニマムモードとし、拡張メモリ間接の分岐テーブルリードのとき制御信号aa7rd、例外処理のベクタリードのとき制御信号VECrdを活性状態とする。即ち、図13の論理記述は、mode信号と、制御信号aa7rd、VECrdに応じて、選択が行われる。前記制御信号がいずれも非活性状態のときは、内部バスabの内容が選択される。   The logical description representing the function of the address buffer AB can be expressed as shown in FIG. The logic description in FIG. 4 is called RTL (Register Transfer Level) or HDL (Hardware Description Language) description, and can be logically expanded into a logic circuit by a known logic synthesis tool. HDL is standardized as IEEE 1364. The syntax of the logical description shown here conforms to the case statement, and when there is a change in the value or signal defined in () next to alwayss @, The description is to process. The symbol “|” represents a logical sum, and “&” represents a logical product. “2′b01” means a binary code 01 having a 2-bit length. In the logic description of FIG. 13, the mode is the maximum mode when mode = 0, the minimum mode when mode = 1, the control signal aa7rd is active when the branch table is read indirectly in the extended memory, and the control signal VECrd is active when the vector is read for exception processing. And That is, the logical description in FIG. 13 is selected according to the mode signal and the control signals aa7rd and VECrd. When all the control signals are inactive, the contents of the internal bus ab are selected.

図14には算術論理演算器ALUの主要部の構成が例示される。算術論理演算器ALUは、入力セレクタ25、算術論理演算部26、ビットフィールド演算部27、及び出力セレクタ28を含む。このほかに、図示はされない、内部バスdb側のALU入力セレクタや、ビット操作命令用などの付加的な機能も含むが、ここでは詳細な説明は省略する。   FIG. 14 illustrates the configuration of the main part of the arithmetic logic unit ALU. The arithmetic logic unit ALU includes an input selector 25, an arithmetic logic unit 26, a bit field operation unit 27, and an output selector 28. In addition to this, additional functions such as an ALU input selector on the internal bus db side and a bit operation instruction, which are not illustrated, are included, but detailed description thereof is omitted here.

入力セレクタ25は、ゼロ拡張機能と1ビットシフト又は2ビットシフト機能を持つ。図15にはその機能が論理記述で例示される。即ち、出力する汎用レジスタなどの資源が選択され,内部バスgbを経由して算術論理演算器ALUに入力した後、信号gbbyte、gbwordで、使用する汎用レジスタ(インデックスレジスタ)のサイズを指定し、上位はゼロ拡張される。その後、信号gbsft1、gbsft2でシフトビット数を指定し、×1/×2/×4を選択する。例えば、後述のMOV.L @(d:16,R1L),ER0のアドレス計算では、gbbyte=1、gbword=0、gbsft1=0、gbsft2=1とされる。0拡張とシフト演算されたデータは、リードデータバッファDBRから出力されて内部バスdbを経由して算術論理演算部26に入力されたディスプレースメントと加算される。その加算結果は、出力セレクタ28と内部バスabを経由してアドレスとして出力され、また内部バスwb2を経由して汎用レジスタにも格納される。演算結果はバスabにもバスwb2にも出力される。前記入力セレクタ25は、内部バスgbの内容を減算するために、反転する論理を含めることもできる。インデックスレジスタとしては、負の数を使用しないようにして、入力セレクタ25の論理を並列化して、遅延時間を短縮できる。   The input selector 25 has a zero extension function and a 1-bit shift or 2-bit shift function. FIG. 15 illustrates the function by a logical description. That is, after a resource such as a general-purpose register to be output is selected and input to the arithmetic logic unit ALU via the internal bus gb, the size of the general-purpose register (index register) to be used is specified by the signals gbbyte and gbword. The upper part is zero-extended. Thereafter, the number of shift bits is specified by the signals gbsft1 and gbsft2, and x1 / x2 / x4 is selected. For example, MOV. In the address calculation of L @ (d: 16, R1L), ER0, gbbyte = 1, gbword = 0, gbsft1 = 0, and gbsft2 = 1. The data that has been shifted and expanded by 0 is added to the displacement that is output from the read data buffer DBR and input to the arithmetic logic unit 26 via the internal bus db. The addition result is output as an address via the output selector 28 and the internal bus ab, and is also stored in the general-purpose register via the internal bus wb2. The calculation result is output to both the bus ab and the bus wb2. The input selector 25 may include logic to invert in order to subtract the contents of the internal bus gb. As the index register, it is possible to shorten the delay time by not using negative numbers and by parallelizing the logic of the input selector 25.

ビットフィールドロード演算部27は、内部バスgb、dbと、イミディエイトデータ(imm)を入力し、結果を内部バスwb2に出力する。イミディエイトデータ(imm)は、前記の通り、命令コードのビット7〜0(図8のBFLD命令のxx)などとされる。内部バスwb2に出力された演算結果は、汎用レジスタまたはライトデータバッファDBWに格納される。BFLD演算を行う論理記述は図16に例示される。すなわち、イミディエイトデータ(imm)と内部バスgbとの論理積をとり、イミディエイトデータ(imm)で指定したビット数だけ(最も下位の”1”のビットがビット0になるまで)、右シフトを行うものである。   The bit field load operation unit 27 inputs the internal buses gb and db and the immediate data (imm) and outputs the result to the internal bus wb2. As described above, the immediate data (imm) is bits 7 to 0 of the instruction code (xx of the BFLD instruction in FIG. 8) or the like. The calculation result output to the internal bus wb2 is stored in the general-purpose register or the write data buffer DBW. A logical description for performing the BFLD operation is illustrated in FIG. That is, the logical product of the immediate data (imm) and the internal bus gb is calculated, and the right shift is performed by the number of bits specified by the immediate data (imm) (until the lowest “1” bit becomes bit 0). Is.

BFST演算を行う論理記述は図17に例示される。すなわち、内部バスdbを、イミディエイトデータ(imm)で指定したビット数だけ(最も下位の”1”のビット位置まで)、左シフトを行い、bf_inを生成し、イミディエイトデータ(imm)が1のビットはbf_inを、そのほかのビットは内部バスgb(メモリからリードしたデータ)の内容を生成するものである。   A logical description for performing the BFST operation is illustrated in FIG. That is, the internal bus db is shifted to the left by the number of bits specified by the immediate data (imm) (to the bit position of the lowest “1”), bf_in is generated, and the immediate data (imm) is 1 bit. Bf_in and other bits generate the contents of the internal bus gb (data read from the memory).

次に、本発明に関する命令の実行タイミングを説明する。前記の通り、内部バスは32ビットであるが、簡単のために、命令リードは16ビットずつ行うものとする。また、内蔵ROM4、RAM5のリード/ライトを1ステートでリード/ライト可能とする。   Next, the execution timing of instructions related to the present invention will be described. As described above, the internal bus is 32 bits, but for the sake of simplicity, it is assumed that instruction read is performed 16 bits at a time. In addition, read / write of the built-in ROM 4 and RAM 5 can be read / written in one state.

図18にはMOV.L@(d:16,R1L),ER0の実行タイミングが例示される。これは図11で説明した[配列などの実効アドレス計算]の命令フォーマットに応ずる命令の実行タイミングを示す。   18 shows MOV. The execution timing of L @ (d: 16, R1L), ER0 is illustrated. This shows the execution timing of an instruction corresponding to the instruction format of [Effective address calculation of array etc.] described in FIG.

T0で、CPU2のアドレスバッファABからアドレスがアドレスバスIABに出力される。また、命令デコーダDECから、命令フェッチ(if)を示す、バスコマンドBCMDが出力される。   At T0, the address is output from the address buffer AB of the CPU 2 to the address bus IAB. The instruction decoder DEC outputs a bus command BCMD indicating instruction fetch (if).

T1では、T0の内部アドレスバスIAB上のアドレスとバスコマンドBCMDに従ったリードデータが内部データバスIDBに得られる。このリードデータは、T2で命令レジスタIRに取り込まれる。以上の動作は以前の命令の実行の制御によって行われる。   At T1, the address on the internal address bus IAB of T0 and the read data according to the bus command BCMD are obtained on the internal data bus IDB. This read data is taken into the instruction register IR at T2. The above operation is performed by controlling the execution of the previous instruction.

特に制限はされないものの、引続き、T1、T2、T4、T5でも内部アドレスバスIABにアドレスが出力され、バスコマンドBCMDが出力され、命令リード(先読み)が行われる。本命令のディスプレースメントは、T2で内部データバスIDBに得られ、T3でリードデータバッファDBRに取り込まれる。   Although there is no particular limitation, an address is output to the internal address bus IAB, a bus command BCMD is output, and an instruction read (prefetch) is performed, even at T1, T2, T4, and T5. The displacement of this instruction is obtained on the internal data bus IDB at T2, and is taken into the read data buffer DBR at T3.

直前の命令の実行が終了すると、最も早く命令の実行が開始される場合には、T2で、リードデータが、命令コードが命令デコーダDECに入力されて、命令の内容が解読される。   When the execution of the immediately preceding instruction is completed, the execution of the instruction is started earliest. At T2, the read data and the instruction code are input to the instruction decoder DEC, and the contents of the instruction are decoded.

命令コードの一部(レジスタ指定フィード)がレジスタセレクタRESLに与えられ、解読される。解読結果に従って、T3で制御信号・レジスタ選択信号が出力される。信号rsgb1が活性状態になって、汎用レジスタER1の内容が内部バスgbに出力される。また、図示を省略する制御信号dbrdb(リードデータバッファDBRからバスdbへの出力制御信号)、図示を省略する制御信号dbrext(リードデータバッファのデータに対する符号拡張指示信号)が活性状態になって、リードデータバッファDBRに取り込まれた16ビットディスプレースメントが符号拡張されて、内部バスdbに出力される。これらが算術論理演算器ALUに入力される。信号gbbyte(内部バスgbからのバイト入力指示信号)、gbsft2(内部バスgbからの入力に対する2ビットシフト指示信号)が活性状態になり、内部バスgbから入力されたデータの下位8ビットをゼロ拡張し、2ビットシフトされて、内部バスdbから入力された内容と加算される。信号aluab(ALUの演算結果をバスabに出力する指示信号)が活性状態になり、加算結果(ea)が内部バスabに出力され、更に、アドレスバッファABを経由して、内部アドレスバスIABに出力される。同時に、ロングワードのリードを示すバスコマンドBCMDが出力される。同時に、レジスタ選択信号を含むデータリード制御信号が生成され、順次、T4、T5の制御を行う。具体的には、T4で信号ldd(IDBからDBRへのロード指示信号)が活性状態になり、リードデータバッファDBR取り込み制御が指示される。T5では、信号dbrrd0(DBRのリード指示信号)が活性状態になり、リードデータバッファDBRの内容がデスティネーションレジスタである汎用レジスタER0への転送が指示される。   A part of the instruction code (register designation feed) is given to the register selector RESL and decoded. In accordance with the decoding result, a control signal / register selection signal is output at T3. The signal rsgb1 is activated and the contents of the general-purpose register ER1 are output to the internal bus gb. In addition, a control signal dbrdb (output control signal from the read data buffer DBR to the bus db) (not shown) and a control signal dbrex (sign extension instruction signal for the data in the read data buffer) (not shown) are activated. The 16-bit displacement captured in the read data buffer DBR is sign-extended and output to the internal bus db. These are input to the arithmetic logic unit ALU. The signals gbbyte (byte input instruction signal from the internal bus gb) and gbsft2 (2-bit shift instruction signal for the input from the internal bus gb) are activated, and the lower 8 bits of the data input from the internal bus gb are zero-extended. Then, it is shifted by 2 bits and added to the content input from the internal bus db. The signal alaab (instruction signal for outputting the operation result of ALU to the bus ab) is activated, the addition result (ea) is output to the internal bus ab, and further to the internal address bus IAB via the address buffer AB. Is output. At the same time, a bus command BCMD indicating a long word read is output. At the same time, a data read control signal including a register selection signal is generated, and T4 and T5 are sequentially controlled. Specifically, at T4, the signal ldd (load instruction signal from IDB to DBR) is activated, and read data buffer DBR fetch control is instructed. At T5, the signal dbrrd0 (DBR read instruction signal) is activated, and the transfer of the contents of the read data buffer DBR to the general-purpose register ER0, which is the destination register, is instructed.

リードデータは、T4で内部データバスIDBに得られ、前記の通り、T5でリードデータバッファDBRに取り込まれ、T6で、汎用レジスタER0へ転送される。同時に、転送データの内容に従って、コンディションコードレジスタCCRの所定のフラグが更新される。   The read data is obtained on the internal data bus IDB at T4, and as described above, is read into the read data buffer DBR at T5 and transferred to the general-purpose register ER0 at T6. At the same time, a predetermined flag in the condition code register CCR is updated according to the contents of the transfer data.

図19にはMOVA/L @(d:16,R1L),ER1の実行タイミングが例示される。これは図11で説明した[配列などの実効アドレス計算用MOVA命令]の命令フォーマットに応ずる命令の実行タイミングを示す。   FIG. 19 illustrates the execution timing of MOVA / L @ (d: 16, R1L), ER1. This indicates the execution timing of an instruction corresponding to the instruction format of [MOVA instruction for effective address calculation such as array] described in FIG.

前記同様に、T2で、命令コードが命令デコーダDECに入力されて、命令の内容が解読される。ディスプレースメントは、T3でリードデータバッファDBRに取り込まれる。命令コードの一部(レジスタ指定フィード)がレジスタセレクタRESLに与えられ、解読される。解読結果に従って、T3で制御信号・レジスタ選択信号が出力される。信号rsgb1(ER1からバスgbへの出力指示信号)が活性状態になって、汎用レジスタER1の内容が内部バスgbに出力される。また、信号dbrdb(DBRからバスdbへの出力指示信号)が活性状態になって、DBRに取り込まれたディスプレースメントが内部バスdbに出力される。これらが算術論理演算器ALUに入力される。信号gbbyte、gbsft2信号が活性状態になり、内部バスgbから入力されたデータの下位8ビットをゼロ拡張し、2ビットシフトされて、内部バスdbから入力された内容と加算され、加算結果が内部バスwb2に出力される。同時に、信号wbrd1(バスwb2からレジスタER1へのライト指示信号)が活性状態になって、内部バスwb2の内容がデスティネーションレジスタである汎用レジスタER1に格納される。特に制限はされないものの、実効アドレスの転送命令であるMOVAの場合は、コンディションコードレジスタCCRは保持される。   Similarly to the above, at T2, the instruction code is input to the instruction decoder DEC, and the contents of the instruction are decoded. The displacement is taken into the read data buffer DBR at T3. A part of the instruction code (register designation feed) is given to the register selector RESL and decoded. In accordance with the decoding result, a control signal / register selection signal is output at T3. Signal rsgb1 (output instruction signal from ER1 to bus gb) is activated, and the contents of general-purpose register ER1 are output to internal bus gb. Further, the signal dbrdb (output instruction signal from the DBR to the bus db) is activated, and the displacement taken into the DBR is output to the internal bus db. These are input to the arithmetic logic unit ALU. The signals gbbyte and gbsft2 are activated, the lower 8 bits of the data input from the internal bus gb are zero-extended, shifted by 2 bits, added to the content input from the internal bus db, and the addition result is internal It is output to the bus wb2. At the same time, the signal wbrd1 (write instruction signal from the bus wb2 to the register ER1) is activated, and the contents of the internal bus wb2 are stored in the general-purpose register ER1 that is the destination register. Although there is no particular limitation, the condition code register CCR is retained in the case of MOVA, which is an effective address transfer instruction.

図20にはBRA R2の実行タイミングが例示される。これは図11で説明した[分岐命令1]の命令フォーマットに応ずる命令の実行タイミングを示す。   FIG. 20 illustrates the execution timing of BRA R2. This indicates the execution timing of an instruction corresponding to the instruction format of [Branch instruction 1] described in FIG.

前記同様に、T2で、命令コードが命令デコーダDECに入力されて、命令の内容が解読される。命令コードの一部(レジスタ指定フィード)がレジスタセレクタRESLに与えられ、解読される。解読結果に従って、T2では、命令リードが抑止される。T3で制御信号・レジスタ選択信号が出力される。信号rsgb2が活性状態になって、汎用レジスタER2の内容が内部バスgbに出力される。また、図示を省略する信号pcdb(PCの値のバスdbへの出力指示信号)が活性状態になって、プログラムカウンタPCの値が内部バスdbに出力される。これらが算術論理演算器ALUに入力される。信号gbword、gbsft1が活性状態になり、内部バスgbから入力されたデータの下位16ビットをゼロ拡張し、1ビットシフトされて、内部バスdbから入力された内容と加算され、加算結果が内部バスabに出力される。内部バスabに出力されたアドレス(target)は、アドレスバッファABを経由して、内部アドレスバスIABに出力される。同時に、命令リードを示すバスコマンドBCMDが出力される。また、内部バスabに出力された内容は、インクリメンタで+2され、プログラムカウンタPCに格納される。   Similarly to the above, at T2, the instruction code is input to the instruction decoder DEC, and the contents of the instruction are decoded. A part of the instruction code (register designation feed) is given to the register selector RESL and decoded. According to the decoding result, instruction reading is suppressed at T2. At T3, a control signal / register selection signal is output. The signal rsgb2 is activated and the contents of the general-purpose register ER2 are output to the internal bus gb. Further, the signal pcdb (output instruction signal of the PC value to the bus db) not shown is activated, and the value of the program counter PC is output to the internal bus db. These are input to the arithmetic logic unit ALU. The signals gbword and gbsft1 are activated, the lower 16 bits of the data input from the internal bus gb are zero-extended, shifted by 1 bit, and added to the content input from the internal bus db, and the addition result is the internal bus is output to ab. The address (target) output to the internal bus ab is output to the internal address bus IAB via the address buffer AB. At the same time, a bus command BCMD indicating an instruction read is output. Further, the content output to the internal bus ab is incremented by +2 by the incrementer and stored in the program counter PC.

T4では、更新されたプログラムカウンタPCの値に従って、命令リードとプログラムカウンタPCのインクリメントが行われる。T5では、T3でリードした分岐先の命令コードが命令デコーダDECに入力されて、分岐先の命令の内容が解読される。   At T4, instruction read and increment of the program counter PC are performed according to the updated value of the program counter PC. At T5, the branch destination instruction code read at T3 is input to the instruction decoder DEC, and the contents of the branch destination instruction are decoded.

図21にはJMP @@aa:7の実行タイミングが例示される。これは図11で説明した[分岐命令2]の命令フォーマットに応ずる命令の実行タイミングを示す。   FIG. 21 illustrates the execution timing of JMP @@ aa: 7. This indicates the execution timing of an instruction corresponding to the instruction format of [branch instruction 2] described in FIG.

前記同様に、T2で、命令コードが命令デコーダDECに入力されて、命令の内容が解読される。解読結果に従って、制御信号aa7rdが活性状態になり、T2では、アドレスバッファABに、命令コードの一部(ビット6〜0)と、上位ビットに固定値(H’80)及びベクタベースレジスタVBRの内容が与えられる。更に、CPU動作モード(mode)に応じて、ミニマムモードの場合は1ビット、マキシマムモードの場合は2ビットシフトが行われ、内部アドレスバスIABに出力される。同時に、ミニマムモードの場合はワード、マキシマムモードの場合はロングワードのリードを示すバスコマンドBCMDが出力される。T3では、待機状態とされる。サブルーチン分岐命令の場合は、このステートでスタック操作を行うとよい。   Similarly to the above, at T2, the instruction code is input to the instruction decoder DEC, and the contents of the instruction are decoded. According to the result of decoding, the control signal aa7rd is activated, and at T2, a part of the instruction code (bits 6 to 0), a fixed value (H'80) in the upper bits and the vector base register VBR are stored in the address buffer AB. Content is given. Further, according to the CPU operation mode (mode), a 1-bit shift is performed in the minimum mode, and a 2-bit shift is performed in the maximum mode, and the result is output to the internal address bus IAB. At the same time, a bus command BCMD indicating a word read in the minimum mode and a long word read in the maximum mode are output. At T3, a standby state is set. In the case of a subroutine branch instruction, the stack operation may be performed in this state.

T4で、リードしたデータがリードデータバッファDBRに格納され、この内容が、内部バスabと、アドレスバッファABを経由して、内部アドレスバスIABに出力される。同時に、命令リードを示すバスコマンドBCMDが出力される。また、内部バスabに出力された内容は、インクリメンタINCで+2され、プログラムカウンタPCに格納される。   At T4, the read data is stored in the read data buffer DBR, and the contents are output to the internal address bus IAB via the internal bus ab and the address buffer AB. At the same time, a bus command BCMD indicating an instruction read is output. Further, the content output to the internal bus ab is incremented by +2 by the incrementer INC and stored in the program counter PC.

T5では、更新されたプログラムカウンタPCの値に従って、命令リードとプログラムカウンタPCのインクリメントが行われる。T6では、T3でリードした分岐先の命令コードが命令デコーダDECに入力されて、分岐先の命令の内容が解読される。   At T5, instruction read and increment of the program counter PC are performed according to the updated value of the program counter PC. At T6, the branch destination instruction code read at T3 is input to the instruction decoder DEC, and the contents of the branch destination instruction are decoded.

絶対アドレス32ビットの分岐命令を、命令コードを16ビット単位でリードする場合に比較して、実行ステート数を同等にできる。命令コードを32ビット単位でリードしたりして、絶対アドレス32ビットの分岐命令の実行開始前に、絶対アドレス32ビットをリード済みであれば、拡張メモリ間接のアドレシングモードより、高速に実行できるので、高速な分岐が必要な処理は絶対アドレス32ビット分岐命令を使用すればよい。また、分岐先が共通な分岐命令が多数あって、さほど高速な分岐が必要でない分岐命令では、拡張メモリ間接アドレシングモードの分岐命令を使用すればよい。この指定は、Cコンパイラのオプションや、ソースプログラムの制御命令として、指定可能にするとよい。   The number of execution states can be made equal when a branch instruction having an absolute address of 32 bits is compared with a case where the instruction code is read in units of 16 bits. If the instruction code is read in 32-bit units and the 32-bit absolute address has been read before the execution of the branch instruction with the 32-bit absolute address, the execution can be performed faster than in the extended memory indirect addressing mode. For processing that requires high-speed branching, an absolute address 32-bit branch instruction may be used. For branch instructions that have many branch instructions that share a common branch destination and do not require a high-speed branch, a branch instruction in the extended memory indirect addressing mode may be used. This specification may be specified as a C compiler option or a source program control instruction.

図22にはBFLD #xx,@aa:16,R3Hの実行タイミングが例示される。これは図11で説明した[ビットフィールド命令]の命令フォーマットに応ずる命令の実行タイミングを示す。   FIG. 22 illustrates the execution timing of BFLD #xx, @aa: 16, R3H. This indicates the execution timing of an instruction corresponding to the instruction format of [bit field instruction] described in FIG.

前記同様に、T2で、命令コード第1ワード(bfld−1)が命令デコーダDECに入力されて、命令の内容が解読される。第2ワードの絶対アドレス(bfld−2)は、T3でリードデータバッファDBRに取り込まれる。T4で第3ワード(bfld−3)が命令デコーダDECに入力されて、命令の内容が解読される。   Similarly to the above, at T2, the instruction code first word (bfld-1) is input to the instruction decoder DEC, and the contents of the instruction are decoded. The absolute address (bfld-2) of the second word is taken into the read data buffer DBR at T3. At T4, the third word (bfld-3) is input to the instruction decoder DEC, and the contents of the instruction are decoded.

解読結果に従って、T3で、夫々図示を省略する信号dbrab(バッファDBRからバスabへの出力指示信号)、dbrext(バッファDBRの保持情報に対する符号拡張の指示信号)が活性状態になって、下位16ビットを符号拡張し、内部バスab、アドレスバッファABを経由して、内部アドレスバスIABに出力される。同時に、バイトのリードを示すバスコマンドBCMDが出力される。リードしたデータは、T5でリードデータバッファDBRに取り込まれる。   In accordance with the decoding result, at T3, the signals dbrab (output instruction signal from the buffer DBR to the bus ab) and dblex (sign extension instruction signal for the information held in the buffer DBR) are activated, and the lower 16 The bit is sign-extended and output to the internal address bus IAB via the internal bus ab and the address buffer AB. At the same time, a bus command BCMD indicating a byte read is output. The read data is taken into the read data buffer DBR at T5.

T5で制御信号・レジスタ選択信号が出力される。信号dbrgbが活性状態になって、リードデータが内部バスgbに出力され、また、命令コードの一部のイミディエイトデータが、算術論理演算器ALUに入力される。信号bfldが活性状態になって、算術論理演算器ALUがビットフィールドロード演算を行い、演算結果が内部バスwb2に出力される。同時に、信号wbrd3h(バスwb2から汎用レジスタR3Hへのロード指示信号)が活性状態になって、内部バスwb2の内容がデスティネーションレジスタである汎用レジスタR3Hに格納される。特に制限はされないものの、BFLD命令の場合は、コンディションコードレジスタCCRは保持される。   At T5, a control signal / register selection signal is output. The signal dbrgb is activated, read data is output to the internal bus gb, and immediate data as part of the instruction code is input to the arithmetic logic unit ALU. The signal bfld is activated, the arithmetic logic unit ALU performs a bit field load operation, and the operation result is output to the internal bus wb2. At the same time, the signal wbrd3h (load instruction signal from the bus wb2 to the general-purpose register R3H) is activated, and the contents of the internal bus wb2 are stored in the general-purpose register R3H which is the destination register. Although not particularly limited, the condition code register CCR is retained in the case of a BFLD instruction.

図23にはBFST R4L,#xx,@ER3の実行タイミングが示される。これは図11で説明した[ビットフィールド命令]の命令フォーマットに応ずる図22とは別の命令の実行タイミングを示す。   FIG. 23 shows the execution timing of BFST R4L, #xx, @ ER3. This shows the execution timing of an instruction different from FIG. 22 corresponding to the instruction format of [bit field instruction] described in FIG.

前記同様に、T2で、命令コード第1ワード(bfst−1)が命令デコーダDECに入力されて、命令の内容が解読される。T3で第2ワード(bfst−2)が命令デコーダDECに入力されて、命令の内容が解読される。解読結果に従って、T2で、図示を省略する信号yrsab3が活性状態になって、汎用レジスタER3の内容が、内部バスab、アドレスバッファABを経由して、内部アドレスバスIABに出力される。同時に、バイトのリードを示すバスコマンドBCMDが出力される。リードしたデータは、T4でリードデータバッファDBRに取り込まれる。   Similarly to the above, at T2, the instruction code first word (bfst-1) is input to the instruction decoder DEC, and the contents of the instruction are decoded. At T3, the second word (bfst-2) is input to the instruction decoder DEC, and the contents of the instruction are decoded. In accordance with the decoding result, at T2, the signal yrsab3 (not shown) is activated, and the contents of the general-purpose register ER3 are output to the internal address bus IAB via the internal bus ab and the address buffer AB. At the same time, a bus command BCMD indicating a byte read is output. The read data is taken into the read data buffer DBR at T4.

T4で制御信号・レジスタ選択信号が出力される。信号dbrgbが活性状態になって、リードデータが内部バスgbに出力され、信号rddb4lが活性状態になって、汎用レジスタR4Lの内容が内部バスdbに出力され、また、命令コードの一部のイミディエイトデータが、算術論理演算器ALUに入力される。信号bfstが活性状態になって、算術論理演算器ALUがビットフィールドストア演算を行い、演算結果が内部バスwb2に出力される。同時に、信号wbdbwが活性状態になって、内部バスwb2の内容が、T5で、ライトデータバッファDBWに格納される。T4で同時に、T2と同じ内容が、内部アドレスバスIABに出力される。これは、T2で、テンポラリレジスタTRに保持するようにし、T4で内部バスabに出力するとよい。これについては、特願2000−161137号で別に提案した。或いは、アドレスバッファABに保持してもよい。T4で更に、バイトのライトを示すバスコマンドBCMDが出力される。T5で、ライトデータバッファDBWの内容が内部データバスIDBに出力される。特に制限はされないものの、BFST命令の場合は、コンディションコードレジスタCCRの値は保持される。   At T4, a control signal / register selection signal is output. The signal dbrgb is activated, read data is output to the internal bus gb, the signal rddb4l is activated, the contents of the general-purpose register R4L are output to the internal bus db, and an immediate part of the instruction code Data is input to the arithmetic logic unit ALU. The signal bfst becomes active, the arithmetic logic unit ALU performs a bit field store operation, and the operation result is output to the internal bus wb2. At the same time, the signal wbdbw is activated, and the contents of the internal bus wb2 are stored in the write data buffer DBW at T5. At the same time at T4, the same contents as T2 are output to the internal address bus IAB. This is preferably held in the temporary register TR at T2 and output to the internal bus ab at T4. This was separately proposed in Japanese Patent Application No. 2000-161137. Alternatively, it may be held in the address buffer AB. Further, at T4, a bus command BCMD indicating a byte write is output. At T5, the contents of the write data buffer DBW are output to the internal data bus IDB. Although not particularly limited, in the case of a BFST instruction, the value of the condition code register CCR is retained.

図24には前記CPU2の開発環境の概略が示される。開発者は、各種エディタなどを用いて、C言語乃至アセンブリ言語でプログラムを作成する。これは通常、複数のモジュールに分割して作成される。   FIG. 24 shows an outline of the development environment of the CPU 2. The developer creates a program in C language or assembly language using various editors. This is usually created by dividing it into a plurality of modules.

Cコンパイラ30は、開発者の作成したそれぞれのC言語ソースプログラム31を入力し、アセンブリ言語ソースプログラム乃至オブジェクトモジュールを出力する。コンパイル時のオプションなどとして、拡張メモリ間接として使用すべき、関数などを指定可能にすることもできる。   The C compiler 30 inputs each C language source program 31 created by the developer, and outputs an assembly language source program or an object module. As a compile-time option, a function that should be used as extended memory indirect can be specified.

アセンブラ32は、アセンブリ言語ソースプログラム33を入力し、オブジェクトモジュールを出力する。   The assembler 32 inputs the assembly language source program 33 and outputs an object module.

リンケージエディタ34は、上記Cコンパイラやアセンブラの生成した、複数のオブジェクトモジュール35を入力して、各モジュールの外部参照や相対アドレスなどの解決を行い、1つのプログラムに結合して、ロードモジュール36を出力する。このとき、プログラムを解析して、ディスプレースメントや絶対アドレスのビット長を決める。また、分岐命令の分岐先の頻度の高いものを、拡張メモリ間接などの短い命令コードの命令を割当てるようにする。要するに、リンク時に最適化を行なう。   The linkage editor 34 inputs a plurality of object modules 35 generated by the C compiler and assembler, resolves external references and relative addresses of the modules, combines them into one program, and loads the load module 36. Output. At this time, the program is analyzed to determine the displacement and the bit length of the absolute address. In addition, an instruction with a short instruction code such as extended memory indirect is assigned to a branch instruction with a high branch destination frequency. In short, optimization is performed at the time of linking.

ロードモジュール36は、シミュレータ/デバッガ37に入力して、パーソナルコンピュータなどのシステム開発装置上で、CPU2の動作をシミュレーションし、実行結果を表示し、プログラムの解析や評価を行うことができる。また、エミュレータ38に入力して、実際の応用システム上などで動作する、いわゆるインサーキットエミュレーションを行い、マイクロコンピュータ全体としての、実動作の解析や評価を行うことができる。さらに、ロードモジュールをPROMライタ39に入力して、マイクロコンピュータの内蔵ROMがフラッシュメモリなどの場合や、外部のフラッシュメモリなどに、作成したプログラムをロードすることができる。必要に応じて、オブジェクトコンバータなどによって、所望のフォーマットに変換する。このほかに、ライブラリアンとして、汎用的なサブルーチンなどを提供することもできる。   The load module 36 can input to the simulator / debugger 37, simulate the operation of the CPU 2 on a system development device such as a personal computer, display the execution result, and analyze and evaluate the program. In addition, by inputting to the emulator 38 and performing so-called in-circuit emulation that operates on an actual application system or the like, it is possible to analyze and evaluate the actual operation of the entire microcomputer. Furthermore, a load module can be input to the PROM writer 39, and the created program can be loaded to the case where the built-in ROM of the microcomputer is a flash memory or the like, or to an external flash memory. If necessary, it is converted into a desired format by an object converter or the like. In addition, a general subroutine can be provided as a librarian.

以上説明したマイクロコンピュータによれば、以下の作用効果を得ることができる。   According to the microcomputer described above, the following functions and effects can be obtained.

(1)従来複数の命令を使用して実現していた処理に対応する命令を実行する機能を有することにより、使い勝手を向上するとともに、プログラム容量を縮小し、処理速度を向上することができる。プログラム容量を縮小することによって、ひいては、プログラム格納用のROMなどのメモリ容量を縮小し、費用を節約することができる。   (1) By having a function of executing an instruction corresponding to processing that has been realized using a plurality of instructions in the past, it is possible to improve usability, reduce the program capacity, and improve the processing speed. By reducing the program capacity, it is possible to reduce the memory capacity of the ROM for storing the program, thereby saving costs.

(2)インデックスレジスタの使用と、データレジスタの使用を同じ単位で行うことによって、プログラミングを容易にし、上位の汎用レジスタを別のデータレジスタとして使用することを容易にできる。   (2) By using the index register and the data register in the same unit, programming can be facilitated, and the upper general-purpose register can be easily used as another data register.

(3)汎用レジスタ内容をインデックスレジスタとする実効アドレス計算を行い、結果を同一の汎用レジスタに格納する命令は、使用するレジスタフィールドを少なくし、一旦使用した汎用レジスタは、通常複数回使用することは少ないから、使い勝手を損なわず、命令コード長を短縮し、或いは、他の命令コードの追加を可能にすることができる。   (3) The effective address calculation using the contents of the general-purpose register as an index register and the instruction to store the result in the same general-purpose register should use fewer register fields, and the once-used general-purpose register should normally be used multiple times. Therefore, it is possible to shorten the instruction code length or add another instruction code without impairing the usability.

(4)インデックスレジスタは、下位詰めで使用することで、アドレスレジスタの本数と同一にでき、命令フォーマットを共通にしやすい。既存のCPUに追加する場合も追加しやすい。   (4) By using the index register in the lower order, it can be made the same as the number of address registers, and the instruction format can be easily made common. When adding to an existing CPU, it is easy to add.

(5)拡張メモリ間接は、例外処理ベクタと連続した領域にサブルーチンベクタテーブルのマッピングを可能にし、プログラミングの容易化に寄与することができる。例外処理ベクタテーブルとサブルーチンベクタテーブルが重ならないようにして、有効活用ができる。ベクタベースレジスタVBRを例外処理と共にサブルーチンコールにも共用すれば、資源の有効活用と、使い勝手の向上を図ることができる。   (5) Extended memory indirect enables mapping of a subroutine vector table to an area contiguous with an exception processing vector, thereby contributing to facilitating programming. The exception processing vector table and the subroutine vector table can be used effectively without overlapping. If the vector base register VBR is shared for exception calls and subroutine calls, it is possible to effectively use resources and improve usability.

(6)Cコンパイラで、拡張メモリ間接の使用を選択することにより、効率的に、プログラム容量の削減を行うことができる。   (6) By selecting the indirect use of the extended memory by the C compiler, the program capacity can be efficiently reduced.

(7)ビットフィールドをイミディエイトで指定することにより、論理構成を容易にできる。ビットフィールド演算部を、算術演算器は桁上がりを有する算術論理演算と並列とし、遅延時間を均等にして、遅延時間の増加を抑止できる。   (7) By specifying the bit field as immediate, the logical configuration can be facilitated. The bit field operation unit is parallel to the arithmetic logic operation in which the arithmetic operation unit has a carry, and the delay time can be equalized to prevent an increase in the delay time.

(8)サブルーチンコールの先頭アドレステーブルをポイントする専用サブルーチンベクタベースレジスタTBRを、例外処理用のベクタベースレジスタVBRとは別に導入することにより、コード効率、ジャンプ可能な範囲の全アドレス空間対応、自由に配置できる専用サブルーチンベクタテーブルエリアによるプログラミングの容易化、を満たすことができる。   (8) By introducing a dedicated subroutine vector base register TBR that points to the head address table of the subroutine call separately from the vector base register VBR for exception handling, code efficiency, all address space within the jumpable range, free This makes it easy to program with a dedicated subroutine vector table area that can be placed in

以上本発明者等によってなされた発明を実施例に限定されるものではなく、その要旨を逸しない範囲において種々変更可能である。   The invention made by the inventors as described above is not limited to the embodiments, and various modifications can be made without departing from the spirit of the invention.

例えば、汎用レジスタは、アドレス及びデータに共通に利用可能なものである必要はなく、一部または全部がアドレス専用またはデータ専用のものであってもよい。汎用レジスタのデータサイズについても任意とすることができる。また、インデックスレジスタは、下位詰めで使用するものとしているが、汎用レジスタRHや、汎用レジスタEを使用可能にしてもよい。   For example, the general-purpose registers need not be commonly used for addresses and data, and some or all of them may be dedicated to addresses or data. The data size of the general-purpose register can also be set arbitrarily. Further, although the index register is used in the lower order, the general register RH or the general register E may be usable.

CPUの命令体系や命令フォーマットは任意に変形できる。例えば、MOVA命令は同一の汎用レジスタを指定するものとしたが、他の汎用レジスタや、メモリ上のデータをソース(インデックスレジスタ)とすることもできる。ディスプレースメント付インデックスレジスタ間接は、転送命令のほか、メモリを指定する他の演算命令などに適用することもできる。ディスプレースメント付インデックスレジスタ間接における、ゼロ拡張とシフトは、ALUの機能とするほか、内部バスgbの機能としてもよい。   The CPU instruction system and instruction format can be arbitrarily modified. For example, the MOVA instruction designates the same general-purpose register, but other general-purpose registers or data on the memory can be used as a source (index register). The index register indirect with displacement can be applied to other operation instructions that specify a memory in addition to a transfer instruction. The zero extension and shift in the index register with displacement indirectly may be functions of the internal bus gb in addition to the functions of the ALU.

ベクタベースレジスタVBRはなくてもよい。動作モードなどに従って、切替えるようなものでもよい。ビットフィールド転送のための詳細な論理や実行シーケンスは変形が可能である。図25の(6a)と(6b)の双方のアドレシングモードを共に持つことは必須ではなく、何れか一方だけであってもよい。   The vector base register VBR may be omitted. It may be switched according to the operation mode. The detailed logic and execution sequence for bit field transfer can be modified. It is not essential to have both the addressing modes (6a) and (6b) in FIG. 25, and only one of them may be provided.

また、命令コードの基本単位16ビットに限定する必要はなく、8ビット或いは32ビットなど任意のビット幅とできる。拡張メモリ間接による分岐命令は、絶対アドレスによる分岐命令より命令コード長が短ければよい。簡単のために、バス幅を32ビットとし、命令リードを16ビット単位としたが、命令リードを32ビット単位にして高速化することができる。これについては、特願平11−167812号で提案した。また、バス幅を16ビットとして、ロングワードのリード/ライトを、ワード単位の2回のリード/ライトで実行するようにしてもよい。   Also, it is not necessary to limit the basic unit of the instruction code to 16 bits, and any bit width such as 8 bits or 32 bits can be used. A branch instruction with indirect extended memory may have a shorter instruction code length than a branch instruction with an absolute address. For simplicity, the bus width is set to 32 bits and the instruction read is set to 16 bits. However, the instruction read can be set to 32 bits to increase the speed. This was proposed in Japanese Patent Application No. 11-167812. Alternatively, the bus width may be 16 bits, and long word read / write may be executed in two read / write operations in units of words.

プログラムカウンタのビット数や、そのほかの制御レジスタの構成なども任意にできる。VBRは、CPU内部のレジスタとして持つほか、内部I/Oレジスタとしてもよい。ビット数も任意にできる。或いは、動作モードなどや内部I/Oレジスタの設定などで、固定値を切替えるようにしてもよい。   The number of bits of the program counter and the configuration of other control registers can be arbitrarily set. The VBR may be an internal I / O register as well as a register inside the CPU. The number of bits can also be arbitrarily set. Alternatively, the fixed value may be switched by an operation mode or setting of an internal I / O register.

以上の説明では主として本発明者によってなされた発明をその背景となった利用分野であるシングルチップマイクロコンピュータに適用した場合について説明したが、それに限定されるものではなく、その他のシステムオンチップのマイクロコンピュータ、データプロセッサ、汎用マイクロプロセッサ等のデータ処理装置に広く適用することが可能である。本発明は少なくとも、命令を解読して処理し、演算処理を行う条件のものに適用することができる。   In the above description, the case where the invention made mainly by the present inventor is applied to the single chip microcomputer, which is the field of use behind the present invention, has been described. However, the present invention is not limited to this. The present invention can be widely applied to data processing devices such as computers, data processors, and general-purpose microprocessors. The present invention can be applied to at least a condition for decoding and processing instructions and performing arithmetic processing.

本発明が適用されたCPUの詳細を例示するブロック図である。It is a block diagram which illustrates the detail of CPU to which this invention was applied. 本発明の適用されたシングルチップマイクロコンピュータのブロック図である。1 is a block diagram of a single chip microcomputer to which the present invention is applied. FIG. CPUに内蔵された汎用レジスタ及び制御レジスタの構成を例示する説明図である。It is explanatory drawing which illustrates the structure of the general purpose register and control register which were built in CPU. 汎用レジスタの使用形態を例示する説明図である。It is explanatory drawing which illustrates the usage form of a general purpose register. CPUのアドレス空間を例示する説明図である。It is explanatory drawing which illustrates the address space of CPU. 転送/演算命令の実効アドレスの計算方法を例示する説明図である。It is explanatory drawing which illustrates the calculation method of the effective address of a transfer / arithmetic instruction. 転送/演算命令の実効アドレスの更に別の計算方法を例示する説明図である。It is explanatory drawing which illustrates further another calculation method of the effective address of a transfer / arithmetic instruction. 分岐命令の実効アドレスの計算方法を例示する説明図である。It is explanatory drawing which illustrates the calculation method of the effective address of a branch instruction. 分岐命令の実効アドレスの更に別の計算方法を例示する説明図である。It is explanatory drawing which illustrates another calculation method of the effective address of a branch instruction. CPUの機械語の命令フォーマットを例示するフォーマット図である。It is a format figure which illustrates the instruction format of the machine language of CPU. 本発明に関する命令フォーマットを例示する説明図である。It is explanatory drawing which illustrates the command format regarding this invention. ビットフィールド命令によるデータ処理機能を例示する説明図である。It is explanatory drawing which illustrates the data processing function by a bit field instruction. アドレスバッファの機能を論理記述で例示する説明図である。It is explanatory drawing which illustrates the function of an address buffer with a logic description. 算術論理演算器の主要部の構成を例示するブロック図である。It is a block diagram which illustrates the composition of the principal part of an arithmetic logic unit. 入力セレクタのゼロ拡張機能と1ビットシフト又は2ビットシフト機能を論理記述で例示する説明図である。It is explanatory drawing which illustrates the zero extension function and 1-bit shift or 2-bit shift function of an input selector by a logic description. BFLD演算機能を論理記述で例示する説明図である。It is explanatory drawing which illustrates a BFLD operation function with a logic description. BFST演算機能を論理記述で例示する説明図である。It is explanatory drawing which illustrates a BFST operation function with a logic description. MOV.L@(d:16,R1L),ER0の命令実行タイミングを例示するタイミングチャートである。MOV. It is a timing chart which illustrates the instruction execution timing of L @ (d: 16, R1L) and ER0. MOVA/L @(d:16,R1L),ER1の命令実行タイミングを例示するタイミングチャートである。It is a timing chart which illustrates the instruction execution timing of MOVA / L @ (d: 16, R1L), ER1. BRA R2の命令実行タイミングを例示するタイミングチャートである。It is a timing chart which illustrates the instruction execution timing of BRA R2. JMP @@aa:7の命令実行タイミングを例示するタイミングチャートである。It is a timing chart which illustrates the instruction execution timing of JMP @@ aa: 7. BFLD #xx,@aa:16,R3Hの命令実行タイミングを例示するタイミングチャートである。It is a timing chart which illustrates the instruction execution timing of BFLD #xx, @aa: 16, R3H. BFST R4L,#xx,@ER3の命令実行タイミングを例示するタイミングチャートである。It is a timing chart which illustrates the instruction execution timing of BFST R4L, #xx, @ ER3. CPUの開発環境の概略を例示する説明図である。It is explanatory drawing which illustrates the outline of the development environment of CPU. 拡張メモリ間接アドレシングモードのアドレス演算手法の詳細を例示する説明図である。It is explanatory drawing which illustrates the detail of the address calculation method of extended memory indirect addressing mode. 図25の(6b)に示されるアドレシングモードによるサブルーチン命令による動作を示す説明図である。It is explanatory drawing which shows the operation | movement by the subroutine command by the addressing mode shown by (6b) of FIG. サブルーチンコール群の先頭アドレスを示す専用サブルーチンベースレジスタをさらに導入した場合におけるサブルーチン命令による動作を示す説明図である。It is explanatory drawing which shows the operation | movement by a subroutine command in the case of introduce | transducing the exclusive subroutine base register which shows the head address of a subroutine call group further.

符号の説明Explanation of symbols

1 マイクロコンピュータ
2 CPU
2A 制御部
2B 実行部
IR 命令レジスタ
DEC 命令デコーダ
ER0〜ER7 汎用レジスタ
VBR ベクタベースレジスタ
ALU 算術論理演算器
INC インクリメンタ
IDB 内部データバス
IAB 内部アドレスバス
TBR サブルーチンベクタテーブルレジスタ
SBR サブルーチンベースレジスタ
1 Microcomputer 2 CPU
2A Control unit 2B Execution unit IR Instruction register DEC Instruction decoder ER0 to ER7 General purpose register VBR Vector base register ALU Arithmetic logic unit INC Incrementer IDB Internal data bus IAB Internal address bus TBR Subroutine vector table register SBR Subroutine base register

Claims (3)

命令を読み込んで解読し、その解読結果に従って命令を実行する命令実行手段を有し、
前記命令実行手段は、メモリ上のデータをリードし、当該リードしたデータと命令コード中に含まれる連続する複数ビットの第1指定情報との論理積をとり、前記論理積の結果に対し、前記第1指定情報の下位ビット側の第1の状態のビットが最下位ビットになるように右シフトし、前記右シフトの結果を汎用レジスタに格納するロード命令と、
前記汎用レジスタのデータを、命令コード中に含まれる連続する複数ビットの第2指定情報の下位ビット側の第1の状態のビット位置まで左シフトし、前記第2指定情報における第1の状態のビット位置では前記シフトした内容を選択し、第2の状態のビット位置ではメモリのデータを選択して、その結果をメモリに格納するストア命令と、を実行可能であることを特徴とするデータ処理装置。
Having instruction execution means for reading and decoding an instruction and executing the instruction according to the decoding result;
It said instruction executing means reads the data in memory, a logical product of the read data to the first designation information of a plurality consecutive bits are Ru contained in the instruction code, the result of the logical product On the other hand, a load instruction that shifts right so that the bit in the first state on the lower bit side of the first designation information becomes the least significant bit, and stores the result of the right shift in a general-purpose register ;
The data of the general-purpose register is left-shifted to the bit position of the first state on the lower bit side of the second designation information of a plurality of consecutive bits included in the instruction code, and the first state of the second designation information A data processing characterized in that it can execute a store instruction for selecting the shifted content at a bit position, selecting memory data at a bit position in the second state, and storing the result in the memory apparatus.
前記ロード命令は、その命令コード中に、メモリ上のリードアドレスを指定するための情報と、前記右シフトの結果を格納する汎用レジスタを指定するための情報とを含み、
前記ストア命令は、その命令コード中に、前記左シフトの対象とするデータを保持する汎用レジスタを指定するための情報と、前記操作の結果を格納するメモリを指定するための情報とを含む、ことを含むことを特徴とする請求項1記載のデータ処理装置。
The load instruction includes, in the instruction code , information for designating a read address on the memory, and information for designating a general-purpose register for storing the result of the right shift ,
The store instruction includes, in the instruction code, information for designating a general-purpose register that holds the data to be subjected to the left shift, and information for designating a memory that stores the result of the operation. The data processing apparatus according to claim 1, further comprising:
前記命令実行手段は中央処理装置であり、1個の半導体基板に形成されて成ることを特徴とする請求項1又は2記載のデータ処理装置。   3. A data processing apparatus according to claim 1, wherein said instruction execution means is a central processing unit and is formed on one semiconductor substrate.
JP2006286815A 2002-06-28 2006-10-20 Data processing device Expired - Fee Related JP4498338B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2006286815A JP4498338B2 (en) 2002-06-28 2006-10-20 Data processing device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2002191340 2002-06-28
JP2006286815A JP4498338B2 (en) 2002-06-28 2006-10-20 Data processing device

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2002305308A Division JP4004915B2 (en) 2002-06-28 2002-10-21 Data processing device

Publications (2)

Publication Number Publication Date
JP2007048317A JP2007048317A (en) 2007-02-22
JP4498338B2 true JP4498338B2 (en) 2010-07-07

Family

ID=37851036

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2006286815A Expired - Fee Related JP4498338B2 (en) 2002-06-28 2006-10-20 Data processing device

Country Status (1)

Country Link
JP (1) JP4498338B2 (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002073325A (en) * 2000-08-25 2002-03-12 Sanyo Electric Co Ltd Data processing device and method

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4085447A (en) * 1976-09-07 1978-04-18 Sperry Rand Corporation Right justified mask transfer apparatus
JPS63263527A (en) * 1987-04-22 1988-10-31 Hitachi Ltd Information processor
JPH0778723B2 (en) * 1988-11-08 1995-08-23 日本電気株式会社 Information processing equipment

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002073325A (en) * 2000-08-25 2002-03-12 Sanyo Electric Co Ltd Data processing device and method

Also Published As

Publication number Publication date
JP2007048317A (en) 2007-02-22

Similar Documents

Publication Publication Date Title
TWI476597B (en) Data processing apparatus and semiconductor integrated circuit device
JP5199931B2 (en) 8-bit microcontroller with RISC architecture
JP4004915B2 (en) Data processing device
JP2002540523A (en) Microcontroller instruction set
US4434462A (en) Off-chip access for psuedo-microprogramming in microprocessor
JPS6339931B2 (en)
JP2581236B2 (en) Data processing device
JP3694531B2 (en) 8-bit microcontroller with RISC architecture
JP2001202243A (en) Data processor
US6687808B2 (en) Data processor using indirect register addressing
US7996651B2 (en) Enhanced microprocessor or microcontroller
JP2006313561A (en) Data processor
US6986028B2 (en) Repeat block with zero cycle overhead nesting
JP4073721B2 (en) Data processing device
JP4545777B2 (en) Data processing device
JP3786575B2 (en) Data processing device
JP2556182B2 (en) Data processing device
JP4498338B2 (en) Data processing device
JP3839835B2 (en) Data processing apparatus and microcomputer
JP3760093B2 (en) Microcomputer
JP3740321B2 (en) Data processing device
JP2861560B2 (en) Data processing device
JP4382076B2 (en) Data processing device
JP2696578B2 (en) Data processing device
JP2002132499A (en) Data processing apparatus and recording medium

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20081209

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20090209

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20090310

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20090511

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20100413

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20100413

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130423

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Ref document number: 4498338

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313111

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130423

Year of fee payment: 3

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20140423

Year of fee payment: 4

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

LAPS Cancellation because of no payment of annual fees