JP2004295914A - Data processing device - Google Patents
Data processing device Download PDFInfo
- Publication number
- JP2004295914A JP2004295914A JP2004161157A JP2004161157A JP2004295914A JP 2004295914 A JP2004295914 A JP 2004295914A JP 2004161157 A JP2004161157 A JP 2004161157A JP 2004161157 A JP2004161157 A JP 2004161157A JP 2004295914 A JP2004295914 A JP 2004295914A
- Authority
- JP
- Japan
- Prior art keywords
- register
- instruction
- signal
- bit
- cpu
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Executing Machine-Instructions (AREA)
Abstract
Description
本発明は、データ処理装置に関し、特に、半導体集積回路装置によって構成される高速かつ小型のシングルチップマイクロコンピュータに利用して有効な技術に関するものである。 The present invention relates to a data processing device, and more particularly to a technology effective when used in a high-speed and small-sized single-chip microcomputer constituted by a semiconductor integrated circuit device.
半導体集積回路装置の製造技術の高度化に伴って、半導体単結晶からなるシングルチップに、中央演算処理装置(Central Processing Unit;以下、単にCPUと称する)、プログラムを格納するROM(Read Only Memory)、書き替え可能に各種データを格納するRAM(Random Access Memory)等を含む構成素子を集積して製造した、小型のシングルチップマイクロコンピュータ(以下、単にマイクロコンピュータと称する)が広範囲に普及してきており、種々の目的のデータ処理装置として使用されてきている。このマイクロコンピュータは、CPUが同時に処理し得る情報の量によって性能が異なり、例えば4ビット、8ビット、16ビット、32ビット等のマイクロコンピュータとして区分されている。 2. Description of the Related Art With the advancement of the manufacturing technology of semiconductor integrated circuit devices, a central processing unit (hereinafter, simply referred to as a CPU) and a ROM (Read Only Memory) for storing programs on a single chip made of a semiconductor single crystal. 2. Description of the Related Art A small single-chip microcomputer (hereinafter simply referred to as a microcomputer) manufactured by integrating components including a RAM (Random Access Memory) for storing various data in a rewritable manner has become widespread. Have been used as data processing devices for various purposes. This microcomputer has different performance depending on the amount of information that can be simultaneously processed by the CPU, and is classified as, for example, a 4-bit, 8-bit, 16-bit, or 32-bit microcomputer.
このようなマイクロコンピュータは、アドレス空間の拡張や、命令セットの拡大、高速化等が図られてきている。また、CPUは、ソフトウェアによってその性能が定義されているから、前記のようにアドレス空間の拡張や、命令セットの拡大、高速化等を図ったマイクロコンピュータにおいても、既存のマイクロコンピュータのソフトウェア資産を有効に利用できることが望ましい。 In such a microcomputer, an address space is expanded, an instruction set is expanded, a speed is increased, and the like. Further, since the performance of the CPU is defined by software, even in a microcomputer in which the address space is expanded, the instruction set is expanded, and the speed is increased as described above, the software resources of the existing microcomputer are used. It is desirable that it can be used effectively.
このため、オブジェクトレベルで互換性を保ちつつ、アドレス空間の拡張や、命令セットの拡大、高速化等を実現した例として、例えば本出願人が先に提案した特許文献1、あるいは非特許文献1等がある。
For this reason, as an example of realizing expansion of an address space, expansion of an instruction set, speeding-up, etc. while maintaining compatibility at the object level, for example,
前記CPUは、システムクロックの2周期である、いわゆる2ステートで基本命令を実行している。これに対して、1ステートで基本命令を実行するようにし、さらに、CPUとは独立して乗算器を内蔵して高速化を図った例として、例えば非特許文献2、あるいは非特許文献3等がある。このような乗算器は積和演算と乗算に利用する。
The CPU executes a basic instruction in so-called two states, which are two periods of a system clock. On the other hand, as an example in which a basic instruction is executed in one state and a multiplier is built in independently of the CPU to increase the speed, for example, Non-Patent
このように高速化を図ることによって、マイクロコンピュータによって制御される各種機器の高速化や高性能化、あるいは、従来においては複数の半導体集積回路装置で構成していたものを、結合したりすることにより小型化を図ることができるようになる。 By increasing the speed in this way, it is possible to increase the speed and performance of various devices controlled by the microcomputer, or to combine components conventionally constituted by a plurality of semiconductor integrated circuit devices. Thereby, miniaturization can be achieved.
また、前記のような各種機器の高速化や高性能化、あるいは小型化は、アドレス空間が比較的小さく、命令セットが比較的小さいCPUあるいはマイクロコンピュータにおいても要求されるから、前記特許文献1等に記載されるアドレス空間の広いCPUと、アドレス空間の小さいCPUが存在する場合には、その双方の高速化を図ることが望ましい。 In addition, high speed, high performance, and miniaturization of various devices as described above are also required for a CPU or a microcomputer having a relatively small address space and a relatively small instruction set. When there are a CPU having a large address space and a CPU having a small address space, it is desirable to speed up both of them.
このような観点から、上位CPUを開発し、これをベースにして下位CPUへ展開できれば都合が良い。これによって、開発効率を向上することができる。さらに、半導体集積回路装置によって構成されるCPU自体の他に、クロスアセンブラやCコンパイラ、シミュレータ、リアルタイムOS等の開発ツール等の開発も共通化して、開発効率を向上することが望ましい。 From such a viewpoint, it is convenient if the upper CPU can be developed and developed to the lower CPU based on this. Thereby, the development efficiency can be improved. Further, in addition to the CPU itself constituted by the semiconductor integrated circuit device, it is desirable that development of development tools such as a cross assembler, a C compiler, a simulator, a real-time OS, and the like be shared to improve development efficiency.
前記のようなマイクロコンピュータにおいて、乗算器は専用の資源を必要とするから、必ずしも積和演算や乗算の高速化を必要としない場合には、費用対効果の点で得策でない。また、例えば前記非特許文献3においては、乗算結果は専用のレジスタ(MAC)に得られるから、これを利用する場合には、別の命令によってそれをCPUの汎用レジスタに転送しなければならない。乗算器を内蔵して乗算自体を高速化しても、そのように乗算結果を使用するまでの時間が長くなっては意味がない。
In such a microcomputer, since the multiplier requires a dedicated resource, it is not advisable in terms of cost-effectiveness if the product-sum operation or the multiplication is not necessarily required to be performed at high speed. Further, for example, in
一方、従来のCPUとの互換性を維持するためには、前記のように命令の追加は困難であり、追加する命令は最小限にしなければならない。また、演算結果等のフラグも互換性を保持する必要がある。積和演算についても、演算結果等のフラグを参照できれば使い勝手が良くなる。フラグの状態を判定して分岐する、いわゆる条件分岐命令などで演算結果を容易に判定し、処理の内容を変更することができるからである。かかるフラグには、オーバフロー(V)、ゼロ(Z)、ネガティブ(N)などがある。 On the other hand, in order to maintain compatibility with a conventional CPU, it is difficult to add instructions as described above, and the added instructions must be minimized. Further, it is necessary to maintain compatibility of flags such as operation results. As for the product-sum operation, the usability is improved if a flag such as an operation result can be referred to. This is because it is possible to easily determine the operation result using a so-called conditional branch instruction or the like that determines the state of the flag and branches, and changes the content of the processing. Such flags include overflow (V), zero (Z), and negative (N).
本発明の目的は、互換性を維持しつつニーズに応じた乗算性能が得られ、しかも処理性能の向上を図ることが可能な技術を提供することにある。 An object of the present invention is to provide a technique capable of obtaining multiplication performance according to needs while maintaining compatibility and improving processing performance.
本発明の他の目的は、制御手段に乗算手段を内蔵して互換性を維持しつつ処理の高速化を図ることが可能な技術を提供することにある。 Another object of the present invention is to provide a technique capable of increasing the speed of processing while maintaining compatibility by incorporating a multiplying means in a control means.
本発明のその他の目的は、乗算手段を制御手段から独立して設け、しかも制御手段に乗算機能を備えさせることにより、製造費用の低減が可能な技術を提供することにある。 Another object of the present invention is to provide a technique capable of reducing the manufacturing cost by providing the multiplying means independently of the control means and providing the control means with a multiplying function.
本発明の前記ならびにそのほかの目的と新規な特長は、本発明書の記述および添付図面から明らかになるであろう。 The above and other objects and novel features of the present invention will become apparent from the description of the present specification and the accompanying drawings.
本願において開示される発明のうち代表的なものの概要を簡単に説明すれば下記の通りである。 The outline of a representative invention among the inventions disclosed in the present application will be briefly described as follows.
(1)本発明のデータ処理装置は、命令を実行する実行手段を制御する制御手段と乗算手段を設け、前記制御手段と乗算手段とが並列動作する第1の命令とともに、前記乗算手段が動作する第2の命令を有し、乗算手段は前記制御手段に内蔵されている。また、第1の命令は積和命令であるとともに、第2の命令は乗算命令になっている。積和命令のアドレッシングモードは、いわゆるポストインクリメントレジスタ間接とする。乗算手段には結果を判定するフラグ検出手段を設け、乗算命令時はフラグ検出結果を制御手段に供給して、保持させる手段を設ける。 (1) A data processing device according to the present invention includes a control unit for controlling an execution unit for executing an instruction, and a multiplication unit. The multiplication unit operates together with a first instruction in which the control unit and the multiplication unit operate in parallel. And a multiplication means is built in the control means. The first instruction is a multiply-accumulate instruction, and the second instruction is a multiply instruction. The addressing mode of the product-sum instruction is so-called post-increment register indirect. The multiplication means is provided with a flag detection means for judging the result, and is provided with means for supplying the flag detection result to the control means at the time of a multiplication instruction and holding the result.
(2)本発明のデータ処理装置は、命令を実行する実行手段を制御する制御手段と乗算手段を設け、前記制御手段と乗算手段とが並列動作する第1の命令とともに、前記乗算手段が動作する第2の命令を有し、乗算手段は前記制御手段から独立して設けられている。また、制御手段は乗算機能を備えている。 (2) The data processing device of the present invention includes a control unit for controlling an execution unit for executing an instruction and a multiplication unit, and the multiplication unit operates together with a first instruction in which the control unit and the multiplication unit operate in parallel. And a multiplying means is provided independently of the control means. The control means has a multiplication function.
(3)本発明のデータ処理装置は、命令を実行する実行手段を制御する制御手段に指定可能な複数のレジスタの組み合わせを固定にし、複数のレジスタの退避/復帰命令を有している。 (3) The data processing device of the present invention has a fixed combination of a plurality of registers that can be designated as a control unit that controls an execution unit that executes an instruction, and has a save / restore instruction for a plurality of registers.
(4)本発明のデータ処理装置は、命令を実行する実行手段を制御する制御手段に搭載されるコントロールレジスタの有効/無効を切り換える手段を有し、コントロールレジスタの有効時には、例外処理の遷移時、例外処理からの復帰時に、前記コントロールレジスタの待避/復帰を行い、前記コントロールレジスタの無効時には、例外処理の遷移時、例外処理からの復帰時に、前記コントロールレジスタの待避/復帰を行なわない。 (4) The data processing device of the present invention has means for switching the validity / invalidity of the control register mounted on the control means for controlling the execution means for executing the instruction. When returning from exception processing, the control register is saved / restored. When the control register is invalid, the control register is not saved / restored at the transition of exception processing or when returning from exception processing.
(5)本発明のデータ処理装置は、命令を実行する実行手段を制御する制御手段の搭載される固定的なスタックレジスタを設け、エミュレーションプログラムへの遷移時、エミュレーションプログラムからの復帰時に、前記固定的なスタックレジスタ用いて、ユーザが使用するスタックポインタを無視あるいは保持するかを指定する手段を有している。 (5) The data processing device of the present invention is provided with a fixed stack register in which a control means for controlling an execution means for executing an instruction is provided, and the fixed stack register is provided at the time of transition to the emulation program and at the time of return from the emulation program. A means for designating whether to ignore or hold the stack pointer used by the user by using a general stack register.
上記した(1)の手段によれば、乗算器(乗算手段)を内蔵することによって、アドレッシングモードの増加を最小限にして、かつ処理性能を低下させずに積和演算を実行可能にすることができる。また、ポストインクリメントレジスタ間接により、多数のデータの積和演算を連続して処理することができる。さらに、乗算の結果(積、フラグ)を直ちに利用できるから、実質的な乗算の実行速度を向上することができる。 According to the above-mentioned means (1), by incorporating a multiplier (multiplication means), it is possible to minimize the increase in the addressing mode and to execute the product-sum operation without lowering the processing performance. Can be. In addition, the product-sum operation of a large number of data can be continuously processed by the post-increment register indirect. Further, since the result (product, flag) of the multiplication can be used immediately, the execution speed of the actual multiplication can be improved.
乗算器とCPU(制御手段)を一体に構成して、乗算器・CPU間の配線を短縮して、物理的規模を縮小する。また、高速化に寄与することができる。 The multiplier and the CPU (control means) are integrally configured to reduce the wiring between the multiplier and the CPU, thereby reducing the physical scale. In addition, it can contribute to speeding up.
上記した(2)の手段によれば、乗算器を取外し可能に(独立して)設けることによって、乗算器を取外した場合は、積和演算をサポートしないことによって、容易に下位CPUを実現し、論理的・物理的規模を縮小し、製造費用を低減した別のマイクロコンピュータを容易に開発することができる。また、乗算器を取外したCPUにおいても、汎用的な乗算命令をサポートすることによって、使い勝手の低下を防止できる。さらに、乗算器使用するか使用しないかの制御信号(有効/無効)を与えて制御することによって、テスト性を向上したり、エミュレータを共通化したりすることができる。さらにまた、全体的な開発効率を向上することができる。 According to the above-mentioned means (2), the lower CPU can be easily realized by providing the multiplier detachably (independently) and not supporting the product-sum operation when the multiplier is removed. Further, another microcomputer having a reduced logical / physical scale and a reduced manufacturing cost can be easily developed. Further, even in the CPU from which the multiplier has been removed, by supporting a general-purpose multiplication instruction, it is possible to prevent a decrease in usability. Further, by giving and controlling a control signal (valid / invalid) for using or not using a multiplier, testability can be improved and an emulator can be shared. Furthermore, overall development efficiency can be improved.
乗算器を削除した場合、乗算は除算と同一のシーケンスで実行できる。積和演算はサポートせず、積和演算の特殊なシーケンスをサポートしないことによって論理規模の縮小を更に行なうことができる。テスト命令をサポートすることによって、論理規模の増加を最低限にして、テストの容易性を向上することができる。 If the multiplier is omitted, the multiplication can be performed in the same sequence as the division. Since the product-sum operation is not supported and the special sequence of the product-sum operation is not supported, the logical scale can be further reduced. By supporting test instructions, testability can be improved with minimal increase in logic size.
上記した(3)の手段によれば、複数レジスタの退避/復帰命令を持ち、この組み合わせを固定的にすることによって、論理規模の縮小を図ることができ、また、高速化を図ることができる。レジスタの本数の異なる命令を複数命令サポートすることによって、使い勝手の低下を防ぐことができる。 According to the above-mentioned means (3), a save / restore instruction for a plurality of registers is provided, and by fixing the combination, the logical scale can be reduced and the speed can be increased. . By supporting a plurality of instructions having different numbers of registers, it is possible to prevent a decrease in usability.
さらに、内部動作のパイプラインに対応して、入出力タイミングの異なるレジスタ選択回路を複数持つことにより、レジスタ間演算命令などの基本命令を実質的に1命令/1ステート実行を行なうことができる。 Further, by providing a plurality of register selection circuits having different input / output timings corresponding to the pipeline of the internal operation, it is possible to substantially execute one instruction / one state of a basic instruction such as an inter-register operation instruction.
上記した(4)の手段によれば、コントロールレジスタの有効/無効を切り換えることで、スタックの節約と、割込み応答時間の高速化に寄与することができる。また、互換性を維持することができる。 According to the above-described means (4), by switching between valid and invalid of the control register, it is possible to contribute to saving of the stack and shortening of the interrupt response time. In addition, compatibility can be maintained.
上記した(5)の手段によれば、エミュレータ専用の固定スタックポインタを持つことにより、エミュレータのサポートを容易にすることができる。また、論理規模の増加を最低限にして、エミュレータの設計を容易にすることができる。エミュレータ専用スタックポインタの一部のアドレスを、CPU外部から与えるようにして、スタックレジスタをリロケータブルにし、マイクロコンピュータのアドレス配置などに容易に対応することができる。 According to the above-mentioned means (5), the support of the emulator can be facilitated by having a fixed stack pointer dedicated to the emulator. Further, the design of the emulator can be facilitated by minimizing the increase in the logical scale. By giving a part of the address of the emulator-dedicated stack pointer from outside the CPU, the stack register can be made relocatable, and it is possible to easily cope with the address arrangement of the microcomputer.
本題において開示される発明のうち代表的なものによって得られる効果を簡単に説明すれば下記の通りである。 The effects obtained by typical aspects of the invention disclosed in the subject will be briefly described as follows.
(1)乗算器をCPUに内蔵することによって、アドレッシングモードの増加を最小限にして、かつ処理性能を低下させずに積和演算を実行可能にすることができる。乗算器による乗算の結果を汎用レジスタCCRに反映させ、かかる結果を直ちに利用可能にして、処理速度を高速にすることができる。 (1) By incorporating the multiplier in the CPU, it is possible to minimize the increase in the addressing mode and execute the product-sum operation without lowering the processing performance. The result of the multiplication by the multiplier is reflected in the general-purpose register CCR, such a result can be immediately used, and the processing speed can be increased.
(2)乗算器を取外し可能に(独立して)設けることによって、乗算器を取外した場合は、積和演算をサポートしないことによって、容易に下位CPUを実現し、論理的・物理的規模を縮小し、製造費用の低減に寄与することができる。 (2) By providing the multiplier detachably (independently), when the multiplier is removed, the lower CPU can be easily realized by not supporting the product-sum operation, and the logical and physical scales can be reduced. This can contribute to a reduction in manufacturing cost.
(3)複数レジスタの退避/復帰命令を持ち、この組み合わせを固定的にすることによって、論理規模の縮小を図ることができ、また、高速化を図ることができる。 (3) By having a save / restore instruction for a plurality of registers and fixing this combination, the logical scale can be reduced, and the speed can be increased.
(4)コントロールレジスタの有効/無効を切り換えることで、スタックの節約と、割込み応答時間の高速化に寄与することができるとともに、互換性を維持することができる。 (4) By switching between valid / invalid of the control register, it is possible to save the stack and to shorten the interrupt response time, and to maintain compatibility.
(5)エミュレータ専用の固定スタックポインタを持つことにより、エミュレータをサポートすることができ、また、論理規模の増加を最低限にして、エミュレータの設計を容易にすることができ、さらにエミュレータ専用スタックポインタの一部のアドレスを、CPU外部から与えるようにして、スタックレジスタをリロケータブルにし、マイクロコンピュータのアドレス配置などに容易に対応することができる。 (5) Emulators can be supported by having a fixed stack pointer dedicated to the emulator, an increase in logical scale can be minimized, the design of the emulator can be simplified, and a stack pointer dedicated to the emulator can be used. By giving a part of the address from outside the CPU, the stack register is made relocatable, and it is possible to easily cope with the address arrangement of the microcomputer.
以下、本発明について、図面を参照して実施の形態とともに詳細に説明する。 Hereinafter, the present invention will be described in detail along with embodiments with reference to the drawings.
なお、実施の形態を説明するための全図において、同一機能を有するものは同一符号を付け、その繰り返しの説明は省略する。 In all the drawings for describing the embodiments, components having the same function are denoted by the same reference numerals, and repeated description thereof will be omitted.
図1に、本発明の適用されたデータ処理装置の一例であるシングルチップマイクロコンピュータ(以下、単にマイクロコンピュータと称する)のブロック図を示す。マイクロコンピュータは、CPU1、乗算器2、システムコントローラ(SYSC)3、割込コントローラ(INT)4、ROM5、RAM6、タイマA7、タイマB8、シリアルコミュニケーションインタフェース(SCI)9、A/D変換器10、第1乃至第9入出力ポート(IOP1〜IOP9)11A〜11I、クロック発振器(CPG)12の機能ブロック乃至はモジュールから構成され、公知の半導体製造技術により1つの半導体基板上に半導体集積回路装置として形成される。CPU1は、乗算器2を内蔵してなる。システムコントローラ(SYSC)3は、システムコントロールレジスタ(SYSCR)13および制御レジスタ(CPUCR)14を内蔵している。
FIG. 1 shows a block diagram of a single-chip microcomputer (hereinafter simply referred to as a microcomputer) as an example of a data processing device to which the present invention is applied. The microcomputer includes a
かかるマイクロコンピュータは、電源端子として、グランドレベル(Vss)、電源電圧レベル(Vcc)、その他専用制御端子として、リセット(RES)、スタンバイ(STBY)、モード制御(MD0〜2)、クロック入力(EXTAL、XTAL)端子を有する。クロック入力(EXTAL、XTAL)端子に接続される、図示はされない水晶振動子に基づいて、クロック発振器が生成するシステムクロック(φ1、φ2)に同期して、マイクロコンピュータは動作する。或は外部クロックをEXTAL端子に入力してもよい。システムクロックの1周期を1ステートと呼ぶ。 Such a microcomputer has a ground level (Vss) and a power supply voltage level (Vcc) as power supply terminals, and reset (RES), standby (STBY), mode control (MD0 to 2), and clock input (EXTAL) as other dedicated control terminals. , XTAL) terminals. The microcomputer operates in synchronization with system clocks (φ1, φ2) generated by a clock oscillator based on a crystal oscillator (not shown) connected to clock input (EXTAL, XTAL) terminals. Alternatively, an external clock may be input to the EXTAL terminal. One cycle of the system clock is called one state.
これらの機能ブロックは、内部バスによって相互に接続される。内部バスは内部アドレスバス(PAB)・内部データバス(PDB)の他、リード信号・ライト信号を含み、さらにバスサイズ信号或いはシステムクロック(φ1、φ2)などを含む。 These functional blocks are interconnected by an internal bus. The internal bus includes a read signal and a write signal in addition to an internal address bus (PAB) and an internal data bus (PDB), and further includes a bus size signal or a system clock (φ1, φ2).
入出力ポートは、外部バス信号、入出力回路の入出力信号と兼用とされている。これらは、動作モードあるいはソフトウェアの設定により、機能を選択されて、使用される。IOP1〜3はアドレスバス出力、IOP4、5はデータバス入出力、IOP6はバス制御信号入出力信号と兼用されている。外部アドレスは、それぞれ、これらの入出力ポートに含まれるバッファ回路を介して内部アドレスバスと接続されている。
The input / output port is also used as an external bus signal and an input / output signal of an input / output circuit. These functions are selected and used depending on the operation mode or software setting.
内部バスおよび外部バス共に16ビットバス幅とし、バイトサイズ(8ビット)およびワードサイズ(16ビット)のリード/ライトを可能にする。なお、内部バスおよび外部バスのいずれも8ビット幅とすることもできる。バス制御信号入出力信号には、アドレスストローブ信号AS、リード信号RD、ライト信号HWR・LWR、ウェイト信号WAIT、エリア0選択信号CS0などがある。割込信号は、タイマ・SCI・IOP8から要求され、割込コントローラ(INT)が調停して、CPUに割込を要求する。このとき、CPUに対し、割込要求信号とベクタ番号を与える。
Both the internal bus and the external bus have a 16-bit bus width, and enable reading / writing of byte size (8 bits) and word size (16 bits). Note that both the internal bus and the external bus may have an 8-bit width. The bus control signal input / output signals include an address strobe signal AS, a read signal RD, a write signal HWR / LWR, a wait signal WAIT, an
RES端子にリセット信号が加えられると、モード端子(MD0〜2)で与えられる動作モードを取り込み、マイクロコンピュータはリセット状態になる。モード端子で設定する動作モードは、シングルチップ/拡張、アドレス空間、内蔵ROMの有効/無効、データバス幅の初期値を8ビットまたは16ビットから選択する。 When a reset signal is applied to the RES terminal, the operation mode given by the mode terminals (MD0 to MD2) is fetched, and the microcomputer is reset. The operation mode set by the mode terminal selects single chip / extension, address space, enable / disable of built-in ROM, and the initial value of the data bus width from 8 bits or 16 bits.
図2に、システムコントロールレジスタ(SYSCR)3の構成を示す。各ビットの内容を表1乃至表4に示す。 FIG. 2 shows the configuration of the system control register (SYSCR) 3. Tables 1 to 4 show the contents of each bit.
なお、ビット2、1:リザーブビット
リードすると常に”0”が読み出される。ライトは無効である。
When read, "0" is always read. Light is invalid.
[表1]
[Table 1]
[表2]
[Table 2]
[表3]
[Table 3]
[表4]
[Table 4]
以下に、表5にCPU1の命令セットを示す。本実施の形態 に用いられるCPU1の命令は合計で71種類ある。表6に命令とアドレッシングモードとの組み合わせを示す。表7に以下の各表に使用される記号(オペレーションの記号)の意味を示す。表8乃至表15に各命令の機能別一覧表を示す。
Table 5 shows an instruction set of the
[表5]
[Table 5]
[表6]
[Table 6]
[表7]
[Table 7]
[表8]
[Table 8]
[表9]
[Table 9]
[表10]
[Table 10]
[表11]
[Table 11]
[表12]
[Table 12]
[表13]
[Table 13]
[表14]
[Table 14]
[表15]
[Table 15]
基本的な命令は平成5年6月(株)日立製作所発行『H8/300Hシリーズプログラミングマニュアル』などに記載のCPUと同様であり、いわゆる、ロードストアアーキテクチャを採用している。命令とアドレッシングモードの組み合わせを削減し、CPUの命令制御の論理規模・物理的規模を縮小できる。 The basic instructions are the same as those of the CPU described in "H8 / 300H Series Programming Manual" issued by Hitachi, Ltd. in June 1993, and employ a so-called load store architecture. The combination of the instruction and the addressing mode can be reduced, and the logical and physical scales of the instruction control of the CPU can be reduced.
本発明のCPUは、上記従来CPUに対して命令実行時間の高速化を実現している。 The CPU of the present invention realizes faster instruction execution time than the conventional CPU.
CPUの命令は、2バイト(ワード)を単位にしている。各命令は下記のようなオペレーションフィールド(op)、レジスタフィールド(r)、EA拡張部(EA)、およびコンディションフィールド(cc)から構成されている。 CPU instructions are in units of 2 bytes (words). Each instruction includes an operation field (op), a register field (r), an EA extension (EA), and a condition field (cc) as described below.
(1)オペレーションフィールド
命令の機能を表し、アドレッシングモードの指定、オペランドの処理内容を指定する。命令の先頭4ビットを必ず含んでいる。2つのオペレーションフィールドを持つ場合もある。
(1) Operation field This field indicates the function of the instruction, and specifies the addressing mode and the processing contents of the operand. It always contains the first 4 bits of the instruction. It may have two operation fields.
(2)レジスタフィールド
汎用レジスタを指定する。アドレスレジスタのとき3ビット、データレジスタのとき3ビットまたは4ビットである。2つのレジスタフィールドを持つ場合、またはレジスタフィールドを持たない場合もある。
(2) Register field Specify a general-purpose register. The address register has 3 bits, and the data register has 3 bits or 4 bits. It may have two register fields or no register field.
(3)EA拡張部
イミディエイトデータ、絶対アドレスまたはディスプレースメントを指定する。8ビット、16ビット、または32ビットである。
(3) EA extension part Specifies immediate data, an absolute address, or a displacement. 8, 16 or 32 bits.
(4)コンディションフィールド
Bcc命令の分岐条件を示す。
(4) Condition field Indicates the condition for branching the Bcc instruction.
図3に、命令の基本フォーマットの例を示す。 FIG. 3 shows an example of the basic format of the instruction.
図4に、マイクロコンピュータにおいて、CPU1に対し乗算器2を取外し可能に設けた概略ブロック図を示す。命令レジスタ(IR)21、命令デコーダ・制御回路(CONT)22、レジスタセレクタ(RSEL)23、ライトデータバッファ(DBW)24、リードデータバッファ(DBR)25、演算器(ALU)26、演算器(INC)27、汎用レジスタ(ER0〜ER7)28A〜28H、エミュレータスタックポインタ(EMLSP)29、プログラムカウンタ(PC)30、コンディションコードレジスタ(CCR)31、拡張レジスタ(EXR)32、アドレスバッファ(MAB)33からなる。乗算器2なしのCPU1はこれらによって構成される。各バッファやレジスタ、演算器の各ブロックの機能は、特開平5−241826号公報に記載のCPUと概略同様である。また、乗算器2を含むCPU1は、更に、バススイッチ34、乗算器2がある。
FIG. 4 is a schematic block diagram in which a
命令デコーダ・制御回路(CONT)22には、制御信号CPUS、制御信号INTM1、そのほかの制御信号(割り込み要求など)が入力されている。CONT22は各部を制御するための、出力タイミングの相違する制御信号A、B、Cを出力する。
The instruction decoder / control circuit (CONT) 22 receives a control signal CPUS, a control signal INTM1, and other control signals (such as an interrupt request). The
なお、図中のC1およびC2は、当該信号の同期タイミングを示す。例えば、RSEL入力1のC1はφに同期して入力が行われることを示し、RSEL入力2のC2はφ#(#は論理反転)に同期して入力が行われることを示す。また、ALU入力のC1は、φの期間に入力が行われることを示し、ALU出力のC2は、φ#の期間に出力が行われることを示す。ALU26とINC27は、それぞれ動作タイミングの異なった演算器であり、それぞれ、オーバラップしつつ演算可能である。
Note that C1 and C2 in the figure indicate the synchronization timing of the signal. For example, C1 of
そのほかのレジスタなどは、φ、φ#の両方でデータを入出力可能である。GB、DB、WBの各バスはφ、φ#の両方で異なったデータを転送可能である。φ、φ#は互いにノーオーバラップの関係の2相クロックとしてもよい。 Other registers can input / output data in both φ and φ #. The GB, DB, and WB buses can transfer different data in both φ and φ #. φ and φ # may be two-phase clocks having a no-overlap relationship with each other.
レジスタセレクタ(RSEL)23には、IR21乃至CONT22から命令コードの一部(レジスタ指定フィールド)が与えられる。この供給タイミングは、レジスタ指定フィールドの位置によって相違される。RSEL23は出力タイミングの相違するレジスタ選択信号A、Bを出力する。
The register selector (RSEL) 23 receives a part of the instruction code (register designation field) from the IR 21 to the
例えば、平成5年6月(株)日立製作所発行『H8/300Hシリーズプログラミングマニュアル』に記載のCPUにおいては、16ビット単位の命令コードのビット7−4が、CONT22と同時に与えられ(RSEL入力1)、ビット11−8および3−0(RSEL入力2)が、CONT22の内容と0.5ステート遅れて与えられる。RSEL入力2の反転制御信号をRSELに与える。
For example, in the CPU described in "H8 / 300H Series Programming Manual" issued by Hitachi, Ltd. in June 1993, bits 7-4 of a 16-bit instruction code are given simultaneously with CONT 22 (RSEL input 1). ), Bits 11-8 and 3-0 (RSEL input 2) are provided 0.5 state later than the contents of CONT22. An inversion control signal of
CPU1内部のDBW24、DBR25、ALU26、INC27、ER0〜ER7(28A〜28H)、PC30、CCR31、VAG、ABは、GBバス、DBバス、WBバスによって相互に接続されている。
The
2つの演算器ALU26、INC27に対し、GB、DBバスからデータを入力し、WBバスにデータを出力する。それぞれの入出力バスの数に対応した数の内部バスとして、バス即ち配線の増加による物理的規模の増加を抑止している。 Data is input from the GB and DB buses to the two arithmetic units ALU26 and INC27, and data is output to the WB bus. As the number of internal buses corresponding to the number of input / output buses, an increase in physical scale due to an increase in buses, that is, wiring, is suppressed.
また、ライトデータバッファ(DBW)24は内部データバスへの出力、リードデータバッファ(DBR)25は内部データバスからの入力、アドレスバッファ(MAB)33は内部アドレスバスへの出力、命令レジスタは内部データバスからの入力が可能であり、それぞれ内部バスに接続されている。ライトデータバッファ(DBW)24およびリードデータバッファ(DBR)25は32ビット構成とされる。ライトデータは32ビット一括してライトデータバッファ(DBW)24に書き込むことができ、所定のタイミングで、16ビットの内部データバスに出力される。また、内部データバスから読み出したデータを、リードデータバッファ(DBR)25に一旦格納して、32ビットのリードデータを一括して出力することができる。MABは+2のインクリメント機能を有する。 The write data buffer (DBW) 24 outputs to the internal data bus, the read data buffer (DBR) 25 inputs from the internal data bus, the address buffer (MAB) 33 outputs to the internal address bus, and the instruction register stores the internal data bus. Input from the data bus is possible, and each is connected to the internal bus. The write data buffer (DBW) 24 and the read data buffer (DBR) 25 have a 32-bit configuration. Write data can be written to the write data buffer (DBW) 24 in a batch of 32 bits, and output to the 16-bit internal data bus at a predetermined timing. Further, data read from the internal data bus can be temporarily stored in the read data buffer (DBR) 25, and 32-bit read data can be output collectively. MAB has a +2 increment function.
命令デコーダ・制御回路(CONT)22が、IR21からの入力、CPUS信号、INTM1信号やそのほかの入力信号に基づいて、動作制御を行なう。制御回路の出力は所定のバッファを介して出力される。CONT22自身にも、ステート番号などがフィードバックされる。
An instruction decoder / control circuit (CONT) 22 controls the operation based on the input from the IR 21, the CPUS signal, the INTM1 signal, and other input signals. The output of the control circuit is output via a predetermined buffer. The state number and the like are also fed back to the
アドレスバッファ(MAB)33はインクリメント機能(+2)を有する。ER0〜ER7(28A〜28Hは)データレジスタまたはアドレスレジスタとして使用することができる。 The address buffer (MAB) 33 has an increment function (+2). ER0 to ER7 (28A to 28H) can be used as data registers or address registers.
EMLSP29は、ユーザには公開されていないリソースで、エミュレータに搭載されて動作するとき、ユーザプログラムとエミュレーションプログラムの間の遷移時のスタックポインタとして使用する。その内容を指定するために、一部の内容が、CPU外部から与えられる。
The
PC30は32ビットのカウンタであり、CPU1が次に実行する命令のアドレスを示している。コンディションコードレジスタ(CCR)31は割り込みマスクビット(I)、キャリフラグ(C)、ゼロフラグ(Z)、ネガティブフラグ(N)、オーバフローフラグ(V)を含んでいる。
The PC 30 is a 32-bit counter and indicates the address of an instruction to be executed next by the
CPU1と乗算器2は、バススイッチ34を介して接続されている。また、バススイッチ34は内部データバスとのインタフェースも行なう。また、CPU1から乗算器2への制御信号を与える。乗算器2のステータス信号BUSYと、フラグ検出信号をCPU1に与える。TESTMODE信号を、例えば、SYSC3から与える。制御信号CPUSは、SYSCR14あるいはそのほかのレジスタの制御ビットの出力にしてもよいし、マイクロコンピュータの制御端子のようなもので指定してもよい。
The
図5に、制御信号CPUSを制御レジスタ(CPUCR)14の制御ビットで構成した具体的な例を示す。図は1ビットの構成を示している。CPUCR14は、フリップフロップで構成される。フリップフロップにはリセット信号が与えられる。フリップフロップのクロックは内部ライト信号と、アドレスをデコードして得られるCPUCR選択信号の論理積信号とされる。データ入力はデータバスのビット8とされる。出力がCPUS信号とされる。また、クロックトバッファCBF6を介して、データバスに出力される。クロックトバッファCBF6のクロックは内部ライト信号とCPUCR選択信号の論理積信号とされる。
FIG. 5 shows a specific example in which the control signal CPUS is configured by the control bits of the control register (CPUCR) 14. The figure shows the configuration of one bit. The
本レジスタのライトは、テストモードや、エミュレータに搭載した場合のブレークモードなどでのみライト可能にするとよい。ブレークモードなどについては、特開平6−150026などに記載されている。同様に、TESTMODE信号を生成することができる。同一のレジスタに配置することができる。 This register can be written only in the test mode or in the break mode when the emulator is mounted. The break mode and the like are described in JP-A-6-150026 and the like. Similarly, a TESTMODE signal can be generated. They can be located in the same register.
図6に、制御信号CPUSの設定方法の一例として、エミュレーション用プロセッサおよびエミュレータをブロック図で示す。エミュレーション用プロセッサ38は、マイクロコンピュータ部分にエミュレーション用インタフェース39を加えて構成される。エミュレーション用インタフェース39には、エミュレーション用プロセッサ専用の制御レジスタ41を有する。メモリ42は、ROM、RAMを含み、I/OはI/Oポート、タイマ、SCIなどを含む。
FIG. 6 is a block diagram showing an emulation processor and an emulator as an example of a method of setting the control signal CPUS. The
コネクタ部がマイクロコンピュータの代わりに応用システム(ユーザシステム)43に装着される。エミュレーション用プロセッサ38は上記コネクタ部とインタフェースケーブル44を介し、ターゲットシステムインタフェースを用いて上記応用システム43と信号の入出力を行なう。
The connector section is mounted on an application system (user system) 43 instead of the microcomputer. The
応用システム(ユーザシステム)43には、特に制限はされないものの、ユーザバス45が存在し、ユーザメモリ46が接続される。エミュレーション用プロセッサ38が出力し、インタフェースケーブル44を介して供給されるユーザストローブ信号に従って、ユーザメモリ46はリード/ライトされる。
The application system (user system) 43 includes, but is not limited to, a
一方、エミュレーション用プロセッサ38は上記エミュレーションインタフェース39を用いてエミュレーションバス47に接続される。エミュレーションバス47には図示はされない状態信号・制御信号などを含む。上記エミュレーションバス47を用いて、エミュレーション用プロセッサ38から、応用システム43とエミュレーション用プロセッサ38の内部状態に応じた情報などが出力され、また、エミュレーション用プロセッサ38に対し、エミュレーションのための各種制御信号が入力される。エミュレーション用プロセッサ38の、図示はされないエミュレートモード端子が電源レベルに固定され、エミュレーション用プロセッサ38内部ではエミュレートモードが設定される。
On the other hand, the
さらに、上記エミュレーションバス47には、特に制限はされないものの、応用システム43またはターゲットマイクロコンピュータ内蔵のメモリを代行するためのRAMでなるようなエミュレーションメモリ48がある。また、エミュレーション用プロセッサ38の制御状態やエミュレーションバス47の状態を監視して、その状態が予め設定された状態に達した時に、上記エミュレータ専用割込みを入力して、CPUによるユーザプログラムの実行を停止させ、エミュレーション用プログラム実行状態に遷移させる(ブレーク)ためのブレーク制御回路49と、上記CPUのリード動作またはライト動作を示す信号、命令リード動作を示す信号などに基づき、エミュレーションバス47に与えられるアドレスデータさらには制御情報を逐次蓄えるリアルタイムトレース回路50などが接続される。
Further, the
上記エミュレーションバス47が、エミュレーションメモリ48、ブレーク制御回路49、リアルタイムトレース回路50などに、それぞれ接続される。これらでもってマイクロコンピュータ開発装置55が構成されている。
The
上記エミュレーションメモリ48、ブレーク制御回路49、リアルタイムトレース回路50はコントロールバス51に接続され、コントロールバス51を介してコントロールプロセッサ52の制御を受けるようになっている。上記コントロールバス51は、エミュレーション用プロセッサ制御回路に接続されるとともに、インタフェース回路を介して、特に制限はされないもののパーソナルコンピュータなどのシステム開発装置54に接続される。例えば、システム開発装置54から入力されたプログラムをエミュレーションメモリ48に転送し、内蔵ROM上に配置されるべきかかるプログラムをCPU1がリードすると、エミュレーションメモリ48上のプログラムがリードされる。また、ブレーク条件や、リアルタイムトレース条件などもシステム開発装置54から与えることができる。
The
コントロールプロセッサ52は、CPUS信号をエミュレーション用プロセッサ38に供給して、乗算器の使用/不使用の選択を行なうことができる。コントロールプロセッサ52は、システム開発装置54から入力された情報などに基づいて、CPUS信号を制御する。あるいは、図5のような制御レジスタを、エミュレーション用インタフェース39内に制御レジスタに設けて、エミュレータ40のソフトウェアをCPUが実行して、前記制御レジスタを指定することによって、CPUS信号を生成するようにすることができる。この場合は、エミュレーション用ソフトウェアの実行モード、いわゆるブレークモードでのみライト可能にすると都合がよい。開発途上にあるユーザのソフトウェアの誤動作によって、誤った設定を行なうことがない。
The
エミュレーション用プロセッサ38およびエミュレータ40を複数のCPUをサポート可能にすることによって、実際のマイクロコンピュータのみを開発すればよく、開発効率を向上することができる。なお、EMLSP29のアドレス指定情報も、エミュレーション用インタフェース39内の制御レジスタで指定することができる。
By enabling the
エミュレーション用プロセッサ38やエミュレータ40については、特開平3−271834号公報、あるいは特開平6−150026号公報などに記載されている。
The
図7に、制御信号CPUS設定方法の一例である、マイクロコンピュータの主要部をブロック図で示す。CPUS信号をレジスタによらず、CMOSインバータ回路58の出力とする。かかるCMOSインバータ回路58は、Pチャネル型MOSトランジスタQ1、Nチャネル型MOSトランジスタQ2で構成される。このCMOSインバータ回路58の入力は、抵抗Rを介して電源Vddに接続されると共に、保護回路Q3、Q4を介して端子Pに結合される。端子Pは、ワイヤWによってグランドレベル電源用リードLに接続されるか、解放状態とされるかが選択され、CPUSの設定を行なう。
FIG. 7 is a block diagram showing a main part of a microcomputer which is an example of a control signal CPUS setting method. The CPUS signal is output from the
端子Pが解放状態とされれば、CMOSインバータ回路58の入力はハイレベルとなって、CPUS信号は非活性状態になる。一方、端子Pが、ワイヤWによって、グランドレベル電源用リードLに接続されれば、CMOSインバータ回路58の入力はロウレベルとなって、CPUS信号は活性状態になる。乗算器を使用可能にする。
When the terminal P is released, the input of the
端子Pは対応するリードを持たず、例えばプラスティックパッケージに封止された場合には、対応する端子を持たない。 The terminal P does not have a corresponding lead, and for example, does not have a corresponding terminal when sealed in a plastic package.
これにより、半導体集積回路装置のパッケージの端子を直接利用することなく、乗算器の制御を設定できるため、一定のパッケージを用いた場合に、有効な端子数の減少防ぐことができる。この場合、端子Pをグランドレベル電源端子に隣接して配置すると都合がよい。 Thus, since the control of the multiplier can be set without directly using the terminals of the package of the semiconductor integrated circuit device, it is possible to prevent the effective number of terminals from decreasing when a fixed package is used. In this case, it is convenient to arrange the terminal P adjacent to the ground level power supply terminal.
あるいは、端子Pをグランドレベル電源用リードLにワイヤWによって接続するか、しないかの選択を、半導体集積回路装置の配線変更として実現してもよい。CMOSインバータ回路58の入力を、半導体集積回路装置内部の電源電圧またはグランドのいずれに接続するかを選択すればよい。このとき、抵抗R及び端子Pは削除することができる。または、CPUSビットをPROM素子などで構成してもよい。この場合、製造者が設定を行なってもよいし、ユーザが設定を行なってもよい。
Alternatively, whether or not the terminal P is connected to the ground level power supply lead L by the wire W or not may be realized as a change in wiring of the semiconductor integrated circuit device. It is sufficient to select whether to connect the input of the
図8および図9に、CPUの内部レジスタ構成を示す。これらのレジスタは、図8の汎用レジスタおよび図9のコントロールレジスタの2つに分割される。以下、各レジスタについて説明する。 8 and 9 show the internal register configuration of the CPU. These registers are divided into two, a general-purpose register in FIG. 8 and a control register in FIG. Hereinafter, each register will be described.
(1)汎用レジスタ
CPUはこの汎用レジスタを8本有している。この汎用レジスタは32ビット長からなり、すべて同じ機能を有しており、アドレスレジスタとしてもデータレジスタとしても使用することができる。データレジスタとしては32ビット、16ビットおよび8ビットレジスタとして使用できる。
(1) General-purpose registers The CPU has eight general-purpose registers. This general-purpose register has a 32-bit length and has the same function, and can be used as both an address register and a data register. The data register can be used as a 32-bit, 16-bit and 8-bit register.
アドレスレジスタ及び32ビットレジスタとしては、一括して汎用レジスタER(ER0〜ER7)として使用する。16ビットレジスタとしては、汎用レジスタERを分割して汎用レジスタE(E0〜E7)、汎用レジスタR(R0〜R7)として使用する。これらは同等の機能を有しており、16ビットレジスタを最大16本まで使用することができる。 The address register and the 32-bit register are collectively used as general-purpose registers ER (ER0 to ER7). As 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 can use up to 16 16-bit registers.
8ビットレジスタとしては、汎用レジスタRを分割して汎用レジスタRH(R0H〜R7H)、汎用レジスタRL(R0L〜R7L)として使用する。これらは同等の機能を有しており、8ビットレジスタを最大16本まで使用することができる。 As the 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 the same function and can use up to 16 8-bit registers.
図10に、汎用レジスタの使用方法を示す。各レジスタは独立して使用方法を選択することができる。 FIG. 10 shows how to use a general-purpose register. The usage of each register can be independently selected.
汎用レジスタER7には、汎用レジスタとしての機能に加えて、スタックポインタ(SP)としての機能が割り当てられており、例外処理やサブルーチン分岐などで暗黙的に使用される。図11にスタックの状態を示す。 The general-purpose register ER7 is assigned a function as a stack pointer (SP) in addition to the function as the general-purpose register, and is used implicitly in exception processing and subroutine branching. FIG. 11 shows the state of the stack.
(2)コントロールレジスタ
コントロールレジスタは、24ビットのプログラムカウンタ(PC)と8ビットの拡張レジスタ(エクステンドレジスタ)(EXR)および8ビットのコンディションコードレジスタ(CCR)を含んでいる。
(2) Control Register The control register includes a 24-bit program counter (PC), an 8-bit extension register (extended register) (EXR), and an 8-bit condition code register (CCR).
1.プログラムカウンタ(PC)
24ビットのカウンタで、CPUが次に実行する命令のアドレスを示している。CPUの命令は、すべて2バイト(ワード)を単位としているため、最下位ビットは無効である。(命令コードのリード時には最下位ビットは”0”とみなされる)。
1. Program counter (PC)
A 24-bit counter indicates the address of an instruction to be executed next by the CPU. Since all CPU instructions are in units of 2 bytes (words), the least significant bit is invalid. (The least significant bit is regarded as "0" when reading the instruction code).
分岐命令の実行アドレスの上位8ビットは無視される。プログラム領域として使用できるのは、H’00000000〜H’00FFFFFFの領域である。 The upper 8 bits of the execution address of the branch instruction are ignored. The area of H'00000000 to H'00FFFFFF can be used as the program area.
2.拡張レジスタ(EXR)
8ビットのレジスタで、トレースビット(T)、割込みマスクビット(I2〜I0)を含む8ビットで構成されている。
2. Extension register (EXR)
It is an 8-bit register, and is composed of 8 bits including a trace bit (T) and an interrupt mask bit (I2 to I0).
ビット7:トレースビット(T)
トレースビットか否かを指定する。本ビットが”0”にクリアされているときは命令を順次実行する。”1”にセットされているときは1命令実行する毎にトレース例外処理を実行する。
Bit 7: trace bit (T)
Specify whether it is a trace bit or not. When this bit is cleared to "0", instructions are sequentially executed. When set to "1", trace exception processing is executed each time one instruction is executed.
ビット6〜4:リザーブビット
リザーブビットである。
Bits 6-4: Reserved bits These are reserved bits.
ビット2〜0:割込みマスクビット(I2〜I0)
割込み要求マスクレベル(0〜7)を指定する。
Specify the interrupt request mask level (0 to 7).
EXRは、LDC、STC、ANDC、ORC、XORC命令で実行することができる。このうち、STCを除く命令を実行した場合、実行終了後3ステートの間は、NMIを含めてすべての割込みは受け付けられない。 EXR can be executed with LDC, STC, ANDC, ORC, and XORC instructions. When instructions other than the STC are executed, all interrupts including the NMI are not accepted for three states after the execution is completed.
3.コンディションコードレジスタ(CCR)
8ビットのレジスタで、CPUの内部状態を示す。割込みマスクビット(I)とハーフキャリ(H)、ネガティブ(N)、ゼロ(Z)、オーバフロー(V)、キャリ(C)を含む8ビットで構成されている。
3. Condition code register (CCR)
An 8-bit register indicating the internal state of the CPU. It is composed of 8 bits including an interrupt mask bit (I), a half carry (H), a negative (N), a zero (Z), an overflow (V), and a carry (C).
ビット7:割込みマスクビット(I)
本ビットが”1”にセットされると、割込みがマスクされる。ただし、NMIはIビットに関係なく受け付けられる。例外処理の実行が開始されたときに”1”にセットされる。
Bit 7: interrupt mask bit (I)
When this bit is set to "1", the interrupt is masked. However, NMI is accepted regardless of the I bit. It is set to "1" when the execution of the exception processing is started.
ビット6:ユーザビット/割込みマスクビット(UI)
ソフトウェア(LDC、STC、ANDC、ORC、ZORC命令)でリード/ライトできる。割込みマスクビットとしても使用可能である。
Bit 6: user bit / interrupt mask bit (UI)
It can be read / written by software (LDC, STC, ANDC, ORC, ZORC instructions). It can also be used as an interrupt mask bit.
ビット5:ハーフキャリフラグ(H)
ADD.B、ADDX.B、SUB.B、SUBX.B、CMP.B、NEG.B命令の実行により、ビット3にキャリまたはボローが生じたとき”1”にセットされ、生じなかったとき”0”にクリアされる。また、ADD.W、SUB.W、CMP.W、NEG.W命令の実行により、ビット11にキャリまたはボローが生じたとき、ADD.L、SUB.L、CMP.L、NEG.L命令の実行により、ビット27にキャリまたはボローが生じたとき、”1”にセットされ、生じなかったとき”0”にクリアされる。
Bit 5: Half carry flag (H)
ADD. B, ADDX. B, SUB. B, SUBX. B, CMP. B, NEG. The
ビット4:ユーザビット(U)
ソフトウェア(LDC、STC、ANDC、ORC、XORC命令)でリート/ライトできる。
Bit 4: User bit (U)
REIT / WRITE can be performed by software (LDC, STC, ANDC, ORC, XORC instructions).
ビット3:ネガティブフラグ(N)
データの最上位ビットを符号ビットとみなし、最上位ビットの値を格納する。
Bit 3: Negative flag (N)
The most significant bit of the data is regarded as a sign bit, and the value of the most significant bit is stored.
ビット2:ゼロフラグ(Z)
データがゼロのとき”1”にセットされ、ゼロ以外のとき”0”にクリアされる。
Bit 2: Zero flag (Z)
It is set to "1" when the data is zero, and cleared to "0" when it is not zero.
ビット1:オーバフローフラグ(V)
算術演算命令により、オーバフローが生じたとき”1”にセットされる。それ以外のとき”0”にクリアされる。
Bit 1: Overflow flag (V)
Set to "1" when an overflow occurs due to an arithmetic operation instruction. Otherwise, it is cleared to "0".
ビット0:キャリフラグ(C)
演算の実行により、キャリが生じたとき”1”にセットされ、生じなかったとき”0”にクリアされる。キャリには次の種類がある。
Bit 0: carry flag (C)
It is set to "1" when a carry is generated by execution of an operation, and is cleared to "0" when no carry is generated. There are the following types of carry.
(a)加算結果のキャリ
(b)減算結果のボロー
(c)シフト/ローテートのキャリ
また、キャリフラグには、ビットアキュムレータの機能があり、ビット操作命令で使用される。なお、命令によってはフラグが変化しない場合がある。CCRは、LDC、STC、ANDC、ORC、XORC命令で操作することができる。また、N、Z、V、Cの各フラグは、条件分岐命令(Bcc)で使用される。
(A) Carry of addition result (b) Borrow of subtraction result (c) Carry of shift / rotate The carry flag has a bit accumulator function and is used in a bit manipulation instruction. Note that the flag may not change depending on the instruction. The CCR can be operated with LDC, STC, ANDC, ORC, and XORC instructions. The flags N, Z, V, and C are used in a conditional branch instruction (Bcc).
4.積和レジスタ(MAC)
64ビットのレジスタであり、積和演算結果を格納する。32ビットのMACH、MACLから構成される。MACHは下位10ビットが有効であり、上位は符号拡張されている。
4. Multiply-accumulate register (MAC)
This is a 64-bit register that stores the product-sum operation result. It is composed of 32-bit MACH and MACL. The lower 10 bits of the MACH are valid, and the upper bits are sign-extended.
図12に、CPUの基本動作タイミングを示す。 FIG. 12 shows the basic operation timing of the CPU.
ADD.W R0、R1のようなレジスタ間演算のタイミングである。特に制限はされないものの、内部データバスは16ビットであって、内蔵ROM、RAMのリード/ライトを1ステートでリード/ライト可能とする。 ADD. This is the timing of the operation between registers such as W R0 and R1. Although there is no particular limitation, the internal data bus is 16 bits, and the internal ROM and RAM can be read / written in one state.
T0のC2(φ#同期。#は反転論理を示す)で、CPU1のアドレスバッファ(MAB)33からアドレスがIABに出力される。
The address is output to the IAB from the address buffer (MAB) 33 of the
T1のC1(φ同期)で、IABの内容がPABに出力され、リードサイクルが開始される。C2でリードデータが内部データバスに得られ、これをIR21にラッチする。以上の動作は以前の命令の実行の制御によって行われる。 At C1 (φ synchronization) of T1, the contents of IAB are output to PAB, and a read cycle is started. In C2, read data is obtained on the internal data bus, and this is latched in IR21. The above operation is performed by controlling the execution of the previous instruction.
直前の命令の実行が終了すると、最も早く命令の実行が開始される場合には、T2のC1で命令コードがCONT22に入力されて、命令の内容が解読される。解読結果に従って、制御信号を出力して、各部の制御を行なう。命令の一部(レジスタ指定フィールド:RSEL入力信号1)がレジスタセレクタ23に与えられる。
When the execution of the immediately preceding instruction is completed and the execution of the instruction is started earliest, the instruction code is input to the
レジスタ間演算命令では、T2のC2で、PCの内容を内部バスGBに読み出して、MAB33とINC27に入力する。MAB33からアドレスIABが出力される。レジスタセレクタ23に制御信号を与える。RSEL入力信号1と制御信号A(Rs−DB出力、Rd−GB出力)とに基づいて、レジスタ選択信号Bが生成される。RSEL入力信号2がレジスタセレクタ23に与えられる。
In the inter-register operation instruction, the contents of the PC are read out to the internal bus GB at C2 of T2 and input to the
T3から、次の次の命令がリードされる。T3のC1で、INC27でインクリメント(+2)された結果が、内部バスWBを経由して、PC30にライトされる。RSEL入力信号2と制御信号B(WB−Rd入力)とに基づいて、レジスタ選択信号Cが生成される。レジスタ選択信号Bがレジスタを選択して、ソース側、デスティネーション側のレジスタ(S、D)のデータをALU26に入力する。ALU26の演算内容はCONT22が制御信号Cによって指示する。加減算・論理演算・シフトなどは1クロックで演算を行なうことができる。例えば、上記命令では16ビットの加算を行なう。次の命令のCONT22へのロードを指示する。RSEL入力信号2と制御信号B(WB−Rd入力)とに基づいて、レジスタ選択信号Cが生成される。
From T3, the next next instruction is read. At C1 of T3, the result incremented (+2) by INC27 is written to PC 30 via internal bus WB. A register selection signal C is generated based on the
T3のC2で、ALU26の演算結果(R)が、内部バスWBを経由して、レジスタ選択信号Cが選択したデスティネーション側のレジスタにライトされる。制御信号Cによって、CCR31の更新を行なう。更に次の次の命令をIR21に取り込む。同時に、次の命令の実行が開始され、例えば、PC30の内容を読み出して、MAB33とINC27に入力される。レジスタ間演算を実質的に1ステートで実行できる。2つの演算器26、27の入出力バスの数に対応した数の内部バスとして(演算器に対応して、内部バスを増加させることなく)、バス即ち配線の増加による物理的規模の増加を抑止している。
At C2 in T3, the operation result (R) of the
図13に、CPUの基本動作タイミングを示す。 FIG. 13 shows the basic operation timing of the CPU.
MOV.W R0、@R1のような、レジスタ間接によるデータライトのタイミングである。 MOV. This is the timing of data write by register indirect, such as WR0 and @ R1.
T0のC2で、CPU1のMAB33からアドレスがIABに出力される。
At C2 of T0, the address is output from the
T1のC1で、アドレスがPABに出力され、リードサイクルが開始される。C2でリードデータが内部データバスに得られ、これをIR21にラッチする。 At C1 of T1, the address is output to PAB, and a read cycle is started. In C2, read data is obtained on the internal data bus, and this is latched in IR21.
直前の命令の実行が終了すると、T2のC1で命令コードがCONT22に入力されて、命令の内容が解読され、各部の制御を行なう。命令の一部のレジスタ指定フィールド(RSEL入力信号1)がレジスタセレクタ23に与えられる。レジスタ間接によるデータライトでは、制御信号AとRSEL入力信号1とに基づいて、レジスタ選択信号Aが与えられ、アドレスとして指定されたレジスタが選択される。
When the execution of the immediately preceding instruction is completed, the instruction code is input to the
T2のC2で、選択されたレジスタの内容(A)を内部バスGBに読み出して、MAB33を経由してアドレスIABに出力される。RSEL入力信号2がレジスタセレクタ23に与えられる。RSEL入力信号2と制御信号B(Rd−DB出力)とに基づいて、レジスタ選択信号Bが生成される。
At C2 of T2, the content (A) of the selected register is read out to the internal bus GB and output to the address IAB via the
T3のC1で、制御信号Cの一部がCONT22に入力され、状態遷移が行われる(ステートマシンが構成される)。IABの内容に基づいて、ライトサイクルが開始される。選択されたレジスタの内容(D)を内部バスDBに読み出して、データバッファ(DBW)を経由して内部データバスに出力される。
At C1 of T3, a part of the control signal C is input to the
T3のC2で、PC30の内容を内部バスGBに読み出して、MAB33とINC27に入力する。MAB33からアドレスIABが出力される。RSEL入力信号1と制御信号A(Rd−GB出力)とに基づいて、レジスタ選択信号Bが生成される。
At C2 of T3, the contents of the PC 30 are read out to the internal bus GB and input to the
T4から、次の次の命令がリードされる。 From T4, the next next instruction is read.
T4のC1で、INC27でインクリメント(+2)された結果が、内部バスWBを経由して、PC30にライトされる。レジスタ選択信号Bがレジスタを選択して、データレジスタ(D)のデータをALU26に入力する。ALU26の演算内容はCONT22が制御信号Cによって指示する。転送の場合はデータのチェックのみを行なう。次の命令のCONT22へのロードを指示する。
At C1 of T4, the result incremented (+2) by INC27 is written to PC 30 via internal bus WB. The register selection signal B selects the register, and inputs the data of the data register (D) to the
T4のC2で、制御信号Cによって、チェックした結果によって、CCR31の更新を行なう。更に次の次の命令をIR21に取り込む。同時に、次の命令の実行が開始され、例えば、PC30の内容を読み出して、MAB33とINC27に入力される。
At C2 of T4, the
RSELに入力するタイミングを、RSEL入力1(アドレスレジスタ、ソースレジスタ)とRSEL入力2(データレジスタ、ディスティネーションレジスタ)のように、レジスタ指定フィールド毎にことなったタイミング(φ同期とφ#同期)とすることにより、命令実行の高速化を実現することができる。 The timing of input to the RSEL is different from the timing of each register specification field (φ synchronization and φ # synchronization), such as RSEL input 1 (address register, source register) and RSEL input 2 (data register, destination register). By doing so, high-speed instruction execution can be realized.
表16乃至表19に、本発明に関係のある命令の説明を示す。 Tables 16 to 19 show descriptions of instructions related to the present invention.
表16は命令コードを示し、表18は命令の実行状態を示し、表19はコンディションコードの変化を示している。表17はレジスタフィールドと汎用レジスタの対応を示している。 Table 16 shows the instruction code, Table 18 shows the execution state of the instruction, and Table 19 shows the change of the condition code. Table 17 shows the correspondence between register fields and general-purpose registers.
[表16]
[Table 16]
[表17]
[Table 17]
[表18]
[Table 18]
[表19]
[Table 19]
積和演算を行なうMAC命令、MACレジスタをクリアするCLRMAC命令、汎用レジスタの内容をMACレジスタに転送するLDMAC命令、MACレジスタの内容を汎用レジスタに転送するSTMAC命令がある。 There are a MAC instruction for performing a sum-of-products operation, a CLRMAC instruction for clearing a MAC register, an LDMAC instruction for transferring the contents of a general-purpose register to a MAC register, and an STMAC instruction for transferring the contents of a MAC register to a general-purpose register.
また、汎用レジスタの待避/復帰命令には、1本のレジスタの待避/復帰命令に、PUSH、POP命令が、複数レジスタの待避/復帰命令にSTM/LDM命令がある。STM/LDM命令には、指定するレジスタ本数に対応して3種類がある。 The save / restore instructions for general-purpose registers include PUSH and POP instructions for save / restore instructions for one register, and the STM / LDM instructions for save / restore instructions for multiple registers. There are three types of STM / LDM instructions corresponding to the number of designated registers.
図14に、乗算器2の概略ブロック図を示す。
FIG. 14 is a schematic block diagram of the
乗算器2は、入力ラッチ(X)61、入力ラッチ(Y)62、部分積生成回路63、マツチプレクサ64、デコーダ65A、65B、65C、選択回路66A、66B、66C、加算器67、フィードバック回路68、乗算結果レジスタ69などによって構成されている。
The
乗算器2は16×16ビットの乗算を行なうことを基本動作とし、さらに、これを利用して、16×16ビット+42ビットの積和演算を可能としている。
The basic operation of the
乗算器は乗算動作は、2次のブースのデコードを用いて、16ビット×6ビットを3回行なうようにされる。 The multiplier performs a 16-bit × 6-bit multiplication operation three times using a second-order Booth decoding.
16ビットの乗数Yは、Y=−y[16]・2^15+Σ(y[i]・2^(i−1))=Σ(y[2j]+y[2j+1]−2・y[2j+2])・2^2jと表現される。i=1〜15、j=0〜7、y[0]=0である。 The 16-bit multiplier Y is Y = −y [16] · 2] 15 + Σ (y [i] · 2 ^ (i−1)) = Σ (y [2j] + y [2j + 1] −2 · y [2j + 2] ) · 2 ^ 2j. i = 1 to 15, j = 0 to 7, and y [0] = 0.
被乗数Xとの乗算は、X・Y=Σ(y[2j]+y[2j+1]−2・y[2j+2])・X・2^2jとなる。y[2j]+y[2j+1]−2・y[2j+2]は、y[2j]、y[2j+1]、y[2j+2]の値の組み合わせにより、0、±1、±2の5種類があるから、部分積(y[2j]+y[2j+1]−2・y[2j+2])・Xは、0、±X、±2Xの5種類である。この内、0、Xは直ちに得られる。2Xは、1ビットの左シフト(最下位ビットは0)、−Xは2の補数であり、論理反転+1で得られる。−2Xは、論理反転+1の1ビットの左シフト(最下位ビットは0)で得る。
The multiplication with the multiplicand X is XY = Σ (y [2j] + y [2j + 1] −2 · y [2j + 2]) · X · 2 ^ 2j. There are five types of y [2j] + y [2j + 1] −2 · y [2j + 2] depending on the combination of the values of y [2j], y [2j + 1], and y [2j + 2]. , Partial products (y [2j] + y [2j + 1] −2 · y [2j + 2]) · X are of five types: 0, ± X, ± 2X. Of these, 0 and X are obtained immediately. 2X is one bit left shift (the least significant bit is 0), -X is a two's complement, and is obtained by
X側は、採りうる0、±X、±2Xの5種類の部分積(17ビット)を生成しておく。この5種類を部分積選択回路66A〜66Cに与える。
The X side generates five types of partial products (17 bits) of 0, ± X, and ± 2X that can be taken. These five types are given to partial
一方、Y入力のy[2j]、y[2j+1]、y[2j+2]をデコードして、0、±1、±2を判定して、この結果によって、部分積選択回路66A〜66Cを制御して、前記5種類の部分積を選択する。1回に2ビット単位3種類の選択を行なう。これを加算器67で加算する。加算は、2ビットずつシフトしたそれぞれ17ビットの部分積を加算して、22ビット分の結果を得る。不足する上位ビットは符号拡張したデータとする。
On the other hand, y [2j], y [2j + 1], y [2j + 2] of the Y input are decoded to determine 0, ± 1, ± 2, and the partial
この内、下位6ビットは、乗算結果レジスタ69のビット0〜5に格納される。上位16ビットはフィードバック回路68を介して、2回めの加算に含められる。2回目の処理では、前記同様に得られた部分積選択回路66A〜66Cの出力である、2ビットずつシフトしたそれぞれ17ビットの部分積と、1回めの処理の上位16ビットを加算する。22ビット分の結果を得る。不足する上位ビットは符号拡張したデータとする。この内、下位6ビットは、乗算結果レジスタ69のビット11〜6に格納される。上位16ビットはフィードバック回路68を介して、2回めの加算に含められる。
Of these, the lower 6 bits are stored in
同様に3回めの処理が行われる。加算結果下位20ビットが乗算結果レジスタ69のビット31〜12に格納される。加算結果の最上位2ビットは無視する。
Similarly, a third process is performed. The lower 20 bits of the addition result are stored in
積和演算の場合は、前回の結果が同時に加算されるようにする。 In the case of a product-sum operation, the previous results are added simultaneously.
更に、前回の結果の上位ビットとの4回目の加算を行って、42ビットの結果を得る。16ビット×16ビットの積和の結果を42ビットで得ることにより、約1000回の積和演算を繰り返してもオーバフローしないことになる。 Furthermore, a fourth addition with the upper bit of the previous result is performed to obtain a 42-bit result. By obtaining the result of a 16-bit × 16-bit product-sum operation in 42 bits, no overflow occurs even if the product-sum operation is repeated about 1000 times.
内部論理の構成上は、40ビットの結果とすれば、加算器が22ビット長でよく、論理的規模を最適化できる。 In terms of the structure of the internal logic, if the result is 40 bits, the adder may be 22 bits long, and the logical scale can be optimized.
図15に、上記のワードサイズ乗算(16ビット×16ビット)の演算方法を示す。 FIG. 15 shows an operation method of the word size multiplication (16 bits × 16 bits).
8ビット×8ビットのバイトサイズ乗算は、上位を拡張する。符号無しの場合0拡張、符号付きの場合符号拡張を行なう。いずれの場合も、上位は全ビット”0”か全ビット”1”かのいずれかであって、ブースのデコードは0になる。このため、3回目の処理は行なわずに、2回の処理で済む。 The byte size multiplication of 8 bits × 8 bits extends the high order. If there is no sign, 0 extension is performed, and if signed, sign extension is performed. In either case, the upper bit is either all bits “0” or all bits “1”, and the Booth decoding becomes “0”. Therefore, the second process is sufficient without performing the third process.
図4において、CPU1から乗算器2に、乗算を示す信号として、MUL信号(制御信号B)、符号付き/無しを示す信号としてUNSINP信号(制御信号B)、バイト/ワードサイズを示す信号として、BYTE信号(制御信号B)、積和演算の起動信号として、MAC信号(制御信号B)、MACHからCPUへのデータ転送要求信号として、STMACH信号(制御信号C)、MACLからCPUへのデータ転送要求信号として、STMACL信号(制御信号C)、CPUからMACHへのデータ転送要求信号として、LDMACH信号(制御信号B)、CPUからMACLへのデータ転送要求信号として、LDMACL信号(制御信号B)、MACレジスタのクリア信号として、CLRMAC信号(制御信号B)、乗数の転送信号として、STX信号(制御信号B)、被乗数の転送信号として、STY信号(制御信号B)、乗算結果の転送信号として、MULRD信号(制御信号C)を与える。
In FIG. 4, the MUL signal (control signal B) as a signal indicating multiplication, the UNSINP signal (control signal B) as a signal indicating signed / non-signed, and a signal indicating byte / word size from the
また、乗算器2からCPU1へ、演算実行中を示す信号として、BUSY信号、フラグに反映すべきデータとして、VFLAG、ZFLAG、NFLAG信号が与えられる。
Further, the
CPU−乗算器の相互のデータ転送にXバス、Yバスを使用する。 An X bus and a Y bus are used for mutual data transfer between the CPU and the multiplier.
また、SYSCR13から飽和演算の選択を示す信号として、FIXED信号が与えられる。また、テストモード信号として、TESTMODE信号が与えられる。TESTMODE信号が活性状態になって、テストモードが指示されると、乗算器は1回の処理のみで動作を終了するようにする。
Further, a FIXED signal is given from the
処理を短縮することによって、CPUの命令実行ステートも短縮できる。入力データの組み合わせを種々変更してテストする場合に、テスト時間を短縮できる。加算を1回しか行なわないので、テスト設計を容易にすることができる。3回の処理を行って、加算結果が蓄積されて、所望の動作のテストの結果を演算結果として得にくくなることがない。 By shortening the processing, the instruction execution state of the CPU can also be shortened. When a test is performed with various combinations of input data, the test time can be reduced. Since the addition is performed only once, test design can be facilitated. By performing the processing three times, the addition result is accumulated, and the result of the test of the desired operation is not difficult to obtain as the operation result.
TESTMODE信号が非活性状態であっても、CPU乃至乗算器のテストを行なうことができることは言うまでもない。TESTMODE信号は、前記のCPUSのようにレジスタの出力として供給することができる。 It goes without saying that the CPU or the multiplier can be tested even when the TESTMODE signal is inactive. The TESTMODE signal can be supplied as an output of a register, as in the CPUS described above.
表20に乗算器2の内部のフラグの検出方式およびCPU1への転送方式を示す。
Table 20 shows a method of detecting a flag inside the
[表20]
[Table 20]
乗算器2のフラグ仕様は次のように、1.Vフラグおよび2.Nフラグ、Zフラグから構成されている。
The flag specifications of the
1.Vフラグ
セット条件はMAC命令実行中にオーバフローまたはアンダフローが発生したときである。
1. The V flag is set when an overflow or underflow occurs during the execution of the MAC instruction.
クリア条件はLDMACまたはCLRMAC命令を実行したときである。 The clear condition is when the LDMAC or CLRMAC instruction is executed.
乗算器からCCRへの転送は、STMAC実行時に行われる。 The transfer from the multiplier to the CCR is performed when STMAC is executed.
従って、一連の連続した積和演算中に1回でもオーバフローまたはアンダフローが発生すると、乗算器のVフラグはセットされた状態を保持する。LDMACまたはCLRMAC命令を実行して、新しい一連の積和演算の開始が判断されると、乗算器のVフラグはクリアされる。 Therefore, if an overflow or underflow occurs at least once during a series of successive product-sum operations, the V flag of the multiplier remains set. When the LDMAC or CLRMAC instruction is executed to determine the start of a new series of multiply-accumulate operations, the multiplier V flag is cleared.
2.Nフラグ、Zフラグ
MUL命令用N、ZフラグとMAC命令用N、Zフラグを別々に設けて出力する。
2. N flag and Z flag The N and Z flags for the MUL instruction and the N and Z flags for the MAC instruction are separately provided and output.
乗算器からCCRへの転送は、乗算(MUL)命令の場合、乗算結果の転送時、MAC命令の場合STMAC実行時に行われる。 The transfer from the multiplier to the CCR is performed at the time of transfer of the multiplication result in the case of a multiplication (MUL) instruction, and at the time of execution of STMAC in the case of a MAC instruction.
なお、NフラグとZフラグは、LDMAC/CLRMACによって変化しない。 Note that the N flag and the Z flag are not changed by LDMAC / CLRMAC.
図16にVフラグ仕様の実現の概念図を示し、図17にNフラグ、Zフラグ仕様の実現の概念図を示す。 FIG. 16 shows a conceptual diagram of realizing the V flag specification, and FIG. 17 shows a conceptual diagram of realizing the N flag and Z flag specifications.
Vフラグはセットリセット型のフリップフロップ(RS−F/F)で構成され、一旦、オーバフローまたはアンダフローが発生すると、STMACにより読み出すまで状態を保持する。 The V flag is constituted by a set-reset type flip-flop (RS-F / F), and once an overflow or underflow occurs, keeps its state until it is read out by STMAC.
N、Vフラグはラッチ回路(D−F/F)とマルチプレクサ(MPX)で構成される。MAC命令実行時の演算結果はラッチ回路に保持され、マルチプレクサに与えられる。また、乗算命令実行時の演算結果は、直接マルチプレクサに与えられる。マルチプレクサはSTMAC命令のときラッチ回路の出力を出力し、それ以外のとき演算結果を直接出力する。 The N and V flags are composed of a latch circuit (DF / F) and a multiplexer (MPX). The operation result at the time of executing the MAC instruction is held in the latch circuit and supplied to the multiplexer. The operation result at the time of executing the multiplication instruction is directly supplied to the multiplexer. The multiplexer outputs the output of the latch circuit in the case of the STMAC instruction, and directly outputs the operation result otherwise.
MAC命令とその他の命令は並列して動作する。MAC命令のフラグを随時CCRに反映しては、並列実行中の命令のフラグ動作と矛盾してしまう。MAC命令のフラグを乗算器内部で保持して、STMAC命令実行時にCCRに転送するようにして、上記矛盾を回避することができる。 The MAC instruction and other instructions operate in parallel. If the flag of the MAC instruction is reflected in the CCR as needed, it contradicts the flag operation of the instruction being executed in parallel. The contradiction can be avoided by holding the flag of the MAC instruction inside the multiplier and transferring it to the CCR when the STMAC instruction is executed.
図18に、バススイッチ34のブロック図を示す。
FIG. 18 shows a block diagram of the
バススイッチ34は、選択回路71A、71B、拡張回路72A、72B、72C、出力バッファ73A、73B、73C、73Dから構成される。バススイッチは、CPU内部バスのGB、DB、WBと、乗算器のXバス、Yバスと、マイクロコンピュータの内部バスであるIDBのインタフェースを行なう。
The
乗算の開始時、及びLDMAC命令の場合は、GB、DBからXバス、Yバスに入力される。GB、DBの入力は、選択回路71A、71Bで選択される。これは汎用レジスタ及び内部バスが32ビット構成であるために、乗数、被乗数が8ビットまたは16ビットであるために、CONT22の制御信号A及びレジスタ制御信号Aに基づいて、所定の部分が選択される。
At the start of multiplication and in the case of an LDMAC instruction, data is input from GB and DB to the X bus and Y bus. The inputs of GB and DB are selected by the
選択回路71A、71Bの出力は、拡張回路72A、72Bに入力される。CONT22の制御信号Aに基づいて、符号無しバイトサイズ乗算(MULXU.B)の場合、上位8ビットを0拡張する。また、符号付きバイトサイズ乗算(MULXS.B)の場合、上位8ビットを符号拡張する。ワードサイズの場合は、選択回路71A、71Bの出力をそのまま出力する。
Outputs of the
選択回路71A、71Bの出力は出力バッファ73B、73Cに入力される。CONT22の制御信号Aに基づいて、所定のタイミングで、拡張回路72A、72Bの出力をXバスまたはYバスに出力する。
Outputs of the
乗算の終了時、及びSTMAC命令の場合は、Xバス、YバスからWBへの出力が行われる。Xバス、Yバスの入力は拡張回路72Cに入力される。これは、MACHの上位22ビットを符号拡張する。拡張回路72Cの出力は出力バッファに入力される。CONT22の制御信号Cに基づいて、所定のタイミングで、拡張回路72Cの出力をWBに出力する。
At the end of the multiplication and in the case of the STMAC instruction, the output is performed from the X bus and the Y bus to the WB. Inputs of the X bus and the Y bus are input to the
MAC命令のデータリード時、IDBからXバス、Yバスへの入力が、それぞれ1回ずつ行われる。CONT22の制御信号Aに基づいて、所定のタイミングで、IDBの内容をXバスまたはYバスに出力する。また、IDBは、DBWからの出力を入力可能とされ、DBR及びIRへデータを入力可能とされる。
At the time of data reading of the MAC instruction, input from the IDB to the X bus and the Y bus is performed once each. The contents of the IDB are output to the X bus or the Y bus at a predetermined timing based on the control signal A of the
図19、20に、MAC命令の動作タイミングを示す。 19 and 20 show the operation timing of the MAC instruction.
例えば、MAC @ER1+,@ER2+命令などの例である。この場合のER1を第1のアドレスレジスタ、ER2を第2のアドレスレジスタとする。前記同様に、T2からMAC命令の実行が開始される。 For example, it is an example of a MAC $ ER1 +, $ ER2 + instruction. In this case, ER1 is a first address register, and ER2 is a second address register. As described above, the execution of the MAC instruction is started from T2.
まず、プリフィックスコードの実行を行い、PC30の内容をアドレスとした命令のリードを行い、また、PC30の内容のインクリメントを行なう。 First, a prefix code is executed, an instruction using the contents of the PC 30 as an address is read, and the contents of the PC 30 are incremented.
T3のφ#で、レジスタ制御信号Aに基づいて、第1のアドレスの内容をGBに読み出して、MAB33に転送し、IABに出力する。
At φ # of T3, the contents of the first address are read to GB based on the register control signal A, transferred to the
T4のφで、第1のアドレスの内容をGBに読み出して、ALU26に入力し、インクリメントを行なう。
At φ of T4, the contents of the first address are read out to GB and input to the
T4のφ#で、インクリメント結果を、WB経由で、第1のアドレスレジスタに格納する。バススイッチ34に入力した、第1のリードデータをXバスに出力すると共に、制御信号Bに含まれるSTX信号を活性状態にし、乗算器2にこの内容を入力ラッチXにラッチさせる。同時に、第2のアドレスの内容をGBに読み出して、MABに転送し、IABに出力する。
At φ # of T4, the increment result is stored in the first address register via WB. The first read data input to the
T5のφで、第2のアドレスの内容をGBに読み出して、ALU26に入力し、インクリメントを行なう。T5のφ#で、インクリメント結果を、WB経由で、第2のアドレスレジスタに格納する。バススイッチ34に入力した、第2のリードデータをYバスに出力すると共に、制御信号Bに含まれるSTY信号を活性状態にし、乗算器2にこの内容を入力ラッチYにラッチさせる。MAC信号を活性状態にして、積和演算動作の開始を指示する。同時に、PC30の内容をアドレスとした命令のリードを行い、また、PC30の内容のインクリメントを行なう。
At φ of T5, the content of the second address is read out to GB and input to the
T6のφで、インクリメント結果をPC30に格納する。一方、BUSY信号が活性状態になる。MAC命令では、CPU1は乗算器2とは並列に動作し、BUSY信号を無視して、次の命令の実行を開始する。
At φ of T6, the increment result is stored in the PC 30. On the other hand, the BUSY signal is activated. With the MAC instruction, the
MAC命令を連続して実行した場合も、次のMAC命令がアドレス計算を行っている間に、乗算器の動作が終了するために、MAC命令実行にウェイトを挿入することはない。 Even when the MAC instruction is continuously executed, the operation of the multiplier is completed while the next MAC instruction is performing the address calculation, so that no wait is inserted into the execution of the MAC instruction.
プリフィックスコードを付した命令コードとすることにより、特開平−51981号公報に記載されているように、互換性を保持しつつ命令セットを拡張することができる。また、乗算器動作中に、次の積和演算を行った場合、命令フェッチとデータのアクセスを行なうことができるから、命令長が長くなっても実行時間を低下させることがない。積和演算を連続的に高速に実行することができる。 By using an instruction code with a prefix code, an instruction set can be extended while maintaining compatibility, as described in Japanese Patent Application Laid-Open No. Hei 5-11981. In addition, when the next product-sum operation is performed during the operation of the multiplier, the instruction fetch and the data access can be performed, so that the execution time does not decrease even if the instruction length becomes long. The product-sum operation can be continuously executed at high speed.
乗算器2は、演算終了時点で、SYSCR13のMACSビットを参照して、オーバフローが発生していれば、MACレジスタの内容を、上限(H’7FFFFFFF)または下限(H’80000000)に固定する。
At the end of the operation, the
図21、22に、STMAC、LDMAC命令の動作タイミングを示す。 21 and 22 show the operation timing of the STMAC and LDMAC instructions.
例えば、STMAC MACH,ER2命令などの例である。前記同様に、T2からSTMAC命令の実行が開始される。 For example, it is an example of an STMAC MACH, ER2 instruction. As described above, the execution of the STMAC instruction is started from T2.
まず、BUSY信号の状態をサンプリングする。BUSY信号が活性状態であれば、ウェイト状態になる。 First, the state of the BUSY signal is sampled. When the BUSY signal is in the active state, the state changes to the wait state.
T2のφ#でPCの内容がGBに読み出され、MAB33に入力されて、IABに出力される。また、INC27に入力されて、インクリメント動作が開始される。
At φ # of T2, the contents of the PC are read to GB, input to
CPU内部のクロックがロウレベルで固定され、CPUの動作を停止する。直前にMAC命令を実行した場合、BUSY信号は3ステートの期間活性状態であり、STMAC命令も3ステートウェイト状態になる。 The clock inside the CPU is fixed at the low level, and the operation of the CPU is stopped. When the MAC instruction is executed immediately before, the BUSY signal is active for three states, and the STMAC instruction is also in a three-state wait state.
T5でBUSY信号が非活性状態になると、T6からクロックの動作が開始される。 When the BUSY signal becomes inactive at T5, the clock operation starts at T6.
T6のφで、インクリメント結果がWBに出力され、PC30に格納される。STMACHまたはSTMACL信号が活性状態になって、MACレジスタの読み出しが指示される。MACレジスタの内容がXバス、Yバスに出力される。特に制限はされないものの、Xバスが上位、Yバスが下位の内容とされる。 At φ of T6, the increment result is output to WB and stored in the PC 30. The STMACH or STMACL signal becomes active, and an instruction to read the MAC register is issued. The contents of the MAC register are output to the X bus and the Y bus. Although there is no particular limitation, the X bus is the upper content and the Y bus is the lower content.
T6のφ#で、Xバス、Yバスの内容がWBに出力されて、指定されたレジスタ(STMAC MACH,ER2の場合は、ER2)に格納される。同時に、乗算器のフラグの内容がCCRのN、Z、Vフラグに格納される。 At φ # of T6, the contents of the X bus and the Y bus are output to the WB and stored in the designated register (ER2 in the case of STMAC MACH, ER2). At the same time, the contents of the flags of the multipliers are stored in the N, Z, and V flags of the CCR.
また、LDMAC ER1,MACL命令などの例である。 Also, examples are LDMAC ER1 and MACL instructions.
T8からLDMAC命令の実行が開始される。 The execution of the LDMAC instruction is started from T8.
T9のφで、指定されたレジスタ(LDMAC ER1,MACLの場合は、ER1)の内容が読み出される。この内容がXバス、Yバスに出力される。 At φ in T9, the contents of the specified register (ER1 in the case of LDMAC ER1, MACL) are read. This content is output to the X bus and the Y bus.
T9のφ#で、LDMACHまたはLDMACL信号が活性状態になる。PC30の内容がGB経由で、MAB33とINC27に入力される。
At φ # of T9, the LDMACH or LDMACL signal is activated. The contents of the PC 30 are input to the
T10のφで、インクリメントされた結果がWB経由で、PC30に格納される。また、Xバス、Yバスの内容がMACレジスタに格納される。 At φ of T10, the incremented result is stored in the PC 30 via WB. The contents of the X bus and the Y bus are stored in the MAC register.
前記同様に、BUSY信号が活性状態の場合は、LDMAC命令も活性状態になるようにしてもよい。 Similarly to the above, when the BUSY signal is active, the LDMAC instruction may be activated.
CLRMAC命令は、概略LDMAC命令と同様の動作で、LDMAC命令のLDMACH、L信号と同じタイミングで、CLRMAC信号を活性状態にするようにすればよい。 The CLRMAC command may be configured to activate the CLRMAC signal at the same timing as the LDMACH and L signals of the LDMAC command, in substantially the same operation as the LDMAC command.
図23、24に、乗算器を用いた乗算命令のタイミング図を示す。 23 and 24 show timing diagrams of a multiplication instruction using a multiplier.
なお、CONT22の部分に、内部のステートマシンのステップの番号を記載した。これは、基本的には、CONT22の出力のフィードバック信号で形成される。また、制御信号CPUSを用いて、乗算器を使用するか使用しないかを選択する。例えば、MULXU.W R1,ER0などのバイトサイズ・符号無し乗算の例である。前記同様に、T2から実行を開始する。
The number of the step of the internal state machine is described in the part of CONT22. This is basically formed by the feedback signal of the output of the
命令が解読されると、まず、T2のφ#で、レジスタ制御信号Aによって、汎用レジスタの読みだしを指示する。読出された結果は、GB、DBおよびバススイッチ34を介して、Xバス、Yバスに出力される。
When the instruction is decoded, first, the reading of the general-purpose register is instructed by the register control signal A at φ # of T2. The read result is output to the X bus and the Y bus via the GB, the DB, and the
制御信号Bに含まれるSTX、STY信号に基づいて、Xバス、Yバスの内容は、T3のφで乗算器の入力ラッチにラッチされる。また、同時に、制御信号Bに含まれるMUL信号によって、乗算器に乗算を指示する。CONT22から、バイト/ワードの選択、符号付/符号無の選択、乗算/積和の選択を上記制御信号によって指示する。
Based on the STX and STY signals included in the control signal B, the contents of the X bus and Y bus are latched by the input latch of the multiplier at φ of T3. At the same time, the MUL signal included in the control signal B instructs the multiplier to perform multiplication. The control signal indicates from the
乗算器は、T3のφ#で、BUSY信号を与える。また、マルチプレクサやデコーダを動作させる。T4のφで、1回目の加算を行なう。T4のφで部分積を乗算結果レジスタとフィードバックラッチに格納する。これを3回繰り返す。BUSY信号が活性状態になったことに呼応して、CPUはウェイト状態になる。 The multiplier provides a BUSY signal at φ # of T3. Also, a multiplexer and a decoder are operated. The first addition is performed at φ of T4. The partial product is stored in the multiplication result register and the feedback latch at φ of T4. This is repeated three times. The CPU enters the wait state in response to the BUSY signal being activated.
T5のφでBUSYが非活性状態になって、CPUは動作を再開し、T6のφで、制御信号Cに含まれる、MULRD信号を活性状態にして、乗算結果レジスタのリードを指示する。乗算結果レジスタの内容は、Xバス、Yバスおよびバススイッチ34を経由して、T6のφ#でWBを経由して、レジスタ制御信号Cによって指定されるレジスタに格納される。同時に、乗算の結果フラグがCCR31に格納される。
At φ in T5, BUSY becomes inactive, the CPU resumes operation, and at φ in T6, the MULRD signal included in the control signal C is activated to instruct reading of the multiplication result register. The contents of the multiplication result register are stored in the register specified by the register control signal C via the X bus, the Y bus, and the
前記の通り、乗算命令はBUSY信号によって、クロックが停止し、ウェイト状態となる。バイトサイズ符号無し乗算命令(MULXU.B R0L,R1など)は1ウェイトが挿入され、3ステートで実行される。ワードサイズ符号無し乗算命令(MULXU.W R0,ER1など)は2ウェイトが挿入され、4ステートで実行される。なお、符号付き乗算の場合は、それぞれ、プリフィックスコードの実行が付加される。 As described above, the clock of the multiplication instruction is stopped by the BUSY signal, and the multiplication instruction enters a wait state. A byte-size unsigned multiplication instruction (MULXU.B R0L, R1, etc.) is inserted in one wait and executed in three states. A word-size unsigned multiplication instruction (MULXU.WR0, ER1, etc.) is inserted in two wait states and executed in four states. In the case of signed multiplication, execution of a prefix code is added to each.
BUSY信号によって、演算実行の終了を判定することにより、制御回路(CONT22)の論理を縮小することができる。 The logic of the control circuit (CONT22) can be reduced by determining the end of the execution of the operation by the BUSY signal.
TESTMODE信号が活性状態になって、テストモードを指示された場合には、乗算器は1ステップの動作のみを行い、BUSY信号は非活性状態を保持する。CPUは1ステートで処理を終了する。 When the test mode is activated and the test mode is instructed, the multiplier performs only one-step operation, and the BUSY signal keeps the inactive state. The CPU ends the process in one state.
図25、26に、乗算器を用いない乗算命令のタイミング図を示す。乗算器を用いない乗算は、特に制限はされないものの、除算と類似のシーケンスで行なうようにする。 25 and 26 show timing diagrams of a multiplication instruction without using a multiplier. Multiplication without using a multiplier is performed in a sequence similar to division, although there is no particular limitation.
命令が解読されると、まず、汎用レジスタの読みだしを指示する。読出された結果は、符号判定を行なう。符号付/符号無の選択に対応して、符号判定を行い、除数は符号反転し、負数にする。そのほかは正数にする。 When the instruction is decoded, first, the instruction to read the general-purpose register is issued. A sign determination is performed on the read result. In accordance with the selection of signed / unsigned, sign judgment is performed, and the divisor is sign-inverted to a negative number. Others are positive numbers.
被乗数を上位、下位は0にして1ビットずつシフトし、シフトした結果によって、下位側に乗数を加算するかを決める。その結果に対して、さらにシフトを行い、シフトした結果によって、下位側に乗数を加算を行っていく。これを8または16回繰返して、乗算結果の絶対値を得る。例えば、MULXU.B R1L,R0などのバイトサイズ・符号無し乗算の例である。前記同様に、T2から除算命令の実行が開始される。前記のような、所定の処理を行った後、T5から部分乗算を行なう。 The multiplicand is shifted one bit at a time, with the upper and lower bits set to 0, and whether to add the multiplier to the lower bit is determined based on the shifted result. The result is further shifted, and a multiplier is added to the lower side according to the shifted result. This is repeated eight or sixteen times to obtain the absolute value of the multiplication result. For example, MULXU. B is an example of byte size / unsigned multiplication such as R1L, R0. As described above, the execution of the division instruction is started from T2. After performing the predetermined processing as described above, partial multiplication is performed from T5.
部分乗算は、左シフト処理と加算で構成される。前回の加算と次回のシフト処理を同一のALU処理で行なうようにする。 Partial multiplication includes left shift processing and addition. The previous addition and the next shift processing are performed by the same ALU processing.
T5のφ1に同期して、指定されたレジスタ(ディスティネーションレジスタRd)から被乗数を読み込み、シフト処理を行なう。シフト処理の結果(部分積)がφ#に同期してWBを経由して、Rdにライトされる。また、シフトアウトされたキャリが内部で保持される。 In synchronization with φ1 of T5, the multiplicand is read from the designated register (destination register Rd) and shift processing is performed. The result (partial product) of the shift processing is written to Rd via WB in synchronization with φ #. Also, the shifted out carry is held internally.
T6のφ1に同期して、Rdから部分積を読み込み、部分乗算処理を行なう。前回のキャリが”1”である場合、部分積の下位8ビットに乗数を加算し、16ビットでシフト処理を行い、最下位ビットは”0”とする。前記以外の場合、部分積に16ビットでシフト処理を行い、最下位ビットは”0”とする。かかる結果がφ#に同期してWBを経由して、Rdにライトされる。また、シフトアウトされたキャリが内部で保持される。この動作を7回繰り返す。 In synchronization with φ1 of T6, a partial product is read from Rd, and a partial multiplication process is performed. If the previous carry is "1", a multiplier is added to the lower 8 bits of the partial product, a shift process is performed with 16 bits, and the least significant bit is set to "0". In other cases, the partial product is shifted by 16 bits, and the least significant bit is set to “0”. The result is written to Rd via WB in synchronization with φ #. Also, the shifted out carry is held internally. This operation is repeated seven times.
T13では、上記同様の判定を行い、前回のキャリが”1”である場合、部分積の下位8ビットに乗数を加算する。前記以外の場合、部分積を保持する。16ビットの積が得られる。かかる結果がφ#に同期してWBを経由して、Rdにライトされる。符号付きの場合は、T14で符号処理を行なう。また、ワードサイズの場合は、部分乗算処理が8回追加される。 At T13, the same determination as above is performed. If the previous carry is “1”, a multiplier is added to the lower 8 bits of the partial product. Otherwise, the partial product is retained. A 16-bit product is obtained. The result is written to Rd via WB in synchronization with φ #. If signed, sign processing is performed at T14. In the case of a word size, a partial multiplication process is added eight times.
先に保持した符号判定結果に基づいて、積の符号処理を行なう。すなわち、乗数・被乗数の一方が正数、他方が負数のときは、積の符号を反転する(0から積を引く)。 The sign processing of the product is performed based on the sign judgment result held earlier. That is, when one of the multiplier and the multiplicand is a positive number and the other is a negative number, the sign of the product is inverted (the product is subtracted from 0).
図27に、乗算命令の状態遷移図を示す。例えば、MULXU.B R1L,R0などのバイトサイズ・符号無し乗算の例である。命令の実行が開始されると、CPUS信号の状態によって分岐する。 FIG. 27 shows a state transition diagram of the multiplication instruction. For example, MULXU. B is an example of byte size / unsigned multiplication such as R1L, R0. When the execution of the instruction is started, the operation branches depending on the state of the CPUS signal.
CPUS信号が活性状態であって、乗算器の使用が許可されると、図6の動作を行なう。即ち、ステップ1で、指定されたレジスタの内容を、GB、DBを経由して、X、Yバスに出力して、乗算器に供給する。BUSY信号の状態を判定する。テストモードであれば、BUSY信号は非活性状態であって、直ちにステップ2に遷移する。
When the CPUS signal is active and the use of the multiplier is permitted, the operation of FIG. 6 is performed. That is, in
BUSY信号が活性状態であると、WAIT状態に遷移する。BUSY信号は非活性状態になるとステップ2に遷移する。 When the BUSY signal is in the active state, the state transitions to the WAIT state. When the BUSY signal goes into the inactive state, the flow goes to step 2.
ステップ2では、X、Yバスの内容をWBを経由して、指定されたレジスタにライトする。例えば、乗算器のフラグの内容をCCR31に格納する。次の命令の実行を開始する。
In
CPUS信号が非活性状態であって、乗算器の使用が禁止されると、図25、26の動作を行なう。即ち、ステップ1、2でデータアライメントなどを行った後、ステップ3から、部分乗算処理を行なう。ステップ3では、GB上位に被乗数を出力し、これをシフトする。
When the CPUS signal is in the inactive state and the use of the multiplier is prohibited, the operations of FIGS. 25 and 26 are performed. That is, after performing data alignment and the like in
ステップ4では、GBに部分積を、DB下位に乗数を出力し、ALU26で加算を行なう。前のステップでシフトアウトしたビットが”1”であれば、加算した結果が選択され、シフトアウトしたビットが”0”であれば、GBの内容が選択され、シフトを行なう。これをステップ10まで繰り返す。
In
ステップ11では、GBに部分積を、DB下位に乗数を出力し、ALU26で加算を行なう。前のステップでシフトアウトしたビットが”1”であれば、加算した結果が選択され、シフトアウトしたビットが”0”であれば、GBの内容が選択される。シフトは行なわない。ステップ12で、命令のリードを行なう。例えば、積を検査して、CCRに反映する。次の命令の実行を開始する。
In
図25、26に、除算命令のタイミング図を示している。例えば、DIVXU.B R1L,R0などのバイトサイズ・符号無し除算の例である。前記同様に、T2から除算命令の実行が開始される。除数の符号反転などの、所定の処理を行った後、T5から部分除算を行なう。部分除算は、左シフト処理と減算で構成される。前回の減算と次回のシフト処理を同一のALU処理で行なうようにする。 25 and 26 show timing diagrams of the division instruction. For example, DIVXU. B is an example of byte size / unsigned division such as R1L, R0. As described above, the execution of the division instruction is started from T2. After performing predetermined processing such as sign inversion of the divisor, partial division is performed from T5. Partial division includes left shift processing and subtraction. The previous subtraction and the next shift processing are performed by the same ALU processing.
T5のφ1に同期して、指定されたレジスタ(ディスティネーションレジスタRd)から被除数を読み込み、シフト処理を行なう。シフト処理の結果(部分剰余)がφ#に同期してWBを経由して、Rdにライトされる。また、シフトアウトされたキャリが内部で保持される。 In synchronization with φ1 of T5, the dividend is read from the designated register (destination register Rd) and shift processing is performed. The result of the shift processing (partial remainder) is written to Rd via WB in synchronization with φ #. Also, the shifted out carry is held internally.
T6のφ1に同期して、Rdから部分剰余を読み込み、部分除算処理を行なう。前回のキャリが”1”である場合、または、部分剰余の上位8ビットが除数以上である場合、部分剰余の上位8ビットから除数を減算(除数の符号反転を行っている場合、除数の反転を加算)し、16ビットでシフト処理を行い、最下位ビットは”1”とする。前記以外の場合、部分剰余に16ビットでシフト処理を行い、最下位ビットは”0”とする。かかる結果がφ#に同期してWBを経由して、Rdにライトされる。また、シフトアウトされたキャリが内部で保持される。この動作を7回繰り返す。 In synchronization with φ1 of T6, a partial remainder is read from Rd, and a partial division process is performed. When the previous carry is “1”, or when the upper 8 bits of the partial remainder are greater than or equal to the divisor, the divisor is subtracted from the upper 8 bits of the partial remainder (if the sign of the divisor is inverted, the divisor is inverted). Are added), and a shift process is performed with 16 bits, and the least significant bit is set to “1”. In other cases, the partial remainder is shifted by 16 bits, and the least significant bit is set to “0”. The result is written to Rd via WB in synchronization with φ #. Also, the shifted out carry is held internally. This operation is repeated seven times.
T13では、上記同様の判定を行い、前回のキャリが”1”である場合、または、部分剰余の上位8ビットが除数以上である場合、部分剰余の上位8ビットから除数を減算し、下位8ビットでシフト処理を行い、最下位ビットは”1”とする。前記以外の場合、部分剰余に下位8ビットでシフト処理を行い、最下位ビットは”0”とする。いずれの場合も、ビット7の値は失われる。上位8ビットに剰余、下位8ビットに商が得られる。かかる結果がφ#に同期してWBを経由して、Rdにライトされる。
At T13, the same determination as above is performed, and if the previous carry is “1” or if the upper 8 bits of the partial remainder are greater than or equal to the divisor, the divisor is subtracted from the upper 8 bits of the partial remainder to obtain the lower 8 bits. Shift processing is performed on the bits, and the least significant bit is set to “1”. In other cases, the partial remainder is shifted by the lower 8 bits, and the least significant bit is set to “0”. In either case, the value of
符号付きの場合は、T14で符号処理を行なう。また、ワードサイズの場合は、部分除算処理が8回追加される。 If signed, sign processing is performed at T14. In the case of a word size, a partial division process is added eight times.
図28に、ALU26の概略ブロック図を示す。ALU26は、算術論理演算回路76と、選択回路77、シフト回路78、制御回路79から構成される。乗除算に直接関係のない部分は省略している。
FIG. 28 shows a schematic block diagram of the
算術論理演算回路76は、GBとDBの内容を入力して、加算、減算、論理積、論理和、排他的論理和などの演算を行い、結果を出力する。選択回路77は、算術論理演算回路の出力と、GBの内容を入力して、いずれかを選択して出力する。シフト回路78は、選択回路77の出力を入力して、シフト処理を行なう。
The arithmetic and
選択回路77、シフト回路78は制御回路79によって制御される。制御回路79は、CONT22の与える制御信号と算術論理演算回路76とシフト回路78の出力によって、選択回路77の選択とシフト回路78のシフト入力を制御する。制御回路79が、前記の部分乗算、部分除算の判定を行なう。条件が成立していれば、算術論理演算回路76の出力を選択し、除算の場合、1をシフト回路に入力する。条件が不成立であれば、GBの入力を選択し、除算の場合、0をシフト回路に入力する。乗算の場合のシフト回路の入力は、0とされる。
The
除算の部分除算と乗算の部分乗算の処理のシーケンス、及びALU26の回路構成を共通化する。除算と乗算を共通化して、CONT22の論理規模を縮小できる。
The processing sequence of partial division of division and partial multiplication of multiplication and the circuit configuration of the
これにより、乗算器を持たないCPUを容易に提供することができる。乗算器を持つCPUにおいて不必要な乗算器を用いない乗算の論理を除算と共通化して、論理規模の増加を最低限にすることができる。 This makes it possible to easily provide a CPU having no multiplier. In a CPU having a multiplier, the logic of multiplication that does not use an unnecessary multiplier is shared with division, thereby minimizing the increase in the logic scale.
また、CPUSによって、乗算器を用いない選択を可能にすることによって、テスト性を向上することができる。テスト時に、乗算器を用いるか用いないかを選択することに両方の論理をテストの対象にすることができる。 Further, the testability can be improved by enabling selection without using the multiplier by the CPUS. During testing, both logic can be tested by choosing to use or not use a multiplier.
複数命令の待避/復帰命令の命令コードは表16の通りである。 Table 16 shows the instruction codes of the save / restore instructions of a plurality of instructions.
最初に使用するレジスタ番号が、命令コード中に指定される。例えば、昭和5年3月(株)日立製作所発行『H8/500シリーズプログラミングマニュアル』に記載の複数命令の待避/復帰命令のように任意のレジスタの組み合わせを指定するのではなく、連続したレジスタ番号の固定の組み合わせとし、2、3、4本の固定の組み合わせとしている。命令コードも、レジスタ本数に応じて3種類を用意している。 The register number to be used first is specified in the instruction code. For example, instead of specifying an arbitrary combination of registers as in the save / restore instruction of multiple instructions described in the “H8 / 500 Series Programming Manual” issued by Hitachi, Ltd. , And two, three, and four fixed combinations. Three types of instruction codes are prepared according to the number of registers.
複数命令の待避命令は、待避するレジスタの本数に対応して、
STM(ERl−ERl+1),@−SP
STM(ERm−ERm+2),@−SP
STM(ERn−ERn+3),@−SP
の3種類を有する。l=0、2、4、6であり、m、n=0、4である。指定した汎用レジスタをスタックに待避する。例えば、ER0とER1をスタックに待避する場合は、
STM(ER0−ER1),@−SP
を用いる。ER0、ER1の順番でスタックにライトされ、スタックポインタ(ER7)は+8される。命令コード中のレジスタ指定部は、最初に待避されるレジスタ番号にしてある。
The save instruction of multiple instructions corresponds to the number of registers to be saved,
STM (ERl-ERl + 1), @ -SP
STM (ERm-ERm + 2), @ -SP
STM (ERn-ERn + 3), @ -SP
There are three types. l = 0, 2, 4, 6 and m, n = 0, 4. Save the specified general-purpose register to the stack. For example, when saving ER0 and ER1 to the stack,
STM (ER0-ER1), @ -SP
Is used. The data is written to the stack in the order of ER0 and ER1, and the stack pointer (ER7) is incremented by +8. The register designation part in the instruction code is the register number to be saved first.
図29、30に複数レジスタの待避命令の実行シーケンスを示す。例えば、STM.L ER0−ER1,@−SPなどの2本の汎用レジスタを待避する例である。レジスタ指定フィールドはB’000である(B’は2進数を示す)。 29 and 30 show an execution sequence of a save instruction of a plurality of registers. For example, in STM. This is an example in which two general-purpose registers such as LER0-ER1 and $ -SP are saved. The register designation field is B'000 (B 'indicates a binary number).
前記同様に、T2から除算命令の実行が開始される。特に制限はされないものの、命令コードの第1ワードはプリフィックスコードであり、次の命令コードの動作を指定し、PCをインクリメントするほかの動作は行なわない。 As described above, the execution of the division instruction is started from T2. Although not particularly limited, the first word of the instruction code is a prefix code, specifies the operation of the next instruction code, and does not perform any other operation for incrementing the PC.
第2ワードの命令コードは、PUSH命令と共通にされる。 The instruction code of the second word is made common to the PUSH instruction.
T4のφで、SPの内容をGBに読み出し、ALU26に入力する。ALU26では−4の演算を行なう。なお、前記の通り、実行前のSPはスタックの先頭アドレスを示しているとする。
At φ of T4, the contents of the SP are read out to GB and input to the
T4のφ#で演算結果がWBとGBに出力される。WBからSPに書き込まれ、GBからMAB33に格納される。MAB33の内容がIABに出力される。また、第1の制御信号BとRSEL2(=B’000)とによって、待避されるレジスタが選択され、レジスタ制御信号Bが生成される。
The calculation result is output to WB and GB at φ # of T4. The data is written from WB to SP, and stored from GB to
T5のφで、選択されたレジスタ(ER0)の内容がDB経由で、DBW24に転送される。
At φ of T5, the contents of the selected register (ER0) are transferred to the
T5のφ#で、転送されたデータ(ER0の内容)の上位16ビット(Eレジスタの内容)が内部データバスに出力される。また、MAB33のインクリメント機能によって、IABの出力値を+2とする。 At φ # of T5, the upper 16 bits (contents of the E register) of the transferred data (contents of ER0) are output to the internal data bus. Further, the output value of IAB is set to +2 by the increment function of MAB33.
T6のφで、更に、SPの内容をGBに読み出し、ALU26に入力する。ALU26では−4の演算を行なう。
At φ of T6, the contents of the SP are further read to GB and input to the
T6のφ#で、DBW24に転送されたデータの下位16ビット(Rレジスタの内容)が内部データバスに出力される。ALU26の演算結果がWBとGBに出力される。WBからSPに書き込まれ、GBからMABに格納される。MAB33の内容がIABに出力される。また、第2の制御信号BによってRSELのビット0が反転される。第1の制御信号とRSEL2(=B’001)とによって、待避されるレジスタが選択され、レジスタ制御信号Bが生成される。
At φ # of T6, the lower 16 bits (contents of the R register) of the data transferred to the
T7のφで、選択されたレジスタ(ER1)の内容がDB経由で、DBW24に転送される。
At φ of T7, the contents of the selected register (ER1) are transferred to the
T7のφ#で、転送されたデータ(ER1の内容)の上位16ビット(Eレジスタの内容)が内部データバスに出力される。また、MAB33のインクリメント機能によって、IABの出力値を+2とする。 At φ # of T7, the upper 16 bits (contents of the E register) of the transferred data (contents of ER1) are output to the internal data bus. Further, the output value of IAB is set to +2 by the increment function of MAB33.
T8のφ#で、DBW24に転送されたデータの下位16ビット(Rレジスタの内容)が内部データバスに出力される。
At φ # of T8, the lower 16 bits (contents of the R register) of the data transferred to the
T8のφ#以降で、前記同様に、次の次の命令の読み出しと、PC30のインクリメント(+2)を行なう。 After φ # at T8, the next next instruction is read and the PC 30 is incremented (+2) in the same manner as described above.
レジスタ3本を指定した場合は、実行ステート数が2ステート長くなり、SPのデクリメント(−4)と、RSELのビット1が反転される。RSELは、レジスタ指定フィールドが000の場合、010とされ、汎用レジスタER2が選択される。ライト動作が2回行われる。
When three registers are specified, the number of execution states increases by two states, and the SP decrement (−4) and the
レジスタ4本を指定した場合は、更に、実行ステート数が2ステート長くなり、SPのデクリメント(−4)と、RSELのビット1とビット0が反転される。RSELは、レジスタ指定フィールドが000の場合、011とされ、汎用レジスタER23が選択される。ライト動作が2回行われる。
When four registers are specified, the number of execution states is further increased by two states, and the SP decrement (−4) and the
レジスタ番号の下位ビットが固定であるので、これを命令処理の実行に従って、変更させることが容易である。例えば、2本のレジスタを待避する場合、命令コード上のレジスタ指定フィールドの下位ビットは0であるので、1回めのレジスタ指定は、レジスタ指定フィールドの値に従い、2回のレジスタ指定は、CONT22の制御に従って、レジスタ指定フィールドの下位1ビットを1に変更して、行なうようにする。 Since the lower bits of the register number are fixed, it is easy to change this in accordance with the execution of the instruction processing. For example, when saving two registers, the lower bit of the register specification field on the instruction code is 0, so the first register specification is performed according to the value of the register specification field, and the second register specification is performed using CONT22. Is performed by changing the lower 1 bit of the register designation field to 1 in accordance with the control of (1).
一方、PUSH命令はレジスタ1本の待避であり、前記の2回目の待避動作を行なわないようにされ、実行動作の共通化を図っている。 On the other hand, the PUSH instruction saves one register, so that the second save operation is not performed, and the execution operation is shared.
図31、32に複数レジスタの復帰命令の実行シーケンスを示す。例えば、LDM.L @ER7+,ER0−ER1などの2本の汎用レジスタを待避する例である。レジスタ指定フィールドは001である。 FIGS. 31 and 32 show the execution sequence of the return instruction of a plurality of registers. For example, LDM. In this example, two general registers such as L @ ER7 + and ER0-ER1 are saved. The register designation field is 001.
図33、34に、RSEL2入力制御回路の具体的な構成、およびその動作説明を示す。この制御回路は、アンド回路75A、75B、オア回路80A、80Bから構成される。
33 and 34 show a specific configuration of the RSEL2 input control circuit and an operation description thereof. This control circuit includes AND
ビット2には、オペコードのレジスタ指定フィールドのビット2がそのまま入力される。ビット1、0には、オアゲートとアンドゲートを介して入力される。オアゲートの他方の入力はSTM制御信号1、0であり、アンドゲートの他方の入力はLDM制御信号1、0の反転とされる。STM制御信号1、0およびLDM制御信号1、0は、CONT22の出力である制御信号Bに含まれる。
In the
STM制御信号が活性状態になると、当該RSELビットは1になる。また、LDM制御信号が活性状態になると、当該RSELビットは0になる。STM、LDM命令と指定したレジスタ本数に従って、STM制御信号、LDM制御信号が生成される。 When the STM control signal is activated, the RSEL bit becomes 1. When the LDM control signal is activated, the RSEL bit becomes 0. An STM control signal and an LDM control signal are generated according to the STM and LDM instructions and the designated number of registers.
これにより、レジスタ選択回路をそのほかの命令と共通化することができる。共通化によって、物理的規模の増加を抑止できる。 Thereby, the register selection circuit can be shared with other instructions. Commonization can suppress an increase in physical scale.
図35、36に、C言語で書かれた関数と、これをCPUの命令に変換したリストの概略を示す。このリストには、オフセット(相対アドレス)、命令コード、Cラベル、Cソース及びアセンブラ命令の各項目が示されている。 35 and 36 schematically show functions written in the C language and lists converted from the functions into CPU instructions. This list shows items of offset (relative address), instruction code, C label, C source, and assembler instruction.
C言語からCPUの命令へのコンパイルについては、例えば、平成4年9月(株)日立製作所発行『H8/300シリーズCコンパイラ』に記載されている。引数を汎用レジスタER0、ER1に設定しておくことができる。 Compilation from C language to CPU instructions is described in, for example, "H8 / 300 Series C Compiler" issued by Hitachi, Ltd., September, 1992. Arguments can be set in general-purpose registers ER0 and ER1.
関数Proc1では、引数をレジスタ渡しとし、これをER0に割り当てている。関数内の処理で、ER2、3、4、6を使用するため、関数処理の先頭で、
STM (ER2−ER3),@−SP
STM (ER4−ER6),@−SP
を実行して、関数の最後で、
LDM @SP+,(ER4−ER6)
LDM @SP+,(ER2−ER3)
を実行して、サブルーチンからリターン(RTS)している。
In the function Proc1, an argument is passed to a register and is assigned to ER0. Since ER2, ER3, ER4, ER6 are used in the processing within the function, at the beginning of the function processing,
STM (ER2-ER3), @ -SP
STM (ER4-ER6), @ -SP
And at the end of the function,
LDM @ SP +, (ER4-ER6)
LDM @ SP +, (ER2-ER3)
And returns from the subroutine (RTS).
ER0、ER1は引数領域のため、関数内では使用せず、内容の待避/復帰も行なわない。 Since ER0 and ER1 are argument areas, they are not used in the function and the contents are not saved / restored.
また、この関数内で呼び出される関数Proc3は、引数をレジスタ渡しとし、これをER0に割り当てている。関数内の処理で、ER5を使用するため、関数処理の先頭で、1レジスタの待避
PUSH.L ER5
を実行して、関数の最後で、
POP.L ER5
を実行して、サブルーチンからリターン(RTS)している。
The function Proc3 called in this function passes an argument by register and assigns it to ER0. Since ER5 is used in the processing in the function, one register is saved at the beginning of the function processing. L ER5
And at the end of the function,
POP. L ER5
And returns from the subroutine (RTS).
スタックポインタはER7と兼用であるから、ER7を待避/復帰することは意味がない。従って、タスク切替えを行なう場合に使用可能なすべてのレジスタを待避する場合には、
STM @SP+,(ER0−ER3)
STM @SP+,(ER4−ER6)
の2命令を用いる。ER0からER6の順番でスタックに待避される。同様に、復帰する場合には、
LDM @SP+,(ER4−ER6)
LDM @SP+,(ER0−ER3)
の2命令を用いる。ER6からER0の順番でスタックから復帰される。
Since the stack pointer is also used as ER7, it is meaningless to save / restore ER7. Therefore, when saving all the registers that can be used when performing task switching,
STM @ SP +, (ER0-ER3)
STM @ SP +, (ER4-ER6)
Are used. It is saved on the stack in the order of ER0 to ER6. Similarly, when returning,
LDM @ SP +, (ER4-ER6)
LDM @ SP +, (ER0-ER3)
Are used. Return from the stack in the order of ER6 to ER0.
前記のように任意の組み合わせを指定できないが、予め、レジスタの割当てを行っておくことにより、実質的な制約にはなりにくい。7本のレジスタを待避/復帰する場合に2命令を用いることになるが、全体的な実行ステート数やプログラム容量に対しては影響が小さい。少なくとも、1本のレジスタずつの待避/復帰命令を用いるより効果がある。後者の場合、4バイト×7、5ステート×7であるのに対して、前者では、4バイト×2、9+11ステートで実行できる。少なくとも、命令リードのためのリードサイクルや、アドレス計算のための内部動作の分を短縮して、高速化を図ることができる。 Although an arbitrary combination cannot be specified as described above, by allocating registers in advance, it is unlikely to be a substantial constraint. Two instructions are used to save / restore the seven registers, but this has little effect on the total number of execution states and the program capacity. At least, it is more effective to use the save / restore instruction for each register. In the latter case, 4 bytes × 7, 5 states × 7, whereas in the former, 4 bytes × 2, 9 + 11 states. At least, a read cycle for instruction read and an internal operation for address calculation can be shortened to achieve high speed.
前記C言語で書かれたプログラムのように、関数乃至サブルーチンを多く用いるプログラムの高速化を実現することができる。 Like a program written in the C language, it is possible to realize a high-speed program using many functions or subroutines.
また、上記のような関数乃至サブルーチンの場合のほかに、割り込み処理ルーチンにおいても、同様のレジスタの待避/復帰を行なう必要がある。マイクロコンピュータが機器制御などを行なう場合には、割り込み処理については、割り込みのイベントが発生してから、実際の割り込み処理を実行するまでの時間を短縮することによって、リアルタイム制御性を向上することができる。複数レジスタの待避を高速に実行可能にすることにより、かかるリアルタイム制御性の向上に効果がある。 In addition to the above-described functions and subroutines, it is necessary to perform the same save / restore of registers in an interrupt processing routine. When a microcomputer performs device control, etc., it is possible to improve real-time controllability by reducing the time from the occurrence of an interrupt event to the actual execution of interrupt processing. it can. By making it possible to save a plurality of registers at high speed, it is effective in improving such real-time controllability.
また、固定の組み合わせにし、各命令の実行ステート数を固定にすることにより、内部の条件分岐を行なうことをなくし、内部論理を簡潔にし、論理規模を縮小できる。マイクロプログラムによらず、ワイアードロジックなどでも容易に実現できる。マイクロプログラムによらず、ワイアードロジックなどとすることにより、論理回路の高速化に寄与することができる。特に、C言語など関数乃至サブルーチンを多く用いるプログラムを高速に実行することができる。 Further, by using a fixed combination and fixing the number of execution states of each instruction, it is possible to eliminate internal conditional branching, simplify the internal logic, and reduce the logic scale. It can be easily realized by wired logic or the like without using a microprogram. By using wired logic or the like regardless of the microprogram, it is possible to contribute to speeding up of a logic circuit. In particular, a program that uses many functions or subroutines such as the C language can be executed at high speed.
図37、38に、割込み例外処理のシーケンスを示す。 37 and 38 show the sequence of the interrupt exception handling.
図39に、例外処理の状態遷移図を示す。 FIG. 39 shows a state transition diagram of the exception processing.
前記同様に、T2から割り込み例外処理の実行が開始される。プリフェッチした命令はキャンセルされ、図示されない割り込み要求信号に呼応して、CONT22の入力が切り換えられる。
In the same manner as described above, the execution of the interrupt exception handling is started from T2. The prefetched instruction is canceled, and the input of the
ステップ1の動作として、PC30のデクリメントを行なう。T2のφ#で、PC30の内容を読み出して、GB経由で、INC27でデクリメント(−4)を行なう。これはプリフェッチをキャンセルしたことに対応して、待避すべきPC30の値を算出する。
As an operation of
T3のφで、デクリメントした結果を、WB経由で一旦PC30に格納する。 The result of the decrement at φ of T3 is temporarily stored in the PC 30 via WB.
ステップ2で、SPをデクリメントし、この内容をアドレスとして、PC30の内容をデータとして、ライト動作を行なう。即ち、T3のφで、同時に、SPの内容を読み出して、GB経由でALU26でデクリメント(−2)を行なう。
In
T3のφ#で、デクリメントした結果を、WB経由でSPに格納するとともに、GB経由でMAB33に転送し、IABに出力させる。
At φ # of T3, the decremented result is stored in the SP via the WB, transferred to the
T4のφで、PC30の内容をDB経由でDBW24に転送する。DBW24の内容は、T4のφ#から、内部データバスに出力される。
At φ of T4, the contents of the PC 30 are transferred to the
ステップ3で、SPをデクリメントし、この内容をアドレスとして、PC30の上位8ビットとCCR31の内容をデータとして、ライト動作を行なう。
In
T4のφで、同時に、SPの内容を読み出して、GB経由でALU26でデクリメント(−2)を行なう。
At φ of T4, the contents of the SP are read at the same time, and the
T4のφ#で、デクリメントした結果を、WB経由でSPに格納するとともに、GB経由でMAB33に転送し、IABに出力させる。DBW24に保持したPC30の内容下位16ビットを内部データバスに出力する。
At φ # of T4, the decremented result is stored in SP via WB, transferred to
T5のφで、CCR31の内容をDB経由でDBW24に転送する。T4で格納したPC30の上位8ビットは保持される。DBW24の内容は、T5のφ#から、内部データバスに出力される。
At φ of T5, the contents of the
INTM1信号が非活性状態であれば、ステップ4に遷移する。INTM1信号が活性状態であれば、ステップ12に遷移し、SPをデクリメントし、この内容をアドレスとして、EXRの内容をデータとして、ライト動作を行なう。 If the INTM1 signal is in the inactive state, the process proceeds to step 4. If the INTM1 signal is in the active state, the flow goes to step 12 to decrement SP and perform a write operation using this content as an address and the EXR content as data.
T5のφで、SPの内容を読み出して、GB経由でALU27でデクリメント(−2)を行なう。
At φ of T5, the contents of SP are read, and decrement (-2) is performed by
T5のφ#で、デクリメントした結果を、WB経由でSPに格納する。 At φ5 of T5, the result of the decrement is stored in the SP via WB.
T6のφで、EXRの内容をDB経由でDBW24に転送する。T6のφ#から、内部データバスに出力される。
At φ of T6, the contents of EXR are transferred to
ステップ4で、ベクタアドレスの内容をリードする。
In
T5のφ#で、同時に、VAGの内容をGB経由でMAB33に転送し、IABに出力させる。VAGには、図示されない、割り込みコントローラから与えられるベクタ番号に基づいて、ベクタアドレスを生成する。
At φ # of T5, the contents of VAG are simultaneously transferred to
ステップ5で、ベクタアドレスのリード動作の終了を待つ。
In
ステップ6で、DBR25に格納した、ベクタアドレスの内容をアドレスとして、命令のリードを行なう。DBR25の内容をインクリメントし、PC30に格納する。
In
T8のφ#で、DBR25に格納したベクタアドレスのリード内容(分岐先の先頭アドレス)をGB経由で、MAB33に転送し、IABに出力させ、ALU26でインクリメント(+2)する。
At φ # of T8, the read content (start address of the branch destination) of the vector address stored in the DBR 25 is transferred to the
T9のφで、インクリメントした結果を、WB経由でPC30に格納する。 At φ of T9, the incremented result is stored in the PC 30 via WB.
ステップ7で、PC30の内容をアドレスとして、命令のリードを行い、PC30のインクリメントを行なう。
In
T9のφ#で、PC30の内容(分岐先の先頭アドレス)をGB経由で、MAB33に転送し、IABに出力させ、ALU26でインクリメント(+2)する。リードした命令をIR21に格納する。
At φ # of T9, the contents of the PC 30 (the leading address of the branch destination) are transferred to the
T10のφで、インクリメントした結果を、WB経由でPC30に格納する。 At φ of T10, the increment result is stored in the PC 30 via WB.
次の命令の実行を開始させる。 Starts execution of the next instruction.
制御信号INTM1に従って、ステップ12を行なうか、行なわないかが選択され、スタックを2回行なうか、3回行なうかが選択される。スタックを2回行なう場合には、PCとCCR31のみが待避される。SPは−4となる。上記T5の動作に相当する部分(ステップ12)が実行されない。3回行なう場合には、PC30とCCR31及びEXRが待避される。SPは−6となる。
According to control signal INTM1, whether to perform
なお、ステップ1単位の動作が複数ステートにまたがっているのは、1つのCONT22の入力に対応して、複数の異なるタイミングの制御信号A、B、C及びレジスタ選択信号A、B、Cが生成されるのに対応する。
It should be noted that the operation in units of steps spans a plurality of states because a plurality of control signals A, B, C and register selection signals A, B, C at different timings are generated in response to the input of one
図40、41に、例外処理後のスタックの状態を示す。図41はノーマルモードを示し、図42はアドバンストモードを示している。 40 and 41 show the state of the stack after the exception processing. FIG. 41 shows the normal mode, and FIG. 42 shows the advanced mode.
図42に、RTE命令の実行シーケンスを示す。 FIG. 42 shows an execution sequence of the RTE instruction.
図43に、例外処理の状態遷移図を示す。 FIG. 43 shows a state transition diagram of the exception processing.
前記同様に、T2からRTE命令の実行が開始される。 As described above, the execution of the RTE instruction is started from T2.
ステップ1の動作として、SPの内容をアドレスとして、スタックのリードを行なう。T2のφ#で、SPの内容を読み出して、GB経由で、MAB33に転送し、IABに出力させる。
As an operation of
T3のφで、SPの内容を読み出して、GB経由で、ALU27でインクリメント(+2)する。IABのアドレスでスタックをリードする。T3のφ#で、リードした内容をDBR25に格納する。
At φ of T3, the contents of the SP are read and incremented (+2) by the
INTM1信号が非活性状態であれば、ステップ2に遷移する。INTM1信号が活性状態であれば、ステップ10に遷移し、リードした結果をEXRに格納する。SPをインクリメントし、この内容でリードを行なう。 If the INTM1 signal is in the inactive state, the process proceeds to step 2. If the INTM1 signal is in the active state, the flow goes to step 10 to store the read result in EXR. SP is incremented, and reading is performed with this content.
T3のφ#で、同時に、インクリメントした結果を、WB経由でSPに格納する。また、GBを経由して、MAB33に転送し、IABに出力させる。
At φ # of T3, the incremented result is simultaneously stored in SP via WB. Further, the data is transferred to the
T4のφで、DBR25の内容をGBに読み出し、これをALU27に入力する。T4のφ#で、ALU27はGBから入力した内容をそのまま、WBに出力し、EXRに格納する。
At φ of T4, the contents of the DBR 25 are read to GB and input to the
ステップ2で、リードした結果をCCR31に格納する。MAB33に格納した内容を、MAB33でインクリメントさせる。この内容でリードを行なう。なお、MAB33のインクリメント機能は、特開平4−333153号公報などに記載されている。
In
T5のφで、DBR25の内容をGBに読み出し、これをALU27に入力する。T5のφ#で、ALU27はGBから入力した内容をそのまま、WBに出力し、CCR31に格納する。
At φ of T5, the contents of the DBR 25 are read to GB, and this is input to the
ステップ3で、SPの内容をインクリメント(+4)する。
In
T6のφで、SPの内容を読み出して、GB経由で、ALU26でインクリメント(+4)する。
At φ of T6, the contents of the SP are read and incremented (+4) by the
T6のφ#で、インクリメントした結果を、WB経由でSPに格納する。 At φ6 of T6, the increment result is stored in the SP via WB.
ステップ4で、DBR25に格納した、スタックから復帰したPC30の内容をアドレスとして、命令のリードを行なう。DBR25の内容をインクリメントし、PC30に格納する。
In
T6のφ#で、同時に、DBR25に格納したベクタアドレスのリード内容(分岐先の先頭アドレス)をGB経由で、MABに転送し、IABに出力させ、ALUでインクリメント(+2)する。 At φ # of T6, at the same time, the read contents of the vector address (the leading address of the branch destination) stored in the DBR 25 are transferred to the MAB via GB, output to the IAB, and incremented (+2) by the ALU.
T7のφで、インクリメントした結果を、WB経由でPC30に格納する。 At φ of T7, the increment result is stored in the PC 30 via WB.
ステップ5で、PC30の内容をアドレスとして、命令のリードを行い、PC30のインクリメントを行なう。
In
T7のφ#で、PC30の内容(分岐先の先頭アドレス)をGB経由で、MAB33に転送し、IABに出力させ、ALU26でインクリメント(+2)する。リードした命令をIRに格納する。
At φ # of T7, the contents of the PC 30 (the leading address of the branch destination) are transferred to the
T8のφで、インクリメントした結果を、WB経由でPC30に格納する。次の命令の実行を開始させる。 At φ of T8, the increment result is stored in the PC 30 via WB. Starts execution of the next instruction.
例えば、INTM1信号が0レベルの場合には、前記従来CPU(例えば、前記平成5年6月(株)日立製作所発行『H8/300Hシリーズプログラミングマニュアル』に記載のCPU)と同一のスタックの構造とされる。命令コードが共通であることと相俟って、従来CPUによって書かれたプログラムをそのまま実行することができる。 For example, when the INTM1 signal is at the 0 level, the same stack structure as that of the conventional CPU (for example, the CPU described in "H8 / 300H Series Programming Manual" issued by Hitachi, Ltd., June 1993) is used. Is done. The program written by the conventional CPU can be directly executed in combination with the common instruction code.
新たな、コンディションコードや割込みマスクビットやトレースビットなどを追加する場合には、これに対応したプログラムを作成することになるから、スタックの構造が異なっても実質的な問題はない。割込みマスクビットを追加するなどして、使い勝手を向上することができる。 When a new condition code, interrupt mask bit, trace bit, or the like is added, a program corresponding to this is created, so that there is no substantial problem even if the stack structure is different. Usability can be improved by adding an interrupt mask bit or the like.
なお、前記の通りINTM1ビットがSYSCRに存在し、このビットの状態がINTM1信号に反映されるようになっている。リセット後に、かかるSYSCRの設定を行なうことにより、EXRを使用するかしないかが選択される。 As described above, the INTM1 bit exists in the SYSCR, and the state of this bit is reflected in the INTM1 signal. After the reset, the setting of the SYSCR is performed to select whether to use the EXR.
図44にCONT22の一部の論理を示す。このCONT22は、アンド回路86A〜86Dによって構成される。
FIG. 44 shows a part of the logic of the
EXRを使用しない、すなわち、INTM1ビットを”0”にクリアすると、EXRのビットは全て”0”とみなされ、設定値は、無視されるようにされる。 When EXR is not used, that is, when the INTM1 bit is cleared to “0”, all bits of EXR are regarded as “0” and the set value is ignored.
次に、図4におけるエミュレーション用インタフェース39に含まれる制御レジスタ41の構成を示す。この制御レジスタ41は、以下説明するように、(1)ASEコントロールレジスタ D (ASECRD)、(2)ブレークコントロールレジスタ A B(BRCRA、B)、(3)ブレークアドレスレジスタ A、B(BARA、B)、(4)ブレークアドレスマスクレジスタ A、B(BAMRA、B)、および(5)ASE専用スタックレジスタ(BRKSTKR)から構成されている。
Next, the configuration of the
図45に、(1)ASEコントロールレジスタ D (ASECRD)の構成を示す。このレジスタは8ビットリード/ライト可能なレジスタで、シングルステップの設定、RTB命令実行後の割込制御、多重ブレークの許可禁止、ウインドウ機能を指定する。各ビットの内容を表21乃至表24に示す。 FIG. 45 shows the configuration of (1) ASE control register D (ASECRD). This register is an 8-bit readable / writable register, and specifies single step setting, interrupt control after execution of an RTB instruction, permission / prohibition of multiple breaks, and a window function. Tables 21 to 24 show the contents of each bit.
[表21]
[Table 21]
[表22]
[Table 22]
[表23]
[Table 23]
[表24]
[Table 24]
図46に、(2)ブレークコントロールレジスタ A B(BRCRA、B)の構成を示す。このレジスタは、(a)BRCRA、(b)BRCRBからなり、各々は8ビットのリード/ライトが可能なレジスタで、それぞれPCブレークのチャネルA、Bの制御を行なう。各ビットの内容を表25乃至表28に示す。 FIG. 46 shows the configuration of (2) Break Control Register AB (BRCR, B). This register is composed of (a) BRCRA and (b) BRCRB, each of which is an 8-bit readable / writable register and controls the PC break channels A and B, respectively. Tables 25 to 28 show the contents of each bit.
[表25]
[Table 25]
[表26]
[Table 26]
[表27]
[Table 27]
[表28]
[Table 28]
図47に、(3)ブレークアドレスレジスタ A、B(BARA、B)の構成を示す。このレジスタは、(a)BARA、(b)BARBからなり、各々は32ビットのリード/ライトが可能なレジスタで、それぞれPCブレークのチャネルA、Bのアドレスを指定する。32ビットのレジスタをバイトサイズに分割して、BARR、E、H、Lと表記される場合もある。最上位のBARRはリザーブされている。リードすると不定値が読み出される。ライトは無効である。 FIG. 47 shows the configuration of (3) break address registers A and B (BARA, B). This register is composed of (a) BARA and (b) BARB, each of which is a 32-bit readable / writable register and specifies the address of a channel A or B of a PC break, respectively. A 32-bit register may be divided into byte sizes and denoted as BARR, E, H, and L. The top BARR is reserved. When read, an undefined value is read. Light is invalid.
図48に、(4)ブレークアドレスマスクレジスタ A、B(BAMRA、B)の構成を示す。このレジスタは、(a)BAMRA、(b)BAMRBからなり、各々は32ビットのリード/ライトが可能なレジスタで、それぞれPCブレークのチャネルA、Bのアドレス比較のマスクを行なうビットを指定する。BAMRのビットを”1”にセットすると、このビットに対応するアドレスのビットは、アドレス比較対象から除外される。32ビットのレジスタをバイトサイズに分割して、BAMRR、E、H、Lと表記される場合もある。最上位のBARRはリザーブされている。リードすると不定値が読み出される。ライトは無効である。 FIG. 48 shows the configuration of (4) Break address mask registers A and B (BAMRA, B). This register comprises (a) BAMRA and (b) BAMRB, each of which is a 32-bit readable / writable register and specifies a bit for masking the address comparison of channels A and B of a PC break, respectively. When the bit of BAMR is set to "1", the bit of the address corresponding to this bit is excluded from the address comparison target. In some cases, a 32-bit register is divided into byte sizes and denoted as BAMRR, E, H, and L. The top BARR is reserved. When read, an undefined value is read. Light is invalid.
図49に、(5)ASE専用スタックレジスタ(BRKSTKR)の構成を示す。このレジスタは、6バイト(48ビット)のリード/ライトが可能なレジスタで、ユーザモード⇔ブレークモードの遷移時に、スタック領域として使用する。ユーザのSPは使用せず、保持される。スタックされるリソースおよびスタックの構造は、MCU動作モード(ノーマルモード/アドバンストモード)および、制御レジスタの設定(SYSCRのINTM1ビット)によって相違される。表29にこのレジスタの使用方法を示す。 FIG. 49 shows the configuration of (5) ASE dedicated stack register (BRKSTKR). This register is a 6-byte (48-bit) readable / writable register, and is used as a stack area when transitioning from user mode to break mode. The user's SP is not used and is retained. The resources to be stacked and the structure of the stack differ depending on the MCU operation mode (normal mode / advanced mode) and the setting of the control register (INTM1 bit of SYSCR). Table 29 shows how to use this register.
[表29]
[Table 29]
エミュレーション用ソフトウェアの実行状態への遷移(ブレーク)時には、固定アドレスのブレークスタックレジスタを使用するようにする。ブレーク例外処理や、ブレークからのリターン命令時には、ユーザのスタックポインタ(ER7)を使用せず、固定的なスタックアドレスを生成する。かかるスタックアドレスの生成はEMLSP29による。
At the time of transition (break) to the execution state of the emulation software, a break stack register at a fixed address is used. At the time of break exception handling or a return instruction from a break, a fixed stack address is generated without using the user's stack pointer (ER7). The generation of such a stack address is performed by the
図50に、EMLSP29の構成を示す。このEMLSP29は、クロックトバッファで構成される。
FIG. 50 shows the configuration of the
かかるクロックトバッファの内、ビット23〜10は1固定、ビット5、4、0は0固定、ビット9〜6は、外部からの指定を入力する。また、ビット3、2、1はCONT22の制御信号を入力する。CMOS回路で構成する場合、必要に応じて論理反転を用いればよい。クロックトバッファの出力はGBに接続されている。また制御信号mは、CONTの制御信号とクロック(φ#)の論理積信号である。
Of the clocked buffers,
通常のレジスタ回路が、データを保持するためのラッチ回路を持たなければならないが、EMLSP29は、これを持たず、小型化を図っている。
A normal register circuit must have a latch circuit for holding data, but the
従って、ブレークスタックレジスタの先頭アドレスは、B’000000であって、64kバイト単位で16通りのアドレスを選択可能とされる。マイクロコンピュータの内部I/Oレジスタの配置によって、アドレスを変更できる。 Therefore, the start address of the break stack register is B'000000, and 16 addresses can be selected in units of 64 kbytes. The address can be changed depending on the arrangement of the internal I / O registers of the microcomputer.
ブレーク例外処理の実行シーケンスは、図37、38と同様であり、そこでのSP(ER7)の読み出しに代わって、EMLSP29を読み出すようにする。
この場合、最初(T3のφ)は下位アドレスをB’000110として、デクリメントした内容のB’000100がスタックのアドレスとされる。
The execution sequence of the break exception process is the same as that shown in FIGS. 37 and 38, and the
In this case, at the beginning (φ of T3), the lower address is B'000110, and the decremented content B'000100 is set as the address of the stack.
2回目(T4のφ)は下位アドレスをB’000100として、デクリメントした内容のB’000010がスタックのアドレスとされる。 In the second time (φ of T4), the lower address is set to B'000100, and the decremented content B'000010 is set as the stack address.
3回目(T5のφ)は下位アドレスをB’000010として、デクリメントした内容のB’000000がスタックのアドレスとされる。3回目は、INTM信号が活性状態のときに有効である。読み出されるビット2、1は、CONT22の制御信号によって選択する。
For the third time (φ of T5), the lower address is set to B'000010, and the decremented content B'000000 is set as the address of the stack. The third time is effective when the INTM signal is in the active state. The
リターン命令の実行シーケンスは、図42と同様であり、SP(ER7)の読み出しに代わって、EMLSP29を読み出すようにする。
The execution sequence of the return instruction is the same as that in FIG. 42, and the
最初(T2のφ#)はINTM1信号によって異なり、INTM1信号が非活性状態であれば、下位アドレスをB’000010として、INTM1信号が活性状態であれば、下位アドレスをB’000000として、読み出す。これらがスタックのアドレスとなる。 The first (φ # of T2) differs depending on the INTM1 signal. When the INTM1 signal is inactive, the lower address is read as B'000010, and when the INTM1 signal is active, the lower address is read as B'000000. These are the addresses of the stack.
2回目(T3のφ)は、INTM1信号が活性状態である場合に有効であり、下位アドレスをB’000010として、デクリメントした結果をアドレスとしてリードを行なう。 The second time (φ of T3) is effective when the INTM1 signal is in the active state. The lower address is set to B'000010, and the result of the decrement is read as the address.
3回目はMAB33のインクリメントによってアドレスを生成し、EMLSP29は使用しない。
In the third time, an address is generated by incrementing the
これにより、固定的な出力回路として論理規模を縮小できる。ユーザに公開されない資源による論理規模の増大を最小限にすることができる。 Thereby, the logic scale can be reduced as a fixed output circuit. An increase in logical scale due to resources not disclosed to the user can be minimized.
図51に、ブレーク例外処理の実行タイミングを示す。実行シーケンスは図37、38の例外処理タイミングと同様である。 FIG. 51 shows the execution timing of the break exception handling. The execution sequence is the same as the exception processing timing in FIGS.
前記同様に、T2から割り込み例外処理の実行が開始される。プリフェッチした命令はキャンセルされ、図示されないブレーク要求信号に呼応して、CONT22の入力が切り換えられる。
In the same manner as described above, the execution of the interrupt exception handling is started from T2. The prefetched instruction is canceled, and the input of the
T3のバス動作が行われない期間に、ブレークモードを示す信号BRKAK#が活性状態になる。 During a period in which the bus operation of T3 is not performed, the signal BRKAK # indicating the break mode is activated.
図52に、ブレーク制御論理の回路構成を示す。この回路は、アンド回路81A乃至81G、オア回路82A乃至82D、フリップフロップ83から構成されている。
FIG. 52 shows a circuit configuration of the break control logic. This circuit includes AND
CPUに対するブレーク要求は、3要因が存在する。第1はBRK端子による要求である。第2はアドレス比較Aによる要求であり、これは、BRKCRのBIEAビットによって許可される。第3はアドレス比較Bによる要求であり、これは、BRKCRのBIEBビットによって許可される。なお、かかるアドレス比較は、前記の通り、(CA23・AR23+¬CA23・¬AR23+AMR23)・…・(CAn・ARn+¬CAn・¬ARn+AMRn)・…・(CA0・AR0+¬CA0・¬AR0+AMR0)と表現される。(¬は論理反転を示す)。 There are three causes for a break request to the CPU. The first is a request by the BRK terminal. The second is a request by address comparison A, which is granted by the BIEA bit of BRKCR. Third is a request by address compare B, which is granted by the BIEB bit of BRKCR. As described above, this address comparison is expressed as (CA23 / AR23 + @ CA23 / @ AR23 + AMR23)... (CAn / ARn + @ CAn / @ ARn + AMRn)... (CA0.AR0 + @ CA0. @ AR0 + AMR0). You. (¬ indicates logical inversion).
これらの論理和信号が、ブレーク要求として、CPUに与えられる。ブレークモードでは、MBIEビットの状態によってBRK端子によるブレーク要求の許可禁止が選択される。即ち、ブレークモードでMBIEビットが”0”にクリアされている場合は、ブレーク要求が抑止される。アドレス比較によるブレーク要求は、ブレークモードで禁止される。 These OR signals are supplied to the CPU as a break request. In the break mode, permission / prohibition of the break request by the BRK terminal is selected according to the state of the MBIE bit. That is, when the MBIE bit is cleared to "0" in the break mode, the break request is suppressed. Break requests by address comparison are prohibited in the break mode.
また、MBIEビットは、フリップフロップで構成され、BRKAK信号の反転信号で”0”にクリアされる。かかるフリップフロップの入力は、所定のデータバスのビットであって、クロックは、ブレークモード信号とアドレスデコード信号とライト信号の論理積信号とされる。かかるアドレスデコード信号は、CPUの出力するアドレスがBRKCRの存在するアドレスになったとき、活性状態とされる。即ち、ブレークモードでのみライト可能とされる。 The MBIE bit is formed by a flip-flop, and is cleared to “0” by an inverted signal of the BRKAK signal. The input of the flip-flop is a bit of a predetermined data bus, and the clock is an AND signal of a break mode signal, an address decode signal, and a write signal. Such an address decode signal is activated when the address output from the CPU becomes an address where BRKCR exists. That is, writing is enabled only in the break mode.
即ち、ブレークモードに遷移した直後は、ブレーク要求が禁止状態であって、不所望のブレークの多重例外処理(スタックした内容の破壊)が禁止される。また、BRKCRのSSTPビットと、BRKAK信号の反転信号との論理積が、シングルステップブレーク要求として、CPUに与えられる。 That is, immediately after the transition to the break mode, the break request is in a disabled state, and the multiple exception processing of the undesired break (destruction of the stacked contents) is prohibited. The logical product of the SSTP bit of BRKCR and the inverted signal of the BRKAK signal is given to the CPU as a single step break request.
シングルステップブレーク要求と、RTB命令実行信号との論理積信号と、ブレーク要求が、CPU内部で、CPUブレーク例外処理要求として認識される。これらの例外処理の内容は共通とされる。 The logical product signal of the single step break request, the RTB instruction execution signal, and the break request are recognized inside the CPU as a CPU break exception processing request. The contents of these exception processes are common.
CPUはRTB命令実行時には、かかるシングルステップブレーク要求を無視する。 When executing the RTB instruction, the CPU ignores the single step break request.
上記実施の形態 によれば、以下の作用効果を得るものである。 According to the above embodiment, the following operation and effect can be obtained.
(1)既存の命令セットと互換性を維持しつつ、乗算器を内蔵することに当っては、ポストインクリメントレジスタ間接のアドレッシングモードのみをサポートすることによって、アドレッシングモードの増加を最小限にして、かつ処理性能を低下させずに積和演算を実行可能にすることができる。また、アドレスレジスタの補正をレジスタ間演算命令で行い、これを1ステートで実行することができ、アドレッシングの柔軟性を向上することができる。さらに、積和演算をCPUの内部動作(ポストインクリメントのアドレス計算)と並行に行なうことによって、実行ステート数の短縮を行なうことができる。 (1) Incorporating a multiplier while maintaining compatibility with the existing instruction set, by supporting only the post-increment register indirect addressing mode, the increase in the addressing mode is minimized. In addition, the product-sum operation can be executed without lowering the processing performance. Further, correction of the address register can be performed by an inter-register operation instruction, and this can be executed in one state, so that the flexibility of addressing can be improved. Further, by performing the product-sum operation in parallel with the internal operation of the CPU (post-increment address calculation), the number of execution states can be reduced.
(2)乗算器を利用して乗算命令を実行することにあたっては、乗算の結果(積、フラグ)を直接汎用レジスタ、CCRに格納するようにして、直ちに結果を利用できるようにし、実質的な乗算の実行速度を向上することができる。また、積和演算の結果(MAC)をリード(STMAC)すると同時に、乗算器内部で保持したフラグをCCRに格納することによって、積和演算結果の利用や判定を容易に行なうことができ、使い勝手を向上することができる。 (2) In executing a multiplication instruction using a multiplier, the result of multiplication (product, flag) is directly stored in a general-purpose register or CCR so that the result can be used immediately, The execution speed of the multiplication can be improved. In addition, by reading the result (MAC) of the product-sum operation (STMAC) and storing the flag held in the multiplier in the CCR at the same time, the result of the product-sum operation can be easily used and determined. Can be improved.
(3)乗算器を取外し可能にすることによって、乗算器を取外した場合は、積和演算をサポートしないことによって、容易に下位CPUを実現し、論理的・物理的規模を縮小し、製造費用を低減した別のマイクロコンピュータを容易に開発することができる。また、汎用的な乗算命令を、乗算器によらずにサポートすることによって、かかる別のマイクロコンピュータにおける使い勝手の低下を防止できる。さらに、乗算器によらない乗算命令を除算と同一のシーケンスで実行するようにして、乗算器を持つマイクロコンピュータにおいても冗長な論理を最低限にすることができる。 (3) By making the multiplier removable, when the multiplier is removed, the lower CPU can be easily realized by not supporting the product-sum operation, thereby reducing the logical and physical scale, and the manufacturing cost. It is possible to easily develop another microcomputer in which the number is reduced. Further, by supporting a general-purpose multiplication instruction without using a multiplier, it is possible to prevent the usability of such another microcomputer from being reduced. Further, by executing a multiplication instruction which does not depend on the multiplier in the same sequence as the division, redundant logic can be minimized even in a microcomputer having a multiplier.
また、乗算器使用するか使用しないかの制御信号を与えて制御することによって、テスト性を向上したり、エミュレータを共通化したりすることができる。全体的な開発効率を向上することができる。さらにまた、乗算器を削除し、小型化したCPUを用いて、マイクロコンピュータを構成することによって、半導体集積回路の論理規模・物理的規模を縮小して、製造費用の縮小を図ることができる。 In addition, by providing a control signal indicating whether a multiplier is used or not, control can be performed to improve testability and to use a common emulator. Overall development efficiency can be improved. Furthermore, by eliminating the multiplier and configuring the microcomputer using a downsized CPU, the logical scale and the physical scale of the semiconductor integrated circuit can be reduced, and the manufacturing cost can be reduced.
(4)乗算器とCPUを一体に構成して、乗算器・CPU間の配線を短縮して、物理的規模を縮小する。また、高速化に寄与することができる。 (4) The multiplier and the CPU are integrally formed to reduce the wiring between the multiplier and the CPU, thereby reducing the physical scale. In addition, it can contribute to speeding up.
(5)乗算器のテストモードを設定して、このときの乗算器の処理を1ステップのみにすることによって、論理規模の増加を最低限にして、テストの容易性を向上することができる。テストステップを短縮することができる。 (5) By setting the test mode of the multiplier and performing only one step of the processing of the multiplier at this time, it is possible to minimize the increase in the logic scale and improve the testability. Test steps can be shortened.
(6)内部動作のパイプラインに対応して、入出力タイミングの異なるレジスタ選択回路を複数持つことにより、実質的に1命令/1ステート実行を行なうことができる。 (6) By providing a plurality of register selection circuits having different input / output timings corresponding to the pipeline of the internal operation, one instruction / one state can be executed substantially.
(7)複数レジスタの退避/復帰命令を持ち、この組み合わせを固定的にすることによって、論理規模の縮小を図ることができる。レジスタの本数の異なる命令を複数命令サポートすることによって、使い勝手の低下を防ぐことができる。また、複数レジスタの退避/復帰命令を関数(サブルーチン)の入り口/出口で実行することによって、C言語などで記述された場合のように、関数の使用頻度が高い場合に、処理速度を特に向上することができる。さらに、割り込み例外処理ルーチンの先頭で複数レジスタの退避を用いることにより、リアルタイム性の向上を図ることができる。 (7) By having a save / restore instruction for a plurality of registers and fixing this combination, the logical scale can be reduced. By supporting a plurality of instructions having different numbers of registers, it is possible to prevent a decrease in usability. Also, by executing save / restore instructions of a plurality of registers at the entrance / exit of a function (subroutine), the processing speed is particularly improved when the function is frequently used, such as when the function is described in C language or the like. can do. Further, by using the saving of a plurality of registers at the beginning of the interrupt exception handling routine, the real-time property can be improved.
(8)EXRの有効/無効を切り換えることで、互換性を維持することと、機能拡張とを両立することができる。EXRを無効とし、例外処理において退避/復帰を行なわないようにすることで、スタックの節約と、割込み応答時間の高速化に寄与することができる。また、互換性を維持する。さらに、EXRを有効とすることで、割り込みマスクレベルを拡張したり、トレース機能を追加したりして、使い勝手を向上することができる。 (8) By switching between valid / invalid of EXR, compatibility can be maintained and function expansion can be achieved at the same time. By disabling EXR and not saving / restoring in exception processing, it is possible to contribute to saving the stack and shortening the interrupt response time. Also, maintain compatibility. Further, by enabling the EXR, the usability can be improved by extending the interrupt mask level and adding a trace function.
(9)エミュレータ用の固定的なスタックポインタを持つことによって、ユーザプログラムとエミュレーションプログラムの遷移時に、ユーザのスタックポインタとは独立して、固定的なアドレスに対して退避および復帰が行われるから、エミュレータのソフトウェア、ハードウェアの開発を容易にすることができる。 (9) By having a fixed stack pointer for the emulator, at the transition between the user program and the emulation program, saving and restoring to a fixed address are performed independently of the user's stack pointer. Emulator software and hardware development can be facilitated.
また、エミュレータ用のスタックポインタを固定的にすることによって、ユーザに公開しない資源を最小限の論理的・物理的規模にすることができる。ユーザプログラムからエミュレーションプログラムへの遷移(ブレーク)を多重に行なうことを禁止することを可能にすることによって、不所望のスタックの内容の破壊を防止することができる。 In addition, by fixing the stack pointer for the emulator, resources that are not disclosed to the user can be reduced to a minimum logical and physical scale. By making it possible to prohibit multiple transitions (breaks) from the user program to the emulation program, it is possible to prevent undesired destruction of the contents of the stack.
以上本発明者等によってなされた発明を実施の形態 に限定されるものではなく、その要旨を逸脱しない範囲において種々変更可能である。実施の形態 を相互に組み合せて使用することもできる。 The invention made by the inventors of the present invention is not limited to the embodiment, but can be variously changed without departing from the gist of the invention. The embodiments may be used in combination with each other.
例えば、CPUの命令セットやレジスタ構成は変更可能である。内部バス幅なども変更可能である。但し、命令の大部分の命令コード長より、小さいバス幅でないことが望ましい。 For example, the instruction set and register configuration of the CPU can be changed. The internal bus width can be changed. However, it is desirable that the bus width is not smaller than the instruction code length of most of the instructions.
また、乗算器の内部構成なども種々変更可能である。16ビット×6ビットを3回繰り返すのではなく、16ビット×4ビットを4下位繰り返すようにしてもよい。命令実行ステートと論理的規模に鑑みて選択すればよい。 Further, the internal configuration of the multiplier can be variously changed. Instead of repeating 16 bits × 6 bits three times, 16 bits × 4 bits may be repeated four lower orders. The selection may be made in consideration of the instruction execution state and the logical scale.
さらに、飽和演算の指定、乗算器あり/なしの指定、テストモードの指定方法が種々変更可能であることは言うまでもない。 Further, it goes without saying that the designation of the saturation operation, the designation of the presence / absence of the multiplier, and the designation method of the test mode can be variously changed.
さらにまた、乗算器に限らず除算器を内蔵するものであっても良い。 Furthermore, the present invention is not limited to the multiplier, and may include a divider.
また、互換性を維持すべき対象は、前記例に限定されない。一般的に、CPUの例外処理時に、コントロールレジスタの内容を待避することは行われており、そのほかのCPUについても、本発明を適用して、互換性を維持しつつ、コントロールレジスタの機能を拡張することができる。 Further, the object for which compatibility should be maintained is not limited to the above example. Generally, the contents of the control register are saved during exception processing of the CPU, and the functions of the control register are extended to other CPUs while maintaining compatibility by applying the present invention. can do.
さらに、シングルチップマイクロコンピュータのその他の機能ブロックについても何等制約されない。 Further, the other functional blocks of the single-chip microcomputer are not restricted at all.
以上の説明では主として本発明者によってなされた発明をその背景となった利用分野であるシングルチップマイクロコンピュータに適用した場合について説明したが、それに限定されるものではなく、その他のデータ処理装置にも適用可能であり、本発明は少なくとも、複数の動作モードを選択して動作するデータ処理装置に適用することができる。 In the above description, the case where the invention made by the present inventor is mainly applied to a single-chip microcomputer, which is a field of use as a background, has been described. The present invention is applicable to at least a data processing device that operates by selecting a plurality of operation modes.
1…CPU、2…乗算器、3…システムコントローラ(SYSC)、4…割込コントローラ(INT)、5…ROM、6…RAM、9…シリアルコミュニケーションインターフェース(SCI)、13…システムコントロールレジスタ(SYSCR)、14…制御レジスタ(CPUCR)、21…命令レジスタ(IR)、22…命令デコーダ・制御回路(CONT)、23…レジスタセレクタ(RSEL)、24…ライトデータバッファ(DBW)、25…リードデータバッファ(DBR)、26、27…演算器、29…エミュレータスタックポインタ(EMLSP)、30…プログラムカウンタ(PC)、31…コンディションレジスタ(CCR)、32…拡張レジスタ(EXR)、33…アドレスバッファ(MAB)、34…バススイッチ、38…エミュレーション用プロセッサ、39…エミュレーション用インタフェース、44…インタフェースケーブル、48…エミュレーションメモリ、49…ブレーク制御回路、50…リアルタイムトレース回路、58…CMOSインバータ回路、65A〜65C…デコーダ、66A〜66C、71A、71B、77…選択回路、67…加算器、72A〜72C…拡張回路、76…算術論理演算回路、78…シフト回路、79…制御回路、75A、75B、81A〜81G、86A〜86D…アンド回路、80A、80B、82A〜82D…オア回路、83…フリップフロップ。
DESCRIPTION OF
Claims (6)
前記命令を実行する実行手段を制御する制御手段に、指定可能な複数のレジスタの組み合わせを固定にし、前記複数のレジスタの待避/復帰命令を有することを特徴とするデータ処理装置。 A data processing device that sequentially executes a predetermined instruction,
A data processing apparatus, wherein a combination of a plurality of registers that can be specified is fixed to a control unit that controls an execution unit that executes the instruction, and a save / restore instruction for the plurality of registers is provided.
A data processing device wherein a combination of registers that can be designated by a save / restore instruction is fixed.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2004161157A JP2004295914A (en) | 2004-05-31 | 2004-05-31 | Data processing device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2004161157A JP2004295914A (en) | 2004-05-31 | 2004-05-31 | Data processing device |
Related Parent Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP7060797A Division JPH08263290A (en) | 1995-03-20 | 1995-03-20 | Data processing device |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JP2004295914A true JP2004295914A (en) | 2004-10-21 |
Family
ID=33411298
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2004161157A Pending JP2004295914A (en) | 2004-05-31 | 2004-05-31 | Data processing device |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP2004295914A (en) |
-
2004
- 2004-05-31 JP JP2004161157A patent/JP2004295914A/en active Pending
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US6560697B2 (en) | Data processor having repeat instruction processing using executed instruction number counter | |
| US8612726B2 (en) | Multi-cycle programmable processor with FSM implemented controller selectively altering functional units datapaths based on instruction type | |
| JPH09311786A (en) | Data processing device | |
| JP2001202243A (en) | Data processing device | |
| JP4004915B2 (en) | Data processing device | |
| JP4073721B2 (en) | Data processing device | |
| JP3578883B2 (en) | Data processing device | |
| JP2006313561A (en) | Data processor | |
| US6078940A (en) | Microprocessor with an instruction for multiply and left shift with saturate | |
| US6055628A (en) | Microprocessor with a nestable delayed branch instruction without branch related pipeline interlocks | |
| US6209080B1 (en) | Constant reconstruction processor that supports reductions in code size and processing time | |
| JP4800582B2 (en) | Arithmetic processing unit | |
| US6112291A (en) | Method and apparatus for performing a shift instruction with saturate by examination of an operand prior to shifting | |
| JP3786575B2 (en) | Data processing device | |
| JP3759742B2 (en) | Data processing device | |
| JP2000207210A (en) | Microprocessor | |
| JP2004295914A (en) | Data processing device | |
| JP3740321B2 (en) | Data processing device | |
| US6128725A (en) | Microprocessor with an instruction for setting or clearing a bit field | |
| JPH08263290A (en) | Data processing device | |
| JP4545777B2 (en) | Data processing device | |
| US5784634A (en) | Pipelined CPU with instruction fetch, execution and write back stages | |
| JP4382076B2 (en) | Data processing device | |
| JP3760093B2 (en) | Microcomputer | |
| JP3839835B2 (en) | Data processing apparatus and microcomputer |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20060404 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20060602 |
|
| A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20060627 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20060828 |
|
| A911 | Transfer to examiner for re-examination before appeal (zenchi) |
Free format text: JAPANESE INTERMEDIATE CODE: A911 Effective date: 20060904 |
|
| A912 | Re-examination (zenchi) completed and case transferred to appeal board |
Free format text: JAPANESE INTERMEDIATE CODE: A912 Effective date: 20061027 |