JPH05108542A - Data processor - Google Patents

Data processor

Info

Publication number
JPH05108542A
JPH05108542A JP3267434A JP26743491A JPH05108542A JP H05108542 A JPH05108542 A JP H05108542A JP 3267434 A JP3267434 A JP 3267434A JP 26743491 A JP26743491 A JP 26743491A JP H05108542 A JPH05108542 A JP H05108542A
Authority
JP
Japan
Prior art keywords
instruction
bit
register
state
contents
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
Application number
JP3267434A
Other languages
Japanese (ja)
Inventor
Naomiki Mitsuishi
直幹 三ツ石
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hitachi Ltd
Original Assignee
Hitachi Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP3267434A priority Critical patent/JPH05108542A/en
Publication of JPH05108542A publication Critical patent/JPH05108542A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To recognize a bit state easily in comparison with a conventional system due to plural instructions by providing an instruction exclusive for inspecting the state of a bit not depending on a data processed result in a control register. CONSTITUTION:This device is equipped with means to interrupt a processing under executing according to a prescribed signal, means to save the contents of a prescribed register to an external storage device in the case of this interruption and means to recover the saved contents into the source register according to a prescribed instruction. Namely, at a microcomputer equipped with the control register to be saved in the case of executing the interruption processing and to be recovered by a return instruction, the exclusive instruction is provided to inspect the state of the bit not depending on the data processed result in the control register. Thus, the state of the bit not depending on the data processed result in the control register, which is saved in the case of executing the interruption processing and recovered by the return instruction, can be inspected with one instruction, and the state of the bit can be easily recognized.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、データ処理技術さらに
はマイクロコンピュータの命令形式に適用して特に有効
な技術に関し、例えばマイクロコンピュータ内の制御レ
ジスタのビット検査命令に利用して有効な技術に関する
ものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a data processing technique, and more particularly to a technique which is particularly effective when applied to an instruction format of a microcomputer, for example, a technique which is effectively used for a bit check instruction of a control register in a microcomputer. It is a thing.

【0002】[0002]

【従来の技術】マイクロコンピュータの中央処理装置
(CPU)は、一般に汎用レジスタやアキュムレータあ
るいはインデックスレジスタなどと呼ばれるデータレジ
スタまたはアドレスレジスタと、プログラムカウンタや
コンディションコードレジスタ等の制御レジスタを備え
ている。上記各種レジスタのうちコンディションコード
レジスタは、CPUのデータ処理の結果を反映するフラ
グからなり、例えば、ゼロフラグ、ネガティブフラグ、
キャリーフラグ、オーバフローフラグ等を含む。このう
ち、例えばキャリーフラグはCPUが加算を行なった時
にキャリーが発生すれば“1”にセットされ、キャリー
発生しなければ“0”にクリアされるものである。
2. Description of the Related Art A central processing unit (CPU) of a microcomputer is provided with a data register or address register generally called a general purpose register, an accumulator or an index register, and a control register such as a program counter or a condition code register. The condition code register among the above-mentioned various registers is composed of a flag that reflects the result of the data processing of the CPU, such as a zero flag, a negative flag,
Includes carry flag, overflow flag, etc. Of these, for example, the carry flag is set to "1" if a carry occurs when the CPU performs addition, and is cleared to "0" if a carry does not occur.

【0003】また、マイクロコンピュータはCPUの処
理とは独立の外部要因または内蔵の機能ブロックの動作
が発生したときに、CPUの処理を一時中断して、前記
外部要因または機能ブロックの動作に対応した処理を行
なわしめる、いわゆる割込み機能を持っている。このよ
うな割込み処理をCPUが実行すると、プログラムカウ
ンタやコンディションコードレジスタの内容がCPUの
外部、いわゆるスタック領域に退避される。また、前記
割込み処理の実行が終了し、いわゆるリターン命令を実
行してCPUの処理が割込み処理前の状態に復帰する
と、前記退避されたプログラムカウンタやコンディショ
ンコードレジスタの内容が回復される。
When an external factor independent of the processing of the CPU or an operation of a built-in functional block occurs, the microcomputer temporarily suspends the processing of the CPU to cope with the operation of the external factor or the functional block. It has a so-called interrupt function to perform processing. When the CPU executes such interrupt processing, the contents of the program counter and the condition code register are saved outside the CPU, that is, in a so-called stack area. Further, when the execution of the interrupt processing is completed and a so-called return instruction is executed and the processing of the CPU returns to the state before the interrupt processing, the contents of the saved program counter and condition code register are restored.

【0004】図5に従来のマイクロコンピュータにおけ
るCPUのレジスタ構成例を示す。このCPUは8ビッ
ト構成の汎用レジスタ16本と、16ビット構成のプロ
グラムカウンタ、8ビット構成のコンディションコード
レジスタを含む。コンディションコードレジスタには前
記ゼロフラグ(Z)、ネガティブフラグ(N)、キャリ
ーフラグ(C)、オーバフローフラグ(V)の他に、割
込みマスクビット(I)と3ビットのユーザビット(U
0、U1、U2)が含まれる。割込みマスクビットは
“1”にセットすると割込みが禁止され、“0”にクリ
アすると割込みが許可される。また、割込み処理を実行
すると割込みマスクビットは“1”にセットされる。コ
ンディションコードレジスタは前記の通り、CPUによ
るデータ処理の結果の反映、割込み処理の実行によって
変化するほか、コンディションコードレジスタ自身に対
する論理演算によっても変化する。また、コンディショ
ンコードレジスタと汎用レジスタの間でデータ転送を行
うことができ、ソフトウェアプログラムによって操作す
ることができる。
FIG. 5 shows an example of a register configuration of a CPU in a conventional microcomputer. This CPU includes 16 general-purpose registers having 8 bits, a program counter having 16 bits, and a condition code register having 8 bits. In the condition code register, in addition to the zero flag (Z), negative flag (N), carry flag (C) and overflow flag (V), an interrupt mask bit (I) and 3 user bits (U
0, U1, U2) are included. The interrupt mask bit is set to "1" to disable the interrupt, and cleared to "0" to enable the interrupt. When the interrupt process is executed, the interrupt mask bit is set to "1". As described above, the condition code register changes due to the reflection of the result of data processing by the CPU, execution of interrupt processing, and also due to the logical operation on the condition code register itself. Further, data can be transferred between the condition code register and the general-purpose register, and can be operated by a software program.

【0005】一方、3ビットのユーザビット(U0、U
1、U2)はデータ処理の結果の反映や割込み処理の実
行によっては変化せず、ソフトウェアプログラムによっ
てのみ変化する。また、ユーザビットは割込み処理実行
時に、自動的に退避される特性をもっており、プログラ
ムの実行状態の表示などに使用できる。例えば、オペレ
ーティングシステム(OS)を構成する場合、OSのプ
ログラムを実行しているか、ユーザプログラムを実行し
ているかの表示にユーザビットを使用することができ
る。特に制限はされないものの、OSのプログラムを実
行していればユーザビットのうち、ビットU0を“1”
にセットし、ユーザプログラムを実行していればユーザ
ビットU0を“0”にクリアするようにする。これによ
って、割込みによってOSのプログラムの実行を中断し
てユーザプログラムを実行した場合、割込み処理中にユ
ーザプログラムを実行し、前記ユーザビットU0を書き
換え、“0”にクリアしても、リターン命令の実行によ
ってユーザビットの元の状態“1”が回復され、OSの
プログラムの実行を再開させることができる否かの判定
に利用することができる。かかるCPUは、(株)日立
製作所、平成元年6月発行『H8/330 HD647
3308 HD6433308 ハードウェアマニュア
ル』に記載されている。
On the other hand, 3 user bits (U0, U
1, U2) does not change depending on the reflection of the result of the data processing or the execution of the interrupt processing, but only by the software program. Further, the user bit has a characteristic that it is automatically saved when the interrupt processing is executed, and can be used for displaying the execution state of the program. For example, when configuring an operating system (OS), a user bit can be used to indicate whether an OS program is running or a user program is running. Although not particularly limited, if the OS program is running, the bit U0 of the user bits is set to "1".
And the user bit U0 is cleared to "0" if the user program is being executed. As a result, even if the execution of the OS program is interrupted by the interrupt and the user program is executed, even if the user program is executed during the interrupt process to rewrite the user bit U0 and clear it to "0", the return instruction The original state "1" of the user bit is restored by the execution, and can be used for determining whether or not the execution of the OS program can be resumed. Such CPU is “H8 / 330 HD647” issued by Hitachi, Ltd. in June 1989.
3308 HD64333308 Hardware Manual ”.

【0006】[0006]

【発明が解決しようとする課題】しかしながら前記CP
Uにおいては、ユーザビットが“1”であるか“0”で
あるかの判定は、一旦コンディションコードレジスタの
全体を汎用レジスタに転送して、転送されたユーザビッ
トを、いわゆるビットテスト命令で判定し、その判定結
果で処理するプログラムを変更するような場合、分岐命
令をさらに使用しなければならなかった。このような処
理についてのプログラム例を以下に示す。 STC CCR,R0L BTST #4,R0L BEQ L1 (OSのプログラム) L1: (ユーザプログラム)
However, the above-mentioned CP
In U, whether the user bit is "1" or "0" is determined by temporarily transferring the entire condition code register to a general-purpose register and determining the transferred user bit by a so-called bit test instruction. However, if the program to be processed is changed based on the determination result, the branch instruction must be further used. A program example for such processing is shown below. STC CCR, R0L BTST # 4, R0L BEQ L1 (OS program) L1: (User program)

【0007】上記プログラムは、3つの命令を使用して
おり実行される処理内容に比較して煩雑で、実行効率が
非常に悪い。また、その内容も分かり難いという問題点
がある。本発明の目的は、割込み処理実行時に退避さ
れ、リターン命令によって回復される制御レジスタ内の
データ処理結果に依存しないビットの状態を簡単に検査
することのできるデータ処理技術を提供することにあ
る。この発明の前記ならびにそのほかの目的と新規な特
徴については、本明細書の記述および添附図面から明ら
かになるであろう。
The above program uses three instructions and is complicated as compared with the processing contents to be executed, and its execution efficiency is very poor. In addition, there is a problem that the content is difficult to understand. It is an object of the present invention to provide a data processing technique capable of easily inspecting the state of a bit that is saved during execution of interrupt processing and that is restored by a return instruction and that does not depend on the data processing result. The above and other objects and novel features of the present invention will be apparent from the description of this specification and the accompanying drawings.

【0008】[0008]

【課題を解決するための手段】本願において開示される
発明のうち代表的なものの概要を説明すれば、下記のと
おりである。すなわち、割込み処理実行時に退避され、
リターン命令によって回復される制御レジスタを備えた
マイクロコンピュータにおいて、制御レジスタ内のデー
タ処理結果に依存しないビットの状態を検査する専用の
命令を設けるようにしたものである。
The typical ones of the inventions disclosed in the present application will be outlined below. That is, it is saved when interrupt processing is executed,
In a microcomputer provided with a control register which is restored by a return instruction, a dedicated instruction for inspecting the state of a bit that does not depend on the data processing result in the control register is provided.

【0009】[0009]

【作用】上記した手段によれば、割込み処理実行時に退
避し、リターン命令によって回復される制御レジスタ内
のデータ処理結果に依存しないビットの状態を1命令で
検査することができ、複数命令によってその状態を検査
する従来方式に比べて簡単にビット状態を知ることがで
きるようになる。
According to the above-mentioned means, the state of the bit saved in the execution of the interrupt processing and recovered by the return instruction and not depending on the data processing result in the control register can be inspected by one instruction. The bit state can be known more easily than the conventional method of checking the state.

【0010】[0010]

【実施例】図4には本発明を適用して好適なマイクロコ
ンピュータのCPUのブロック図が示されている。すな
わち、CPUは汎用レジスタやアキュムレータあるいは
インデックスレジスタなどと呼ばれるデータレジスタま
たはアドレスレジスタと、プログラムカウンタやコンデ
ィションコードレジスタ等の制御レジスタ等からなるレ
ジスタ群REGと、加減算や論理演算などを行なう算術
論理ユニットALUと、データバスDBを介して外部の
プログラムメモリから読み込まれた命令をフェッチする
命令レジスタIRと、フェッチされた命令をデコードし
て上記算術論理ユニットALU等の制御信号を形成する
制御部CONTと、外部データバスDBおよびアドレス
バスABと内部バスIDB1,IDB2間に設けられた
データ入出力バッファDIBF,DOBFおよびアドレ
スバッファABFとから構成されている。
DESCRIPTION OF THE PREFERRED EMBODIMENTS FIG. 4 shows a block diagram of a CPU of a microcomputer suitable for application of the present invention. That is, the CPU includes a data register or address register called a general-purpose register, an accumulator or an index register, a register group REG including control registers such as a program counter and a condition code register, and an arithmetic logic unit ALU for performing addition / subtraction and logical operation. An instruction register IR for fetching an instruction read from an external program memory via the data bus DB; a control unit CONT for decoding the fetched instruction to form a control signal for the arithmetic logic unit ALU or the like; It is composed of external data bus DB and address bus AB and data input / output buffers DIBF and DOBF and address buffer ABF provided between internal buses IDB1 and IDB2.

【0011】上記レジスタ群REG内のレジスタ構成お
よびその中のコンディションコードレジスタのビット構
成は図5に示されているものと同一である。また、本実
施例のCPUは、上記コンディションコードレジスタ内
のユーザビットU0,U1,U2の状態を検査する専用
の命令(以下、ユーザビット検査命令と称する)を解読
し実行する機能を備えている。なお、特に制限はされな
いものの、データバスが16ビットで構成されており、
16ビットのデータを2ステートでリード/ライト可能
とし、いわゆる命令の先取り制御を行なうように構成さ
れている。
The register structure in the register group REG and the bit structure of the condition code register therein are the same as those shown in FIG. Further, the CPU of this embodiment has a function of decoding and executing a dedicated instruction (hereinafter referred to as a user bit check instruction) for checking the states of the user bits U0, U1, U2 in the condition code register. .. Although not particularly limited, the data bus is composed of 16 bits,
16-bit data can be read / written in two states and so-called instruction prefetch control is performed.

【0012】図1には上記ユーザビット検査命令のフロ
ーチャートの一例が示されている。特に制限はされない
ものの、本命令を TSTUn n=0、1、2 と表記する。例えば、TSTU0命令はユーザビットU
0を検査してU0ビットが0であればゼロフラグを1に
セットし、U0ビットが1であればゼロフラグを0にク
リアするものである。この命令はコンディションコード
レジスタのゼロフラグ以外の内容には影響せず、また、
汎用レジスタの内容にも影響しない。命令長は2バイト
とされる。
FIG. 1 shows an example of a flow chart of the user bit check instruction. Although not particularly limited, this instruction is expressed as TSTUn n = 0, 1, 2. For example, the TSTU0 instruction is user bit U
When 0 is checked and the U0 bit is 0, the zero flag is set to 1, and when the U0 bit is 1, the zero flag is cleared to 0. This instruction does not affect the contents other than the zero flag of the condition code register, and
It does not affect the contents of general registers. The instruction length is 2 bytes.

【0013】このTSTUn命令が実行されると、第1
ステップS11でデータバスDB上のデータ(次の命
令)をCPU内部に取り込む。同時にプログラムカウン
タPCの内容を第1の内部バスIDB1を経由してアド
レスバッファABFと算術論理演算器ALUに転送す
る。算術論理演算器ALUではプログラムカウンタPC
の内容に「2」を加算し、第2の内部バスIDB2を経
由してプログラムカウンタPCに加算結果を格納する。
第2ステップS12で、前記アドレスバッファABFに
格納したプログラムカウンタPCの内容に基づいて命令
のリードを開始する。同時に第1ステップS11で格納
した次の命令の解読を開始する。さらに、コンディショ
ンコードレジスタの内容を第1の内部バスIDB1を経
由してアドレスバッファABFと算術論理演算器ALU
に転送する。
When this TSTUn instruction is executed, the first
In step S11, the data (next instruction) on the data bus DB is loaded into the CPU. At the same time, the contents of the program counter PC are transferred to the address buffer ABF and the arithmetic logic unit ALU via the first internal bus IDB1. Program counter PC for arithmetic logic unit ALU
"2" is added to the contents of, and the addition result is stored in the program counter PC via the second internal bus IDB2.
In the second step S12, the reading of the instruction is started based on the contents of the program counter PC stored in the address buffer ABF. At the same time, the decoding of the next instruction stored in the first step S11 is started. Further, the contents of the condition code register are transferred via the first internal bus IDB1 to the address buffer ABF and the arithmetic logic unit ALU.
Transfer to.

【0014】特に制限はされないものの、TSTU0命
令ではコンディションコードレジスタのビット4(ユー
ザビットU0)値を検査し、TSTU1命令ではコンデ
ィションコードレジスタのビット5(ユーザビットU
1)値を検査し、TSTU2では、命令ではコンディシ
ョンコードレジスタのビット6(ユーザビットU2)値
を検査する。具体的には、TSTU0命令では算術論理
演算器内部でデータH’10(=B’0001000
0;H’は16進数を、B’は2進数を示す)を発生し
て、前記第1の内部バスから入力されたデータとの論理
積をとり、結果がH’00であるか否か判定すればよ
い。この判定結果によってコンディションコードレジス
タ内のゼロフラグの値を変化させるようになっている。
このゼロフラグを調べて分岐するか否か判定すればよ
い。なお、TSTU1命令では算術論理演算器内部でデ
ータH’20を、TSTU2命令では算術論理演算器内
部でデータH’40をそれぞれ発生する。
Although not particularly limited, the TSTU0 instruction inspects the value 4 (user bit U0) of the condition code register and the TSTU1 instruction inspects bit 5 (user bit U) of the condition code register.
1) Check the value, and in TSTU2, the instruction checks the bit 6 (user bit U2) value of the condition code register. Specifically, in the TSTU0 instruction, the data H'10 (= B'0001000) is stored inside the arithmetic logic unit.
0; H'represents a hexadecimal number and B'represents a binary number), and is ANDed with the data input from the first internal bus to determine whether the result is H'00. Just make a decision. The value of the zero flag in the condition code register is changed according to the result of this judgment.
The zero flag may be checked to determine whether to branch. Note that the TSTU1 instruction generates data H'20 inside the arithmetic logic unit, and the TSTU2 instruction generates data H'40 inside the arithmetic logic unit.

【0015】図2には、コンディションコードレジスタ
のユーザビットの状態を検査する他の命令のフローチャ
ート例が示されている。特に制限はされないものの、本
命令を LDUn n=0、1、2 と表記する。例えば、LDU0命令はユーザビットU0
の内容をキャリーフラグに反映させるものである。コン
ディションコードレジスタのキャリーフラグ以外の内容
には影響せず、また、汎用レジスタの内容にも影響しな
い。
FIG. 2 shows an example of a flowchart of another instruction for checking the state of the user bit of the condition code register. Although not particularly limited, this instruction is expressed as LDUn n = 0, 1, 2. For example, the LDU0 instruction is user bit U0
The content of is reflected in the carry flag. It does not affect the contents other than the carry flag of the condition code register, nor does it affect the contents of the general-purpose register.

【0016】このLDUn命令が実行されると、第1ス
テップS21でデータバス上のデータ(次の命令)をC
PU内部に取り込む。同時にプログラムカウンタPCの
内容を第1の内部バスIDB1を経由してアドレスバッ
ファABFと算術論理演算器ALUに転送する。算術論
理演算器ALUでは「2」を加算し、第2の内部バスI
DB2を経由してプログラムカウンタPCに加算結果を
格納する。第2ステップS22で、前記アドレスバッフ
ァABFに格納したプログラムカウンタPCの内容に基
づいて命令のリードを開始する。同時にコンディション
コードレジスタの内容を第1の内部バスIDB1を経由
してアドレスバッフABFと算術論理演算器ALUに転
送する。算術論理演算器ALUでは、前記と同様に、L
DU0命令、LDU1命令、LDU2命令により、それ
ぞれ、コンディションコードレジスタのビット4、5、
6の値を検査する。この判定結果によってキャリーフラ
グの値が変化される。但し、前記ゼロフラグとは反転し
たデータをキャリーフラグに格納する。
When this LDUn instruction is executed, the data (next instruction) on the data bus is transferred to C in the first step S21.
Take in the PU. At the same time, the contents of the program counter PC are transferred to the address buffer ABF and the arithmetic logic unit ALU via the first internal bus IDB1. The arithmetic logic unit ALU adds "2" to the second internal bus I
The addition result is stored in the program counter PC via DB2. In the second step S22, reading of an instruction is started based on the contents of the program counter PC stored in the address buffer ABF. At the same time, the contents of the condition code register are transferred to the address buffer ABF and the arithmetic and logic unit ALU via the first internal bus IDB1. In the arithmetic logic unit ALU, L
The DU0 instruction, LDU1 instruction, and LDU2 instruction respectively cause bits 4, 5 of the condition code register,
Check the value of 6. The value of the carry flag is changed according to this determination result. However, data inverted from the zero flag is stored in the carry flag.

【0017】図3には、コンディションコードのユーザ
ビットの状態を検査し、さらにその結果によって分岐を
行う命令のフローチャートが示されている。特に制限は
されないものの、本命令を BUCn 相対値 BUSn 相対値 n=0、1、2 と表記する。例えば、BUC0 100 命令はU0ビ
ットの状態を検査した結果が“0”であれば、本命令の
次の番地命令の存在する番地に相対値100を加えた番
地に分岐し、U0ビットが“1”であれば次の番地の命
令を実行するものである。また、BUS0 −10 命
令はU0ビットが“1”であれば、本命令の存在する番
地から相対値10を引いた番地に分岐し、U0ビットが
“0”であれば次の番地の命令を実行するものである。
いずれも、コンディションコードレジスタ内の他のビッ
トには影響を与えず、また、汎用レジスタの内容にも影
響しない。
FIG. 3 shows a flowchart of an instruction for checking the state of the user bit of the condition code and branching according to the result. Although not particularly limited, this instruction is expressed as BUCn relative value BUSn relative value n = 0, 1, 2. For example, if the result of checking the state of the U0 bit is "0", the BUC0 100 instruction branches to the address where the relative address 100 is added to the address where the next address instruction of this instruction exists, and the U0 bit is "1". If it is ", the instruction at the next address is executed. If the U0 bit is "1", the BUS0-10 instruction branches to an address obtained by subtracting the relative value 10 from the address where this instruction exists, and if the U0 bit is "0", the instruction at the next address is executed. Is what you do.
Neither affects the other bits in the condition code register, nor does it affect the contents of the general purpose register.

【0018】前記BUCn命令は、命令コード中に相対
値16ビットを含み、4バイト長とする。この命令が実
行されると、まず第1ステップS31でデータバスDB
上のデータ(相対値16ビット)をCPU内部に取り込
む。同時にコンディションコードレジスタの内容を第1
の内部バスIDB1を経由してアドレスバッファABF
と算術論理演算器ALUに転送する。算術論理演算器A
LUは、前記と同様に、BUC0ではコンディションコ
ードレジスタのビット4(U0)を、BUC1ではビッ
ト5(U1)を、BUC2ではビット6(U2)の値を
それぞれ検査する。第2ステップS32では、前記検査
結果であるゼロ検出回路の出力が“1”であれば、プロ
グラムカウンタPCの内容を第1の内部バスIDB1を
経由して算術論理演算器ALUに転送する。そして、第
1ステップで格納した相対値を第2の内部バスIDB2
を経由して算術論理演算器ALUに転送し加算する。加
算結果は第3の内部バスIDB3を経由してプログラム
カウンタPCに格納する。一方、前記検査結果であるゼ
ロ検出回路の出力が“0”であれば、プログラムカウン
タPCの内容を第1の内部バスIDB1を経由して算術
論理演算器ALUに転送させ、前記相対値の加算結果の
格納は行なわない。
The BUCn instruction has a relative value of 16 bits in the instruction code and has a length of 4 bytes. When this instruction is executed, first, in the first step S31, the data bus DB
The above data (relative value 16 bits) is loaded into the CPU. At the same time, set the contents of the condition code register to the first
Address buffer ABF via internal bus IDB1 of
To the arithmetic logic unit ALU. Arithmetic logic operation unit A
The LU inspects the value of bit 4 (U0) of the condition code register in BUC0, the bit 5 (U1) in BUC1, and the value of bit 6 (U2) in BUC2 in the same manner as described above. In the second step S32, if the output of the zero detection circuit which is the check result is "1", the contents of the program counter PC are transferred to the arithmetic logic unit ALU via the first internal bus IDB1. Then, the relative value stored in the first step is used as the second internal bus IDB2.
Is transferred to the arithmetic and logic unit ALU and added. The addition result is stored in the program counter PC via the third internal bus IDB3. On the other hand, if the output of the zero detection circuit, which is the inspection result, is "0", the contents of the program counter PC are transferred to the arithmetic logic unit ALU via the first internal bus IDB1 and the relative value is added. The result is not stored.

【0019】第3ステップS33では、プログラムカウ
ンタPCの内容を第1の内部バスIDB1を経由してア
ドレスバッファABFと算術論理演算器ALUに転送す
る。U0ビットが“1”であれば次の番地、U0ビット
が“0”であれば分岐先の番地が転送されることにな
る。算術論理演算器ALUでは「2」を加算し、第2の
内部バスIDB2を経由してプログラムカウンタPCに
加算結果を格納する。第4ステップS34では、前記ア
ドレスバッファABFに格納したプログラムカウンタP
Cの内容に基づいて命令のリードを開始する。第5ステ
ップS35ではデータバスDB上のデータをCPU内部
に取り込むとともに、プログラムカウンタPCの内容を
第1の内部バスIDB1を経由してアドレスバッファA
BFと算術論理演算器ALUに転送する。算術論理演算
器ALUでは「2」を加算し、結果を第2の内部バスI
DB2を経由してプログラムカウンタPCに格納する。
第6ステップS36では、前記アドレスバッファABF
に格納したプログラムカウンタPCの内容に基づいて命
令のリードを開始する。同時に第5ステップS35で格
納した命令の解読を開始する。
In the third step S33, the contents of the program counter PC are transferred to the address buffer ABF and the arithmetic logic unit ALU via the first internal bus IDB1. If the U0 bit is "1", the next address is transferred, and if the U0 bit is "0", the branch destination address is transferred. The arithmetic logic unit ALU adds "2" and stores the addition result in the program counter PC via the second internal bus IDB2. In the fourth step S34, the program counter P stored in the address buffer ABF is stored.
The instruction read is started based on the contents of C. In the fifth step S35, the data on the data bus DB is fetched into the CPU, and the contents of the program counter PC are transferred to the address buffer A via the first internal bus IDB1.
Transfer to BF and arithmetic logic unit ALU. The arithmetic logic unit ALU adds "2" and outputs the result to the second internal bus I.
Stored in the program counter PC via DB2.
In the sixth step S36, the address buffer ABF is
The instruction reading is started based on the contents of the program counter PC stored in. At the same time, the decoding of the instruction stored in the fifth step S35 is started.

【0020】図6には、上記ユーザビット検査命令TS
TUn,LDUnを実行するのに好適な算術論理演算器
ALUとコンディションコードレジスタの1部分の具体
的構成例が示されている。算術論理演算器ALUは、ビ
ットデータ発生回路BDG、演算回路LOC、ゼロ検出
回路ZDCとから構成される。演算回路LOCには第1
・第2の内部バスIDB1,IDB2上のデータとビッ
トデータ発生回路BDGの出力が入力され、第3の内部
バスIDB3に出力が可能とされている。ビットデータ
発生回路BDGは制御部から入力された3本の信号に基
づいて、H’01(=B’00000001)〜H’8
0(=B’10000000)のデータを発生する。F
zはゼロフラグ、Fcはキャリーフラグである。
FIG. 6 shows the user bit check instruction TS.
A specific configuration example of a part of the arithmetic and logic unit ALU and the condition code register suitable for executing TUn and LDUn is shown. The arithmetic logic operation unit ALU includes a bit data generation circuit BDG, an operation circuit LOC, and a zero detection circuit ZDC. The arithmetic circuit LOC has a first
The data on the second internal buses IDB1 and IDB2 and the output of the bit data generation circuit BDG are input and can be output to the third internal bus IDB3. The bit data generation circuit BDG uses H'01 (= B'00000001) to H'8 based on the three signals input from the control unit.
Data of 0 (= B'10000000) is generated. F
z is a zero flag and Fc is a carry flag.

【0021】なお、演算回路LOCには第2の内部バス
IDB2とビットデータ発生回路BDGの出力のいずれ
か一方が入力される。例えば、加算命令では第2の内部
バスIDB2上のデータを入力し、前記TSTUn命令
ではビットデータ発生回路BDGの出力を入力する。ゼ
ロ検出回路ZDCは演算回路LOCの出力を入力し、ア
ンド論理ゲートによって入力値が全ビット0であるか判
定し、全ビット0であれば“1”を出力する。特に制限
はされないものの、この実施例では、内部バスが負論理
とされている。第1・第2の内部バスIDB1,IDB
2はシステムクロックφがハイレベルの期間にPチャネ
ル型MOSFETからなるプリチャージトランジスタに
よってハイレベル(“0”レベル)にプリチャージされ
る。
Either the second internal bus IDB2 or the output of the bit data generating circuit BDG is input to the arithmetic circuit LOC. For example, the add instruction inputs data on the second internal bus IDB2, and the TSTUn instruction inputs the output of the bit data generation circuit BDG. The zero detection circuit ZDC receives the output of the arithmetic circuit LOC, determines whether the input value is all bits 0 by an AND logic gate, and outputs "1" if all bits are 0. Although not particularly limited, in this embodiment, the internal bus is negative logic. First and second internal buses IDB1 and IDB
2 is precharged to a high level (“0” level) by a precharge transistor composed of a P-channel MOSFET while the system clock φ is at a high level.

【0022】次に、図6の回路において、前記TSTU
0命令が実行されるとその第2ステップでは、 制御信号CR1を“1”レベルとし、コンディション
コードレジスタの内容を第1の内部バスIDB1に出力
する。 制御信号A1を“1”レベルとし、ビットデータ発生
回路DBGの出力を演算回路LOCに入力する。 制御信号B0〜2によってビットデータ発生回路BD
GにH’10の発生を指示する。 制御信号C0〜2によって論理積演算を指示する。 制御信号CZ0を“1”レベルとして、ゼロ検出回路
ZDCの出力をゼロフラグFzに入力する。 以上の動作によってコンディションコードレジスタのビ
ット4の内容をゼロフラグFzに反映することができ
る。
Next, in the circuit of FIG.
When the 0 instruction is executed, in the second step, the control signal CR1 is set to "1" level, and the content of the condition code register is output to the first internal bus IDB1. The control signal A1 is set to "1" level, and the output of the bit data generation circuit DBG is input to the arithmetic circuit LOC. Bit data generation circuit BD according to control signals B0 to 2
Instruct G to generate H'10. The logical product calculation is instructed by the control signals C0 to C2. The control signal CZ0 is set to "1" level, and the output of the zero detection circuit ZDC is input to the zero flag Fz. By the above operation, the contents of bit 4 of the condition code register can be reflected in the zero flag Fz.

【0023】同様に前記LDU0命令が実行されると、
その第2ステップでは、 制御信号CR1を“1”レベルとし、コンディション
コードレジスタの内容を第1の内部バスIDB1に出力
する。 制御信号A1を“1”レベルとし、ビットデータ発生
回路BDGの出力を演算回路LOCに入力する。 制御信号B0〜2によってビットデータ発生回路BD
GにH’10の発生を指示する。 制御信号C0〜2によって論理積演算を指示する。 制御信号CC1を“1”レベルとして、ゼロ検出回路
ZDCの出力の反転信号をキャリーフラグFcに入力す
る。 以上の動作によってコンディションコードレジスタのビ
ット4の内容をキャリフラグFcに反映させることがで
きる。
Similarly, when the LDU0 instruction is executed,
In the second step, the control signal CR1 is set to "1" level, and the content of the condition code register is output to the first internal bus IDB1. The control signal A1 is set to "1" level, and the output of the bit data generation circuit BDG is input to the arithmetic circuit LOC. Bit data generation circuit BD according to control signals B0 to 2
Instruct G to generate H'10. The logical product calculation is instructed by the control signals C0 to C2. The control signal CC1 is set to "1" level, and the inverted signal of the output of the zero detection circuit ZDC is input to the carry flag Fc. By the above operation, the contents of bit 4 of the condition code register can be reflected in the carry flag Fc.

【0024】図7には上記BUCn命令およびBUSn
命令を実行するのに好適なプログラムカウンタPCと算
術論理演算器ALUの具体的構成例が示されている。プ
ログラムカウンタPCは第3の内部バスIDB3からの
入力が可能とされる。BUCn、BUSn命令の第2ス
テップ以外に第3の内部バスIDB3からデータの入力
を行なう場合には制御信号PW0が“1”レベルとされ
る。BUCn、BUSn命令の第2ステップでは制御信
号PW1が“1”レベルとされ、前記ゼロ検出回路の出
力をいわゆるシフトレジスタで1ステップ遅延させた内
容に基づいて、第3の内部バスIDB3からデータの入
力を行なうか行なわないかを選択する。同時にBUSn
命令では制御信号ZNが“1”レベルとされ、ゼロ検出
の結果を反転する。
FIG. 7 shows the BUCn instruction and BUSn.
A concrete configuration example of a program counter PC and an arithmetic logic unit ALU suitable for executing instructions is shown. The program counter PC can be input from the third internal bus IDB3. When data is input from the third internal bus IDB3 other than the second step of the BUCn and BUSn instructions, the control signal PW0 is set to "1" level. At the second step of the BUCn and BUSn instructions, the control signal PW1 is set to "1" level, and the data of the third internal bus IDB3 is transferred based on the contents of the output of the zero detection circuit delayed by one step by a so-called shift register. Select whether to input or not. BUSn at the same time
In the command, the control signal ZN is set to "1" level, and the result of zero detection is inverted.

【0025】図8には上記ユーザビット検査命令TST
Un,LDUnを実行するのに好適な算術論理演算器A
LUとコンディションコードレジスタの他の具体的構成
例が示されている。前記ビットデータ発生回路BDGの
出力とコンディションコードレジスタのビット4〜6の
内容が、アンド論理ゲートGaとノア論理ゲートGnと
からなる検査回路DTCに入力されている。ビットデー
タ発生回路BDGの出力が“1”となったビットに対応
するコンディションコードレジスタのビット4〜6の内
容が“1”であれば、かかるビットのアンド論理ゲート
Gaの出力が“1”となり、ノア論理ゲートGnの出力
が“0”レベルとなる。その他は図6の回路と同様であ
り、検査結果がゼロフラグFzに反映されるように構成
されている。
FIG. 8 shows the user bit check instruction TST.
Arithmetic and logic unit A suitable for executing Un and LDUn
Another specific configuration example of the LU and the condition code register is shown. The output of the bit data generation circuit BDG and the contents of bits 4 to 6 of the condition code register are input to the inspection circuit DTC composed of an AND logic gate Ga and a NOR logic gate Gn. If the contents of bits 4 to 6 of the condition code register corresponding to the bit for which the output of the bit data generation circuit BDG has become "1" are "1", the output of the AND logic gate Ga for that bit becomes "1". , The output of the NOR logic gate Gn becomes "0" level. Others are the same as the circuit of FIG. 6, and the inspection result is reflected in the zero flag Fz.

【0026】図8の回路において、前記TSTU0命令
が実行されると、第2ステップでは、 制御信号B0〜2によってビットデータ発生回路BD
GにH’10の発生を指示する。 制御信号CZ0を“1”レベルとして、前記検査回路
DTCの出力をゼロフラグFzに入力する。 以上の動作によってコンディションコードレジスタのビ
ット4の内容をゼロフラグFzに反映することができ
る。
In the circuit of FIG. 8, when the TSTU0 instruction is executed, in the second step, the bit data generating circuit BD is generated by the control signals B0-2.
Instruct G to generate H'10. The control signal CZ0 is set to "1" level, and the output of the inspection circuit DTC is input to the zero flag Fz. By the above operation, the contents of bit 4 of the condition code register can be reflected in the zero flag Fz.

【0027】同様に図8の回路においてノア論理ゲート
Gnの出力を反転してゼロフラグFzの代わりにキャリ
ーフラグに入れるように構成しても良い。このような回
路において、前記LDU0命令が実行されると、第2ス
テップで、 制御信号B0〜2によってビットデータ発生回路BD
GにH’10の発生を指示する。 制御信号CC1を“1”レベルとして、検査回路DT
Cの出力の反転をキャリーフラグFcに入力する。 以上の動作によってコンディションコードレジスタのビ
ット4の内容をキャリフラグFcに反映することができ
る。
Similarly, in the circuit of FIG. 8, the output of the NOR logic gate Gn may be inverted and put in the carry flag instead of the zero flag Fz. In such a circuit, when the LDU0 instruction is executed, in the second step, the bit data generating circuit BD is generated by the control signals B0 to B2.
Instruct G to generate H'10. The control signal CC1 is set to "1" level and the inspection circuit DT
The inversion of the output of C is input to the carry flag Fc. By the above operation, the contents of bit 4 of the condition code register can be reflected in the carry flag Fc.

【0028】上記実施例によれば、割込み処理実行時に
退避し、リターン命令によって回復され、かつデータ処
理結果に依存しないビットの状態を1命令で簡単に検査
することができるので、複数命令によってその状態を検
査する従来方式に比べてソフトウェアプログラムを単純
化して実行効率を向上できるとともに、内容を直接的に
表現できるという効果がある。以上本発明者によってな
された発明を実施例に限定されるものではなく、その要
旨を逸脱しない範囲において種々変更可能である。例え
ば、CPUのレジスタの本数・ビット数、CPUの内部
構成などについては何ら限定されない。コンディション
コードレジスタの検査方法も実施例に限定されない。ユ
ーザビットのビット数など変更可能である。また、コン
ディションコードレジスタに、ハーフキャリーフラグな
どを含めることもできる。また、実施例を相互に組合せ
ることも可能である。さらに、ユーザビットはリセット
信号が入っても影響されないように構成しておくように
しても良い。以上の説明では主として本発明者等によっ
てなされた発明をその背景となった利用分野であるマイ
クロコンピュータに適用した場合について説明したが、
それに限定されるものではなく、その他のデータ処理装
置にも適用可能である。本発明は少なくとも割込み処理
実行時/リターン時に退避/復帰が行なわれるレジスタ
を備えたデータ処理装置に広く適用することができる。
According to the above-described embodiment, the state of the bit saved during the execution of the interrupt process, restored by the return instruction, and independent of the data processing result can be easily inspected by one instruction. Compared with the conventional method of checking the state, there is an effect that the software program can be simplified to improve the execution efficiency and the contents can be directly expressed. The invention made by the present inventor is not limited to the embodiments, and various modifications can be made without departing from the spirit of the invention. For example, the number of registers and the number of bits of the CPU, the internal configuration of the CPU, and the like are not limited at all. The method of checking the condition code register is not limited to the embodiment. The number of user bits can be changed. Also, the condition code register may include a half carry flag or the like. It is also possible to combine the embodiments with each other. Further, the user bit may be configured so as not to be affected by the reset signal. In the above description, the case where the invention mainly made by the present inventors is applied to a microcomputer, which is a field of application which is the background of the invention, has been described.
The present invention is not limited to this, and can be applied to other data processing devices. INDUSTRIAL APPLICABILITY The present invention can be widely applied to at least a data processing device including a register that is saved / restored at the time of executing / returning an interrupt process.

【0029】[0029]

【発明の効果】本願において開示される発明のうち代表
的なものによって得られる効果を簡単に説明すれば下記
のとおりである。すなわち、割込み処理実行時に退避さ
れ、リターン命令によって回復される制御レジスタを備
えたマイクロコンピュータにおいて、制御レジスタ内の
データ処理結果に依存しないビットの状態を簡単に知る
ことができるようになる。
The effects obtained by the typical ones of the inventions disclosed in the present application will be briefly described as follows. That is, it becomes possible to easily know the state of the bit that does not depend on the data processing result in the control register in the microcomputer provided with the control register that is saved when the interrupt processing is executed and restored by the return instruction.

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

【図1】本発明に係るコンディションコードのユーザビ
ットの状態を検査する命令の一例を示すフローチャート
である。
FIG. 1 is a flowchart showing an example of an instruction for checking the state of a user bit of a condition code according to the present invention.

【図2】コンディションコードのユーザビットの状態を
検査する命令の他の例を示すフローチャートである。
FIG. 2 is a flowchart showing another example of an instruction for checking the state of user bits of a condition code.

【図3】コンディションコードのユーザビットの状態を
検査し、その結果によって分岐を行う命令の一例を示す
フローチャートである。
FIG. 3 is a flowchart showing an example of an instruction for checking the state of a user bit of a condition code and branching according to the result.

【図4】本発明を適用して好適なマイクロコンピュータ
のCPUの一例を示すブロック図である。
FIG. 4 is a block diagram showing an example of a CPU of a microcomputer to which the present invention is preferably applied.

【図5】CPUのレジスタ構成例を示す説明図である。FIG. 5 is an explanatory diagram showing a register configuration example of a CPU.

【図6】算術論理演算器とコンディションコードレジス
タの1部分の具体例を示す回路構成図である。
FIG. 6 is a circuit configuration diagram showing a specific example of a part of an arithmetic logic unit and a condition code register.

【図7】プログラムカウンタの1部分の具体例を示す回
路構成図である。
FIG. 7 is a circuit configuration diagram showing a specific example of a part of a program counter.

【図8】算術論理演算器とコンディションコードレジス
タの1部分の他の具体例を示す回路構成図である。
FIG. 8 is a circuit configuration diagram showing another specific example of a part of the arithmetic logic unit and the condition code register.

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

CCR コンディションコードレジスタ PC プログラムカウンタ LOC 演算回路 BDG ビットデータ発生回路 ZDC ゼロ検出回路 Fz ゼロフラグ Fc キャリーフラグ CCR condition code register PC program counter LOC operation circuit BDG bit data generation circuit ZDC zero detection circuit Fz zero flag Fc carry flag

Claims (3)

【特許請求の範囲】[Claims] 【請求項1】 装置外部からの所定の信号により実行中
の処理を中断する手段と、該中断時に所定のレジスタの
内容を外部の記憶装置に退避させる手段と、所定の命令
によって上記退避された内容を元のレジスタに回復させ
る手段とを備え、上記レジスタ内には命令によって読出
し書込み可能なビットを含み、該ビットの状態を所定の
命令によって検査可能に構成されてなることを特徴とす
るデータ処理装置。
1. A means for interrupting a process being executed by a predetermined signal from the outside of the apparatus, a means for saving the contents of a predetermined register to an external storage device at the time of the interruption, and the above-mentioned save by a predetermined instruction. Means for restoring the contents to the original register, the register includes a bit readable and writable by an instruction, and the state of the bit can be inspected by a predetermined instruction. Processing equipment.
【請求項2】 命令によって読出し書込み可能な上記ビ
ットの状態を、所定の命令によって検査しその結果に基
いて次に実行する命令を変更するように構成されている
ことを特徴とする請求項1記載のデータ処理装置。
2. The state of the bit readable and writable by an instruction is inspected by a predetermined instruction, and the instruction to be executed next is changed based on the result. The described data processing device.
【請求項3】 命令によって読出し書込み可能な上記ビ
ットの状態を検査した結果が、上記レジスタ内の所定の
ビットに反映されるように構成されていることを特徴と
する請求項1または請求項2記載のデータ処理装置。
3. The method according to claim 1, wherein a result of checking a state of the bit that can be read and written by an instruction is reflected in a predetermined bit in the register. The described data processing device.
JP3267434A 1991-10-16 1991-10-16 Data processor Pending JPH05108542A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP3267434A JPH05108542A (en) 1991-10-16 1991-10-16 Data processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP3267434A JPH05108542A (en) 1991-10-16 1991-10-16 Data processor

Publications (1)

Publication Number Publication Date
JPH05108542A true JPH05108542A (en) 1993-04-30

Family

ID=17444794

Family Applications (1)

Application Number Title Priority Date Filing Date
JP3267434A Pending JPH05108542A (en) 1991-10-16 1991-10-16 Data processor

Country Status (1)

Country Link
JP (1) JPH05108542A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2020526825A (en) * 2017-07-10 2020-08-31 エイアールエム リミテッド Testing bit values in vector elements

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2020526825A (en) * 2017-07-10 2020-08-31 エイアールエム リミテッド Testing bit values in vector elements
US11422807B2 (en) 2017-07-10 2022-08-23 Arm Limited Testing bit values inside vector elements

Similar Documents

Publication Publication Date Title
US6115808A (en) Method and apparatus for performing predicate hazard detection
US4924382A (en) Debugging microprocessor capable of switching between emulation and monitor without accessing stack area
JPH0527971A (en) Information processor
US6243806B1 (en) Program execution method and apparatus employing data flags for branching determination
US6990569B2 (en) Handling problematic events in a data processing apparatus
JPH05108542A (en) Data processor
US5421026A (en) Data processor for processing instruction after conditional branch instruction at high speed
JPH11316695A (en) Stop point interrupt generator for superscalar microprocessor
US6425047B1 (en) Process containing address decoders suited to improvements in clock speed
WO2022235265A1 (en) Debug channel for communication between a processor and an external debug host
US6233675B1 (en) Facility to allow fast execution of and, or, and test instructions
JPH02123442A (en) Accelerated memory
US20120089817A1 (en) Conditional selection of data elements
JP2525492B2 (en) Programmable controller
JPH05216721A (en) Electronic computer
US6289439B1 (en) Method, device and microprocessor for performing an XOR clear without executing an XOR instruction
JPH0248733A (en) Information processor
JP2629479B2 (en) Information processing device
JP3239042B2 (en) Microcomputer
JPH06202907A (en) Debug support device
JPH0535499A (en) Data processing device and method
JP2908117B2 (en) Vector arithmetic processing unit
JPS5875256A (en) Monitoring system for execution instruction processing state
JPH02234227A (en) Misalignment processing system
JP2001084149A (en) Interruption processing system for information processor